diff --git a/.clang-tidy b/.clang-tidy index 2747454ca09d19d0af59207f587a0b3afe36b033..e7d5a5e58c66b679eb607560b1c4073abb0f6d97 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -18,6 +18,7 @@ modernize-*, -modernize-use-auto, -modernize-use-nullptr, -modernize-pass-by-value, +-modernize-use-nodiscard, mpi-*, diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000000000000000000000000000000000..33f72ecb941c410f7541f32541a34878ff987b3f --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "name": "virtual-fluids-environment", + "extensions": [ + "mhutchie.git-graph", + "donjayamanne.githistory", + "twxs.cmake", + "ms-vscode.cpptools", + "visualstudioexptteam.vscodeintellicode", + "xaver.clang-format", + "notskm.clang-tidy", + "streetsidesoftware.code-spell-checker" + ], + "runArgs": ["--gpus","all", // remove this line in case you have no gpus available + "--hostname=${localEnv:HOSTNAME}"], // HOSTNAME needs to be known by the vscode environment. It is probably necessary to add "export HOSTNAME=<hostname>" to the config file of your host machine's bash. + + "image": "git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu20_04:1.4" +} diff --git a/.gitignore b/.gitignore index 8708a2906743e7953fd79b8277927031b1f6a32d..fbab1b2097fad956dceb05769613cb82053b27e8 100644 --- a/.gitignore +++ b/.gitignore @@ -13,12 +13,28 @@ __pycache__/ # IDE .vscode/ +.vscode-server/ .sync/ .idea/ +.ccache/ +.cache/ +.devcontainer/devcontainer.json -# Simulation results +# simulation results output/ logs/ +# grid +.grid/ + +# scripts +scripts/ + +# stl files +stl/ + # MacOS .DS_Store + +# Settings +.gitconfig \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d2423ba9dc39c9d935c1d16b971396ce7d11e789..b34c5a8f66c1340670b6acd80ea6a9901b2760d1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ ############################################################################### ## VirtualFluids CI Pipeline ## ############################################################################### -image: irmb/virtualfluids-python-deps-ubuntu20.04:latest +image: git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu20_04:1.3 stages: - build @@ -20,8 +20,6 @@ stages: .gnu_build_template: stage: build - image: irmb/virtualfluids-deps-ubuntu20.04 - tags: - gpu - linux @@ -104,11 +102,6 @@ msvc_16: - cmake .. --preset=all_msvc -DCMAKE_CUDA_ARCHITECTURES=61 -DBUILD_WARNINGS_AS_ERRORS=ON - MSBuild.exe VirtualFluids.sln /property:Configuration=$env:BUILD_CONFIGURATION /verbosity:minimal /maxcpucount:4 - cache: - key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" - paths: - - $CI_PROJECT_DIR/$env:BUILD_FOLDER/ - artifacts: expire_in: 1 hrs paths: @@ -121,8 +114,6 @@ msvc_16: gcc_9_python: stage: build_python - image: irmb/virtualfluids-python-deps-ubuntu20.04:latest - needs: ["gcc_9"] cache: @@ -149,8 +140,6 @@ gcc_9_python: build_singularity_image: stage: container_upload - image: irmb/virtualfluids-python-deps-ubuntu20.04:latest - needs: - gcc_9_python @@ -171,8 +160,6 @@ build_singularity_image: gcc_9_unit_tests: stage: test - image: irmb/virtualfluids-deps-ubuntu20.04:latest - needs: ["gcc_9"] before_script: @@ -203,8 +190,6 @@ msvc_16_unit_tests: gcc_9_python_bindings_test: stage: test - image: irmb/virtualfluids-python-deps-ubuntu20.04:latest - needs: ["gcc_9_python"] before_script: @@ -216,48 +201,6 @@ gcc_9_python_bindings_test: script: - python3 -m unittest discover -s Python -v -############################################################################### -gcc_9_python_slurm_test: - stage: test - - image: irmb/virtualfluids-python-deps-ubuntu20.04:latest - - needs: ["gcc_9_python"] - - rules: - - if: $PHOENIX_PRIVATE_KEY - - tags: - - linux - - privileged - - variables: - SSH_KEY: "$PHOENIX_PRIVATE_KEY" - HOST: "$PHOENIX_HOSTNAME" - USER: "$PHOENIX_USER" - - before_script: - - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' - - apt-get install -y rsync - - mkdir -p ~/.ssh - - chmod 700 ~/.ssh - - eval $(ssh-agent -s) - - echo "$SSH_KEY" | tr -d '\r' | ssh-add - - - echo $SSH_KEY >> ansible/private_key - - ssh-keyscan -t rsa $HOST >> ~/.ssh/known_hosts - - ssh $USER@$HOST "rm -rf output-*" - - ssh $USER@$HOST "rm -f *.out" - - pip3 install git+git://github.com/SvenMarcus/ssh-slurm-runner - - script: - - singularity build PoiseuilleTestContainer.sif Python/SlurmTests/poiseuille/PoiseuilleTestContainer.def - - scp PoiseuilleTestContainer.sif $USER@$HOST:PoiseuilleTestContainer.sif - - scp Python/SlurmTests/poiseuille/slurm.job $USER@$HOST:slurm.job - - python3 -m ssh_slurm_runner slurm.job --host $HOST --user $USER --keyfile ansible/private_key - - ssh $USER@$HOST "rm -rf output-*" - - ssh $USER@$HOST "rm -f *.out" - - ssh $USER@$HOST "rm PoiseuilleTestContainer.sif" - - ssh $USER@$HOST "rm slurm.job" ############################################################################### ## Benchmark ## @@ -281,9 +224,13 @@ nvidia_test: gpu_numerical_tests: stage: benchmark - image: irmb/virtualfluids-deps-ubuntu20.04 - - when: manual + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + when: always + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + when: never + - when: manual + allow_failure: true needs: [] @@ -309,7 +256,8 @@ gpu_numerical_tests: script: - cd $CI_PROJECT_DIR - - ./build/bin/NumericalTests $CI_PROJECT_DIR/apps/gpu/tests/NumericalTests/configK15_nu10tm2.txt 2>&1 | tee -a numerical_tests_gpu_results.txt + # - ./build/bin/NumericalTests $CI_PROJECT_DIR/apps/gpu/tests/NumericalTests/configK15_nu10tm2.txt 2>&1 | tee -a numerical_tests_gpu_results.txt + - ./build/bin/NumericalTests $CI_PROJECT_DIR/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt 2>&1 | tee -a numerical_tests_gpu_results.txt cache: key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" @@ -321,6 +269,30 @@ gpu_numerical_tests: paths: - $CI_PROJECT_DIR/numerical_tests_gpu_results.txt +############################################################################### +run-regression-tests: + stage: test + + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + when: always + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + when: never + - when: manual + allow_failure: true + + needs: [] + + tags: + - gpu + - linux + + before_script: + - apt-get update && apt-get -y install python3.8-venv + - chmod +x ./regression-tests/* + + script: + - ./regression-tests/regression-tests.sh ############################################################################### ## Code analysis ## @@ -328,8 +300,6 @@ gpu_numerical_tests: clang_build_analyzer_clang_10: stage: analyze - image: irmb/virtualfluids-deps-ubuntu20.04 - only: ["schedules"] needs: [] @@ -362,8 +332,6 @@ clang_build_analyzer_clang_10: include_what_you_use_clang_10: stage: analyze - image: irmb/virtualfluids-deps-ubuntu20.04 - only: ["schedules"] needs: [] @@ -391,24 +359,28 @@ include_what_you_use_clang_10: - make ############################################################################### +.analyze_template: + + rules: # dont create MR pipeline, run always on irmb/develop and manual in all other cases + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + when: never + - if: '$CI_PROJECT_NAMESPACE == "irmb" && $CI_COMMIT_BRANCH == "develop"' + when: always + - when: manual + allow_failure: true + cppcheck: stage: analyze - image: irmb/virtualfluids-deps-ubuntu20.04 - - only: - - develop@irmb/VirtualFluids_dev + extends: .analyze_template needs: [] before_script: - - export DEBIAN_FRONTEND=noninteractive - - apt-get update - - apt-get install -y cppcheck + - cppcheck --version script: - cd $CI_PROJECT_DIR - - cppcheck --version - cppcheck src --enable=all --xml 2> cppcheck.xml artifacts: @@ -422,10 +394,7 @@ cppcheck: lizard: stage: analyze - image: irmb/virtualfluids-python-deps-ubuntu20.04:latest - - only: - - develop@irmb/VirtualFluids_dev + extends: .analyze_template needs: [] @@ -450,17 +419,11 @@ lizard: gcov_gcc_9: stage: analyze - image: irmb/virtualfluids-python-deps-ubuntu20.04:latest - - only: - - develop@irmb/VirtualFluids_dev + extends: .analyze_template needs: [] before_script: - - export DEBIAN_FRONTEND=noninteractive - - apt-get update - - pip3 install gcovr - gcovr --version script: @@ -482,7 +445,9 @@ gcov_gcc_9: - coverage/ reports: - cobertura: coverage/coverage.xml + coverage_report: + coverage_format: cobertura + path: coverage/coverage.xml cache: key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" @@ -494,10 +459,7 @@ gcov_gcc_9: clang-tidy: stage: analyze - image: irmb/virtualfluids-python-deps-ubuntu20.04:latest - - only: - - develop@irmb/VirtualFluids_dev + extends: .analyze_template needs: [] @@ -510,7 +472,6 @@ clang-tidy: - mkdir -p $CI_PROJECT_DIR/build - cd $CI_PROJECT_DIR/build - cmake .. - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_VF_CPU=ON -DBUILD_VF_GPU=OFF - python3 ../utilities/filterCompileCommands.py compile_commands.json @@ -553,7 +514,7 @@ pages: .deploy_template: stage: deploy - image: irmb/virtualfluids-python-deps-ubuntu20.04:latest + before_script: - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' @@ -616,8 +577,6 @@ vf_wheel_to_jupyterhub: sonar-scanner: stage: deploy - image: irmb/virtualfluids-python-deps-ubuntu20.04:latest - tags: - linux diff --git a/3rdParty/googletest/CMakeLists.txt b/3rdParty/googletest/CMakeLists.txt deleted file mode 100644 index 781b60be44fc76ec640fea0444a527c10125e141..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -# Note: CMake support is community-based. The maintainers do not use CMake -# internally. - -cmake_minimum_required(VERSION 2.8.12) - -if (POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) -endif (POLICY CMP0048) - -project(googletest-distribution) -set(GOOGLETEST_VERSION 1.10.0) - -########################################################## -# Enable MACOSX_RPATH support for gtest and gmock -# to avoid CMP0042 warnings -IF(APPLE) - SET(CMAKE_MACOSX_RPATH 1) -ENDIF() -########################################################## - -if (CMAKE_VERSION VERSION_LESS "3.1") - add_definitions(-std=c++11) -else() - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - if(NOT CYGWIN) - set(CMAKE_CXX_EXTENSIONS OFF) - endif() -endif() - -enable_testing() - -include(CMakeDependentOption) -include(GNUInstallDirs) - -#Note that googlemock target already builds googletest -#option(BUILD_GMOCK "Builds the googlemock subproject" ON) -#option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" OFF) - -#if(BUILD_GMOCK) - add_subdirectory( googlemock ) -#else() -# add_subdirectory( googletest ) -#endif() - -groupTarget(gmock ${thirdFolder}/googletest) -groupTarget(gmock_main ${thirdFolder}/googletest) -groupTarget(gtest ${thirdFolder}/googletest) -groupTarget(gtest_main ${thirdFolder}/googletest) \ No newline at end of file diff --git a/3rdParty/googletest/googlemock/CMakeLists.txt b/3rdParty/googletest/googlemock/CMakeLists.txt deleted file mode 100644 index 63cd3c61441ee2ba9177b6b366c069013b0ff4ad..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/CMakeLists.txt +++ /dev/null @@ -1,233 +0,0 @@ -######################################################################## -# Note: CMake support is community-based. The maintainers do not use CMake -# internally. -# -# CMake build script for Google Mock. -# -# To run the tests for Google Mock itself on Linux, use 'make test' or -# ctest. You can select which tests to run using 'ctest -R regex'. -# For more options, run 'ctest --help'. - -option(gmock_build_tests "Build all of Google Mock's own tests." OFF) - -# A directory to find Google Test sources. -if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt") - set(gtest_dir gtest) -else() - set(gtest_dir ../googletest) -endif() - -# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build(). -include("${gtest_dir}/cmake/hermetic_build.cmake" OPTIONAL) - -if (COMMAND pre_project_set_up_hermetic_build) - # Google Test also calls hermetic setup functions from add_subdirectory, - # although its changes will not affect things at the current scope. - pre_project_set_up_hermetic_build() -endif() - -######################################################################## -# -# Project-wide settings - -# Name of the project. -# -# CMake files in this project can refer to the root source directory -# as ${gmock_SOURCE_DIR} and to the root binary directory as -# ${gmock_BINARY_DIR}. -# Language "C" is required for find_package(Threads). -if (CMAKE_VERSION VERSION_LESS 3.0) - project(gmock CXX C) -else() - cmake_policy(SET CMP0048 NEW) - project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) -endif() -cmake_minimum_required(VERSION 2.8.12) - -if (COMMAND set_up_hermetic_build) - set_up_hermetic_build() -endif() - -# Instructs CMake to process Google Test's CMakeLists.txt and add its -# targets to the current scope. We are placing Google Test's binary -# directory in a subdirectory of our own as VC compilation may break -# if they are the same (the default). -add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/${gtest_dir}") - - -# These commands only run if this is the main project -if(CMAKE_PROJECT_NAME STREQUAL "gmock" OR CMAKE_PROJECT_NAME STREQUAL "googletest-distribution") - # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to - # make it prominent in the GUI. - option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) -else() - mark_as_advanced(gmock_build_tests) -endif() - -# Although Google Test's CMakeLists.txt calls this function, the -# changes there don't affect the current scope. Therefore we have to -# call it again here. -config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake - -# Adds Google Mock's and Google Test's header directories to the search path. -set(gmock_build_include_dirs - "${gmock_SOURCE_DIR}/include" - "${gmock_SOURCE_DIR}" - "${gtest_SOURCE_DIR}/include" - # This directory is needed to build directly from Google Test sources. - "${gtest_SOURCE_DIR}") -include_directories(${gmock_build_include_dirs}) - -######################################################################## -# -# Defines the gmock & gmock_main libraries. User tests should link -# with one of them. - -# Google Mock libraries. We build them using more strict warnings than what -# are used for other targets, to ensure that Google Mock can be compiled by -# a user aggressive about warnings. -if (MSVC) - cxx_library(gmock - "${cxx_strict}" - "${gtest_dir}/src/gtest-all.cc" - src/gmock-all.cc) - - cxx_library(gmock_main - "${cxx_strict}" - "${gtest_dir}/src/gtest-all.cc" - src/gmock-all.cc - src/gmock_main.cc) -else() - cxx_library(gmock "${cxx_strict}" src/gmock-all.cc) - target_link_libraries(gmock PUBLIC gtest) - cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc) - target_link_libraries(gmock_main PUBLIC gmock) -endif() -# If the CMake version supports it, attach header directory information -# to the targets for when we are part of a parent build (ie being pulled -# in via add_subdirectory() rather than being a standalone build). -if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") - target_include_directories(gmock SYSTEM INTERFACE - "$<BUILD_INTERFACE:${gmock_build_include_dirs}>" - "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>") - target_include_directories(gmock_main SYSTEM INTERFACE - "$<BUILD_INTERFACE:${gmock_build_include_dirs}>" - "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>") -endif() - -######################################################################## -# -# Install rules -install_project(gmock gmock_main) - -######################################################################## -# -# Google Mock's own tests. -# -# You can skip this section if you aren't interested in testing -# Google Mock itself. -# -# The tests are not built by default. To build them, set the -# gmock_build_tests option to ON. You can do it by running ccmake -# or specifying the -Dgmock_build_tests=ON flag when running cmake. - -if (gmock_build_tests) - # This must be set in the root directory for the tests to be run by - # 'make test' or ctest. - enable_testing() - - if (WIN32) - file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1" - CONTENT -"$project_bin = \"${CMAKE_BINARY_DIR}/bin/$<CONFIG>\" -$env:Path = \"$project_bin;$env:Path\" -& $args") - elseif (MINGW OR CYGWIN) - file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1" - CONTENT -"$project_bin = (cygpath --windows ${CMAKE_BINARY_DIR}/bin) -$env:Path = \"$project_bin;$env:Path\" -& $args") - endif() - - if (MINGW OR CYGWIN) - if (CMAKE_VERSION VERSION_LESS "2.8.12") - add_compile_options("-Wa,-mbig-obj") - else() - add_definitions("-Wa,-mbig-obj") - endif() - endif() - - ############################################################ - # C++ tests built with standard compiler flags. - - cxx_test(gmock-actions_test gmock_main) - cxx_test(gmock-cardinalities_test gmock_main) - cxx_test(gmock_ex_test gmock_main) - cxx_test(gmock-function-mocker_test gmock_main) - cxx_test(gmock-generated-actions_test gmock_main) - cxx_test(gmock-generated-function-mockers_test gmock_main) - cxx_test(gmock-generated-matchers_test gmock_main) - cxx_test(gmock-internal-utils_test gmock_main) - cxx_test(gmock-matchers_test gmock_main) - cxx_test(gmock-more-actions_test gmock_main) - cxx_test(gmock-nice-strict_test gmock_main) - cxx_test(gmock-port_test gmock_main) - cxx_test(gmock-spec-builders_test gmock_main) - cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc) - cxx_test(gmock_test gmock_main) - - if (DEFINED GTEST_HAS_PTHREAD) - cxx_test(gmock_stress_test gmock) - endif() - - # gmock_all_test is commented to save time building and running tests. - # Uncomment if necessary. - # cxx_test(gmock_all_test gmock_main) - - ############################################################ - # C++ tests built with non-standard compiler flags. - - if (MSVC) - cxx_library(gmock_main_no_exception "${cxx_no_exception}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - - cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - - else() - cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc) - target_link_libraries(gmock_main_no_exception PUBLIC gmock) - - cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc) - target_link_libraries(gmock_main_no_rtti PUBLIC gmock) - endif() - cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}" - gmock_main_no_exception test/gmock-more-actions_test.cc) - - cxx_test_with_flags(gmock_no_rtti_test "${cxx_no_rtti}" - gmock_main_no_rtti test/gmock-spec-builders_test.cc) - - cxx_shared_library(shared_gmock_main "${cxx_default}" - "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc) - - # Tests that a binary can be built with Google Mock as a shared library. On - # some system configurations, it may not possible to run the binary without - # knowing more details about the system configurations. We do not try to run - # this binary. To get a more robust shared library coverage, configure with - # -DBUILD_SHARED_LIBS=ON. - cxx_executable_with_flags(shared_gmock_test_ "${cxx_default}" - shared_gmock_main test/gmock-spec-builders_test.cc) - set_target_properties(shared_gmock_test_ - PROPERTIES - COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") - - ############################################################ - # Python tests. - - cxx_executable(gmock_leak_test_ test gmock_main) - py_test(gmock_leak_test) - - cxx_executable(gmock_output_test_ test gmock) - py_test(gmock_output_test) -endif() diff --git a/3rdParty/googletest/googlemock/CONTRIBUTORS b/3rdParty/googletest/googlemock/CONTRIBUTORS deleted file mode 100644 index 6e9ae362b60c384c743cd654903ec287fb6a270c..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/CONTRIBUTORS +++ /dev/null @@ -1,40 +0,0 @@ -# This file contains a list of people who've made non-trivial -# contribution to the Google C++ Mocking Framework project. People -# who commit code to the project are encouraged to add their names -# here. Please keep the list sorted by first names. - -Benoit Sigoure <tsuna@google.com> -Bogdan Piloca <boo@google.com> -Chandler Carruth <chandlerc@google.com> -Dave MacLachlan <dmaclach@gmail.com> -David Anderson <danderson@google.com> -Dean Sturtevant -Gene Volovich <gv@cite.com> -Hal Burch <gmock@hburch.com> -Jeffrey Yasskin <jyasskin@google.com> -Jim Keller <jimkeller@google.com> -Joe Walnes <joe@truemesh.com> -Jon Wray <jwray@google.com> -Keir Mierle <mierle@gmail.com> -Keith Ray <keith.ray@gmail.com> -Kostya Serebryany <kcc@google.com> -Lev Makhlis -Manuel Klimek <klimek@google.com> -Mario Tanev <radix@google.com> -Mark Paskin -Markus Heule <markus.heule@gmail.com> -Matthew Simmons <simmonmt@acm.org> -Mike Bland <mbland@google.com> -Neal Norwitz <nnorwitz@gmail.com> -Nermin Ozkiranartli <nermin@google.com> -Owen Carlsen <ocarlsen@google.com> -Paneendra Ba <paneendra@google.com> -Paul Menage <menage@google.com> -Piotr Kaminski <piotrk@google.com> -Russ Rufer <russ@pentad.com> -Sverre Sundsdal <sundsdal@gmail.com> -Takeshi Yoshino <tyoshino@google.com> -Vadim Berman <vadimb@google.com> -Vlad Losev <vladl@google.com> -Wolfgang Klier <wklier@google.com> -Zhanyong Wan <wan@google.com> diff --git a/3rdParty/googletest/googlemock/LICENSE b/3rdParty/googletest/googlemock/LICENSE deleted file mode 100644 index 1941a11f8ce94389160b458927a29ba217542818..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2008, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3rdParty/googletest/googlemock/README.md b/3rdParty/googletest/googlemock/README.md deleted file mode 100644 index 183fdb81d9b6f17b5e57bd9bb6e86066d943a427..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Googletest Mocking (gMock) Framework - -### Overview - -Google's framework for writing and using C++ mock classes. It can help you -derive better designs of your system and write better tests. - -It is inspired by: - -* [jMock](http://www.jmock.org/), -* [EasyMock](http://www.easymock.org/), and -* [Hamcrest](http://code.google.com/p/hamcrest/), - -and designed with C++'s specifics in mind. - -gMock: - -- provides a declarative syntax for defining mocks, -- can define partial (hybrid) mocks, which are a cross of real and mock - objects, -- handles functions of arbitrary types and overloaded functions, -- comes with a rich set of matchers for validating function arguments, -- uses an intuitive syntax for controlling the behavior of a mock, -- does automatic verification of expectations (no record-and-replay needed), -- allows arbitrary (partial) ordering constraints on function calls to be - expressed, -- lets a user extend it by defining new matchers and actions. -- does not use exceptions, and -- is easy to learn and use. - -Details and examples can be found here: - -* [gMock for Dummies](docs/for_dummies.md) -* [Legacy gMock FAQ](docs/gmock_faq.md) -* [gMock Cookbook](docs/cook_book.md) -* [gMock Cheat Sheet](docs/cheat_sheet.md) - -Please note that code under scripts/generator/ is from the [cppclean -project](http://code.google.com/p/cppclean/) and under the Apache -License, which is different from Google Mock's license. - -Google Mock is a part of -[Google Test C++ testing framework](http://github.com/google/googletest/) and a -subject to the same requirements. diff --git a/3rdParty/googletest/googlemock/cmake/gmock.pc.in b/3rdParty/googletest/googlemock/cmake/gmock.pc.in deleted file mode 100644 index 08e0454749ba7d9d33812f610ec2d8d94d58b43e..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/cmake/gmock.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=${pcfiledir}/../.. -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ - -Name: gmock -Description: GoogleMock (without main() function) -Version: @PROJECT_VERSION@ -URL: https://github.com/google/googletest -Requires: gtest -Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ diff --git a/3rdParty/googletest/googlemock/cmake/gmock_main.pc.in b/3rdParty/googletest/googlemock/cmake/gmock_main.pc.in deleted file mode 100644 index b22fe614828393c9c8e7aa690a0cbdc6a97e3c42..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/cmake/gmock_main.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=${pcfiledir}/../.. -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ - -Name: gmock_main -Description: GoogleMock (with main() function) -Version: @PROJECT_VERSION@ -URL: https://github.com/google/googletest -Requires: gmock -Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-actions.h b/3rdParty/googletest/googlemock/include/gmock/gmock-actions.h deleted file mode 100644 index f12d39be06a7697aec8180ab59ed3ec7f8800ee5..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-actions.h +++ /dev/null @@ -1,1142 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used actions. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ - -#ifndef _WIN32_WCE -# include <errno.h> -#endif - -#include <algorithm> -#include <functional> -#include <memory> -#include <string> -#include <type_traits> -#include <utility> - -#include "gmock/internal/gmock-internal-utils.h" -#include "gmock/internal/gmock-port.h" - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) -#endif - -namespace testing { - -// To implement an action Foo, define: -// 1. a class FooAction that implements the ActionInterface interface, and -// 2. a factory function that creates an Action object from a -// const FooAction*. -// -// The two-level delegation design follows that of Matcher, providing -// consistency for extension developers. It also eases ownership -// management as Action objects can now be copied like plain values. - -namespace internal { - -// BuiltInDefaultValueGetter<T, true>::Get() returns a -// default-constructed T value. BuiltInDefaultValueGetter<T, -// false>::Get() crashes with an error. -// -// This primary template is used when kDefaultConstructible is true. -template <typename T, bool kDefaultConstructible> -struct BuiltInDefaultValueGetter { - static T Get() { return T(); } -}; -template <typename T> -struct BuiltInDefaultValueGetter<T, false> { - static T Get() { - Assert(false, __FILE__, __LINE__, - "Default action undefined for the function return type."); - return internal::Invalid<T>(); - // The above statement will never be reached, but is required in - // order for this function to compile. - } -}; - -// BuiltInDefaultValue<T>::Get() returns the "built-in" default value -// for type T, which is NULL when T is a raw pointer type, 0 when T is -// a numeric type, false when T is bool, or "" when T is string or -// std::string. In addition, in C++11 and above, it turns a -// default-constructed T value if T is default constructible. For any -// other type T, the built-in default T value is undefined, and the -// function will abort the process. -template <typename T> -class BuiltInDefaultValue { - public: - // This function returns true if and only if type T has a built-in default - // value. - static bool Exists() { - return ::std::is_default_constructible<T>::value; - } - - static T Get() { - return BuiltInDefaultValueGetter< - T, ::std::is_default_constructible<T>::value>::Get(); - } -}; - -// This partial specialization says that we use the same built-in -// default value for T and const T. -template <typename T> -class BuiltInDefaultValue<const T> { - public: - static bool Exists() { return BuiltInDefaultValue<T>::Exists(); } - static T Get() { return BuiltInDefaultValue<T>::Get(); } -}; - -// This partial specialization defines the default values for pointer -// types. -template <typename T> -class BuiltInDefaultValue<T*> { - public: - static bool Exists() { return true; } - static T* Get() { return nullptr; } -}; - -// The following specializations define the default values for -// specific types we care about. -#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \ - template <> \ - class BuiltInDefaultValue<type> { \ - public: \ - static bool Exists() { return true; } \ - static type Get() { return value; } \ - } - -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, ""); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0'); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0'); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0'); - -// There's no need for a default action for signed wchar_t, as that -// type is the same as wchar_t for gcc, and invalid for MSVC. -// -// There's also no need for a default action for unsigned wchar_t, as -// that type is the same as unsigned int for gcc, and invalid for -// MSVC. -#if GMOCK_WCHAR_T_IS_NATIVE_ -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U); // NOLINT -#endif - -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(UInt64, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(Int64, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0); -GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0); - -#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ - -} // namespace internal - -// When an unexpected function call is encountered, Google Mock will -// let it return a default value if the user has specified one for its -// return type, or if the return type has a built-in default value; -// otherwise Google Mock won't know what value to return and will have -// to abort the process. -// -// The DefaultValue<T> class allows a user to specify the -// default value for a type T that is both copyable and publicly -// destructible (i.e. anything that can be used as a function return -// type). The usage is: -// -// // Sets the default value for type T to be foo. -// DefaultValue<T>::Set(foo); -template <typename T> -class DefaultValue { - public: - // Sets the default value for type T; requires T to be - // copy-constructable and have a public destructor. - static void Set(T x) { - delete producer_; - producer_ = new FixedValueProducer(x); - } - - // Provides a factory function to be called to generate the default value. - // This method can be used even if T is only move-constructible, but it is not - // limited to that case. - typedef T (*FactoryFunction)(); - static void SetFactory(FactoryFunction factory) { - delete producer_; - producer_ = new FactoryValueProducer(factory); - } - - // Unsets the default value for type T. - static void Clear() { - delete producer_; - producer_ = nullptr; - } - - // Returns true if and only if the user has set the default value for type T. - static bool IsSet() { return producer_ != nullptr; } - - // Returns true if T has a default return value set by the user or there - // exists a built-in default value. - static bool Exists() { - return IsSet() || internal::BuiltInDefaultValue<T>::Exists(); - } - - // Returns the default value for type T if the user has set one; - // otherwise returns the built-in default value. Requires that Exists() - // is true, which ensures that the return value is well-defined. - static T Get() { - return producer_ == nullptr ? internal::BuiltInDefaultValue<T>::Get() - : producer_->Produce(); - } - - private: - class ValueProducer { - public: - virtual ~ValueProducer() {} - virtual T Produce() = 0; - }; - - class FixedValueProducer : public ValueProducer { - public: - explicit FixedValueProducer(T value) : value_(value) {} - T Produce() override { return value_; } - - private: - const T value_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(FixedValueProducer); - }; - - class FactoryValueProducer : public ValueProducer { - public: - explicit FactoryValueProducer(FactoryFunction factory) - : factory_(factory) {} - T Produce() override { return factory_(); } - - private: - const FactoryFunction factory_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(FactoryValueProducer); - }; - - static ValueProducer* producer_; -}; - -// This partial specialization allows a user to set default values for -// reference types. -template <typename T> -class DefaultValue<T&> { - public: - // Sets the default value for type T&. - static void Set(T& x) { // NOLINT - address_ = &x; - } - - // Unsets the default value for type T&. - static void Clear() { address_ = nullptr; } - - // Returns true if and only if the user has set the default value for type T&. - static bool IsSet() { return address_ != nullptr; } - - // Returns true if T has a default return value set by the user or there - // exists a built-in default value. - static bool Exists() { - return IsSet() || internal::BuiltInDefaultValue<T&>::Exists(); - } - - // Returns the default value for type T& if the user has set one; - // otherwise returns the built-in default value if there is one; - // otherwise aborts the process. - static T& Get() { - return address_ == nullptr ? internal::BuiltInDefaultValue<T&>::Get() - : *address_; - } - - private: - static T* address_; -}; - -// This specialization allows DefaultValue<void>::Get() to -// compile. -template <> -class DefaultValue<void> { - public: - static bool Exists() { return true; } - static void Get() {} -}; - -// Points to the user-set default value for type T. -template <typename T> -typename DefaultValue<T>::ValueProducer* DefaultValue<T>::producer_ = nullptr; - -// Points to the user-set default value for type T&. -template <typename T> -T* DefaultValue<T&>::address_ = nullptr; - -// Implement this interface to define an action for function type F. -template <typename F> -class ActionInterface { - public: - typedef typename internal::Function<F>::Result Result; - typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; - - ActionInterface() {} - virtual ~ActionInterface() {} - - // Performs the action. This method is not const, as in general an - // action can have side effects and be stateful. For example, a - // get-the-next-element-from-the-collection action will need to - // remember the current element. - virtual Result Perform(const ArgumentTuple& args) = 0; - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionInterface); -}; - -// An Action<F> is a copyable and IMMUTABLE (except by assignment) -// object that represents an action to be taken when a mock function -// of type F is called. The implementation of Action<T> is just a -// std::shared_ptr to const ActionInterface<T>. Don't inherit from Action! -// You can view an object implementing ActionInterface<F> as a -// concrete action (including its current state), and an Action<F> -// object as a handle to it. -template <typename F> -class Action { - // Adapter class to allow constructing Action from a legacy ActionInterface. - // New code should create Actions from functors instead. - struct ActionAdapter { - // Adapter must be copyable to satisfy std::function requirements. - ::std::shared_ptr<ActionInterface<F>> impl_; - - template <typename... Args> - typename internal::Function<F>::Result operator()(Args&&... args) { - return impl_->Perform( - ::std::forward_as_tuple(::std::forward<Args>(args)...)); - } - }; - - public: - typedef typename internal::Function<F>::Result Result; - typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; - - // Constructs a null Action. Needed for storing Action objects in - // STL containers. - Action() {} - - // Construct an Action from a specified callable. - // This cannot take std::function directly, because then Action would not be - // directly constructible from lambda (it would require two conversions). - template <typename G, - typename = typename ::std::enable_if< - ::std::is_constructible<::std::function<F>, G>::value>::type> - Action(G&& fun) : fun_(::std::forward<G>(fun)) {} // NOLINT - - // Constructs an Action from its implementation. - explicit Action(ActionInterface<F>* impl) - : fun_(ActionAdapter{::std::shared_ptr<ActionInterface<F>>(impl)}) {} - - // This constructor allows us to turn an Action<Func> object into an - // Action<F>, as long as F's arguments can be implicitly converted - // to Func's and Func's return type can be implicitly converted to F's. - template <typename Func> - explicit Action(const Action<Func>& action) : fun_(action.fun_) {} - - // Returns true if and only if this is the DoDefault() action. - bool IsDoDefault() const { return fun_ == nullptr; } - - // Performs the action. Note that this method is const even though - // the corresponding method in ActionInterface is not. The reason - // is that a const Action<F> means that it cannot be re-bound to - // another concrete action, not that the concrete action it binds to - // cannot change state. (Think of the difference between a const - // pointer and a pointer to const.) - Result Perform(ArgumentTuple args) const { - if (IsDoDefault()) { - internal::IllegalDoDefault(__FILE__, __LINE__); - } - return internal::Apply(fun_, ::std::move(args)); - } - - private: - template <typename G> - friend class Action; - - // fun_ is an empty function if and only if this is the DoDefault() action. - ::std::function<F> fun_; -}; - -// The PolymorphicAction class template makes it easy to implement a -// polymorphic action (i.e. an action that can be used in mock -// functions of than one type, e.g. Return()). -// -// To define a polymorphic action, a user first provides a COPYABLE -// implementation class that has a Perform() method template: -// -// class FooAction { -// public: -// template <typename Result, typename ArgumentTuple> -// Result Perform(const ArgumentTuple& args) const { -// // Processes the arguments and returns a result, using -// // std::get<N>(args) to get the N-th (0-based) argument in the tuple. -// } -// ... -// }; -// -// Then the user creates the polymorphic action using -// MakePolymorphicAction(object) where object has type FooAction. See -// the definition of Return(void) and SetArgumentPointee<N>(value) for -// complete examples. -template <typename Impl> -class PolymorphicAction { - public: - explicit PolymorphicAction(const Impl& impl) : impl_(impl) {} - - template <typename F> - operator Action<F>() const { - return Action<F>(new MonomorphicImpl<F>(impl_)); - } - - private: - template <typename F> - class MonomorphicImpl : public ActionInterface<F> { - public: - typedef typename internal::Function<F>::Result Result; - typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; - - explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} - - Result Perform(const ArgumentTuple& args) override { - return impl_.template Perform<Result>(args); - } - - private: - Impl impl_; - - GTEST_DISALLOW_ASSIGN_(MonomorphicImpl); - }; - - Impl impl_; - - GTEST_DISALLOW_ASSIGN_(PolymorphicAction); -}; - -// Creates an Action from its implementation and returns it. The -// created Action object owns the implementation. -template <typename F> -Action<F> MakeAction(ActionInterface<F>* impl) { - return Action<F>(impl); -} - -// Creates a polymorphic action from its implementation. This is -// easier to use than the PolymorphicAction<Impl> constructor as it -// doesn't require you to explicitly write the template argument, e.g. -// -// MakePolymorphicAction(foo); -// vs -// PolymorphicAction<TypeOfFoo>(foo); -template <typename Impl> -inline PolymorphicAction<Impl> MakePolymorphicAction(const Impl& impl) { - return PolymorphicAction<Impl>(impl); -} - -namespace internal { - -// Helper struct to specialize ReturnAction to execute a move instead of a copy -// on return. Useful for move-only types, but could be used on any type. -template <typename T> -struct ByMoveWrapper { - explicit ByMoveWrapper(T value) : payload(std::move(value)) {} - T payload; -}; - -// Implements the polymorphic Return(x) action, which can be used in -// any function that returns the type of x, regardless of the argument -// types. -// -// Note: The value passed into Return must be converted into -// Function<F>::Result when this action is cast to Action<F> rather than -// when that action is performed. This is important in scenarios like -// -// MOCK_METHOD1(Method, T(U)); -// ... -// { -// Foo foo; -// X x(&foo); -// EXPECT_CALL(mock, Method(_)).WillOnce(Return(x)); -// } -// -// In the example above the variable x holds reference to foo which leaves -// scope and gets destroyed. If copying X just copies a reference to foo, -// that copy will be left with a hanging reference. If conversion to T -// makes a copy of foo, the above code is safe. To support that scenario, we -// need to make sure that the type conversion happens inside the EXPECT_CALL -// statement, and conversion of the result of Return to Action<T(U)> is a -// good place for that. -// -// The real life example of the above scenario happens when an invocation -// of gtl::Container() is passed into Return. -// -template <typename R> -class ReturnAction { - public: - // Constructs a ReturnAction object from the value to be returned. - // 'value' is passed by value instead of by const reference in order - // to allow Return("string literal") to compile. - explicit ReturnAction(R value) : value_(new R(std::move(value))) {} - - // This template type conversion operator allows Return(x) to be - // used in ANY function that returns x's type. - template <typename F> - operator Action<F>() const { // NOLINT - // Assert statement belongs here because this is the best place to verify - // conditions on F. It produces the clearest error messages - // in most compilers. - // Impl really belongs in this scope as a local class but can't - // because MSVC produces duplicate symbols in different translation units - // in this case. Until MS fixes that bug we put Impl into the class scope - // and put the typedef both here (for use in assert statement) and - // in the Impl class. But both definitions must be the same. - typedef typename Function<F>::Result Result; - GTEST_COMPILE_ASSERT_( - !std::is_reference<Result>::value, - use_ReturnRef_instead_of_Return_to_return_a_reference); - static_assert(!std::is_void<Result>::value, - "Can't use Return() on an action expected to return `void`."); - return Action<F>(new Impl<R, F>(value_)); - } - - private: - // Implements the Return(x) action for a particular function type F. - template <typename R_, typename F> - class Impl : public ActionInterface<F> { - public: - typedef typename Function<F>::Result Result; - typedef typename Function<F>::ArgumentTuple ArgumentTuple; - - // The implicit cast is necessary when Result has more than one - // single-argument constructor (e.g. Result is std::vector<int>) and R - // has a type conversion operator template. In that case, value_(value) - // won't compile as the compiler doesn't known which constructor of - // Result to call. ImplicitCast_ forces the compiler to convert R to - // Result without considering explicit constructors, thus resolving the - // ambiguity. value_ is then initialized using its copy constructor. - explicit Impl(const std::shared_ptr<R>& value) - : value_before_cast_(*value), - value_(ImplicitCast_<Result>(value_before_cast_)) {} - - Result Perform(const ArgumentTuple&) override { return value_; } - - private: - GTEST_COMPILE_ASSERT_(!std::is_reference<Result>::value, - Result_cannot_be_a_reference_type); - // We save the value before casting just in case it is being cast to a - // wrapper type. - R value_before_cast_; - Result value_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl); - }; - - // Partially specialize for ByMoveWrapper. This version of ReturnAction will - // move its contents instead. - template <typename R_, typename F> - class Impl<ByMoveWrapper<R_>, F> : public ActionInterface<F> { - public: - typedef typename Function<F>::Result Result; - typedef typename Function<F>::ArgumentTuple ArgumentTuple; - - explicit Impl(const std::shared_ptr<R>& wrapper) - : performed_(false), wrapper_(wrapper) {} - - Result Perform(const ArgumentTuple&) override { - GTEST_CHECK_(!performed_) - << "A ByMove() action should only be performed once."; - performed_ = true; - return std::move(wrapper_->payload); - } - - private: - bool performed_; - const std::shared_ptr<R> wrapper_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - const std::shared_ptr<R> value_; - - GTEST_DISALLOW_ASSIGN_(ReturnAction); -}; - -// Implements the ReturnNull() action. -class ReturnNullAction { - public: - // Allows ReturnNull() to be used in any pointer-returning function. In C++11 - // this is enforced by returning nullptr, and in non-C++11 by asserting a - // pointer type on compile time. - template <typename Result, typename ArgumentTuple> - static Result Perform(const ArgumentTuple&) { - return nullptr; - } -}; - -// Implements the Return() action. -class ReturnVoidAction { - public: - // Allows Return() to be used in any void-returning function. - template <typename Result, typename ArgumentTuple> - static void Perform(const ArgumentTuple&) { - static_assert(std::is_void<Result>::value, "Result should be void."); - } -}; - -// Implements the polymorphic ReturnRef(x) action, which can be used -// in any function that returns a reference to the type of x, -// regardless of the argument types. -template <typename T> -class ReturnRefAction { - public: - // Constructs a ReturnRefAction object from the reference to be returned. - explicit ReturnRefAction(T& ref) : ref_(ref) {} // NOLINT - - // This template type conversion operator allows ReturnRef(x) to be - // used in ANY function that returns a reference to x's type. - template <typename F> - operator Action<F>() const { - typedef typename Function<F>::Result Result; - // Asserts that the function return type is a reference. This - // catches the user error of using ReturnRef(x) when Return(x) - // should be used, and generates some helpful error message. - GTEST_COMPILE_ASSERT_(std::is_reference<Result>::value, - use_Return_instead_of_ReturnRef_to_return_a_value); - return Action<F>(new Impl<F>(ref_)); - } - - private: - // Implements the ReturnRef(x) action for a particular function type F. - template <typename F> - class Impl : public ActionInterface<F> { - public: - typedef typename Function<F>::Result Result; - typedef typename Function<F>::ArgumentTuple ArgumentTuple; - - explicit Impl(T& ref) : ref_(ref) {} // NOLINT - - Result Perform(const ArgumentTuple&) override { return ref_; } - - private: - T& ref_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - T& ref_; - - GTEST_DISALLOW_ASSIGN_(ReturnRefAction); -}; - -// Implements the polymorphic ReturnRefOfCopy(x) action, which can be -// used in any function that returns a reference to the type of x, -// regardless of the argument types. -template <typename T> -class ReturnRefOfCopyAction { - public: - // Constructs a ReturnRefOfCopyAction object from the reference to - // be returned. - explicit ReturnRefOfCopyAction(const T& value) : value_(value) {} // NOLINT - - // This template type conversion operator allows ReturnRefOfCopy(x) to be - // used in ANY function that returns a reference to x's type. - template <typename F> - operator Action<F>() const { - typedef typename Function<F>::Result Result; - // Asserts that the function return type is a reference. This - // catches the user error of using ReturnRefOfCopy(x) when Return(x) - // should be used, and generates some helpful error message. - GTEST_COMPILE_ASSERT_( - std::is_reference<Result>::value, - use_Return_instead_of_ReturnRefOfCopy_to_return_a_value); - return Action<F>(new Impl<F>(value_)); - } - - private: - // Implements the ReturnRefOfCopy(x) action for a particular function type F. - template <typename F> - class Impl : public ActionInterface<F> { - public: - typedef typename Function<F>::Result Result; - typedef typename Function<F>::ArgumentTuple ArgumentTuple; - - explicit Impl(const T& value) : value_(value) {} // NOLINT - - Result Perform(const ArgumentTuple&) override { return value_; } - - private: - T value_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - const T value_; - - GTEST_DISALLOW_ASSIGN_(ReturnRefOfCopyAction); -}; - -// Implements the polymorphic DoDefault() action. -class DoDefaultAction { - public: - // This template type conversion operator allows DoDefault() to be - // used in any function. - template <typename F> - operator Action<F>() const { return Action<F>(); } // NOLINT -}; - -// Implements the Assign action to set a given pointer referent to a -// particular value. -template <typename T1, typename T2> -class AssignAction { - public: - AssignAction(T1* ptr, T2 value) : ptr_(ptr), value_(value) {} - - template <typename Result, typename ArgumentTuple> - void Perform(const ArgumentTuple& /* args */) const { - *ptr_ = value_; - } - - private: - T1* const ptr_; - const T2 value_; - - GTEST_DISALLOW_ASSIGN_(AssignAction); -}; - -#if !GTEST_OS_WINDOWS_MOBILE - -// Implements the SetErrnoAndReturn action to simulate return from -// various system calls and libc functions. -template <typename T> -class SetErrnoAndReturnAction { - public: - SetErrnoAndReturnAction(int errno_value, T result) - : errno_(errno_value), - result_(result) {} - template <typename Result, typename ArgumentTuple> - Result Perform(const ArgumentTuple& /* args */) const { - errno = errno_; - return result_; - } - - private: - const int errno_; - const T result_; - - GTEST_DISALLOW_ASSIGN_(SetErrnoAndReturnAction); -}; - -#endif // !GTEST_OS_WINDOWS_MOBILE - -// Implements the SetArgumentPointee<N>(x) action for any function -// whose N-th argument (0-based) is a pointer to x's type. -template <size_t N, typename A, typename = void> -struct SetArgumentPointeeAction { - A value; - - template <typename... Args> - void operator()(const Args&... args) const { - *::std::get<N>(std::tie(args...)) = value; - } -}; - -// Implements the Invoke(object_ptr, &Class::Method) action. -template <class Class, typename MethodPtr> -struct InvokeMethodAction { - Class* const obj_ptr; - const MethodPtr method_ptr; - - template <typename... Args> - auto operator()(Args&&... args) const - -> decltype((obj_ptr->*method_ptr)(std::forward<Args>(args)...)) { - return (obj_ptr->*method_ptr)(std::forward<Args>(args)...); - } -}; - -// Implements the InvokeWithoutArgs(f) action. The template argument -// FunctionImpl is the implementation type of f, which can be either a -// function pointer or a functor. InvokeWithoutArgs(f) can be used as an -// Action<F> as long as f's type is compatible with F. -template <typename FunctionImpl> -struct InvokeWithoutArgsAction { - FunctionImpl function_impl; - - // Allows InvokeWithoutArgs(f) to be used as any action whose type is - // compatible with f. - template <typename... Args> - auto operator()(const Args&...) -> decltype(function_impl()) { - return function_impl(); - } -}; - -// Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action. -template <class Class, typename MethodPtr> -struct InvokeMethodWithoutArgsAction { - Class* const obj_ptr; - const MethodPtr method_ptr; - - using ReturnType = typename std::result_of<MethodPtr(Class*)>::type; - - template <typename... Args> - ReturnType operator()(const Args&...) const { - return (obj_ptr->*method_ptr)(); - } -}; - -// Implements the IgnoreResult(action) action. -template <typename A> -class IgnoreResultAction { - public: - explicit IgnoreResultAction(const A& action) : action_(action) {} - - template <typename F> - operator Action<F>() const { - // Assert statement belongs here because this is the best place to verify - // conditions on F. It produces the clearest error messages - // in most compilers. - // Impl really belongs in this scope as a local class but can't - // because MSVC produces duplicate symbols in different translation units - // in this case. Until MS fixes that bug we put Impl into the class scope - // and put the typedef both here (for use in assert statement) and - // in the Impl class. But both definitions must be the same. - typedef typename internal::Function<F>::Result Result; - - // Asserts at compile time that F returns void. - static_assert(std::is_void<Result>::value, "Result type should be void."); - - return Action<F>(new Impl<F>(action_)); - } - - private: - template <typename F> - class Impl : public ActionInterface<F> { - public: - typedef typename internal::Function<F>::Result Result; - typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; - - explicit Impl(const A& action) : action_(action) {} - - void Perform(const ArgumentTuple& args) override { - // Performs the action and ignores its result. - action_.Perform(args); - } - - private: - // Type OriginalFunction is the same as F except that its return - // type is IgnoredValue. - typedef typename internal::Function<F>::MakeResultIgnoredValue - OriginalFunction; - - const Action<OriginalFunction> action_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - const A action_; - - GTEST_DISALLOW_ASSIGN_(IgnoreResultAction); -}; - -template <typename InnerAction, size_t... I> -struct WithArgsAction { - InnerAction action; - - // The inner action could be anything convertible to Action<X>. - // We use the conversion operator to detect the signature of the inner Action. - template <typename R, typename... Args> - operator Action<R(Args...)>() const { // NOLINT - Action<R(typename std::tuple_element<I, std::tuple<Args...>>::type...)> - converted(action); - - return [converted](Args... args) -> R { - return converted.Perform(std::forward_as_tuple( - std::get<I>(std::forward_as_tuple(std::forward<Args>(args)...))...)); - }; - } -}; - -template <typename... Actions> -struct DoAllAction { - private: - template <typename... Args, size_t... I> - std::vector<Action<void(Args...)>> Convert(IndexSequence<I...>) const { - return {std::get<I>(actions)...}; - } - - public: - std::tuple<Actions...> actions; - - template <typename R, typename... Args> - operator Action<R(Args...)>() const { // NOLINT - struct Op { - std::vector<Action<void(Args...)>> converted; - Action<R(Args...)> last; - R operator()(Args... args) const { - auto tuple_args = std::forward_as_tuple(std::forward<Args>(args)...); - for (auto& a : converted) { - a.Perform(tuple_args); - } - return last.Perform(tuple_args); - } - }; - return Op{Convert<Args...>(MakeIndexSequence<sizeof...(Actions) - 1>()), - std::get<sizeof...(Actions) - 1>(actions)}; - } -}; - -} // namespace internal - -// An Unused object can be implicitly constructed from ANY value. -// This is handy when defining actions that ignore some or all of the -// mock function arguments. For example, given -// -// MOCK_METHOD3(Foo, double(const string& label, double x, double y)); -// MOCK_METHOD3(Bar, double(int index, double x, double y)); -// -// instead of -// -// double DistanceToOriginWithLabel(const string& label, double x, double y) { -// return sqrt(x*x + y*y); -// } -// double DistanceToOriginWithIndex(int index, double x, double y) { -// return sqrt(x*x + y*y); -// } -// ... -// EXPECT_CALL(mock, Foo("abc", _, _)) -// .WillOnce(Invoke(DistanceToOriginWithLabel)); -// EXPECT_CALL(mock, Bar(5, _, _)) -// .WillOnce(Invoke(DistanceToOriginWithIndex)); -// -// you could write -// -// // We can declare any uninteresting argument as Unused. -// double DistanceToOrigin(Unused, double x, double y) { -// return sqrt(x*x + y*y); -// } -// ... -// EXPECT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin)); -// EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin)); -typedef internal::IgnoredValue Unused; - -// Creates an action that does actions a1, a2, ..., sequentially in -// each invocation. -template <typename... Action> -internal::DoAllAction<typename std::decay<Action>::type...> DoAll( - Action&&... action) { - return {std::forward_as_tuple(std::forward<Action>(action)...)}; -} - -// WithArg<k>(an_action) creates an action that passes the k-th -// (0-based) argument of the mock function to an_action and performs -// it. It adapts an action accepting one argument to one that accepts -// multiple arguments. For convenience, we also provide -// WithArgs<k>(an_action) (defined below) as a synonym. -template <size_t k, typename InnerAction> -internal::WithArgsAction<typename std::decay<InnerAction>::type, k> -WithArg(InnerAction&& action) { - return {std::forward<InnerAction>(action)}; -} - -// WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes -// the selected arguments of the mock function to an_action and -// performs it. It serves as an adaptor between actions with -// different argument lists. -template <size_t k, size_t... ks, typename InnerAction> -internal::WithArgsAction<typename std::decay<InnerAction>::type, k, ks...> -WithArgs(InnerAction&& action) { - return {std::forward<InnerAction>(action)}; -} - -// WithoutArgs(inner_action) can be used in a mock function with a -// non-empty argument list to perform inner_action, which takes no -// argument. In other words, it adapts an action accepting no -// argument to one that accepts (and ignores) arguments. -template <typename InnerAction> -internal::WithArgsAction<typename std::decay<InnerAction>::type> -WithoutArgs(InnerAction&& action) { - return {std::forward<InnerAction>(action)}; -} - -// Creates an action that returns 'value'. 'value' is passed by value -// instead of const reference - otherwise Return("string literal") -// will trigger a compiler error about using array as initializer. -template <typename R> -internal::ReturnAction<R> Return(R value) { - return internal::ReturnAction<R>(std::move(value)); -} - -// Creates an action that returns NULL. -inline PolymorphicAction<internal::ReturnNullAction> ReturnNull() { - return MakePolymorphicAction(internal::ReturnNullAction()); -} - -// Creates an action that returns from a void function. -inline PolymorphicAction<internal::ReturnVoidAction> Return() { - return MakePolymorphicAction(internal::ReturnVoidAction()); -} - -// Creates an action that returns the reference to a variable. -template <typename R> -inline internal::ReturnRefAction<R> ReturnRef(R& x) { // NOLINT - return internal::ReturnRefAction<R>(x); -} - -// Creates an action that returns the reference to a copy of the -// argument. The copy is created when the action is constructed and -// lives as long as the action. -template <typename R> -inline internal::ReturnRefOfCopyAction<R> ReturnRefOfCopy(const R& x) { - return internal::ReturnRefOfCopyAction<R>(x); -} - -// Modifies the parent action (a Return() action) to perform a move of the -// argument instead of a copy. -// Return(ByMove()) actions can only be executed once and will assert this -// invariant. -template <typename R> -internal::ByMoveWrapper<R> ByMove(R x) { - return internal::ByMoveWrapper<R>(std::move(x)); -} - -// Creates an action that does the default action for the give mock function. -inline internal::DoDefaultAction DoDefault() { - return internal::DoDefaultAction(); -} - -// Creates an action that sets the variable pointed by the N-th -// (0-based) function argument to 'value'. -template <size_t N, typename T> -internal::SetArgumentPointeeAction<N, T> SetArgPointee(T x) { - return {std::move(x)}; -} - -// The following version is DEPRECATED. -template <size_t N, typename T> -internal::SetArgumentPointeeAction<N, T> SetArgumentPointee(T x) { - return {std::move(x)}; -} - -// Creates an action that sets a pointer referent to a given value. -template <typename T1, typename T2> -PolymorphicAction<internal::AssignAction<T1, T2> > Assign(T1* ptr, T2 val) { - return MakePolymorphicAction(internal::AssignAction<T1, T2>(ptr, val)); -} - -#if !GTEST_OS_WINDOWS_MOBILE - -// Creates an action that sets errno and returns the appropriate error. -template <typename T> -PolymorphicAction<internal::SetErrnoAndReturnAction<T> > -SetErrnoAndReturn(int errval, T result) { - return MakePolymorphicAction( - internal::SetErrnoAndReturnAction<T>(errval, result)); -} - -#endif // !GTEST_OS_WINDOWS_MOBILE - -// Various overloads for Invoke(). - -// Legacy function. -// Actions can now be implicitly constructed from callables. No need to create -// wrapper objects. -// This function exists for backwards compatibility. -template <typename FunctionImpl> -typename std::decay<FunctionImpl>::type Invoke(FunctionImpl&& function_impl) { - return std::forward<FunctionImpl>(function_impl); -} - -// Creates an action that invokes the given method on the given object -// with the mock function's arguments. -template <class Class, typename MethodPtr> -internal::InvokeMethodAction<Class, MethodPtr> Invoke(Class* obj_ptr, - MethodPtr method_ptr) { - return {obj_ptr, method_ptr}; -} - -// Creates an action that invokes 'function_impl' with no argument. -template <typename FunctionImpl> -internal::InvokeWithoutArgsAction<typename std::decay<FunctionImpl>::type> -InvokeWithoutArgs(FunctionImpl function_impl) { - return {std::move(function_impl)}; -} - -// Creates an action that invokes the given method on the given object -// with no argument. -template <class Class, typename MethodPtr> -internal::InvokeMethodWithoutArgsAction<Class, MethodPtr> InvokeWithoutArgs( - Class* obj_ptr, MethodPtr method_ptr) { - return {obj_ptr, method_ptr}; -} - -// Creates an action that performs an_action and throws away its -// result. In other words, it changes the return type of an_action to -// void. an_action MUST NOT return void, or the code won't compile. -template <typename A> -inline internal::IgnoreResultAction<A> IgnoreResult(const A& an_action) { - return internal::IgnoreResultAction<A>(an_action); -} - -// Creates a reference wrapper for the given L-value. If necessary, -// you can explicitly specify the type of the reference. For example, -// suppose 'derived' is an object of type Derived, ByRef(derived) -// would wrap a Derived&. If you want to wrap a const Base& instead, -// where Base is a base class of Derived, just write: -// -// ByRef<const Base>(derived) -// -// N.B. ByRef is redundant with std::ref, std::cref and std::reference_wrapper. -// However, it may still be used for consistency with ByMove(). -template <typename T> -inline ::std::reference_wrapper<T> ByRef(T& l_value) { // NOLINT - return ::std::reference_wrapper<T>(l_value); -} - -} // namespace testing - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-cardinalities.h b/3rdParty/googletest/googlemock/include/gmock/gmock-cardinalities.h deleted file mode 100644 index 46e01e102d5841a5ef8ee18d681d0393ac051bbf..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-cardinalities.h +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used cardinalities. More -// cardinalities can be defined by the user implementing the -// CardinalityInterface interface if necessary. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ - -#include <limits.h> -#include <memory> -#include <ostream> // NOLINT -#include "gmock/internal/gmock-port.h" -#include "gtest/gtest.h" - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -namespace testing { - -// To implement a cardinality Foo, define: -// 1. a class FooCardinality that implements the -// CardinalityInterface interface, and -// 2. a factory function that creates a Cardinality object from a -// const FooCardinality*. -// -// The two-level delegation design follows that of Matcher, providing -// consistency for extension developers. It also eases ownership -// management as Cardinality objects can now be copied like plain values. - -// The implementation of a cardinality. -class CardinalityInterface { - public: - virtual ~CardinalityInterface() {} - - // Conservative estimate on the lower/upper bound of the number of - // calls allowed. - virtual int ConservativeLowerBound() const { return 0; } - virtual int ConservativeUpperBound() const { return INT_MAX; } - - // Returns true if and only if call_count calls will satisfy this - // cardinality. - virtual bool IsSatisfiedByCallCount(int call_count) const = 0; - - // Returns true if and only if call_count calls will saturate this - // cardinality. - virtual bool IsSaturatedByCallCount(int call_count) const = 0; - - // Describes self to an ostream. - virtual void DescribeTo(::std::ostream* os) const = 0; -}; - -// A Cardinality is a copyable and IMMUTABLE (except by assignment) -// object that specifies how many times a mock function is expected to -// be called. The implementation of Cardinality is just a std::shared_ptr -// to const CardinalityInterface. Don't inherit from Cardinality! -class GTEST_API_ Cardinality { - public: - // Constructs a null cardinality. Needed for storing Cardinality - // objects in STL containers. - Cardinality() {} - - // Constructs a Cardinality from its implementation. - explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {} - - // Conservative estimate on the lower/upper bound of the number of - // calls allowed. - int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); } - int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); } - - // Returns true if and only if call_count calls will satisfy this - // cardinality. - bool IsSatisfiedByCallCount(int call_count) const { - return impl_->IsSatisfiedByCallCount(call_count); - } - - // Returns true if and only if call_count calls will saturate this - // cardinality. - bool IsSaturatedByCallCount(int call_count) const { - return impl_->IsSaturatedByCallCount(call_count); - } - - // Returns true if and only if call_count calls will over-saturate this - // cardinality, i.e. exceed the maximum number of allowed calls. - bool IsOverSaturatedByCallCount(int call_count) const { - return impl_->IsSaturatedByCallCount(call_count) && - !impl_->IsSatisfiedByCallCount(call_count); - } - - // Describes self to an ostream - void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } - - // Describes the given actual call count to an ostream. - static void DescribeActualCallCountTo(int actual_call_count, - ::std::ostream* os); - - private: - std::shared_ptr<const CardinalityInterface> impl_; -}; - -// Creates a cardinality that allows at least n calls. -GTEST_API_ Cardinality AtLeast(int n); - -// Creates a cardinality that allows at most n calls. -GTEST_API_ Cardinality AtMost(int n); - -// Creates a cardinality that allows any number of calls. -GTEST_API_ Cardinality AnyNumber(); - -// Creates a cardinality that allows between min and max calls. -GTEST_API_ Cardinality Between(int min, int max); - -// Creates a cardinality that allows exactly n calls. -GTEST_API_ Cardinality Exactly(int n); - -// Creates a cardinality from its implementation. -inline Cardinality MakeCardinality(const CardinalityInterface* c) { - return Cardinality(c); -} - -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-function-mocker.h b/3rdParty/googletest/googlemock/include/gmock/gmock-function-mocker.h deleted file mode 100644 index cc1535c806bf4f0080e87dc716fe666fc1e4c840..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-function-mocker.h +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements MOCK_METHOD. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT -#define THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT - -#include "gmock/gmock-generated-function-mockers.h" // NOLINT -#include "gmock/internal/gmock-pp.h" - -#define MOCK_METHOD(...) \ - GMOCK_PP_VARIADIC_CALL(GMOCK_INTERNAL_MOCK_METHOD_ARG_, __VA_ARGS__) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_1(...) \ - GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_2(...) \ - GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_3(_Ret, _MethodName, _Args) \ - GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, ()) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, _Spec) \ - GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Args); \ - GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Spec); \ - GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \ - GMOCK_PP_NARG0 _Args, GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)); \ - GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \ - GMOCK_INTERNAL_MOCK_METHOD_IMPL( \ - GMOCK_PP_NARG0 _Args, _MethodName, GMOCK_INTERNAL_HAS_CONST(_Spec), \ - GMOCK_INTERNAL_HAS_OVERRIDE(_Spec), GMOCK_INTERNAL_HAS_FINAL(_Spec), \ - GMOCK_INTERNAL_HAS_NOEXCEPT(_Spec), GMOCK_INTERNAL_GET_CALLTYPE(_Spec), \ - (GMOCK_INTERNAL_SIGNATURE(_Ret, _Args))) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_5(...) \ - GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_6(...) \ - GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) - -#define GMOCK_INTERNAL_MOCK_METHOD_ARG_7(...) \ - GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__) - -#define GMOCK_INTERNAL_WRONG_ARITY(...) \ - static_assert( \ - false, \ - "MOCK_METHOD must be called with 3 or 4 arguments. _Ret, " \ - "_MethodName, _Args and optionally _Spec. _Args and _Spec must be " \ - "enclosed in parentheses. If _Ret is a type with unprotected commas, " \ - "it must also be enclosed in parentheses.") - -#define GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Tuple) \ - static_assert( \ - GMOCK_PP_IS_ENCLOSED_PARENS(_Tuple), \ - GMOCK_PP_STRINGIZE(_Tuple) " should be enclosed in parentheses.") - -#define GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE(_N, ...) \ - static_assert( \ - std::is_function<__VA_ARGS__>::value, \ - "Signature must be a function type, maybe return type contains " \ - "unprotected comma."); \ - static_assert( \ - ::testing::tuple_size<typename ::testing::internal::Function< \ - __VA_ARGS__>::ArgumentTuple>::value == _N, \ - "This method does not take " GMOCK_PP_STRINGIZE( \ - _N) " arguments. Parenthesize all types with unproctected commas.") - -#define GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT, ~, _Spec) - -#define GMOCK_INTERNAL_MOCK_METHOD_IMPL(_N, _MethodName, _Constness, \ - _Override, _Final, _Noexcept, \ - _CallType, _Signature) \ - typename ::testing::internal::Function<GMOCK_PP_REMOVE_PARENS( \ - _Signature)>::Result \ - GMOCK_INTERNAL_EXPAND(_CallType) \ - _MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \ - GMOCK_PP_IF(_Constness, const, ) GMOCK_PP_IF(_Noexcept, noexcept, ) \ - GMOCK_PP_IF(_Override, override, ) \ - GMOCK_PP_IF(_Final, final, ) { \ - GMOCK_MOCKER_(_N, _Constness, _MethodName) \ - .SetOwnerAndName(this, #_MethodName); \ - return GMOCK_MOCKER_(_N, _Constness, _MethodName) \ - .Invoke(GMOCK_PP_REPEAT(GMOCK_INTERNAL_FORWARD_ARG, _Signature, _N)); \ - } \ - ::testing::MockSpec<GMOCK_PP_REMOVE_PARENS(_Signature)> gmock_##_MethodName( \ - GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_PARAMETER, _Signature, _N)) \ - GMOCK_PP_IF(_Constness, const, ) { \ - GMOCK_MOCKER_(_N, _Constness, _MethodName).RegisterOwner(this); \ - return GMOCK_MOCKER_(_N, _Constness, _MethodName) \ - .With(GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_ARGUMENT, , _N)); \ - } \ - ::testing::MockSpec<GMOCK_PP_REMOVE_PARENS(_Signature)> gmock_##_MethodName( \ - const ::testing::internal::WithoutMatchers&, \ - GMOCK_PP_IF(_Constness, const, )::testing::internal::Function< \ - GMOCK_PP_REMOVE_PARENS(_Signature)>*) \ - const GMOCK_PP_IF(_Noexcept, noexcept, ) { \ - return GMOCK_PP_CAT(::testing::internal::AdjustConstness_, \ - GMOCK_PP_IF(_Constness, const, ))(this) \ - ->gmock_##_MethodName(GMOCK_PP_REPEAT( \ - GMOCK_INTERNAL_A_MATCHER_ARGUMENT, _Signature, _N)); \ - } \ - mutable ::testing::FunctionMocker<GMOCK_PP_REMOVE_PARENS(_Signature)> \ - GMOCK_MOCKER_(_N, _Constness, _MethodName) - -#define GMOCK_INTERNAL_EXPAND(...) __VA_ARGS__ - -// Five Valid modifiers. -#define GMOCK_INTERNAL_HAS_CONST(_Tuple) \ - GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_CONST, ~, _Tuple)) - -#define GMOCK_INTERNAL_HAS_OVERRIDE(_Tuple) \ - GMOCK_PP_HAS_COMMA( \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_OVERRIDE, ~, _Tuple)) - -#define GMOCK_INTERNAL_HAS_FINAL(_Tuple) \ - GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_FINAL, ~, _Tuple)) - -#define GMOCK_INTERNAL_HAS_NOEXCEPT(_Tuple) \ - GMOCK_PP_HAS_COMMA( \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_NOEXCEPT, ~, _Tuple)) - -#define GMOCK_INTERNAL_GET_CALLTYPE(_Tuple) \ - GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_CALLTYPE_IMPL, ~, _Tuple) - -#define GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT(_i, _, _elem) \ - static_assert( \ - (GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem)) + \ - GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem)) + \ - GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem)) + \ - GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)) + \ - GMOCK_INTERNAL_IS_CALLTYPE(_elem)) == 1, \ - GMOCK_PP_STRINGIZE( \ - _elem) " cannot be recognized as a valid specification modifier."); - -// Modifiers implementation. -#define GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem) \ - GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_CONST_I_, _elem) - -#define GMOCK_INTERNAL_DETECT_CONST_I_const , - -#define GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem) \ - GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_OVERRIDE_I_, _elem) - -#define GMOCK_INTERNAL_DETECT_OVERRIDE_I_override , - -#define GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem) \ - GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_FINAL_I_, _elem) - -#define GMOCK_INTERNAL_DETECT_FINAL_I_final , - -// TODO(iserna): Maybe noexcept should accept an argument here as well. -#define GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem) \ - GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_NOEXCEPT_I_, _elem) - -#define GMOCK_INTERNAL_DETECT_NOEXCEPT_I_noexcept , - -#define GMOCK_INTERNAL_GET_CALLTYPE_IMPL(_i, _, _elem) \ - GMOCK_PP_IF(GMOCK_INTERNAL_IS_CALLTYPE(_elem), \ - GMOCK_INTERNAL_GET_VALUE_CALLTYPE, GMOCK_PP_EMPTY) \ - (_elem) - -// TODO(iserna): GMOCK_INTERNAL_IS_CALLTYPE and -// GMOCK_INTERNAL_GET_VALUE_CALLTYPE needed more expansions to work on windows -// maybe they can be simplified somehow. -#define GMOCK_INTERNAL_IS_CALLTYPE(_arg) \ - GMOCK_INTERNAL_IS_CALLTYPE_I( \ - GMOCK_PP_CAT(GMOCK_INTERNAL_IS_CALLTYPE_HELPER_, _arg)) -#define GMOCK_INTERNAL_IS_CALLTYPE_I(_arg) GMOCK_PP_IS_ENCLOSED_PARENS(_arg) - -#define GMOCK_INTERNAL_GET_VALUE_CALLTYPE(_arg) \ - GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I( \ - GMOCK_PP_CAT(GMOCK_INTERNAL_IS_CALLTYPE_HELPER_, _arg)) -#define GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I(_arg) \ - GMOCK_PP_CAT(GMOCK_PP_IDENTITY, _arg) - -#define GMOCK_INTERNAL_IS_CALLTYPE_HELPER_Calltype - -#define GMOCK_INTERNAL_SIGNATURE(_Ret, _Args) \ - GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_Ret), GMOCK_PP_REMOVE_PARENS, \ - GMOCK_PP_IDENTITY) \ - (_Ret)(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_TYPE, _, _Args)) - -#define GMOCK_INTERNAL_GET_TYPE(_i, _, _elem) \ - GMOCK_PP_COMMA_IF(_i) \ - GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_elem), GMOCK_PP_REMOVE_PARENS, \ - GMOCK_PP_IDENTITY) \ - (_elem) - -#define GMOCK_INTERNAL_PARAMETER(_i, _Signature, _) \ - GMOCK_PP_COMMA_IF(_i) \ - GMOCK_INTERNAL_ARG_O(typename, GMOCK_PP_INC(_i), \ - GMOCK_PP_REMOVE_PARENS(_Signature)) \ - gmock_a##_i - -#define GMOCK_INTERNAL_FORWARD_ARG(_i, _Signature, _) \ - GMOCK_PP_COMMA_IF(_i) \ - ::std::forward<GMOCK_INTERNAL_ARG_O(typename, GMOCK_PP_INC(_i), \ - GMOCK_PP_REMOVE_PARENS(_Signature))>( \ - gmock_a##_i) - -#define GMOCK_INTERNAL_MATCHER_PARAMETER(_i, _Signature, _) \ - GMOCK_PP_COMMA_IF(_i) \ - GMOCK_INTERNAL_MATCHER_O(typename, GMOCK_PP_INC(_i), \ - GMOCK_PP_REMOVE_PARENS(_Signature)) \ - gmock_a##_i - -#define GMOCK_INTERNAL_MATCHER_ARGUMENT(_i, _1, _2) \ - GMOCK_PP_COMMA_IF(_i) \ - gmock_a##_i - -#define GMOCK_INTERNAL_A_MATCHER_ARGUMENT(_i, _Signature, _) \ - GMOCK_PP_COMMA_IF(_i) \ - ::testing::A<GMOCK_INTERNAL_ARG_O(typename, GMOCK_PP_INC(_i), \ - GMOCK_PP_REMOVE_PARENS(_Signature))>() - -#define GMOCK_INTERNAL_ARG_O(_tn, _i, ...) GMOCK_ARG_(_tn, _i, __VA_ARGS__) - -#define GMOCK_INTERNAL_MATCHER_O(_tn, _i, ...) \ - GMOCK_MATCHER_(_tn, _i, __VA_ARGS__) - -#endif // THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-actions.h b/3rdParty/googletest/googlemock/include/gmock/gmock-generated-actions.h deleted file mode 100644 index 981af78ff9a1711585bd17a2785f2509f385f7ca..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-actions.h +++ /dev/null @@ -1,1884 +0,0 @@ -// This file was GENERATED by command: -// pump.py gmock-generated-actions.h.pump -// DO NOT EDIT BY HAND!!! - -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used variadic actions. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ - -#include <memory> -#include <utility> - -#include "gmock/gmock-actions.h" -#include "gmock/internal/gmock-port.h" - -namespace testing { -namespace internal { - -// A macro from the ACTION* family (defined later in this file) -// defines an action that can be used in a mock function. Typically, -// these actions only care about a subset of the arguments of the mock -// function. For example, if such an action only uses the second -// argument, it can be used in any mock function that takes >= 2 -// arguments where the type of the second argument is compatible. -// -// Therefore, the action implementation must be prepared to take more -// arguments than it needs. The ExcessiveArg type is used to -// represent those excessive arguments. In order to keep the compiler -// error messages tractable, we define it in the testing namespace -// instead of testing::internal. However, this is an INTERNAL TYPE -// and subject to change without notice, so a user MUST NOT USE THIS -// TYPE DIRECTLY. -struct ExcessiveArg {}; - -// A helper class needed for implementing the ACTION* macros. -template <typename Result, class Impl> -class ActionHelper { - public: - static Result Perform(Impl* impl, const ::std::tuple<>& args) { - return impl->template gmock_PerformImpl<>(args, ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); - } - - template <typename A0> - static Result Perform(Impl* impl, const ::std::tuple<A0>& args) { - return impl->template gmock_PerformImpl<A0>(args, std::get<0>(args), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); - } - - template <typename A0, typename A1> - static Result Perform(Impl* impl, const ::std::tuple<A0, A1>& args) { - return impl->template gmock_PerformImpl<A0, A1>(args, std::get<0>(args), - std::get<1>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg()); - } - - template <typename A0, typename A1, typename A2> - static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2>& args) { - return impl->template gmock_PerformImpl<A0, A1, A2>(args, - std::get<0>(args), std::get<1>(args), std::get<2>(args), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); - } - - template <typename A0, typename A1, typename A2, typename A3> - static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3>& args) { - return impl->template gmock_PerformImpl<A0, A1, A2, A3>(args, - std::get<0>(args), std::get<1>(args), std::get<2>(args), - std::get<3>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); - } - - template <typename A0, typename A1, typename A2, typename A3, typename A4> - static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3, - A4>& args) { - return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4>(args, - std::get<0>(args), std::get<1>(args), std::get<2>(args), - std::get<3>(args), std::get<4>(args), ExcessiveArg(), ExcessiveArg(), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); - } - - template <typename A0, typename A1, typename A2, typename A3, typename A4, - typename A5> - static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3, A4, - A5>& args) { - return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5>(args, - std::get<0>(args), std::get<1>(args), std::get<2>(args), - std::get<3>(args), std::get<4>(args), std::get<5>(args), - ExcessiveArg(), ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); - } - - template <typename A0, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6> - static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3, A4, A5, - A6>& args) { - return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6>(args, - std::get<0>(args), std::get<1>(args), std::get<2>(args), - std::get<3>(args), std::get<4>(args), std::get<5>(args), - std::get<6>(args), ExcessiveArg(), ExcessiveArg(), ExcessiveArg()); - } - - template <typename A0, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename A7> - static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3, A4, A5, - A6, A7>& args) { - return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, - A7>(args, std::get<0>(args), std::get<1>(args), std::get<2>(args), - std::get<3>(args), std::get<4>(args), std::get<5>(args), - std::get<6>(args), std::get<7>(args), ExcessiveArg(), ExcessiveArg()); - } - - template <typename A0, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename A7, typename A8> - static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3, A4, A5, - A6, A7, A8>& args) { - return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, - A8>(args, std::get<0>(args), std::get<1>(args), std::get<2>(args), - std::get<3>(args), std::get<4>(args), std::get<5>(args), - std::get<6>(args), std::get<7>(args), std::get<8>(args), - ExcessiveArg()); - } - - template <typename A0, typename A1, typename A2, typename A3, typename A4, - typename A5, typename A6, typename A7, typename A8, typename A9> - static Result Perform(Impl* impl, const ::std::tuple<A0, A1, A2, A3, A4, A5, - A6, A7, A8, A9>& args) { - return impl->template gmock_PerformImpl<A0, A1, A2, A3, A4, A5, A6, A7, A8, - A9>(args, std::get<0>(args), std::get<1>(args), std::get<2>(args), - std::get<3>(args), std::get<4>(args), std::get<5>(args), - std::get<6>(args), std::get<7>(args), std::get<8>(args), - std::get<9>(args)); - } -}; - -} // namespace internal -} // namespace testing - -// The ACTION* family of macros can be used in a namespace scope to -// define custom actions easily. The syntax: -// -// ACTION(name) { statements; } -// -// will define an action with the given name that executes the -// statements. The value returned by the statements will be used as -// the return value of the action. Inside the statements, you can -// refer to the K-th (0-based) argument of the mock function by -// 'argK', and refer to its type by 'argK_type'. For example: -// -// ACTION(IncrementArg1) { -// arg1_type temp = arg1; -// return ++(*temp); -// } -// -// allows you to write -// -// ...WillOnce(IncrementArg1()); -// -// You can also refer to the entire argument tuple and its type by -// 'args' and 'args_type', and refer to the mock function type and its -// return type by 'function_type' and 'return_type'. -// -// Note that you don't need to specify the types of the mock function -// arguments. However rest assured that your code is still type-safe: -// you'll get a compiler error if *arg1 doesn't support the ++ -// operator, or if the type of ++(*arg1) isn't compatible with the -// mock function's return type, for example. -// -// Sometimes you'll want to parameterize the action. For that you can use -// another macro: -// -// ACTION_P(name, param_name) { statements; } -// -// For example: -// -// ACTION_P(Add, n) { return arg0 + n; } -// -// will allow you to write: -// -// ...WillOnce(Add(5)); -// -// Note that you don't need to provide the type of the parameter -// either. If you need to reference the type of a parameter named -// 'foo', you can write 'foo_type'. For example, in the body of -// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type -// of 'n'. -// -// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support -// multi-parameter actions. -// -// For the purpose of typing, you can view -// -// ACTION_Pk(Foo, p1, ..., pk) { ... } -// -// as shorthand for -// -// template <typename p1_type, ..., typename pk_type> -// FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... } -// -// In particular, you can provide the template type arguments -// explicitly when invoking Foo(), as in Foo<long, bool>(5, false); -// although usually you can rely on the compiler to infer the types -// for you automatically. You can assign the result of expression -// Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ..., -// pk_type>. This can be useful when composing actions. -// -// You can also overload actions with different numbers of parameters: -// -// ACTION_P(Plus, a) { ... } -// ACTION_P2(Plus, a, b) { ... } -// -// While it's tempting to always use the ACTION* macros when defining -// a new action, you should also consider implementing ActionInterface -// or using MakePolymorphicAction() instead, especially if you need to -// use the action a lot. While these approaches require more work, -// they give you more control on the types of the mock function -// arguments and the action parameters, which in general leads to -// better compiler error messages that pay off in the long run. They -// also allow overloading actions based on parameter types (as opposed -// to just based on the number of parameters). -// -// CAVEAT: -// -// ACTION*() can only be used in a namespace scope as templates cannot be -// declared inside of a local class. -// Users can, however, define any local functors (e.g. a lambda) that -// can be used as actions. -// -// MORE INFORMATION: -// -// To learn more about using these macros, please search for 'ACTION' on -// https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md - -// An internal macro needed for implementing ACTION*(). -#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ - const args_type& args GTEST_ATTRIBUTE_UNUSED_, \ - const arg0_type& arg0 GTEST_ATTRIBUTE_UNUSED_, \ - const arg1_type& arg1 GTEST_ATTRIBUTE_UNUSED_, \ - const arg2_type& arg2 GTEST_ATTRIBUTE_UNUSED_, \ - const arg3_type& arg3 GTEST_ATTRIBUTE_UNUSED_, \ - const arg4_type& arg4 GTEST_ATTRIBUTE_UNUSED_, \ - const arg5_type& arg5 GTEST_ATTRIBUTE_UNUSED_, \ - const arg6_type& arg6 GTEST_ATTRIBUTE_UNUSED_, \ - const arg7_type& arg7 GTEST_ATTRIBUTE_UNUSED_, \ - const arg8_type& arg8 GTEST_ATTRIBUTE_UNUSED_, \ - const arg9_type& arg9 GTEST_ATTRIBUTE_UNUSED_ - -// Sometimes you want to give an action explicit template parameters -// that cannot be inferred from its value parameters. ACTION() and -// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that -// and can be viewed as an extension to ACTION() and ACTION_P*(). -// -// The syntax: -// -// ACTION_TEMPLATE(ActionName, -// HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m), -// AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } -// -// defines an action template that takes m explicit template -// parameters and n value parameters. name_i is the name of the i-th -// template parameter, and kind_i specifies whether it's a typename, -// an integral constant, or a template. p_i is the name of the i-th -// value parameter. -// -// Example: -// -// // DuplicateArg<k, T>(output) converts the k-th argument of the mock -// // function to type T and copies it to *output. -// ACTION_TEMPLATE(DuplicateArg, -// HAS_2_TEMPLATE_PARAMS(int, k, typename, T), -// AND_1_VALUE_PARAMS(output)) { -// *output = T(::std::get<k>(args)); -// } -// ... -// int n; -// EXPECT_CALL(mock, Foo(_, _)) -// .WillOnce(DuplicateArg<1, unsigned char>(&n)); -// -// To create an instance of an action template, write: -// -// ActionName<t1, ..., t_m>(v1, ..., v_n) -// -// where the ts are the template arguments and the vs are the value -// arguments. The value argument types are inferred by the compiler. -// If you want to explicitly specify the value argument types, you can -// provide additional template arguments: -// -// ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n) -// -// where u_i is the desired type of v_i. -// -// ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the -// number of value parameters, but not on the number of template -// parameters. Without the restriction, the meaning of the following -// is unclear: -// -// OverloadedAction<int, bool>(x); -// -// Are we using a single-template-parameter action where 'bool' refers -// to the type of x, or are we using a two-template-parameter action -// where the compiler is asked to infer the type of x? -// -// Implementation notes: -// -// GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and -// GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for -// implementing ACTION_TEMPLATE. The main trick we use is to create -// new macro invocations when expanding a macro. For example, we have -// -// #define ACTION_TEMPLATE(name, template_params, value_params) -// ... GMOCK_INTERNAL_DECL_##template_params ... -// -// which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...) -// to expand to -// -// ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ... -// -// Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the -// preprocessor will continue to expand it to -// -// ... typename T ... -// -// This technique conforms to the C++ standard and is portable. It -// allows us to implement action templates using O(N) code, where N is -// the maximum number of template/value parameters supported. Without -// using it, we'd have to devote O(N^2) amount of code to implement all -// combinations of m and n. - -// Declares the template parameters. -#define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0 -#define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1) kind0 name0, kind1 name1 -#define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2) kind0 name0, kind1 name1, kind2 name2 -#define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \ - kind3 name3 -#define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \ - kind2 name2, kind3 name3, kind4 name4 -#define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \ - kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5 -#define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, \ - kind5 name5, kind6 name6 -#define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \ - kind4 name4, kind5 name5, kind6 name6, kind7 name7 -#define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \ - kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \ - kind8 name8 -#define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \ - kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \ - kind6 name6, kind7 name7, kind8 name8, kind9 name9 - -// Lists the template parameters. -#define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0 -#define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1) name0, name1 -#define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2) name0, name1, name2 -#define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3) name0, name1, name2, name3 -#define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \ - name4 -#define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \ - name2, name3, name4, name5 -#define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6) name0, name1, name2, name3, name4, name5, name6 -#define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7 -#define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name1, \ - kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ - kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \ - name6, name7, name8 -#define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ - name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ - name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \ - name3, name4, name5, name6, name7, name8, name9 - -// Declares the types of value parameters. -#define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \ - typename p0##_type, typename p1##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \ - typename p0##_type, typename p1##_type, typename p2##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ - typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ - typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ - typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) , typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type -#define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \ - typename p2##_type, typename p3##_type, typename p4##_type, \ - typename p5##_type, typename p6##_type, typename p7##_type, \ - typename p8##_type, typename p9##_type - -// Initializes the value parameters. -#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\ - () -#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\ - (p0##_type gmock_p0) : p0(::std::move(gmock_p0)) -#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\ - (p0##_type gmock_p0, p1##_type gmock_p1) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)) -#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\ - (p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)) -#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)) -#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)) -#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)) -#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)) -#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \ - p7(::std::move(gmock_p7)) -#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \ - p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)) -#define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9)\ - (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ - p9##_type gmock_p9) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \ - p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)), \ - p9(::std::move(gmock_p9)) - -// Declares the fields for storing the value parameters. -#define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0; -#define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \ - p1##_type p1; -#define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \ - p1##_type p1; p2##_type p2; -#define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0; \ - p1##_type p1; p2##_type p2; p3##_type p3; -#define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ - p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; -#define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ - p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ - p5##_type p5; -#define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ - p5##_type p5; p6##_type p6; -#define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p4; \ - p5##_type p5; p6##_type p6; p7##_type p7; -#define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ - p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; -#define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ - p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \ - p9##_type p9; - -// Lists the value parameters. -#define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0 -#define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1 -#define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2 -#define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, p3 -#define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, \ - p2, p3, p4 -#define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, \ - p1, p2, p3, p4, p5 -#define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) p0, p1, p2, p3, p4, p5, p6 -#define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) p0, p1, p2, p3, p4, p5, p6, p7 -#define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8 -#define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 - -// Lists the value parameter types. -#define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \ - p1##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type, \ - p1##_type, p2##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ - p0##_type, p1##_type, p2##_type, p3##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ - p0##_type, p1##_type, p2##_type, p3##_type, p4##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) , \ - p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, \ - p6##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type, p8##_type -#define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type, p8##_type, p9##_type - -// Declares the value parameters. -#define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0 -#define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \ - p1##_type p1 -#define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \ - p1##_type p1, p2##_type p2 -#define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0, \ - p1##_type p1, p2##_type p2, p3##_type p3 -#define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ - p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4 -#define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ - p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ - p5##_type p5 -#define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ - p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ - p5##_type p5, p6##_type p6 -#define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, \ - p5##_type p5, p6##_type p6, p7##_type p7 -#define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8 -#define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ - p9##_type p9 - -// The suffix of the class template implementing the action template. -#define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS() -#define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P -#define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2 -#define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3 -#define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4 -#define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5 -#define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6 -#define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) P7 -#define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7) P8 -#define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8) P9 -#define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ - p7, p8, p9) P10 - -// The name of the class template implementing the action template. -#define GMOCK_ACTION_CLASS_(name, value_params)\ - GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) - -#define ACTION_TEMPLATE(name, template_params, value_params)\ - template <GMOCK_INTERNAL_DECL_##template_params\ - GMOCK_INTERNAL_DECL_TYPE_##value_params>\ - class GMOCK_ACTION_CLASS_(name, value_params) {\ - public:\ - explicit GMOCK_ACTION_CLASS_(name, value_params)\ - GMOCK_INTERNAL_INIT_##value_params {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - GMOCK_INTERNAL_DEFN_##value_params\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(\ - new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\ - }\ - GMOCK_INTERNAL_DEFN_##value_params\ - private:\ - GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\ - };\ - template <GMOCK_INTERNAL_DECL_##template_params\ - GMOCK_INTERNAL_DECL_TYPE_##value_params>\ - inline GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ - GMOCK_INTERNAL_DECL_##value_params) {\ - return GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ - GMOCK_INTERNAL_LIST_##value_params);\ - }\ - template <GMOCK_INTERNAL_DECL_##template_params\ - GMOCK_INTERNAL_DECL_TYPE_##value_params>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\ - gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION(name)\ - class name##Action {\ - public:\ - name##Action() {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl() {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>());\ - }\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##Action);\ - };\ - inline name##Action name() {\ - return name##Action();\ - }\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##Action::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P(name, p0)\ - template <typename p0##_type>\ - class name##ActionP {\ - public:\ - explicit name##ActionP(p0##_type gmock_p0) : \ - p0(::std::forward<p0##_type>(gmock_p0)) {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - explicit gmock_Impl(p0##_type gmock_p0) : \ - p0(::std::forward<p0##_type>(gmock_p0)) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>(p0));\ - }\ - p0##_type p0;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP);\ - };\ - template <typename p0##_type>\ - inline name##ActionP<p0##_type> name(p0##_type p0) {\ - return name##ActionP<p0##_type>(p0);\ - }\ - template <typename p0##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P2(name, p0, p1)\ - template <typename p0##_type, typename p1##_type>\ - class name##ActionP2 {\ - public:\ - name##ActionP2(p0##_type gmock_p0, \ - p1##_type gmock_p1) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)) {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, \ - p1##_type gmock_p1) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>(p0, p1));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP2);\ - };\ - template <typename p0##_type, typename p1##_type>\ - inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \ - p1##_type p1) {\ - return name##ActionP2<p0##_type, p1##_type>(p0, p1);\ - }\ - template <typename p0##_type, typename p1##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P3(name, p0, p1, p2)\ - template <typename p0##_type, typename p1##_type, typename p2##_type>\ - class name##ActionP3 {\ - public:\ - name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)) {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP3);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type>\ - inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \ - p1##_type p1, p2##_type p2) {\ - return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP3<p0##_type, p1##_type, \ - p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P4(name, p0, p1, p2, p3)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type>\ - class name##ActionP4 {\ - public:\ - name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, \ - p3##_type gmock_p3) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)) {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP4);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type>\ - inline name##ActionP4<p0##_type, p1##_type, p2##_type, \ - p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ - p3##_type p3) {\ - return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \ - p2, p3);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP4<p0##_type, p1##_type, p2##_type, \ - p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P5(name, p0, p1, p2, p3, p4)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type>\ - class name##ActionP5 {\ - public:\ - name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, \ - p4##_type gmock_p4) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)) {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, \ - p4##_type gmock_p4) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP5);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type>\ - inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4) {\ - return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type>(p0, p1, p2, p3, p4);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type>\ - class name##ActionP6 {\ - public:\ - name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)) {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP6);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type>\ - inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ - p3##_type p3, p4##_type p4, p5##_type p5) {\ - return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type>\ - class name##ActionP7 {\ - public:\ - name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, \ - p6##_type gmock_p6) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)) {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ - p6));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP7);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type>\ - inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \ - p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ - p6##_type p6) {\ - return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type>\ - class name##ActionP8 {\ - public:\ - name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, \ - p7##_type gmock_p7) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)), \ - p7(::std::forward<p7##_type>(gmock_p7)) {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, \ - p7##_type gmock_p7) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)), \ - p7(::std::forward<p7##_type>(gmock_p7)) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ - p6, p7));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP8);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type>\ - inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \ - p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ - p6##_type p6, p7##_type p7) {\ - return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \ - p6, p7);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, \ - p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type>\ - class name##ActionP9 {\ - public:\ - name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)), \ - p7(::std::forward<p7##_type>(gmock_p7)), \ - p8(::std::forward<p8##_type>(gmock_p8)) {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)), \ - p7(::std::forward<p7##_type>(gmock_p7)), \ - p8(::std::forward<p8##_type>(gmock_p8)) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP9);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type>\ - inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, \ - p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ - p8##_type p8) {\ - return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \ - p3, p4, p5, p6, p7, p8);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type, \ - p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type, \ - typename p9##_type>\ - class name##ActionP10 {\ - public:\ - name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8, \ - p9##_type gmock_p9) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)), \ - p7(::std::forward<p7##_type>(gmock_p7)), \ - p8(::std::forward<p8##_type>(gmock_p8)), \ - p9(::std::forward<p9##_type>(gmock_p9)) {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ - p9##_type gmock_p9) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)), \ - p7(::std::forward<p7##_type>(gmock_p7)), \ - p8(::std::forward<p8##_type>(gmock_p8)), \ - p9(::std::forward<p9##_type>(gmock_p9)) {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - p9##_type p9;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>(p0, p1, p2, p3, p4, p5, \ - p6, p7, p8, p9));\ - }\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - p9##_type p9;\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP10);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type, \ - typename p9##_type>\ - inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ - p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ - p9##_type p9) {\ - return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \ - p1, p2, p3, p4, p5, p6, p7, p8, p9);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type, \ - typename p9##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type, p8##_type, \ - p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -namespace testing { - - -// The ACTION*() macros trigger warning C4100 (unreferenced formal -// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in -// the macro definition, as the warnings are generated when the macro -// is expanded and macro expansion cannot contain #pragma. Therefore -// we suppress them here. -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) -#endif - -// Various overloads for InvokeArgument<N>(). -// -// The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th -// (0-based) argument, which must be a k-ary callable, of the mock -// function, with arguments a1, a2, ..., a_k. -// -// Notes: -// -// 1. The arguments are passed by value by default. If you need to -// pass an argument by reference, wrap it inside ByRef(). For -// example, -// -// InvokeArgument<1>(5, string("Hello"), ByRef(foo)) -// -// passes 5 and string("Hello") by value, and passes foo by -// reference. -// -// 2. If the callable takes an argument by reference but ByRef() is -// not used, it will receive the reference to a copy of the value, -// instead of the original value. For example, when the 0-th -// argument of the mock function takes a const string&, the action -// -// InvokeArgument<0>(string("Hello")) -// -// makes a copy of the temporary string("Hello") object and passes a -// reference of the copy, instead of the original temporary object, -// to the callable. This makes it easy for a user to define an -// InvokeArgument action from temporary values and have it performed -// later. - -namespace internal { -namespace invoke_argument { - -// Appears in InvokeArgumentAdl's argument list to help avoid -// accidental calls to user functions of the same name. -struct AdlTag {}; - -// InvokeArgumentAdl - a helper for InvokeArgument. -// The basic overloads are provided here for generic functors. -// Overloads for other custom-callables are provided in the -// internal/custom/callback-actions.h header. - -template <typename R, typename F> -R InvokeArgumentAdl(AdlTag, F f) { - return f(); -} -template <typename R, typename F, typename A1> -R InvokeArgumentAdl(AdlTag, F f, A1 a1) { - return f(a1); -} -template <typename R, typename F, typename A1, typename A2> -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2) { - return f(a1, a2); -} -template <typename R, typename F, typename A1, typename A2, typename A3> -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3) { - return f(a1, a2, a3); -} -template <typename R, typename F, typename A1, typename A2, typename A3, - typename A4> -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4) { - return f(a1, a2, a3, a4); -} -template <typename R, typename F, typename A1, typename A2, typename A3, - typename A4, typename A5> -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - return f(a1, a2, a3, a4, a5); -} -template <typename R, typename F, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6> -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - return f(a1, a2, a3, a4, a5, a6); -} -template <typename R, typename F, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename A7> -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, - A7 a7) { - return f(a1, a2, a3, a4, a5, a6, a7); -} -template <typename R, typename F, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename A7, typename A8> -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, - A7 a7, A8 a8) { - return f(a1, a2, a3, a4, a5, a6, a7, a8); -} -template <typename R, typename F, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename A7, typename A8, - typename A9> -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, - A7 a7, A8 a8, A9 a9) { - return f(a1, a2, a3, a4, a5, a6, a7, a8, a9); -} -template <typename R, typename F, typename A1, typename A2, typename A3, - typename A4, typename A5, typename A6, typename A7, typename A8, - typename A9, typename A10> -R InvokeArgumentAdl(AdlTag, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, - A7 a7, A8 a8, A9 a9, A10 a10) { - return f(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); -} -} // namespace invoke_argument -} // namespace internal - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_0_VALUE_PARAMS()) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args)); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_1_VALUE_PARAMS(p0)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args), p0); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_2_VALUE_PARAMS(p0, p1)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args), p0, p1); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_3_VALUE_PARAMS(p0, p1, p2)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args), p0, p1, p2); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args), p0, p1, p2, p3); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args), p0, p1, p2, p3, p4); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args), p0, p1, p2, p3, p4, p5); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8); -} - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); -} - -// Various overloads for ReturnNew<T>(). -// -// The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new -// instance of type T, constructed on the heap with constructor arguments -// a1, a2, ..., and a_k. The caller assumes ownership of the returned value. -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_0_VALUE_PARAMS()) { - return new T(); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_1_VALUE_PARAMS(p0)) { - return new T(p0); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_2_VALUE_PARAMS(p0, p1)) { - return new T(p0, p1); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_3_VALUE_PARAMS(p0, p1, p2)) { - return new T(p0, p1, p2); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { - return new T(p0, p1, p2, p3); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { - return new T(p0, p1, p2, p3, p4); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { - return new T(p0, p1, p2, p3, p4, p5); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { - return new T(p0, p1, p2, p3, p4, p5, p6); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { - return new T(p0, p1, p2, p3, p4, p5, p6, p7); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { - return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8); -} - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)) { - return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); -} - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -} // namespace testing - -// Include any custom callback actions added by the local installation. -// We must include this header at the end to make sure it can use the -// declarations from this file. -#include "gmock/internal/custom/gmock-generated-actions.h" - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-actions.h.pump b/3rdParty/googletest/googlemock/include/gmock/gmock-generated-actions.h.pump deleted file mode 100644 index 209603c5a90135ec53abae541d08243ba182e0b8..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-actions.h.pump +++ /dev/null @@ -1,627 +0,0 @@ -$$ -*- mode: c++; -*- -$$ This is a Pump source file. Please use Pump to convert it to -$$ gmock-generated-actions.h. -$$ -$var n = 10 $$ The maximum arity we support. -$$}} This meta comment fixes auto-indentation in editors. -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used variadic actions. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ - -#include <memory> -#include <utility> - -#include "gmock/gmock-actions.h" -#include "gmock/internal/gmock-port.h" - -namespace testing { -namespace internal { - -// A macro from the ACTION* family (defined later in this file) -// defines an action that can be used in a mock function. Typically, -// these actions only care about a subset of the arguments of the mock -// function. For example, if such an action only uses the second -// argument, it can be used in any mock function that takes >= 2 -// arguments where the type of the second argument is compatible. -// -// Therefore, the action implementation must be prepared to take more -// arguments than it needs. The ExcessiveArg type is used to -// represent those excessive arguments. In order to keep the compiler -// error messages tractable, we define it in the testing namespace -// instead of testing::internal. However, this is an INTERNAL TYPE -// and subject to change without notice, so a user MUST NOT USE THIS -// TYPE DIRECTLY. -struct ExcessiveArg {}; - -// A helper class needed for implementing the ACTION* macros. -template <typename Result, class Impl> -class ActionHelper { - public: -$range i 0..n -$for i - -[[ -$var template = [[$if i==0 [[]] $else [[ -$range j 0..i-1 - template <$for j, [[typename A$j]]> -]]]] -$range j 0..i-1 -$var As = [[$for j, [[A$j]]]] -$var as = [[$for j, [[std::get<$j>(args)]]]] -$range k 1..n-i -$var eas = [[$for k, [[ExcessiveArg()]]]] -$var arg_list = [[$if (i==0) | (i==n) [[$as$eas]] $else [[$as, $eas]]]] -$template - static Result Perform(Impl* impl, const ::std::tuple<$As>& args) { - return impl->template gmock_PerformImpl<$As>(args, $arg_list); - } - -]] -}; - -} // namespace internal -} // namespace testing - -// The ACTION* family of macros can be used in a namespace scope to -// define custom actions easily. The syntax: -// -// ACTION(name) { statements; } -// -// will define an action with the given name that executes the -// statements. The value returned by the statements will be used as -// the return value of the action. Inside the statements, you can -// refer to the K-th (0-based) argument of the mock function by -// 'argK', and refer to its type by 'argK_type'. For example: -// -// ACTION(IncrementArg1) { -// arg1_type temp = arg1; -// return ++(*temp); -// } -// -// allows you to write -// -// ...WillOnce(IncrementArg1()); -// -// You can also refer to the entire argument tuple and its type by -// 'args' and 'args_type', and refer to the mock function type and its -// return type by 'function_type' and 'return_type'. -// -// Note that you don't need to specify the types of the mock function -// arguments. However rest assured that your code is still type-safe: -// you'll get a compiler error if *arg1 doesn't support the ++ -// operator, or if the type of ++(*arg1) isn't compatible with the -// mock function's return type, for example. -// -// Sometimes you'll want to parameterize the action. For that you can use -// another macro: -// -// ACTION_P(name, param_name) { statements; } -// -// For example: -// -// ACTION_P(Add, n) { return arg0 + n; } -// -// will allow you to write: -// -// ...WillOnce(Add(5)); -// -// Note that you don't need to provide the type of the parameter -// either. If you need to reference the type of a parameter named -// 'foo', you can write 'foo_type'. For example, in the body of -// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type -// of 'n'. -// -// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P$n to support -// multi-parameter actions. -// -// For the purpose of typing, you can view -// -// ACTION_Pk(Foo, p1, ..., pk) { ... } -// -// as shorthand for -// -// template <typename p1_type, ..., typename pk_type> -// FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... } -// -// In particular, you can provide the template type arguments -// explicitly when invoking Foo(), as in Foo<long, bool>(5, false); -// although usually you can rely on the compiler to infer the types -// for you automatically. You can assign the result of expression -// Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ..., -// pk_type>. This can be useful when composing actions. -// -// You can also overload actions with different numbers of parameters: -// -// ACTION_P(Plus, a) { ... } -// ACTION_P2(Plus, a, b) { ... } -// -// While it's tempting to always use the ACTION* macros when defining -// a new action, you should also consider implementing ActionInterface -// or using MakePolymorphicAction() instead, especially if you need to -// use the action a lot. While these approaches require more work, -// they give you more control on the types of the mock function -// arguments and the action parameters, which in general leads to -// better compiler error messages that pay off in the long run. They -// also allow overloading actions based on parameter types (as opposed -// to just based on the number of parameters). -// -// CAVEAT: -// -// ACTION*() can only be used in a namespace scope as templates cannot be -// declared inside of a local class. -// Users can, however, define any local functors (e.g. a lambda) that -// can be used as actions. -// -// MORE INFORMATION: -// -// To learn more about using these macros, please search for 'ACTION' on -// https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md - -$range i 0..n -$range k 0..n-1 - -// An internal macro needed for implementing ACTION*(). -#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ - const args_type& args GTEST_ATTRIBUTE_UNUSED_ -$for k [[, \ - const arg$k[[]]_type& arg$k GTEST_ATTRIBUTE_UNUSED_]] - - -// Sometimes you want to give an action explicit template parameters -// that cannot be inferred from its value parameters. ACTION() and -// ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that -// and can be viewed as an extension to ACTION() and ACTION_P*(). -// -// The syntax: -// -// ACTION_TEMPLATE(ActionName, -// HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_m), -// AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } -// -// defines an action template that takes m explicit template -// parameters and n value parameters. name_i is the name of the i-th -// template parameter, and kind_i specifies whether it's a typename, -// an integral constant, or a template. p_i is the name of the i-th -// value parameter. -// -// Example: -// -// // DuplicateArg<k, T>(output) converts the k-th argument of the mock -// // function to type T and copies it to *output. -// ACTION_TEMPLATE(DuplicateArg, -// HAS_2_TEMPLATE_PARAMS(int, k, typename, T), -// AND_1_VALUE_PARAMS(output)) { -// *output = T(::std::get<k>(args)); -// } -// ... -// int n; -// EXPECT_CALL(mock, Foo(_, _)) -// .WillOnce(DuplicateArg<1, unsigned char>(&n)); -// -// To create an instance of an action template, write: -// -// ActionName<t1, ..., t_m>(v1, ..., v_n) -// -// where the ts are the template arguments and the vs are the value -// arguments. The value argument types are inferred by the compiler. -// If you want to explicitly specify the value argument types, you can -// provide additional template arguments: -// -// ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n) -// -// where u_i is the desired type of v_i. -// -// ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the -// number of value parameters, but not on the number of template -// parameters. Without the restriction, the meaning of the following -// is unclear: -// -// OverloadedAction<int, bool>(x); -// -// Are we using a single-template-parameter action where 'bool' refers -// to the type of x, or are we using a two-template-parameter action -// where the compiler is asked to infer the type of x? -// -// Implementation notes: -// -// GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and -// GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for -// implementing ACTION_TEMPLATE. The main trick we use is to create -// new macro invocations when expanding a macro. For example, we have -// -// #define ACTION_TEMPLATE(name, template_params, value_params) -// ... GMOCK_INTERNAL_DECL_##template_params ... -// -// which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), ...) -// to expand to -// -// ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ... -// -// Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the -// preprocessor will continue to expand it to -// -// ... typename T ... -// -// This technique conforms to the C++ standard and is portable. It -// allows us to implement action templates using O(N) code, where N is -// the maximum number of template/value parameters supported. Without -// using it, we'd have to devote O(N^2) amount of code to implement all -// combinations of m and n. - -// Declares the template parameters. - -$range j 1..n -$for j [[ -$range m 0..j-1 -#define GMOCK_INTERNAL_DECL_HAS_$j[[]] -_TEMPLATE_PARAMS($for m, [[kind$m, name$m]]) $for m, [[kind$m name$m]] - - -]] - -// Lists the template parameters. - -$for j [[ -$range m 0..j-1 -#define GMOCK_INTERNAL_LIST_HAS_$j[[]] -_TEMPLATE_PARAMS($for m, [[kind$m, name$m]]) $for m, [[name$m]] - - -]] - -// Declares the types of value parameters. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_DECL_TYPE_AND_$i[[]] -_VALUE_PARAMS($for j, [[p$j]]) $for j [[, typename p$j##_type]] - - -]] - -// Initializes the value parameters. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\ - ($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(::std::move(gmock_p$j))]] - - -]] - -// Declares the fields for storing the value parameters. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_DEFN_AND_$i[[]] -_VALUE_PARAMS($for j, [[p$j]]) $for j [[p$j##_type p$j; ]] - - -]] - -// Lists the value parameters. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_LIST_AND_$i[[]] -_VALUE_PARAMS($for j, [[p$j]]) $for j, [[p$j]] - - -]] - -// Lists the value parameter types. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_LIST_TYPE_AND_$i[[]] -_VALUE_PARAMS($for j, [[p$j]]) $for j [[, p$j##_type]] - - -]] - -// Declares the value parameters. - -$for i [[ -$range j 0..i-1 -#define GMOCK_INTERNAL_DECL_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]]) [[]] -$for j, [[p$j##_type p$j]] - - -]] - -// The suffix of the class template implementing the action template. -$for i [[ - - -$range j 0..i-1 -#define GMOCK_INTERNAL_COUNT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]]) [[]] -$if i==1 [[P]] $elif i>=2 [[P$i]] -]] - - -// The name of the class template implementing the action template. -#define GMOCK_ACTION_CLASS_(name, value_params)\ - GTEST_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) - -$range k 0..n-1 - -#define ACTION_TEMPLATE(name, template_params, value_params)\ - template <GMOCK_INTERNAL_DECL_##template_params\ - GMOCK_INTERNAL_DECL_TYPE_##value_params>\ - class GMOCK_ACTION_CLASS_(name, value_params) {\ - public:\ - explicit GMOCK_ACTION_CLASS_(name, value_params)\ - GMOCK_INTERNAL_INIT_##value_params {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <$for k, [[typename arg$k[[]]_type]]>\ - return_type gmock_PerformImpl(const args_type& args[[]] -$for k [[, const arg$k[[]]_type& arg$k]]) const;\ - GMOCK_INTERNAL_DEFN_##value_params\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(\ - new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\ - }\ - GMOCK_INTERNAL_DEFN_##value_params\ - private:\ - GTEST_DISALLOW_ASSIGN_(GMOCK_ACTION_CLASS_(name, value_params));\ - };\ - template <GMOCK_INTERNAL_DECL_##template_params\ - GMOCK_INTERNAL_DECL_TYPE_##value_params>\ - inline GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ - GMOCK_INTERNAL_DECL_##value_params) {\ - return GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ - GMOCK_INTERNAL_LIST_##value_params);\ - }\ - template <GMOCK_INTERNAL_DECL_##template_params\ - GMOCK_INTERNAL_DECL_TYPE_##value_params>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - GMOCK_ACTION_CLASS_(name, value_params)<\ - GMOCK_INTERNAL_LIST_##template_params\ - GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\ - gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -$for i - -[[ -$var template = [[$if i==0 [[]] $else [[ -$range j 0..i-1 - - template <$for j, [[typename p$j##_type]]>\ -]]]] -$var class_name = [[name##Action[[$if i==0 [[]] $elif i==1 [[P]] - $else [[P$i]]]]]] -$range j 0..i-1 -$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] -$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] -$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::std::forward<p$j##_type>(gmock_p$j))]]]]]] -$var param_field_decls = [[$for j -[[ - - p$j##_type p$j;\ -]]]] -$var param_field_decls2 = [[$for j -[[ - - p$j##_type p$j;\ -]]]] -$var params = [[$for j, [[p$j]]]] -$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]] -$var typename_arg_types = [[$for k, [[typename arg$k[[]]_type]]]] -$var arg_types_and_names = [[$for k, [[const arg$k[[]]_type& arg$k]]]] -$var macro_name = [[$if i==0 [[ACTION]] $elif i==1 [[ACTION_P]] - $else [[ACTION_P$i]]]] - -#define $macro_name(name$for j [[, p$j]])\$template - class $class_name {\ - public:\ - [[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {}\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - [[$if i==1 [[explicit ]]]]gmock_Impl($ctor_param_list)$inits {}\ - virtual return_type Perform(const args_type& args) {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <$typename_arg_types>\ - return_type gmock_PerformImpl(const args_type& args, [[]] -$arg_types_and_names) const;\$param_field_decls - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - template <typename F> operator ::testing::Action<F>() const {\ - return ::testing::Action<F>(new gmock_Impl<F>($params));\ - }\$param_field_decls2 - private:\ - GTEST_DISALLOW_ASSIGN_($class_name);\ - };\$template - inline $class_name$param_types name($param_types_and_names) {\ - return $class_name$param_types($params);\ - }\$template - template <typename F>\ - template <$typename_arg_types>\ - typename ::testing::internal::Function<F>::Result\ - $class_name$param_types::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const -]] -$$ } // This meta comment fixes auto-indentation in Emacs. It won't -$$ // show up in the generated code. - - -namespace testing { - - -// The ACTION*() macros trigger warning C4100 (unreferenced formal -// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in -// the macro definition, as the warnings are generated when the macro -// is expanded and macro expansion cannot contain #pragma. Therefore -// we suppress them here. -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) -#endif - -// Various overloads for InvokeArgument<N>(). -// -// The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th -// (0-based) argument, which must be a k-ary callable, of the mock -// function, with arguments a1, a2, ..., a_k. -// -// Notes: -// -// 1. The arguments are passed by value by default. If you need to -// pass an argument by reference, wrap it inside ByRef(). For -// example, -// -// InvokeArgument<1>(5, string("Hello"), ByRef(foo)) -// -// passes 5 and string("Hello") by value, and passes foo by -// reference. -// -// 2. If the callable takes an argument by reference but ByRef() is -// not used, it will receive the reference to a copy of the value, -// instead of the original value. For example, when the 0-th -// argument of the mock function takes a const string&, the action -// -// InvokeArgument<0>(string("Hello")) -// -// makes a copy of the temporary string("Hello") object and passes a -// reference of the copy, instead of the original temporary object, -// to the callable. This makes it easy for a user to define an -// InvokeArgument action from temporary values and have it performed -// later. - -namespace internal { -namespace invoke_argument { - -// Appears in InvokeArgumentAdl's argument list to help avoid -// accidental calls to user functions of the same name. -struct AdlTag {}; - -// InvokeArgumentAdl - a helper for InvokeArgument. -// The basic overloads are provided here for generic functors. -// Overloads for other custom-callables are provided in the -// internal/custom/callback-actions.h header. - -$range i 0..n -$for i -[[ -$range j 1..i - -template <typename R, typename F[[$for j [[, typename A$j]]]]> -R InvokeArgumentAdl(AdlTag, F f[[$for j [[, A$j a$j]]]]) { - return f([[$for j, [[a$j]]]]); -} -]] - -} // namespace invoke_argument -} // namespace internal - -$range i 0..n -$for i [[ -$range j 0..i-1 - -ACTION_TEMPLATE(InvokeArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])) { - using internal::invoke_argument::InvokeArgumentAdl; - return InvokeArgumentAdl<return_type>( - internal::invoke_argument::AdlTag(), - ::std::get<k>(args)$for j [[, p$j]]); -} - -]] - -// Various overloads for ReturnNew<T>(). -// -// The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new -// instance of type T, constructed on the heap with constructor arguments -// a1, a2, ..., and a_k. The caller assumes ownership of the returned value. -$range i 0..n -$for i [[ -$range j 0..i-1 -$var ps = [[$for j, [[p$j]]]] - -ACTION_TEMPLATE(ReturnNew, - HAS_1_TEMPLATE_PARAMS(typename, T), - AND_$i[[]]_VALUE_PARAMS($ps)) { - return new T($ps); -} - -]] - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -} // namespace testing - -// Include any custom callback actions added by the local installation. -// We must include this header at the end to make sure it can use the -// declarations from this file. -#include "gmock/internal/custom/gmock-generated-actions.h" - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h b/3rdParty/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h deleted file mode 100644 index cd9578178c00e03f815133514717f71a04b5ce92..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h +++ /dev/null @@ -1,752 +0,0 @@ -// This file was GENERATED by command: -// pump.py gmock-generated-function-mockers.h.pump -// DO NOT EDIT BY HAND!!! - -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements function mockers of various arities. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ - -#include <functional> -#include <utility> - -#include "gmock/gmock-spec-builders.h" -#include "gmock/internal/gmock-internal-utils.h" - -namespace testing { -namespace internal { -// Removes the given pointer; this is a helper for the expectation setter method -// for parameterless matchers. -// -// We want to make sure that the user cannot set a parameterless expectation on -// overloaded methods, including methods which are overloaded on const. Example: -// -// class MockClass { -// MOCK_METHOD0(GetName, string&()); -// MOCK_CONST_METHOD0(GetName, const string&()); -// }; -// -// TEST() { -// // This should be an error, as it's not clear which overload is expected. -// EXPECT_CALL(mock, GetName).WillOnce(ReturnRef(value)); -// } -// -// Here are the generated expectation-setter methods: -// -// class MockClass { -// // Overload 1 -// MockSpec<string&()> gmock_GetName() { ... } -// // Overload 2. Declared const so that the compiler will generate an -// // error when trying to resolve between this and overload 4 in -// // 'gmock_GetName(WithoutMatchers(), nullptr)'. -// MockSpec<string&()> gmock_GetName( -// const WithoutMatchers&, const Function<string&()>*) const { -// // Removes const from this, calls overload 1 -// return AdjustConstness_(this)->gmock_GetName(); -// } -// -// // Overload 3 -// const string& gmock_GetName() const { ... } -// // Overload 4 -// MockSpec<const string&()> gmock_GetName( -// const WithoutMatchers&, const Function<const string&()>*) const { -// // Does not remove const, calls overload 3 -// return AdjustConstness_const(this)->gmock_GetName(); -// } -// } -// -template <typename MockType> -const MockType* AdjustConstness_const(const MockType* mock) { - return mock; -} - -// Removes const from and returns the given pointer; this is a helper for the -// expectation setter method for parameterless matchers. -template <typename MockType> -MockType* AdjustConstness_(const MockType* mock) { - return const_cast<MockType*>(mock); -} - -} // namespace internal - -// The style guide prohibits "using" statements in a namespace scope -// inside a header file. However, the FunctionMocker class template -// is meant to be defined in the ::testing namespace. The following -// line is just a trick for working around a bug in MSVC 8.0, which -// cannot handle it if we define FunctionMocker in ::testing. -using internal::FunctionMocker; - -// GMOCK_RESULT_(tn, F) expands to the result type of function type F. -// We define this as a variadic macro in case F contains unprotected -// commas (the same reason that we use variadic macros in other places -// in this file). -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_RESULT_(tn, ...) \ - tn ::testing::internal::Function<__VA_ARGS__>::Result - -// The type of argument N of the given function type. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_ARG_(tn, N, ...) \ - tn ::testing::internal::Function<__VA_ARGS__>::template Arg<N-1>::type - -// The matcher type for argument N of the given function type. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_MATCHER_(tn, N, ...) \ - const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>& - -// The variable for mocking the given method. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_MOCKER_(arity, constness, Method) \ - GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \ - static_assert(0 == \ - ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \ - "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - ) constness { \ - GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_(0, constness, Method).Invoke(); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method() constness { \ - GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(0, constness, Method).With(); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method(); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \ - Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \ - static_assert(1 == \ - ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \ - "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \ - GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_(1, constness, \ - Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \ - __VA_ARGS__)>(gmock_a1)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \ - GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \ - Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \ - static_assert(2 == \ - ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \ - "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ - __VA_ARGS__) gmock_a2) constness { \ - GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_(2, constness, \ - Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \ - __VA_ARGS__)>(gmock_a1), \ - ::std::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \ - GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \ - Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \ - static_assert(3 == \ - ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \ - "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ - __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, \ - __VA_ARGS__) gmock_a3) constness { \ - GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_(3, constness, \ - Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \ - __VA_ARGS__)>(gmock_a1), \ - ::std::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \ - ::std::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \ - GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \ - gmock_a3); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \ - Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \ - static_assert(4 == \ - ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \ - "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ - __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \ - GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_(4, constness, \ - Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \ - __VA_ARGS__)>(gmock_a1), \ - ::std::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \ - ::std::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \ - ::std::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \ - GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \ - gmock_a3, gmock_a4); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \ - Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \ - static_assert(5 == \ - ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \ - "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ - __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ - __VA_ARGS__) gmock_a5) constness { \ - GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_(5, constness, \ - Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \ - __VA_ARGS__)>(gmock_a1), \ - ::std::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \ - ::std::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \ - ::std::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \ - ::std::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \ - GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \ - gmock_a3, gmock_a4, gmock_a5); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \ - Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \ - static_assert(6 == \ - ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \ - "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ - __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ - __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, \ - __VA_ARGS__) gmock_a6) constness { \ - GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_(6, constness, \ - Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \ - __VA_ARGS__)>(gmock_a1), \ - ::std::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \ - ::std::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \ - ::std::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \ - ::std::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \ - ::std::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \ - GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \ - gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \ - Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \ - static_assert(7 == \ - ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \ - "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ - __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ - __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \ - GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_(7, constness, \ - Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \ - __VA_ARGS__)>(gmock_a1), \ - ::std::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \ - ::std::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \ - ::std::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \ - ::std::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \ - ::std::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \ - ::std::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \ - GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \ - gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \ - Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \ - static_assert(8 == \ - ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \ - "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ - __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ - __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \ - __VA_ARGS__) gmock_a8) constness { \ - GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_(8, constness, \ - Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \ - __VA_ARGS__)>(gmock_a1), \ - ::std::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \ - ::std::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \ - ::std::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \ - ::std::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \ - ::std::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \ - ::std::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \ - ::std::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \ - GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \ - gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 8, __VA_ARGS__)>()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \ - Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \ - static_assert(9 == \ - ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \ - "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ - __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ - __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \ - __VA_ARGS__) gmock_a8, GMOCK_ARG_(tn, 9, \ - __VA_ARGS__) gmock_a9) constness { \ - GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_(9, constness, \ - Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \ - __VA_ARGS__)>(gmock_a1), \ - ::std::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \ - ::std::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \ - ::std::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \ - ::std::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \ - ::std::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \ - ::std::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \ - ::std::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8), \ - ::std::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>(gmock_a9)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ - GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \ - GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \ - gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \ - gmock_a9); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 9, __VA_ARGS__)>()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \ - Method) - -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \ - static_assert(10 == \ - ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \ - "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \ - __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \ - __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \ - __VA_ARGS__) gmock_a8, GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \ - GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \ - GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_(10, constness, \ - Method).Invoke(::std::forward<GMOCK_ARG_(tn, 1, \ - __VA_ARGS__)>(gmock_a1), \ - ::std::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \ - ::std::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \ - ::std::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \ - ::std::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \ - ::std::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \ - ::std::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \ - ::std::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8), \ - ::std::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>(gmock_a9), \ - ::std::forward<GMOCK_ARG_(tn, 10, __VA_ARGS__)>(gmock_a10)); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \ - GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \ - GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \ - GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \ - GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \ - GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \ - GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \ - GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \ - GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \ - GMOCK_MATCHER_(tn, 10, \ - __VA_ARGS__) gmock_a10) constness { \ - GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \ - gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \ - gmock_a10); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 9, __VA_ARGS__)>(), \ - ::testing::A<GMOCK_ARG_(tn, 10, __VA_ARGS__)>()); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \ - Method) - -#define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__) -#define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__) -#define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__) -#define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__) -#define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__) -#define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__) -#define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__) -#define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__) -#define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__) -#define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__) -#define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__) - -#define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__) - -#define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__) -#define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__) - -#define MOCK_CONST_METHOD0_T(m, ...) \ - GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD1_T(m, ...) \ - GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD2_T(m, ...) \ - GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD3_T(m, ...) \ - GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD4_T(m, ...) \ - GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD5_T(m, ...) \ - GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD6_T(m, ...) \ - GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD7_T(m, ...) \ - GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD8_T(m, ...) \ - GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD9_T(m, ...) \ - GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__) -#define MOCK_CONST_METHOD10_T(m, ...) \ - GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__) - -#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD0_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD1_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD2_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD3_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD4_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD5_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD6_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD7_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD8_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD9_(, , ct, m, __VA_ARGS__) -#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD10_(, , ct, m, __VA_ARGS__) - -#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__) - -#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__) -#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__) - -#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__) -#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__) - -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump b/3rdParty/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump deleted file mode 100644 index a56e132f348706701dc1cfafa51bd0e61ed400e1..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +++ /dev/null @@ -1,227 +0,0 @@ -$$ -*- mode: c++; -*- -$$ This is a Pump source file. Please use Pump to convert -$$ it to gmock-generated-function-mockers.h. -$$ -$var n = 10 $$ The maximum arity we support. -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements function mockers of various arities. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ - -#include <functional> -#include <utility> - -#include "gmock/gmock-spec-builders.h" -#include "gmock/internal/gmock-internal-utils.h" - -namespace testing { -namespace internal { - -$range i 0..n -// Removes the given pointer; this is a helper for the expectation setter method -// for parameterless matchers. -// -// We want to make sure that the user cannot set a parameterless expectation on -// overloaded methods, including methods which are overloaded on const. Example: -// -// class MockClass { -// MOCK_METHOD0(GetName, string&()); -// MOCK_CONST_METHOD0(GetName, const string&()); -// }; -// -// TEST() { -// // This should be an error, as it's not clear which overload is expected. -// EXPECT_CALL(mock, GetName).WillOnce(ReturnRef(value)); -// } -// -// Here are the generated expectation-setter methods: -// -// class MockClass { -// // Overload 1 -// MockSpec<string&()> gmock_GetName() { ... } -// // Overload 2. Declared const so that the compiler will generate an -// // error when trying to resolve between this and overload 4 in -// // 'gmock_GetName(WithoutMatchers(), nullptr)'. -// MockSpec<string&()> gmock_GetName( -// const WithoutMatchers&, const Function<string&()>*) const { -// // Removes const from this, calls overload 1 -// return AdjustConstness_(this)->gmock_GetName(); -// } -// -// // Overload 3 -// const string& gmock_GetName() const { ... } -// // Overload 4 -// MockSpec<const string&()> gmock_GetName( -// const WithoutMatchers&, const Function<const string&()>*) const { -// // Does not remove const, calls overload 3 -// return AdjustConstness_const(this)->gmock_GetName(); -// } -// } -// -template <typename MockType> -const MockType* AdjustConstness_const(const MockType* mock) { - return mock; -} - -// Removes const from and returns the given pointer; this is a helper for the -// expectation setter method for parameterless matchers. -template <typename MockType> -MockType* AdjustConstness_(const MockType* mock) { - return const_cast<MockType*>(mock); -} - -} // namespace internal - -// The style guide prohibits "using" statements in a namespace scope -// inside a header file. However, the FunctionMocker class template -// is meant to be defined in the ::testing namespace. The following -// line is just a trick for working around a bug in MSVC 8.0, which -// cannot handle it if we define FunctionMocker in ::testing. -using internal::FunctionMocker; - -// GMOCK_RESULT_(tn, F) expands to the result type of function type F. -// We define this as a variadic macro in case F contains unprotected -// commas (the same reason that we use variadic macros in other places -// in this file). -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_RESULT_(tn, ...) \ - tn ::testing::internal::Function<__VA_ARGS__>::Result - -// The type of argument N of the given function type. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_ARG_(tn, N, ...) \ - tn ::testing::internal::Function<__VA_ARGS__>::template Arg<N-1>::type - -// The matcher type for argument N of the given function type. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_MATCHER_(tn, N, ...) \ - const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>& - -// The variable for mocking the given method. -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_MOCKER_(arity, constness, Method) \ - GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) - - -$for i [[ -$range j 1..i -$var arg_as = [[$for j, [[GMOCK_ARG_(tn, $j, __VA_ARGS__) gmock_a$j]]]] -$var as = [[$for j, \ - [[::std::forward<GMOCK_ARG_(tn, $j, __VA_ARGS__)>(gmock_a$j)]]]] -$var matcher_arg_as = [[$for j, \ - [[GMOCK_MATCHER_(tn, $j, __VA_ARGS__) gmock_a$j]]]] -$var matcher_as = [[$for j, [[gmock_a$j]]]] -$var anything_matchers = [[$for j, \ - [[::testing::A<GMOCK_ARG_(tn, $j, __VA_ARGS__)>()]]]] -// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \ - static_assert($i == ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ - $arg_as) constness { \ - GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \ - return GMOCK_MOCKER_($i, constness, Method).Invoke($as); \ - } \ - ::testing::MockSpec<__VA_ARGS__> \ - gmock_##Method($matcher_arg_as) constness { \ - GMOCK_MOCKER_($i, constness, Method).RegisterOwner(this); \ - return GMOCK_MOCKER_($i, constness, Method).With($matcher_as); \ - } \ - ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \ - const ::testing::internal::WithoutMatchers&, \ - constness ::testing::internal::Function<__VA_ARGS__>* ) const { \ - return ::testing::internal::AdjustConstness_##constness(this)-> \ - gmock_##Method($anything_matchers); \ - } \ - mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_($i, constness, Method) - - -]] -$for i [[ -#define MOCK_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, , , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, const, , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_METHOD$i[[]]_T(m, ...) GMOCK_METHOD$i[[]]_(typename, , , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i[[]]_T(m, ...) \ - GMOCK_METHOD$i[[]]_(typename, const, , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(, , ct, m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(, const, ct, m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(typename, , ct, m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(typename, const, ct, m, __VA_ARGS__) - -]] - -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-matchers.h b/3rdParty/googletest/googlemock/include/gmock/gmock-generated-matchers.h deleted file mode 100644 index 690a57f1c9fd7560b604815ea830c1aa9d44bf49..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-matchers.h +++ /dev/null @@ -1,1097 +0,0 @@ -// This file was GENERATED by command: -// pump.py gmock-generated-matchers.h.pump -// DO NOT EDIT BY HAND!!! - -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used variadic matchers. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ - -#include <iterator> -#include <sstream> -#include <string> -#include <utility> -#include <vector> -#include "gmock/gmock-matchers.h" - -// The MATCHER* family of macros can be used in a namespace scope to -// define custom matchers easily. -// -// Basic Usage -// =========== -// -// The syntax -// -// MATCHER(name, description_string) { statements; } -// -// defines a matcher with the given name that executes the statements, -// which must return a bool to indicate if the match succeeds. Inside -// the statements, you can refer to the value being matched by 'arg', -// and refer to its type by 'arg_type'. -// -// The description string documents what the matcher does, and is used -// to generate the failure message when the match fails. Since a -// MATCHER() is usually defined in a header file shared by multiple -// C++ source files, we require the description to be a C-string -// literal to avoid possible side effects. It can be empty, in which -// case we'll use the sequence of words in the matcher name as the -// description. -// -// For example: -// -// MATCHER(IsEven, "") { return (arg % 2) == 0; } -// -// allows you to write -// -// // Expects mock_foo.Bar(n) to be called where n is even. -// EXPECT_CALL(mock_foo, Bar(IsEven())); -// -// or, -// -// // Verifies that the value of some_expression is even. -// EXPECT_THAT(some_expression, IsEven()); -// -// If the above assertion fails, it will print something like: -// -// Value of: some_expression -// Expected: is even -// Actual: 7 -// -// where the description "is even" is automatically calculated from the -// matcher name IsEven. -// -// Argument Type -// ============= -// -// Note that the type of the value being matched (arg_type) is -// determined by the context in which you use the matcher and is -// supplied to you by the compiler, so you don't need to worry about -// declaring it (nor can you). This allows the matcher to be -// polymorphic. For example, IsEven() can be used to match any type -// where the value of "(arg % 2) == 0" can be implicitly converted to -// a bool. In the "Bar(IsEven())" example above, if method Bar() -// takes an int, 'arg_type' will be int; if it takes an unsigned long, -// 'arg_type' will be unsigned long; and so on. -// -// Parameterizing Matchers -// ======================= -// -// Sometimes you'll want to parameterize the matcher. For that you -// can use another macro: -// -// MATCHER_P(name, param_name, description_string) { statements; } -// -// For example: -// -// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } -// -// will allow you to write: -// -// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); -// -// which may lead to this message (assuming n is 10): -// -// Value of: Blah("a") -// Expected: has absolute value 10 -// Actual: -9 -// -// Note that both the matcher description and its parameter are -// printed, making the message human-friendly. -// -// In the matcher definition body, you can write 'foo_type' to -// reference the type of a parameter named 'foo'. For example, in the -// body of MATCHER_P(HasAbsoluteValue, value) above, you can write -// 'value_type' to refer to the type of 'value'. -// -// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P10 to -// support multi-parameter matchers. -// -// Describing Parameterized Matchers -// ================================= -// -// The last argument to MATCHER*() is a string-typed expression. The -// expression can reference all of the matcher's parameters and a -// special bool-typed variable named 'negation'. When 'negation' is -// false, the expression should evaluate to the matcher's description; -// otherwise it should evaluate to the description of the negation of -// the matcher. For example, -// -// using testing::PrintToString; -// -// MATCHER_P2(InClosedRange, low, hi, -// std::string(negation ? "is not" : "is") + " in range [" + -// PrintToString(low) + ", " + PrintToString(hi) + "]") { -// return low <= arg && arg <= hi; -// } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: is in range [4, 6] -// ... -// Expected: is not in range [2, 4] -// -// If you specify "" as the description, the failure message will -// contain the sequence of words in the matcher name followed by the -// parameter values printed as a tuple. For example, -// -// MATCHER_P2(InClosedRange, low, hi, "") { ... } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: in closed range (4, 6) -// ... -// Expected: not (in closed range (2, 4)) -// -// Types of Matcher Parameters -// =========================== -// -// For the purpose of typing, you can view -// -// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } -// -// as shorthand for -// -// template <typename p1_type, ..., typename pk_type> -// FooMatcherPk<p1_type, ..., pk_type> -// Foo(p1_type p1, ..., pk_type pk) { ... } -// -// When you write Foo(v1, ..., vk), the compiler infers the types of -// the parameters v1, ..., and vk for you. If you are not happy with -// the result of the type inference, you can specify the types by -// explicitly instantiating the template, as in Foo<long, bool>(5, -// false). As said earlier, you don't get to (or need to) specify -// 'arg_type' as that's determined by the context in which the matcher -// is used. You can assign the result of expression Foo(p1, ..., pk) -// to a variable of type FooMatcherPk<p1_type, ..., pk_type>. This -// can be useful when composing matchers. -// -// While you can instantiate a matcher template with reference types, -// passing the parameters by pointer usually makes your code more -// readable. If, however, you still want to pass a parameter by -// reference, be aware that in the failure message generated by the -// matcher you will see the value of the referenced object but not its -// address. -// -// Explaining Match Results -// ======================== -// -// Sometimes the matcher description alone isn't enough to explain why -// the match has failed or succeeded. For example, when expecting a -// long string, it can be very helpful to also print the diff between -// the expected string and the actual one. To achieve that, you can -// optionally stream additional information to a special variable -// named result_listener, whose type is a pointer to class -// MatchResultListener: -// -// MATCHER_P(EqualsLongString, str, "") { -// if (arg == str) return true; -// -// *result_listener << "the difference: " -/// << DiffStrings(str, arg); -// return false; -// } -// -// Overloading Matchers -// ==================== -// -// You can overload matchers with different numbers of parameters: -// -// MATCHER_P(Blah, a, description_string1) { ... } -// MATCHER_P2(Blah, a, b, description_string2) { ... } -// -// Caveats -// ======= -// -// When defining a new matcher, you should also consider implementing -// MatcherInterface or using MakePolymorphicMatcher(). These -// approaches require more work than the MATCHER* macros, but also -// give you more control on the types of the value being matched and -// the matcher parameters, which may leads to better compiler error -// messages when the matcher is used wrong. They also allow -// overloading matchers based on parameter types (as opposed to just -// based on the number of parameters). -// -// MATCHER*() can only be used in a namespace scope as templates cannot be -// declared inside of a local class. -// -// More Information -// ================ -// -// To learn more about using these macros, please search for 'MATCHER' -// on -// https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md - -#define MATCHER(name, description)\ - class name##Matcher {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - gmock_Impl()\ - {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<>()));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>());\ - }\ - name##Matcher() {\ - }\ - private:\ - };\ - inline name##Matcher name() {\ - return name##Matcher();\ - }\ - template <typename arg_type>\ - bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P(name, p0, description)\ - template <typename p0##_type>\ - class name##MatcherP {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - explicit gmock_Impl(p0##_type gmock_p0)\ - : p0(::std::move(gmock_p0)) {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type const p0;\ - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<p0##_type>(p0)));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0));\ - }\ - explicit name##MatcherP(p0##_type gmock_p0) : p0(::std::move(gmock_p0)) {\ - }\ - p0##_type const p0;\ - private:\ - };\ - template <typename p0##_type>\ - inline name##MatcherP<p0##_type> name(p0##_type p0) {\ - return name##MatcherP<p0##_type>(p0);\ - }\ - template <typename p0##_type>\ - template <typename arg_type>\ - bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P2(name, p0, p1, description)\ - template <typename p0##_type, typename p1##_type>\ - class name##MatcherP2 {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\ - : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)) {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<p0##_type, p1##_type>(p0, p1)));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1));\ - }\ - name##MatcherP2(p0##_type gmock_p0, \ - p1##_type gmock_p1) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)) {\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - private:\ - };\ - template <typename p0##_type, typename p1##_type>\ - inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \ - p1##_type p1) {\ - return name##MatcherP2<p0##_type, p1##_type>(p0, p1);\ - }\ - template <typename p0##_type, typename p1##_type>\ - template <typename arg_type>\ - bool name##MatcherP2<p0##_type, \ - p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P3(name, p0, p1, p2, description)\ - template <typename p0##_type, typename p1##_type, typename p2##_type>\ - class name##MatcherP3 {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\ - : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ - p2(::std::move(gmock_p2)) {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, p2)));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2));\ - }\ - name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)) {\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - private:\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type>\ - inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \ - p1##_type p1, p2##_type p2) {\ - return name##MatcherP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type>\ - template <typename arg_type>\ - bool name##MatcherP3<p0##_type, p1##_type, \ - p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P4(name, p0, p1, p2, p3, description)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type>\ - class name##MatcherP4 {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3)\ - : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ - p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)) {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \ - p1, p2, p3)));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3));\ - }\ - name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)) {\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - private:\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type>\ - inline name##MatcherP4<p0##_type, p1##_type, p2##_type, \ - p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ - p3##_type p3) {\ - return name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \ - p1, p2, p3);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type>\ - template <typename arg_type>\ - bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \ - p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type>\ - class name##MatcherP5 {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4)\ - : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ - p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ - p4(::std::move(gmock_p4)) {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type>(p0, p1, p2, p3, p4)));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4));\ - }\ - name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, \ - p4##_type gmock_p4) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)) {\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - private:\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type>\ - inline name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4) {\ - return name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type>(p0, p1, p2, p3, p4);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type>\ - template <typename arg_type>\ - bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type>\ - class name##MatcherP6 {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\ - : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ - p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ - p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)) {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - p5##_type const p5;\ - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5));\ - }\ - name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)) {\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - p5##_type const p5;\ - private:\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type>\ - inline name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ - p3##_type p3, p4##_type p4, p5##_type p5) {\ - return name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type>\ - template <typename arg_type>\ - bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type>\ - class name##MatcherP7 {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6)\ - : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ - p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ - p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ - p6(::std::move(gmock_p6)) {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - p5##_type const p5;\ - p6##_type const p6;\ - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \ - p6)));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6));\ - }\ - name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)) {\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - p5##_type const p5;\ - p6##_type const p6;\ - private:\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type>\ - inline name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \ - p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ - p6##_type p6) {\ - return name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type>\ - template <typename arg_type>\ - bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type>\ - class name##MatcherP8 {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7)\ - : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ - p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ - p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ - p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)) {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - p5##_type const p5;\ - p6##_type const p6;\ - p7##_type const p7;\ - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \ - p3, p4, p5, p6, p7)));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7));\ - }\ - name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, \ - p7##_type gmock_p7) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \ - p7(::std::move(gmock_p7)) {\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - p5##_type const p5;\ - p6##_type const p6;\ - p7##_type const p7;\ - private:\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type>\ - inline name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \ - p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ - p6##_type p6, p7##_type p7) {\ - return name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \ - p6, p7);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type>\ - template <typename arg_type>\ - bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, \ - p7##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type>\ - class name##MatcherP9 {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\ - : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ - p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ - p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ - p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)), \ - p8(::std::move(gmock_p8)) {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - p5##_type const p5;\ - p6##_type const p6;\ - p7##_type const p7;\ - p8##_type const p8;\ - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, \ - p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8));\ - }\ - name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \ - p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)) {\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - p5##_type const p5;\ - p6##_type const p6;\ - p7##_type const p7;\ - p8##_type const p8;\ - private:\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type>\ - inline name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, \ - p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ - p8##_type p8) {\ - return name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \ - p3, p4, p5, p6, p7, p8);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type>\ - template <typename arg_type>\ - bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type, \ - p8##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type, \ - typename p9##_type>\ - class name##MatcherP10 {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ - p9##_type gmock_p9)\ - : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ - p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ - p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ - p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)), \ - p8(::std::move(gmock_p8)), p9(::std::move(gmock_p9)) {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - p5##_type const p5;\ - p6##_type const p6;\ - p7##_type const p7;\ - p8##_type const p8;\ - p9##_type const p9;\ - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ - p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\ - }\ - name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8, p9##_type gmock_p9) : p0(::std::move(gmock_p0)), \ - p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \ - p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \ - p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \ - p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)), \ - p9(::std::move(gmock_p9)) {\ - }\ - p0##_type const p0;\ - p1##_type const p1;\ - p2##_type const p2;\ - p3##_type const p3;\ - p4##_type const p4;\ - p5##_type const p5;\ - p6##_type const p6;\ - p7##_type const p7;\ - p8##_type const p8;\ - p9##_type const p9;\ - private:\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type, \ - typename p9##_type>\ - inline name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ - p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ - p9##_type p9) {\ - return name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \ - p1, p2, p3, p4, p5, p6, p7, p8, p9);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type, \ - typename p9##_type>\ - template <typename arg_type>\ - bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ - p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-matchers.h.pump b/3rdParty/googletest/googlemock/include/gmock/gmock-generated-matchers.h.pump deleted file mode 100644 index ae90917cc38e2dcf556fe5b8034bedf673c4121e..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ /dev/null @@ -1,346 +0,0 @@ -$$ -*- mode: c++; -*- -$$ This is a Pump source file. Please use Pump to convert -$$ it to gmock-generated-matchers.h. -$$ -$var n = 10 $$ The maximum arity we support. -$$ }} This line fixes auto-indentation of the following code in Emacs. -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used variadic matchers. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ - -#include <iterator> -#include <sstream> -#include <string> -#include <utility> -#include <vector> -#include "gmock/gmock-matchers.h" - -// The MATCHER* family of macros can be used in a namespace scope to -// define custom matchers easily. -// -// Basic Usage -// =========== -// -// The syntax -// -// MATCHER(name, description_string) { statements; } -// -// defines a matcher with the given name that executes the statements, -// which must return a bool to indicate if the match succeeds. Inside -// the statements, you can refer to the value being matched by 'arg', -// and refer to its type by 'arg_type'. -// -// The description string documents what the matcher does, and is used -// to generate the failure message when the match fails. Since a -// MATCHER() is usually defined in a header file shared by multiple -// C++ source files, we require the description to be a C-string -// literal to avoid possible side effects. It can be empty, in which -// case we'll use the sequence of words in the matcher name as the -// description. -// -// For example: -// -// MATCHER(IsEven, "") { return (arg % 2) == 0; } -// -// allows you to write -// -// // Expects mock_foo.Bar(n) to be called where n is even. -// EXPECT_CALL(mock_foo, Bar(IsEven())); -// -// or, -// -// // Verifies that the value of some_expression is even. -// EXPECT_THAT(some_expression, IsEven()); -// -// If the above assertion fails, it will print something like: -// -// Value of: some_expression -// Expected: is even -// Actual: 7 -// -// where the description "is even" is automatically calculated from the -// matcher name IsEven. -// -// Argument Type -// ============= -// -// Note that the type of the value being matched (arg_type) is -// determined by the context in which you use the matcher and is -// supplied to you by the compiler, so you don't need to worry about -// declaring it (nor can you). This allows the matcher to be -// polymorphic. For example, IsEven() can be used to match any type -// where the value of "(arg % 2) == 0" can be implicitly converted to -// a bool. In the "Bar(IsEven())" example above, if method Bar() -// takes an int, 'arg_type' will be int; if it takes an unsigned long, -// 'arg_type' will be unsigned long; and so on. -// -// Parameterizing Matchers -// ======================= -// -// Sometimes you'll want to parameterize the matcher. For that you -// can use another macro: -// -// MATCHER_P(name, param_name, description_string) { statements; } -// -// For example: -// -// MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } -// -// will allow you to write: -// -// EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); -// -// which may lead to this message (assuming n is 10): -// -// Value of: Blah("a") -// Expected: has absolute value 10 -// Actual: -9 -// -// Note that both the matcher description and its parameter are -// printed, making the message human-friendly. -// -// In the matcher definition body, you can write 'foo_type' to -// reference the type of a parameter named 'foo'. For example, in the -// body of MATCHER_P(HasAbsoluteValue, value) above, you can write -// 'value_type' to refer to the type of 'value'. -// -// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P$n to -// support multi-parameter matchers. -// -// Describing Parameterized Matchers -// ================================= -// -// The last argument to MATCHER*() is a string-typed expression. The -// expression can reference all of the matcher's parameters and a -// special bool-typed variable named 'negation'. When 'negation' is -// false, the expression should evaluate to the matcher's description; -// otherwise it should evaluate to the description of the negation of -// the matcher. For example, -// -// using testing::PrintToString; -// -// MATCHER_P2(InClosedRange, low, hi, -// std::string(negation ? "is not" : "is") + " in range [" + -// PrintToString(low) + ", " + PrintToString(hi) + "]") { -// return low <= arg && arg <= hi; -// } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: is in range [4, 6] -// ... -// Expected: is not in range [2, 4] -// -// If you specify "" as the description, the failure message will -// contain the sequence of words in the matcher name followed by the -// parameter values printed as a tuple. For example, -// -// MATCHER_P2(InClosedRange, low, hi, "") { ... } -// ... -// EXPECT_THAT(3, InClosedRange(4, 6)); -// EXPECT_THAT(3, Not(InClosedRange(2, 4))); -// -// would generate two failures that contain the text: -// -// Expected: in closed range (4, 6) -// ... -// Expected: not (in closed range (2, 4)) -// -// Types of Matcher Parameters -// =========================== -// -// For the purpose of typing, you can view -// -// MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } -// -// as shorthand for -// -// template <typename p1_type, ..., typename pk_type> -// FooMatcherPk<p1_type, ..., pk_type> -// Foo(p1_type p1, ..., pk_type pk) { ... } -// -// When you write Foo(v1, ..., vk), the compiler infers the types of -// the parameters v1, ..., and vk for you. If you are not happy with -// the result of the type inference, you can specify the types by -// explicitly instantiating the template, as in Foo<long, bool>(5, -// false). As said earlier, you don't get to (or need to) specify -// 'arg_type' as that's determined by the context in which the matcher -// is used. You can assign the result of expression Foo(p1, ..., pk) -// to a variable of type FooMatcherPk<p1_type, ..., pk_type>. This -// can be useful when composing matchers. -// -// While you can instantiate a matcher template with reference types, -// passing the parameters by pointer usually makes your code more -// readable. If, however, you still want to pass a parameter by -// reference, be aware that in the failure message generated by the -// matcher you will see the value of the referenced object but not its -// address. -// -// Explaining Match Results -// ======================== -// -// Sometimes the matcher description alone isn't enough to explain why -// the match has failed or succeeded. For example, when expecting a -// long string, it can be very helpful to also print the diff between -// the expected string and the actual one. To achieve that, you can -// optionally stream additional information to a special variable -// named result_listener, whose type is a pointer to class -// MatchResultListener: -// -// MATCHER_P(EqualsLongString, str, "") { -// if (arg == str) return true; -// -// *result_listener << "the difference: " -/// << DiffStrings(str, arg); -// return false; -// } -// -// Overloading Matchers -// ==================== -// -// You can overload matchers with different numbers of parameters: -// -// MATCHER_P(Blah, a, description_string1) { ... } -// MATCHER_P2(Blah, a, b, description_string2) { ... } -// -// Caveats -// ======= -// -// When defining a new matcher, you should also consider implementing -// MatcherInterface or using MakePolymorphicMatcher(). These -// approaches require more work than the MATCHER* macros, but also -// give you more control on the types of the value being matched and -// the matcher parameters, which may leads to better compiler error -// messages when the matcher is used wrong. They also allow -// overloading matchers based on parameter types (as opposed to just -// based on the number of parameters). -// -// MATCHER*() can only be used in a namespace scope as templates cannot be -// declared inside of a local class. -// -// More Information -// ================ -// -// To learn more about using these macros, please search for 'MATCHER' -// on -// https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md - -$range i 0..n -$for i - -[[ -$var macro_name = [[$if i==0 [[MATCHER]] $elif i==1 [[MATCHER_P]] - $else [[MATCHER_P$i]]]] -$var class_name = [[name##Matcher[[$if i==0 [[]] $elif i==1 [[P]] - $else [[P$i]]]]]] -$range j 0..i-1 -$var template = [[$if i==0 [[]] $else [[ - - template <$for j, [[typename p$j##_type]]>\ -]]]] -$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] -$var impl_ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] -$var impl_inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::std::move(gmock_p$j))]]]]]] -$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::std::move(gmock_p$j))]]]]]] -$var params = [[$for j, [[p$j]]]] -$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]] -$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] -$var param_field_decls = [[$for j -[[ - - p$j##_type const p$j;\ -]]]] -$var param_field_decls2 = [[$for j -[[ - - p$j##_type const p$j;\ -]]]] - -#define $macro_name(name$for j [[, p$j]], description)\$template - class $class_name {\ - public:\ - template <typename arg_type>\ - class gmock_Impl : public ::testing::MatcherInterface<\ - GTEST_REFERENCE_TO_CONST_(arg_type)> {\ - public:\ - [[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\ - $impl_inits {}\ - virtual bool MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener) const;\ - virtual void DescribeTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(false);\ - }\ - virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ - *gmock_os << FormatDescription(true);\ - }\$param_field_decls - private:\ - ::std::string FormatDescription(bool negation) const {\ - ::std::string gmock_description = (description);\ - if (!gmock_description.empty()) {\ - return gmock_description;\ - }\ - return ::testing::internal::FormatMatcherDescription(\ - negation, #name, \ - ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ - ::std::tuple<$for j, [[p$j##_type]]>($for j, [[p$j]])));\ - }\ - };\ - template <typename arg_type>\ - operator ::testing::Matcher<arg_type>() const {\ - return ::testing::Matcher<arg_type>(\ - new gmock_Impl<arg_type>($params));\ - }\ - [[$if i==1 [[explicit ]]]]$class_name($ctor_param_list)$inits {\ - }\$param_field_decls2 - private:\ - };\$template - inline $class_name$param_types name($param_types_and_names) {\ - return $class_name$param_types($params);\ - }\$template - template <typename arg_type>\ - bool $class_name$param_types::gmock_Impl<arg_type>::MatchAndExplain(\ - GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ - ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ - const -]] - - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-matchers.h b/3rdParty/googletest/googlemock/include/gmock/gmock-matchers.h deleted file mode 100644 index 28e188bb8130881858d7b9ee1c14b76c7ddbd5f6..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-matchers.h +++ /dev/null @@ -1,4568 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some commonly used argument matchers. More -// matchers can be defined by the user implementing the -// MatcherInterface<T> interface if necessary. -// -// See googletest/include/gtest/gtest-matchers.h for the definition of class -// Matcher, class MatcherInterface, and others. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ - -#include <math.h> -#include <algorithm> -#include <initializer_list> -#include <iterator> -#include <limits> -#include <memory> -#include <ostream> // NOLINT -#include <sstream> -#include <string> -#include <type_traits> -#include <utility> -#include <vector> -#include "gmock/internal/gmock-internal-utils.h" -#include "gmock/internal/gmock-port.h" -#include "gtest/gtest.h" - -// MSVC warning C5046 is new as of VS2017 version 15.8. -#if defined(_MSC_VER) && _MSC_VER >= 1915 -#define GMOCK_MAYBE_5046_ 5046 -#else -#define GMOCK_MAYBE_5046_ -#endif - -GTEST_DISABLE_MSC_WARNINGS_PUSH_( - 4251 GMOCK_MAYBE_5046_ /* class A needs to have dll-interface to be used by - clients of class B */ - /* Symbol involving type with internal linkage not defined */) - -namespace testing { - -// To implement a matcher Foo for type T, define: -// 1. a class FooMatcherImpl that implements the -// MatcherInterface<T> interface, and -// 2. a factory function that creates a Matcher<T> object from a -// FooMatcherImpl*. -// -// The two-level delegation design makes it possible to allow a user -// to write "v" instead of "Eq(v)" where a Matcher is expected, which -// is impossible if we pass matchers by pointers. It also eases -// ownership management as Matcher objects can now be copied like -// plain values. - -// A match result listener that stores the explanation in a string. -class StringMatchResultListener : public MatchResultListener { - public: - StringMatchResultListener() : MatchResultListener(&ss_) {} - - // Returns the explanation accumulated so far. - std::string str() const { return ss_.str(); } - - // Clears the explanation accumulated so far. - void Clear() { ss_.str(""); } - - private: - ::std::stringstream ss_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(StringMatchResultListener); -}; - -// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION -// and MUST NOT BE USED IN USER CODE!!! -namespace internal { - -// The MatcherCastImpl class template is a helper for implementing -// MatcherCast(). We need this helper in order to partially -// specialize the implementation of MatcherCast() (C++ allows -// class/struct templates to be partially specialized, but not -// function templates.). - -// This general version is used when MatcherCast()'s argument is a -// polymorphic matcher (i.e. something that can be converted to a -// Matcher but is not one yet; for example, Eq(value)) or a value (for -// example, "hello"). -template <typename T, typename M> -class MatcherCastImpl { - public: - static Matcher<T> Cast(const M& polymorphic_matcher_or_value) { - // M can be a polymorphic matcher, in which case we want to use - // its conversion operator to create Matcher<T>. Or it can be a value - // that should be passed to the Matcher<T>'s constructor. - // - // We can't call Matcher<T>(polymorphic_matcher_or_value) when M is a - // polymorphic matcher because it'll be ambiguous if T has an implicit - // constructor from M (this usually happens when T has an implicit - // constructor from any type). - // - // It won't work to unconditionally implict_cast - // polymorphic_matcher_or_value to Matcher<T> because it won't trigger - // a user-defined conversion from M to T if one exists (assuming M is - // a value). - return CastImpl(polymorphic_matcher_or_value, - std::is_convertible<M, Matcher<T>>{}, - std::is_convertible<M, T>{}); - } - - private: - template <bool Ignore> - static Matcher<T> CastImpl(const M& polymorphic_matcher_or_value, - std::true_type /* convertible_to_matcher */, - bool_constant<Ignore>) { - // M is implicitly convertible to Matcher<T>, which means that either - // M is a polymorphic matcher or Matcher<T> has an implicit constructor - // from M. In both cases using the implicit conversion will produce a - // matcher. - // - // Even if T has an implicit constructor from M, it won't be called because - // creating Matcher<T> would require a chain of two user-defined conversions - // (first to create T from M and then to create Matcher<T> from T). - return polymorphic_matcher_or_value; - } - - // M can't be implicitly converted to Matcher<T>, so M isn't a polymorphic - // matcher. It's a value of a type implicitly convertible to T. Use direct - // initialization to create a matcher. - static Matcher<T> CastImpl(const M& value, - std::false_type /* convertible_to_matcher */, - std::true_type /* convertible_to_T */) { - return Matcher<T>(ImplicitCast_<T>(value)); - } - - // M can't be implicitly converted to either Matcher<T> or T. Attempt to use - // polymorphic matcher Eq(value) in this case. - // - // Note that we first attempt to perform an implicit cast on the value and - // only fall back to the polymorphic Eq() matcher afterwards because the - // latter calls bool operator==(const Lhs& lhs, const Rhs& rhs) in the end - // which might be undefined even when Rhs is implicitly convertible to Lhs - // (e.g. std::pair<const int, int> vs. std::pair<int, int>). - // - // We don't define this method inline as we need the declaration of Eq(). - static Matcher<T> CastImpl(const M& value, - std::false_type /* convertible_to_matcher */, - std::false_type /* convertible_to_T */); -}; - -// This more specialized version is used when MatcherCast()'s argument -// is already a Matcher. This only compiles when type T can be -// statically converted to type U. -template <typename T, typename U> -class MatcherCastImpl<T, Matcher<U> > { - public: - static Matcher<T> Cast(const Matcher<U>& source_matcher) { - return Matcher<T>(new Impl(source_matcher)); - } - - private: - class Impl : public MatcherInterface<T> { - public: - explicit Impl(const Matcher<U>& source_matcher) - : source_matcher_(source_matcher) {} - - // We delegate the matching logic to the source matcher. - bool MatchAndExplain(T x, MatchResultListener* listener) const override { - using FromType = typename std::remove_cv<typename std::remove_pointer< - typename std::remove_reference<T>::type>::type>::type; - using ToType = typename std::remove_cv<typename std::remove_pointer< - typename std::remove_reference<U>::type>::type>::type; - // Do not allow implicitly converting base*/& to derived*/&. - static_assert( - // Do not trigger if only one of them is a pointer. That implies a - // regular conversion and not a down_cast. - (std::is_pointer<typename std::remove_reference<T>::type>::value != - std::is_pointer<typename std::remove_reference<U>::type>::value) || - std::is_same<FromType, ToType>::value || - !std::is_base_of<FromType, ToType>::value, - "Can't implicitly convert from <base> to <derived>"); - - return source_matcher_.MatchAndExplain(static_cast<U>(x), listener); - } - - void DescribeTo(::std::ostream* os) const override { - source_matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - source_matcher_.DescribeNegationTo(os); - } - - private: - const Matcher<U> source_matcher_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; -}; - -// This even more specialized version is used for efficiently casting -// a matcher to its own type. -template <typename T> -class MatcherCastImpl<T, Matcher<T> > { - public: - static Matcher<T> Cast(const Matcher<T>& matcher) { return matcher; } -}; - -} // namespace internal - -// In order to be safe and clear, casting between different matcher -// types is done explicitly via MatcherCast<T>(m), which takes a -// matcher m and returns a Matcher<T>. It compiles only when T can be -// statically converted to the argument type of m. -template <typename T, typename M> -inline Matcher<T> MatcherCast(const M& matcher) { - return internal::MatcherCastImpl<T, M>::Cast(matcher); -} - -// Implements SafeMatcherCast(). -// -// FIXME: The intermediate SafeMatcherCastImpl class was introduced as a -// workaround for a compiler bug, and can now be removed. -template <typename T> -class SafeMatcherCastImpl { - public: - // This overload handles polymorphic matchers and values only since - // monomorphic matchers are handled by the next one. - template <typename M> - static inline Matcher<T> Cast(const M& polymorphic_matcher_or_value) { - return internal::MatcherCastImpl<T, M>::Cast(polymorphic_matcher_or_value); - } - - // This overload handles monomorphic matchers. - // - // In general, if type T can be implicitly converted to type U, we can - // safely convert a Matcher<U> to a Matcher<T> (i.e. Matcher is - // contravariant): just keep a copy of the original Matcher<U>, convert the - // argument from type T to U, and then pass it to the underlying Matcher<U>. - // The only exception is when U is a reference and T is not, as the - // underlying Matcher<U> may be interested in the argument's address, which - // is not preserved in the conversion from T to U. - template <typename U> - static inline Matcher<T> Cast(const Matcher<U>& matcher) { - // Enforce that T can be implicitly converted to U. - GTEST_COMPILE_ASSERT_((std::is_convertible<T, U>::value), - "T must be implicitly convertible to U"); - // Enforce that we are not converting a non-reference type T to a reference - // type U. - GTEST_COMPILE_ASSERT_( - std::is_reference<T>::value || !std::is_reference<U>::value, - cannot_convert_non_reference_arg_to_reference); - // In case both T and U are arithmetic types, enforce that the - // conversion is not lossy. - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(T) RawT; - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(U) RawU; - const bool kTIsOther = GMOCK_KIND_OF_(RawT) == internal::kOther; - const bool kUIsOther = GMOCK_KIND_OF_(RawU) == internal::kOther; - GTEST_COMPILE_ASSERT_( - kTIsOther || kUIsOther || - (internal::LosslessArithmeticConvertible<RawT, RawU>::value), - conversion_of_arithmetic_types_must_be_lossless); - return MatcherCast<T>(matcher); - } -}; - -template <typename T, typename M> -inline Matcher<T> SafeMatcherCast(const M& polymorphic_matcher) { - return SafeMatcherCastImpl<T>::Cast(polymorphic_matcher); -} - -// A<T>() returns a matcher that matches any value of type T. -template <typename T> -Matcher<T> A(); - -// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION -// and MUST NOT BE USED IN USER CODE!!! -namespace internal { - -// If the explanation is not empty, prints it to the ostream. -inline void PrintIfNotEmpty(const std::string& explanation, - ::std::ostream* os) { - if (explanation != "" && os != nullptr) { - *os << ", " << explanation; - } -} - -// Returns true if the given type name is easy to read by a human. -// This is used to decide whether printing the type of a value might -// be helpful. -inline bool IsReadableTypeName(const std::string& type_name) { - // We consider a type name readable if it's short or doesn't contain - // a template or function type. - return (type_name.length() <= 20 || - type_name.find_first_of("<(") == std::string::npos); -} - -// Matches the value against the given matcher, prints the value and explains -// the match result to the listener. Returns the match result. -// 'listener' must not be NULL. -// Value cannot be passed by const reference, because some matchers take a -// non-const argument. -template <typename Value, typename T> -bool MatchPrintAndExplain(Value& value, const Matcher<T>& matcher, - MatchResultListener* listener) { - if (!listener->IsInterested()) { - // If the listener is not interested, we do not need to construct the - // inner explanation. - return matcher.Matches(value); - } - - StringMatchResultListener inner_listener; - const bool match = matcher.MatchAndExplain(value, &inner_listener); - - UniversalPrint(value, listener->stream()); -#if GTEST_HAS_RTTI - const std::string& type_name = GetTypeName<Value>(); - if (IsReadableTypeName(type_name)) - *listener->stream() << " (of type " << type_name << ")"; -#endif - PrintIfNotEmpty(inner_listener.str(), listener->stream()); - - return match; -} - -// An internal helper class for doing compile-time loop on a tuple's -// fields. -template <size_t N> -class TuplePrefix { - public: - // TuplePrefix<N>::Matches(matcher_tuple, value_tuple) returns true - // if and only if the first N fields of matcher_tuple matches - // the first N fields of value_tuple, respectively. - template <typename MatcherTuple, typename ValueTuple> - static bool Matches(const MatcherTuple& matcher_tuple, - const ValueTuple& value_tuple) { - return TuplePrefix<N - 1>::Matches(matcher_tuple, value_tuple) && - std::get<N - 1>(matcher_tuple).Matches(std::get<N - 1>(value_tuple)); - } - - // TuplePrefix<N>::ExplainMatchFailuresTo(matchers, values, os) - // describes failures in matching the first N fields of matchers - // against the first N fields of values. If there is no failure, - // nothing will be streamed to os. - template <typename MatcherTuple, typename ValueTuple> - static void ExplainMatchFailuresTo(const MatcherTuple& matchers, - const ValueTuple& values, - ::std::ostream* os) { - // First, describes failures in the first N - 1 fields. - TuplePrefix<N - 1>::ExplainMatchFailuresTo(matchers, values, os); - - // Then describes the failure (if any) in the (N - 1)-th (0-based) - // field. - typename std::tuple_element<N - 1, MatcherTuple>::type matcher = - std::get<N - 1>(matchers); - typedef typename std::tuple_element<N - 1, ValueTuple>::type Value; - const Value& value = std::get<N - 1>(values); - StringMatchResultListener listener; - if (!matcher.MatchAndExplain(value, &listener)) { - *os << " Expected arg #" << N - 1 << ": "; - std::get<N - 1>(matchers).DescribeTo(os); - *os << "\n Actual: "; - // We remove the reference in type Value to prevent the - // universal printer from printing the address of value, which - // isn't interesting to the user most of the time. The - // matcher's MatchAndExplain() method handles the case when - // the address is interesting. - internal::UniversalPrint(value, os); - PrintIfNotEmpty(listener.str(), os); - *os << "\n"; - } - } -}; - -// The base case. -template <> -class TuplePrefix<0> { - public: - template <typename MatcherTuple, typename ValueTuple> - static bool Matches(const MatcherTuple& /* matcher_tuple */, - const ValueTuple& /* value_tuple */) { - return true; - } - - template <typename MatcherTuple, typename ValueTuple> - static void ExplainMatchFailuresTo(const MatcherTuple& /* matchers */, - const ValueTuple& /* values */, - ::std::ostream* /* os */) {} -}; - -// TupleMatches(matcher_tuple, value_tuple) returns true if and only if -// all matchers in matcher_tuple match the corresponding fields in -// value_tuple. It is a compiler error if matcher_tuple and -// value_tuple have different number of fields or incompatible field -// types. -template <typename MatcherTuple, typename ValueTuple> -bool TupleMatches(const MatcherTuple& matcher_tuple, - const ValueTuple& value_tuple) { - // Makes sure that matcher_tuple and value_tuple have the same - // number of fields. - GTEST_COMPILE_ASSERT_(std::tuple_size<MatcherTuple>::value == - std::tuple_size<ValueTuple>::value, - matcher_and_value_have_different_numbers_of_fields); - return TuplePrefix<std::tuple_size<ValueTuple>::value>::Matches(matcher_tuple, - value_tuple); -} - -// Describes failures in matching matchers against values. If there -// is no failure, nothing will be streamed to os. -template <typename MatcherTuple, typename ValueTuple> -void ExplainMatchFailureTupleTo(const MatcherTuple& matchers, - const ValueTuple& values, - ::std::ostream* os) { - TuplePrefix<std::tuple_size<MatcherTuple>::value>::ExplainMatchFailuresTo( - matchers, values, os); -} - -// TransformTupleValues and its helper. -// -// TransformTupleValuesHelper hides the internal machinery that -// TransformTupleValues uses to implement a tuple traversal. -template <typename Tuple, typename Func, typename OutIter> -class TransformTupleValuesHelper { - private: - typedef ::std::tuple_size<Tuple> TupleSize; - - public: - // For each member of tuple 't', taken in order, evaluates '*out++ = f(t)'. - // Returns the final value of 'out' in case the caller needs it. - static OutIter Run(Func f, const Tuple& t, OutIter out) { - return IterateOverTuple<Tuple, TupleSize::value>()(f, t, out); - } - - private: - template <typename Tup, size_t kRemainingSize> - struct IterateOverTuple { - OutIter operator() (Func f, const Tup& t, OutIter out) const { - *out++ = f(::std::get<TupleSize::value - kRemainingSize>(t)); - return IterateOverTuple<Tup, kRemainingSize - 1>()(f, t, out); - } - }; - template <typename Tup> - struct IterateOverTuple<Tup, 0> { - OutIter operator() (Func /* f */, const Tup& /* t */, OutIter out) const { - return out; - } - }; -}; - -// Successively invokes 'f(element)' on each element of the tuple 't', -// appending each result to the 'out' iterator. Returns the final value -// of 'out'. -template <typename Tuple, typename Func, typename OutIter> -OutIter TransformTupleValues(Func f, const Tuple& t, OutIter out) { - return TransformTupleValuesHelper<Tuple, Func, OutIter>::Run(f, t, out); -} - -// Implements A<T>(). -template <typename T> -class AnyMatcherImpl : public MatcherInterface<const T&> { - public: - bool MatchAndExplain(const T& /* x */, - MatchResultListener* /* listener */) const override { - return true; - } - void DescribeTo(::std::ostream* os) const override { *os << "is anything"; } - void DescribeNegationTo(::std::ostream* os) const override { - // This is mostly for completeness' safe, as it's not very useful - // to write Not(A<bool>()). However we cannot completely rule out - // such a possibility, and it doesn't hurt to be prepared. - *os << "never matches"; - } -}; - -// Implements _, a matcher that matches any value of any -// type. This is a polymorphic matcher, so we need a template type -// conversion operator to make it appearing as a Matcher<T> for any -// type T. -class AnythingMatcher { - public: - template <typename T> - operator Matcher<T>() const { return A<T>(); } -}; - -// Implements the polymorphic IsNull() matcher, which matches any raw or smart -// pointer that is NULL. -class IsNullMatcher { - public: - template <typename Pointer> - bool MatchAndExplain(const Pointer& p, - MatchResultListener* /* listener */) const { - return p == nullptr; - } - - void DescribeTo(::std::ostream* os) const { *os << "is NULL"; } - void DescribeNegationTo(::std::ostream* os) const { - *os << "isn't NULL"; - } -}; - -// Implements the polymorphic NotNull() matcher, which matches any raw or smart -// pointer that is not NULL. -class NotNullMatcher { - public: - template <typename Pointer> - bool MatchAndExplain(const Pointer& p, - MatchResultListener* /* listener */) const { - return p != nullptr; - } - - void DescribeTo(::std::ostream* os) const { *os << "isn't NULL"; } - void DescribeNegationTo(::std::ostream* os) const { - *os << "is NULL"; - } -}; - -// Ref(variable) matches any argument that is a reference to -// 'variable'. This matcher is polymorphic as it can match any -// super type of the type of 'variable'. -// -// The RefMatcher template class implements Ref(variable). It can -// only be instantiated with a reference type. This prevents a user -// from mistakenly using Ref(x) to match a non-reference function -// argument. For example, the following will righteously cause a -// compiler error: -// -// int n; -// Matcher<int> m1 = Ref(n); // This won't compile. -// Matcher<int&> m2 = Ref(n); // This will compile. -template <typename T> -class RefMatcher; - -template <typename T> -class RefMatcher<T&> { - // Google Mock is a generic framework and thus needs to support - // mocking any function types, including those that take non-const - // reference arguments. Therefore the template parameter T (and - // Super below) can be instantiated to either a const type or a - // non-const type. - public: - // RefMatcher() takes a T& instead of const T&, as we want the - // compiler to catch using Ref(const_value) as a matcher for a - // non-const reference. - explicit RefMatcher(T& x) : object_(x) {} // NOLINT - - template <typename Super> - operator Matcher<Super&>() const { - // By passing object_ (type T&) to Impl(), which expects a Super&, - // we make sure that Super is a super type of T. In particular, - // this catches using Ref(const_value) as a matcher for a - // non-const reference, as you cannot implicitly convert a const - // reference to a non-const reference. - return MakeMatcher(new Impl<Super>(object_)); - } - - private: - template <typename Super> - class Impl : public MatcherInterface<Super&> { - public: - explicit Impl(Super& x) : object_(x) {} // NOLINT - - // MatchAndExplain() takes a Super& (as opposed to const Super&) - // in order to match the interface MatcherInterface<Super&>. - bool MatchAndExplain(Super& x, - MatchResultListener* listener) const override { - *listener << "which is located @" << static_cast<const void*>(&x); - return &x == &object_; - } - - void DescribeTo(::std::ostream* os) const override { - *os << "references the variable "; - UniversalPrinter<Super&>::Print(object_, os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - *os << "does not reference the variable "; - UniversalPrinter<Super&>::Print(object_, os); - } - - private: - const Super& object_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - T& object_; - - GTEST_DISALLOW_ASSIGN_(RefMatcher); -}; - -// Polymorphic helper functions for narrow and wide string matchers. -inline bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs) { - return String::CaseInsensitiveCStringEquals(lhs, rhs); -} - -inline bool CaseInsensitiveCStringEquals(const wchar_t* lhs, - const wchar_t* rhs) { - return String::CaseInsensitiveWideCStringEquals(lhs, rhs); -} - -// String comparison for narrow or wide strings that can have embedded NUL -// characters. -template <typename StringType> -bool CaseInsensitiveStringEquals(const StringType& s1, - const StringType& s2) { - // Are the heads equal? - if (!CaseInsensitiveCStringEquals(s1.c_str(), s2.c_str())) { - return false; - } - - // Skip the equal heads. - const typename StringType::value_type nul = 0; - const size_t i1 = s1.find(nul), i2 = s2.find(nul); - - // Are we at the end of either s1 or s2? - if (i1 == StringType::npos || i2 == StringType::npos) { - return i1 == i2; - } - - // Are the tails equal? - return CaseInsensitiveStringEquals(s1.substr(i1 + 1), s2.substr(i2 + 1)); -} - -// String matchers. - -// Implements equality-based string matchers like StrEq, StrCaseNe, and etc. -template <typename StringType> -class StrEqualityMatcher { - public: - StrEqualityMatcher(const StringType& str, bool expect_eq, - bool case_sensitive) - : string_(str), expect_eq_(expect_eq), case_sensitive_(case_sensitive) {} - -#if GTEST_HAS_ABSL - bool MatchAndExplain(const absl::string_view& s, - MatchResultListener* listener) const { - // This should fail to compile if absl::string_view is used with wide - // strings. - const StringType& str = std::string(s); - return MatchAndExplain(str, listener); - } -#endif // GTEST_HAS_ABSL - - // Accepts pointer types, particularly: - // const char* - // char* - // const wchar_t* - // wchar_t* - template <typename CharType> - bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { - if (s == nullptr) { - return !expect_eq_; - } - return MatchAndExplain(StringType(s), listener); - } - - // Matches anything that can convert to StringType. - // - // This is a template, not just a plain function with const StringType&, - // because absl::string_view has some interfering non-explicit constructors. - template <typename MatcheeStringType> - bool MatchAndExplain(const MatcheeStringType& s, - MatchResultListener* /* listener */) const { - const StringType& s2(s); - const bool eq = case_sensitive_ ? s2 == string_ : - CaseInsensitiveStringEquals(s2, string_); - return expect_eq_ == eq; - } - - void DescribeTo(::std::ostream* os) const { - DescribeToHelper(expect_eq_, os); - } - - void DescribeNegationTo(::std::ostream* os) const { - DescribeToHelper(!expect_eq_, os); - } - - private: - void DescribeToHelper(bool expect_eq, ::std::ostream* os) const { - *os << (expect_eq ? "is " : "isn't "); - *os << "equal to "; - if (!case_sensitive_) { - *os << "(ignoring case) "; - } - UniversalPrint(string_, os); - } - - const StringType string_; - const bool expect_eq_; - const bool case_sensitive_; - - GTEST_DISALLOW_ASSIGN_(StrEqualityMatcher); -}; - -// Implements the polymorphic HasSubstr(substring) matcher, which -// can be used as a Matcher<T> as long as T can be converted to a -// string. -template <typename StringType> -class HasSubstrMatcher { - public: - explicit HasSubstrMatcher(const StringType& substring) - : substring_(substring) {} - -#if GTEST_HAS_ABSL - bool MatchAndExplain(const absl::string_view& s, - MatchResultListener* listener) const { - // This should fail to compile if absl::string_view is used with wide - // strings. - const StringType& str = std::string(s); - return MatchAndExplain(str, listener); - } -#endif // GTEST_HAS_ABSL - - // Accepts pointer types, particularly: - // const char* - // char* - // const wchar_t* - // wchar_t* - template <typename CharType> - bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { - return s != nullptr && MatchAndExplain(StringType(s), listener); - } - - // Matches anything that can convert to StringType. - // - // This is a template, not just a plain function with const StringType&, - // because absl::string_view has some interfering non-explicit constructors. - template <typename MatcheeStringType> - bool MatchAndExplain(const MatcheeStringType& s, - MatchResultListener* /* listener */) const { - const StringType& s2(s); - return s2.find(substring_) != StringType::npos; - } - - // Describes what this matcher matches. - void DescribeTo(::std::ostream* os) const { - *os << "has substring "; - UniversalPrint(substring_, os); - } - - void DescribeNegationTo(::std::ostream* os) const { - *os << "has no substring "; - UniversalPrint(substring_, os); - } - - private: - const StringType substring_; - - GTEST_DISALLOW_ASSIGN_(HasSubstrMatcher); -}; - -// Implements the polymorphic StartsWith(substring) matcher, which -// can be used as a Matcher<T> as long as T can be converted to a -// string. -template <typename StringType> -class StartsWithMatcher { - public: - explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) { - } - -#if GTEST_HAS_ABSL - bool MatchAndExplain(const absl::string_view& s, - MatchResultListener* listener) const { - // This should fail to compile if absl::string_view is used with wide - // strings. - const StringType& str = std::string(s); - return MatchAndExplain(str, listener); - } -#endif // GTEST_HAS_ABSL - - // Accepts pointer types, particularly: - // const char* - // char* - // const wchar_t* - // wchar_t* - template <typename CharType> - bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { - return s != nullptr && MatchAndExplain(StringType(s), listener); - } - - // Matches anything that can convert to StringType. - // - // This is a template, not just a plain function with const StringType&, - // because absl::string_view has some interfering non-explicit constructors. - template <typename MatcheeStringType> - bool MatchAndExplain(const MatcheeStringType& s, - MatchResultListener* /* listener */) const { - const StringType& s2(s); - return s2.length() >= prefix_.length() && - s2.substr(0, prefix_.length()) == prefix_; - } - - void DescribeTo(::std::ostream* os) const { - *os << "starts with "; - UniversalPrint(prefix_, os); - } - - void DescribeNegationTo(::std::ostream* os) const { - *os << "doesn't start with "; - UniversalPrint(prefix_, os); - } - - private: - const StringType prefix_; - - GTEST_DISALLOW_ASSIGN_(StartsWithMatcher); -}; - -// Implements the polymorphic EndsWith(substring) matcher, which -// can be used as a Matcher<T> as long as T can be converted to a -// string. -template <typename StringType> -class EndsWithMatcher { - public: - explicit EndsWithMatcher(const StringType& suffix) : suffix_(suffix) {} - -#if GTEST_HAS_ABSL - bool MatchAndExplain(const absl::string_view& s, - MatchResultListener* listener) const { - // This should fail to compile if absl::string_view is used with wide - // strings. - const StringType& str = std::string(s); - return MatchAndExplain(str, listener); - } -#endif // GTEST_HAS_ABSL - - // Accepts pointer types, particularly: - // const char* - // char* - // const wchar_t* - // wchar_t* - template <typename CharType> - bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { - return s != nullptr && MatchAndExplain(StringType(s), listener); - } - - // Matches anything that can convert to StringType. - // - // This is a template, not just a plain function with const StringType&, - // because absl::string_view has some interfering non-explicit constructors. - template <typename MatcheeStringType> - bool MatchAndExplain(const MatcheeStringType& s, - MatchResultListener* /* listener */) const { - const StringType& s2(s); - return s2.length() >= suffix_.length() && - s2.substr(s2.length() - suffix_.length()) == suffix_; - } - - void DescribeTo(::std::ostream* os) const { - *os << "ends with "; - UniversalPrint(suffix_, os); - } - - void DescribeNegationTo(::std::ostream* os) const { - *os << "doesn't end with "; - UniversalPrint(suffix_, os); - } - - private: - const StringType suffix_; - - GTEST_DISALLOW_ASSIGN_(EndsWithMatcher); -}; - -// Implements a matcher that compares the two fields of a 2-tuple -// using one of the ==, <=, <, etc, operators. The two fields being -// compared don't have to have the same type. -// -// The matcher defined here is polymorphic (for example, Eq() can be -// used to match a std::tuple<int, short>, a std::tuple<const long&, double>, -// etc). Therefore we use a template type conversion operator in the -// implementation. -template <typename D, typename Op> -class PairMatchBase { - public: - template <typename T1, typename T2> - operator Matcher<::std::tuple<T1, T2>>() const { - return Matcher<::std::tuple<T1, T2>>(new Impl<const ::std::tuple<T1, T2>&>); - } - template <typename T1, typename T2> - operator Matcher<const ::std::tuple<T1, T2>&>() const { - return MakeMatcher(new Impl<const ::std::tuple<T1, T2>&>); - } - - private: - static ::std::ostream& GetDesc(::std::ostream& os) { // NOLINT - return os << D::Desc(); - } - - template <typename Tuple> - class Impl : public MatcherInterface<Tuple> { - public: - bool MatchAndExplain(Tuple args, - MatchResultListener* /* listener */) const override { - return Op()(::std::get<0>(args), ::std::get<1>(args)); - } - void DescribeTo(::std::ostream* os) const override { - *os << "are " << GetDesc; - } - void DescribeNegationTo(::std::ostream* os) const override { - *os << "aren't " << GetDesc; - } - }; -}; - -class Eq2Matcher : public PairMatchBase<Eq2Matcher, AnyEq> { - public: - static const char* Desc() { return "an equal pair"; } -}; -class Ne2Matcher : public PairMatchBase<Ne2Matcher, AnyNe> { - public: - static const char* Desc() { return "an unequal pair"; } -}; -class Lt2Matcher : public PairMatchBase<Lt2Matcher, AnyLt> { - public: - static const char* Desc() { return "a pair where the first < the second"; } -}; -class Gt2Matcher : public PairMatchBase<Gt2Matcher, AnyGt> { - public: - static const char* Desc() { return "a pair where the first > the second"; } -}; -class Le2Matcher : public PairMatchBase<Le2Matcher, AnyLe> { - public: - static const char* Desc() { return "a pair where the first <= the second"; } -}; -class Ge2Matcher : public PairMatchBase<Ge2Matcher, AnyGe> { - public: - static const char* Desc() { return "a pair where the first >= the second"; } -}; - -// Implements the Not(...) matcher for a particular argument type T. -// We do not nest it inside the NotMatcher class template, as that -// will prevent different instantiations of NotMatcher from sharing -// the same NotMatcherImpl<T> class. -template <typename T> -class NotMatcherImpl : public MatcherInterface<const T&> { - public: - explicit NotMatcherImpl(const Matcher<T>& matcher) - : matcher_(matcher) {} - - bool MatchAndExplain(const T& x, - MatchResultListener* listener) const override { - return !matcher_.MatchAndExplain(x, listener); - } - - void DescribeTo(::std::ostream* os) const override { - matcher_.DescribeNegationTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - matcher_.DescribeTo(os); - } - - private: - const Matcher<T> matcher_; - - GTEST_DISALLOW_ASSIGN_(NotMatcherImpl); -}; - -// Implements the Not(m) matcher, which matches a value that doesn't -// match matcher m. -template <typename InnerMatcher> -class NotMatcher { - public: - explicit NotMatcher(InnerMatcher matcher) : matcher_(matcher) {} - - // This template type conversion operator allows Not(m) to be used - // to match any type m can match. - template <typename T> - operator Matcher<T>() const { - return Matcher<T>(new NotMatcherImpl<T>(SafeMatcherCast<T>(matcher_))); - } - - private: - InnerMatcher matcher_; - - GTEST_DISALLOW_ASSIGN_(NotMatcher); -}; - -// Implements the AllOf(m1, m2) matcher for a particular argument type -// T. We do not nest it inside the BothOfMatcher class template, as -// that will prevent different instantiations of BothOfMatcher from -// sharing the same BothOfMatcherImpl<T> class. -template <typename T> -class AllOfMatcherImpl : public MatcherInterface<const T&> { - public: - explicit AllOfMatcherImpl(std::vector<Matcher<T> > matchers) - : matchers_(std::move(matchers)) {} - - void DescribeTo(::std::ostream* os) const override { - *os << "("; - for (size_t i = 0; i < matchers_.size(); ++i) { - if (i != 0) *os << ") and ("; - matchers_[i].DescribeTo(os); - } - *os << ")"; - } - - void DescribeNegationTo(::std::ostream* os) const override { - *os << "("; - for (size_t i = 0; i < matchers_.size(); ++i) { - if (i != 0) *os << ") or ("; - matchers_[i].DescribeNegationTo(os); - } - *os << ")"; - } - - bool MatchAndExplain(const T& x, - MatchResultListener* listener) const override { - // If either matcher1_ or matcher2_ doesn't match x, we only need - // to explain why one of them fails. - std::string all_match_result; - - for (size_t i = 0; i < matchers_.size(); ++i) { - StringMatchResultListener slistener; - if (matchers_[i].MatchAndExplain(x, &slistener)) { - if (all_match_result.empty()) { - all_match_result = slistener.str(); - } else { - std::string result = slistener.str(); - if (!result.empty()) { - all_match_result += ", and "; - all_match_result += result; - } - } - } else { - *listener << slistener.str(); - return false; - } - } - - // Otherwise we need to explain why *both* of them match. - *listener << all_match_result; - return true; - } - - private: - const std::vector<Matcher<T> > matchers_; - - GTEST_DISALLOW_ASSIGN_(AllOfMatcherImpl); -}; - -// VariadicMatcher is used for the variadic implementation of -// AllOf(m_1, m_2, ...) and AnyOf(m_1, m_2, ...). -// CombiningMatcher<T> is used to recursively combine the provided matchers -// (of type Args...). -template <template <typename T> class CombiningMatcher, typename... Args> -class VariadicMatcher { - public: - VariadicMatcher(const Args&... matchers) // NOLINT - : matchers_(matchers...) { - static_assert(sizeof...(Args) > 0, "Must have at least one matcher."); - } - - // This template type conversion operator allows an - // VariadicMatcher<Matcher1, Matcher2...> object to match any type that - // all of the provided matchers (Matcher1, Matcher2, ...) can match. - template <typename T> - operator Matcher<T>() const { - std::vector<Matcher<T> > values; - CreateVariadicMatcher<T>(&values, std::integral_constant<size_t, 0>()); - return Matcher<T>(new CombiningMatcher<T>(std::move(values))); - } - - private: - template <typename T, size_t I> - void CreateVariadicMatcher(std::vector<Matcher<T> >* values, - std::integral_constant<size_t, I>) const { - values->push_back(SafeMatcherCast<T>(std::get<I>(matchers_))); - CreateVariadicMatcher<T>(values, std::integral_constant<size_t, I + 1>()); - } - - template <typename T> - void CreateVariadicMatcher( - std::vector<Matcher<T> >*, - std::integral_constant<size_t, sizeof...(Args)>) const {} - - std::tuple<Args...> matchers_; - - GTEST_DISALLOW_ASSIGN_(VariadicMatcher); -}; - -template <typename... Args> -using AllOfMatcher = VariadicMatcher<AllOfMatcherImpl, Args...>; - -// Implements the AnyOf(m1, m2) matcher for a particular argument type -// T. We do not nest it inside the AnyOfMatcher class template, as -// that will prevent different instantiations of AnyOfMatcher from -// sharing the same EitherOfMatcherImpl<T> class. -template <typename T> -class AnyOfMatcherImpl : public MatcherInterface<const T&> { - public: - explicit AnyOfMatcherImpl(std::vector<Matcher<T> > matchers) - : matchers_(std::move(matchers)) {} - - void DescribeTo(::std::ostream* os) const override { - *os << "("; - for (size_t i = 0; i < matchers_.size(); ++i) { - if (i != 0) *os << ") or ("; - matchers_[i].DescribeTo(os); - } - *os << ")"; - } - - void DescribeNegationTo(::std::ostream* os) const override { - *os << "("; - for (size_t i = 0; i < matchers_.size(); ++i) { - if (i != 0) *os << ") and ("; - matchers_[i].DescribeNegationTo(os); - } - *os << ")"; - } - - bool MatchAndExplain(const T& x, - MatchResultListener* listener) const override { - std::string no_match_result; - - // If either matcher1_ or matcher2_ matches x, we just need to - // explain why *one* of them matches. - for (size_t i = 0; i < matchers_.size(); ++i) { - StringMatchResultListener slistener; - if (matchers_[i].MatchAndExplain(x, &slistener)) { - *listener << slistener.str(); - return true; - } else { - if (no_match_result.empty()) { - no_match_result = slistener.str(); - } else { - std::string result = slistener.str(); - if (!result.empty()) { - no_match_result += ", and "; - no_match_result += result; - } - } - } - } - - // Otherwise we need to explain why *both* of them fail. - *listener << no_match_result; - return false; - } - - private: - const std::vector<Matcher<T> > matchers_; - - GTEST_DISALLOW_ASSIGN_(AnyOfMatcherImpl); -}; - -// AnyOfMatcher is used for the variadic implementation of AnyOf(m_1, m_2, ...). -template <typename... Args> -using AnyOfMatcher = VariadicMatcher<AnyOfMatcherImpl, Args...>; - -// Wrapper for implementation of Any/AllOfArray(). -template <template <class> class MatcherImpl, typename T> -class SomeOfArrayMatcher { - public: - // Constructs the matcher from a sequence of element values or - // element matchers. - template <typename Iter> - SomeOfArrayMatcher(Iter first, Iter last) : matchers_(first, last) {} - - template <typename U> - operator Matcher<U>() const { // NOLINT - using RawU = typename std::decay<U>::type; - std::vector<Matcher<RawU>> matchers; - for (const auto& matcher : matchers_) { - matchers.push_back(MatcherCast<RawU>(matcher)); - } - return Matcher<U>(new MatcherImpl<RawU>(std::move(matchers))); - } - - private: - const ::std::vector<T> matchers_; - - GTEST_DISALLOW_ASSIGN_(SomeOfArrayMatcher); -}; - -template <typename T> -using AllOfArrayMatcher = SomeOfArrayMatcher<AllOfMatcherImpl, T>; - -template <typename T> -using AnyOfArrayMatcher = SomeOfArrayMatcher<AnyOfMatcherImpl, T>; - -// Used for implementing Truly(pred), which turns a predicate into a -// matcher. -template <typename Predicate> -class TrulyMatcher { - public: - explicit TrulyMatcher(Predicate pred) : predicate_(pred) {} - - // This method template allows Truly(pred) to be used as a matcher - // for type T where T is the argument type of predicate 'pred'. The - // argument is passed by reference as the predicate may be - // interested in the address of the argument. - template <typename T> - bool MatchAndExplain(T& x, // NOLINT - MatchResultListener* /* listener */) const { - // Without the if-statement, MSVC sometimes warns about converting - // a value to bool (warning 4800). - // - // We cannot write 'return !!predicate_(x);' as that doesn't work - // when predicate_(x) returns a class convertible to bool but - // having no operator!(). - if (predicate_(x)) - return true; - return false; - } - - void DescribeTo(::std::ostream* os) const { - *os << "satisfies the given predicate"; - } - - void DescribeNegationTo(::std::ostream* os) const { - *os << "doesn't satisfy the given predicate"; - } - - private: - Predicate predicate_; - - GTEST_DISALLOW_ASSIGN_(TrulyMatcher); -}; - -// Used for implementing Matches(matcher), which turns a matcher into -// a predicate. -template <typename M> -class MatcherAsPredicate { - public: - explicit MatcherAsPredicate(M matcher) : matcher_(matcher) {} - - // This template operator() allows Matches(m) to be used as a - // predicate on type T where m is a matcher on type T. - // - // The argument x is passed by reference instead of by value, as - // some matcher may be interested in its address (e.g. as in - // Matches(Ref(n))(x)). - template <typename T> - bool operator()(const T& x) const { - // We let matcher_ commit to a particular type here instead of - // when the MatcherAsPredicate object was constructed. This - // allows us to write Matches(m) where m is a polymorphic matcher - // (e.g. Eq(5)). - // - // If we write Matcher<T>(matcher_).Matches(x) here, it won't - // compile when matcher_ has type Matcher<const T&>; if we write - // Matcher<const T&>(matcher_).Matches(x) here, it won't compile - // when matcher_ has type Matcher<T>; if we just write - // matcher_.Matches(x), it won't compile when matcher_ is - // polymorphic, e.g. Eq(5). - // - // MatcherCast<const T&>() is necessary for making the code work - // in all of the above situations. - return MatcherCast<const T&>(matcher_).Matches(x); - } - - private: - M matcher_; - - GTEST_DISALLOW_ASSIGN_(MatcherAsPredicate); -}; - -// For implementing ASSERT_THAT() and EXPECT_THAT(). The template -// argument M must be a type that can be converted to a matcher. -template <typename M> -class PredicateFormatterFromMatcher { - public: - explicit PredicateFormatterFromMatcher(M m) : matcher_(std::move(m)) {} - - // This template () operator allows a PredicateFormatterFromMatcher - // object to act as a predicate-formatter suitable for using with - // Google Test's EXPECT_PRED_FORMAT1() macro. - template <typename T> - AssertionResult operator()(const char* value_text, const T& x) const { - // We convert matcher_ to a Matcher<const T&> *now* instead of - // when the PredicateFormatterFromMatcher object was constructed, - // as matcher_ may be polymorphic (e.g. NotNull()) and we won't - // know which type to instantiate it to until we actually see the - // type of x here. - // - // We write SafeMatcherCast<const T&>(matcher_) instead of - // Matcher<const T&>(matcher_), as the latter won't compile when - // matcher_ has type Matcher<T> (e.g. An<int>()). - // We don't write MatcherCast<const T&> either, as that allows - // potentially unsafe downcasting of the matcher argument. - const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_); - - // The expected path here is that the matcher should match (i.e. that most - // tests pass) so optimize for this case. - if (matcher.Matches(x)) { - return AssertionSuccess(); - } - - ::std::stringstream ss; - ss << "Value of: " << value_text << "\n" - << "Expected: "; - matcher.DescribeTo(&ss); - - // Rerun the matcher to "PrintAndExain" the failure. - StringMatchResultListener listener; - if (MatchPrintAndExplain(x, matcher, &listener)) { - ss << "\n The matcher failed on the initial attempt; but passed when " - "rerun to generate the explanation."; - } - ss << "\n Actual: " << listener.str(); - return AssertionFailure() << ss.str(); - } - - private: - const M matcher_; - - GTEST_DISALLOW_ASSIGN_(PredicateFormatterFromMatcher); -}; - -// A helper function for converting a matcher to a predicate-formatter -// without the user needing to explicitly write the type. This is -// used for implementing ASSERT_THAT() and EXPECT_THAT(). -// Implementation detail: 'matcher' is received by-value to force decaying. -template <typename M> -inline PredicateFormatterFromMatcher<M> -MakePredicateFormatterFromMatcher(M matcher) { - return PredicateFormatterFromMatcher<M>(std::move(matcher)); -} - -// Implements the polymorphic floating point equality matcher, which matches -// two float values using ULP-based approximation or, optionally, a -// user-specified epsilon. The template is meant to be instantiated with -// FloatType being either float or double. -template <typename FloatType> -class FloatingEqMatcher { - public: - // Constructor for FloatingEqMatcher. - // The matcher's input will be compared with expected. The matcher treats two - // NANs as equal if nan_eq_nan is true. Otherwise, under IEEE standards, - // equality comparisons between NANs will always return false. We specify a - // negative max_abs_error_ term to indicate that ULP-based approximation will - // be used for comparison. - FloatingEqMatcher(FloatType expected, bool nan_eq_nan) : - expected_(expected), nan_eq_nan_(nan_eq_nan), max_abs_error_(-1) { - } - - // Constructor that supports a user-specified max_abs_error that will be used - // for comparison instead of ULP-based approximation. The max absolute - // should be non-negative. - FloatingEqMatcher(FloatType expected, bool nan_eq_nan, - FloatType max_abs_error) - : expected_(expected), - nan_eq_nan_(nan_eq_nan), - max_abs_error_(max_abs_error) { - GTEST_CHECK_(max_abs_error >= 0) - << ", where max_abs_error is" << max_abs_error; - } - - // Implements floating point equality matcher as a Matcher<T>. - template <typename T> - class Impl : public MatcherInterface<T> { - public: - Impl(FloatType expected, bool nan_eq_nan, FloatType max_abs_error) - : expected_(expected), - nan_eq_nan_(nan_eq_nan), - max_abs_error_(max_abs_error) {} - - bool MatchAndExplain(T value, - MatchResultListener* listener) const override { - const FloatingPoint<FloatType> actual(value), expected(expected_); - - // Compares NaNs first, if nan_eq_nan_ is true. - if (actual.is_nan() || expected.is_nan()) { - if (actual.is_nan() && expected.is_nan()) { - return nan_eq_nan_; - } - // One is nan; the other is not nan. - return false; - } - if (HasMaxAbsError()) { - // We perform an equality check so that inf will match inf, regardless - // of error bounds. If the result of value - expected_ would result in - // overflow or if either value is inf, the default result is infinity, - // which should only match if max_abs_error_ is also infinity. - if (value == expected_) { - return true; - } - - const FloatType diff = value - expected_; - if (fabs(diff) <= max_abs_error_) { - return true; - } - - if (listener->IsInterested()) { - *listener << "which is " << diff << " from " << expected_; - } - return false; - } else { - return actual.AlmostEquals(expected); - } - } - - void DescribeTo(::std::ostream* os) const override { - // os->precision() returns the previously set precision, which we - // store to restore the ostream to its original configuration - // after outputting. - const ::std::streamsize old_precision = os->precision( - ::std::numeric_limits<FloatType>::digits10 + 2); - if (FloatingPoint<FloatType>(expected_).is_nan()) { - if (nan_eq_nan_) { - *os << "is NaN"; - } else { - *os << "never matches"; - } - } else { - *os << "is approximately " << expected_; - if (HasMaxAbsError()) { - *os << " (absolute error <= " << max_abs_error_ << ")"; - } - } - os->precision(old_precision); - } - - void DescribeNegationTo(::std::ostream* os) const override { - // As before, get original precision. - const ::std::streamsize old_precision = os->precision( - ::std::numeric_limits<FloatType>::digits10 + 2); - if (FloatingPoint<FloatType>(expected_).is_nan()) { - if (nan_eq_nan_) { - *os << "isn't NaN"; - } else { - *os << "is anything"; - } - } else { - *os << "isn't approximately " << expected_; - if (HasMaxAbsError()) { - *os << " (absolute error > " << max_abs_error_ << ")"; - } - } - // Restore original precision. - os->precision(old_precision); - } - - private: - bool HasMaxAbsError() const { - return max_abs_error_ >= 0; - } - - const FloatType expected_; - const bool nan_eq_nan_; - // max_abs_error will be used for value comparison when >= 0. - const FloatType max_abs_error_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - // The following 3 type conversion operators allow FloatEq(expected) and - // NanSensitiveFloatEq(expected) to be used as a Matcher<float>, a - // Matcher<const float&>, or a Matcher<float&>, but nothing else. - // (While Google's C++ coding style doesn't allow arguments passed - // by non-const reference, we may see them in code not conforming to - // the style. Therefore Google Mock needs to support them.) - operator Matcher<FloatType>() const { - return MakeMatcher( - new Impl<FloatType>(expected_, nan_eq_nan_, max_abs_error_)); - } - - operator Matcher<const FloatType&>() const { - return MakeMatcher( - new Impl<const FloatType&>(expected_, nan_eq_nan_, max_abs_error_)); - } - - operator Matcher<FloatType&>() const { - return MakeMatcher( - new Impl<FloatType&>(expected_, nan_eq_nan_, max_abs_error_)); - } - - private: - const FloatType expected_; - const bool nan_eq_nan_; - // max_abs_error will be used for value comparison when >= 0. - const FloatType max_abs_error_; - - GTEST_DISALLOW_ASSIGN_(FloatingEqMatcher); -}; - -// A 2-tuple ("binary") wrapper around FloatingEqMatcher: -// FloatingEq2Matcher() matches (x, y) by matching FloatingEqMatcher(x, false) -// against y, and FloatingEq2Matcher(e) matches FloatingEqMatcher(x, false, e) -// against y. The former implements "Eq", the latter "Near". At present, there -// is no version that compares NaNs as equal. -template <typename FloatType> -class FloatingEq2Matcher { - public: - FloatingEq2Matcher() { Init(-1, false); } - - explicit FloatingEq2Matcher(bool nan_eq_nan) { Init(-1, nan_eq_nan); } - - explicit FloatingEq2Matcher(FloatType max_abs_error) { - Init(max_abs_error, false); - } - - FloatingEq2Matcher(FloatType max_abs_error, bool nan_eq_nan) { - Init(max_abs_error, nan_eq_nan); - } - - template <typename T1, typename T2> - operator Matcher<::std::tuple<T1, T2>>() const { - return MakeMatcher( - new Impl<::std::tuple<T1, T2>>(max_abs_error_, nan_eq_nan_)); - } - template <typename T1, typename T2> - operator Matcher<const ::std::tuple<T1, T2>&>() const { - return MakeMatcher( - new Impl<const ::std::tuple<T1, T2>&>(max_abs_error_, nan_eq_nan_)); - } - - private: - static ::std::ostream& GetDesc(::std::ostream& os) { // NOLINT - return os << "an almost-equal pair"; - } - - template <typename Tuple> - class Impl : public MatcherInterface<Tuple> { - public: - Impl(FloatType max_abs_error, bool nan_eq_nan) : - max_abs_error_(max_abs_error), - nan_eq_nan_(nan_eq_nan) {} - - bool MatchAndExplain(Tuple args, - MatchResultListener* listener) const override { - if (max_abs_error_ == -1) { - FloatingEqMatcher<FloatType> fm(::std::get<0>(args), nan_eq_nan_); - return static_cast<Matcher<FloatType>>(fm).MatchAndExplain( - ::std::get<1>(args), listener); - } else { - FloatingEqMatcher<FloatType> fm(::std::get<0>(args), nan_eq_nan_, - max_abs_error_); - return static_cast<Matcher<FloatType>>(fm).MatchAndExplain( - ::std::get<1>(args), listener); - } - } - void DescribeTo(::std::ostream* os) const override { - *os << "are " << GetDesc; - } - void DescribeNegationTo(::std::ostream* os) const override { - *os << "aren't " << GetDesc; - } - - private: - FloatType max_abs_error_; - const bool nan_eq_nan_; - }; - - void Init(FloatType max_abs_error_val, bool nan_eq_nan_val) { - max_abs_error_ = max_abs_error_val; - nan_eq_nan_ = nan_eq_nan_val; - } - FloatType max_abs_error_; - bool nan_eq_nan_; -}; - -// Implements the Pointee(m) matcher for matching a pointer whose -// pointee matches matcher m. The pointer can be either raw or smart. -template <typename InnerMatcher> -class PointeeMatcher { - public: - explicit PointeeMatcher(const InnerMatcher& matcher) : matcher_(matcher) {} - - // This type conversion operator template allows Pointee(m) to be - // used as a matcher for any pointer type whose pointee type is - // compatible with the inner matcher, where type Pointer can be - // either a raw pointer or a smart pointer. - // - // The reason we do this instead of relying on - // MakePolymorphicMatcher() is that the latter is not flexible - // enough for implementing the DescribeTo() method of Pointee(). - template <typename Pointer> - operator Matcher<Pointer>() const { - return Matcher<Pointer>(new Impl<const Pointer&>(matcher_)); - } - - private: - // The monomorphic implementation that works for a particular pointer type. - template <typename Pointer> - class Impl : public MatcherInterface<Pointer> { - public: - typedef typename PointeeOf<typename std::remove_const< - typename std::remove_reference<Pointer>::type>::type>::type Pointee; - - explicit Impl(const InnerMatcher& matcher) - : matcher_(MatcherCast<const Pointee&>(matcher)) {} - - void DescribeTo(::std::ostream* os) const override { - *os << "points to a value that "; - matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - *os << "does not point to a value that "; - matcher_.DescribeTo(os); - } - - bool MatchAndExplain(Pointer pointer, - MatchResultListener* listener) const override { - if (GetRawPointer(pointer) == nullptr) return false; - - *listener << "which points to "; - return MatchPrintAndExplain(*pointer, matcher_, listener); - } - - private: - const Matcher<const Pointee&> matcher_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - const InnerMatcher matcher_; - - GTEST_DISALLOW_ASSIGN_(PointeeMatcher); -}; - -#if GTEST_HAS_RTTI -// Implements the WhenDynamicCastTo<T>(m) matcher that matches a pointer or -// reference that matches inner_matcher when dynamic_cast<T> is applied. -// The result of dynamic_cast<To> is forwarded to the inner matcher. -// If To is a pointer and the cast fails, the inner matcher will receive NULL. -// If To is a reference and the cast fails, this matcher returns false -// immediately. -template <typename To> -class WhenDynamicCastToMatcherBase { - public: - explicit WhenDynamicCastToMatcherBase(const Matcher<To>& matcher) - : matcher_(matcher) {} - - void DescribeTo(::std::ostream* os) const { - GetCastTypeDescription(os); - matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const { - GetCastTypeDescription(os); - matcher_.DescribeNegationTo(os); - } - - protected: - const Matcher<To> matcher_; - - static std::string GetToName() { - return GetTypeName<To>(); - } - - private: - static void GetCastTypeDescription(::std::ostream* os) { - *os << "when dynamic_cast to " << GetToName() << ", "; - } - - GTEST_DISALLOW_ASSIGN_(WhenDynamicCastToMatcherBase); -}; - -// Primary template. -// To is a pointer. Cast and forward the result. -template <typename To> -class WhenDynamicCastToMatcher : public WhenDynamicCastToMatcherBase<To> { - public: - explicit WhenDynamicCastToMatcher(const Matcher<To>& matcher) - : WhenDynamicCastToMatcherBase<To>(matcher) {} - - template <typename From> - bool MatchAndExplain(From from, MatchResultListener* listener) const { - To to = dynamic_cast<To>(from); - return MatchPrintAndExplain(to, this->matcher_, listener); - } -}; - -// Specialize for references. -// In this case we return false if the dynamic_cast fails. -template <typename To> -class WhenDynamicCastToMatcher<To&> : public WhenDynamicCastToMatcherBase<To&> { - public: - explicit WhenDynamicCastToMatcher(const Matcher<To&>& matcher) - : WhenDynamicCastToMatcherBase<To&>(matcher) {} - - template <typename From> - bool MatchAndExplain(From& from, MatchResultListener* listener) const { - // We don't want an std::bad_cast here, so do the cast with pointers. - To* to = dynamic_cast<To*>(&from); - if (to == nullptr) { - *listener << "which cannot be dynamic_cast to " << this->GetToName(); - return false; - } - return MatchPrintAndExplain(*to, this->matcher_, listener); - } -}; -#endif // GTEST_HAS_RTTI - -// Implements the Field() matcher for matching a field (i.e. member -// variable) of an object. -template <typename Class, typename FieldType> -class FieldMatcher { - public: - FieldMatcher(FieldType Class::*field, - const Matcher<const FieldType&>& matcher) - : field_(field), matcher_(matcher), whose_field_("whose given field ") {} - - FieldMatcher(const std::string& field_name, FieldType Class::*field, - const Matcher<const FieldType&>& matcher) - : field_(field), - matcher_(matcher), - whose_field_("whose field `" + field_name + "` ") {} - - void DescribeTo(::std::ostream* os) const { - *os << "is an object " << whose_field_; - matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const { - *os << "is an object " << whose_field_; - matcher_.DescribeNegationTo(os); - } - - template <typename T> - bool MatchAndExplain(const T& value, MatchResultListener* listener) const { - // FIXME: The dispatch on std::is_pointer was introduced as a workaround for - // a compiler bug, and can now be removed. - return MatchAndExplainImpl( - typename std::is_pointer<typename std::remove_const<T>::type>::type(), - value, listener); - } - - private: - bool MatchAndExplainImpl(std::false_type /* is_not_pointer */, - const Class& obj, - MatchResultListener* listener) const { - *listener << whose_field_ << "is "; - return MatchPrintAndExplain(obj.*field_, matcher_, listener); - } - - bool MatchAndExplainImpl(std::true_type /* is_pointer */, const Class* p, - MatchResultListener* listener) const { - if (p == nullptr) return false; - - *listener << "which points to an object "; - // Since *p has a field, it must be a class/struct/union type and - // thus cannot be a pointer. Therefore we pass false_type() as - // the first argument. - return MatchAndExplainImpl(std::false_type(), *p, listener); - } - - const FieldType Class::*field_; - const Matcher<const FieldType&> matcher_; - - // Contains either "whose given field " if the name of the field is unknown - // or "whose field `name_of_field` " if the name is known. - const std::string whose_field_; - - GTEST_DISALLOW_ASSIGN_(FieldMatcher); -}; - -// Implements the Property() matcher for matching a property -// (i.e. return value of a getter method) of an object. -// -// Property is a const-qualified member function of Class returning -// PropertyType. -template <typename Class, typename PropertyType, typename Property> -class PropertyMatcher { - public: - typedef const PropertyType& RefToConstProperty; - - PropertyMatcher(Property property, const Matcher<RefToConstProperty>& matcher) - : property_(property), - matcher_(matcher), - whose_property_("whose given property ") {} - - PropertyMatcher(const std::string& property_name, Property property, - const Matcher<RefToConstProperty>& matcher) - : property_(property), - matcher_(matcher), - whose_property_("whose property `" + property_name + "` ") {} - - void DescribeTo(::std::ostream* os) const { - *os << "is an object " << whose_property_; - matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const { - *os << "is an object " << whose_property_; - matcher_.DescribeNegationTo(os); - } - - template <typename T> - bool MatchAndExplain(const T&value, MatchResultListener* listener) const { - return MatchAndExplainImpl( - typename std::is_pointer<typename std::remove_const<T>::type>::type(), - value, listener); - } - - private: - bool MatchAndExplainImpl(std::false_type /* is_not_pointer */, - const Class& obj, - MatchResultListener* listener) const { - *listener << whose_property_ << "is "; - // Cannot pass the return value (for example, int) to MatchPrintAndExplain, - // which takes a non-const reference as argument. - RefToConstProperty result = (obj.*property_)(); - return MatchPrintAndExplain(result, matcher_, listener); - } - - bool MatchAndExplainImpl(std::true_type /* is_pointer */, const Class* p, - MatchResultListener* listener) const { - if (p == nullptr) return false; - - *listener << "which points to an object "; - // Since *p has a property method, it must be a class/struct/union - // type and thus cannot be a pointer. Therefore we pass - // false_type() as the first argument. - return MatchAndExplainImpl(std::false_type(), *p, listener); - } - - Property property_; - const Matcher<RefToConstProperty> matcher_; - - // Contains either "whose given property " if the name of the property is - // unknown or "whose property `name_of_property` " if the name is known. - const std::string whose_property_; - - GTEST_DISALLOW_ASSIGN_(PropertyMatcher); -}; - -// Type traits specifying various features of different functors for ResultOf. -// The default template specifies features for functor objects. -template <typename Functor> -struct CallableTraits { - typedef Functor StorageType; - - static void CheckIsValid(Functor /* functor */) {} - - template <typename T> - static auto Invoke(Functor f, const T& arg) -> decltype(f(arg)) { - return f(arg); - } -}; - -// Specialization for function pointers. -template <typename ArgType, typename ResType> -struct CallableTraits<ResType(*)(ArgType)> { - typedef ResType ResultType; - typedef ResType(*StorageType)(ArgType); - - static void CheckIsValid(ResType(*f)(ArgType)) { - GTEST_CHECK_(f != nullptr) - << "NULL function pointer is passed into ResultOf()."; - } - template <typename T> - static ResType Invoke(ResType(*f)(ArgType), T arg) { - return (*f)(arg); - } -}; - -// Implements the ResultOf() matcher for matching a return value of a -// unary function of an object. -template <typename Callable, typename InnerMatcher> -class ResultOfMatcher { - public: - ResultOfMatcher(Callable callable, InnerMatcher matcher) - : callable_(std::move(callable)), matcher_(std::move(matcher)) { - CallableTraits<Callable>::CheckIsValid(callable_); - } - - template <typename T> - operator Matcher<T>() const { - return Matcher<T>(new Impl<const T&>(callable_, matcher_)); - } - - private: - typedef typename CallableTraits<Callable>::StorageType CallableStorageType; - - template <typename T> - class Impl : public MatcherInterface<T> { - using ResultType = decltype(CallableTraits<Callable>::template Invoke<T>( - std::declval<CallableStorageType>(), std::declval<T>())); - - public: - template <typename M> - Impl(const CallableStorageType& callable, const M& matcher) - : callable_(callable), matcher_(MatcherCast<ResultType>(matcher)) {} - - void DescribeTo(::std::ostream* os) const override { - *os << "is mapped by the given callable to a value that "; - matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - *os << "is mapped by the given callable to a value that "; - matcher_.DescribeNegationTo(os); - } - - bool MatchAndExplain(T obj, MatchResultListener* listener) const override { - *listener << "which is mapped by the given callable to "; - // Cannot pass the return value directly to MatchPrintAndExplain, which - // takes a non-const reference as argument. - // Also, specifying template argument explicitly is needed because T could - // be a non-const reference (e.g. Matcher<Uncopyable&>). - ResultType result = - CallableTraits<Callable>::template Invoke<T>(callable_, obj); - return MatchPrintAndExplain(result, matcher_, listener); - } - - private: - // Functors often define operator() as non-const method even though - // they are actually stateless. But we need to use them even when - // 'this' is a const pointer. It's the user's responsibility not to - // use stateful callables with ResultOf(), which doesn't guarantee - // how many times the callable will be invoked. - mutable CallableStorageType callable_; - const Matcher<ResultType> matcher_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; // class Impl - - const CallableStorageType callable_; - const InnerMatcher matcher_; - - GTEST_DISALLOW_ASSIGN_(ResultOfMatcher); -}; - -// Implements a matcher that checks the size of an STL-style container. -template <typename SizeMatcher> -class SizeIsMatcher { - public: - explicit SizeIsMatcher(const SizeMatcher& size_matcher) - : size_matcher_(size_matcher) { - } - - template <typename Container> - operator Matcher<Container>() const { - return Matcher<Container>(new Impl<const Container&>(size_matcher_)); - } - - template <typename Container> - class Impl : public MatcherInterface<Container> { - public: - using SizeType = decltype(std::declval<Container>().size()); - explicit Impl(const SizeMatcher& size_matcher) - : size_matcher_(MatcherCast<SizeType>(size_matcher)) {} - - void DescribeTo(::std::ostream* os) const override { - *os << "size "; - size_matcher_.DescribeTo(os); - } - void DescribeNegationTo(::std::ostream* os) const override { - *os << "size "; - size_matcher_.DescribeNegationTo(os); - } - - bool MatchAndExplain(Container container, - MatchResultListener* listener) const override { - SizeType size = container.size(); - StringMatchResultListener size_listener; - const bool result = size_matcher_.MatchAndExplain(size, &size_listener); - *listener - << "whose size " << size << (result ? " matches" : " doesn't match"); - PrintIfNotEmpty(size_listener.str(), listener->stream()); - return result; - } - - private: - const Matcher<SizeType> size_matcher_; - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - private: - const SizeMatcher size_matcher_; - GTEST_DISALLOW_ASSIGN_(SizeIsMatcher); -}; - -// Implements a matcher that checks the begin()..end() distance of an STL-style -// container. -template <typename DistanceMatcher> -class BeginEndDistanceIsMatcher { - public: - explicit BeginEndDistanceIsMatcher(const DistanceMatcher& distance_matcher) - : distance_matcher_(distance_matcher) {} - - template <typename Container> - operator Matcher<Container>() const { - return Matcher<Container>(new Impl<const Container&>(distance_matcher_)); - } - - template <typename Container> - class Impl : public MatcherInterface<Container> { - public: - typedef internal::StlContainerView< - GTEST_REMOVE_REFERENCE_AND_CONST_(Container)> ContainerView; - typedef typename std::iterator_traits< - typename ContainerView::type::const_iterator>::difference_type - DistanceType; - explicit Impl(const DistanceMatcher& distance_matcher) - : distance_matcher_(MatcherCast<DistanceType>(distance_matcher)) {} - - void DescribeTo(::std::ostream* os) const override { - *os << "distance between begin() and end() "; - distance_matcher_.DescribeTo(os); - } - void DescribeNegationTo(::std::ostream* os) const override { - *os << "distance between begin() and end() "; - distance_matcher_.DescribeNegationTo(os); - } - - bool MatchAndExplain(Container container, - MatchResultListener* listener) const override { - using std::begin; - using std::end; - DistanceType distance = std::distance(begin(container), end(container)); - StringMatchResultListener distance_listener; - const bool result = - distance_matcher_.MatchAndExplain(distance, &distance_listener); - *listener << "whose distance between begin() and end() " << distance - << (result ? " matches" : " doesn't match"); - PrintIfNotEmpty(distance_listener.str(), listener->stream()); - return result; - } - - private: - const Matcher<DistanceType> distance_matcher_; - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - private: - const DistanceMatcher distance_matcher_; - GTEST_DISALLOW_ASSIGN_(BeginEndDistanceIsMatcher); -}; - -// Implements an equality matcher for any STL-style container whose elements -// support ==. This matcher is like Eq(), but its failure explanations provide -// more detailed information that is useful when the container is used as a set. -// The failure message reports elements that are in one of the operands but not -// the other. The failure messages do not report duplicate or out-of-order -// elements in the containers (which don't properly matter to sets, but can -// occur if the containers are vectors or lists, for example). -// -// Uses the container's const_iterator, value_type, operator ==, -// begin(), and end(). -template <typename Container> -class ContainerEqMatcher { - public: - typedef internal::StlContainerView<Container> View; - typedef typename View::type StlContainer; - typedef typename View::const_reference StlContainerReference; - - static_assert(!std::is_const<Container>::value, - "Container type must not be const"); - static_assert(!std::is_reference<Container>::value, - "Container type must not be a reference"); - - // We make a copy of expected in case the elements in it are modified - // after this matcher is created. - explicit ContainerEqMatcher(const Container& expected) - : expected_(View::Copy(expected)) {} - - void DescribeTo(::std::ostream* os) const { - *os << "equals "; - UniversalPrint(expected_, os); - } - void DescribeNegationTo(::std::ostream* os) const { - *os << "does not equal "; - UniversalPrint(expected_, os); - } - - template <typename LhsContainer> - bool MatchAndExplain(const LhsContainer& lhs, - MatchResultListener* listener) const { - typedef internal::StlContainerView< - typename std::remove_const<LhsContainer>::type> - LhsView; - typedef typename LhsView::type LhsStlContainer; - StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs); - if (lhs_stl_container == expected_) - return true; - - ::std::ostream* const os = listener->stream(); - if (os != nullptr) { - // Something is different. Check for extra values first. - bool printed_header = false; - for (typename LhsStlContainer::const_iterator it = - lhs_stl_container.begin(); - it != lhs_stl_container.end(); ++it) { - if (internal::ArrayAwareFind(expected_.begin(), expected_.end(), *it) == - expected_.end()) { - if (printed_header) { - *os << ", "; - } else { - *os << "which has these unexpected elements: "; - printed_header = true; - } - UniversalPrint(*it, os); - } - } - - // Now check for missing values. - bool printed_header2 = false; - for (typename StlContainer::const_iterator it = expected_.begin(); - it != expected_.end(); ++it) { - if (internal::ArrayAwareFind( - lhs_stl_container.begin(), lhs_stl_container.end(), *it) == - lhs_stl_container.end()) { - if (printed_header2) { - *os << ", "; - } else { - *os << (printed_header ? ",\nand" : "which") - << " doesn't have these expected elements: "; - printed_header2 = true; - } - UniversalPrint(*it, os); - } - } - } - - return false; - } - - private: - const StlContainer expected_; - - GTEST_DISALLOW_ASSIGN_(ContainerEqMatcher); -}; - -// A comparator functor that uses the < operator to compare two values. -struct LessComparator { - template <typename T, typename U> - bool operator()(const T& lhs, const U& rhs) const { return lhs < rhs; } -}; - -// Implements WhenSortedBy(comparator, container_matcher). -template <typename Comparator, typename ContainerMatcher> -class WhenSortedByMatcher { - public: - WhenSortedByMatcher(const Comparator& comparator, - const ContainerMatcher& matcher) - : comparator_(comparator), matcher_(matcher) {} - - template <typename LhsContainer> - operator Matcher<LhsContainer>() const { - return MakeMatcher(new Impl<LhsContainer>(comparator_, matcher_)); - } - - template <typename LhsContainer> - class Impl : public MatcherInterface<LhsContainer> { - public: - typedef internal::StlContainerView< - GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView; - typedef typename LhsView::type LhsStlContainer; - typedef typename LhsView::const_reference LhsStlContainerReference; - // Transforms std::pair<const Key, Value> into std::pair<Key, Value> - // so that we can match associative containers. - typedef typename RemoveConstFromKey< - typename LhsStlContainer::value_type>::type LhsValue; - - Impl(const Comparator& comparator, const ContainerMatcher& matcher) - : comparator_(comparator), matcher_(matcher) {} - - void DescribeTo(::std::ostream* os) const override { - *os << "(when sorted) "; - matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - *os << "(when sorted) "; - matcher_.DescribeNegationTo(os); - } - - bool MatchAndExplain(LhsContainer lhs, - MatchResultListener* listener) const override { - LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs); - ::std::vector<LhsValue> sorted_container(lhs_stl_container.begin(), - lhs_stl_container.end()); - ::std::sort( - sorted_container.begin(), sorted_container.end(), comparator_); - - if (!listener->IsInterested()) { - // If the listener is not interested, we do not need to - // construct the inner explanation. - return matcher_.Matches(sorted_container); - } - - *listener << "which is "; - UniversalPrint(sorted_container, listener->stream()); - *listener << " when sorted"; - - StringMatchResultListener inner_listener; - const bool match = matcher_.MatchAndExplain(sorted_container, - &inner_listener); - PrintIfNotEmpty(inner_listener.str(), listener->stream()); - return match; - } - - private: - const Comparator comparator_; - const Matcher<const ::std::vector<LhsValue>&> matcher_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(Impl); - }; - - private: - const Comparator comparator_; - const ContainerMatcher matcher_; - - GTEST_DISALLOW_ASSIGN_(WhenSortedByMatcher); -}; - -// Implements Pointwise(tuple_matcher, rhs_container). tuple_matcher -// must be able to be safely cast to Matcher<std::tuple<const T1&, const -// T2&> >, where T1 and T2 are the types of elements in the LHS -// container and the RHS container respectively. -template <typename TupleMatcher, typename RhsContainer> -class PointwiseMatcher { - GTEST_COMPILE_ASSERT_( - !IsHashTable<GTEST_REMOVE_REFERENCE_AND_CONST_(RhsContainer)>::value, - use_UnorderedPointwise_with_hash_tables); - - public: - typedef internal::StlContainerView<RhsContainer> RhsView; - typedef typename RhsView::type RhsStlContainer; - typedef typename RhsStlContainer::value_type RhsValue; - - static_assert(!std::is_const<RhsContainer>::value, - "RhsContainer type must not be const"); - static_assert(!std::is_reference<RhsContainer>::value, - "RhsContainer type must not be a reference"); - - // Like ContainerEq, we make a copy of rhs in case the elements in - // it are modified after this matcher is created. - PointwiseMatcher(const TupleMatcher& tuple_matcher, const RhsContainer& rhs) - : tuple_matcher_(tuple_matcher), rhs_(RhsView::Copy(rhs)) {} - - template <typename LhsContainer> - operator Matcher<LhsContainer>() const { - GTEST_COMPILE_ASSERT_( - !IsHashTable<GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)>::value, - use_UnorderedPointwise_with_hash_tables); - - return Matcher<LhsContainer>( - new Impl<const LhsContainer&>(tuple_matcher_, rhs_)); - } - - template <typename LhsContainer> - class Impl : public MatcherInterface<LhsContainer> { - public: - typedef internal::StlContainerView< - GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView; - typedef typename LhsView::type LhsStlContainer; - typedef typename LhsView::const_reference LhsStlContainerReference; - typedef typename LhsStlContainer::value_type LhsValue; - // We pass the LHS value and the RHS value to the inner matcher by - // reference, as they may be expensive to copy. We must use tuple - // instead of pair here, as a pair cannot hold references (C++ 98, - // 20.2.2 [lib.pairs]). - typedef ::std::tuple<const LhsValue&, const RhsValue&> InnerMatcherArg; - - Impl(const TupleMatcher& tuple_matcher, const RhsStlContainer& rhs) - // mono_tuple_matcher_ holds a monomorphic version of the tuple matcher. - : mono_tuple_matcher_(SafeMatcherCast<InnerMatcherArg>(tuple_matcher)), - rhs_(rhs) {} - - void DescribeTo(::std::ostream* os) const override { - *os << "contains " << rhs_.size() - << " values, where each value and its corresponding value in "; - UniversalPrinter<RhsStlContainer>::Print(rhs_, os); - *os << " "; - mono_tuple_matcher_.DescribeTo(os); - } - void DescribeNegationTo(::std::ostream* os) const override { - *os << "doesn't contain exactly " << rhs_.size() - << " values, or contains a value x at some index i" - << " where x and the i-th value of "; - UniversalPrint(rhs_, os); - *os << " "; - mono_tuple_matcher_.DescribeNegationTo(os); - } - - bool MatchAndExplain(LhsContainer lhs, - MatchResultListener* listener) const override { - LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs); - const size_t actual_size = lhs_stl_container.size(); - if (actual_size != rhs_.size()) { - *listener << "which contains " << actual_size << " values"; - return false; - } - - typename LhsStlContainer::const_iterator left = lhs_stl_container.begin(); - typename RhsStlContainer::const_iterator right = rhs_.begin(); - for (size_t i = 0; i != actual_size; ++i, ++left, ++right) { - if (listener->IsInterested()) { - StringMatchResultListener inner_listener; - // Create InnerMatcherArg as a temporarily object to avoid it outlives - // *left and *right. Dereference or the conversion to `const T&` may - // return temp objects, e.g for vector<bool>. - if (!mono_tuple_matcher_.MatchAndExplain( - InnerMatcherArg(ImplicitCast_<const LhsValue&>(*left), - ImplicitCast_<const RhsValue&>(*right)), - &inner_listener)) { - *listener << "where the value pair ("; - UniversalPrint(*left, listener->stream()); - *listener << ", "; - UniversalPrint(*right, listener->stream()); - *listener << ") at index #" << i << " don't match"; - PrintIfNotEmpty(inner_listener.str(), listener->stream()); - return false; - } - } else { - if (!mono_tuple_matcher_.Matches( - InnerMatcherArg(ImplicitCast_<const LhsValue&>(*left), - ImplicitCast_<const RhsValue&>(*right)))) - return false; - } - } - - return true; - } - - private: - const Matcher<InnerMatcherArg> mono_tuple_matcher_; - const RhsStlContainer rhs_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - private: - const TupleMatcher tuple_matcher_; - const RhsStlContainer rhs_; - - GTEST_DISALLOW_ASSIGN_(PointwiseMatcher); -}; - -// Holds the logic common to ContainsMatcherImpl and EachMatcherImpl. -template <typename Container> -class QuantifierMatcherImpl : public MatcherInterface<Container> { - public: - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; - typedef StlContainerView<RawContainer> View; - typedef typename View::type StlContainer; - typedef typename View::const_reference StlContainerReference; - typedef typename StlContainer::value_type Element; - - template <typename InnerMatcher> - explicit QuantifierMatcherImpl(InnerMatcher inner_matcher) - : inner_matcher_( - testing::SafeMatcherCast<const Element&>(inner_matcher)) {} - - // Checks whether: - // * All elements in the container match, if all_elements_should_match. - // * Any element in the container matches, if !all_elements_should_match. - bool MatchAndExplainImpl(bool all_elements_should_match, - Container container, - MatchResultListener* listener) const { - StlContainerReference stl_container = View::ConstReference(container); - size_t i = 0; - for (typename StlContainer::const_iterator it = stl_container.begin(); - it != stl_container.end(); ++it, ++i) { - StringMatchResultListener inner_listener; - const bool matches = inner_matcher_.MatchAndExplain(*it, &inner_listener); - - if (matches != all_elements_should_match) { - *listener << "whose element #" << i - << (matches ? " matches" : " doesn't match"); - PrintIfNotEmpty(inner_listener.str(), listener->stream()); - return !all_elements_should_match; - } - } - return all_elements_should_match; - } - - protected: - const Matcher<const Element&> inner_matcher_; - - GTEST_DISALLOW_ASSIGN_(QuantifierMatcherImpl); -}; - -// Implements Contains(element_matcher) for the given argument type Container. -// Symmetric to EachMatcherImpl. -template <typename Container> -class ContainsMatcherImpl : public QuantifierMatcherImpl<Container> { - public: - template <typename InnerMatcher> - explicit ContainsMatcherImpl(InnerMatcher inner_matcher) - : QuantifierMatcherImpl<Container>(inner_matcher) {} - - // Describes what this matcher does. - void DescribeTo(::std::ostream* os) const override { - *os << "contains at least one element that "; - this->inner_matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - *os << "doesn't contain any element that "; - this->inner_matcher_.DescribeTo(os); - } - - bool MatchAndExplain(Container container, - MatchResultListener* listener) const override { - return this->MatchAndExplainImpl(false, container, listener); - } - - private: - GTEST_DISALLOW_ASSIGN_(ContainsMatcherImpl); -}; - -// Implements Each(element_matcher) for the given argument type Container. -// Symmetric to ContainsMatcherImpl. -template <typename Container> -class EachMatcherImpl : public QuantifierMatcherImpl<Container> { - public: - template <typename InnerMatcher> - explicit EachMatcherImpl(InnerMatcher inner_matcher) - : QuantifierMatcherImpl<Container>(inner_matcher) {} - - // Describes what this matcher does. - void DescribeTo(::std::ostream* os) const override { - *os << "only contains elements that "; - this->inner_matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - *os << "contains some element that "; - this->inner_matcher_.DescribeNegationTo(os); - } - - bool MatchAndExplain(Container container, - MatchResultListener* listener) const override { - return this->MatchAndExplainImpl(true, container, listener); - } - - private: - GTEST_DISALLOW_ASSIGN_(EachMatcherImpl); -}; - -// Implements polymorphic Contains(element_matcher). -template <typename M> -class ContainsMatcher { - public: - explicit ContainsMatcher(M m) : inner_matcher_(m) {} - - template <typename Container> - operator Matcher<Container>() const { - return Matcher<Container>( - new ContainsMatcherImpl<const Container&>(inner_matcher_)); - } - - private: - const M inner_matcher_; - - GTEST_DISALLOW_ASSIGN_(ContainsMatcher); -}; - -// Implements polymorphic Each(element_matcher). -template <typename M> -class EachMatcher { - public: - explicit EachMatcher(M m) : inner_matcher_(m) {} - - template <typename Container> - operator Matcher<Container>() const { - return Matcher<Container>( - new EachMatcherImpl<const Container&>(inner_matcher_)); - } - - private: - const M inner_matcher_; - - GTEST_DISALLOW_ASSIGN_(EachMatcher); -}; - -struct Rank1 {}; -struct Rank0 : Rank1 {}; - -namespace pair_getters { -using std::get; -template <typename T> -auto First(T& x, Rank1) -> decltype(get<0>(x)) { // NOLINT - return get<0>(x); -} -template <typename T> -auto First(T& x, Rank0) -> decltype((x.first)) { // NOLINT - return x.first; -} - -template <typename T> -auto Second(T& x, Rank1) -> decltype(get<1>(x)) { // NOLINT - return get<1>(x); -} -template <typename T> -auto Second(T& x, Rank0) -> decltype((x.second)) { // NOLINT - return x.second; -} -} // namespace pair_getters - -// Implements Key(inner_matcher) for the given argument pair type. -// Key(inner_matcher) matches an std::pair whose 'first' field matches -// inner_matcher. For example, Contains(Key(Ge(5))) can be used to match an -// std::map that contains at least one element whose key is >= 5. -template <typename PairType> -class KeyMatcherImpl : public MatcherInterface<PairType> { - public: - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(PairType) RawPairType; - typedef typename RawPairType::first_type KeyType; - - template <typename InnerMatcher> - explicit KeyMatcherImpl(InnerMatcher inner_matcher) - : inner_matcher_( - testing::SafeMatcherCast<const KeyType&>(inner_matcher)) { - } - - // Returns true if and only if 'key_value.first' (the key) matches the inner - // matcher. - bool MatchAndExplain(PairType key_value, - MatchResultListener* listener) const override { - StringMatchResultListener inner_listener; - const bool match = inner_matcher_.MatchAndExplain( - pair_getters::First(key_value, Rank0()), &inner_listener); - const std::string explanation = inner_listener.str(); - if (explanation != "") { - *listener << "whose first field is a value " << explanation; - } - return match; - } - - // Describes what this matcher does. - void DescribeTo(::std::ostream* os) const override { - *os << "has a key that "; - inner_matcher_.DescribeTo(os); - } - - // Describes what the negation of this matcher does. - void DescribeNegationTo(::std::ostream* os) const override { - *os << "doesn't have a key that "; - inner_matcher_.DescribeTo(os); - } - - private: - const Matcher<const KeyType&> inner_matcher_; - - GTEST_DISALLOW_ASSIGN_(KeyMatcherImpl); -}; - -// Implements polymorphic Key(matcher_for_key). -template <typename M> -class KeyMatcher { - public: - explicit KeyMatcher(M m) : matcher_for_key_(m) {} - - template <typename PairType> - operator Matcher<PairType>() const { - return Matcher<PairType>( - new KeyMatcherImpl<const PairType&>(matcher_for_key_)); - } - - private: - const M matcher_for_key_; - - GTEST_DISALLOW_ASSIGN_(KeyMatcher); -}; - -// Implements Pair(first_matcher, second_matcher) for the given argument pair -// type with its two matchers. See Pair() function below. -template <typename PairType> -class PairMatcherImpl : public MatcherInterface<PairType> { - public: - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(PairType) RawPairType; - typedef typename RawPairType::first_type FirstType; - typedef typename RawPairType::second_type SecondType; - - template <typename FirstMatcher, typename SecondMatcher> - PairMatcherImpl(FirstMatcher first_matcher, SecondMatcher second_matcher) - : first_matcher_( - testing::SafeMatcherCast<const FirstType&>(first_matcher)), - second_matcher_( - testing::SafeMatcherCast<const SecondType&>(second_matcher)) { - } - - // Describes what this matcher does. - void DescribeTo(::std::ostream* os) const override { - *os << "has a first field that "; - first_matcher_.DescribeTo(os); - *os << ", and has a second field that "; - second_matcher_.DescribeTo(os); - } - - // Describes what the negation of this matcher does. - void DescribeNegationTo(::std::ostream* os) const override { - *os << "has a first field that "; - first_matcher_.DescribeNegationTo(os); - *os << ", or has a second field that "; - second_matcher_.DescribeNegationTo(os); - } - - // Returns true if and only if 'a_pair.first' matches first_matcher and - // 'a_pair.second' matches second_matcher. - bool MatchAndExplain(PairType a_pair, - MatchResultListener* listener) const override { - if (!listener->IsInterested()) { - // If the listener is not interested, we don't need to construct the - // explanation. - return first_matcher_.Matches(pair_getters::First(a_pair, Rank0())) && - second_matcher_.Matches(pair_getters::Second(a_pair, Rank0())); - } - StringMatchResultListener first_inner_listener; - if (!first_matcher_.MatchAndExplain(pair_getters::First(a_pair, Rank0()), - &first_inner_listener)) { - *listener << "whose first field does not match"; - PrintIfNotEmpty(first_inner_listener.str(), listener->stream()); - return false; - } - StringMatchResultListener second_inner_listener; - if (!second_matcher_.MatchAndExplain(pair_getters::Second(a_pair, Rank0()), - &second_inner_listener)) { - *listener << "whose second field does not match"; - PrintIfNotEmpty(second_inner_listener.str(), listener->stream()); - return false; - } - ExplainSuccess(first_inner_listener.str(), second_inner_listener.str(), - listener); - return true; - } - - private: - void ExplainSuccess(const std::string& first_explanation, - const std::string& second_explanation, - MatchResultListener* listener) const { - *listener << "whose both fields match"; - if (first_explanation != "") { - *listener << ", where the first field is a value " << first_explanation; - } - if (second_explanation != "") { - *listener << ", "; - if (first_explanation != "") { - *listener << "and "; - } else { - *listener << "where "; - } - *listener << "the second field is a value " << second_explanation; - } - } - - const Matcher<const FirstType&> first_matcher_; - const Matcher<const SecondType&> second_matcher_; - - GTEST_DISALLOW_ASSIGN_(PairMatcherImpl); -}; - -// Implements polymorphic Pair(first_matcher, second_matcher). -template <typename FirstMatcher, typename SecondMatcher> -class PairMatcher { - public: - PairMatcher(FirstMatcher first_matcher, SecondMatcher second_matcher) - : first_matcher_(first_matcher), second_matcher_(second_matcher) {} - - template <typename PairType> - operator Matcher<PairType> () const { - return Matcher<PairType>( - new PairMatcherImpl<const PairType&>(first_matcher_, second_matcher_)); - } - - private: - const FirstMatcher first_matcher_; - const SecondMatcher second_matcher_; - - GTEST_DISALLOW_ASSIGN_(PairMatcher); -}; - -// Implements ElementsAre() and ElementsAreArray(). -template <typename Container> -class ElementsAreMatcherImpl : public MatcherInterface<Container> { - public: - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; - typedef internal::StlContainerView<RawContainer> View; - typedef typename View::type StlContainer; - typedef typename View::const_reference StlContainerReference; - typedef typename StlContainer::value_type Element; - - // Constructs the matcher from a sequence of element values or - // element matchers. - template <typename InputIter> - ElementsAreMatcherImpl(InputIter first, InputIter last) { - while (first != last) { - matchers_.push_back(MatcherCast<const Element&>(*first++)); - } - } - - // Describes what this matcher does. - void DescribeTo(::std::ostream* os) const override { - if (count() == 0) { - *os << "is empty"; - } else if (count() == 1) { - *os << "has 1 element that "; - matchers_[0].DescribeTo(os); - } else { - *os << "has " << Elements(count()) << " where\n"; - for (size_t i = 0; i != count(); ++i) { - *os << "element #" << i << " "; - matchers_[i].DescribeTo(os); - if (i + 1 < count()) { - *os << ",\n"; - } - } - } - } - - // Describes what the negation of this matcher does. - void DescribeNegationTo(::std::ostream* os) const override { - if (count() == 0) { - *os << "isn't empty"; - return; - } - - *os << "doesn't have " << Elements(count()) << ", or\n"; - for (size_t i = 0; i != count(); ++i) { - *os << "element #" << i << " "; - matchers_[i].DescribeNegationTo(os); - if (i + 1 < count()) { - *os << ", or\n"; - } - } - } - - bool MatchAndExplain(Container container, - MatchResultListener* listener) const override { - // To work with stream-like "containers", we must only walk - // through the elements in one pass. - - const bool listener_interested = listener->IsInterested(); - - // explanations[i] is the explanation of the element at index i. - ::std::vector<std::string> explanations(count()); - StlContainerReference stl_container = View::ConstReference(container); - typename StlContainer::const_iterator it = stl_container.begin(); - size_t exam_pos = 0; - bool mismatch_found = false; // Have we found a mismatched element yet? - - // Go through the elements and matchers in pairs, until we reach - // the end of either the elements or the matchers, or until we find a - // mismatch. - for (; it != stl_container.end() && exam_pos != count(); ++it, ++exam_pos) { - bool match; // Does the current element match the current matcher? - if (listener_interested) { - StringMatchResultListener s; - match = matchers_[exam_pos].MatchAndExplain(*it, &s); - explanations[exam_pos] = s.str(); - } else { - match = matchers_[exam_pos].Matches(*it); - } - - if (!match) { - mismatch_found = true; - break; - } - } - // If mismatch_found is true, 'exam_pos' is the index of the mismatch. - - // Find how many elements the actual container has. We avoid - // calling size() s.t. this code works for stream-like "containers" - // that don't define size(). - size_t actual_count = exam_pos; - for (; it != stl_container.end(); ++it) { - ++actual_count; - } - - if (actual_count != count()) { - // The element count doesn't match. If the container is empty, - // there's no need to explain anything as Google Mock already - // prints the empty container. Otherwise we just need to show - // how many elements there actually are. - if (listener_interested && (actual_count != 0)) { - *listener << "which has " << Elements(actual_count); - } - return false; - } - - if (mismatch_found) { - // The element count matches, but the exam_pos-th element doesn't match. - if (listener_interested) { - *listener << "whose element #" << exam_pos << " doesn't match"; - PrintIfNotEmpty(explanations[exam_pos], listener->stream()); - } - return false; - } - - // Every element matches its expectation. We need to explain why - // (the obvious ones can be skipped). - if (listener_interested) { - bool reason_printed = false; - for (size_t i = 0; i != count(); ++i) { - const std::string& s = explanations[i]; - if (!s.empty()) { - if (reason_printed) { - *listener << ",\nand "; - } - *listener << "whose element #" << i << " matches, " << s; - reason_printed = true; - } - } - } - return true; - } - - private: - static Message Elements(size_t count) { - return Message() << count << (count == 1 ? " element" : " elements"); - } - - size_t count() const { return matchers_.size(); } - - ::std::vector<Matcher<const Element&> > matchers_; - - GTEST_DISALLOW_ASSIGN_(ElementsAreMatcherImpl); -}; - -// Connectivity matrix of (elements X matchers), in element-major order. -// Initially, there are no edges. -// Use NextGraph() to iterate over all possible edge configurations. -// Use Randomize() to generate a random edge configuration. -class GTEST_API_ MatchMatrix { - public: - MatchMatrix(size_t num_elements, size_t num_matchers) - : num_elements_(num_elements), - num_matchers_(num_matchers), - matched_(num_elements_* num_matchers_, 0) { - } - - size_t LhsSize() const { return num_elements_; } - size_t RhsSize() const { return num_matchers_; } - bool HasEdge(size_t ilhs, size_t irhs) const { - return matched_[SpaceIndex(ilhs, irhs)] == 1; - } - void SetEdge(size_t ilhs, size_t irhs, bool b) { - matched_[SpaceIndex(ilhs, irhs)] = b ? 1 : 0; - } - - // Treating the connectivity matrix as a (LhsSize()*RhsSize())-bit number, - // adds 1 to that number; returns false if incrementing the graph left it - // empty. - bool NextGraph(); - - void Randomize(); - - std::string DebugString() const; - - private: - size_t SpaceIndex(size_t ilhs, size_t irhs) const { - return ilhs * num_matchers_ + irhs; - } - - size_t num_elements_; - size_t num_matchers_; - - // Each element is a char interpreted as bool. They are stored as a - // flattened array in lhs-major order, use 'SpaceIndex()' to translate - // a (ilhs, irhs) matrix coordinate into an offset. - ::std::vector<char> matched_; -}; - -typedef ::std::pair<size_t, size_t> ElementMatcherPair; -typedef ::std::vector<ElementMatcherPair> ElementMatcherPairs; - -// Returns a maximum bipartite matching for the specified graph 'g'. -// The matching is represented as a vector of {element, matcher} pairs. -GTEST_API_ ElementMatcherPairs -FindMaxBipartiteMatching(const MatchMatrix& g); - -struct UnorderedMatcherRequire { - enum Flags { - Superset = 1 << 0, - Subset = 1 << 1, - ExactMatch = Superset | Subset, - }; -}; - -// Untyped base class for implementing UnorderedElementsAre. By -// putting logic that's not specific to the element type here, we -// reduce binary bloat and increase compilation speed. -class GTEST_API_ UnorderedElementsAreMatcherImplBase { - protected: - explicit UnorderedElementsAreMatcherImplBase( - UnorderedMatcherRequire::Flags matcher_flags) - : match_flags_(matcher_flags) {} - - // A vector of matcher describers, one for each element matcher. - // Does not own the describers (and thus can be used only when the - // element matchers are alive). - typedef ::std::vector<const MatcherDescriberInterface*> MatcherDescriberVec; - - // Describes this UnorderedElementsAre matcher. - void DescribeToImpl(::std::ostream* os) const; - - // Describes the negation of this UnorderedElementsAre matcher. - void DescribeNegationToImpl(::std::ostream* os) const; - - bool VerifyMatchMatrix(const ::std::vector<std::string>& element_printouts, - const MatchMatrix& matrix, - MatchResultListener* listener) const; - - bool FindPairing(const MatchMatrix& matrix, - MatchResultListener* listener) const; - - MatcherDescriberVec& matcher_describers() { - return matcher_describers_; - } - - static Message Elements(size_t n) { - return Message() << n << " element" << (n == 1 ? "" : "s"); - } - - UnorderedMatcherRequire::Flags match_flags() const { return match_flags_; } - - private: - UnorderedMatcherRequire::Flags match_flags_; - MatcherDescriberVec matcher_describers_; - - GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcherImplBase); -}; - -// Implements UnorderedElementsAre, UnorderedElementsAreArray, IsSubsetOf, and -// IsSupersetOf. -template <typename Container> -class UnorderedElementsAreMatcherImpl - : public MatcherInterface<Container>, - public UnorderedElementsAreMatcherImplBase { - public: - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; - typedef internal::StlContainerView<RawContainer> View; - typedef typename View::type StlContainer; - typedef typename View::const_reference StlContainerReference; - typedef typename StlContainer::const_iterator StlContainerConstIterator; - typedef typename StlContainer::value_type Element; - - template <typename InputIter> - UnorderedElementsAreMatcherImpl(UnorderedMatcherRequire::Flags matcher_flags, - InputIter first, InputIter last) - : UnorderedElementsAreMatcherImplBase(matcher_flags) { - for (; first != last; ++first) { - matchers_.push_back(MatcherCast<const Element&>(*first)); - matcher_describers().push_back(matchers_.back().GetDescriber()); - } - } - - // Describes what this matcher does. - void DescribeTo(::std::ostream* os) const override { - return UnorderedElementsAreMatcherImplBase::DescribeToImpl(os); - } - - // Describes what the negation of this matcher does. - void DescribeNegationTo(::std::ostream* os) const override { - return UnorderedElementsAreMatcherImplBase::DescribeNegationToImpl(os); - } - - bool MatchAndExplain(Container container, - MatchResultListener* listener) const override { - StlContainerReference stl_container = View::ConstReference(container); - ::std::vector<std::string> element_printouts; - MatchMatrix matrix = - AnalyzeElements(stl_container.begin(), stl_container.end(), - &element_printouts, listener); - - if (matrix.LhsSize() == 0 && matrix.RhsSize() == 0) { - return true; - } - - if (match_flags() == UnorderedMatcherRequire::ExactMatch) { - if (matrix.LhsSize() != matrix.RhsSize()) { - // The element count doesn't match. If the container is empty, - // there's no need to explain anything as Google Mock already - // prints the empty container. Otherwise we just need to show - // how many elements there actually are. - if (matrix.LhsSize() != 0 && listener->IsInterested()) { - *listener << "which has " << Elements(matrix.LhsSize()); - } - return false; - } - } - - return VerifyMatchMatrix(element_printouts, matrix, listener) && - FindPairing(matrix, listener); - } - - private: - template <typename ElementIter> - MatchMatrix AnalyzeElements(ElementIter elem_first, ElementIter elem_last, - ::std::vector<std::string>* element_printouts, - MatchResultListener* listener) const { - element_printouts->clear(); - ::std::vector<char> did_match; - size_t num_elements = 0; - for (; elem_first != elem_last; ++num_elements, ++elem_first) { - if (listener->IsInterested()) { - element_printouts->push_back(PrintToString(*elem_first)); - } - for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) { - did_match.push_back(Matches(matchers_[irhs])(*elem_first)); - } - } - - MatchMatrix matrix(num_elements, matchers_.size()); - ::std::vector<char>::const_iterator did_match_iter = did_match.begin(); - for (size_t ilhs = 0; ilhs != num_elements; ++ilhs) { - for (size_t irhs = 0; irhs != matchers_.size(); ++irhs) { - matrix.SetEdge(ilhs, irhs, *did_match_iter++ != 0); - } - } - return matrix; - } - - ::std::vector<Matcher<const Element&> > matchers_; - - GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcherImpl); -}; - -// Functor for use in TransformTuple. -// Performs MatcherCast<Target> on an input argument of any type. -template <typename Target> -struct CastAndAppendTransform { - template <typename Arg> - Matcher<Target> operator()(const Arg& a) const { - return MatcherCast<Target>(a); - } -}; - -// Implements UnorderedElementsAre. -template <typename MatcherTuple> -class UnorderedElementsAreMatcher { - public: - explicit UnorderedElementsAreMatcher(const MatcherTuple& args) - : matchers_(args) {} - - template <typename Container> - operator Matcher<Container>() const { - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; - typedef typename internal::StlContainerView<RawContainer>::type View; - typedef typename View::value_type Element; - typedef ::std::vector<Matcher<const Element&> > MatcherVec; - MatcherVec matchers; - matchers.reserve(::std::tuple_size<MatcherTuple>::value); - TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_, - ::std::back_inserter(matchers)); - return Matcher<Container>( - new UnorderedElementsAreMatcherImpl<const Container&>( - UnorderedMatcherRequire::ExactMatch, matchers.begin(), - matchers.end())); - } - - private: - const MatcherTuple matchers_; - GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreMatcher); -}; - -// Implements ElementsAre. -template <typename MatcherTuple> -class ElementsAreMatcher { - public: - explicit ElementsAreMatcher(const MatcherTuple& args) : matchers_(args) {} - - template <typename Container> - operator Matcher<Container>() const { - GTEST_COMPILE_ASSERT_( - !IsHashTable<GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>::value || - ::std::tuple_size<MatcherTuple>::value < 2, - use_UnorderedElementsAre_with_hash_tables); - - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer; - typedef typename internal::StlContainerView<RawContainer>::type View; - typedef typename View::value_type Element; - typedef ::std::vector<Matcher<const Element&> > MatcherVec; - MatcherVec matchers; - matchers.reserve(::std::tuple_size<MatcherTuple>::value); - TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_, - ::std::back_inserter(matchers)); - return Matcher<Container>(new ElementsAreMatcherImpl<const Container&>( - matchers.begin(), matchers.end())); - } - - private: - const MatcherTuple matchers_; - GTEST_DISALLOW_ASSIGN_(ElementsAreMatcher); -}; - -// Implements UnorderedElementsAreArray(), IsSubsetOf(), and IsSupersetOf(). -template <typename T> -class UnorderedElementsAreArrayMatcher { - public: - template <typename Iter> - UnorderedElementsAreArrayMatcher(UnorderedMatcherRequire::Flags match_flags, - Iter first, Iter last) - : match_flags_(match_flags), matchers_(first, last) {} - - template <typename Container> - operator Matcher<Container>() const { - return Matcher<Container>( - new UnorderedElementsAreMatcherImpl<const Container&>( - match_flags_, matchers_.begin(), matchers_.end())); - } - - private: - UnorderedMatcherRequire::Flags match_flags_; - ::std::vector<T> matchers_; - - GTEST_DISALLOW_ASSIGN_(UnorderedElementsAreArrayMatcher); -}; - -// Implements ElementsAreArray(). -template <typename T> -class ElementsAreArrayMatcher { - public: - template <typename Iter> - ElementsAreArrayMatcher(Iter first, Iter last) : matchers_(first, last) {} - - template <typename Container> - operator Matcher<Container>() const { - GTEST_COMPILE_ASSERT_( - !IsHashTable<GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>::value, - use_UnorderedElementsAreArray_with_hash_tables); - - return Matcher<Container>(new ElementsAreMatcherImpl<const Container&>( - matchers_.begin(), matchers_.end())); - } - - private: - const ::std::vector<T> matchers_; - - GTEST_DISALLOW_ASSIGN_(ElementsAreArrayMatcher); -}; - -// Given a 2-tuple matcher tm of type Tuple2Matcher and a value second -// of type Second, BoundSecondMatcher<Tuple2Matcher, Second>(tm, -// second) is a polymorphic matcher that matches a value x if and only if -// tm matches tuple (x, second). Useful for implementing -// UnorderedPointwise() in terms of UnorderedElementsAreArray(). -// -// BoundSecondMatcher is copyable and assignable, as we need to put -// instances of this class in a vector when implementing -// UnorderedPointwise(). -template <typename Tuple2Matcher, typename Second> -class BoundSecondMatcher { - public: - BoundSecondMatcher(const Tuple2Matcher& tm, const Second& second) - : tuple2_matcher_(tm), second_value_(second) {} - - template <typename T> - operator Matcher<T>() const { - return MakeMatcher(new Impl<T>(tuple2_matcher_, second_value_)); - } - - // We have to define this for UnorderedPointwise() to compile in - // C++98 mode, as it puts BoundSecondMatcher instances in a vector, - // which requires the elements to be assignable in C++98. The - // compiler cannot generate the operator= for us, as Tuple2Matcher - // and Second may not be assignable. - // - // However, this should never be called, so the implementation just - // need to assert. - void operator=(const BoundSecondMatcher& /*rhs*/) { - GTEST_LOG_(FATAL) << "BoundSecondMatcher should never be assigned."; - } - - private: - template <typename T> - class Impl : public MatcherInterface<T> { - public: - typedef ::std::tuple<T, Second> ArgTuple; - - Impl(const Tuple2Matcher& tm, const Second& second) - : mono_tuple2_matcher_(SafeMatcherCast<const ArgTuple&>(tm)), - second_value_(second) {} - - void DescribeTo(::std::ostream* os) const override { - *os << "and "; - UniversalPrint(second_value_, os); - *os << " "; - mono_tuple2_matcher_.DescribeTo(os); - } - - bool MatchAndExplain(T x, MatchResultListener* listener) const override { - return mono_tuple2_matcher_.MatchAndExplain(ArgTuple(x, second_value_), - listener); - } - - private: - const Matcher<const ArgTuple&> mono_tuple2_matcher_; - const Second second_value_; - - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - const Tuple2Matcher tuple2_matcher_; - const Second second_value_; -}; - -// Given a 2-tuple matcher tm and a value second, -// MatcherBindSecond(tm, second) returns a matcher that matches a -// value x if and only if tm matches tuple (x, second). Useful for -// implementing UnorderedPointwise() in terms of UnorderedElementsAreArray(). -template <typename Tuple2Matcher, typename Second> -BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond( - const Tuple2Matcher& tm, const Second& second) { - return BoundSecondMatcher<Tuple2Matcher, Second>(tm, second); -} - -// Returns the description for a matcher defined using the MATCHER*() -// macro where the user-supplied description string is "", if -// 'negation' is false; otherwise returns the description of the -// negation of the matcher. 'param_values' contains a list of strings -// that are the print-out of the matcher's parameters. -GTEST_API_ std::string FormatMatcherDescription(bool negation, - const char* matcher_name, - const Strings& param_values); - -// Implements a matcher that checks the value of a optional<> type variable. -template <typename ValueMatcher> -class OptionalMatcher { - public: - explicit OptionalMatcher(const ValueMatcher& value_matcher) - : value_matcher_(value_matcher) {} - - template <typename Optional> - operator Matcher<Optional>() const { - return Matcher<Optional>(new Impl<const Optional&>(value_matcher_)); - } - - template <typename Optional> - class Impl : public MatcherInterface<Optional> { - public: - typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Optional) OptionalView; - typedef typename OptionalView::value_type ValueType; - explicit Impl(const ValueMatcher& value_matcher) - : value_matcher_(MatcherCast<ValueType>(value_matcher)) {} - - void DescribeTo(::std::ostream* os) const override { - *os << "value "; - value_matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - *os << "value "; - value_matcher_.DescribeNegationTo(os); - } - - bool MatchAndExplain(Optional optional, - MatchResultListener* listener) const override { - if (!optional) { - *listener << "which is not engaged"; - return false; - } - const ValueType& value = *optional; - StringMatchResultListener value_listener; - const bool match = value_matcher_.MatchAndExplain(value, &value_listener); - *listener << "whose value " << PrintToString(value) - << (match ? " matches" : " doesn't match"); - PrintIfNotEmpty(value_listener.str(), listener->stream()); - return match; - } - - private: - const Matcher<ValueType> value_matcher_; - GTEST_DISALLOW_ASSIGN_(Impl); - }; - - private: - const ValueMatcher value_matcher_; - GTEST_DISALLOW_ASSIGN_(OptionalMatcher); -}; - -namespace variant_matcher { -// Overloads to allow VariantMatcher to do proper ADL lookup. -template <typename T> -void holds_alternative() {} -template <typename T> -void get() {} - -// Implements a matcher that checks the value of a variant<> type variable. -template <typename T> -class VariantMatcher { - public: - explicit VariantMatcher(::testing::Matcher<const T&> matcher) - : matcher_(std::move(matcher)) {} - - template <typename Variant> - bool MatchAndExplain(const Variant& value, - ::testing::MatchResultListener* listener) const { - using std::get; - if (!listener->IsInterested()) { - return holds_alternative<T>(value) && matcher_.Matches(get<T>(value)); - } - - if (!holds_alternative<T>(value)) { - *listener << "whose value is not of type '" << GetTypeName() << "'"; - return false; - } - - const T& elem = get<T>(value); - StringMatchResultListener elem_listener; - const bool match = matcher_.MatchAndExplain(elem, &elem_listener); - *listener << "whose value " << PrintToString(elem) - << (match ? " matches" : " doesn't match"); - PrintIfNotEmpty(elem_listener.str(), listener->stream()); - return match; - } - - void DescribeTo(std::ostream* os) const { - *os << "is a variant<> with value of type '" << GetTypeName() - << "' and the value "; - matcher_.DescribeTo(os); - } - - void DescribeNegationTo(std::ostream* os) const { - *os << "is a variant<> with value of type other than '" << GetTypeName() - << "' or the value "; - matcher_.DescribeNegationTo(os); - } - - private: - static std::string GetTypeName() { -#if GTEST_HAS_RTTI - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_( - return internal::GetTypeName<T>()); -#endif - return "the element type"; - } - - const ::testing::Matcher<const T&> matcher_; -}; - -} // namespace variant_matcher - -namespace any_cast_matcher { - -// Overloads to allow AnyCastMatcher to do proper ADL lookup. -template <typename T> -void any_cast() {} - -// Implements a matcher that any_casts the value. -template <typename T> -class AnyCastMatcher { - public: - explicit AnyCastMatcher(const ::testing::Matcher<const T&>& matcher) - : matcher_(matcher) {} - - template <typename AnyType> - bool MatchAndExplain(const AnyType& value, - ::testing::MatchResultListener* listener) const { - if (!listener->IsInterested()) { - const T* ptr = any_cast<T>(&value); - return ptr != nullptr && matcher_.Matches(*ptr); - } - - const T* elem = any_cast<T>(&value); - if (elem == nullptr) { - *listener << "whose value is not of type '" << GetTypeName() << "'"; - return false; - } - - StringMatchResultListener elem_listener; - const bool match = matcher_.MatchAndExplain(*elem, &elem_listener); - *listener << "whose value " << PrintToString(*elem) - << (match ? " matches" : " doesn't match"); - PrintIfNotEmpty(elem_listener.str(), listener->stream()); - return match; - } - - void DescribeTo(std::ostream* os) const { - *os << "is an 'any' type with value of type '" << GetTypeName() - << "' and the value "; - matcher_.DescribeTo(os); - } - - void DescribeNegationTo(std::ostream* os) const { - *os << "is an 'any' type with value of type other than '" << GetTypeName() - << "' or the value "; - matcher_.DescribeNegationTo(os); - } - - private: - static std::string GetTypeName() { -#if GTEST_HAS_RTTI - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_( - return internal::GetTypeName<T>()); -#endif - return "the element type"; - } - - const ::testing::Matcher<const T&> matcher_; -}; - -} // namespace any_cast_matcher - -// Implements the Args() matcher. -template <class ArgsTuple, size_t... k> -class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> { - public: - using RawArgsTuple = typename std::decay<ArgsTuple>::type; - using SelectedArgs = - std::tuple<typename std::tuple_element<k, RawArgsTuple>::type...>; - using MonomorphicInnerMatcher = Matcher<const SelectedArgs&>; - - template <typename InnerMatcher> - explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher) - : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(inner_matcher)) {} - - bool MatchAndExplain(ArgsTuple args, - MatchResultListener* listener) const override { - // Workaround spurious C4100 on MSVC<=15.7 when k is empty. - (void)args; - const SelectedArgs& selected_args = - std::forward_as_tuple(std::get<k>(args)...); - if (!listener->IsInterested()) return inner_matcher_.Matches(selected_args); - - PrintIndices(listener->stream()); - *listener << "are " << PrintToString(selected_args); - - StringMatchResultListener inner_listener; - const bool match = - inner_matcher_.MatchAndExplain(selected_args, &inner_listener); - PrintIfNotEmpty(inner_listener.str(), listener->stream()); - return match; - } - - void DescribeTo(::std::ostream* os) const override { - *os << "are a tuple "; - PrintIndices(os); - inner_matcher_.DescribeTo(os); - } - - void DescribeNegationTo(::std::ostream* os) const override { - *os << "are a tuple "; - PrintIndices(os); - inner_matcher_.DescribeNegationTo(os); - } - - private: - // Prints the indices of the selected fields. - static void PrintIndices(::std::ostream* os) { - *os << "whose fields ("; - const char* sep = ""; - // Workaround spurious C4189 on MSVC<=15.7 when k is empty. - (void)sep; - const char* dummy[] = {"", (*os << sep << "#" << k, sep = ", ")...}; - (void)dummy; - *os << ") "; - } - - MonomorphicInnerMatcher inner_matcher_; -}; - -template <class InnerMatcher, size_t... k> -class ArgsMatcher { - public: - explicit ArgsMatcher(InnerMatcher inner_matcher) - : inner_matcher_(std::move(inner_matcher)) {} - - template <typename ArgsTuple> - operator Matcher<ArgsTuple>() const { // NOLINT - return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, k...>(inner_matcher_)); - } - - private: - InnerMatcher inner_matcher_; -}; - -} // namespace internal - -// ElementsAreArray(iterator_first, iterator_last) -// ElementsAreArray(pointer, count) -// ElementsAreArray(array) -// ElementsAreArray(container) -// ElementsAreArray({ e1, e2, ..., en }) -// -// The ElementsAreArray() functions are like ElementsAre(...), except -// that they are given a homogeneous sequence rather than taking each -// element as a function argument. The sequence can be specified as an -// array, a pointer and count, a vector, an initializer list, or an -// STL iterator range. In each of these cases, the underlying sequence -// can be either a sequence of values or a sequence of matchers. -// -// All forms of ElementsAreArray() make a copy of the input matcher sequence. - -template <typename Iter> -inline internal::ElementsAreArrayMatcher< - typename ::std::iterator_traits<Iter>::value_type> -ElementsAreArray(Iter first, Iter last) { - typedef typename ::std::iterator_traits<Iter>::value_type T; - return internal::ElementsAreArrayMatcher<T>(first, last); -} - -template <typename T> -inline internal::ElementsAreArrayMatcher<T> ElementsAreArray( - const T* pointer, size_t count) { - return ElementsAreArray(pointer, pointer + count); -} - -template <typename T, size_t N> -inline internal::ElementsAreArrayMatcher<T> ElementsAreArray( - const T (&array)[N]) { - return ElementsAreArray(array, N); -} - -template <typename Container> -inline internal::ElementsAreArrayMatcher<typename Container::value_type> -ElementsAreArray(const Container& container) { - return ElementsAreArray(container.begin(), container.end()); -} - -template <typename T> -inline internal::ElementsAreArrayMatcher<T> -ElementsAreArray(::std::initializer_list<T> xs) { - return ElementsAreArray(xs.begin(), xs.end()); -} - -// UnorderedElementsAreArray(iterator_first, iterator_last) -// UnorderedElementsAreArray(pointer, count) -// UnorderedElementsAreArray(array) -// UnorderedElementsAreArray(container) -// UnorderedElementsAreArray({ e1, e2, ..., en }) -// -// UnorderedElementsAreArray() verifies that a bijective mapping onto a -// collection of matchers exists. -// -// The matchers can be specified as an array, a pointer and count, a container, -// an initializer list, or an STL iterator range. In each of these cases, the -// underlying matchers can be either values or matchers. - -template <typename Iter> -inline internal::UnorderedElementsAreArrayMatcher< - typename ::std::iterator_traits<Iter>::value_type> -UnorderedElementsAreArray(Iter first, Iter last) { - typedef typename ::std::iterator_traits<Iter>::value_type T; - return internal::UnorderedElementsAreArrayMatcher<T>( - internal::UnorderedMatcherRequire::ExactMatch, first, last); -} - -template <typename T> -inline internal::UnorderedElementsAreArrayMatcher<T> -UnorderedElementsAreArray(const T* pointer, size_t count) { - return UnorderedElementsAreArray(pointer, pointer + count); -} - -template <typename T, size_t N> -inline internal::UnorderedElementsAreArrayMatcher<T> -UnorderedElementsAreArray(const T (&array)[N]) { - return UnorderedElementsAreArray(array, N); -} - -template <typename Container> -inline internal::UnorderedElementsAreArrayMatcher< - typename Container::value_type> -UnorderedElementsAreArray(const Container& container) { - return UnorderedElementsAreArray(container.begin(), container.end()); -} - -template <typename T> -inline internal::UnorderedElementsAreArrayMatcher<T> -UnorderedElementsAreArray(::std::initializer_list<T> xs) { - return UnorderedElementsAreArray(xs.begin(), xs.end()); -} - -// _ is a matcher that matches anything of any type. -// -// This definition is fine as: -// -// 1. The C++ standard permits using the name _ in a namespace that -// is not the global namespace or ::std. -// 2. The AnythingMatcher class has no data member or constructor, -// so it's OK to create global variables of this type. -// 3. c-style has approved of using _ in this case. -const internal::AnythingMatcher _ = {}; -// Creates a matcher that matches any value of the given type T. -template <typename T> -inline Matcher<T> A() { - return Matcher<T>(new internal::AnyMatcherImpl<T>()); -} - -// Creates a matcher that matches any value of the given type T. -template <typename T> -inline Matcher<T> An() { return A<T>(); } - -template <typename T, typename M> -Matcher<T> internal::MatcherCastImpl<T, M>::CastImpl( - const M& value, std::false_type /* convertible_to_matcher */, - std::false_type /* convertible_to_T */) { - return Eq(value); -} - -// Creates a polymorphic matcher that matches any NULL pointer. -inline PolymorphicMatcher<internal::IsNullMatcher > IsNull() { - return MakePolymorphicMatcher(internal::IsNullMatcher()); -} - -// Creates a polymorphic matcher that matches any non-NULL pointer. -// This is convenient as Not(NULL) doesn't compile (the compiler -// thinks that that expression is comparing a pointer with an integer). -inline PolymorphicMatcher<internal::NotNullMatcher > NotNull() { - return MakePolymorphicMatcher(internal::NotNullMatcher()); -} - -// Creates a polymorphic matcher that matches any argument that -// references variable x. -template <typename T> -inline internal::RefMatcher<T&> Ref(T& x) { // NOLINT - return internal::RefMatcher<T&>(x); -} - -// Creates a matcher that matches any double argument approximately -// equal to rhs, where two NANs are considered unequal. -inline internal::FloatingEqMatcher<double> DoubleEq(double rhs) { - return internal::FloatingEqMatcher<double>(rhs, false); -} - -// Creates a matcher that matches any double argument approximately -// equal to rhs, including NaN values when rhs is NaN. -inline internal::FloatingEqMatcher<double> NanSensitiveDoubleEq(double rhs) { - return internal::FloatingEqMatcher<double>(rhs, true); -} - -// Creates a matcher that matches any double argument approximately equal to -// rhs, up to the specified max absolute error bound, where two NANs are -// considered unequal. The max absolute error bound must be non-negative. -inline internal::FloatingEqMatcher<double> DoubleNear( - double rhs, double max_abs_error) { - return internal::FloatingEqMatcher<double>(rhs, false, max_abs_error); -} - -// Creates a matcher that matches any double argument approximately equal to -// rhs, up to the specified max absolute error bound, including NaN values when -// rhs is NaN. The max absolute error bound must be non-negative. -inline internal::FloatingEqMatcher<double> NanSensitiveDoubleNear( - double rhs, double max_abs_error) { - return internal::FloatingEqMatcher<double>(rhs, true, max_abs_error); -} - -// Creates a matcher that matches any float argument approximately -// equal to rhs, where two NANs are considered unequal. -inline internal::FloatingEqMatcher<float> FloatEq(float rhs) { - return internal::FloatingEqMatcher<float>(rhs, false); -} - -// Creates a matcher that matches any float argument approximately -// equal to rhs, including NaN values when rhs is NaN. -inline internal::FloatingEqMatcher<float> NanSensitiveFloatEq(float rhs) { - return internal::FloatingEqMatcher<float>(rhs, true); -} - -// Creates a matcher that matches any float argument approximately equal to -// rhs, up to the specified max absolute error bound, where two NANs are -// considered unequal. The max absolute error bound must be non-negative. -inline internal::FloatingEqMatcher<float> FloatNear( - float rhs, float max_abs_error) { - return internal::FloatingEqMatcher<float>(rhs, false, max_abs_error); -} - -// Creates a matcher that matches any float argument approximately equal to -// rhs, up to the specified max absolute error bound, including NaN values when -// rhs is NaN. The max absolute error bound must be non-negative. -inline internal::FloatingEqMatcher<float> NanSensitiveFloatNear( - float rhs, float max_abs_error) { - return internal::FloatingEqMatcher<float>(rhs, true, max_abs_error); -} - -// Creates a matcher that matches a pointer (raw or smart) that points -// to a value that matches inner_matcher. -template <typename InnerMatcher> -inline internal::PointeeMatcher<InnerMatcher> Pointee( - const InnerMatcher& inner_matcher) { - return internal::PointeeMatcher<InnerMatcher>(inner_matcher); -} - -#if GTEST_HAS_RTTI -// Creates a matcher that matches a pointer or reference that matches -// inner_matcher when dynamic_cast<To> is applied. -// The result of dynamic_cast<To> is forwarded to the inner matcher. -// If To is a pointer and the cast fails, the inner matcher will receive NULL. -// If To is a reference and the cast fails, this matcher returns false -// immediately. -template <typename To> -inline PolymorphicMatcher<internal::WhenDynamicCastToMatcher<To> > -WhenDynamicCastTo(const Matcher<To>& inner_matcher) { - return MakePolymorphicMatcher( - internal::WhenDynamicCastToMatcher<To>(inner_matcher)); -} -#endif // GTEST_HAS_RTTI - -// Creates a matcher that matches an object whose given field matches -// 'matcher'. For example, -// Field(&Foo::number, Ge(5)) -// matches a Foo object x if and only if x.number >= 5. -template <typename Class, typename FieldType, typename FieldMatcher> -inline PolymorphicMatcher< - internal::FieldMatcher<Class, FieldType> > Field( - FieldType Class::*field, const FieldMatcher& matcher) { - return MakePolymorphicMatcher( - internal::FieldMatcher<Class, FieldType>( - field, MatcherCast<const FieldType&>(matcher))); - // The call to MatcherCast() is required for supporting inner - // matchers of compatible types. For example, it allows - // Field(&Foo::bar, m) - // to compile where bar is an int32 and m is a matcher for int64. -} - -// Same as Field() but also takes the name of the field to provide better error -// messages. -template <typename Class, typename FieldType, typename FieldMatcher> -inline PolymorphicMatcher<internal::FieldMatcher<Class, FieldType> > Field( - const std::string& field_name, FieldType Class::*field, - const FieldMatcher& matcher) { - return MakePolymorphicMatcher(internal::FieldMatcher<Class, FieldType>( - field_name, field, MatcherCast<const FieldType&>(matcher))); -} - -// Creates a matcher that matches an object whose given property -// matches 'matcher'. For example, -// Property(&Foo::str, StartsWith("hi")) -// matches a Foo object x if and only if x.str() starts with "hi". -template <typename Class, typename PropertyType, typename PropertyMatcher> -inline PolymorphicMatcher<internal::PropertyMatcher< - Class, PropertyType, PropertyType (Class::*)() const> > -Property(PropertyType (Class::*property)() const, - const PropertyMatcher& matcher) { - return MakePolymorphicMatcher( - internal::PropertyMatcher<Class, PropertyType, - PropertyType (Class::*)() const>( - property, MatcherCast<const PropertyType&>(matcher))); - // The call to MatcherCast() is required for supporting inner - // matchers of compatible types. For example, it allows - // Property(&Foo::bar, m) - // to compile where bar() returns an int32 and m is a matcher for int64. -} - -// Same as Property() above, but also takes the name of the property to provide -// better error messages. -template <typename Class, typename PropertyType, typename PropertyMatcher> -inline PolymorphicMatcher<internal::PropertyMatcher< - Class, PropertyType, PropertyType (Class::*)() const> > -Property(const std::string& property_name, - PropertyType (Class::*property)() const, - const PropertyMatcher& matcher) { - return MakePolymorphicMatcher( - internal::PropertyMatcher<Class, PropertyType, - PropertyType (Class::*)() const>( - property_name, property, MatcherCast<const PropertyType&>(matcher))); -} - -// The same as above but for reference-qualified member functions. -template <typename Class, typename PropertyType, typename PropertyMatcher> -inline PolymorphicMatcher<internal::PropertyMatcher< - Class, PropertyType, PropertyType (Class::*)() const &> > -Property(PropertyType (Class::*property)() const &, - const PropertyMatcher& matcher) { - return MakePolymorphicMatcher( - internal::PropertyMatcher<Class, PropertyType, - PropertyType (Class::*)() const&>( - property, MatcherCast<const PropertyType&>(matcher))); -} - -// Three-argument form for reference-qualified member functions. -template <typename Class, typename PropertyType, typename PropertyMatcher> -inline PolymorphicMatcher<internal::PropertyMatcher< - Class, PropertyType, PropertyType (Class::*)() const &> > -Property(const std::string& property_name, - PropertyType (Class::*property)() const &, - const PropertyMatcher& matcher) { - return MakePolymorphicMatcher( - internal::PropertyMatcher<Class, PropertyType, - PropertyType (Class::*)() const&>( - property_name, property, MatcherCast<const PropertyType&>(matcher))); -} - -// Creates a matcher that matches an object if and only if the result of -// applying a callable to x matches 'matcher'. For example, -// ResultOf(f, StartsWith("hi")) -// matches a Foo object x if and only if f(x) starts with "hi". -// `callable` parameter can be a function, function pointer, or a functor. It is -// required to keep no state affecting the results of the calls on it and make -// no assumptions about how many calls will be made. Any state it keeps must be -// protected from the concurrent access. -template <typename Callable, typename InnerMatcher> -internal::ResultOfMatcher<Callable, InnerMatcher> ResultOf( - Callable callable, InnerMatcher matcher) { - return internal::ResultOfMatcher<Callable, InnerMatcher>( - std::move(callable), std::move(matcher)); -} - -// String matchers. - -// Matches a string equal to str. -inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrEq( - const std::string& str) { - return MakePolymorphicMatcher( - internal::StrEqualityMatcher<std::string>(str, true, true)); -} - -// Matches a string not equal to str. -inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrNe( - const std::string& str) { - return MakePolymorphicMatcher( - internal::StrEqualityMatcher<std::string>(str, false, true)); -} - -// Matches a string equal to str, ignoring case. -inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrCaseEq( - const std::string& str) { - return MakePolymorphicMatcher( - internal::StrEqualityMatcher<std::string>(str, true, false)); -} - -// Matches a string not equal to str, ignoring case. -inline PolymorphicMatcher<internal::StrEqualityMatcher<std::string> > StrCaseNe( - const std::string& str) { - return MakePolymorphicMatcher( - internal::StrEqualityMatcher<std::string>(str, false, false)); -} - -// Creates a matcher that matches any string, std::string, or C string -// that contains the given substring. -inline PolymorphicMatcher<internal::HasSubstrMatcher<std::string> > HasSubstr( - const std::string& substring) { - return MakePolymorphicMatcher( - internal::HasSubstrMatcher<std::string>(substring)); -} - -// Matches a string that starts with 'prefix' (case-sensitive). -inline PolymorphicMatcher<internal::StartsWithMatcher<std::string> > StartsWith( - const std::string& prefix) { - return MakePolymorphicMatcher( - internal::StartsWithMatcher<std::string>(prefix)); -} - -// Matches a string that ends with 'suffix' (case-sensitive). -inline PolymorphicMatcher<internal::EndsWithMatcher<std::string> > EndsWith( - const std::string& suffix) { - return MakePolymorphicMatcher(internal::EndsWithMatcher<std::string>(suffix)); -} - -#if GTEST_HAS_STD_WSTRING -// Wide string matchers. - -// Matches a string equal to str. -inline PolymorphicMatcher<internal::StrEqualityMatcher<std::wstring> > StrEq( - const std::wstring& str) { - return MakePolymorphicMatcher( - internal::StrEqualityMatcher<std::wstring>(str, true, true)); -} - -// Matches a string not equal to str. -inline PolymorphicMatcher<internal::StrEqualityMatcher<std::wstring> > StrNe( - const std::wstring& str) { - return MakePolymorphicMatcher( - internal::StrEqualityMatcher<std::wstring>(str, false, true)); -} - -// Matches a string equal to str, ignoring case. -inline PolymorphicMatcher<internal::StrEqualityMatcher<std::wstring> > -StrCaseEq(const std::wstring& str) { - return MakePolymorphicMatcher( - internal::StrEqualityMatcher<std::wstring>(str, true, false)); -} - -// Matches a string not equal to str, ignoring case. -inline PolymorphicMatcher<internal::StrEqualityMatcher<std::wstring> > -StrCaseNe(const std::wstring& str) { - return MakePolymorphicMatcher( - internal::StrEqualityMatcher<std::wstring>(str, false, false)); -} - -// Creates a matcher that matches any ::wstring, std::wstring, or C wide string -// that contains the given substring. -inline PolymorphicMatcher<internal::HasSubstrMatcher<std::wstring> > HasSubstr( - const std::wstring& substring) { - return MakePolymorphicMatcher( - internal::HasSubstrMatcher<std::wstring>(substring)); -} - -// Matches a string that starts with 'prefix' (case-sensitive). -inline PolymorphicMatcher<internal::StartsWithMatcher<std::wstring> > -StartsWith(const std::wstring& prefix) { - return MakePolymorphicMatcher( - internal::StartsWithMatcher<std::wstring>(prefix)); -} - -// Matches a string that ends with 'suffix' (case-sensitive). -inline PolymorphicMatcher<internal::EndsWithMatcher<std::wstring> > EndsWith( - const std::wstring& suffix) { - return MakePolymorphicMatcher( - internal::EndsWithMatcher<std::wstring>(suffix)); -} - -#endif // GTEST_HAS_STD_WSTRING - -// Creates a polymorphic matcher that matches a 2-tuple where the -// first field == the second field. -inline internal::Eq2Matcher Eq() { return internal::Eq2Matcher(); } - -// Creates a polymorphic matcher that matches a 2-tuple where the -// first field >= the second field. -inline internal::Ge2Matcher Ge() { return internal::Ge2Matcher(); } - -// Creates a polymorphic matcher that matches a 2-tuple where the -// first field > the second field. -inline internal::Gt2Matcher Gt() { return internal::Gt2Matcher(); } - -// Creates a polymorphic matcher that matches a 2-tuple where the -// first field <= the second field. -inline internal::Le2Matcher Le() { return internal::Le2Matcher(); } - -// Creates a polymorphic matcher that matches a 2-tuple where the -// first field < the second field. -inline internal::Lt2Matcher Lt() { return internal::Lt2Matcher(); } - -// Creates a polymorphic matcher that matches a 2-tuple where the -// first field != the second field. -inline internal::Ne2Matcher Ne() { return internal::Ne2Matcher(); } - -// Creates a polymorphic matcher that matches a 2-tuple where -// FloatEq(first field) matches the second field. -inline internal::FloatingEq2Matcher<float> FloatEq() { - return internal::FloatingEq2Matcher<float>(); -} - -// Creates a polymorphic matcher that matches a 2-tuple where -// DoubleEq(first field) matches the second field. -inline internal::FloatingEq2Matcher<double> DoubleEq() { - return internal::FloatingEq2Matcher<double>(); -} - -// Creates a polymorphic matcher that matches a 2-tuple where -// FloatEq(first field) matches the second field with NaN equality. -inline internal::FloatingEq2Matcher<float> NanSensitiveFloatEq() { - return internal::FloatingEq2Matcher<float>(true); -} - -// Creates a polymorphic matcher that matches a 2-tuple where -// DoubleEq(first field) matches the second field with NaN equality. -inline internal::FloatingEq2Matcher<double> NanSensitiveDoubleEq() { - return internal::FloatingEq2Matcher<double>(true); -} - -// Creates a polymorphic matcher that matches a 2-tuple where -// FloatNear(first field, max_abs_error) matches the second field. -inline internal::FloatingEq2Matcher<float> FloatNear(float max_abs_error) { - return internal::FloatingEq2Matcher<float>(max_abs_error); -} - -// Creates a polymorphic matcher that matches a 2-tuple where -// DoubleNear(first field, max_abs_error) matches the second field. -inline internal::FloatingEq2Matcher<double> DoubleNear(double max_abs_error) { - return internal::FloatingEq2Matcher<double>(max_abs_error); -} - -// Creates a polymorphic matcher that matches a 2-tuple where -// FloatNear(first field, max_abs_error) matches the second field with NaN -// equality. -inline internal::FloatingEq2Matcher<float> NanSensitiveFloatNear( - float max_abs_error) { - return internal::FloatingEq2Matcher<float>(max_abs_error, true); -} - -// Creates a polymorphic matcher that matches a 2-tuple where -// DoubleNear(first field, max_abs_error) matches the second field with NaN -// equality. -inline internal::FloatingEq2Matcher<double> NanSensitiveDoubleNear( - double max_abs_error) { - return internal::FloatingEq2Matcher<double>(max_abs_error, true); -} - -// Creates a matcher that matches any value of type T that m doesn't -// match. -template <typename InnerMatcher> -inline internal::NotMatcher<InnerMatcher> Not(InnerMatcher m) { - return internal::NotMatcher<InnerMatcher>(m); -} - -// Returns a matcher that matches anything that satisfies the given -// predicate. The predicate can be any unary function or functor -// whose return type can be implicitly converted to bool. -template <typename Predicate> -inline PolymorphicMatcher<internal::TrulyMatcher<Predicate> > -Truly(Predicate pred) { - return MakePolymorphicMatcher(internal::TrulyMatcher<Predicate>(pred)); -} - -// Returns a matcher that matches the container size. The container must -// support both size() and size_type which all STL-like containers provide. -// Note that the parameter 'size' can be a value of type size_type as well as -// matcher. For instance: -// EXPECT_THAT(container, SizeIs(2)); // Checks container has 2 elements. -// EXPECT_THAT(container, SizeIs(Le(2)); // Checks container has at most 2. -template <typename SizeMatcher> -inline internal::SizeIsMatcher<SizeMatcher> -SizeIs(const SizeMatcher& size_matcher) { - return internal::SizeIsMatcher<SizeMatcher>(size_matcher); -} - -// Returns a matcher that matches the distance between the container's begin() -// iterator and its end() iterator, i.e. the size of the container. This matcher -// can be used instead of SizeIs with containers such as std::forward_list which -// do not implement size(). The container must provide const_iterator (with -// valid iterator_traits), begin() and end(). -template <typename DistanceMatcher> -inline internal::BeginEndDistanceIsMatcher<DistanceMatcher> -BeginEndDistanceIs(const DistanceMatcher& distance_matcher) { - return internal::BeginEndDistanceIsMatcher<DistanceMatcher>(distance_matcher); -} - -// Returns a matcher that matches an equal container. -// This matcher behaves like Eq(), but in the event of mismatch lists the -// values that are included in one container but not the other. (Duplicate -// values and order differences are not explained.) -template <typename Container> -inline PolymorphicMatcher<internal::ContainerEqMatcher< - typename std::remove_const<Container>::type>> -ContainerEq(const Container& rhs) { - // This following line is for working around a bug in MSVC 8.0, - // which causes Container to be a const type sometimes. - typedef typename std::remove_const<Container>::type RawContainer; - return MakePolymorphicMatcher( - internal::ContainerEqMatcher<RawContainer>(rhs)); -} - -// Returns a matcher that matches a container that, when sorted using -// the given comparator, matches container_matcher. -template <typename Comparator, typename ContainerMatcher> -inline internal::WhenSortedByMatcher<Comparator, ContainerMatcher> -WhenSortedBy(const Comparator& comparator, - const ContainerMatcher& container_matcher) { - return internal::WhenSortedByMatcher<Comparator, ContainerMatcher>( - comparator, container_matcher); -} - -// Returns a matcher that matches a container that, when sorted using -// the < operator, matches container_matcher. -template <typename ContainerMatcher> -inline internal::WhenSortedByMatcher<internal::LessComparator, ContainerMatcher> -WhenSorted(const ContainerMatcher& container_matcher) { - return - internal::WhenSortedByMatcher<internal::LessComparator, ContainerMatcher>( - internal::LessComparator(), container_matcher); -} - -// Matches an STL-style container or a native array that contains the -// same number of elements as in rhs, where its i-th element and rhs's -// i-th element (as a pair) satisfy the given pair matcher, for all i. -// TupleMatcher must be able to be safely cast to Matcher<std::tuple<const -// T1&, const T2&> >, where T1 and T2 are the types of elements in the -// LHS container and the RHS container respectively. -template <typename TupleMatcher, typename Container> -inline internal::PointwiseMatcher<TupleMatcher, - typename std::remove_const<Container>::type> -Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) { - // This following line is for working around a bug in MSVC 8.0, - // which causes Container to be a const type sometimes (e.g. when - // rhs is a const int[]).. - typedef typename std::remove_const<Container>::type RawContainer; - return internal::PointwiseMatcher<TupleMatcher, RawContainer>( - tuple_matcher, rhs); -} - - -// Supports the Pointwise(m, {a, b, c}) syntax. -template <typename TupleMatcher, typename T> -inline internal::PointwiseMatcher<TupleMatcher, std::vector<T> > Pointwise( - const TupleMatcher& tuple_matcher, std::initializer_list<T> rhs) { - return Pointwise(tuple_matcher, std::vector<T>(rhs)); -} - - -// UnorderedPointwise(pair_matcher, rhs) matches an STL-style -// container or a native array that contains the same number of -// elements as in rhs, where in some permutation of the container, its -// i-th element and rhs's i-th element (as a pair) satisfy the given -// pair matcher, for all i. Tuple2Matcher must be able to be safely -// cast to Matcher<std::tuple<const T1&, const T2&> >, where T1 and T2 are -// the types of elements in the LHS container and the RHS container -// respectively. -// -// This is like Pointwise(pair_matcher, rhs), except that the element -// order doesn't matter. -template <typename Tuple2Matcher, typename RhsContainer> -inline internal::UnorderedElementsAreArrayMatcher< - typename internal::BoundSecondMatcher< - Tuple2Matcher, - typename internal::StlContainerView< - typename std::remove_const<RhsContainer>::type>::type::value_type>> -UnorderedPointwise(const Tuple2Matcher& tuple2_matcher, - const RhsContainer& rhs_container) { - // This following line is for working around a bug in MSVC 8.0, - // which causes RhsContainer to be a const type sometimes (e.g. when - // rhs_container is a const int[]). - typedef typename std::remove_const<RhsContainer>::type RawRhsContainer; - - // RhsView allows the same code to handle RhsContainer being a - // STL-style container and it being a native C-style array. - typedef typename internal::StlContainerView<RawRhsContainer> RhsView; - typedef typename RhsView::type RhsStlContainer; - typedef typename RhsStlContainer::value_type Second; - const RhsStlContainer& rhs_stl_container = - RhsView::ConstReference(rhs_container); - - // Create a matcher for each element in rhs_container. - ::std::vector<internal::BoundSecondMatcher<Tuple2Matcher, Second> > matchers; - for (typename RhsStlContainer::const_iterator it = rhs_stl_container.begin(); - it != rhs_stl_container.end(); ++it) { - matchers.push_back( - internal::MatcherBindSecond(tuple2_matcher, *it)); - } - - // Delegate the work to UnorderedElementsAreArray(). - return UnorderedElementsAreArray(matchers); -} - - -// Supports the UnorderedPointwise(m, {a, b, c}) syntax. -template <typename Tuple2Matcher, typename T> -inline internal::UnorderedElementsAreArrayMatcher< - typename internal::BoundSecondMatcher<Tuple2Matcher, T> > -UnorderedPointwise(const Tuple2Matcher& tuple2_matcher, - std::initializer_list<T> rhs) { - return UnorderedPointwise(tuple2_matcher, std::vector<T>(rhs)); -} - - -// Matches an STL-style container or a native array that contains at -// least one element matching the given value or matcher. -// -// Examples: -// ::std::set<int> page_ids; -// page_ids.insert(3); -// page_ids.insert(1); -// EXPECT_THAT(page_ids, Contains(1)); -// EXPECT_THAT(page_ids, Contains(Gt(2))); -// EXPECT_THAT(page_ids, Not(Contains(4))); -// -// ::std::map<int, size_t> page_lengths; -// page_lengths[1] = 100; -// EXPECT_THAT(page_lengths, -// Contains(::std::pair<const int, size_t>(1, 100))); -// -// const char* user_ids[] = { "joe", "mike", "tom" }; -// EXPECT_THAT(user_ids, Contains(Eq(::std::string("tom")))); -template <typename M> -inline internal::ContainsMatcher<M> Contains(M matcher) { - return internal::ContainsMatcher<M>(matcher); -} - -// IsSupersetOf(iterator_first, iterator_last) -// IsSupersetOf(pointer, count) -// IsSupersetOf(array) -// IsSupersetOf(container) -// IsSupersetOf({e1, e2, ..., en}) -// -// IsSupersetOf() verifies that a surjective partial mapping onto a collection -// of matchers exists. In other words, a container matches -// IsSupersetOf({e1, ..., en}) if and only if there is a permutation -// {y1, ..., yn} of some of the container's elements where y1 matches e1, -// ..., and yn matches en. Obviously, the size of the container must be >= n -// in order to have a match. Examples: -// -// - {1, 2, 3} matches IsSupersetOf({Ge(3), Ne(0)}), as 3 matches Ge(3) and -// 1 matches Ne(0). -// - {1, 2} doesn't match IsSupersetOf({Eq(1), Lt(2)}), even though 1 matches -// both Eq(1) and Lt(2). The reason is that different matchers must be used -// for elements in different slots of the container. -// - {1, 1, 2} matches IsSupersetOf({Eq(1), Lt(2)}), as (the first) 1 matches -// Eq(1) and (the second) 1 matches Lt(2). -// - {1, 2, 3} matches IsSupersetOf(Gt(1), Gt(1)), as 2 matches (the first) -// Gt(1) and 3 matches (the second) Gt(1). -// -// The matchers can be specified as an array, a pointer and count, a container, -// an initializer list, or an STL iterator range. In each of these cases, the -// underlying matchers can be either values or matchers. - -template <typename Iter> -inline internal::UnorderedElementsAreArrayMatcher< - typename ::std::iterator_traits<Iter>::value_type> -IsSupersetOf(Iter first, Iter last) { - typedef typename ::std::iterator_traits<Iter>::value_type T; - return internal::UnorderedElementsAreArrayMatcher<T>( - internal::UnorderedMatcherRequire::Superset, first, last); -} - -template <typename T> -inline internal::UnorderedElementsAreArrayMatcher<T> IsSupersetOf( - const T* pointer, size_t count) { - return IsSupersetOf(pointer, pointer + count); -} - -template <typename T, size_t N> -inline internal::UnorderedElementsAreArrayMatcher<T> IsSupersetOf( - const T (&array)[N]) { - return IsSupersetOf(array, N); -} - -template <typename Container> -inline internal::UnorderedElementsAreArrayMatcher< - typename Container::value_type> -IsSupersetOf(const Container& container) { - return IsSupersetOf(container.begin(), container.end()); -} - -template <typename T> -inline internal::UnorderedElementsAreArrayMatcher<T> IsSupersetOf( - ::std::initializer_list<T> xs) { - return IsSupersetOf(xs.begin(), xs.end()); -} - -// IsSubsetOf(iterator_first, iterator_last) -// IsSubsetOf(pointer, count) -// IsSubsetOf(array) -// IsSubsetOf(container) -// IsSubsetOf({e1, e2, ..., en}) -// -// IsSubsetOf() verifies that an injective mapping onto a collection of matchers -// exists. In other words, a container matches IsSubsetOf({e1, ..., en}) if and -// only if there is a subset of matchers {m1, ..., mk} which would match the -// container using UnorderedElementsAre. Obviously, the size of the container -// must be <= n in order to have a match. Examples: -// -// - {1} matches IsSubsetOf({Gt(0), Lt(0)}), as 1 matches Gt(0). -// - {1, -1} matches IsSubsetOf({Lt(0), Gt(0)}), as 1 matches Gt(0) and -1 -// matches Lt(0). -// - {1, 2} doesn't matches IsSubsetOf({Gt(0), Lt(0)}), even though 1 and 2 both -// match Gt(0). The reason is that different matchers must be used for -// elements in different slots of the container. -// -// The matchers can be specified as an array, a pointer and count, a container, -// an initializer list, or an STL iterator range. In each of these cases, the -// underlying matchers can be either values or matchers. - -template <typename Iter> -inline internal::UnorderedElementsAreArrayMatcher< - typename ::std::iterator_traits<Iter>::value_type> -IsSubsetOf(Iter first, Iter last) { - typedef typename ::std::iterator_traits<Iter>::value_type T; - return internal::UnorderedElementsAreArrayMatcher<T>( - internal::UnorderedMatcherRequire::Subset, first, last); -} - -template <typename T> -inline internal::UnorderedElementsAreArrayMatcher<T> IsSubsetOf( - const T* pointer, size_t count) { - return IsSubsetOf(pointer, pointer + count); -} - -template <typename T, size_t N> -inline internal::UnorderedElementsAreArrayMatcher<T> IsSubsetOf( - const T (&array)[N]) { - return IsSubsetOf(array, N); -} - -template <typename Container> -inline internal::UnorderedElementsAreArrayMatcher< - typename Container::value_type> -IsSubsetOf(const Container& container) { - return IsSubsetOf(container.begin(), container.end()); -} - -template <typename T> -inline internal::UnorderedElementsAreArrayMatcher<T> IsSubsetOf( - ::std::initializer_list<T> xs) { - return IsSubsetOf(xs.begin(), xs.end()); -} - -// Matches an STL-style container or a native array that contains only -// elements matching the given value or matcher. -// -// Each(m) is semantically equivalent to Not(Contains(Not(m))). Only -// the messages are different. -// -// Examples: -// ::std::set<int> page_ids; -// // Each(m) matches an empty container, regardless of what m is. -// EXPECT_THAT(page_ids, Each(Eq(1))); -// EXPECT_THAT(page_ids, Each(Eq(77))); -// -// page_ids.insert(3); -// EXPECT_THAT(page_ids, Each(Gt(0))); -// EXPECT_THAT(page_ids, Not(Each(Gt(4)))); -// page_ids.insert(1); -// EXPECT_THAT(page_ids, Not(Each(Lt(2)))); -// -// ::std::map<int, size_t> page_lengths; -// page_lengths[1] = 100; -// page_lengths[2] = 200; -// page_lengths[3] = 300; -// EXPECT_THAT(page_lengths, Not(Each(Pair(1, 100)))); -// EXPECT_THAT(page_lengths, Each(Key(Le(3)))); -// -// const char* user_ids[] = { "joe", "mike", "tom" }; -// EXPECT_THAT(user_ids, Not(Each(Eq(::std::string("tom"))))); -template <typename M> -inline internal::EachMatcher<M> Each(M matcher) { - return internal::EachMatcher<M>(matcher); -} - -// Key(inner_matcher) matches an std::pair whose 'first' field matches -// inner_matcher. For example, Contains(Key(Ge(5))) can be used to match an -// std::map that contains at least one element whose key is >= 5. -template <typename M> -inline internal::KeyMatcher<M> Key(M inner_matcher) { - return internal::KeyMatcher<M>(inner_matcher); -} - -// Pair(first_matcher, second_matcher) matches a std::pair whose 'first' field -// matches first_matcher and whose 'second' field matches second_matcher. For -// example, EXPECT_THAT(map_type, ElementsAre(Pair(Ge(5), "foo"))) can be used -// to match a std::map<int, string> that contains exactly one element whose key -// is >= 5 and whose value equals "foo". -template <typename FirstMatcher, typename SecondMatcher> -inline internal::PairMatcher<FirstMatcher, SecondMatcher> -Pair(FirstMatcher first_matcher, SecondMatcher second_matcher) { - return internal::PairMatcher<FirstMatcher, SecondMatcher>( - first_matcher, second_matcher); -} - -// Returns a predicate that is satisfied by anything that matches the -// given matcher. -template <typename M> -inline internal::MatcherAsPredicate<M> Matches(M matcher) { - return internal::MatcherAsPredicate<M>(matcher); -} - -// Returns true if and only if the value matches the matcher. -template <typename T, typename M> -inline bool Value(const T& value, M matcher) { - return testing::Matches(matcher)(value); -} - -// Matches the value against the given matcher and explains the match -// result to listener. -template <typename T, typename M> -inline bool ExplainMatchResult( - M matcher, const T& value, MatchResultListener* listener) { - return SafeMatcherCast<const T&>(matcher).MatchAndExplain(value, listener); -} - -// Returns a string representation of the given matcher. Useful for description -// strings of matchers defined using MATCHER_P* macros that accept matchers as -// their arguments. For example: -// -// MATCHER_P(XAndYThat, matcher, -// "X that " + DescribeMatcher<int>(matcher, negation) + -// " and Y that " + DescribeMatcher<double>(matcher, negation)) { -// return ExplainMatchResult(matcher, arg.x(), result_listener) && -// ExplainMatchResult(matcher, arg.y(), result_listener); -// } -template <typename T, typename M> -std::string DescribeMatcher(const M& matcher, bool negation = false) { - ::std::stringstream ss; - Matcher<T> monomorphic_matcher = SafeMatcherCast<T>(matcher); - if (negation) { - monomorphic_matcher.DescribeNegationTo(&ss); - } else { - monomorphic_matcher.DescribeTo(&ss); - } - return ss.str(); -} - -template <typename... Args> -internal::ElementsAreMatcher< - std::tuple<typename std::decay<const Args&>::type...>> -ElementsAre(const Args&... matchers) { - return internal::ElementsAreMatcher< - std::tuple<typename std::decay<const Args&>::type...>>( - std::make_tuple(matchers...)); -} - -template <typename... Args> -internal::UnorderedElementsAreMatcher< - std::tuple<typename std::decay<const Args&>::type...>> -UnorderedElementsAre(const Args&... matchers) { - return internal::UnorderedElementsAreMatcher< - std::tuple<typename std::decay<const Args&>::type...>>( - std::make_tuple(matchers...)); -} - -// Define variadic matcher versions. -template <typename... Args> -internal::AllOfMatcher<typename std::decay<const Args&>::type...> AllOf( - const Args&... matchers) { - return internal::AllOfMatcher<typename std::decay<const Args&>::type...>( - matchers...); -} - -template <typename... Args> -internal::AnyOfMatcher<typename std::decay<const Args&>::type...> AnyOf( - const Args&... matchers) { - return internal::AnyOfMatcher<typename std::decay<const Args&>::type...>( - matchers...); -} - -// AnyOfArray(array) -// AnyOfArray(pointer, count) -// AnyOfArray(container) -// AnyOfArray({ e1, e2, ..., en }) -// AnyOfArray(iterator_first, iterator_last) -// -// AnyOfArray() verifies whether a given value matches any member of a -// collection of matchers. -// -// AllOfArray(array) -// AllOfArray(pointer, count) -// AllOfArray(container) -// AllOfArray({ e1, e2, ..., en }) -// AllOfArray(iterator_first, iterator_last) -// -// AllOfArray() verifies whether a given value matches all members of a -// collection of matchers. -// -// The matchers can be specified as an array, a pointer and count, a container, -// an initializer list, or an STL iterator range. In each of these cases, the -// underlying matchers can be either values or matchers. - -template <typename Iter> -inline internal::AnyOfArrayMatcher< - typename ::std::iterator_traits<Iter>::value_type> -AnyOfArray(Iter first, Iter last) { - return internal::AnyOfArrayMatcher< - typename ::std::iterator_traits<Iter>::value_type>(first, last); -} - -template <typename Iter> -inline internal::AllOfArrayMatcher< - typename ::std::iterator_traits<Iter>::value_type> -AllOfArray(Iter first, Iter last) { - return internal::AllOfArrayMatcher< - typename ::std::iterator_traits<Iter>::value_type>(first, last); -} - -template <typename T> -inline internal::AnyOfArrayMatcher<T> AnyOfArray(const T* ptr, size_t count) { - return AnyOfArray(ptr, ptr + count); -} - -template <typename T> -inline internal::AllOfArrayMatcher<T> AllOfArray(const T* ptr, size_t count) { - return AllOfArray(ptr, ptr + count); -} - -template <typename T, size_t N> -inline internal::AnyOfArrayMatcher<T> AnyOfArray(const T (&array)[N]) { - return AnyOfArray(array, N); -} - -template <typename T, size_t N> -inline internal::AllOfArrayMatcher<T> AllOfArray(const T (&array)[N]) { - return AllOfArray(array, N); -} - -template <typename Container> -inline internal::AnyOfArrayMatcher<typename Container::value_type> AnyOfArray( - const Container& container) { - return AnyOfArray(container.begin(), container.end()); -} - -template <typename Container> -inline internal::AllOfArrayMatcher<typename Container::value_type> AllOfArray( - const Container& container) { - return AllOfArray(container.begin(), container.end()); -} - -template <typename T> -inline internal::AnyOfArrayMatcher<T> AnyOfArray( - ::std::initializer_list<T> xs) { - return AnyOfArray(xs.begin(), xs.end()); -} - -template <typename T> -inline internal::AllOfArrayMatcher<T> AllOfArray( - ::std::initializer_list<T> xs) { - return AllOfArray(xs.begin(), xs.end()); -} - -// Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected -// fields of it matches a_matcher. C++ doesn't support default -// arguments for function templates, so we have to overload it. -template <size_t... k, typename InnerMatcher> -internal::ArgsMatcher<typename std::decay<InnerMatcher>::type, k...> Args( - InnerMatcher&& matcher) { - return internal::ArgsMatcher<typename std::decay<InnerMatcher>::type, k...>( - std::forward<InnerMatcher>(matcher)); -} - -// AllArgs(m) is a synonym of m. This is useful in -// -// EXPECT_CALL(foo, Bar(_, _)).With(AllArgs(Eq())); -// -// which is easier to read than -// -// EXPECT_CALL(foo, Bar(_, _)).With(Eq()); -template <typename InnerMatcher> -inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; } - -// Returns a matcher that matches the value of an optional<> type variable. -// The matcher implementation only uses '!arg' and requires that the optional<> -// type has a 'value_type' member type and that '*arg' is of type 'value_type' -// and is printable using 'PrintToString'. It is compatible with -// std::optional/std::experimental::optional. -// Note that to compare an optional type variable against nullopt you should -// use Eq(nullopt) and not Optional(Eq(nullopt)). The latter implies that the -// optional value contains an optional itself. -template <typename ValueMatcher> -inline internal::OptionalMatcher<ValueMatcher> Optional( - const ValueMatcher& value_matcher) { - return internal::OptionalMatcher<ValueMatcher>(value_matcher); -} - -// Returns a matcher that matches the value of a absl::any type variable. -template <typename T> -PolymorphicMatcher<internal::any_cast_matcher::AnyCastMatcher<T> > AnyWith( - const Matcher<const T&>& matcher) { - return MakePolymorphicMatcher( - internal::any_cast_matcher::AnyCastMatcher<T>(matcher)); -} - -// Returns a matcher that matches the value of a variant<> type variable. -// The matcher implementation uses ADL to find the holds_alternative and get -// functions. -// It is compatible with std::variant. -template <typename T> -PolymorphicMatcher<internal::variant_matcher::VariantMatcher<T> > VariantWith( - const Matcher<const T&>& matcher) { - return MakePolymorphicMatcher( - internal::variant_matcher::VariantMatcher<T>(matcher)); -} - -// These macros allow using matchers to check values in Google Test -// tests. ASSERT_THAT(value, matcher) and EXPECT_THAT(value, matcher) -// succeed if and only if the value matches the matcher. If the assertion -// fails, the value and the description of the matcher will be printed. -#define ASSERT_THAT(value, matcher) ASSERT_PRED_FORMAT1(\ - ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) -#define EXPECT_THAT(value, matcher) EXPECT_PRED_FORMAT1(\ - ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) - -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 5046 - -// Include any custom callback matchers added by the local installation. -// We must include this header at the end to make sure it can use the -// declarations from this file. -#include "gmock/internal/custom/gmock-matchers.h" - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-more-actions.h b/3rdParty/googletest/googlemock/include/gmock/gmock-more-actions.h deleted file mode 100644 index d42484aef2bca540b98b72b52ef0804bb89a2bd7..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-more-actions.h +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some actions that depend on gmock-generated-actions.h. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ - -#include <algorithm> -#include <type_traits> - -#include "gmock/gmock-generated-actions.h" - -namespace testing { -namespace internal { - -// An internal replacement for std::copy which mimics its behavior. This is -// necessary because Visual Studio deprecates ::std::copy, issuing warning 4996. -// However Visual Studio 2010 and later do not honor #pragmas which disable that -// warning. -template<typename InputIterator, typename OutputIterator> -inline OutputIterator CopyElements(InputIterator first, - InputIterator last, - OutputIterator output) { - for (; first != last; ++first, ++output) { - *output = *first; - } - return output; -} - -} // namespace internal - -// Various overloads for Invoke(). - -// The ACTION*() macros trigger warning C4100 (unreferenced formal -// parameter) in MSVC with -W4. Unfortunately they cannot be fixed in -// the macro definition, as the warnings are generated when the macro -// is expanded and macro expansion cannot contain #pragma. Therefore -// we suppress them here. -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) -#endif - -// Action ReturnArg<k>() returns the k-th argument of the mock function. -ACTION_TEMPLATE(ReturnArg, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_0_VALUE_PARAMS()) { - return ::std::get<k>(args); -} - -// Action SaveArg<k>(pointer) saves the k-th (0-based) argument of the -// mock function to *pointer. -ACTION_TEMPLATE(SaveArg, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_1_VALUE_PARAMS(pointer)) { - *pointer = ::std::get<k>(args); -} - -// Action SaveArgPointee<k>(pointer) saves the value pointed to -// by the k-th (0-based) argument of the mock function to *pointer. -ACTION_TEMPLATE(SaveArgPointee, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_1_VALUE_PARAMS(pointer)) { - *pointer = *::std::get<k>(args); -} - -// Action SetArgReferee<k>(value) assigns 'value' to the variable -// referenced by the k-th (0-based) argument of the mock function. -ACTION_TEMPLATE(SetArgReferee, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_1_VALUE_PARAMS(value)) { - typedef typename ::std::tuple_element<k, args_type>::type argk_type; - // Ensures that argument #k is a reference. If you get a compiler - // error on the next line, you are using SetArgReferee<k>(value) in - // a mock function whose k-th (0-based) argument is not a reference. - GTEST_COMPILE_ASSERT_(std::is_reference<argk_type>::value, - SetArgReferee_must_be_used_with_a_reference_argument); - ::std::get<k>(args) = value; -} - -// Action SetArrayArgument<k>(first, last) copies the elements in -// source range [first, last) to the array pointed to by the k-th -// (0-based) argument, which can be either a pointer or an -// iterator. The action does not take ownership of the elements in the -// source range. -ACTION_TEMPLATE(SetArrayArgument, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_2_VALUE_PARAMS(first, last)) { - // Visual Studio deprecates ::std::copy, so we use our own copy in that case. -#ifdef _MSC_VER - internal::CopyElements(first, last, ::std::get<k>(args)); -#else - ::std::copy(first, last, ::std::get<k>(args)); -#endif -} - -// Action DeleteArg<k>() deletes the k-th (0-based) argument of the mock -// function. -ACTION_TEMPLATE(DeleteArg, - HAS_1_TEMPLATE_PARAMS(int, k), - AND_0_VALUE_PARAMS()) { - delete ::std::get<k>(args); -} - -// This action returns the value pointed to by 'pointer'. -ACTION_P(ReturnPointee, pointer) { return *pointer; } - -// Action Throw(exception) can be used in a mock function of any type -// to throw the given exception. Any copyable value can be thrown. -#if GTEST_HAS_EXCEPTIONS - -// Suppresses the 'unreachable code' warning that VC generates in opt modes. -# ifdef _MSC_VER -# pragma warning(push) // Saves the current warning state. -# pragma warning(disable:4702) // Temporarily disables warning 4702. -# endif -ACTION_P(Throw, exception) { throw exception; } -# ifdef _MSC_VER -# pragma warning(pop) // Restores the warning state. -# endif - -#endif // GTEST_HAS_EXCEPTIONS - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-more-matchers.h b/3rdParty/googletest/googlemock/include/gmock/gmock-more-matchers.h deleted file mode 100644 index 1c9a399a341e79ee0102c674a75a269bd2552ec2..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-more-matchers.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2013, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements some matchers that depend on gmock-generated-matchers.h. -// -// Note that tests are implemented in gmock-matchers_test.cc rather than -// gmock-more-matchers-test.cc. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_ -#define GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_ - -#include "gmock/gmock-generated-matchers.h" - -namespace testing { - -// Silence C4100 (unreferenced formal -// parameter) for MSVC -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) -#if (_MSC_VER == 1900) -// and silence C4800 (C4800: 'int *const ': forcing value -// to bool 'true' or 'false') for MSVC 14 -# pragma warning(disable:4800) - #endif -#endif - -// Defines a matcher that matches an empty container. The container must -// support both size() and empty(), which all STL-like containers provide. -MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") { - if (arg.empty()) { - return true; - } - *result_listener << "whose size is " << arg.size(); - return false; -} - -// Define a matcher that matches a value that evaluates in boolean -// context to true. Useful for types that define "explicit operator -// bool" operators and so can't be compared for equality with true -// and false. -MATCHER(IsTrue, negation ? "is false" : "is true") { - return static_cast<bool>(arg); -} - -// Define a matcher that matches a value that evaluates in boolean -// context to false. Useful for types that define "explicit operator -// bool" operators and so can't be compared for equality with true -// and false. -MATCHER(IsFalse, negation ? "is true" : "is false") { - return !static_cast<bool>(arg); -} - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - - -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-nice-strict.h b/3rdParty/googletest/googlemock/include/gmock/gmock-nice-strict.h deleted file mode 100644 index 5495a9805b5fade1998f5d3b7d43a7ed3a99b9dd..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-nice-strict.h +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Implements class templates NiceMock, NaggyMock, and StrictMock. -// -// Given a mock class MockFoo that is created using Google Mock, -// NiceMock<MockFoo> is a subclass of MockFoo that allows -// uninteresting calls (i.e. calls to mock methods that have no -// EXPECT_CALL specs), NaggyMock<MockFoo> is a subclass of MockFoo -// that prints a warning when an uninteresting call occurs, and -// StrictMock<MockFoo> is a subclass of MockFoo that treats all -// uninteresting calls as errors. -// -// Currently a mock is naggy by default, so MockFoo and -// NaggyMock<MockFoo> behave like the same. However, we will soon -// switch the default behavior of mocks to be nice, as that in general -// leads to more maintainable tests. When that happens, MockFoo will -// stop behaving like NaggyMock<MockFoo> and start behaving like -// NiceMock<MockFoo>. -// -// NiceMock, NaggyMock, and StrictMock "inherit" the constructors of -// their respective base class. Therefore you can write -// NiceMock<MockFoo>(5, "a") to construct a nice mock where MockFoo -// has a constructor that accepts (int, const char*), for example. -// -// A known limitation is that NiceMock<MockFoo>, NaggyMock<MockFoo>, -// and StrictMock<MockFoo> only works for mock methods defined using -// the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class. -// If a mock method is defined in a base class of MockFoo, the "nice" -// or "strict" modifier may not affect it, depending on the compiler. -// In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT -// supported. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_ - -#include "gmock/gmock-spec-builders.h" -#include "gmock/internal/gmock-port.h" - -namespace testing { - -template <class MockClass> -class NiceMock : public MockClass { - public: - NiceMock() : MockClass() { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_<MockClass*>(this)); - } - - // Ideally, we would inherit base class's constructors through a using - // declaration, which would preserve their visibility. However, many existing - // tests rely on the fact that current implementation reexports protected - // constructors as public. These tests would need to be cleaned up first. - - // Single argument constructor is special-cased so that it can be - // made explicit. - template <typename A> - explicit NiceMock(A&& arg) : MockClass(std::forward<A>(arg)) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_<MockClass*>(this)); - } - - template <typename A1, typename A2, typename... An> - NiceMock(A1&& arg1, A2&& arg2, An&&... args) - : MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2), - std::forward<An>(args)...) { - ::testing::Mock::AllowUninterestingCalls( - internal::ImplicitCast_<MockClass*>(this)); - } - - ~NiceMock() { // NOLINT - ::testing::Mock::UnregisterCallReaction( - internal::ImplicitCast_<MockClass*>(this)); - } - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(NiceMock); -}; - -template <class MockClass> -class NaggyMock : public MockClass { - public: - NaggyMock() : MockClass() { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_<MockClass*>(this)); - } - - // Ideally, we would inherit base class's constructors through a using - // declaration, which would preserve their visibility. However, many existing - // tests rely on the fact that current implementation reexports protected - // constructors as public. These tests would need to be cleaned up first. - - // Single argument constructor is special-cased so that it can be - // made explicit. - template <typename A> - explicit NaggyMock(A&& arg) : MockClass(std::forward<A>(arg)) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_<MockClass*>(this)); - } - - template <typename A1, typename A2, typename... An> - NaggyMock(A1&& arg1, A2&& arg2, An&&... args) - : MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2), - std::forward<An>(args)...) { - ::testing::Mock::WarnUninterestingCalls( - internal::ImplicitCast_<MockClass*>(this)); - } - - ~NaggyMock() { // NOLINT - ::testing::Mock::UnregisterCallReaction( - internal::ImplicitCast_<MockClass*>(this)); - } - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(NaggyMock); -}; - -template <class MockClass> -class StrictMock : public MockClass { - public: - StrictMock() : MockClass() { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_<MockClass*>(this)); - } - - // Ideally, we would inherit base class's constructors through a using - // declaration, which would preserve their visibility. However, many existing - // tests rely on the fact that current implementation reexports protected - // constructors as public. These tests would need to be cleaned up first. - - // Single argument constructor is special-cased so that it can be - // made explicit. - template <typename A> - explicit StrictMock(A&& arg) : MockClass(std::forward<A>(arg)) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_<MockClass*>(this)); - } - - template <typename A1, typename A2, typename... An> - StrictMock(A1&& arg1, A2&& arg2, An&&... args) - : MockClass(std::forward<A1>(arg1), std::forward<A2>(arg2), - std::forward<An>(args)...) { - ::testing::Mock::FailUninterestingCalls( - internal::ImplicitCast_<MockClass*>(this)); - } - - ~StrictMock() { // NOLINT - ::testing::Mock::UnregisterCallReaction( - internal::ImplicitCast_<MockClass*>(this)); - } - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(StrictMock); -}; - -// The following specializations catch some (relatively more common) -// user errors of nesting nice and strict mocks. They do NOT catch -// all possible errors. - -// These specializations are declared but not defined, as NiceMock, -// NaggyMock, and StrictMock cannot be nested. - -template <typename MockClass> -class NiceMock<NiceMock<MockClass> >; -template <typename MockClass> -class NiceMock<NaggyMock<MockClass> >; -template <typename MockClass> -class NiceMock<StrictMock<MockClass> >; - -template <typename MockClass> -class NaggyMock<NiceMock<MockClass> >; -template <typename MockClass> -class NaggyMock<NaggyMock<MockClass> >; -template <typename MockClass> -class NaggyMock<StrictMock<MockClass> >; - -template <typename MockClass> -class StrictMock<NiceMock<MockClass> >; -template <typename MockClass> -class StrictMock<NaggyMock<MockClass> >; -template <typename MockClass> -class StrictMock<StrictMock<MockClass> >; - -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_NICE_STRICT_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock-spec-builders.h b/3rdParty/googletest/googlemock/include/gmock/gmock-spec-builders.h deleted file mode 100644 index 80c13b554921ae5e4b8ea220efe5765300751123..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock-spec-builders.h +++ /dev/null @@ -1,1985 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements the ON_CALL() and EXPECT_CALL() macros. -// -// A user can use the ON_CALL() macro to specify the default action of -// a mock method. The syntax is: -// -// ON_CALL(mock_object, Method(argument-matchers)) -// .With(multi-argument-matcher) -// .WillByDefault(action); -// -// where the .With() clause is optional. -// -// A user can use the EXPECT_CALL() macro to specify an expectation on -// a mock method. The syntax is: -// -// EXPECT_CALL(mock_object, Method(argument-matchers)) -// .With(multi-argument-matchers) -// .Times(cardinality) -// .InSequence(sequences) -// .After(expectations) -// .WillOnce(action) -// .WillRepeatedly(action) -// .RetiresOnSaturation(); -// -// where all clauses are optional, and .InSequence()/.After()/ -// .WillOnce() can appear any number of times. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ - -#include <functional> -#include <map> -#include <memory> -#include <set> -#include <sstream> -#include <string> -#include <type_traits> -#include <utility> -#include <vector> -#include "gmock/gmock-actions.h" -#include "gmock/gmock-cardinalities.h" -#include "gmock/gmock-matchers.h" -#include "gmock/internal/gmock-internal-utils.h" -#include "gmock/internal/gmock-port.h" -#include "gtest/gtest.h" - -#if GTEST_HAS_EXCEPTIONS -# include <stdexcept> // NOLINT -#endif - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -namespace testing { - -// An abstract handle of an expectation. -class Expectation; - -// A set of expectation handles. -class ExpectationSet; - -// Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION -// and MUST NOT BE USED IN USER CODE!!! -namespace internal { - -// Implements a mock function. -template <typename F> class FunctionMocker; - -// Base class for expectations. -class ExpectationBase; - -// Implements an expectation. -template <typename F> class TypedExpectation; - -// Helper class for testing the Expectation class template. -class ExpectationTester; - -// Protects the mock object registry (in class Mock), all function -// mockers, and all expectations. -// -// The reason we don't use more fine-grained protection is: when a -// mock function Foo() is called, it needs to consult its expectations -// to see which one should be picked. If another thread is allowed to -// call a mock function (either Foo() or a different one) at the same -// time, it could affect the "retired" attributes of Foo()'s -// expectations when InSequence() is used, and thus affect which -// expectation gets picked. Therefore, we sequence all mock function -// calls to ensure the integrity of the mock objects' states. -GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex); - -// Untyped base class for ActionResultHolder<R>. -class UntypedActionResultHolderBase; - -// Abstract base class of FunctionMocker. This is the -// type-agnostic part of the function mocker interface. Its pure -// virtual methods are implemented by FunctionMocker. -class GTEST_API_ UntypedFunctionMockerBase { - public: - UntypedFunctionMockerBase(); - virtual ~UntypedFunctionMockerBase(); - - // Verifies that all expectations on this mock function have been - // satisfied. Reports one or more Google Test non-fatal failures - // and returns false if not. - bool VerifyAndClearExpectationsLocked() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); - - // Clears the ON_CALL()s set on this mock function. - virtual void ClearDefaultActionsLocked() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) = 0; - - // In all of the following Untyped* functions, it's the caller's - // responsibility to guarantee the correctness of the arguments' - // types. - - // Performs the default action with the given arguments and returns - // the action's result. The call description string will be used in - // the error message to describe the call in the case the default - // action fails. - // L = * - virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction( - void* untyped_args, const std::string& call_description) const = 0; - - // Performs the given action with the given arguments and returns - // the action's result. - // L = * - virtual UntypedActionResultHolderBase* UntypedPerformAction( - const void* untyped_action, void* untyped_args) const = 0; - - // Writes a message that the call is uninteresting (i.e. neither - // explicitly expected nor explicitly unexpected) to the given - // ostream. - virtual void UntypedDescribeUninterestingCall( - const void* untyped_args, - ::std::ostream* os) const - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0; - - // Returns the expectation that matches the given function arguments - // (or NULL is there's no match); when a match is found, - // untyped_action is set to point to the action that should be - // performed (or NULL if the action is "do default"), and - // is_excessive is modified to indicate whether the call exceeds the - // expected number. - virtual const ExpectationBase* UntypedFindMatchingExpectation( - const void* untyped_args, - const void** untyped_action, bool* is_excessive, - ::std::ostream* what, ::std::ostream* why) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) = 0; - - // Prints the given function arguments to the ostream. - virtual void UntypedPrintArgs(const void* untyped_args, - ::std::ostream* os) const = 0; - - // Sets the mock object this mock method belongs to, and registers - // this information in the global mock registry. Will be called - // whenever an EXPECT_CALL() or ON_CALL() is executed on this mock - // method. - void RegisterOwner(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex); - - // Sets the mock object this mock method belongs to, and sets the - // name of the mock function. Will be called upon each invocation - // of this mock function. - void SetOwnerAndName(const void* mock_obj, const char* name) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex); - - // Returns the mock object this mock method belongs to. Must be - // called after RegisterOwner() or SetOwnerAndName() has been - // called. - const void* MockObject() const - GTEST_LOCK_EXCLUDED_(g_gmock_mutex); - - // Returns the name of this mock method. Must be called after - // SetOwnerAndName() has been called. - const char* Name() const - GTEST_LOCK_EXCLUDED_(g_gmock_mutex); - - // Returns the result of invoking this mock function with the given - // arguments. This function can be safely called from multiple - // threads concurrently. The caller is responsible for deleting the - // result. - UntypedActionResultHolderBase* UntypedInvokeWith(void* untyped_args) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex); - - protected: - typedef std::vector<const void*> UntypedOnCallSpecs; - - using UntypedExpectations = std::vector<std::shared_ptr<ExpectationBase>>; - - // Returns an Expectation object that references and co-owns exp, - // which must be an expectation on this mock function. - Expectation GetHandleOf(ExpectationBase* exp); - - // Address of the mock object this mock method belongs to. Only - // valid after this mock method has been called or - // ON_CALL/EXPECT_CALL has been invoked on it. - const void* mock_obj_; // Protected by g_gmock_mutex. - - // Name of the function being mocked. Only valid after this mock - // method has been called. - const char* name_; // Protected by g_gmock_mutex. - - // All default action specs for this function mocker. - UntypedOnCallSpecs untyped_on_call_specs_; - - // All expectations for this function mocker. - // - // It's undefined behavior to interleave expectations (EXPECT_CALLs - // or ON_CALLs) and mock function calls. Also, the order of - // expectations is important. Therefore it's a logic race condition - // to read/write untyped_expectations_ concurrently. In order for - // tools like tsan to catch concurrent read/write accesses to - // untyped_expectations, we deliberately leave accesses to it - // unprotected. - UntypedExpectations untyped_expectations_; -}; // class UntypedFunctionMockerBase - -// Untyped base class for OnCallSpec<F>. -class UntypedOnCallSpecBase { - public: - // The arguments are the location of the ON_CALL() statement. - UntypedOnCallSpecBase(const char* a_file, int a_line) - : file_(a_file), line_(a_line), last_clause_(kNone) {} - - // Where in the source file was the default action spec defined? - const char* file() const { return file_; } - int line() const { return line_; } - - protected: - // Gives each clause in the ON_CALL() statement a name. - enum Clause { - // Do not change the order of the enum members! The run-time - // syntax checking relies on it. - kNone, - kWith, - kWillByDefault - }; - - // Asserts that the ON_CALL() statement has a certain property. - void AssertSpecProperty(bool property, - const std::string& failure_message) const { - Assert(property, file_, line_, failure_message); - } - - // Expects that the ON_CALL() statement has a certain property. - void ExpectSpecProperty(bool property, - const std::string& failure_message) const { - Expect(property, file_, line_, failure_message); - } - - const char* file_; - int line_; - - // The last clause in the ON_CALL() statement as seen so far. - // Initially kNone and changes as the statement is parsed. - Clause last_clause_; -}; // class UntypedOnCallSpecBase - -// This template class implements an ON_CALL spec. -template <typename F> -class OnCallSpec : public UntypedOnCallSpecBase { - public: - typedef typename Function<F>::ArgumentTuple ArgumentTuple; - typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; - - // Constructs an OnCallSpec object from the information inside - // the parenthesis of an ON_CALL() statement. - OnCallSpec(const char* a_file, int a_line, - const ArgumentMatcherTuple& matchers) - : UntypedOnCallSpecBase(a_file, a_line), - matchers_(matchers), - // By default, extra_matcher_ should match anything. However, - // we cannot initialize it with _ as that causes ambiguity between - // Matcher's copy and move constructor for some argument types. - extra_matcher_(A<const ArgumentTuple&>()) {} - - // Implements the .With() clause. - OnCallSpec& With(const Matcher<const ArgumentTuple&>& m) { - // Makes sure this is called at most once. - ExpectSpecProperty(last_clause_ < kWith, - ".With() cannot appear " - "more than once in an ON_CALL()."); - last_clause_ = kWith; - - extra_matcher_ = m; - return *this; - } - - // Implements the .WillByDefault() clause. - OnCallSpec& WillByDefault(const Action<F>& action) { - ExpectSpecProperty(last_clause_ < kWillByDefault, - ".WillByDefault() must appear " - "exactly once in an ON_CALL()."); - last_clause_ = kWillByDefault; - - ExpectSpecProperty(!action.IsDoDefault(), - "DoDefault() cannot be used in ON_CALL()."); - action_ = action; - return *this; - } - - // Returns true if and only if the given arguments match the matchers. - bool Matches(const ArgumentTuple& args) const { - return TupleMatches(matchers_, args) && extra_matcher_.Matches(args); - } - - // Returns the action specified by the user. - const Action<F>& GetAction() const { - AssertSpecProperty(last_clause_ == kWillByDefault, - ".WillByDefault() must appear exactly " - "once in an ON_CALL()."); - return action_; - } - - private: - // The information in statement - // - // ON_CALL(mock_object, Method(matchers)) - // .With(multi-argument-matcher) - // .WillByDefault(action); - // - // is recorded in the data members like this: - // - // source file that contains the statement => file_ - // line number of the statement => line_ - // matchers => matchers_ - // multi-argument-matcher => extra_matcher_ - // action => action_ - ArgumentMatcherTuple matchers_; - Matcher<const ArgumentTuple&> extra_matcher_; - Action<F> action_; -}; // class OnCallSpec - -// Possible reactions on uninteresting calls. -enum CallReaction { - kAllow, - kWarn, - kFail, -}; - -} // namespace internal - -// Utilities for manipulating mock objects. -class GTEST_API_ Mock { - public: - // The following public methods can be called concurrently. - - // Tells Google Mock to ignore mock_obj when checking for leaked - // mock objects. - static void AllowLeak(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - - // Verifies and clears all expectations on the given mock object. - // If the expectations aren't satisfied, generates one or more - // Google Test non-fatal failures and returns false. - static bool VerifyAndClearExpectations(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - - // Verifies all expectations on the given mock object and clears its - // default actions and expectations. Returns true if and only if the - // verification was successful. - static bool VerifyAndClear(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - - // Returns whether the mock was created as a naggy mock (default) - static bool IsNaggy(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - // Returns whether the mock was created as a nice mock - static bool IsNice(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - // Returns whether the mock was created as a strict mock - static bool IsStrict(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - - private: - friend class internal::UntypedFunctionMockerBase; - - // Needed for a function mocker to register itself (so that we know - // how to clear a mock object). - template <typename F> - friend class internal::FunctionMocker; - - template <typename M> - friend class NiceMock; - - template <typename M> - friend class NaggyMock; - - template <typename M> - friend class StrictMock; - - // Tells Google Mock to allow uninteresting calls on the given mock - // object. - static void AllowUninterestingCalls(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - - // Tells Google Mock to warn the user about uninteresting calls on - // the given mock object. - static void WarnUninterestingCalls(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - - // Tells Google Mock to fail uninteresting calls on the given mock - // object. - static void FailUninterestingCalls(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - - // Tells Google Mock the given mock object is being destroyed and - // its entry in the call-reaction table should be removed. - static void UnregisterCallReaction(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - - // Returns the reaction Google Mock will have on uninteresting calls - // made on the given mock object. - static internal::CallReaction GetReactionOnUninterestingCalls( - const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - - // Verifies that all expectations on the given mock object have been - // satisfied. Reports one or more Google Test non-fatal failures - // and returns false if not. - static bool VerifyAndClearExpectationsLocked(void* mock_obj) - GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex); - - // Clears all ON_CALL()s set on the given mock object. - static void ClearDefaultActionsLocked(void* mock_obj) - GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex); - - // Registers a mock object and a mock method it owns. - static void Register( - const void* mock_obj, - internal::UntypedFunctionMockerBase* mocker) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - - // Tells Google Mock where in the source code mock_obj is used in an - // ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this - // information helps the user identify which object it is. - static void RegisterUseByOnCallOrExpectCall( - const void* mock_obj, const char* file, int line) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex); - - // Unregisters a mock method; removes the owning mock object from - // the registry when the last mock method associated with it has - // been unregistered. This is called only in the destructor of - // FunctionMocker. - static void UnregisterLocked(internal::UntypedFunctionMockerBase* mocker) - GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex); -}; // class Mock - -// An abstract handle of an expectation. Useful in the .After() -// clause of EXPECT_CALL() for setting the (partial) order of -// expectations. The syntax: -// -// Expectation e1 = EXPECT_CALL(...)...; -// EXPECT_CALL(...).After(e1)...; -// -// sets two expectations where the latter can only be matched after -// the former has been satisfied. -// -// Notes: -// - This class is copyable and has value semantics. -// - Constness is shallow: a const Expectation object itself cannot -// be modified, but the mutable methods of the ExpectationBase -// object it references can be called via expectation_base(). - -class GTEST_API_ Expectation { - public: - // Constructs a null object that doesn't reference any expectation. - Expectation(); - - ~Expectation(); - - // This single-argument ctor must not be explicit, in order to support the - // Expectation e = EXPECT_CALL(...); - // syntax. - // - // A TypedExpectation object stores its pre-requisites as - // Expectation objects, and needs to call the non-const Retire() - // method on the ExpectationBase objects they reference. Therefore - // Expectation must receive a *non-const* reference to the - // ExpectationBase object. - Expectation(internal::ExpectationBase& exp); // NOLINT - - // The compiler-generated copy ctor and operator= work exactly as - // intended, so we don't need to define our own. - - // Returns true if and only if rhs references the same expectation as this - // object does. - bool operator==(const Expectation& rhs) const { - return expectation_base_ == rhs.expectation_base_; - } - - bool operator!=(const Expectation& rhs) const { return !(*this == rhs); } - - private: - friend class ExpectationSet; - friend class Sequence; - friend class ::testing::internal::ExpectationBase; - friend class ::testing::internal::UntypedFunctionMockerBase; - - template <typename F> - friend class ::testing::internal::FunctionMocker; - - template <typename F> - friend class ::testing::internal::TypedExpectation; - - // This comparator is needed for putting Expectation objects into a set. - class Less { - public: - bool operator()(const Expectation& lhs, const Expectation& rhs) const { - return lhs.expectation_base_.get() < rhs.expectation_base_.get(); - } - }; - - typedef ::std::set<Expectation, Less> Set; - - Expectation( - const std::shared_ptr<internal::ExpectationBase>& expectation_base); - - // Returns the expectation this object references. - const std::shared_ptr<internal::ExpectationBase>& expectation_base() const { - return expectation_base_; - } - - // A shared_ptr that co-owns the expectation this handle references. - std::shared_ptr<internal::ExpectationBase> expectation_base_; -}; - -// A set of expectation handles. Useful in the .After() clause of -// EXPECT_CALL() for setting the (partial) order of expectations. The -// syntax: -// -// ExpectationSet es; -// es += EXPECT_CALL(...)...; -// es += EXPECT_CALL(...)...; -// EXPECT_CALL(...).After(es)...; -// -// sets three expectations where the last one can only be matched -// after the first two have both been satisfied. -// -// This class is copyable and has value semantics. -class ExpectationSet { - public: - // A bidirectional iterator that can read a const element in the set. - typedef Expectation::Set::const_iterator const_iterator; - - // An object stored in the set. This is an alias of Expectation. - typedef Expectation::Set::value_type value_type; - - // Constructs an empty set. - ExpectationSet() {} - - // This single-argument ctor must not be explicit, in order to support the - // ExpectationSet es = EXPECT_CALL(...); - // syntax. - ExpectationSet(internal::ExpectationBase& exp) { // NOLINT - *this += Expectation(exp); - } - - // This single-argument ctor implements implicit conversion from - // Expectation and thus must not be explicit. This allows either an - // Expectation or an ExpectationSet to be used in .After(). - ExpectationSet(const Expectation& e) { // NOLINT - *this += e; - } - - // The compiler-generator ctor and operator= works exactly as - // intended, so we don't need to define our own. - - // Returns true if and only if rhs contains the same set of Expectation - // objects as this does. - bool operator==(const ExpectationSet& rhs) const { - return expectations_ == rhs.expectations_; - } - - bool operator!=(const ExpectationSet& rhs) const { return !(*this == rhs); } - - // Implements the syntax - // expectation_set += EXPECT_CALL(...); - ExpectationSet& operator+=(const Expectation& e) { - expectations_.insert(e); - return *this; - } - - int size() const { return static_cast<int>(expectations_.size()); } - - const_iterator begin() const { return expectations_.begin(); } - const_iterator end() const { return expectations_.end(); } - - private: - Expectation::Set expectations_; -}; - - -// Sequence objects are used by a user to specify the relative order -// in which the expectations should match. They are copyable (we rely -// on the compiler-defined copy constructor and assignment operator). -class GTEST_API_ Sequence { - public: - // Constructs an empty sequence. - Sequence() : last_expectation_(new Expectation) {} - - // Adds an expectation to this sequence. The caller must ensure - // that no other thread is accessing this Sequence object. - void AddExpectation(const Expectation& expectation) const; - - private: - // The last expectation in this sequence. - std::shared_ptr<Expectation> last_expectation_; -}; // class Sequence - -// An object of this type causes all EXPECT_CALL() statements -// encountered in its scope to be put in an anonymous sequence. The -// work is done in the constructor and destructor. You should only -// create an InSequence object on the stack. -// -// The sole purpose for this class is to support easy definition of -// sequential expectations, e.g. -// -// { -// InSequence dummy; // The name of the object doesn't matter. -// -// // The following expectations must match in the order they appear. -// EXPECT_CALL(a, Bar())...; -// EXPECT_CALL(a, Baz())...; -// ... -// EXPECT_CALL(b, Xyz())...; -// } -// -// You can create InSequence objects in multiple threads, as long as -// they are used to affect different mock objects. The idea is that -// each thread can create and set up its own mocks as if it's the only -// thread. However, for clarity of your tests we recommend you to set -// up mocks in the main thread unless you have a good reason not to do -// so. -class GTEST_API_ InSequence { - public: - InSequence(); - ~InSequence(); - private: - bool sequence_created_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); // NOLINT -} GTEST_ATTRIBUTE_UNUSED_; - -namespace internal { - -// Points to the implicit sequence introduced by a living InSequence -// object (if any) in the current thread or NULL. -GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence; - -// Base class for implementing expectations. -// -// There are two reasons for having a type-agnostic base class for -// Expectation: -// -// 1. We need to store collections of expectations of different -// types (e.g. all pre-requisites of a particular expectation, all -// expectations in a sequence). Therefore these expectation objects -// must share a common base class. -// -// 2. We can avoid binary code bloat by moving methods not depending -// on the template argument of Expectation to the base class. -// -// This class is internal and mustn't be used by user code directly. -class GTEST_API_ ExpectationBase { - public: - // source_text is the EXPECT_CALL(...) source that created this Expectation. - ExpectationBase(const char* file, int line, const std::string& source_text); - - virtual ~ExpectationBase(); - - // Where in the source file was the expectation spec defined? - const char* file() const { return file_; } - int line() const { return line_; } - const char* source_text() const { return source_text_.c_str(); } - // Returns the cardinality specified in the expectation spec. - const Cardinality& cardinality() const { return cardinality_; } - - // Describes the source file location of this expectation. - void DescribeLocationTo(::std::ostream* os) const { - *os << FormatFileLocation(file(), line()) << " "; - } - - // Describes how many times a function call matching this - // expectation has occurred. - void DescribeCallCountTo(::std::ostream* os) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); - - // If this mock method has an extra matcher (i.e. .With(matcher)), - // describes it to the ostream. - virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) = 0; - - protected: - friend class ::testing::Expectation; - friend class UntypedFunctionMockerBase; - - enum Clause { - // Don't change the order of the enum members! - kNone, - kWith, - kTimes, - kInSequence, - kAfter, - kWillOnce, - kWillRepeatedly, - kRetiresOnSaturation - }; - - typedef std::vector<const void*> UntypedActions; - - // Returns an Expectation object that references and co-owns this - // expectation. - virtual Expectation GetHandle() = 0; - - // Asserts that the EXPECT_CALL() statement has the given property. - void AssertSpecProperty(bool property, - const std::string& failure_message) const { - Assert(property, file_, line_, failure_message); - } - - // Expects that the EXPECT_CALL() statement has the given property. - void ExpectSpecProperty(bool property, - const std::string& failure_message) const { - Expect(property, file_, line_, failure_message); - } - - // Explicitly specifies the cardinality of this expectation. Used - // by the subclasses to implement the .Times() clause. - void SpecifyCardinality(const Cardinality& cardinality); - - // Returns true if and only if the user specified the cardinality - // explicitly using a .Times(). - bool cardinality_specified() const { return cardinality_specified_; } - - // Sets the cardinality of this expectation spec. - void set_cardinality(const Cardinality& a_cardinality) { - cardinality_ = a_cardinality; - } - - // The following group of methods should only be called after the - // EXPECT_CALL() statement, and only when g_gmock_mutex is held by - // the current thread. - - // Retires all pre-requisites of this expectation. - void RetireAllPreRequisites() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); - - // Returns true if and only if this expectation is retired. - bool is_retired() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - return retired_; - } - - // Retires this expectation. - void Retire() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - retired_ = true; - } - - // Returns true if and only if this expectation is satisfied. - bool IsSatisfied() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - return cardinality().IsSatisfiedByCallCount(call_count_); - } - - // Returns true if and only if this expectation is saturated. - bool IsSaturated() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - return cardinality().IsSaturatedByCallCount(call_count_); - } - - // Returns true if and only if this expectation is over-saturated. - bool IsOverSaturated() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - return cardinality().IsOverSaturatedByCallCount(call_count_); - } - - // Returns true if and only if all pre-requisites of this expectation are - // satisfied. - bool AllPrerequisitesAreSatisfied() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); - - // Adds unsatisfied pre-requisites of this expectation to 'result'. - void FindUnsatisfiedPrerequisites(ExpectationSet* result) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex); - - // Returns the number this expectation has been invoked. - int call_count() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - return call_count_; - } - - // Increments the number this expectation has been invoked. - void IncrementCallCount() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - call_count_++; - } - - // Checks the action count (i.e. the number of WillOnce() and - // WillRepeatedly() clauses) against the cardinality if this hasn't - // been done before. Prints a warning if there are too many or too - // few actions. - void CheckActionCountIfNotDone() const - GTEST_LOCK_EXCLUDED_(mutex_); - - friend class ::testing::Sequence; - friend class ::testing::internal::ExpectationTester; - - template <typename Function> - friend class TypedExpectation; - - // Implements the .Times() clause. - void UntypedTimes(const Cardinality& a_cardinality); - - // This group of fields are part of the spec and won't change after - // an EXPECT_CALL() statement finishes. - const char* file_; // The file that contains the expectation. - int line_; // The line number of the expectation. - const std::string source_text_; // The EXPECT_CALL(...) source text. - // True if and only if the cardinality is specified explicitly. - bool cardinality_specified_; - Cardinality cardinality_; // The cardinality of the expectation. - // The immediate pre-requisites (i.e. expectations that must be - // satisfied before this expectation can be matched) of this - // expectation. We use std::shared_ptr in the set because we want an - // Expectation object to be co-owned by its FunctionMocker and its - // successors. This allows multiple mock objects to be deleted at - // different times. - ExpectationSet immediate_prerequisites_; - - // This group of fields are the current state of the expectation, - // and can change as the mock function is called. - int call_count_; // How many times this expectation has been invoked. - bool retired_; // True if and only if this expectation has retired. - UntypedActions untyped_actions_; - bool extra_matcher_specified_; - bool repeated_action_specified_; // True if a WillRepeatedly() was specified. - bool retires_on_saturation_; - Clause last_clause_; - mutable bool action_count_checked_; // Under mutex_. - mutable Mutex mutex_; // Protects action_count_checked_. - - GTEST_DISALLOW_ASSIGN_(ExpectationBase); -}; // class ExpectationBase - -// Impements an expectation for the given function type. -template <typename F> -class TypedExpectation : public ExpectationBase { - public: - typedef typename Function<F>::ArgumentTuple ArgumentTuple; - typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; - typedef typename Function<F>::Result Result; - - TypedExpectation(FunctionMocker<F>* owner, const char* a_file, int a_line, - const std::string& a_source_text, - const ArgumentMatcherTuple& m) - : ExpectationBase(a_file, a_line, a_source_text), - owner_(owner), - matchers_(m), - // By default, extra_matcher_ should match anything. However, - // we cannot initialize it with _ as that causes ambiguity between - // Matcher's copy and move constructor for some argument types. - extra_matcher_(A<const ArgumentTuple&>()), - repeated_action_(DoDefault()) {} - - ~TypedExpectation() override { - // Check the validity of the action count if it hasn't been done - // yet (for example, if the expectation was never used). - CheckActionCountIfNotDone(); - for (UntypedActions::const_iterator it = untyped_actions_.begin(); - it != untyped_actions_.end(); ++it) { - delete static_cast<const Action<F>*>(*it); - } - } - - // Implements the .With() clause. - TypedExpectation& With(const Matcher<const ArgumentTuple&>& m) { - if (last_clause_ == kWith) { - ExpectSpecProperty(false, - ".With() cannot appear " - "more than once in an EXPECT_CALL()."); - } else { - ExpectSpecProperty(last_clause_ < kWith, - ".With() must be the first " - "clause in an EXPECT_CALL()."); - } - last_clause_ = kWith; - - extra_matcher_ = m; - extra_matcher_specified_ = true; - return *this; - } - - // Implements the .Times() clause. - TypedExpectation& Times(const Cardinality& a_cardinality) { - ExpectationBase::UntypedTimes(a_cardinality); - return *this; - } - - // Implements the .Times() clause. - TypedExpectation& Times(int n) { - return Times(Exactly(n)); - } - - // Implements the .InSequence() clause. - TypedExpectation& InSequence(const Sequence& s) { - ExpectSpecProperty(last_clause_ <= kInSequence, - ".InSequence() cannot appear after .After()," - " .WillOnce(), .WillRepeatedly(), or " - ".RetiresOnSaturation()."); - last_clause_ = kInSequence; - - s.AddExpectation(GetHandle()); - return *this; - } - TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2) { - return InSequence(s1).InSequence(s2); - } - TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2, - const Sequence& s3) { - return InSequence(s1, s2).InSequence(s3); - } - TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2, - const Sequence& s3, const Sequence& s4) { - return InSequence(s1, s2, s3).InSequence(s4); - } - TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2, - const Sequence& s3, const Sequence& s4, - const Sequence& s5) { - return InSequence(s1, s2, s3, s4).InSequence(s5); - } - - // Implements that .After() clause. - TypedExpectation& After(const ExpectationSet& s) { - ExpectSpecProperty(last_clause_ <= kAfter, - ".After() cannot appear after .WillOnce()," - " .WillRepeatedly(), or " - ".RetiresOnSaturation()."); - last_clause_ = kAfter; - - for (ExpectationSet::const_iterator it = s.begin(); it != s.end(); ++it) { - immediate_prerequisites_ += *it; - } - return *this; - } - TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2) { - return After(s1).After(s2); - } - TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2, - const ExpectationSet& s3) { - return After(s1, s2).After(s3); - } - TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2, - const ExpectationSet& s3, const ExpectationSet& s4) { - return After(s1, s2, s3).After(s4); - } - TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s2, - const ExpectationSet& s3, const ExpectationSet& s4, - const ExpectationSet& s5) { - return After(s1, s2, s3, s4).After(s5); - } - - // Implements the .WillOnce() clause. - TypedExpectation& WillOnce(const Action<F>& action) { - ExpectSpecProperty(last_clause_ <= kWillOnce, - ".WillOnce() cannot appear after " - ".WillRepeatedly() or .RetiresOnSaturation()."); - last_clause_ = kWillOnce; - - untyped_actions_.push_back(new Action<F>(action)); - if (!cardinality_specified()) { - set_cardinality(Exactly(static_cast<int>(untyped_actions_.size()))); - } - return *this; - } - - // Implements the .WillRepeatedly() clause. - TypedExpectation& WillRepeatedly(const Action<F>& action) { - if (last_clause_ == kWillRepeatedly) { - ExpectSpecProperty(false, - ".WillRepeatedly() cannot appear " - "more than once in an EXPECT_CALL()."); - } else { - ExpectSpecProperty(last_clause_ < kWillRepeatedly, - ".WillRepeatedly() cannot appear " - "after .RetiresOnSaturation()."); - } - last_clause_ = kWillRepeatedly; - repeated_action_specified_ = true; - - repeated_action_ = action; - if (!cardinality_specified()) { - set_cardinality(AtLeast(static_cast<int>(untyped_actions_.size()))); - } - - // Now that no more action clauses can be specified, we check - // whether their count makes sense. - CheckActionCountIfNotDone(); - return *this; - } - - // Implements the .RetiresOnSaturation() clause. - TypedExpectation& RetiresOnSaturation() { - ExpectSpecProperty(last_clause_ < kRetiresOnSaturation, - ".RetiresOnSaturation() cannot appear " - "more than once."); - last_clause_ = kRetiresOnSaturation; - retires_on_saturation_ = true; - - // Now that no more action clauses can be specified, we check - // whether their count makes sense. - CheckActionCountIfNotDone(); - return *this; - } - - // Returns the matchers for the arguments as specified inside the - // EXPECT_CALL() macro. - const ArgumentMatcherTuple& matchers() const { - return matchers_; - } - - // Returns the matcher specified by the .With() clause. - const Matcher<const ArgumentTuple&>& extra_matcher() const { - return extra_matcher_; - } - - // Returns the action specified by the .WillRepeatedly() clause. - const Action<F>& repeated_action() const { return repeated_action_; } - - // If this mock method has an extra matcher (i.e. .With(matcher)), - // describes it to the ostream. - void MaybeDescribeExtraMatcherTo(::std::ostream* os) override { - if (extra_matcher_specified_) { - *os << " Expected args: "; - extra_matcher_.DescribeTo(os); - *os << "\n"; - } - } - - private: - template <typename Function> - friend class FunctionMocker; - - // Returns an Expectation object that references and co-owns this - // expectation. - Expectation GetHandle() override { return owner_->GetHandleOf(this); } - - // The following methods will be called only after the EXPECT_CALL() - // statement finishes and when the current thread holds - // g_gmock_mutex. - - // Returns true if and only if this expectation matches the given arguments. - bool Matches(const ArgumentTuple& args) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - return TupleMatches(matchers_, args) && extra_matcher_.Matches(args); - } - - // Returns true if and only if this expectation should handle the given - // arguments. - bool ShouldHandleArguments(const ArgumentTuple& args) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - - // In case the action count wasn't checked when the expectation - // was defined (e.g. if this expectation has no WillRepeatedly() - // or RetiresOnSaturation() clause), we check it when the - // expectation is used for the first time. - CheckActionCountIfNotDone(); - return !is_retired() && AllPrerequisitesAreSatisfied() && Matches(args); - } - - // Describes the result of matching the arguments against this - // expectation to the given ostream. - void ExplainMatchResultTo( - const ArgumentTuple& args, - ::std::ostream* os) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - - if (is_retired()) { - *os << " Expected: the expectation is active\n" - << " Actual: it is retired\n"; - } else if (!Matches(args)) { - if (!TupleMatches(matchers_, args)) { - ExplainMatchFailureTupleTo(matchers_, args, os); - } - StringMatchResultListener listener; - if (!extra_matcher_.MatchAndExplain(args, &listener)) { - *os << " Expected args: "; - extra_matcher_.DescribeTo(os); - *os << "\n Actual: don't match"; - - internal::PrintIfNotEmpty(listener.str(), os); - *os << "\n"; - } - } else if (!AllPrerequisitesAreSatisfied()) { - *os << " Expected: all pre-requisites are satisfied\n" - << " Actual: the following immediate pre-requisites " - << "are not satisfied:\n"; - ExpectationSet unsatisfied_prereqs; - FindUnsatisfiedPrerequisites(&unsatisfied_prereqs); - int i = 0; - for (ExpectationSet::const_iterator it = unsatisfied_prereqs.begin(); - it != unsatisfied_prereqs.end(); ++it) { - it->expectation_base()->DescribeLocationTo(os); - *os << "pre-requisite #" << i++ << "\n"; - } - *os << " (end of pre-requisites)\n"; - } else { - // This line is here just for completeness' sake. It will never - // be executed as currently the ExplainMatchResultTo() function - // is called only when the mock function call does NOT match the - // expectation. - *os << "The call matches the expectation.\n"; - } - } - - // Returns the action that should be taken for the current invocation. - const Action<F>& GetCurrentAction(const FunctionMocker<F>* mocker, - const ArgumentTuple& args) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - const int count = call_count(); - Assert(count >= 1, __FILE__, __LINE__, - "call_count() is <= 0 when GetCurrentAction() is " - "called - this should never happen."); - - const int action_count = static_cast<int>(untyped_actions_.size()); - if (action_count > 0 && !repeated_action_specified_ && - count > action_count) { - // If there is at least one WillOnce() and no WillRepeatedly(), - // we warn the user when the WillOnce() clauses ran out. - ::std::stringstream ss; - DescribeLocationTo(&ss); - ss << "Actions ran out in " << source_text() << "...\n" - << "Called " << count << " times, but only " - << action_count << " WillOnce()" - << (action_count == 1 ? " is" : "s are") << " specified - "; - mocker->DescribeDefaultActionTo(args, &ss); - Log(kWarning, ss.str(), 1); - } - - return count <= action_count - ? *static_cast<const Action<F>*>( - untyped_actions_[static_cast<size_t>(count - 1)]) - : repeated_action(); - } - - // Given the arguments of a mock function call, if the call will - // over-saturate this expectation, returns the default action; - // otherwise, returns the next action in this expectation. Also - // describes *what* happened to 'what', and explains *why* Google - // Mock does it to 'why'. This method is not const as it calls - // IncrementCallCount(). A return value of NULL means the default - // action. - const Action<F>* GetActionForArguments(const FunctionMocker<F>* mocker, - const ArgumentTuple& args, - ::std::ostream* what, - ::std::ostream* why) - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - if (IsSaturated()) { - // We have an excessive call. - IncrementCallCount(); - *what << "Mock function called more times than expected - "; - mocker->DescribeDefaultActionTo(args, what); - DescribeCallCountTo(why); - - return nullptr; - } - - IncrementCallCount(); - RetireAllPreRequisites(); - - if (retires_on_saturation_ && IsSaturated()) { - Retire(); - } - - // Must be done after IncrementCount()! - *what << "Mock function call matches " << source_text() <<"...\n"; - return &(GetCurrentAction(mocker, args)); - } - - // All the fields below won't change once the EXPECT_CALL() - // statement finishes. - FunctionMocker<F>* const owner_; - ArgumentMatcherTuple matchers_; - Matcher<const ArgumentTuple&> extra_matcher_; - Action<F> repeated_action_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(TypedExpectation); -}; // class TypedExpectation - -// A MockSpec object is used by ON_CALL() or EXPECT_CALL() for -// specifying the default behavior of, or expectation on, a mock -// function. - -// Note: class MockSpec really belongs to the ::testing namespace. -// However if we define it in ::testing, MSVC will complain when -// classes in ::testing::internal declare it as a friend class -// template. To workaround this compiler bug, we define MockSpec in -// ::testing::internal and import it into ::testing. - -// Logs a message including file and line number information. -GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity, - const char* file, int line, - const std::string& message); - -template <typename F> -class MockSpec { - public: - typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; - typedef typename internal::Function<F>::ArgumentMatcherTuple - ArgumentMatcherTuple; - - // Constructs a MockSpec object, given the function mocker object - // that the spec is associated with. - MockSpec(internal::FunctionMocker<F>* function_mocker, - const ArgumentMatcherTuple& matchers) - : function_mocker_(function_mocker), matchers_(matchers) {} - - // Adds a new default action spec to the function mocker and returns - // the newly created spec. - internal::OnCallSpec<F>& InternalDefaultActionSetAt( - const char* file, int line, const char* obj, const char* call) { - LogWithLocation(internal::kInfo, file, line, - std::string("ON_CALL(") + obj + ", " + call + ") invoked"); - return function_mocker_->AddNewOnCallSpec(file, line, matchers_); - } - - // Adds a new expectation spec to the function mocker and returns - // the newly created spec. - internal::TypedExpectation<F>& InternalExpectedAt( - const char* file, int line, const char* obj, const char* call) { - const std::string source_text(std::string("EXPECT_CALL(") + obj + ", " + - call + ")"); - LogWithLocation(internal::kInfo, file, line, source_text + " invoked"); - return function_mocker_->AddNewExpectation( - file, line, source_text, matchers_); - } - - // This operator overload is used to swallow the superfluous parameter list - // introduced by the ON/EXPECT_CALL macros. See the macro comments for more - // explanation. - MockSpec<F>& operator()(const internal::WithoutMatchers&, void* const) { - return *this; - } - - private: - template <typename Function> - friend class internal::FunctionMocker; - - // The function mocker that owns this spec. - internal::FunctionMocker<F>* const function_mocker_; - // The argument matchers specified in the spec. - ArgumentMatcherTuple matchers_; - - GTEST_DISALLOW_ASSIGN_(MockSpec); -}; // class MockSpec - -// Wrapper type for generically holding an ordinary value or lvalue reference. -// If T is not a reference type, it must be copyable or movable. -// ReferenceOrValueWrapper<T> is movable, and will also be copyable unless -// T is a move-only value type (which means that it will always be copyable -// if the current platform does not support move semantics). -// -// The primary template defines handling for values, but function header -// comments describe the contract for the whole template (including -// specializations). -template <typename T> -class ReferenceOrValueWrapper { - public: - // Constructs a wrapper from the given value/reference. - explicit ReferenceOrValueWrapper(T value) - : value_(std::move(value)) { - } - - // Unwraps and returns the underlying value/reference, exactly as - // originally passed. The behavior of calling this more than once on - // the same object is unspecified. - T Unwrap() { return std::move(value_); } - - // Provides nondestructive access to the underlying value/reference. - // Always returns a const reference (more precisely, - // const std::add_lvalue_reference<T>::type). The behavior of calling this - // after calling Unwrap on the same object is unspecified. - const T& Peek() const { - return value_; - } - - private: - T value_; -}; - -// Specialization for lvalue reference types. See primary template -// for documentation. -template <typename T> -class ReferenceOrValueWrapper<T&> { - public: - // Workaround for debatable pass-by-reference lint warning (c-library-team - // policy precludes NOLINT in this context) - typedef T& reference; - explicit ReferenceOrValueWrapper(reference ref) - : value_ptr_(&ref) {} - T& Unwrap() { return *value_ptr_; } - const T& Peek() const { return *value_ptr_; } - - private: - T* value_ptr_; -}; - -// MSVC warns about using 'this' in base member initializer list, so -// we need to temporarily disable the warning. We have to do it for -// the entire class to suppress the warning, even though it's about -// the constructor only. -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355) - -// C++ treats the void type specially. For example, you cannot define -// a void-typed variable or pass a void value to a function. -// ActionResultHolder<T> holds a value of type T, where T must be a -// copyable type or void (T doesn't need to be default-constructable). -// It hides the syntactic difference between void and other types, and -// is used to unify the code for invoking both void-returning and -// non-void-returning mock functions. - -// Untyped base class for ActionResultHolder<T>. -class UntypedActionResultHolderBase { - public: - virtual ~UntypedActionResultHolderBase() {} - - // Prints the held value as an action's result to os. - virtual void PrintAsActionResult(::std::ostream* os) const = 0; -}; - -// This generic definition is used when T is not void. -template <typename T> -class ActionResultHolder : public UntypedActionResultHolderBase { - public: - // Returns the held value. Must not be called more than once. - T Unwrap() { - return result_.Unwrap(); - } - - // Prints the held value as an action's result to os. - void PrintAsActionResult(::std::ostream* os) const override { - *os << "\n Returns: "; - // T may be a reference type, so we don't use UniversalPrint(). - UniversalPrinter<T>::Print(result_.Peek(), os); - } - - // Performs the given mock function's default action and returns the - // result in a new-ed ActionResultHolder. - template <typename F> - static ActionResultHolder* PerformDefaultAction( - const FunctionMocker<F>* func_mocker, - typename Function<F>::ArgumentTuple&& args, - const std::string& call_description) { - return new ActionResultHolder(Wrapper(func_mocker->PerformDefaultAction( - std::move(args), call_description))); - } - - // Performs the given action and returns the result in a new-ed - // ActionResultHolder. - template <typename F> - static ActionResultHolder* PerformAction( - const Action<F>& action, typename Function<F>::ArgumentTuple&& args) { - return new ActionResultHolder( - Wrapper(action.Perform(std::move(args)))); - } - - private: - typedef ReferenceOrValueWrapper<T> Wrapper; - - explicit ActionResultHolder(Wrapper result) - : result_(std::move(result)) { - } - - Wrapper result_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder); -}; - -// Specialization for T = void. -template <> -class ActionResultHolder<void> : public UntypedActionResultHolderBase { - public: - void Unwrap() { } - - void PrintAsActionResult(::std::ostream* /* os */) const override {} - - // Performs the given mock function's default action and returns ownership - // of an empty ActionResultHolder*. - template <typename F> - static ActionResultHolder* PerformDefaultAction( - const FunctionMocker<F>* func_mocker, - typename Function<F>::ArgumentTuple&& args, - const std::string& call_description) { - func_mocker->PerformDefaultAction(std::move(args), call_description); - return new ActionResultHolder; - } - - // Performs the given action and returns ownership of an empty - // ActionResultHolder*. - template <typename F> - static ActionResultHolder* PerformAction( - const Action<F>& action, typename Function<F>::ArgumentTuple&& args) { - action.Perform(std::move(args)); - return new ActionResultHolder; - } - - private: - ActionResultHolder() {} - GTEST_DISALLOW_COPY_AND_ASSIGN_(ActionResultHolder); -}; - -template <typename F> -class FunctionMocker; - -template <typename R, typename... Args> -class FunctionMocker<R(Args...)> final : public UntypedFunctionMockerBase { - using F = R(Args...); - - public: - using Result = R; - using ArgumentTuple = std::tuple<Args...>; - using ArgumentMatcherTuple = std::tuple<Matcher<Args>...>; - - FunctionMocker() {} - - // There is no generally useful and implementable semantics of - // copying a mock object, so copying a mock is usually a user error. - // Thus we disallow copying function mockers. If the user really - // wants to copy a mock object, they should implement their own copy - // operation, for example: - // - // class MockFoo : public Foo { - // public: - // // Defines a copy constructor explicitly. - // MockFoo(const MockFoo& src) {} - // ... - // }; - FunctionMocker(const FunctionMocker&) = delete; - FunctionMocker& operator=(const FunctionMocker&) = delete; - - // The destructor verifies that all expectations on this mock - // function have been satisfied. If not, it will report Google Test - // non-fatal failures for the violations. - ~FunctionMocker() override GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - MutexLock l(&g_gmock_mutex); - VerifyAndClearExpectationsLocked(); - Mock::UnregisterLocked(this); - ClearDefaultActionsLocked(); - } - - // Returns the ON_CALL spec that matches this mock function with the - // given arguments; returns NULL if no matching ON_CALL is found. - // L = * - const OnCallSpec<F>* FindOnCallSpec( - const ArgumentTuple& args) const { - for (UntypedOnCallSpecs::const_reverse_iterator it - = untyped_on_call_specs_.rbegin(); - it != untyped_on_call_specs_.rend(); ++it) { - const OnCallSpec<F>* spec = static_cast<const OnCallSpec<F>*>(*it); - if (spec->Matches(args)) - return spec; - } - - return nullptr; - } - - // Performs the default action of this mock function on the given - // arguments and returns the result. Asserts (or throws if - // exceptions are enabled) with a helpful call descrption if there - // is no valid return value. This method doesn't depend on the - // mutable state of this object, and thus can be called concurrently - // without locking. - // L = * - Result PerformDefaultAction(ArgumentTuple&& args, - const std::string& call_description) const { - const OnCallSpec<F>* const spec = - this->FindOnCallSpec(args); - if (spec != nullptr) { - return spec->GetAction().Perform(std::move(args)); - } - const std::string message = - call_description + - "\n The mock function has no default action " - "set, and its return type has no default value set."; -#if GTEST_HAS_EXCEPTIONS - if (!DefaultValue<Result>::Exists()) { - throw std::runtime_error(message); - } -#else - Assert(DefaultValue<Result>::Exists(), "", -1, message); -#endif - return DefaultValue<Result>::Get(); - } - - // Performs the default action with the given arguments and returns - // the action's result. The call description string will be used in - // the error message to describe the call in the case the default - // action fails. The caller is responsible for deleting the result. - // L = * - UntypedActionResultHolderBase* UntypedPerformDefaultAction( - void* untyped_args, // must point to an ArgumentTuple - const std::string& call_description) const override { - ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args); - return ResultHolder::PerformDefaultAction(this, std::move(*args), - call_description); - } - - // Performs the given action with the given arguments and returns - // the action's result. The caller is responsible for deleting the - // result. - // L = * - UntypedActionResultHolderBase* UntypedPerformAction( - const void* untyped_action, void* untyped_args) const override { - // Make a copy of the action before performing it, in case the - // action deletes the mock object (and thus deletes itself). - const Action<F> action = *static_cast<const Action<F>*>(untyped_action); - ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args); - return ResultHolder::PerformAction(action, std::move(*args)); - } - - // Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked(): - // clears the ON_CALL()s set on this mock function. - void ClearDefaultActionsLocked() override - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - - // Deleting our default actions may trigger other mock objects to be - // deleted, for example if an action contains a reference counted smart - // pointer to that mock object, and that is the last reference. So if we - // delete our actions within the context of the global mutex we may deadlock - // when this method is called again. Instead, make a copy of the set of - // actions to delete, clear our set within the mutex, and then delete the - // actions outside of the mutex. - UntypedOnCallSpecs specs_to_delete; - untyped_on_call_specs_.swap(specs_to_delete); - - g_gmock_mutex.Unlock(); - for (UntypedOnCallSpecs::const_iterator it = - specs_to_delete.begin(); - it != specs_to_delete.end(); ++it) { - delete static_cast<const OnCallSpec<F>*>(*it); - } - - // Lock the mutex again, since the caller expects it to be locked when we - // return. - g_gmock_mutex.Lock(); - } - - // Returns the result of invoking this mock function with the given - // arguments. This function can be safely called from multiple - // threads concurrently. - Result Invoke(Args... args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - ArgumentTuple tuple(std::forward<Args>(args)...); - std::unique_ptr<ResultHolder> holder(DownCast_<ResultHolder*>( - this->UntypedInvokeWith(static_cast<void*>(&tuple)))); - return holder->Unwrap(); - } - - MockSpec<F> With(Matcher<Args>... m) { - return MockSpec<F>(this, ::std::make_tuple(std::move(m)...)); - } - - protected: - template <typename Function> - friend class MockSpec; - - typedef ActionResultHolder<Result> ResultHolder; - - // Adds and returns a default action spec for this mock function. - OnCallSpec<F>& AddNewOnCallSpec( - const char* file, int line, - const ArgumentMatcherTuple& m) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line); - OnCallSpec<F>* const on_call_spec = new OnCallSpec<F>(file, line, m); - untyped_on_call_specs_.push_back(on_call_spec); - return *on_call_spec; - } - - // Adds and returns an expectation spec for this mock function. - TypedExpectation<F>& AddNewExpectation(const char* file, int line, - const std::string& source_text, - const ArgumentMatcherTuple& m) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line); - TypedExpectation<F>* const expectation = - new TypedExpectation<F>(this, file, line, source_text, m); - const std::shared_ptr<ExpectationBase> untyped_expectation(expectation); - // See the definition of untyped_expectations_ for why access to - // it is unprotected here. - untyped_expectations_.push_back(untyped_expectation); - - // Adds this expectation into the implicit sequence if there is one. - Sequence* const implicit_sequence = g_gmock_implicit_sequence.get(); - if (implicit_sequence != nullptr) { - implicit_sequence->AddExpectation(Expectation(untyped_expectation)); - } - - return *expectation; - } - - private: - template <typename Func> friend class TypedExpectation; - - // Some utilities needed for implementing UntypedInvokeWith(). - - // Describes what default action will be performed for the given - // arguments. - // L = * - void DescribeDefaultActionTo(const ArgumentTuple& args, - ::std::ostream* os) const { - const OnCallSpec<F>* const spec = FindOnCallSpec(args); - - if (spec == nullptr) { - *os << (std::is_void<Result>::value ? "returning directly.\n" - : "returning default value.\n"); - } else { - *os << "taking default action specified at:\n" - << FormatFileLocation(spec->file(), spec->line()) << "\n"; - } - } - - // Writes a message that the call is uninteresting (i.e. neither - // explicitly expected nor explicitly unexpected) to the given - // ostream. - void UntypedDescribeUninterestingCall(const void* untyped_args, - ::std::ostream* os) const override - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - const ArgumentTuple& args = - *static_cast<const ArgumentTuple*>(untyped_args); - *os << "Uninteresting mock function call - "; - DescribeDefaultActionTo(args, os); - *os << " Function call: " << Name(); - UniversalPrint(args, os); - } - - // Returns the expectation that matches the given function arguments - // (or NULL is there's no match); when a match is found, - // untyped_action is set to point to the action that should be - // performed (or NULL if the action is "do default"), and - // is_excessive is modified to indicate whether the call exceeds the - // expected number. - // - // Critical section: We must find the matching expectation and the - // corresponding action that needs to be taken in an ATOMIC - // transaction. Otherwise another thread may call this mock - // method in the middle and mess up the state. - // - // However, performing the action has to be left out of the critical - // section. The reason is that we have no control on what the - // action does (it can invoke an arbitrary user function or even a - // mock function) and excessive locking could cause a dead lock. - const ExpectationBase* UntypedFindMatchingExpectation( - const void* untyped_args, const void** untyped_action, bool* is_excessive, - ::std::ostream* what, ::std::ostream* why) override - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - const ArgumentTuple& args = - *static_cast<const ArgumentTuple*>(untyped_args); - MutexLock l(&g_gmock_mutex); - TypedExpectation<F>* exp = this->FindMatchingExpectationLocked(args); - if (exp == nullptr) { // A match wasn't found. - this->FormatUnexpectedCallMessageLocked(args, what, why); - return nullptr; - } - - // This line must be done before calling GetActionForArguments(), - // which will increment the call count for *exp and thus affect - // its saturation status. - *is_excessive = exp->IsSaturated(); - const Action<F>* action = exp->GetActionForArguments(this, args, what, why); - if (action != nullptr && action->IsDoDefault()) - action = nullptr; // Normalize "do default" to NULL. - *untyped_action = action; - return exp; - } - - // Prints the given function arguments to the ostream. - void UntypedPrintArgs(const void* untyped_args, - ::std::ostream* os) const override { - const ArgumentTuple& args = - *static_cast<const ArgumentTuple*>(untyped_args); - UniversalPrint(args, os); - } - - // Returns the expectation that matches the arguments, or NULL if no - // expectation matches them. - TypedExpectation<F>* FindMatchingExpectationLocked( - const ArgumentTuple& args) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - // See the definition of untyped_expectations_ for why access to - // it is unprotected here. - for (typename UntypedExpectations::const_reverse_iterator it = - untyped_expectations_.rbegin(); - it != untyped_expectations_.rend(); ++it) { - TypedExpectation<F>* const exp = - static_cast<TypedExpectation<F>*>(it->get()); - if (exp->ShouldHandleArguments(args)) { - return exp; - } - } - return nullptr; - } - - // Returns a message that the arguments don't match any expectation. - void FormatUnexpectedCallMessageLocked( - const ArgumentTuple& args, - ::std::ostream* os, - ::std::ostream* why) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - *os << "\nUnexpected mock function call - "; - DescribeDefaultActionTo(args, os); - PrintTriedExpectationsLocked(args, why); - } - - // Prints a list of expectations that have been tried against the - // current mock function call. - void PrintTriedExpectationsLocked( - const ArgumentTuple& args, - ::std::ostream* why) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - const size_t count = untyped_expectations_.size(); - *why << "Google Mock tried the following " << count << " " - << (count == 1 ? "expectation, but it didn't match" : - "expectations, but none matched") - << ":\n"; - for (size_t i = 0; i < count; i++) { - TypedExpectation<F>* const expectation = - static_cast<TypedExpectation<F>*>(untyped_expectations_[i].get()); - *why << "\n"; - expectation->DescribeLocationTo(why); - if (count > 1) { - *why << "tried expectation #" << i << ": "; - } - *why << expectation->source_text() << "...\n"; - expectation->ExplainMatchResultTo(args, why); - expectation->DescribeCallCountTo(why); - } - } -}; // class FunctionMocker - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4355 - -// Reports an uninteresting call (whose description is in msg) in the -// manner specified by 'reaction'. -void ReportUninterestingCall(CallReaction reaction, const std::string& msg); - -} // namespace internal - -// A MockFunction<F> class has one mock method whose type is F. It is -// useful when you just want your test code to emit some messages and -// have Google Mock verify the right messages are sent (and perhaps at -// the right times). For example, if you are exercising code: -// -// Foo(1); -// Foo(2); -// Foo(3); -// -// and want to verify that Foo(1) and Foo(3) both invoke -// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write: -// -// TEST(FooTest, InvokesBarCorrectly) { -// MyMock mock; -// MockFunction<void(string check_point_name)> check; -// { -// InSequence s; -// -// EXPECT_CALL(mock, Bar("a")); -// EXPECT_CALL(check, Call("1")); -// EXPECT_CALL(check, Call("2")); -// EXPECT_CALL(mock, Bar("a")); -// } -// Foo(1); -// check.Call("1"); -// Foo(2); -// check.Call("2"); -// Foo(3); -// } -// -// The expectation spec says that the first Bar("a") must happen -// before check point "1", the second Bar("a") must happen after check -// point "2", and nothing should happen between the two check -// points. The explicit check points make it easy to tell which -// Bar("a") is called by which call to Foo(). -// -// MockFunction<F> can also be used to exercise code that accepts -// std::function<F> callbacks. To do so, use AsStdFunction() method -// to create std::function proxy forwarding to original object's Call. -// Example: -// -// TEST(FooTest, RunsCallbackWithBarArgument) { -// MockFunction<int(string)> callback; -// EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1)); -// Foo(callback.AsStdFunction()); -// } -template <typename F> -class MockFunction; - -template <typename R, typename... Args> -class MockFunction<R(Args...)> { - public: - MockFunction() {} - MockFunction(const MockFunction&) = delete; - MockFunction& operator=(const MockFunction&) = delete; - - std::function<R(Args...)> AsStdFunction() { - return [this](Args... args) -> R { - return this->Call(std::forward<Args>(args)...); - }; - } - - // Implementation detail: the expansion of the MOCK_METHOD macro. - R Call(Args... args) { - mock_.SetOwnerAndName(this, "Call"); - return mock_.Invoke(std::forward<Args>(args)...); - } - - internal::MockSpec<R(Args...)> gmock_Call(Matcher<Args>... m) { - mock_.RegisterOwner(this); - return mock_.With(std::move(m)...); - } - - internal::MockSpec<R(Args...)> gmock_Call(const internal::WithoutMatchers&, - R (*)(Args...)) { - return this->gmock_Call(::testing::A<Args>()...); - } - - private: - internal::FunctionMocker<R(Args...)> mock_; -}; - -// The style guide prohibits "using" statements in a namespace scope -// inside a header file. However, the MockSpec class template is -// meant to be defined in the ::testing namespace. The following line -// is just a trick for working around a bug in MSVC 8.0, which cannot -// handle it if we define MockSpec in ::testing. -using internal::MockSpec; - -// Const(x) is a convenient function for obtaining a const reference -// to x. This is useful for setting expectations on an overloaded -// const mock method, e.g. -// -// class MockFoo : public FooInterface { -// public: -// MOCK_METHOD0(Bar, int()); -// MOCK_CONST_METHOD0(Bar, int&()); -// }; -// -// MockFoo foo; -// // Expects a call to non-const MockFoo::Bar(). -// EXPECT_CALL(foo, Bar()); -// // Expects a call to const MockFoo::Bar(). -// EXPECT_CALL(Const(foo), Bar()); -template <typename T> -inline const T& Const(const T& x) { return x; } - -// Constructs an Expectation object that references and co-owns exp. -inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT - : expectation_base_(exp.GetHandle().expectation_base()) {} - -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -// Implementation for ON_CALL and EXPECT_CALL macros. A separate macro is -// required to avoid compile errors when the name of the method used in call is -// a result of macro expansion. See CompilesWithMethodNameExpandedFromMacro -// tests in internal/gmock-spec-builders_test.cc for more details. -// -// This macro supports statements both with and without parameter matchers. If -// the parameter list is omitted, gMock will accept any parameters, which allows -// tests to be written that don't need to encode the number of method -// parameter. This technique may only be used for non-overloaded methods. -// -// // These are the same: -// ON_CALL(mock, NoArgsMethod()).WillByDefault(...); -// ON_CALL(mock, NoArgsMethod).WillByDefault(...); -// -// // As are these: -// ON_CALL(mock, TwoArgsMethod(_, _)).WillByDefault(...); -// ON_CALL(mock, TwoArgsMethod).WillByDefault(...); -// -// // Can also specify args if you want, of course: -// ON_CALL(mock, TwoArgsMethod(_, 45)).WillByDefault(...); -// -// // Overloads work as long as you specify parameters: -// ON_CALL(mock, OverloadedMethod(_)).WillByDefault(...); -// ON_CALL(mock, OverloadedMethod(_, _)).WillByDefault(...); -// -// // Oops! Which overload did you want? -// ON_CALL(mock, OverloadedMethod).WillByDefault(...); -// => ERROR: call to member function 'gmock_OverloadedMethod' is ambiguous -// -// How this works: The mock class uses two overloads of the gmock_Method -// expectation setter method plus an operator() overload on the MockSpec object. -// In the matcher list form, the macro expands to: -// -// // This statement: -// ON_CALL(mock, TwoArgsMethod(_, 45))... -// -// // ...expands to: -// mock.gmock_TwoArgsMethod(_, 45)(WithoutMatchers(), nullptr)... -// |-------------v---------------||------------v-------------| -// invokes first overload swallowed by operator() -// -// // ...which is essentially: -// mock.gmock_TwoArgsMethod(_, 45)... -// -// Whereas the form without a matcher list: -// -// // This statement: -// ON_CALL(mock, TwoArgsMethod)... -// -// // ...expands to: -// mock.gmock_TwoArgsMethod(WithoutMatchers(), nullptr)... -// |-----------------------v--------------------------| -// invokes second overload -// -// // ...which is essentially: -// mock.gmock_TwoArgsMethod(_, _)... -// -// The WithoutMatchers() argument is used to disambiguate overloads and to -// block the caller from accidentally invoking the second overload directly. The -// second argument is an internal type derived from the method signature. The -// failure to disambiguate two overloads of this method in the ON_CALL statement -// is how we block callers from setting expectations on overloaded methods. -#define GMOCK_ON_CALL_IMPL_(mock_expr, Setter, call) \ - ((mock_expr).gmock_##call)(::testing::internal::GetWithoutMatchers(), \ - nullptr) \ - .Setter(__FILE__, __LINE__, #mock_expr, #call) - -#define ON_CALL(obj, call) \ - GMOCK_ON_CALL_IMPL_(obj, InternalDefaultActionSetAt, call) - -#define EXPECT_CALL(obj, call) \ - GMOCK_ON_CALL_IMPL_(obj, InternalExpectedAt, call) - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/gmock.h b/3rdParty/googletest/googlemock/include/gmock/gmock.h deleted file mode 100644 index 99c3d7871d0f92d472536d54035bd97e48ec71ca..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/gmock.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This is the main header file a user should include. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_ -#define GMOCK_INCLUDE_GMOCK_GMOCK_H_ - -// This file implements the following syntax: -// -// ON_CALL(mock_object, Method(...)) -// .With(...) ? -// .WillByDefault(...); -// -// where With() is optional and WillByDefault() must appear exactly -// once. -// -// EXPECT_CALL(mock_object, Method(...)) -// .With(...) ? -// .Times(...) ? -// .InSequence(...) * -// .WillOnce(...) * -// .WillRepeatedly(...) ? -// .RetiresOnSaturation() ? ; -// -// where all clauses are optional and WillOnce() can be repeated. - -#include "gmock/gmock-actions.h" -#include "gmock/gmock-cardinalities.h" -#include "gmock/gmock-function-mocker.h" -#include "gmock/gmock-generated-actions.h" -#include "gmock/gmock-generated-function-mockers.h" -#include "gmock/gmock-generated-matchers.h" -#include "gmock/gmock-matchers.h" -#include "gmock/gmock-more-actions.h" -#include "gmock/gmock-more-matchers.h" -#include "gmock/gmock-nice-strict.h" -#include "gmock/internal/gmock-internal-utils.h" - -namespace testing { - -// Declares Google Mock flags that we want a user to use programmatically. -GMOCK_DECLARE_bool_(catch_leaked_mocks); -GMOCK_DECLARE_string_(verbose); -GMOCK_DECLARE_int32_(default_mock_behavior); - -// Initializes Google Mock. This must be called before running the -// tests. In particular, it parses the command line for the flags -// that Google Mock recognizes. Whenever a Google Mock flag is seen, -// it is removed from argv, and *argc is decremented. -// -// No value is returned. Instead, the Google Mock flag variables are -// updated. -// -// Since Google Test is needed for Google Mock to work, this function -// also initializes Google Test and parses its flags, if that hasn't -// been done. -GTEST_API_ void InitGoogleMock(int* argc, char** argv); - -// This overloaded version can be used in Windows programs compiled in -// UNICODE mode. -GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv); - -// This overloaded version can be used on Arduino/embedded platforms where -// there is no argc/argv. -GTEST_API_ void InitGoogleMock(); - -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_GMOCK_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/internal/custom/README.md b/3rdParty/googletest/googlemock/include/gmock/internal/custom/README.md deleted file mode 100644 index f6c93f616d62414bc599efa06cd76742eb9977b8..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/internal/custom/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Customization Points - -The custom directory is an injection point for custom user configurations. - -## Header `gmock-port.h` - -The following macros can be defined: - -### Flag related macros: - -* `GMOCK_DECLARE_bool_(name)` -* `GMOCK_DECLARE_int32_(name)` -* `GMOCK_DECLARE_string_(name)` -* `GMOCK_DEFINE_bool_(name, default_val, doc)` -* `GMOCK_DEFINE_int32_(name, default_val, doc)` -* `GMOCK_DEFINE_string_(name, default_val, doc)` diff --git a/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h b/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h deleted file mode 100644 index 92d910cf06dfe16293a77fb4dc294360ae29505f..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +++ /dev/null @@ -1,10 +0,0 @@ -// This file was GENERATED by command: -// pump.py gmock-generated-actions.h.pump -// DO NOT EDIT BY HAND!!! - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ -#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ - -#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump b/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump deleted file mode 100644 index 67c221f14c72f56cdcf74e1c4eb1946cfa43c95e..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +++ /dev/null @@ -1,12 +0,0 @@ -$$ -*- mode: c++; -*- -$$ This is a Pump source file. Please use Pump to convert -$$ it to callback-actions.h. -$$ -$var max_callback_arity = 5 -$$}} This meta comment fixes auto-indentation in editors. - -// GOOGLETEST_CM0002 DO NOT DELETE -#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ -#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ - -#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h b/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h deleted file mode 100644 index 14aafaabe6b5202bfcb25f6a4a2f76b11b3adddd..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Injection point for custom user configurations. See README for details -// -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ -#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ -#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-port.h b/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-port.h deleted file mode 100644 index 0030fe91118a5b398943606033cc5431331e33d8..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/internal/custom/gmock-port.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Injection point for custom user configurations. See README for details -// -// ** Custom implementation starts here ** - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ -#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ - -#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h b/3rdParty/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h deleted file mode 100644 index fdc049c589cb9865c0cac8221693dcd3092b2d95..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h +++ /dev/null @@ -1,513 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file defines some utilities useful for implementing Google -// Mock. They are subject to change without notice, so please DO NOT -// USE THEM IN USER CODE. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ -#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ - -#include <stdio.h> -#include <ostream> // NOLINT -#include <string> -#include <type_traits> -#include "gmock/internal/gmock-port.h" -#include "gtest/gtest.h" - -namespace testing { - -template <typename> -class Matcher; - -namespace internal { - -// Silence MSVC C4100 (unreferenced formal parameter) and -// C4805('==': unsafe mix of type 'const int' and type 'const bool') -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4100) -# pragma warning(disable:4805) -#endif - -// Joins a vector of strings as if they are fields of a tuple; returns -// the joined string. -GTEST_API_ std::string JoinAsTuple(const Strings& fields); - -// Converts an identifier name to a space-separated list of lower-case -// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is -// treated as one word. For example, both "FooBar123" and -// "foo_bar_123" are converted to "foo bar 123". -GTEST_API_ std::string ConvertIdentifierNameToWords(const char* id_name); - -// PointeeOf<Pointer>::type is the type of a value pointed to by a -// Pointer, which can be either a smart pointer or a raw pointer. The -// following default implementation is for the case where Pointer is a -// smart pointer. -template <typename Pointer> -struct PointeeOf { - // Smart pointer classes define type element_type as the type of - // their pointees. - typedef typename Pointer::element_type type; -}; -// This specialization is for the raw pointer case. -template <typename T> -struct PointeeOf<T*> { typedef T type; }; // NOLINT - -// GetRawPointer(p) returns the raw pointer underlying p when p is a -// smart pointer, or returns p itself when p is already a raw pointer. -// The following default implementation is for the smart pointer case. -template <typename Pointer> -inline const typename Pointer::element_type* GetRawPointer(const Pointer& p) { - return p.get(); -} -// This overloaded version is for the raw pointer case. -template <typename Element> -inline Element* GetRawPointer(Element* p) { return p; } - -// MSVC treats wchar_t as a native type usually, but treats it as the -// same as unsigned short when the compiler option /Zc:wchar_t- is -// specified. It defines _NATIVE_WCHAR_T_DEFINED symbol when wchar_t -// is a native type. -#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED) -// wchar_t is a typedef. -#else -# define GMOCK_WCHAR_T_IS_NATIVE_ 1 -#endif - -// In what follows, we use the term "kind" to indicate whether a type -// is bool, an integer type (excluding bool), a floating-point type, -// or none of them. This categorization is useful for determining -// when a matcher argument type can be safely converted to another -// type in the implementation of SafeMatcherCast. -enum TypeKind { - kBool, kInteger, kFloatingPoint, kOther -}; - -// KindOf<T>::value is the kind of type T. -template <typename T> struct KindOf { - enum { value = kOther }; // The default kind. -}; - -// This macro declares that the kind of 'type' is 'kind'. -#define GMOCK_DECLARE_KIND_(type, kind) \ - template <> struct KindOf<type> { enum { value = kind }; } - -GMOCK_DECLARE_KIND_(bool, kBool); - -// All standard integer types. -GMOCK_DECLARE_KIND_(char, kInteger); -GMOCK_DECLARE_KIND_(signed char, kInteger); -GMOCK_DECLARE_KIND_(unsigned char, kInteger); -GMOCK_DECLARE_KIND_(short, kInteger); // NOLINT -GMOCK_DECLARE_KIND_(unsigned short, kInteger); // NOLINT -GMOCK_DECLARE_KIND_(int, kInteger); -GMOCK_DECLARE_KIND_(unsigned int, kInteger); -GMOCK_DECLARE_KIND_(long, kInteger); // NOLINT -GMOCK_DECLARE_KIND_(unsigned long, kInteger); // NOLINT - -#if GMOCK_WCHAR_T_IS_NATIVE_ -GMOCK_DECLARE_KIND_(wchar_t, kInteger); -#endif - -// Non-standard integer types. -GMOCK_DECLARE_KIND_(Int64, kInteger); -GMOCK_DECLARE_KIND_(UInt64, kInteger); - -// All standard floating-point types. -GMOCK_DECLARE_KIND_(float, kFloatingPoint); -GMOCK_DECLARE_KIND_(double, kFloatingPoint); -GMOCK_DECLARE_KIND_(long double, kFloatingPoint); - -#undef GMOCK_DECLARE_KIND_ - -// Evaluates to the kind of 'type'. -#define GMOCK_KIND_OF_(type) \ - static_cast< ::testing::internal::TypeKind>( \ - ::testing::internal::KindOf<type>::value) - -// Evaluates to true if and only if integer type T is signed. -#define GMOCK_IS_SIGNED_(T) (static_cast<T>(-1) < 0) - -// LosslessArithmeticConvertibleImpl<kFromKind, From, kToKind, To>::value -// is true if and only if arithmetic type From can be losslessly converted to -// arithmetic type To. -// -// It's the user's responsibility to ensure that both From and To are -// raw (i.e. has no CV modifier, is not a pointer, and is not a -// reference) built-in arithmetic types, kFromKind is the kind of -// From, and kToKind is the kind of To; the value is -// implementation-defined when the above pre-condition is violated. -template <TypeKind kFromKind, typename From, TypeKind kToKind, typename To> -struct LosslessArithmeticConvertibleImpl : public std::false_type {}; - -// Converting bool to bool is lossless. -template <> -struct LosslessArithmeticConvertibleImpl<kBool, bool, kBool, bool> - : public std::true_type {}; - -// Converting bool to any integer type is lossless. -template <typename To> -struct LosslessArithmeticConvertibleImpl<kBool, bool, kInteger, To> - : public std::true_type {}; - -// Converting bool to any floating-point type is lossless. -template <typename To> -struct LosslessArithmeticConvertibleImpl<kBool, bool, kFloatingPoint, To> - : public std::true_type {}; - -// Converting an integer to bool is lossy. -template <typename From> -struct LosslessArithmeticConvertibleImpl<kInteger, From, kBool, bool> - : public std::false_type {}; - -// Converting an integer to another non-bool integer is lossless -// if and only if the target type's range encloses the source type's range. -template <typename From, typename To> -struct LosslessArithmeticConvertibleImpl<kInteger, From, kInteger, To> - : public bool_constant< - // When converting from a smaller size to a larger size, we are - // fine as long as we are not converting from signed to unsigned. - ((sizeof(From) < sizeof(To)) && - (!GMOCK_IS_SIGNED_(From) || GMOCK_IS_SIGNED_(To))) || - // When converting between the same size, the signedness must match. - ((sizeof(From) == sizeof(To)) && - (GMOCK_IS_SIGNED_(From) == GMOCK_IS_SIGNED_(To)))> {}; // NOLINT - -#undef GMOCK_IS_SIGNED_ - -// Converting an integer to a floating-point type may be lossy, since -// the format of a floating-point number is implementation-defined. -template <typename From, typename To> -struct LosslessArithmeticConvertibleImpl<kInteger, From, kFloatingPoint, To> - : public std::false_type {}; - -// Converting a floating-point to bool is lossy. -template <typename From> -struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kBool, bool> - : public std::false_type {}; - -// Converting a floating-point to an integer is lossy. -template <typename From, typename To> -struct LosslessArithmeticConvertibleImpl<kFloatingPoint, From, kInteger, To> - : public std::false_type {}; - -// Converting a floating-point to another floating-point is lossless -// if and only if the target type is at least as big as the source type. -template <typename From, typename To> -struct LosslessArithmeticConvertibleImpl< - kFloatingPoint, From, kFloatingPoint, To> - : public bool_constant<sizeof(From) <= sizeof(To)> {}; // NOLINT - -// LosslessArithmeticConvertible<From, To>::value is true if and only if -// arithmetic type From can be losslessly converted to arithmetic type To. -// -// It's the user's responsibility to ensure that both From and To are -// raw (i.e. has no CV modifier, is not a pointer, and is not a -// reference) built-in arithmetic types; the value is -// implementation-defined when the above pre-condition is violated. -template <typename From, typename To> -struct LosslessArithmeticConvertible - : public LosslessArithmeticConvertibleImpl< - GMOCK_KIND_OF_(From), From, GMOCK_KIND_OF_(To), To> {}; // NOLINT - -// This interface knows how to report a Google Mock failure (either -// non-fatal or fatal). -class FailureReporterInterface { - public: - // The type of a failure (either non-fatal or fatal). - enum FailureType { - kNonfatal, kFatal - }; - - virtual ~FailureReporterInterface() {} - - // Reports a failure that occurred at the given source file location. - virtual void ReportFailure(FailureType type, const char* file, int line, - const std::string& message) = 0; -}; - -// Returns the failure reporter used by Google Mock. -GTEST_API_ FailureReporterInterface* GetFailureReporter(); - -// Asserts that condition is true; aborts the process with the given -// message if condition is false. We cannot use LOG(FATAL) or CHECK() -// as Google Mock might be used to mock the log sink itself. We -// inline this function to prevent it from showing up in the stack -// trace. -inline void Assert(bool condition, const char* file, int line, - const std::string& msg) { - if (!condition) { - GetFailureReporter()->ReportFailure(FailureReporterInterface::kFatal, - file, line, msg); - } -} -inline void Assert(bool condition, const char* file, int line) { - Assert(condition, file, line, "Assertion failed."); -} - -// Verifies that condition is true; generates a non-fatal failure if -// condition is false. -inline void Expect(bool condition, const char* file, int line, - const std::string& msg) { - if (!condition) { - GetFailureReporter()->ReportFailure(FailureReporterInterface::kNonfatal, - file, line, msg); - } -} -inline void Expect(bool condition, const char* file, int line) { - Expect(condition, file, line, "Expectation failed."); -} - -// Severity level of a log. -enum LogSeverity { - kInfo = 0, - kWarning = 1 -}; - -// Valid values for the --gmock_verbose flag. - -// All logs (informational and warnings) are printed. -const char kInfoVerbosity[] = "info"; -// Only warnings are printed. -const char kWarningVerbosity[] = "warning"; -// No logs are printed. -const char kErrorVerbosity[] = "error"; - -// Returns true if and only if a log with the given severity is visible -// according to the --gmock_verbose flag. -GTEST_API_ bool LogIsVisible(LogSeverity severity); - -// Prints the given message to stdout if and only if 'severity' >= the level -// specified by the --gmock_verbose flag. If stack_frames_to_skip >= -// 0, also prints the stack trace excluding the top -// stack_frames_to_skip frames. In opt mode, any positive -// stack_frames_to_skip is treated as 0, since we don't know which -// function calls will be inlined by the compiler and need to be -// conservative. -GTEST_API_ void Log(LogSeverity severity, const std::string& message, - int stack_frames_to_skip); - -// A marker class that is used to resolve parameterless expectations to the -// correct overload. This must not be instantiable, to prevent client code from -// accidentally resolving to the overload; for example: -// -// ON_CALL(mock, Method({}, nullptr))... -// -class WithoutMatchers { - private: - WithoutMatchers() {} - friend GTEST_API_ WithoutMatchers GetWithoutMatchers(); -}; - -// Internal use only: access the singleton instance of WithoutMatchers. -GTEST_API_ WithoutMatchers GetWithoutMatchers(); - -// Type traits. - -// Disable MSVC warnings for infinite recursion, since in this case the -// the recursion is unreachable. -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4717) -#endif - -// Invalid<T>() is usable as an expression of type T, but will terminate -// the program with an assertion failure if actually run. This is useful -// when a value of type T is needed for compilation, but the statement -// will not really be executed (or we don't care if the statement -// crashes). -template <typename T> -inline T Invalid() { - Assert(false, "", -1, "Internal error: attempt to return invalid value"); - // This statement is unreachable, and would never terminate even if it - // could be reached. It is provided only to placate compiler warnings - // about missing return statements. - return Invalid<T>(); -} - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -// Given a raw type (i.e. having no top-level reference or const -// modifier) RawContainer that's either an STL-style container or a -// native array, class StlContainerView<RawContainer> has the -// following members: -// -// - type is a type that provides an STL-style container view to -// (i.e. implements the STL container concept for) RawContainer; -// - const_reference is a type that provides a reference to a const -// RawContainer; -// - ConstReference(raw_container) returns a const reference to an STL-style -// container view to raw_container, which is a RawContainer. -// - Copy(raw_container) returns an STL-style container view of a -// copy of raw_container, which is a RawContainer. -// -// This generic version is used when RawContainer itself is already an -// STL-style container. -template <class RawContainer> -class StlContainerView { - public: - typedef RawContainer type; - typedef const type& const_reference; - - static const_reference ConstReference(const RawContainer& container) { - static_assert(!std::is_const<RawContainer>::value, - "RawContainer type must not be const"); - return container; - } - static type Copy(const RawContainer& container) { return container; } -}; - -// This specialization is used when RawContainer is a native array type. -template <typename Element, size_t N> -class StlContainerView<Element[N]> { - public: - typedef typename std::remove_const<Element>::type RawElement; - typedef internal::NativeArray<RawElement> type; - // NativeArray<T> can represent a native array either by value or by - // reference (selected by a constructor argument), so 'const type' - // can be used to reference a const native array. We cannot - // 'typedef const type& const_reference' here, as that would mean - // ConstReference() has to return a reference to a local variable. - typedef const type const_reference; - - static const_reference ConstReference(const Element (&array)[N]) { - static_assert(std::is_same<Element, RawElement>::value, - "Element type must not be const"); - return type(array, N, RelationToSourceReference()); - } - static type Copy(const Element (&array)[N]) { - return type(array, N, RelationToSourceCopy()); - } -}; - -// This specialization is used when RawContainer is a native array -// represented as a (pointer, size) tuple. -template <typename ElementPointer, typename Size> -class StlContainerView< ::std::tuple<ElementPointer, Size> > { - public: - typedef typename std::remove_const< - typename internal::PointeeOf<ElementPointer>::type>::type RawElement; - typedef internal::NativeArray<RawElement> type; - typedef const type const_reference; - - static const_reference ConstReference( - const ::std::tuple<ElementPointer, Size>& array) { - return type(std::get<0>(array), std::get<1>(array), - RelationToSourceReference()); - } - static type Copy(const ::std::tuple<ElementPointer, Size>& array) { - return type(std::get<0>(array), std::get<1>(array), RelationToSourceCopy()); - } -}; - -// The following specialization prevents the user from instantiating -// StlContainer with a reference type. -template <typename T> class StlContainerView<T&>; - -// A type transform to remove constness from the first part of a pair. -// Pairs like that are used as the value_type of associative containers, -// and this transform produces a similar but assignable pair. -template <typename T> -struct RemoveConstFromKey { - typedef T type; -}; - -// Partially specialized to remove constness from std::pair<const K, V>. -template <typename K, typename V> -struct RemoveConstFromKey<std::pair<const K, V> > { - typedef std::pair<K, V> type; -}; - -// Emit an assertion failure due to incorrect DoDefault() usage. Out-of-lined to -// reduce code size. -GTEST_API_ void IllegalDoDefault(const char* file, int line); - -template <typename F, typename Tuple, size_t... Idx> -auto ApplyImpl(F&& f, Tuple&& args, IndexSequence<Idx...>) -> decltype( - std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(args))...)) { - return std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(args))...); -} - -// Apply the function to a tuple of arguments. -template <typename F, typename Tuple> -auto Apply(F&& f, Tuple&& args) - -> decltype(ApplyImpl(std::forward<F>(f), std::forward<Tuple>(args), - MakeIndexSequence<std::tuple_size<Tuple>::value>())) { - return ApplyImpl(std::forward<F>(f), std::forward<Tuple>(args), - MakeIndexSequence<std::tuple_size<Tuple>::value>()); -} - -// Template struct Function<F>, where F must be a function type, contains -// the following typedefs: -// -// Result: the function's return type. -// Arg<N>: the type of the N-th argument, where N starts with 0. -// ArgumentTuple: the tuple type consisting of all parameters of F. -// ArgumentMatcherTuple: the tuple type consisting of Matchers for all -// parameters of F. -// MakeResultVoid: the function type obtained by substituting void -// for the return type of F. -// MakeResultIgnoredValue: -// the function type obtained by substituting Something -// for the return type of F. -template <typename T> -struct Function; - -template <typename R, typename... Args> -struct Function<R(Args...)> { - using Result = R; - static constexpr size_t ArgumentCount = sizeof...(Args); - template <size_t I> - using Arg = ElemFromList<I, typename MakeIndexSequence<sizeof...(Args)>::type, - Args...>; - using ArgumentTuple = std::tuple<Args...>; - using ArgumentMatcherTuple = std::tuple<Matcher<Args>...>; - using MakeResultVoid = void(Args...); - using MakeResultIgnoredValue = IgnoredValue(Args...); -}; - -template <typename R, typename... Args> -constexpr size_t Function<R(Args...)>::ArgumentCount; - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -} // namespace internal -} // namespace testing - -#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/internal/gmock-port.h b/3rdParty/googletest/googlemock/include/gmock/internal/gmock-port.h deleted file mode 100644 index 063e2929acd59790635e55687c3ae4f8ed6b0811..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/internal/gmock-port.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// Low-level types and utilities for porting Google Mock to various -// platforms. All macros ending with _ and symbols defined in an -// internal namespace are subject to change without notice. Code -// outside Google Mock MUST NOT USE THEM DIRECTLY. Macros that don't -// end with _ are part of Google Mock's public API and can be used by -// code outside Google Mock. - -// GOOGLETEST_CM0002 DO NOT DELETE - -#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ -#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ - -#include <assert.h> -#include <stdlib.h> -#include <iostream> - -// Most of the utilities needed for porting Google Mock are also -// required for Google Test and are defined in gtest-port.h. -// -// Note to maintainers: to reduce code duplication, prefer adding -// portability utilities to Google Test's gtest-port.h instead of -// here, as Google Mock depends on Google Test. Only add a utility -// here if it's truly specific to Google Mock. - -#include "gtest/internal/gtest-port.h" -#include "gmock/internal/custom/gmock-port.h" - -// For MS Visual C++, check the compiler version. At least VS 2015 is -// required to compile Google Mock. -#if defined(_MSC_VER) && _MSC_VER < 1900 -# error "At least Visual C++ 2015 (14.0) is required to compile Google Mock." -#endif - -// Macro for referencing flags. This is public as we want the user to -// use this syntax to reference Google Mock flags. -#define GMOCK_FLAG(name) FLAGS_gmock_##name - -#if !defined(GMOCK_DECLARE_bool_) - -// Macros for declaring flags. -# define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name) -# define GMOCK_DECLARE_int32_(name) \ - extern GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) -# define GMOCK_DECLARE_string_(name) \ - extern GTEST_API_ ::std::string GMOCK_FLAG(name) - -// Macros for defining flags. -# define GMOCK_DEFINE_bool_(name, default_val, doc) \ - GTEST_API_ bool GMOCK_FLAG(name) = (default_val) -# define GMOCK_DEFINE_int32_(name, default_val, doc) \ - GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val) -# define GMOCK_DEFINE_string_(name, default_val, doc) \ - GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val) - -#endif // !defined(GMOCK_DECLARE_bool_) - -#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ diff --git a/3rdParty/googletest/googlemock/include/gmock/internal/gmock-pp.h b/3rdParty/googletest/googlemock/include/gmock/internal/gmock-pp.h deleted file mode 100644 index 1ab80e1cdbee686c4b1f29061c01e2ec57a23e21..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/include/gmock/internal/gmock-pp.h +++ /dev/null @@ -1,317 +0,0 @@ -#ifndef THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_PP_H_ -#define THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_PP_H_ - -#undef GMOCK_PP_INTERNAL_USE_MSVC -#if defined(__clang__) -#define GMOCK_PP_INTERNAL_USE_MSVC 0 -#elif defined(_MSC_VER) -// TODO(iserna): Also verify tradional versus comformant preprocessor. -static_assert( - _MSC_VER >= 1900, - "MSVC version not supported. There is support for MSVC 14.0 and above."); -#define GMOCK_PP_INTERNAL_USE_MSVC 1 -#else -#define GMOCK_PP_INTERNAL_USE_MSVC 0 -#endif - -// Expands and concatenates the arguments. Constructed macros reevaluate. -#define GMOCK_PP_CAT(_1, _2) GMOCK_PP_INTERNAL_CAT(_1, _2) - -// Expands and stringifies the only argument. -#define GMOCK_PP_STRINGIZE(...) GMOCK_PP_INTERNAL_STRINGIZE(__VA_ARGS__) - -// Returns empty. Given a variadic number of arguments. -#define GMOCK_PP_EMPTY(...) - -// Returns a comma. Given a variadic number of arguments. -#define GMOCK_PP_COMMA(...) , - -// Returns the only argument. -#define GMOCK_PP_IDENTITY(_1) _1 - -// MSVC preprocessor collapses __VA_ARGS__ in a single argument, we use a -// CAT-like directive to force correct evaluation. Each macro has its own. -#if GMOCK_PP_INTERNAL_USE_MSVC - -// Evaluates to the number of arguments after expansion. -// -// #define PAIR x, y -// -// GMOCK_PP_NARG() => 1 -// GMOCK_PP_NARG(x) => 1 -// GMOCK_PP_NARG(x, y) => 2 -// GMOCK_PP_NARG(PAIR) => 2 -// -// Requires: the number of arguments after expansion is at most 15. -#define GMOCK_PP_NARG(...) \ - GMOCK_PP_INTERNAL_NARG_CAT( \ - GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, \ - 8, 7, 6, 5, 4, 3, 2, 1), ) - -// Returns 1 if the expansion of arguments has an unprotected comma. Otherwise -// returns 0. Requires no more than 15 unprotected commas. -#define GMOCK_PP_HAS_COMMA(...) \ - GMOCK_PP_INTERNAL_HAS_COMMA_CAT( \ - GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 1, 0), ) -// Returns the first argument. -#define GMOCK_PP_HEAD(...) \ - GMOCK_PP_INTERNAL_HEAD_CAT(GMOCK_PP_INTERNAL_HEAD(__VA_ARGS__), ) - -// Returns the tail. A variadic list of all arguments minus the first. Requires -// at least one argument. -#define GMOCK_PP_TAIL(...) \ - GMOCK_PP_INTERNAL_TAIL_CAT(GMOCK_PP_INTERNAL_TAIL(__VA_ARGS__), ) - -// Calls CAT(_Macro, NARG(__VA_ARGS__))(__VA_ARGS__) -#define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \ - GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT( \ - GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__))(__VA_ARGS__), ) - -#else // GMOCK_PP_INTERNAL_USE_MSVC - -#define GMOCK_PP_NARG(...) \ - GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, \ - 7, 6, 5, 4, 3, 2, 1) -#define GMOCK_PP_HAS_COMMA(...) \ - GMOCK_PP_INTERNAL_INTERNAL_16TH(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ - 1, 1, 1, 1, 0) -#define GMOCK_PP_HEAD(...) GMOCK_PP_INTERNAL_HEAD(__VA_ARGS__) -#define GMOCK_PP_TAIL(...) GMOCK_PP_INTERNAL_TAIL(__VA_ARGS__) -#define GMOCK_PP_VARIADIC_CALL(_Macro, ...) \ - GMOCK_PP_CAT(_Macro, GMOCK_PP_NARG(__VA_ARGS__))(__VA_ARGS__) - -#endif // GMOCK_PP_INTERNAL_USE_MSVC - -// If the arguments after expansion have no tokens, evaluates to `1`. Otherwise -// evaluates to `0`. -// -// Requires: * the number of arguments after expansion is at most 15. -// * If the argument is a macro, it must be able to be called with one -// argument. -// -// Implementation details: -// -// There is one case when it generates a compile error: if the argument is macro -// that cannot be called with one argument. -// -// #define M(a, b) // it doesn't matter what it expands to -// -// // Expected: expands to `0`. -// // Actual: compile error. -// GMOCK_PP_IS_EMPTY(M) -// -// There are 4 cases tested: -// -// * __VA_ARGS__ possible expansion has no unparen'd commas. Expected 0. -// * __VA_ARGS__ possible expansion is not enclosed in parenthesis. Expected 0. -// * __VA_ARGS__ possible expansion is not a macro that ()-evaluates to a comma. -// Expected 0 -// * __VA_ARGS__ is empty, or has unparen'd commas, or is enclosed in -// parenthesis, or is a macro that ()-evaluates to comma. Expected 1. -// -// We trigger detection on '0001', i.e. on empty. -#define GMOCK_PP_IS_EMPTY(...) \ - GMOCK_PP_INTERNAL_IS_EMPTY(GMOCK_PP_HAS_COMMA(__VA_ARGS__), \ - GMOCK_PP_HAS_COMMA(GMOCK_PP_COMMA __VA_ARGS__), \ - GMOCK_PP_HAS_COMMA(__VA_ARGS__()), \ - GMOCK_PP_HAS_COMMA(GMOCK_PP_COMMA __VA_ARGS__())) - -// Evaluates to _Then if _Cond is 1 and _Else if _Cond is 0. -#define GMOCK_PP_IF(_Cond, _Then, _Else) \ - GMOCK_PP_CAT(GMOCK_PP_INTERNAL_IF_, _Cond)(_Then, _Else) - -// Evaluates to the number of arguments after expansion. Identifies 'empty' as -// 0. -// -// #define PAIR x, y -// -// GMOCK_PP_NARG0() => 0 -// GMOCK_PP_NARG0(x) => 1 -// GMOCK_PP_NARG0(x, y) => 2 -// GMOCK_PP_NARG0(PAIR) => 2 -// -// Requires: * the number of arguments after expansion is at most 15. -// * If the argument is a macro, it must be able to be called with one -// argument. -#define GMOCK_PP_NARG0(...) \ - GMOCK_PP_IF(GMOCK_PP_IS_EMPTY(__VA_ARGS__), 0, GMOCK_PP_NARG(__VA_ARGS__)) - -// Expands to 1 if the first argument starts with something in parentheses, -// otherwise to 0. -#define GMOCK_PP_IS_BEGIN_PARENS(...) \ - GMOCK_PP_INTERNAL_ALTERNATE_HEAD( \ - GMOCK_PP_CAT(GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_, \ - GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C __VA_ARGS__)) - -// Expands to 1 is there is only one argument and it is enclosed in parentheses. -#define GMOCK_PP_IS_ENCLOSED_PARENS(...) \ - GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(__VA_ARGS__), \ - GMOCK_PP_IS_EMPTY(GMOCK_PP_EMPTY __VA_ARGS__), 0) - -// Remove the parens, requires GMOCK_PP_IS_ENCLOSED_PARENS(args) => 1. -#define GMOCK_PP_REMOVE_PARENS(...) GMOCK_PP_INTERNAL_REMOVE_PARENS __VA_ARGS__ - -// Expands to _Macro(0, _Data, e1) _Macro(1, _Data, e2) ... _Macro(K -1, _Data, -// eK) as many of GMOCK_INTERNAL_NARG0 _Tuple. -// Requires: * |_Macro| can be called with 3 arguments. -// * |_Tuple| expansion has no more than 15 elements. -#define GMOCK_PP_FOR_EACH(_Macro, _Data, _Tuple) \ - GMOCK_PP_CAT(GMOCK_PP_INTERNAL_FOR_EACH_IMPL_, GMOCK_PP_NARG0 _Tuple) \ - (0, _Macro, _Data, _Tuple) - -// Expands to _Macro(0, _Data, ) _Macro(1, _Data, ) ... _Macro(K - 1, _Data, ) -// Empty if _K = 0. -// Requires: * |_Macro| can be called with 3 arguments. -// * |_K| literal between 0 and 15 -#define GMOCK_PP_REPEAT(_Macro, _Data, _N) \ - GMOCK_PP_CAT(GMOCK_PP_INTERNAL_FOR_EACH_IMPL_, _N) \ - (0, _Macro, _Data, GMOCK_PP_INTENRAL_EMPTY_TUPLE) - -// Increments the argument, requires the argument to be between 0 and 15. -#define GMOCK_PP_INC(_i) GMOCK_PP_CAT(GMOCK_PP_INTERNAL_INC_, _i) - -// Returns comma if _i != 0. Requires _i to be between 0 and 15. -#define GMOCK_PP_COMMA_IF(_i) GMOCK_PP_CAT(GMOCK_PP_INTERNAL_COMMA_IF_, _i) - -// Internal details follow. Do not use any of these symbols outside of this -// file or we will break your code. -#define GMOCK_PP_INTENRAL_EMPTY_TUPLE (, , , , , , , , , , , , , , , ) -#define GMOCK_PP_INTERNAL_CAT(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_STRINGIZE(...) #__VA_ARGS__ -#define GMOCK_PP_INTERNAL_INTERNAL_16TH(_1, _2, _3, _4, _5, _6, _7, _8, _9, \ - _10, _11, _12, _13, _14, _15, _16, \ - ...) \ - _16 -#define GMOCK_PP_INTERNAL_CAT_5(_1, _2, _3, _4, _5) _1##_2##_3##_4##_5 -#define GMOCK_PP_INTERNAL_IS_EMPTY(_1, _2, _3, _4) \ - GMOCK_PP_HAS_COMMA(GMOCK_PP_INTERNAL_CAT_5(GMOCK_PP_INTERNAL_IS_EMPTY_CASE_, \ - _1, _2, _3, _4)) -#define GMOCK_PP_INTERNAL_IS_EMPTY_CASE_0001 , -#define GMOCK_PP_INTERNAL_IF_1(_Then, _Else) _Then -#define GMOCK_PP_INTERNAL_IF_0(_Then, _Else) _Else -#define GMOCK_PP_INTERNAL_HEAD(_1, ...) _1 -#define GMOCK_PP_INTERNAL_TAIL(_1, ...) __VA_ARGS__ - -#if GMOCK_PP_INTERNAL_USE_MSVC -#define GMOCK_PP_INTERNAL_NARG_CAT(_1, _2) GMOCK_PP_INTERNAL_NARG_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_HEAD_CAT(_1, _2) GMOCK_PP_INTERNAL_HEAD_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_HAS_COMMA_CAT(_1, _2) \ - GMOCK_PP_INTERNAL_HAS_COMMA_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_TAIL_CAT(_1, _2) GMOCK_PP_INTERNAL_TAIL_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT(_1, _2) \ - GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_NARG_CAT_I(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_HEAD_CAT_I(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_HAS_COMMA_CAT_I(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_TAIL_CAT_I(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_VARIADIC_CALL_CAT_I(_1, _2) _1##_2 -#define GMOCK_PP_INTERNAL_ALTERNATE_HEAD(...) \ - GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT(GMOCK_PP_HEAD(__VA_ARGS__), ) -#define GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT(_1, _2) \ - GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT_I(_1, _2) -#define GMOCK_PP_INTERNAL_ALTERNATE_HEAD_CAT_I(_1, _2) _1##_2 -#else // GMOCK_PP_INTERNAL_USE_MSVC -#define GMOCK_PP_INTERNAL_ALTERNATE_HEAD(...) GMOCK_PP_HEAD(__VA_ARGS__) -#endif // GMOCK_PP_INTERNAL_USE_MSVC - -#define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C(...) 1 _ -#define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_1 1, -#define GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_R_GMOCK_PP_INTERNAL_IBP_IS_VARIADIC_C \ - 0, -#define GMOCK_PP_INTERNAL_REMOVE_PARENS(...) __VA_ARGS__ -#define GMOCK_PP_INTERNAL_INC_0 1 -#define GMOCK_PP_INTERNAL_INC_1 2 -#define GMOCK_PP_INTERNAL_INC_2 3 -#define GMOCK_PP_INTERNAL_INC_3 4 -#define GMOCK_PP_INTERNAL_INC_4 5 -#define GMOCK_PP_INTERNAL_INC_5 6 -#define GMOCK_PP_INTERNAL_INC_6 7 -#define GMOCK_PP_INTERNAL_INC_7 8 -#define GMOCK_PP_INTERNAL_INC_8 9 -#define GMOCK_PP_INTERNAL_INC_9 10 -#define GMOCK_PP_INTERNAL_INC_10 11 -#define GMOCK_PP_INTERNAL_INC_11 12 -#define GMOCK_PP_INTERNAL_INC_12 13 -#define GMOCK_PP_INTERNAL_INC_13 14 -#define GMOCK_PP_INTERNAL_INC_14 15 -#define GMOCK_PP_INTERNAL_INC_15 16 -#define GMOCK_PP_INTERNAL_COMMA_IF_0 -#define GMOCK_PP_INTERNAL_COMMA_IF_1 , -#define GMOCK_PP_INTERNAL_COMMA_IF_2 , -#define GMOCK_PP_INTERNAL_COMMA_IF_3 , -#define GMOCK_PP_INTERNAL_COMMA_IF_4 , -#define GMOCK_PP_INTERNAL_COMMA_IF_5 , -#define GMOCK_PP_INTERNAL_COMMA_IF_6 , -#define GMOCK_PP_INTERNAL_COMMA_IF_7 , -#define GMOCK_PP_INTERNAL_COMMA_IF_8 , -#define GMOCK_PP_INTERNAL_COMMA_IF_9 , -#define GMOCK_PP_INTERNAL_COMMA_IF_10 , -#define GMOCK_PP_INTERNAL_COMMA_IF_11 , -#define GMOCK_PP_INTERNAL_COMMA_IF_12 , -#define GMOCK_PP_INTERNAL_COMMA_IF_13 , -#define GMOCK_PP_INTERNAL_COMMA_IF_14 , -#define GMOCK_PP_INTERNAL_COMMA_IF_15 , -#define GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, _element) \ - _Macro(_i, _Data, _element) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_0(_i, _Macro, _Data, _Tuple) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_1(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_2(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_1(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_3(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_2(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_4(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_3(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_5(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_4(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_6(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_5(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_7(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_6(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_8(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_7(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_9(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_8(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_10(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_9(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_11(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_10(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_12(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_11(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_13(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_12(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_14(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_13(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) -#define GMOCK_PP_INTERNAL_FOR_EACH_IMPL_15(_i, _Macro, _Data, _Tuple) \ - GMOCK_PP_INTERNAL_CALL_MACRO(_Macro, _i, _Data, GMOCK_PP_HEAD _Tuple) \ - GMOCK_PP_INTERNAL_FOR_EACH_IMPL_14(GMOCK_PP_INC(_i), _Macro, _Data, \ - (GMOCK_PP_TAIL _Tuple)) - -#endif // THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PP_H_ diff --git a/3rdParty/googletest/googlemock/src/gmock-all.cc b/3rdParty/googletest/googlemock/src/gmock-all.cc deleted file mode 100644 index e43c9b7b4c15b3c6451bbe9bac97f08376e8db65..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/src/gmock-all.cc +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// Google C++ Mocking Framework (Google Mock) -// -// This file #includes all Google Mock implementation .cc files. The -// purpose is to allow a user to build Google Mock by compiling this -// file alone. - -// This line ensures that gmock.h can be compiled on its own, even -// when it's fused. -#include "gmock/gmock.h" - -// The following lines pull in the real gmock *.cc files. -#include "src/gmock-cardinalities.cc" -#include "src/gmock-internal-utils.cc" -#include "src/gmock-matchers.cc" -#include "src/gmock-spec-builders.cc" -#include "src/gmock.cc" diff --git a/3rdParty/googletest/googlemock/src/gmock-cardinalities.cc b/3rdParty/googletest/googlemock/src/gmock-cardinalities.cc deleted file mode 100644 index 7463f4383233c315e128dc577a3c74cec23c8b34..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/src/gmock-cardinalities.cc +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements cardinalities. - -#include "gmock/gmock-cardinalities.h" - -#include <limits.h> -#include <ostream> // NOLINT -#include <sstream> -#include <string> -#include "gmock/internal/gmock-internal-utils.h" -#include "gtest/gtest.h" - -namespace testing { - -namespace { - -// Implements the Between(m, n) cardinality. -class BetweenCardinalityImpl : public CardinalityInterface { - public: - BetweenCardinalityImpl(int min, int max) - : min_(min >= 0 ? min : 0), - max_(max >= min_ ? max : min_) { - std::stringstream ss; - if (min < 0) { - ss << "The invocation lower bound must be >= 0, " - << "but is actually " << min << "."; - internal::Expect(false, __FILE__, __LINE__, ss.str()); - } else if (max < 0) { - ss << "The invocation upper bound must be >= 0, " - << "but is actually " << max << "."; - internal::Expect(false, __FILE__, __LINE__, ss.str()); - } else if (min > max) { - ss << "The invocation upper bound (" << max - << ") must be >= the invocation lower bound (" << min - << ")."; - internal::Expect(false, __FILE__, __LINE__, ss.str()); - } - } - - // Conservative estimate on the lower/upper bound of the number of - // calls allowed. - int ConservativeLowerBound() const override { return min_; } - int ConservativeUpperBound() const override { return max_; } - - bool IsSatisfiedByCallCount(int call_count) const override { - return min_ <= call_count && call_count <= max_; - } - - bool IsSaturatedByCallCount(int call_count) const override { - return call_count >= max_; - } - - void DescribeTo(::std::ostream* os) const override; - - private: - const int min_; - const int max_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(BetweenCardinalityImpl); -}; - -// Formats "n times" in a human-friendly way. -inline std::string FormatTimes(int n) { - if (n == 1) { - return "once"; - } else if (n == 2) { - return "twice"; - } else { - std::stringstream ss; - ss << n << " times"; - return ss.str(); - } -} - -// Describes the Between(m, n) cardinality in human-friendly text. -void BetweenCardinalityImpl::DescribeTo(::std::ostream* os) const { - if (min_ == 0) { - if (max_ == 0) { - *os << "never called"; - } else if (max_ == INT_MAX) { - *os << "called any number of times"; - } else { - *os << "called at most " << FormatTimes(max_); - } - } else if (min_ == max_) { - *os << "called " << FormatTimes(min_); - } else if (max_ == INT_MAX) { - *os << "called at least " << FormatTimes(min_); - } else { - // 0 < min_ < max_ < INT_MAX - *os << "called between " << min_ << " and " << max_ << " times"; - } -} - -} // Unnamed namespace - -// Describes the given call count to an ostream. -void Cardinality::DescribeActualCallCountTo(int actual_call_count, - ::std::ostream* os) { - if (actual_call_count > 0) { - *os << "called " << FormatTimes(actual_call_count); - } else { - *os << "never called"; - } -} - -// Creates a cardinality that allows at least n calls. -GTEST_API_ Cardinality AtLeast(int n) { return Between(n, INT_MAX); } - -// Creates a cardinality that allows at most n calls. -GTEST_API_ Cardinality AtMost(int n) { return Between(0, n); } - -// Creates a cardinality that allows any number of calls. -GTEST_API_ Cardinality AnyNumber() { return AtLeast(0); } - -// Creates a cardinality that allows between min and max calls. -GTEST_API_ Cardinality Between(int min, int max) { - return Cardinality(new BetweenCardinalityImpl(min, max)); -} - -// Creates a cardinality that allows exactly n calls. -GTEST_API_ Cardinality Exactly(int n) { return Between(n, n); } - -} // namespace testing diff --git a/3rdParty/googletest/googlemock/src/gmock-internal-utils.cc b/3rdParty/googletest/googlemock/src/gmock-internal-utils.cc deleted file mode 100644 index e5b547981d14d47fa49132d49cd3e950ae0c30fd..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/src/gmock-internal-utils.cc +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file defines some utilities useful for implementing Google -// Mock. They are subject to change without notice, so please DO NOT -// USE THEM IN USER CODE. - -#include "gmock/internal/gmock-internal-utils.h" - -#include <ctype.h> -#include <ostream> // NOLINT -#include <string> -#include "gmock/gmock.h" -#include "gmock/internal/gmock-port.h" -#include "gtest/gtest.h" - -namespace testing { -namespace internal { - -// Joins a vector of strings as if they are fields of a tuple; returns -// the joined string. -GTEST_API_ std::string JoinAsTuple(const Strings& fields) { - switch (fields.size()) { - case 0: - return ""; - case 1: - return fields[0]; - default: - std::string result = "(" + fields[0]; - for (size_t i = 1; i < fields.size(); i++) { - result += ", "; - result += fields[i]; - } - result += ")"; - return result; - } -} - -// Converts an identifier name to a space-separated list of lower-case -// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is -// treated as one word. For example, both "FooBar123" and -// "foo_bar_123" are converted to "foo bar 123". -GTEST_API_ std::string ConvertIdentifierNameToWords(const char* id_name) { - std::string result; - char prev_char = '\0'; - for (const char* p = id_name; *p != '\0'; prev_char = *(p++)) { - // We don't care about the current locale as the input is - // guaranteed to be a valid C++ identifier name. - const bool starts_new_word = IsUpper(*p) || - (!IsAlpha(prev_char) && IsLower(*p)) || - (!IsDigit(prev_char) && IsDigit(*p)); - - if (IsAlNum(*p)) { - if (starts_new_word && result != "") - result += ' '; - result += ToLower(*p); - } - } - return result; -} - -// This class reports Google Mock failures as Google Test failures. A -// user can define another class in a similar fashion if they intend to -// use Google Mock with a testing framework other than Google Test. -class GoogleTestFailureReporter : public FailureReporterInterface { - public: - void ReportFailure(FailureType type, const char* file, int line, - const std::string& message) override { - AssertHelper(type == kFatal ? - TestPartResult::kFatalFailure : - TestPartResult::kNonFatalFailure, - file, - line, - message.c_str()) = Message(); - if (type == kFatal) { - posix::Abort(); - } - } -}; - -// Returns the global failure reporter. Will create a -// GoogleTestFailureReporter and return it the first time called. -GTEST_API_ FailureReporterInterface* GetFailureReporter() { - // Points to the global failure reporter used by Google Mock. gcc - // guarantees that the following use of failure_reporter is - // thread-safe. We may need to add additional synchronization to - // protect failure_reporter if we port Google Mock to other - // compilers. - static FailureReporterInterface* const failure_reporter = - new GoogleTestFailureReporter(); - return failure_reporter; -} - -// Protects global resources (stdout in particular) used by Log(). -static GTEST_DEFINE_STATIC_MUTEX_(g_log_mutex); - -// Returns true if and only if a log with the given severity is visible -// according to the --gmock_verbose flag. -GTEST_API_ bool LogIsVisible(LogSeverity severity) { - if (GMOCK_FLAG(verbose) == kInfoVerbosity) { - // Always show the log if --gmock_verbose=info. - return true; - } else if (GMOCK_FLAG(verbose) == kErrorVerbosity) { - // Always hide it if --gmock_verbose=error. - return false; - } else { - // If --gmock_verbose is neither "info" nor "error", we treat it - // as "warning" (its default value). - return severity == kWarning; - } -} - -// Prints the given message to stdout if and only if 'severity' >= the level -// specified by the --gmock_verbose flag. If stack_frames_to_skip >= -// 0, also prints the stack trace excluding the top -// stack_frames_to_skip frames. In opt mode, any positive -// stack_frames_to_skip is treated as 0, since we don't know which -// function calls will be inlined by the compiler and need to be -// conservative. -GTEST_API_ void Log(LogSeverity severity, const std::string& message, - int stack_frames_to_skip) { - if (!LogIsVisible(severity)) - return; - - // Ensures that logs from different threads don't interleave. - MutexLock l(&g_log_mutex); - - if (severity == kWarning) { - // Prints a GMOCK WARNING marker to make the warnings easily searchable. - std::cout << "\nGMOCK WARNING:"; - } - // Pre-pends a new-line to message if it doesn't start with one. - if (message.empty() || message[0] != '\n') { - std::cout << "\n"; - } - std::cout << message; - if (stack_frames_to_skip >= 0) { -#ifdef NDEBUG - // In opt mode, we have to be conservative and skip no stack frame. - const int actual_to_skip = 0; -#else - // In dbg mode, we can do what the caller tell us to do (plus one - // for skipping this function's stack frame). - const int actual_to_skip = stack_frames_to_skip + 1; -#endif // NDEBUG - - // Appends a new-line to message if it doesn't end with one. - if (!message.empty() && *message.rbegin() != '\n') { - std::cout << "\n"; - } - std::cout << "Stack trace:\n" - << ::testing::internal::GetCurrentOsStackTraceExceptTop( - ::testing::UnitTest::GetInstance(), actual_to_skip); - } - std::cout << ::std::flush; -} - -GTEST_API_ WithoutMatchers GetWithoutMatchers() { return WithoutMatchers(); } - -GTEST_API_ void IllegalDoDefault(const char* file, int line) { - internal::Assert( - false, file, line, - "You are using DoDefault() inside a composite action like " - "DoAll() or WithArgs(). This is not supported for technical " - "reasons. Please instead spell out the default action, or " - "assign the default action to an Action variable and use " - "the variable in various places."); -} - -} // namespace internal -} // namespace testing diff --git a/3rdParty/googletest/googlemock/src/gmock-matchers.cc b/3rdParty/googletest/googlemock/src/gmock-matchers.cc deleted file mode 100644 index 4a3f7af2351ded2cb40ec83389d0f24d1456de9a..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/src/gmock-matchers.cc +++ /dev/null @@ -1,462 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements Matcher<const string&>, Matcher<string>, and -// utilities for defining matchers. - -#include "gmock/gmock-matchers.h" -#include "gmock/gmock-generated-matchers.h" - -#include <string.h> -#include <iostream> -#include <sstream> -#include <string> - -namespace testing { -namespace internal { - -// Returns the description for a matcher defined using the MATCHER*() -// macro where the user-supplied description string is "", if -// 'negation' is false; otherwise returns the description of the -// negation of the matcher. 'param_values' contains a list of strings -// that are the print-out of the matcher's parameters. -GTEST_API_ std::string FormatMatcherDescription(bool negation, - const char* matcher_name, - const Strings& param_values) { - std::string result = ConvertIdentifierNameToWords(matcher_name); - if (param_values.size() >= 1) result += " " + JoinAsTuple(param_values); - return negation ? "not (" + result + ")" : result; -} - -// FindMaxBipartiteMatching and its helper class. -// -// Uses the well-known Ford-Fulkerson max flow method to find a maximum -// bipartite matching. Flow is considered to be from left to right. -// There is an implicit source node that is connected to all of the left -// nodes, and an implicit sink node that is connected to all of the -// right nodes. All edges have unit capacity. -// -// Neither the flow graph nor the residual flow graph are represented -// explicitly. Instead, they are implied by the information in 'graph' and -// a vector<int> called 'left_' whose elements are initialized to the -// value kUnused. This represents the initial state of the algorithm, -// where the flow graph is empty, and the residual flow graph has the -// following edges: -// - An edge from source to each left_ node -// - An edge from each right_ node to sink -// - An edge from each left_ node to each right_ node, if the -// corresponding edge exists in 'graph'. -// -// When the TryAugment() method adds a flow, it sets left_[l] = r for some -// nodes l and r. This induces the following changes: -// - The edges (source, l), (l, r), and (r, sink) are added to the -// flow graph. -// - The same three edges are removed from the residual flow graph. -// - The reverse edges (l, source), (r, l), and (sink, r) are added -// to the residual flow graph, which is a directional graph -// representing unused flow capacity. -// -// When the method augments a flow (moving left_[l] from some r1 to some -// other r2), this can be thought of as "undoing" the above steps with -// respect to r1 and "redoing" them with respect to r2. -// -// It bears repeating that the flow graph and residual flow graph are -// never represented explicitly, but can be derived by looking at the -// information in 'graph' and in left_. -// -// As an optimization, there is a second vector<int> called right_ which -// does not provide any new information. Instead, it enables more -// efficient queries about edges entering or leaving the right-side nodes -// of the flow or residual flow graphs. The following invariants are -// maintained: -// -// left[l] == kUnused or right[left[l]] == l -// right[r] == kUnused or left[right[r]] == r -// -// . [ source ] . -// . ||| . -// . ||| . -// . ||\--> left[0]=1 ---\ right[0]=-1 ----\ . -// . || | | . -// . |\---> left[1]=-1 \--> right[1]=0 ---\| . -// . | || . -// . \----> left[2]=2 ------> right[2]=2 --\|| . -// . ||| . -// . elements matchers vvv . -// . [ sink ] . -// -// See Also: -// [1] Cormen, et al (2001). "Section 26.2: The Ford-Fulkerson method". -// "Introduction to Algorithms (Second ed.)", pp. 651-664. -// [2] "Ford-Fulkerson algorithm", Wikipedia, -// 'http://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm' -class MaxBipartiteMatchState { - public: - explicit MaxBipartiteMatchState(const MatchMatrix& graph) - : graph_(&graph), - left_(graph_->LhsSize(), kUnused), - right_(graph_->RhsSize(), kUnused) {} - - // Returns the edges of a maximal match, each in the form {left, right}. - ElementMatcherPairs Compute() { - // 'seen' is used for path finding { 0: unseen, 1: seen }. - ::std::vector<char> seen; - // Searches the residual flow graph for a path from each left node to - // the sink in the residual flow graph, and if one is found, add flow - // to the graph. It's okay to search through the left nodes once. The - // edge from the implicit source node to each previously-visited left - // node will have flow if that left node has any path to the sink - // whatsoever. Subsequent augmentations can only add flow to the - // network, and cannot take away that previous flow unit from the source. - // Since the source-to-left edge can only carry one flow unit (or, - // each element can be matched to only one matcher), there is no need - // to visit the left nodes more than once looking for augmented paths. - // The flow is known to be possible or impossible by looking at the - // node once. - for (size_t ilhs = 0; ilhs < graph_->LhsSize(); ++ilhs) { - // Reset the path-marking vector and try to find a path from - // source to sink starting at the left_[ilhs] node. - GTEST_CHECK_(left_[ilhs] == kUnused) - << "ilhs: " << ilhs << ", left_[ilhs]: " << left_[ilhs]; - // 'seen' initialized to 'graph_->RhsSize()' copies of 0. - seen.assign(graph_->RhsSize(), 0); - TryAugment(ilhs, &seen); - } - ElementMatcherPairs result; - for (size_t ilhs = 0; ilhs < left_.size(); ++ilhs) { - size_t irhs = left_[ilhs]; - if (irhs == kUnused) continue; - result.push_back(ElementMatcherPair(ilhs, irhs)); - } - return result; - } - - private: - static const size_t kUnused = static_cast<size_t>(-1); - - // Perform a depth-first search from left node ilhs to the sink. If a - // path is found, flow is added to the network by linking the left and - // right vector elements corresponding each segment of the path. - // Returns true if a path to sink was found, which means that a unit of - // flow was added to the network. The 'seen' vector elements correspond - // to right nodes and are marked to eliminate cycles from the search. - // - // Left nodes will only be explored at most once because they - // are accessible from at most one right node in the residual flow - // graph. - // - // Note that left_[ilhs] is the only element of left_ that TryAugment will - // potentially transition from kUnused to another value. Any other - // left_ element holding kUnused before TryAugment will be holding it - // when TryAugment returns. - // - bool TryAugment(size_t ilhs, ::std::vector<char>* seen) { - for (size_t irhs = 0; irhs < graph_->RhsSize(); ++irhs) { - if ((*seen)[irhs]) continue; - if (!graph_->HasEdge(ilhs, irhs)) continue; - // There's an available edge from ilhs to irhs. - (*seen)[irhs] = 1; - // Next a search is performed to determine whether - // this edge is a dead end or leads to the sink. - // - // right_[irhs] == kUnused means that there is residual flow from - // right node irhs to the sink, so we can use that to finish this - // flow path and return success. - // - // Otherwise there is residual flow to some ilhs. We push flow - // along that path and call ourselves recursively to see if this - // ultimately leads to sink. - if (right_[irhs] == kUnused || TryAugment(right_[irhs], seen)) { - // Add flow from left_[ilhs] to right_[irhs]. - left_[ilhs] = irhs; - right_[irhs] = ilhs; - return true; - } - } - return false; - } - - const MatchMatrix* graph_; // not owned - // Each element of the left_ vector represents a left hand side node - // (i.e. an element) and each element of right_ is a right hand side - // node (i.e. a matcher). The values in the left_ vector indicate - // outflow from that node to a node on the right_ side. The values - // in the right_ indicate inflow, and specify which left_ node is - // feeding that right_ node, if any. For example, left_[3] == 1 means - // there's a flow from element #3 to matcher #1. Such a flow would also - // be redundantly represented in the right_ vector as right_[1] == 3. - // Elements of left_ and right_ are either kUnused or mutually - // referent. Mutually referent means that left_[right_[i]] = i and - // right_[left_[i]] = i. - ::std::vector<size_t> left_; - ::std::vector<size_t> right_; - - GTEST_DISALLOW_ASSIGN_(MaxBipartiteMatchState); -}; - -const size_t MaxBipartiteMatchState::kUnused; - -GTEST_API_ ElementMatcherPairs FindMaxBipartiteMatching(const MatchMatrix& g) { - return MaxBipartiteMatchState(g).Compute(); -} - -static void LogElementMatcherPairVec(const ElementMatcherPairs& pairs, - ::std::ostream* stream) { - typedef ElementMatcherPairs::const_iterator Iter; - ::std::ostream& os = *stream; - os << "{"; - const char* sep = ""; - for (Iter it = pairs.begin(); it != pairs.end(); ++it) { - os << sep << "\n (" - << "element #" << it->first << ", " - << "matcher #" << it->second << ")"; - sep = ","; - } - os << "\n}"; -} - -bool MatchMatrix::NextGraph() { - for (size_t ilhs = 0; ilhs < LhsSize(); ++ilhs) { - for (size_t irhs = 0; irhs < RhsSize(); ++irhs) { - char& b = matched_[SpaceIndex(ilhs, irhs)]; - if (!b) { - b = 1; - return true; - } - b = 0; - } - } - return false; -} - -void MatchMatrix::Randomize() { - for (size_t ilhs = 0; ilhs < LhsSize(); ++ilhs) { - for (size_t irhs = 0; irhs < RhsSize(); ++irhs) { - char& b = matched_[SpaceIndex(ilhs, irhs)]; - b = static_cast<char>(rand() & 1); // NOLINT - } - } -} - -std::string MatchMatrix::DebugString() const { - ::std::stringstream ss; - const char* sep = ""; - for (size_t i = 0; i < LhsSize(); ++i) { - ss << sep; - for (size_t j = 0; j < RhsSize(); ++j) { - ss << HasEdge(i, j); - } - sep = ";"; - } - return ss.str(); -} - -void UnorderedElementsAreMatcherImplBase::DescribeToImpl( - ::std::ostream* os) const { - switch (match_flags()) { - case UnorderedMatcherRequire::ExactMatch: - if (matcher_describers_.empty()) { - *os << "is empty"; - return; - } - if (matcher_describers_.size() == 1) { - *os << "has " << Elements(1) << " and that element "; - matcher_describers_[0]->DescribeTo(os); - return; - } - *os << "has " << Elements(matcher_describers_.size()) - << " and there exists some permutation of elements such that:\n"; - break; - case UnorderedMatcherRequire::Superset: - *os << "a surjection from elements to requirements exists such that:\n"; - break; - case UnorderedMatcherRequire::Subset: - *os << "an injection from elements to requirements exists such that:\n"; - break; - } - - const char* sep = ""; - for (size_t i = 0; i != matcher_describers_.size(); ++i) { - *os << sep; - if (match_flags() == UnorderedMatcherRequire::ExactMatch) { - *os << " - element #" << i << " "; - } else { - *os << " - an element "; - } - matcher_describers_[i]->DescribeTo(os); - if (match_flags() == UnorderedMatcherRequire::ExactMatch) { - sep = ", and\n"; - } else { - sep = "\n"; - } - } -} - -void UnorderedElementsAreMatcherImplBase::DescribeNegationToImpl( - ::std::ostream* os) const { - switch (match_flags()) { - case UnorderedMatcherRequire::ExactMatch: - if (matcher_describers_.empty()) { - *os << "isn't empty"; - return; - } - if (matcher_describers_.size() == 1) { - *os << "doesn't have " << Elements(1) << ", or has " << Elements(1) - << " that "; - matcher_describers_[0]->DescribeNegationTo(os); - return; - } - *os << "doesn't have " << Elements(matcher_describers_.size()) - << ", or there exists no permutation of elements such that:\n"; - break; - case UnorderedMatcherRequire::Superset: - *os << "no surjection from elements to requirements exists such that:\n"; - break; - case UnorderedMatcherRequire::Subset: - *os << "no injection from elements to requirements exists such that:\n"; - break; - } - const char* sep = ""; - for (size_t i = 0; i != matcher_describers_.size(); ++i) { - *os << sep; - if (match_flags() == UnorderedMatcherRequire::ExactMatch) { - *os << " - element #" << i << " "; - } else { - *os << " - an element "; - } - matcher_describers_[i]->DescribeTo(os); - if (match_flags() == UnorderedMatcherRequire::ExactMatch) { - sep = ", and\n"; - } else { - sep = "\n"; - } - } -} - -// Checks that all matchers match at least one element, and that all -// elements match at least one matcher. This enables faster matching -// and better error reporting. -// Returns false, writing an explanation to 'listener', if and only -// if the success criteria are not met. -bool UnorderedElementsAreMatcherImplBase::VerifyMatchMatrix( - const ::std::vector<std::string>& element_printouts, - const MatchMatrix& matrix, MatchResultListener* listener) const { - bool result = true; - ::std::vector<char> element_matched(matrix.LhsSize(), 0); - ::std::vector<char> matcher_matched(matrix.RhsSize(), 0); - - for (size_t ilhs = 0; ilhs < matrix.LhsSize(); ilhs++) { - for (size_t irhs = 0; irhs < matrix.RhsSize(); irhs++) { - char matched = matrix.HasEdge(ilhs, irhs); - element_matched[ilhs] |= matched; - matcher_matched[irhs] |= matched; - } - } - - if (match_flags() & UnorderedMatcherRequire::Superset) { - const char* sep = - "where the following matchers don't match any elements:\n"; - for (size_t mi = 0; mi < matcher_matched.size(); ++mi) { - if (matcher_matched[mi]) continue; - result = false; - if (listener->IsInterested()) { - *listener << sep << "matcher #" << mi << ": "; - matcher_describers_[mi]->DescribeTo(listener->stream()); - sep = ",\n"; - } - } - } - - if (match_flags() & UnorderedMatcherRequire::Subset) { - const char* sep = - "where the following elements don't match any matchers:\n"; - const char* outer_sep = ""; - if (!result) { - outer_sep = "\nand "; - } - for (size_t ei = 0; ei < element_matched.size(); ++ei) { - if (element_matched[ei]) continue; - result = false; - if (listener->IsInterested()) { - *listener << outer_sep << sep << "element #" << ei << ": " - << element_printouts[ei]; - sep = ",\n"; - outer_sep = ""; - } - } - } - return result; -} - -bool UnorderedElementsAreMatcherImplBase::FindPairing( - const MatchMatrix& matrix, MatchResultListener* listener) const { - ElementMatcherPairs matches = FindMaxBipartiteMatching(matrix); - - size_t max_flow = matches.size(); - if ((match_flags() & UnorderedMatcherRequire::Superset) && - max_flow < matrix.RhsSize()) { - if (listener->IsInterested()) { - *listener << "where no permutation of the elements can satisfy all " - "matchers, and the closest match is " - << max_flow << " of " << matrix.RhsSize() - << " matchers with the pairings:\n"; - LogElementMatcherPairVec(matches, listener->stream()); - } - return false; - } - if ((match_flags() & UnorderedMatcherRequire::Subset) && - max_flow < matrix.LhsSize()) { - if (listener->IsInterested()) { - *listener - << "where not all elements can be matched, and the closest match is " - << max_flow << " of " << matrix.RhsSize() - << " matchers with the pairings:\n"; - LogElementMatcherPairVec(matches, listener->stream()); - } - return false; - } - - if (matches.size() > 1) { - if (listener->IsInterested()) { - const char* sep = "where:\n"; - for (size_t mi = 0; mi < matches.size(); ++mi) { - *listener << sep << " - element #" << matches[mi].first - << " is matched by matcher #" << matches[mi].second; - sep = ",\n"; - } - } - } - return true; -} - -} // namespace internal -} // namespace testing diff --git a/3rdParty/googletest/googlemock/src/gmock-spec-builders.cc b/3rdParty/googletest/googlemock/src/gmock-spec-builders.cc deleted file mode 100644 index f9d3434560b40c706afc7d90712beb8e7a866d6f..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/src/gmock-spec-builders.cc +++ /dev/null @@ -1,888 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Mock - a framework for writing C++ mock classes. -// -// This file implements the spec builder syntax (ON_CALL and -// EXPECT_CALL). - -#include "gmock/gmock-spec-builders.h" - -#include <stdlib.h> -#include <iostream> // NOLINT -#include <map> -#include <memory> -#include <set> -#include <string> -#include <vector> -#include "gmock/gmock.h" -#include "gtest/gtest.h" - -#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC -# include <unistd.h> // NOLINT -#endif - -// Silence C4800 (C4800: 'int *const ': forcing value -// to bool 'true' or 'false') for MSVC 15 -#ifdef _MSC_VER -#if _MSC_VER == 1900 -# pragma warning(push) -# pragma warning(disable:4800) -#endif -#endif - -namespace testing { -namespace internal { - -// Protects the mock object registry (in class Mock), all function -// mockers, and all expectations. -GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_gmock_mutex); - -// Logs a message including file and line number information. -GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity, - const char* file, int line, - const std::string& message) { - ::std::ostringstream s; - s << file << ":" << line << ": " << message << ::std::endl; - Log(severity, s.str(), 0); -} - -// Constructs an ExpectationBase object. -ExpectationBase::ExpectationBase(const char* a_file, int a_line, - const std::string& a_source_text) - : file_(a_file), - line_(a_line), - source_text_(a_source_text), - cardinality_specified_(false), - cardinality_(Exactly(1)), - call_count_(0), - retired_(false), - extra_matcher_specified_(false), - repeated_action_specified_(false), - retires_on_saturation_(false), - last_clause_(kNone), - action_count_checked_(false) {} - -// Destructs an ExpectationBase object. -ExpectationBase::~ExpectationBase() {} - -// Explicitly specifies the cardinality of this expectation. Used by -// the subclasses to implement the .Times() clause. -void ExpectationBase::SpecifyCardinality(const Cardinality& a_cardinality) { - cardinality_specified_ = true; - cardinality_ = a_cardinality; -} - -// Retires all pre-requisites of this expectation. -void ExpectationBase::RetireAllPreRequisites() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - if (is_retired()) { - // We can take this short-cut as we never retire an expectation - // until we have retired all its pre-requisites. - return; - } - - ::std::vector<ExpectationBase*> expectations(1, this); - while (!expectations.empty()) { - ExpectationBase* exp = expectations.back(); - expectations.pop_back(); - - for (ExpectationSet::const_iterator it = - exp->immediate_prerequisites_.begin(); - it != exp->immediate_prerequisites_.end(); ++it) { - ExpectationBase* next = it->expectation_base().get(); - if (!next->is_retired()) { - next->Retire(); - expectations.push_back(next); - } - } - } -} - -// Returns true if and only if all pre-requisites of this expectation -// have been satisfied. -bool ExpectationBase::AllPrerequisitesAreSatisfied() const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - ::std::vector<const ExpectationBase*> expectations(1, this); - while (!expectations.empty()) { - const ExpectationBase* exp = expectations.back(); - expectations.pop_back(); - - for (ExpectationSet::const_iterator it = - exp->immediate_prerequisites_.begin(); - it != exp->immediate_prerequisites_.end(); ++it) { - const ExpectationBase* next = it->expectation_base().get(); - if (!next->IsSatisfied()) return false; - expectations.push_back(next); - } - } - return true; -} - -// Adds unsatisfied pre-requisites of this expectation to 'result'. -void ExpectationBase::FindUnsatisfiedPrerequisites(ExpectationSet* result) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - ::std::vector<const ExpectationBase*> expectations(1, this); - while (!expectations.empty()) { - const ExpectationBase* exp = expectations.back(); - expectations.pop_back(); - - for (ExpectationSet::const_iterator it = - exp->immediate_prerequisites_.begin(); - it != exp->immediate_prerequisites_.end(); ++it) { - const ExpectationBase* next = it->expectation_base().get(); - - if (next->IsSatisfied()) { - // If *it is satisfied and has a call count of 0, some of its - // pre-requisites may not be satisfied yet. - if (next->call_count_ == 0) { - expectations.push_back(next); - } - } else { - // Now that we know next is unsatisfied, we are not so interested - // in whether its pre-requisites are satisfied. Therefore we - // don't iterate into it here. - *result += *it; - } - } - } -} - -// Describes how many times a function call matching this -// expectation has occurred. -void ExpectationBase::DescribeCallCountTo(::std::ostream* os) const - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - - // Describes how many times the function is expected to be called. - *os << " Expected: to be "; - cardinality().DescribeTo(os); - *os << "\n Actual: "; - Cardinality::DescribeActualCallCountTo(call_count(), os); - - // Describes the state of the expectation (e.g. is it satisfied? - // is it active?). - *os << " - " << (IsOverSaturated() ? "over-saturated" : - IsSaturated() ? "saturated" : - IsSatisfied() ? "satisfied" : "unsatisfied") - << " and " - << (is_retired() ? "retired" : "active"); -} - -// Checks the action count (i.e. the number of WillOnce() and -// WillRepeatedly() clauses) against the cardinality if this hasn't -// been done before. Prints a warning if there are too many or too -// few actions. -void ExpectationBase::CheckActionCountIfNotDone() const - GTEST_LOCK_EXCLUDED_(mutex_) { - bool should_check = false; - { - MutexLock l(&mutex_); - if (!action_count_checked_) { - action_count_checked_ = true; - should_check = true; - } - } - - if (should_check) { - if (!cardinality_specified_) { - // The cardinality was inferred - no need to check the action - // count against it. - return; - } - - // The cardinality was explicitly specified. - const int action_count = static_cast<int>(untyped_actions_.size()); - const int upper_bound = cardinality().ConservativeUpperBound(); - const int lower_bound = cardinality().ConservativeLowerBound(); - bool too_many; // True if there are too many actions, or false - // if there are too few. - if (action_count > upper_bound || - (action_count == upper_bound && repeated_action_specified_)) { - too_many = true; - } else if (0 < action_count && action_count < lower_bound && - !repeated_action_specified_) { - too_many = false; - } else { - return; - } - - ::std::stringstream ss; - DescribeLocationTo(&ss); - ss << "Too " << (too_many ? "many" : "few") - << " actions specified in " << source_text() << "...\n" - << "Expected to be "; - cardinality().DescribeTo(&ss); - ss << ", but has " << (too_many ? "" : "only ") - << action_count << " WillOnce()" - << (action_count == 1 ? "" : "s"); - if (repeated_action_specified_) { - ss << " and a WillRepeatedly()"; - } - ss << "."; - Log(kWarning, ss.str(), -1); // -1 means "don't print stack trace". - } -} - -// Implements the .Times() clause. -void ExpectationBase::UntypedTimes(const Cardinality& a_cardinality) { - if (last_clause_ == kTimes) { - ExpectSpecProperty(false, - ".Times() cannot appear " - "more than once in an EXPECT_CALL()."); - } else { - ExpectSpecProperty(last_clause_ < kTimes, - ".Times() cannot appear after " - ".InSequence(), .WillOnce(), .WillRepeatedly(), " - "or .RetiresOnSaturation()."); - } - last_clause_ = kTimes; - - SpecifyCardinality(a_cardinality); -} - -// Points to the implicit sequence introduced by a living InSequence -// object (if any) in the current thread or NULL. -GTEST_API_ ThreadLocal<Sequence*> g_gmock_implicit_sequence; - -// Reports an uninteresting call (whose description is in msg) in the -// manner specified by 'reaction'. -void ReportUninterestingCall(CallReaction reaction, const std::string& msg) { - // Include a stack trace only if --gmock_verbose=info is specified. - const int stack_frames_to_skip = - GMOCK_FLAG(verbose) == kInfoVerbosity ? 3 : -1; - switch (reaction) { - case kAllow: - Log(kInfo, msg, stack_frames_to_skip); - break; - case kWarn: - Log(kWarning, - msg + - "\nNOTE: You can safely ignore the above warning unless this " - "call should not happen. Do not suppress it by blindly adding " - "an EXPECT_CALL() if you don't mean to enforce the call. " - "See " - "https://github.com/google/googletest/blob/master/googlemock/" - "docs/cook_book.md#" - "knowing-when-to-expect for details.\n", - stack_frames_to_skip); - break; - default: // FAIL - Expect(false, nullptr, -1, msg); - } -} - -UntypedFunctionMockerBase::UntypedFunctionMockerBase() - : mock_obj_(nullptr), name_("") {} - -UntypedFunctionMockerBase::~UntypedFunctionMockerBase() {} - -// Sets the mock object this mock method belongs to, and registers -// this information in the global mock registry. Will be called -// whenever an EXPECT_CALL() or ON_CALL() is executed on this mock -// method. -void UntypedFunctionMockerBase::RegisterOwner(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - { - MutexLock l(&g_gmock_mutex); - mock_obj_ = mock_obj; - } - Mock::Register(mock_obj, this); -} - -// Sets the mock object this mock method belongs to, and sets the name -// of the mock function. Will be called upon each invocation of this -// mock function. -void UntypedFunctionMockerBase::SetOwnerAndName(const void* mock_obj, - const char* name) - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - // We protect name_ under g_gmock_mutex in case this mock function - // is called from two threads concurrently. - MutexLock l(&g_gmock_mutex); - mock_obj_ = mock_obj; - name_ = name; -} - -// Returns the name of the function being mocked. Must be called -// after RegisterOwner() or SetOwnerAndName() has been called. -const void* UntypedFunctionMockerBase::MockObject() const - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - const void* mock_obj; - { - // We protect mock_obj_ under g_gmock_mutex in case this mock - // function is called from two threads concurrently. - MutexLock l(&g_gmock_mutex); - Assert(mock_obj_ != nullptr, __FILE__, __LINE__, - "MockObject() must not be called before RegisterOwner() or " - "SetOwnerAndName() has been called."); - mock_obj = mock_obj_; - } - return mock_obj; -} - -// Returns the name of this mock method. Must be called after -// SetOwnerAndName() has been called. -const char* UntypedFunctionMockerBase::Name() const - GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - const char* name; - { - // We protect name_ under g_gmock_mutex in case this mock - // function is called from two threads concurrently. - MutexLock l(&g_gmock_mutex); - Assert(name_ != nullptr, __FILE__, __LINE__, - "Name() must not be called before SetOwnerAndName() has " - "been called."); - name = name_; - } - return name; -} - -// Calculates the result of invoking this mock function with the given -// arguments, prints it, and returns it. The caller is responsible -// for deleting the result. -UntypedActionResultHolderBase* UntypedFunctionMockerBase::UntypedInvokeWith( - void* const untyped_args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex) { - // See the definition of untyped_expectations_ for why access to it - // is unprotected here. - if (untyped_expectations_.size() == 0) { - // No expectation is set on this mock method - we have an - // uninteresting call. - - // We must get Google Mock's reaction on uninteresting calls - // made on this mock object BEFORE performing the action, - // because the action may DELETE the mock object and make the - // following expression meaningless. - const CallReaction reaction = - Mock::GetReactionOnUninterestingCalls(MockObject()); - - // True if and only if we need to print this call's arguments and return - // value. This definition must be kept in sync with - // the behavior of ReportUninterestingCall(). - const bool need_to_report_uninteresting_call = - // If the user allows this uninteresting call, we print it - // only when they want informational messages. - reaction == kAllow ? LogIsVisible(kInfo) : - // If the user wants this to be a warning, we print - // it only when they want to see warnings. - reaction == kWarn - ? LogIsVisible(kWarning) - : - // Otherwise, the user wants this to be an error, and we - // should always print detailed information in the error. - true; - - if (!need_to_report_uninteresting_call) { - // Perform the action without printing the call information. - return this->UntypedPerformDefaultAction( - untyped_args, "Function call: " + std::string(Name())); - } - - // Warns about the uninteresting call. - ::std::stringstream ss; - this->UntypedDescribeUninterestingCall(untyped_args, &ss); - - // Calculates the function result. - UntypedActionResultHolderBase* const result = - this->UntypedPerformDefaultAction(untyped_args, ss.str()); - - // Prints the function result. - if (result != nullptr) result->PrintAsActionResult(&ss); - - ReportUninterestingCall(reaction, ss.str()); - return result; - } - - bool is_excessive = false; - ::std::stringstream ss; - ::std::stringstream why; - ::std::stringstream loc; - const void* untyped_action = nullptr; - - // The UntypedFindMatchingExpectation() function acquires and - // releases g_gmock_mutex. - const ExpectationBase* const untyped_expectation = - this->UntypedFindMatchingExpectation( - untyped_args, &untyped_action, &is_excessive, - &ss, &why); - const bool found = untyped_expectation != nullptr; - - // True if and only if we need to print the call's arguments - // and return value. - // This definition must be kept in sync with the uses of Expect() - // and Log() in this function. - const bool need_to_report_call = - !found || is_excessive || LogIsVisible(kInfo); - if (!need_to_report_call) { - // Perform the action without printing the call information. - return untyped_action == nullptr - ? this->UntypedPerformDefaultAction(untyped_args, "") - : this->UntypedPerformAction(untyped_action, untyped_args); - } - - ss << " Function call: " << Name(); - this->UntypedPrintArgs(untyped_args, &ss); - - // In case the action deletes a piece of the expectation, we - // generate the message beforehand. - if (found && !is_excessive) { - untyped_expectation->DescribeLocationTo(&loc); - } - - UntypedActionResultHolderBase* const result = - untyped_action == nullptr - ? this->UntypedPerformDefaultAction(untyped_args, ss.str()) - : this->UntypedPerformAction(untyped_action, untyped_args); - if (result != nullptr) result->PrintAsActionResult(&ss); - ss << "\n" << why.str(); - - if (!found) { - // No expectation matches this call - reports a failure. - Expect(false, nullptr, -1, ss.str()); - } else if (is_excessive) { - // We had an upper-bound violation and the failure message is in ss. - Expect(false, untyped_expectation->file(), - untyped_expectation->line(), ss.str()); - } else { - // We had an expected call and the matching expectation is - // described in ss. - Log(kInfo, loc.str() + ss.str(), 2); - } - - return result; -} - -// Returns an Expectation object that references and co-owns exp, -// which must be an expectation on this mock function. -Expectation UntypedFunctionMockerBase::GetHandleOf(ExpectationBase* exp) { - // See the definition of untyped_expectations_ for why access to it - // is unprotected here. - for (UntypedExpectations::const_iterator it = - untyped_expectations_.begin(); - it != untyped_expectations_.end(); ++it) { - if (it->get() == exp) { - return Expectation(*it); - } - } - - Assert(false, __FILE__, __LINE__, "Cannot find expectation."); - return Expectation(); - // The above statement is just to make the code compile, and will - // never be executed. -} - -// Verifies that all expectations on this mock function have been -// satisfied. Reports one or more Google Test non-fatal failures -// and returns false if not. -bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked() - GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { - g_gmock_mutex.AssertHeld(); - bool expectations_met = true; - for (UntypedExpectations::const_iterator it = - untyped_expectations_.begin(); - it != untyped_expectations_.end(); ++it) { - ExpectationBase* const untyped_expectation = it->get(); - if (untyped_expectation->IsOverSaturated()) { - // There was an upper-bound violation. Since the error was - // already reported when it occurred, there is no need to do - // anything here. - expectations_met = false; - } else if (!untyped_expectation->IsSatisfied()) { - expectations_met = false; - ::std::stringstream ss; - ss << "Actual function call count doesn't match " - << untyped_expectation->source_text() << "...\n"; - // No need to show the source file location of the expectation - // in the description, as the Expect() call that follows already - // takes care of it. - untyped_expectation->MaybeDescribeExtraMatcherTo(&ss); - untyped_expectation->DescribeCallCountTo(&ss); - Expect(false, untyped_expectation->file(), - untyped_expectation->line(), ss.str()); - } - } - - // Deleting our expectations may trigger other mock objects to be deleted, for - // example if an action contains a reference counted smart pointer to that - // mock object, and that is the last reference. So if we delete our - // expectations within the context of the global mutex we may deadlock when - // this method is called again. Instead, make a copy of the set of - // expectations to delete, clear our set within the mutex, and then clear the - // copied set outside of it. - UntypedExpectations expectations_to_delete; - untyped_expectations_.swap(expectations_to_delete); - - g_gmock_mutex.Unlock(); - expectations_to_delete.clear(); - g_gmock_mutex.Lock(); - - return expectations_met; -} - -CallReaction intToCallReaction(int mock_behavior) { - if (mock_behavior >= kAllow && mock_behavior <= kFail) { - return static_cast<internal::CallReaction>(mock_behavior); - } - return kWarn; -} - -} // namespace internal - -// Class Mock. - -namespace { - -typedef std::set<internal::UntypedFunctionMockerBase*> FunctionMockers; - -// The current state of a mock object. Such information is needed for -// detecting leaked mock objects and explicitly verifying a mock's -// expectations. -struct MockObjectState { - MockObjectState() - : first_used_file(nullptr), first_used_line(-1), leakable(false) {} - - // Where in the source file an ON_CALL or EXPECT_CALL is first - // invoked on this mock object. - const char* first_used_file; - int first_used_line; - ::std::string first_used_test_suite; - ::std::string first_used_test; - bool leakable; // true if and only if it's OK to leak the object. - FunctionMockers function_mockers; // All registered methods of the object. -}; - -// A global registry holding the state of all mock objects that are -// alive. A mock object is added to this registry the first time -// Mock::AllowLeak(), ON_CALL(), or EXPECT_CALL() is called on it. It -// is removed from the registry in the mock object's destructor. -class MockObjectRegistry { - public: - // Maps a mock object (identified by its address) to its state. - typedef std::map<const void*, MockObjectState> StateMap; - - // This destructor will be called when a program exits, after all - // tests in it have been run. By then, there should be no mock - // object alive. Therefore we report any living object as test - // failure, unless the user explicitly asked us to ignore it. - ~MockObjectRegistry() { - if (!GMOCK_FLAG(catch_leaked_mocks)) - return; - - int leaked_count = 0; - for (StateMap::const_iterator it = states_.begin(); it != states_.end(); - ++it) { - if (it->second.leakable) // The user said it's fine to leak this object. - continue; - - // FIXME: Print the type of the leaked object. - // This can help the user identify the leaked object. - std::cout << "\n"; - const MockObjectState& state = it->second; - std::cout << internal::FormatFileLocation(state.first_used_file, - state.first_used_line); - std::cout << " ERROR: this mock object"; - if (state.first_used_test != "") { - std::cout << " (used in test " << state.first_used_test_suite << "." - << state.first_used_test << ")"; - } - std::cout << " should be deleted but never is. Its address is @" - << it->first << "."; - leaked_count++; - } - if (leaked_count > 0) { - std::cout << "\nERROR: " << leaked_count << " leaked mock " - << (leaked_count == 1 ? "object" : "objects") - << " found at program exit. Expectations on a mock object is " - "verified when the object is destructed. Leaking a mock " - "means that its expectations aren't verified, which is " - "usually a test bug. If you really intend to leak a mock, " - "you can suppress this error using " - "testing::Mock::AllowLeak(mock_object), or you may use a " - "fake or stub instead of a mock.\n"; - std::cout.flush(); - ::std::cerr.flush(); - // RUN_ALL_TESTS() has already returned when this destructor is - // called. Therefore we cannot use the normal Google Test - // failure reporting mechanism. - _exit(1); // We cannot call exit() as it is not reentrant and - // may already have been called. - } - } - - StateMap& states() { return states_; } - - private: - StateMap states_; -}; - -// Protected by g_gmock_mutex. -MockObjectRegistry g_mock_object_registry; - -// Maps a mock object to the reaction Google Mock should have when an -// uninteresting method is called. Protected by g_gmock_mutex. -std::map<const void*, internal::CallReaction> g_uninteresting_call_reaction; - -// Sets the reaction Google Mock should have when an uninteresting -// method of the given mock object is called. -void SetReactionOnUninterestingCalls(const void* mock_obj, - internal::CallReaction reaction) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - g_uninteresting_call_reaction[mock_obj] = reaction; -} - -} // namespace - -// Tells Google Mock to allow uninteresting calls on the given mock -// object. -void Mock::AllowUninterestingCalls(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - SetReactionOnUninterestingCalls(mock_obj, internal::kAllow); -} - -// Tells Google Mock to warn the user about uninteresting calls on the -// given mock object. -void Mock::WarnUninterestingCalls(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - SetReactionOnUninterestingCalls(mock_obj, internal::kWarn); -} - -// Tells Google Mock to fail uninteresting calls on the given mock -// object. -void Mock::FailUninterestingCalls(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - SetReactionOnUninterestingCalls(mock_obj, internal::kFail); -} - -// Tells Google Mock the given mock object is being destroyed and its -// entry in the call-reaction table should be removed. -void Mock::UnregisterCallReaction(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - g_uninteresting_call_reaction.erase(mock_obj); -} - -// Returns the reaction Google Mock will have on uninteresting calls -// made on the given mock object. -internal::CallReaction Mock::GetReactionOnUninterestingCalls( - const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - return (g_uninteresting_call_reaction.count(mock_obj) == 0) ? - internal::intToCallReaction(GMOCK_FLAG(default_mock_behavior)) : - g_uninteresting_call_reaction[mock_obj]; -} - -// Tells Google Mock to ignore mock_obj when checking for leaked mock -// objects. -void Mock::AllowLeak(const void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - g_mock_object_registry.states()[mock_obj].leakable = true; -} - -// Verifies and clears all expectations on the given mock object. If -// the expectations aren't satisfied, generates one or more Google -// Test non-fatal failures and returns false. -bool Mock::VerifyAndClearExpectations(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - return VerifyAndClearExpectationsLocked(mock_obj); -} - -// Verifies all expectations on the given mock object and clears its -// default actions and expectations. Returns true if and only if the -// verification was successful. -bool Mock::VerifyAndClear(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - ClearDefaultActionsLocked(mock_obj); - return VerifyAndClearExpectationsLocked(mock_obj); -} - -// Verifies and clears all expectations on the given mock object. If -// the expectations aren't satisfied, generates one or more Google -// Test non-fatal failures and returns false. -bool Mock::VerifyAndClearExpectationsLocked(void* mock_obj) - GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex) { - internal::g_gmock_mutex.AssertHeld(); - if (g_mock_object_registry.states().count(mock_obj) == 0) { - // No EXPECT_CALL() was set on the given mock object. - return true; - } - - // Verifies and clears the expectations on each mock method in the - // given mock object. - bool expectations_met = true; - FunctionMockers& mockers = - g_mock_object_registry.states()[mock_obj].function_mockers; - for (FunctionMockers::const_iterator it = mockers.begin(); - it != mockers.end(); ++it) { - if (!(*it)->VerifyAndClearExpectationsLocked()) { - expectations_met = false; - } - } - - // We don't clear the content of mockers, as they may still be - // needed by ClearDefaultActionsLocked(). - return expectations_met; -} - -bool Mock::IsNaggy(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - return Mock::GetReactionOnUninterestingCalls(mock_obj) == internal::kWarn; -} -bool Mock::IsNice(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - return Mock::GetReactionOnUninterestingCalls(mock_obj) == internal::kAllow; -} -bool Mock::IsStrict(void* mock_obj) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - return Mock::GetReactionOnUninterestingCalls(mock_obj) == internal::kFail; -} - -// Registers a mock object and a mock method it owns. -void Mock::Register(const void* mock_obj, - internal::UntypedFunctionMockerBase* mocker) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - g_mock_object_registry.states()[mock_obj].function_mockers.insert(mocker); -} - -// Tells Google Mock where in the source code mock_obj is used in an -// ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this -// information helps the user identify which object it is. -void Mock::RegisterUseByOnCallOrExpectCall(const void* mock_obj, - const char* file, int line) - GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { - internal::MutexLock l(&internal::g_gmock_mutex); - MockObjectState& state = g_mock_object_registry.states()[mock_obj]; - if (state.first_used_file == nullptr) { - state.first_used_file = file; - state.first_used_line = line; - const TestInfo* const test_info = - UnitTest::GetInstance()->current_test_info(); - if (test_info != nullptr) { - state.first_used_test_suite = test_info->test_suite_name(); - state.first_used_test = test_info->name(); - } - } -} - -// Unregisters a mock method; removes the owning mock object from the -// registry when the last mock method associated with it has been -// unregistered. This is called only in the destructor of -// FunctionMockerBase. -void Mock::UnregisterLocked(internal::UntypedFunctionMockerBase* mocker) - GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex) { - internal::g_gmock_mutex.AssertHeld(); - for (MockObjectRegistry::StateMap::iterator it = - g_mock_object_registry.states().begin(); - it != g_mock_object_registry.states().end(); ++it) { - FunctionMockers& mockers = it->second.function_mockers; - if (mockers.erase(mocker) > 0) { - // mocker was in mockers and has been just removed. - if (mockers.empty()) { - g_mock_object_registry.states().erase(it); - } - return; - } - } -} - -// Clears all ON_CALL()s set on the given mock object. -void Mock::ClearDefaultActionsLocked(void* mock_obj) - GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex) { - internal::g_gmock_mutex.AssertHeld(); - - if (g_mock_object_registry.states().count(mock_obj) == 0) { - // No ON_CALL() was set on the given mock object. - return; - } - - // Clears the default actions for each mock method in the given mock - // object. - FunctionMockers& mockers = - g_mock_object_registry.states()[mock_obj].function_mockers; - for (FunctionMockers::const_iterator it = mockers.begin(); - it != mockers.end(); ++it) { - (*it)->ClearDefaultActionsLocked(); - } - - // We don't clear the content of mockers, as they may still be - // needed by VerifyAndClearExpectationsLocked(). -} - -Expectation::Expectation() {} - -Expectation::Expectation( - const std::shared_ptr<internal::ExpectationBase>& an_expectation_base) - : expectation_base_(an_expectation_base) {} - -Expectation::~Expectation() {} - -// Adds an expectation to a sequence. -void Sequence::AddExpectation(const Expectation& expectation) const { - if (*last_expectation_ != expectation) { - if (last_expectation_->expectation_base() != nullptr) { - expectation.expectation_base()->immediate_prerequisites_ - += *last_expectation_; - } - *last_expectation_ = expectation; - } -} - -// Creates the implicit sequence if there isn't one. -InSequence::InSequence() { - if (internal::g_gmock_implicit_sequence.get() == nullptr) { - internal::g_gmock_implicit_sequence.set(new Sequence); - sequence_created_ = true; - } else { - sequence_created_ = false; - } -} - -// Deletes the implicit sequence if it was created by the constructor -// of this object. -InSequence::~InSequence() { - if (sequence_created_) { - delete internal::g_gmock_implicit_sequence.get(); - internal::g_gmock_implicit_sequence.set(nullptr); - } -} - -} // namespace testing - -#ifdef _MSC_VER -#if _MSC_VER == 1900 -# pragma warning(pop) -#endif -#endif diff --git a/3rdParty/googletest/googlemock/src/gmock.cc b/3rdParty/googletest/googlemock/src/gmock.cc deleted file mode 100644 index 32b2a7394fd08cb19c13d0017539bce308195db0..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/src/gmock.cc +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#include "gmock/gmock.h" -#include "gmock/internal/gmock-port.h" - -namespace testing { - -GMOCK_DEFINE_bool_(catch_leaked_mocks, true, - "true if and only if Google Mock should report leaked " - "mock objects as failures."); - -GMOCK_DEFINE_string_(verbose, internal::kWarningVerbosity, - "Controls how verbose Google Mock's output is." - " Valid values:\n" - " info - prints all messages.\n" - " warning - prints warnings and errors.\n" - " error - prints errors only."); - -GMOCK_DEFINE_int32_(default_mock_behavior, 1, - "Controls the default behavior of mocks." - " Valid values:\n" - " 0 - by default, mocks act as NiceMocks.\n" - " 1 - by default, mocks act as NaggyMocks.\n" - " 2 - by default, mocks act as StrictMocks."); - -namespace internal { - -// Parses a string as a command line flag. The string should have the -// format "--gmock_flag=value". When def_optional is true, the -// "=value" part can be omitted. -// -// Returns the value of the flag, or NULL if the parsing failed. -static const char* ParseGoogleMockFlagValue(const char* str, - const char* flag, - bool def_optional) { - // str and flag must not be NULL. - if (str == nullptr || flag == nullptr) return nullptr; - - // The flag must start with "--gmock_". - const std::string flag_str = std::string("--gmock_") + flag; - const size_t flag_len = flag_str.length(); - if (strncmp(str, flag_str.c_str(), flag_len) != 0) return nullptr; - - // Skips the flag name. - const char* flag_end = str + flag_len; - - // When def_optional is true, it's OK to not have a "=value" part. - if (def_optional && (flag_end[0] == '\0')) { - return flag_end; - } - - // If def_optional is true and there are more characters after the - // flag name, or if def_optional is false, there must be a '=' after - // the flag name. - if (flag_end[0] != '=') return nullptr; - - // Returns the string after "=". - return flag_end + 1; -} - -// Parses a string for a Google Mock bool flag, in the form of -// "--gmock_flag=value". -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -static bool ParseGoogleMockBoolFlag(const char* str, const char* flag, - bool* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseGoogleMockFlagValue(str, flag, true); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Converts the string value to a bool. - *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F'); - return true; -} - -// Parses a string for a Google Mock string flag, in the form of -// "--gmock_flag=value". -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -template <typename String> -static bool ParseGoogleMockStringFlag(const char* str, const char* flag, - String* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseGoogleMockFlagValue(str, flag, false); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Sets *value to the value of the flag. - *value = value_str; - return true; -} - -static bool ParseGoogleMockIntFlag(const char* str, const char* flag, - int* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseGoogleMockFlagValue(str, flag, true); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Sets *value to the value of the flag. - return ParseInt32(Message() << "The value of flag --" << flag, - value_str, value); -} - -// The internal implementation of InitGoogleMock(). -// -// The type parameter CharType can be instantiated to either char or -// wchar_t. -template <typename CharType> -void InitGoogleMockImpl(int* argc, CharType** argv) { - // Makes sure Google Test is initialized. InitGoogleTest() is - // idempotent, so it's fine if the user has already called it. - InitGoogleTest(argc, argv); - if (*argc <= 0) return; - - for (int i = 1; i != *argc; i++) { - const std::string arg_string = StreamableToString(argv[i]); - const char* const arg = arg_string.c_str(); - - // Do we see a Google Mock flag? - if (ParseGoogleMockBoolFlag(arg, "catch_leaked_mocks", - &GMOCK_FLAG(catch_leaked_mocks)) || - ParseGoogleMockStringFlag(arg, "verbose", &GMOCK_FLAG(verbose)) || - ParseGoogleMockIntFlag(arg, "default_mock_behavior", - &GMOCK_FLAG(default_mock_behavior))) { - // Yes. Shift the remainder of the argv list left by one. Note - // that argv has (*argc + 1) elements, the last one always being - // NULL. The following loop moves the trailing NULL element as - // well. - for (int j = i; j != *argc; j++) { - argv[j] = argv[j + 1]; - } - - // Decrements the argument count. - (*argc)--; - - // We also need to decrement the iterator as we just removed - // an element. - i--; - } - } -} - -} // namespace internal - -// Initializes Google Mock. This must be called before running the -// tests. In particular, it parses a command line for the flags that -// Google Mock recognizes. Whenever a Google Mock flag is seen, it is -// removed from argv, and *argc is decremented. -// -// No value is returned. Instead, the Google Mock flag variables are -// updated. -// -// Since Google Test is needed for Google Mock to work, this function -// also initializes Google Test and parses its flags, if that hasn't -// been done. -GTEST_API_ void InitGoogleMock(int* argc, char** argv) { - internal::InitGoogleMockImpl(argc, argv); -} - -// This overloaded version can be used in Windows programs compiled in -// UNICODE mode. -GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv) { - internal::InitGoogleMockImpl(argc, argv); -} - -// This overloaded version can be used on Arduino/embedded platforms where -// there is no argc/argv. -GTEST_API_ void InitGoogleMock() { - // Since Arduino doesn't have a command line, fake out the argc/argv arguments - int argc = 1; - const auto arg0 = "dummy"; - char* argv0 = const_cast<char*>(arg0); - char** argv = &argv0; - - internal::InitGoogleMockImpl(&argc, argv); -} - -} // namespace testing diff --git a/3rdParty/googletest/googlemock/src/gmock_main.cc b/3rdParty/googletest/googlemock/src/gmock_main.cc deleted file mode 100644 index 98611b935350d88c8921f2cc9bd785193e78ac6b..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googlemock/src/gmock_main.cc +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#include <iostream> -#include "gmock/gmock.h" -#include "gtest/gtest.h" - -#ifdef ARDUINO -void setup() { - // Since Google Mock depends on Google Test, InitGoogleMock() is - // also responsible for initializing Google Test. Therefore there's - // no need for calling testing::InitGoogleTest() separately. - testing::InitGoogleMock(); -} -void loop() { RUN_ALL_TESTS(); } -#else - -// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which -// causes a link error when _tmain is defined in a static library and UNICODE -// is enabled. For this reason instead of _tmain, main function is used on -// Windows. See the following link to track the current status of this bug: -// https://web.archive.org/web/20170912203238/connect.microsoft.com/VisualStudio/feedback/details/394464/wmain-link-error-in-the-static-library -// // NOLINT -#if GTEST_OS_WINDOWS_MOBILE -# include <tchar.h> // NOLINT - -GTEST_API_ int _tmain(int argc, TCHAR** argv) { -#else -GTEST_API_ int main(int argc, char** argv) { -#endif // GTEST_OS_WINDOWS_MOBILE - std::cout << "Running main() from gmock_main.cc\n"; - // Since Google Mock depends on Google Test, InitGoogleMock() is - // also responsible for initializing Google Test. Therefore there's - // no need for calling testing::InitGoogleTest() separately. - testing::InitGoogleMock(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/3rdParty/googletest/googletest/CMakeLists.txt b/3rdParty/googletest/googletest/CMakeLists.txt deleted file mode 100644 index 0ef01d22e7216988d86f728a27309d6494e36b1c..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/CMakeLists.txt +++ /dev/null @@ -1,328 +0,0 @@ -######################################################################## -# Note: CMake support is community-based. The maintainers do not use CMake -# internally. -# -# CMake build script for Google Test. -# -# To run the tests for Google Test itself on Linux, use 'make test' or -# ctest. You can select which tests to run using 'ctest -R regex'. -# For more options, run 'ctest --help'. - -# When other libraries are using a shared version of runtime libraries, -# Google Test also has to use one. -option( - gtest_force_shared_crt - "Use shared (DLL) run-time lib even when Google Test is built as static lib." - OFF) - -option(gtest_build_tests "Build all of gtest's own tests." OFF) - -option(gtest_build_samples "Build gtest's sample programs." OFF) - -option(gtest_disable_pthreads "Disable uses of pthreads in gtest." OFF) - -option( - gtest_hide_internal_symbols - "Build gtest with internal symbols hidden in shared libraries." - OFF) - -# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build(). -include(cmake/hermetic_build.cmake OPTIONAL) - -if (COMMAND pre_project_set_up_hermetic_build) - pre_project_set_up_hermetic_build() -endif() - -######################################################################## -# -# Project-wide settings - -# Name of the project. -# -# CMake files in this project can refer to the root source directory -# as ${gtest_SOURCE_DIR} and to the root binary directory as -# ${gtest_BINARY_DIR}. -# Language "C" is required for find_package(Threads). - -# Project version: - -if (CMAKE_VERSION VERSION_LESS 3.0) - project(gtest CXX C) - set(PROJECT_VERSION ${GOOGLETEST_VERSION}) -else() - cmake_policy(SET CMP0048 NEW) - project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) -endif() -cmake_minimum_required(VERSION 2.8.12) - -if (POLICY CMP0063) # Visibility - cmake_policy(SET CMP0063 NEW) -endif (POLICY CMP0063) - -if (COMMAND set_up_hermetic_build) - set_up_hermetic_build() -endif() - -# These commands only run if this is the main project -if(CMAKE_PROJECT_NAME STREQUAL "gtest" OR CMAKE_PROJECT_NAME STREQUAL "googletest-distribution") - - # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to - # make it prominent in the GUI. - option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) - -else() - - mark_as_advanced( - gtest_force_shared_crt - gtest_build_tests - gtest_build_samples - gtest_disable_pthreads - gtest_hide_internal_symbols) - -endif() - - -if (gtest_hide_internal_symbols) - set(CMAKE_CXX_VISIBILITY_PRESET hidden) - set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) -endif() - -# Define helper functions and macros used by Google Test. -include(cmake/internal_utils.cmake) - -config_compiler_and_linker() # Defined in internal_utils.cmake. - -# Create the CMake package file descriptors. -if (INSTALL_GTEST) - include(CMakePackageConfigHelpers) - set(cmake_package_name GTest) - set(targets_export_name ${cmake_package_name}Targets CACHE INTERNAL "") - set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated" CACHE INTERNAL "") - set(cmake_files_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${cmake_package_name}") - set(version_file "${generated_dir}/${cmake_package_name}ConfigVersion.cmake") - write_basic_package_version_file(${version_file} VERSION ${GOOGLETEST_VERSION} COMPATIBILITY AnyNewerVersion) - install(EXPORT ${targets_export_name} - NAMESPACE ${cmake_package_name}:: - DESTINATION ${cmake_files_install_dir}) - set(config_file "${generated_dir}/${cmake_package_name}Config.cmake") - configure_package_config_file("${gtest_SOURCE_DIR}/cmake/Config.cmake.in" - "${config_file}" INSTALL_DESTINATION ${cmake_files_install_dir}) - install(FILES ${version_file} ${config_file} - DESTINATION ${cmake_files_install_dir}) -endif() - -# Where Google Test's .h files can be found. -set(gtest_build_include_dirs - "${gtest_SOURCE_DIR}/include" - "${gtest_SOURCE_DIR}") -include_directories(${gtest_build_include_dirs}) - -######################################################################## -# -# Defines the gtest & gtest_main libraries. User tests should link -# with one of them. - -# Google Test libraries. We build them using more strict warnings than what -# are used for other targets, to ensure that gtest can be compiled by a user -# aggressive about warnings. -cxx_library(gtest "${cxx_strict}" src/gtest-all.cc) -cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc) -# If the CMake version supports it, attach header directory information -# to the targets for when we are part of a parent build (ie being pulled -# in via add_subdirectory() rather than being a standalone build). -if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") - target_include_directories(gtest SYSTEM INTERFACE - "$<BUILD_INTERFACE:${gtest_build_include_dirs}>" - "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>") - target_include_directories(gtest_main SYSTEM INTERFACE - "$<BUILD_INTERFACE:${gtest_build_include_dirs}>" - "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>") -endif() -target_link_libraries(gtest_main PUBLIC gtest) - -######################################################################## -# -# Install rules -install_project(gtest gtest_main) - -######################################################################## -# -# Samples on how to link user tests with gtest or gtest_main. -# -# They are not built by default. To build them, set the -# gtest_build_samples option to ON. You can do it by running ccmake -# or specifying the -Dgtest_build_samples=ON flag when running cmake. - -if (gtest_build_samples) - cxx_executable(sample1_unittest samples gtest_main samples/sample1.cc) - cxx_executable(sample2_unittest samples gtest_main samples/sample2.cc) - cxx_executable(sample3_unittest samples gtest_main) - cxx_executable(sample4_unittest samples gtest_main samples/sample4.cc) - cxx_executable(sample5_unittest samples gtest_main samples/sample1.cc) - cxx_executable(sample6_unittest samples gtest_main) - cxx_executable(sample7_unittest samples gtest_main) - cxx_executable(sample8_unittest samples gtest_main) - cxx_executable(sample9_unittest samples gtest) - cxx_executable(sample10_unittest samples gtest) -endif() - -######################################################################## -# -# Google Test's own tests. -# -# You can skip this section if you aren't interested in testing -# Google Test itself. -# -# The tests are not built by default. To build them, set the -# gtest_build_tests option to ON. You can do it by running ccmake -# or specifying the -Dgtest_build_tests=ON flag when running cmake. - -if (gtest_build_tests) - # This must be set in the root directory for the tests to be run by - # 'make test' or ctest. - enable_testing() - - if (WIN32) - file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1" - CONTENT -"$project_bin = \"${CMAKE_BINARY_DIR}/bin/$<CONFIG>\" -$env:Path = \"$project_bin;$env:Path\" -& $args") - elseif (MINGW OR CYGWIN) - file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1" - CONTENT -"$project_bin = (cygpath --windows ${CMAKE_BINARY_DIR}/bin) -$env:Path = \"$project_bin;$env:Path\" -& $args") - endif() - - ############################################################ - # C++ tests built with standard compiler flags. - - cxx_test(googletest-death-test-test gtest_main) - cxx_test(gtest_environment_test gtest) - cxx_test(googletest-filepath-test gtest_main) - cxx_test(googletest-listener-test gtest_main) - cxx_test(gtest_main_unittest gtest_main) - cxx_test(googletest-message-test gtest_main) - cxx_test(gtest_no_test_unittest gtest) - cxx_test(googletest-options-test gtest_main) - cxx_test(googletest-param-test-test gtest - test/googletest-param-test2-test.cc) - cxx_test(googletest-port-test gtest_main) - cxx_test(gtest_pred_impl_unittest gtest_main) - cxx_test(gtest_premature_exit_test gtest - test/gtest_premature_exit_test.cc) - cxx_test(googletest-printers-test gtest_main) - cxx_test(gtest_prod_test gtest_main - test/production.cc) - cxx_test(gtest_repeat_test gtest) - cxx_test(gtest_sole_header_test gtest_main) - cxx_test(gtest_stress_test gtest) - cxx_test(googletest-test-part-test gtest_main) - cxx_test(gtest_throw_on_failure_ex_test gtest) - cxx_test(gtest-typed-test_test gtest_main - test/gtest-typed-test2_test.cc) - cxx_test(gtest_unittest gtest_main) - cxx_test(gtest-unittest-api_test gtest) - cxx_test(gtest_skip_in_environment_setup_test gtest_main) - cxx_test(gtest_skip_test gtest_main) - - ############################################################ - # C++ tests built with non-standard compiler flags. - - # MSVC 7.1 does not support STL with exceptions disabled. - if (NOT MSVC OR MSVC_VERSION GREATER 1310) - cxx_library(gtest_no_exception "${cxx_no_exception}" - src/gtest-all.cc) - cxx_library(gtest_main_no_exception "${cxx_no_exception}" - src/gtest-all.cc src/gtest_main.cc) - endif() - cxx_library(gtest_main_no_rtti "${cxx_no_rtti}" - src/gtest-all.cc src/gtest_main.cc) - - cxx_test_with_flags(gtest-death-test_ex_nocatch_test - "${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=0" - gtest test/googletest-death-test_ex_test.cc) - cxx_test_with_flags(gtest-death-test_ex_catch_test - "${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=1" - gtest test/googletest-death-test_ex_test.cc) - - cxx_test_with_flags(gtest_no_rtti_unittest "${cxx_no_rtti}" - gtest_main_no_rtti test/gtest_unittest.cc) - - cxx_shared_library(gtest_dll "${cxx_default}" - src/gtest-all.cc src/gtest_main.cc) - - cxx_executable_with_flags(gtest_dll_test_ "${cxx_default}" - gtest_dll test/gtest_all_test.cc) - set_target_properties(gtest_dll_test_ - PROPERTIES - COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") - - ############################################################ - # Python tests. - - cxx_executable(googletest-break-on-failure-unittest_ test gtest) - py_test(googletest-break-on-failure-unittest) - - py_test(gtest_skip_environment_check_output_test) - - # Visual Studio .NET 2003 does not support STL with exceptions disabled. - if (NOT MSVC OR MSVC_VERSION GREATER 1310) # 1310 is Visual Studio .NET 2003 - cxx_executable_with_flags( - googletest-catch-exceptions-no-ex-test_ - "${cxx_no_exception}" - gtest_main_no_exception - test/googletest-catch-exceptions-test_.cc) - endif() - - cxx_executable_with_flags( - googletest-catch-exceptions-ex-test_ - "${cxx_exception}" - gtest_main - test/googletest-catch-exceptions-test_.cc) - py_test(googletest-catch-exceptions-test) - - cxx_executable(googletest-color-test_ test gtest) - py_test(googletest-color-test) - - cxx_executable(googletest-env-var-test_ test gtest) - py_test(googletest-env-var-test) - - cxx_executable(googletest-filter-unittest_ test gtest) - py_test(googletest-filter-unittest) - - cxx_executable(gtest_help_test_ test gtest_main) - py_test(gtest_help_test) - - cxx_executable(googletest-list-tests-unittest_ test gtest) - py_test(googletest-list-tests-unittest) - - cxx_executable(googletest-output-test_ test gtest) - py_test(googletest-output-test --no_stacktrace_support) - - cxx_executable(googletest-shuffle-test_ test gtest) - py_test(googletest-shuffle-test) - - # MSVC 7.1 does not support STL with exceptions disabled. - if (NOT MSVC OR MSVC_VERSION GREATER 1310) - cxx_executable(googletest-throw-on-failure-test_ test gtest_no_exception) - set_target_properties(googletest-throw-on-failure-test_ - PROPERTIES - COMPILE_FLAGS "${cxx_no_exception}") - py_test(googletest-throw-on-failure-test) - endif() - - cxx_executable(googletest-uninitialized-test_ test gtest) - py_test(googletest-uninitialized-test) - - cxx_executable(gtest_xml_outfile1_test_ test gtest_main) - cxx_executable(gtest_xml_outfile2_test_ test gtest_main) - py_test(gtest_xml_outfiles_test) - py_test(googletest-json-outfiles-test) - - cxx_executable(gtest_xml_output_unittest_ test gtest) - py_test(gtest_xml_output_unittest --no_stacktrace_support) - py_test(googletest-json-output-unittest --no_stacktrace_support) -endif() diff --git a/3rdParty/googletest/googletest/CONTRIBUTORS b/3rdParty/googletest/googletest/CONTRIBUTORS deleted file mode 100644 index feae2fc04410dc308e464aa256fe1f2d31edc988..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/CONTRIBUTORS +++ /dev/null @@ -1,37 +0,0 @@ -# This file contains a list of people who've made non-trivial -# contribution to the Google C++ Testing Framework project. People -# who commit code to the project are encouraged to add their names -# here. Please keep the list sorted by first names. - -Ajay Joshi <jaj@google.com> -Balázs Dán <balazs.dan@gmail.com> -Bharat Mediratta <bharat@menalto.com> -Chandler Carruth <chandlerc@google.com> -Chris Prince <cprince@google.com> -Chris Taylor <taylorc@google.com> -Dan Egnor <egnor@google.com> -Eric Roman <eroman@chromium.org> -Hady Zalek <hady.zalek@gmail.com> -Jeffrey Yasskin <jyasskin@google.com> -Jói Sigurðsson <joi@google.com> -Keir Mierle <mierle@gmail.com> -Keith Ray <keith.ray@gmail.com> -Kenton Varda <kenton@google.com> -Manuel Klimek <klimek@google.com> -Markus Heule <markus.heule@gmail.com> -Mika Raento <mikie@iki.fi> -Miklós Fazekas <mfazekas@szemafor.com> -Pasi Valminen <pasi.valminen@gmail.com> -Patrick Hanna <phanna@google.com> -Patrick Riley <pfr@google.com> -Peter Kaminski <piotrk@google.com> -Preston Jackson <preston.a.jackson@gmail.com> -Rainer Klaffenboeck <rainer.klaffenboeck@dynatrace.com> -Russ Cox <rsc@google.com> -Russ Rufer <russ@pentad.com> -Sean Mcafee <eefacm@gmail.com> -Sigurður Ãsgeirsson <siggi@google.com> -Tracy Bialik <tracy@pentad.com> -Vadim Berman <vadimb@google.com> -Vlad Losev <vladl@google.com> -Zhanyong Wan <wan@google.com> diff --git a/3rdParty/googletest/googletest/LICENSE b/3rdParty/googletest/googletest/LICENSE deleted file mode 100644 index 1941a11f8ce94389160b458927a29ba217542818..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2008, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/3rdParty/googletest/googletest/README.md b/3rdParty/googletest/googletest/README.md deleted file mode 100644 index 766ddc1e074dca76dcb6db03785fe9bf2924641e..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/README.md +++ /dev/null @@ -1,244 +0,0 @@ -### Generic Build Instructions - -#### Setup - -To build Google Test and your tests that use it, you need to tell your build -system where to find its headers and source files. The exact way to do it -depends on which build system you use, and is usually straightforward. - -### Build with CMake - -Google Test comes with a CMake build script ( -[CMakeLists.txt](https://github.com/google/googletest/blob/master/CMakeLists.txt)) -that can be used on a wide range of platforms ("C" stands for cross-platform.). -If you don't have CMake installed already, you can download it for free from -<http://www.cmake.org/>. - -CMake works by generating native makefiles or build projects that can be used in -the compiler environment of your choice. You can either build Google Test as a -standalone project or it can be incorporated into an existing CMake build for -another project. - -#### Standalone CMake Project - -When building Google Test as a standalone project, the typical workflow starts -with: - - mkdir mybuild # Create a directory to hold the build output. - cd mybuild - cmake ${GTEST_DIR} # Generate native build scripts. - -If you want to build Google Test's samples, you should replace the last command -with - - cmake -Dgtest_build_samples=ON ${GTEST_DIR} - -If you are on a \*nix system, you should now see a Makefile in the current -directory. Just type 'make' to build gtest. - -If you use Windows and have Visual Studio installed, a `gtest.sln` file and -several `.vcproj` files will be created. You can then build them using Visual -Studio. - -On Mac OS X with Xcode installed, a `.xcodeproj` file will be generated. - -#### Incorporating Into An Existing CMake Project - -If you want to use gtest in a project which already uses CMake, then a more -robust and flexible approach is to build gtest as part of that project directly. -This is done by making the GoogleTest source code available to the main build -and adding it using CMake's `add_subdirectory()` command. This has the -significant advantage that the same compiler and linker settings are used -between gtest and the rest of your project, so issues associated with using -incompatible libraries (eg debug/release), etc. are avoided. This is -particularly useful on Windows. Making GoogleTest's source code available to the -main build can be done a few different ways: - -* Download the GoogleTest source code manually and place it at a known - location. This is the least flexible approach and can make it more difficult - to use with continuous integration systems, etc. -* Embed the GoogleTest source code as a direct copy in the main project's - source tree. This is often the simplest approach, but is also the hardest to - keep up to date. Some organizations may not permit this method. -* Add GoogleTest as a git submodule or equivalent. This may not always be - possible or appropriate. Git submodules, for example, have their own set of - advantages and drawbacks. -* Use CMake to download GoogleTest as part of the build's configure step. This - is just a little more complex, but doesn't have the limitations of the other - methods. - -The last of the above methods is implemented with a small piece of CMake code in -a separate file (e.g. `CMakeLists.txt.in`) which is copied to the build area and -then invoked as a sub-build _during the CMake stage_. That directory is then -pulled into the main build with `add_subdirectory()`. For example: - -New file `CMakeLists.txt.in`: - -```cmake -cmake_minimum_required(VERSION 2.8.2) - -project(googletest-download NONE) - -include(ExternalProject) -ExternalProject_Add(googletest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG master - SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src" - BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" -) -``` - -Existing build's `CMakeLists.txt`: - -```cmake -# Download and unpack googletest at configure time -configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt) -execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . - RESULT_VARIABLE result - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download ) -if(result) - message(FATAL_ERROR "CMake step for googletest failed: ${result}") -endif() -execute_process(COMMAND ${CMAKE_COMMAND} --build . - RESULT_VARIABLE result - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download ) -if(result) - message(FATAL_ERROR "Build step for googletest failed: ${result}") -endif() - -# Prevent overriding the parent project's compiler/linker -# settings on Windows -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - -# Add googletest directly to our build. This defines -# the gtest and gtest_main targets. -add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src - ${CMAKE_CURRENT_BINARY_DIR}/googletest-build - EXCLUDE_FROM_ALL) - -# The gtest/gtest_main targets carry header search path -# dependencies automatically when using CMake 2.8.11 or -# later. Otherwise we have to add them here ourselves. -if (CMAKE_VERSION VERSION_LESS 2.8.11) - include_directories("${gtest_SOURCE_DIR}/include") -endif() - -# Now simply link against gtest or gtest_main as needed. Eg -add_executable(example example.cpp) -target_link_libraries(example gtest_main) -add_test(NAME example_test COMMAND example) -``` - -Note that this approach requires CMake 2.8.2 or later due to its use of the -`ExternalProject_Add()` command. The above technique is discussed in more detail -in [this separate article](http://crascit.com/2015/07/25/cmake-gtest/) which -also contains a link to a fully generalized implementation of the technique. - -##### Visual Studio Dynamic vs Static Runtimes - -By default, new Visual Studio projects link the C runtimes dynamically but -Google Test links them statically. This will generate an error that looks -something like the following: gtest.lib(gtest-all.obj) : error LNK2038: mismatch -detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value -'MDd_DynamicDebug' in main.obj - -Google Test already has a CMake option for this: `gtest_force_shared_crt` - -Enabling this option will make gtest link the runtimes dynamically too, and -match the project in which it is included. - -#### C++ Standard Version - -An environment that supports C++11 is required in order to successfully build -Google Test. One way to ensure this is to specify the standard in the top-level -project, for example by using the `set(CMAKE_CXX_STANDARD 11)` command. If this -is not feasible, for example in a C project using Google Test for validation, -then it can be specified by adding it to the options for cmake via the -`DCMAKE_CXX_FLAGS` option. - -### Tweaking Google Test - -Google Test can be used in diverse environments. The default configuration may -not work (or may not work well) out of the box in some environments. However, -you can easily tweak Google Test by defining control macros on the compiler -command line. Generally, these macros are named like `GTEST_XYZ` and you define -them to either 1 or 0 to enable or disable a certain feature. - -We list the most frequently used macros below. For a complete list, see file -[include/gtest/internal/gtest-port.h](https://github.com/google/googletest/blob/master/googletest/include/gtest/internal/gtest-port.h). - -### Multi-threaded Tests - -Google Test is thread-safe where the pthread library is available. After -`#include "gtest/gtest.h"`, you can check the -`GTEST_IS_THREADSAFE` macro to see whether this is the case (yes if the macro is -`#defined` to 1, no if it's undefined.). - -If Google Test doesn't correctly detect whether pthread is available in your -environment, you can force it with - - -DGTEST_HAS_PTHREAD=1 - -or - - -DGTEST_HAS_PTHREAD=0 - -When Google Test uses pthread, you may need to add flags to your compiler and/or -linker to select the pthread library, or you'll get link errors. If you use the -CMake script or the deprecated Autotools script, this is taken care of for you. -If you use your own build script, you'll need to read your compiler and linker's -manual to figure out what flags to add. - -### As a Shared Library (DLL) - -Google Test is compact, so most users can build and link it as a static library -for the simplicity. You can choose to use Google Test as a shared library (known -as a DLL on Windows) if you prefer. - -To compile *gtest* as a shared library, add - - -DGTEST_CREATE_SHARED_LIBRARY=1 - -to the compiler flags. You'll also need to tell the linker to produce a shared -library instead - consult your linker's manual for how to do it. - -To compile your *tests* that use the gtest shared library, add - - -DGTEST_LINKED_AS_SHARED_LIBRARY=1 - -to the compiler flags. - -Note: while the above steps aren't technically necessary today when using some -compilers (e.g. GCC), they may become necessary in the future, if we decide to -improve the speed of loading the library (see -<http://gcc.gnu.org/wiki/Visibility> for details). Therefore you are recommended -to always add the above flags when using Google Test as a shared library. -Otherwise a future release of Google Test may break your build script. - -### Avoiding Macro Name Clashes - -In C++, macros don't obey namespaces. Therefore two libraries that both define a -macro of the same name will clash if you `#include` both definitions. In case a -Google Test macro clashes with another library, you can force Google Test to -rename its macro to avoid the conflict. - -Specifically, if both Google Test and some other code define macro FOO, you can -add - - -DGTEST_DONT_DEFINE_FOO=1 - -to the compiler flags to tell Google Test to change the macro's name from `FOO` -to `GTEST_FOO`. Currently `FOO` can be `FAIL`, `SUCCEED`, or `TEST`. For -example, with `-DGTEST_DONT_DEFINE_TEST=1`, you'll need to write - - GTEST_TEST(SomeTest, DoesThis) { ... } - -instead of - - TEST(SomeTest, DoesThis) { ... } - -in order to define a test. diff --git a/3rdParty/googletest/googletest/cmake/Config.cmake.in b/3rdParty/googletest/googletest/cmake/Config.cmake.in deleted file mode 100644 index 12be4498b1a079681a129e31b17c57e18126a63a..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/cmake/Config.cmake.in +++ /dev/null @@ -1,9 +0,0 @@ -@PACKAGE_INIT@ -include(CMakeFindDependencyMacro) -if (@GTEST_HAS_PTHREAD@) - set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@) - find_dependency(Threads) -endif() - -include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") -check_required_components("@project_name@") diff --git a/3rdParty/googletest/googletest/cmake/gtest.pc.in b/3rdParty/googletest/googletest/cmake/gtest.pc.in deleted file mode 100644 index 9aae29e267f01ef79f1aee7f6d1d3acbb3b1ec35..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/cmake/gtest.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=${pcfiledir}/../.. -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ - -Name: gtest -Description: GoogleTest (without main() function) -Version: @PROJECT_VERSION@ -URL: https://github.com/google/googletest -Libs: -L${libdir} -lgtest @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ diff --git a/3rdParty/googletest/googletest/cmake/gtest_main.pc.in b/3rdParty/googletest/googletest/cmake/gtest_main.pc.in deleted file mode 100644 index 915f2973af799dc035f3d966d3d601c6c3109a50..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/cmake/gtest_main.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=${pcfiledir}/../.. -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ - -Name: gtest_main -Description: GoogleTest (with main() function) -Version: @PROJECT_VERSION@ -URL: https://github.com/google/googletest -Requires: gtest -Libs: -L${libdir} -lgtest_main @CMAKE_THREAD_LIBS_INIT@ -Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ diff --git a/3rdParty/googletest/googletest/cmake/internal_utils.cmake b/3rdParty/googletest/googletest/cmake/internal_utils.cmake deleted file mode 100644 index 2f70f0b084b99e3a231e3d01593c0dee9c7228b6..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/cmake/internal_utils.cmake +++ /dev/null @@ -1,358 +0,0 @@ -# Defines functions and macros useful for building Google Test and -# Google Mock. -# -# Note: -# -# - This file will be run twice when building Google Mock (once via -# Google Test's CMakeLists.txt, and once via Google Mock's). -# Therefore it shouldn't have any side effects other than defining -# the functions and macros. -# -# - The functions/macros defined in this file may depend on Google -# Test and Google Mock's option() definitions, and thus must be -# called *after* the options have been defined. - -if (POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) -endif (POLICY CMP0054) - -# Tweaks CMake's default compiler/linker settings to suit Google Test's needs. -# -# This must be a macro(), as inside a function string() can only -# update variables in the function scope. -macro(fix_default_compiler_settings_) - if (MSVC) - # For MSVC, CMake sets certain flags to defaults we want to override. - # This replacement code is taken from sample in the CMake Wiki at - # https://gitlab.kitware.com/cmake/community/wikis/FAQ#dynamic-replace. - foreach (flag_var - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if (NOT BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt) - # When Google Test is built as a shared library, it should also use - # shared runtime libraries. Otherwise, it may end up with multiple - # copies of runtime library data in different modules, resulting in - # hard-to-find crashes. When it is built as a static library, it is - # preferable to use CRT as static libraries, as we don't have to rely - # on CRT DLLs being available. CMake always defaults to using shared - # CRT libraries, so we override that default here. - string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}") - endif() - - # We prefer more strict warning checking for building Google Test. - # Replaces /W3 with /W4 in defaults. - string(REPLACE "/W3" "/W4" ${flag_var} "${${flag_var}}") - - # Prevent D9025 warning for targets that have exception handling - # turned off (/EHs-c- flag). Where required, exceptions are explicitly - # re-enabled using the cxx_exception_flags variable. - string(REPLACE "/EHsc" "" ${flag_var} "${${flag_var}}") - endforeach() - endif() -endmacro() - -# Defines the compiler/linker flags used to build Google Test and -# Google Mock. You can tweak these definitions to suit your need. A -# variable's value is empty before it's explicitly assigned to. -macro(config_compiler_and_linker) - # Note: pthreads on MinGW is not supported, even if available - # instead, we use windows threading primitives - unset(GTEST_HAS_PTHREAD) - if (NOT gtest_disable_pthreads AND NOT MINGW) - # Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT. - find_package(Threads) - if (CMAKE_USE_PTHREADS_INIT) - set(GTEST_HAS_PTHREAD ON) - endif() - endif() - - fix_default_compiler_settings_() - if (MSVC) - # Newlines inside flags variables break CMake's NMake generator. - # TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds. - set(cxx_base_flags "-GS -W4 -WX -wd4251 -wd4275 -nologo -J -Zi") - set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32") - set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN") - set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1") - set(cxx_no_exception_flags "-EHs-c- -D_HAS_EXCEPTIONS=0") - set(cxx_no_rtti_flags "-GR-") - # Suppress "unreachable code" warning - # http://stackoverflow.com/questions/3232669 explains the issue. - set(cxx_base_flags "${cxx_base_flags} -wd4702") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(cxx_base_flags "-Wall -Wshadow -Werror -Wconversion") - set(cxx_exception_flags "-fexceptions") - set(cxx_no_exception_flags "-fno-exceptions") - set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls") - set(cxx_no_rtti_flags "-fno-rtti") - elseif (CMAKE_COMPILER_IS_GNUCXX) - set(cxx_base_flags "-Wall -Wshadow -Werror") - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0) - set(cxx_base_flags "${cxx_base_flags} -Wno-error=dangling-else") - endif() - set(cxx_exception_flags "-fexceptions") - set(cxx_no_exception_flags "-fno-exceptions") - # Until version 4.3.2, GCC doesn't define a macro to indicate - # whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI - # explicitly. - set(cxx_no_rtti_flags "-fno-rtti -DGTEST_HAS_RTTI=0") - set(cxx_strict_flags - "-Wextra -Wno-unused-parameter -Wno-missing-field-initializers") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") - set(cxx_exception_flags "-features=except") - # Sun Pro doesn't provide macros to indicate whether exceptions and - # RTTI are enabled, so we define GTEST_HAS_* explicitly. - set(cxx_no_exception_flags "-features=no%except -DGTEST_HAS_EXCEPTIONS=0") - set(cxx_no_rtti_flags "-features=no%rtti -DGTEST_HAS_RTTI=0") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "VisualAge" OR - CMAKE_CXX_COMPILER_ID STREQUAL "XL") - # CMake 2.8 changes Visual Age's compiler ID to "XL". - set(cxx_exception_flags "-qeh") - set(cxx_no_exception_flags "-qnoeh") - # Until version 9.0, Visual Age doesn't define a macro to indicate - # whether RTTI is enabled. Therefore we define GTEST_HAS_RTTI - # explicitly. - set(cxx_no_rtti_flags "-qnortti -DGTEST_HAS_RTTI=0") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "HP") - set(cxx_base_flags "-AA -mt") - set(cxx_exception_flags "-DGTEST_HAS_EXCEPTIONS=1") - set(cxx_no_exception_flags "+noeh -DGTEST_HAS_EXCEPTIONS=0") - # RTTI can not be disabled in HP aCC compiler. - set(cxx_no_rtti_flags "") - endif() - - # The pthreads library is available and allowed? - if (DEFINED GTEST_HAS_PTHREAD) - set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=1") - else() - set(GTEST_HAS_PTHREAD_MACRO "-DGTEST_HAS_PTHREAD=0") - endif() - set(cxx_base_flags "${cxx_base_flags} ${GTEST_HAS_PTHREAD_MACRO}") - - # For building gtest's own tests and samples. - set(cxx_exception "${cxx_base_flags} ${cxx_exception_flags}") - set(cxx_no_exception - "${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_no_exception_flags}") - set(cxx_default "${cxx_exception}") - set(cxx_no_rtti "${cxx_default} ${cxx_no_rtti_flags}") - - # For building the gtest libraries. - set(cxx_strict "${cxx_default} ${cxx_strict_flags}") -endmacro() - -# Defines the gtest & gtest_main libraries. User tests should link -# with one of them. -function(cxx_library_with_type name type cxx_flags) - # type can be either STATIC or SHARED to denote a static or shared library. - # ARGN refers to additional arguments after 'cxx_flags'. - add_library(${name} ${type} ${ARGN}) - set_target_properties(${name} - PROPERTIES - COMPILE_FLAGS "${cxx_flags}") - # Generate debug library name with a postfix. - set_target_properties(${name} - PROPERTIES - DEBUG_POSTFIX "d") - # Set the output directory for build artifacts - set_target_properties(${name} - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" - PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - # make PDBs match library name - get_target_property(pdb_debug_postfix ${name} DEBUG_POSTFIX) - set_target_properties(${name} - PROPERTIES - PDB_NAME "${name}" - PDB_NAME_DEBUG "${name}${pdb_debug_postfix}" - COMPILE_PDB_NAME "${name}" - COMPILE_PDB_NAME_DEBUG "${name}${pdb_debug_postfix}") - - if (BUILD_SHARED_LIBS OR type STREQUAL "SHARED") - set_target_properties(${name} - PROPERTIES - COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1") - if (NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11") - target_compile_definitions(${name} INTERFACE - $<INSTALL_INTERFACE:GTEST_LINKED_AS_SHARED_LIBRARY=1>) - endif() - endif() - if (DEFINED GTEST_HAS_PTHREAD) - if ("${CMAKE_VERSION}" VERSION_LESS "3.1.0") - set(threads_spec ${CMAKE_THREAD_LIBS_INIT}) - else() - set(threads_spec Threads::Threads) - endif() - target_link_libraries(${name} PUBLIC ${threads_spec}) - endif() -endfunction() - -######################################################################## -# -# Helper functions for creating build targets. - -function(cxx_shared_library name cxx_flags) - cxx_library_with_type(${name} SHARED "${cxx_flags}" ${ARGN}) -endfunction() - -function(cxx_library name cxx_flags) - cxx_library_with_type(${name} "" "${cxx_flags}" ${ARGN}) -endfunction() - -# cxx_executable_with_flags(name cxx_flags libs srcs...) -# -# creates a named C++ executable that depends on the given libraries and -# is built from the given source files with the given compiler flags. -function(cxx_executable_with_flags name cxx_flags libs) - add_executable(${name} ${ARGN}) - if (MSVC) - # BigObj required for tests. - set(cxx_flags "${cxx_flags} -bigobj") - endif() - if (cxx_flags) - set_target_properties(${name} - PROPERTIES - COMPILE_FLAGS "${cxx_flags}") - endif() - if (BUILD_SHARED_LIBS) - set_target_properties(${name} - PROPERTIES - COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") - endif() - # To support mixing linking in static and dynamic libraries, link each - # library in with an extra call to target_link_libraries. - foreach (lib "${libs}") - target_link_libraries(${name} ${lib}) - endforeach() -endfunction() - -# cxx_executable(name dir lib srcs...) -# -# creates a named target that depends on the given libs and is built -# from the given source files. dir/name.cc is implicitly included in -# the source file list. -function(cxx_executable name dir libs) - cxx_executable_with_flags( - ${name} "${cxx_default}" "${libs}" "${dir}/${name}.cc" ${ARGN}) -endfunction() - -# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE. -find_package(PythonInterp) - -# cxx_test_with_flags(name cxx_flags libs srcs...) -# -# creates a named C++ test that depends on the given libs and is built -# from the given source files with the given compiler flags. -function(cxx_test_with_flags name cxx_flags libs) - cxx_executable_with_flags(${name} "${cxx_flags}" "${libs}" ${ARGN}) - if (WIN32 OR MINGW) - add_test(NAME ${name} - COMMAND "powershell" "-Command" "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1" "$<TARGET_FILE:${name}>") - else() - add_test(NAME ${name} - COMMAND "$<TARGET_FILE:${name}>") - endif() -endfunction() - -# cxx_test(name libs srcs...) -# -# creates a named test target that depends on the given libs and is -# built from the given source files. Unlike cxx_test_with_flags, -# test/name.cc is already implicitly included in the source file list. -function(cxx_test name libs) - cxx_test_with_flags("${name}" "${cxx_default}" "${libs}" - "test/${name}.cc" ${ARGN}) -endfunction() - -# py_test(name) -# -# creates a Python test with the given name whose main module is in -# test/name.py. It does nothing if Python is not installed. -function(py_test name) - if (PYTHONINTERP_FOUND) - if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 3.1) - if (CMAKE_CONFIGURATION_TYPES) - # Multi-configuration build generators as for Visual Studio save - # output in a subdirectory of CMAKE_CURRENT_BINARY_DIR (Debug, - # Release etc.), so we have to provide it here. - if (WIN32 OR MINGW) - add_test(NAME ${name} - COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1 - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG> ${ARGN}) - else() - add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG> ${ARGN}) - endif() - else (CMAKE_CONFIGURATION_TYPES) - # Single-configuration build generators like Makefile generators - # don't have subdirs below CMAKE_CURRENT_BINARY_DIR. - if (WIN32 OR MINGW) - add_test(NAME ${name} - COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1 - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR} ${ARGN}) - else() - add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR} ${ARGN}) - endif() - endif (CMAKE_CONFIGURATION_TYPES) - else() - # ${CMAKE_CURRENT_BINARY_DIR} is known at configuration time, so we can - # directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known - # only at ctest runtime (by calling ctest -c <Configuration>), so - # we have to escape $ to delay variable substitution here. - if (WIN32 OR MINGW) - add_test(NAME ${name} - COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1 - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE} ${ARGN}) - else() - add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE} ${ARGN}) - endif() - endif() - endif(PYTHONINTERP_FOUND) -endfunction() - -# install_project(targets...) -# -# Installs the specified targets and configures the associated pkgconfig files. -function(install_project) - if(INSTALL_GTEST) - install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") - # Install the project targets. - install(TARGETS ${ARGN} - EXPORT ${targets_export_name} - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") - if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - # Install PDBs - foreach(t ${ARGN}) - get_target_property(t_pdb_name ${t} COMPILE_PDB_NAME) - get_target_property(t_pdb_name_debug ${t} COMPILE_PDB_NAME_DEBUG) - get_target_property(t_pdb_output_directory ${t} PDB_OUTPUT_DIRECTORY) - install(FILES - "${t_pdb_output_directory}/\${CMAKE_INSTALL_CONFIG_NAME}/$<$<CONFIG:Debug>:${t_pdb_name_debug}>$<$<NOT:$<CONFIG:Debug>>:${t_pdb_name}>.pdb" - DESTINATION ${CMAKE_INSTALL_LIBDIR} - OPTIONAL) - endforeach() - endif() - # Configure and install pkgconfig files. - foreach(t ${ARGN}) - set(configured_pc "${generated_dir}/${t}.pc") - configure_file("${PROJECT_SOURCE_DIR}/cmake/${t}.pc.in" - "${configured_pc}" @ONLY) - install(FILES "${configured_pc}" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - endforeach() - endif() -endfunction() diff --git a/3rdParty/googletest/googletest/cmake/libgtest.la.in b/3rdParty/googletest/googletest/cmake/libgtest.la.in deleted file mode 100644 index 840c83885f989a02a0ab3073a74e65bc04ddf3e1..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/cmake/libgtest.la.in +++ /dev/null @@ -1,21 +0,0 @@ -# libgtest.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 - -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# Names of this library. -library_names='libgtest.so' - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='@CMAKE_INSTALL_FULL_LIBDIR@' diff --git a/3rdParty/googletest/googletest/include/gtest/gtest-death-test.h b/3rdParty/googletest/googletest/include/gtest/gtest-death-test.h deleted file mode 100644 index dc878ffbb3ae56a2b91b930b71a7cbb503222a46..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/gtest-death-test.h +++ /dev/null @@ -1,343 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// The Google C++ Testing and Mocking Framework (Google Test) -// -// This header file defines the public API for death tests. It is -// #included by gtest.h so a user doesn't need to include this -// directly. -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ -#define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ - -#include "gtest/internal/gtest-death-test-internal.h" - -namespace testing { - -// This flag controls the style of death tests. Valid values are "threadsafe", -// meaning that the death test child process will re-execute the test binary -// from the start, running only a single death test, or "fast", -// meaning that the child process will execute the test logic immediately -// after forking. -GTEST_DECLARE_string_(death_test_style); - -#if GTEST_HAS_DEATH_TEST - -namespace internal { - -// Returns a Boolean value indicating whether the caller is currently -// executing in the context of the death test child process. Tools such as -// Valgrind heap checkers may need this to modify their behavior in death -// tests. IMPORTANT: This is an internal utility. Using it may break the -// implementation of death tests. User code MUST NOT use it. -GTEST_API_ bool InDeathTestChild(); - -} // namespace internal - -// The following macros are useful for writing death tests. - -// Here's what happens when an ASSERT_DEATH* or EXPECT_DEATH* is -// executed: -// -// 1. It generates a warning if there is more than one active -// thread. This is because it's safe to fork() or clone() only -// when there is a single thread. -// -// 2. The parent process clone()s a sub-process and runs the death -// test in it; the sub-process exits with code 0 at the end of the -// death test, if it hasn't exited already. -// -// 3. The parent process waits for the sub-process to terminate. -// -// 4. The parent process checks the exit code and error message of -// the sub-process. -// -// Examples: -// -// ASSERT_DEATH(server.SendMessage(56, "Hello"), "Invalid port number"); -// for (int i = 0; i < 5; i++) { -// EXPECT_DEATH(server.ProcessRequest(i), -// "Invalid request .* in ProcessRequest()") -// << "Failed to die on request " << i; -// } -// -// ASSERT_EXIT(server.ExitNow(), ::testing::ExitedWithCode(0), "Exiting"); -// -// bool KilledBySIGHUP(int exit_code) { -// return WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGHUP; -// } -// -// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!"); -// -// On the regular expressions used in death tests: -// -// GOOGLETEST_CM0005 DO NOT DELETE -// On POSIX-compliant systems (*nix), we use the <regex.h> library, -// which uses the POSIX extended regex syntax. -// -// On other platforms (e.g. Windows or Mac), we only support a simple regex -// syntax implemented as part of Google Test. This limited -// implementation should be enough most of the time when writing -// death tests; though it lacks many features you can find in PCRE -// or POSIX extended regex syntax. For example, we don't support -// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and -// repetition count ("x{5,7}"), among others. -// -// Below is the syntax that we do support. We chose it to be a -// subset of both PCRE and POSIX extended regex, so it's easy to -// learn wherever you come from. In the following: 'A' denotes a -// literal character, period (.), or a single \\ escape sequence; -// 'x' and 'y' denote regular expressions; 'm' and 'n' are for -// natural numbers. -// -// c matches any literal character c -// \\d matches any decimal digit -// \\D matches any character that's not a decimal digit -// \\f matches \f -// \\n matches \n -// \\r matches \r -// \\s matches any ASCII whitespace, including \n -// \\S matches any character that's not a whitespace -// \\t matches \t -// \\v matches \v -// \\w matches any letter, _, or decimal digit -// \\W matches any character that \\w doesn't match -// \\c matches any literal character c, which must be a punctuation -// . matches any single character except \n -// A? matches 0 or 1 occurrences of A -// A* matches 0 or many occurrences of A -// A+ matches 1 or many occurrences of A -// ^ matches the beginning of a string (not that of each line) -// $ matches the end of a string (not that of each line) -// xy matches x followed by y -// -// If you accidentally use PCRE or POSIX extended regex features -// not implemented by us, you will get a run-time failure. In that -// case, please try to rewrite your regular expression within the -// above syntax. -// -// This implementation is *not* meant to be as highly tuned or robust -// as a compiled regex library, but should perform well enough for a -// death test, which already incurs significant overhead by launching -// a child process. -// -// Known caveats: -// -// A "threadsafe" style death test obtains the path to the test -// program from argv[0] and re-executes it in the sub-process. For -// simplicity, the current implementation doesn't search the PATH -// when launching the sub-process. This means that the user must -// invoke the test program via a path that contains at least one -// path separator (e.g. path/to/foo_test and -// /absolute/path/to/bar_test are fine, but foo_test is not). This -// is rarely a problem as people usually don't put the test binary -// directory in PATH. -// - -// Asserts that a given statement causes the program to exit, with an -// integer exit status that satisfies predicate, and emitting error output -// that matches regex. -# define ASSERT_EXIT(statement, predicate, regex) \ - GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_) - -// Like ASSERT_EXIT, but continues on to successive tests in the -// test suite, if any: -# define EXPECT_EXIT(statement, predicate, regex) \ - GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_) - -// Asserts that a given statement causes the program to exit, either by -// explicitly exiting with a nonzero exit code or being killed by a -// signal, and emitting error output that matches regex. -# define ASSERT_DEATH(statement, regex) \ - ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) - -// Like ASSERT_DEATH, but continues on to successive tests in the -// test suite, if any: -# define EXPECT_DEATH(statement, regex) \ - EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex) - -// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*: - -// Tests that an exit code describes a normal exit with a given exit code. -class GTEST_API_ ExitedWithCode { - public: - explicit ExitedWithCode(int exit_code); - bool operator()(int exit_status) const; - private: - // No implementation - assignment is unsupported. - void operator=(const ExitedWithCode& other); - - const int exit_code_; -}; - -# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA -// Tests that an exit code describes an exit due to termination by a -// given signal. -// GOOGLETEST_CM0006 DO NOT DELETE -class GTEST_API_ KilledBySignal { - public: - explicit KilledBySignal(int signum); - bool operator()(int exit_status) const; - private: - const int signum_; -}; -# endif // !GTEST_OS_WINDOWS - -// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode. -// The death testing framework causes this to have interesting semantics, -// since the sideeffects of the call are only visible in opt mode, and not -// in debug mode. -// -// In practice, this can be used to test functions that utilize the -// LOG(DFATAL) macro using the following style: -// -// int DieInDebugOr12(int* sideeffect) { -// if (sideeffect) { -// *sideeffect = 12; -// } -// LOG(DFATAL) << "death"; -// return 12; -// } -// -// TEST(TestSuite, TestDieOr12WorksInDgbAndOpt) { -// int sideeffect = 0; -// // Only asserts in dbg. -// EXPECT_DEBUG_DEATH(DieInDebugOr12(&sideeffect), "death"); -// -// #ifdef NDEBUG -// // opt-mode has sideeffect visible. -// EXPECT_EQ(12, sideeffect); -// #else -// // dbg-mode no visible sideeffect. -// EXPECT_EQ(0, sideeffect); -// #endif -// } -// -// This will assert that DieInDebugReturn12InOpt() crashes in debug -// mode, usually due to a DCHECK or LOG(DFATAL), but returns the -// appropriate fallback value (12 in this case) in opt mode. If you -// need to test that a function has appropriate side-effects in opt -// mode, include assertions against the side-effects. A general -// pattern for this is: -// -// EXPECT_DEBUG_DEATH({ -// // Side-effects here will have an effect after this statement in -// // opt mode, but none in debug mode. -// EXPECT_EQ(12, DieInDebugOr12(&sideeffect)); -// }, "death"); -// -# ifdef NDEBUG - -# define EXPECT_DEBUG_DEATH(statement, regex) \ - GTEST_EXECUTE_STATEMENT_(statement, regex) - -# define ASSERT_DEBUG_DEATH(statement, regex) \ - GTEST_EXECUTE_STATEMENT_(statement, regex) - -# else - -# define EXPECT_DEBUG_DEATH(statement, regex) \ - EXPECT_DEATH(statement, regex) - -# define ASSERT_DEBUG_DEATH(statement, regex) \ - ASSERT_DEATH(statement, regex) - -# endif // NDEBUG for EXPECT_DEBUG_DEATH -#endif // GTEST_HAS_DEATH_TEST - -// This macro is used for implementing macros such as -// EXPECT_DEATH_IF_SUPPORTED and ASSERT_DEATH_IF_SUPPORTED on systems where -// death tests are not supported. Those macros must compile on such systems -// if and only if EXPECT_DEATH and ASSERT_DEATH compile with the same parameters -// on systems that support death tests. This allows one to write such a macro on -// a system that does not support death tests and be sure that it will compile -// on a death-test supporting system. It is exposed publicly so that systems -// that have death-tests with stricter requirements than GTEST_HAS_DEATH_TEST -// can write their own equivalent of EXPECT_DEATH_IF_SUPPORTED and -// ASSERT_DEATH_IF_SUPPORTED. -// -// Parameters: -// statement - A statement that a macro such as EXPECT_DEATH would test -// for program termination. This macro has to make sure this -// statement is compiled but not executed, to ensure that -// EXPECT_DEATH_IF_SUPPORTED compiles with a certain -// parameter if and only if EXPECT_DEATH compiles with it. -// regex - A regex that a macro such as EXPECT_DEATH would use to test -// the output of statement. This parameter has to be -// compiled but not evaluated by this macro, to ensure that -// this macro only accepts expressions that a macro such as -// EXPECT_DEATH would accept. -// terminator - Must be an empty statement for EXPECT_DEATH_IF_SUPPORTED -// and a return statement for ASSERT_DEATH_IF_SUPPORTED. -// This ensures that ASSERT_DEATH_IF_SUPPORTED will not -// compile inside functions where ASSERT_DEATH doesn't -// compile. -// -// The branch that has an always false condition is used to ensure that -// statement and regex are compiled (and thus syntactically correct) but -// never executed. The unreachable code macro protects the terminator -// statement from generating an 'unreachable code' warning in case -// statement unconditionally returns or throws. The Message constructor at -// the end allows the syntax of streaming additional messages into the -// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH. -# define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ - GTEST_LOG_(WARNING) \ - << "Death tests are not supported on this platform.\n" \ - << "Statement '" #statement "' cannot be verified."; \ - } else if (::testing::internal::AlwaysFalse()) { \ - ::testing::internal::RE::PartialMatch(".*", (regex)); \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - terminator; \ - } else \ - ::testing::Message() - -// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and -// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if -// death tests are supported; otherwise they just issue a warning. This is -// useful when you are combining death test assertions with normal test -// assertions in one test. -#if GTEST_HAS_DEATH_TEST -# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ - EXPECT_DEATH(statement, regex) -# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ - ASSERT_DEATH(statement, regex) -#else -# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \ - GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, ) -# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \ - GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return) -#endif - -} // namespace testing - -#endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/gtest-matchers.h b/3rdParty/googletest/googletest/include/gtest/gtest-matchers.h deleted file mode 100644 index 9de6c2e10a20da85aeb95887d6095a2b8010b4a5..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/gtest-matchers.h +++ /dev/null @@ -1,750 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// The Google C++ Testing and Mocking Framework (Google Test) -// -// This file implements just enough of the matcher interface to allow -// EXPECT_DEATH and friends to accept a matcher argument. - -// IWYU pragma: private, include "testing/base/public/gunit.h" -// IWYU pragma: friend third_party/googletest/googlemock/.* -// IWYU pragma: friend third_party/googletest/googletest/.* - -#ifndef GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_ -#define GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_ - -#include <memory> -#include <ostream> -#include <string> -#include <type_traits> - -#include "gtest/gtest-printers.h" -#include "gtest/internal/gtest-internal.h" -#include "gtest/internal/gtest-port.h" - -// MSVC warning C5046 is new as of VS2017 version 15.8. -#if defined(_MSC_VER) && _MSC_VER >= 1915 -#define GTEST_MAYBE_5046_ 5046 -#else -#define GTEST_MAYBE_5046_ -#endif - -GTEST_DISABLE_MSC_WARNINGS_PUSH_( - 4251 GTEST_MAYBE_5046_ /* class A needs to have dll-interface to be used by - clients of class B */ - /* Symbol involving type with internal linkage not defined */) - -namespace testing { - -// To implement a matcher Foo for type T, define: -// 1. a class FooMatcherImpl that implements the -// MatcherInterface<T> interface, and -// 2. a factory function that creates a Matcher<T> object from a -// FooMatcherImpl*. -// -// The two-level delegation design makes it possible to allow a user -// to write "v" instead of "Eq(v)" where a Matcher is expected, which -// is impossible if we pass matchers by pointers. It also eases -// ownership management as Matcher objects can now be copied like -// plain values. - -// MatchResultListener is an abstract class. Its << operator can be -// used by a matcher to explain why a value matches or doesn't match. -// -class MatchResultListener { - public: - // Creates a listener object with the given underlying ostream. The - // listener does not own the ostream, and does not dereference it - // in the constructor or destructor. - explicit MatchResultListener(::std::ostream* os) : stream_(os) {} - virtual ~MatchResultListener() = 0; // Makes this class abstract. - - // Streams x to the underlying ostream; does nothing if the ostream - // is NULL. - template <typename T> - MatchResultListener& operator<<(const T& x) { - if (stream_ != nullptr) *stream_ << x; - return *this; - } - - // Returns the underlying ostream. - ::std::ostream* stream() { return stream_; } - - // Returns true if and only if the listener is interested in an explanation - // of the match result. A matcher's MatchAndExplain() method can use - // this information to avoid generating the explanation when no one - // intends to hear it. - bool IsInterested() const { return stream_ != nullptr; } - - private: - ::std::ostream* const stream_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener); -}; - -inline MatchResultListener::~MatchResultListener() { -} - -// An instance of a subclass of this knows how to describe itself as a -// matcher. -class MatcherDescriberInterface { - public: - virtual ~MatcherDescriberInterface() {} - - // Describes this matcher to an ostream. The function should print - // a verb phrase that describes the property a value matching this - // matcher should have. The subject of the verb phrase is the value - // being matched. For example, the DescribeTo() method of the Gt(7) - // matcher prints "is greater than 7". - virtual void DescribeTo(::std::ostream* os) const = 0; - - // Describes the negation of this matcher to an ostream. For - // example, if the description of this matcher is "is greater than - // 7", the negated description could be "is not greater than 7". - // You are not required to override this when implementing - // MatcherInterface, but it is highly advised so that your matcher - // can produce good error messages. - virtual void DescribeNegationTo(::std::ostream* os) const { - *os << "not ("; - DescribeTo(os); - *os << ")"; - } -}; - -// The implementation of a matcher. -template <typename T> -class MatcherInterface : public MatcherDescriberInterface { - public: - // Returns true if and only if the matcher matches x; also explains the - // match result to 'listener' if necessary (see the next paragraph), in - // the form of a non-restrictive relative clause ("which ...", - // "whose ...", etc) that describes x. For example, the - // MatchAndExplain() method of the Pointee(...) matcher should - // generate an explanation like "which points to ...". - // - // Implementations of MatchAndExplain() should add an explanation of - // the match result *if and only if* they can provide additional - // information that's not already present (or not obvious) in the - // print-out of x and the matcher's description. Whether the match - // succeeds is not a factor in deciding whether an explanation is - // needed, as sometimes the caller needs to print a failure message - // when the match succeeds (e.g. when the matcher is used inside - // Not()). - // - // For example, a "has at least 10 elements" matcher should explain - // what the actual element count is, regardless of the match result, - // as it is useful information to the reader; on the other hand, an - // "is empty" matcher probably only needs to explain what the actual - // size is when the match fails, as it's redundant to say that the - // size is 0 when the value is already known to be empty. - // - // You should override this method when defining a new matcher. - // - // It's the responsibility of the caller (Google Test) to guarantee - // that 'listener' is not NULL. This helps to simplify a matcher's - // implementation when it doesn't care about the performance, as it - // can talk to 'listener' without checking its validity first. - // However, in order to implement dummy listeners efficiently, - // listener->stream() may be NULL. - virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0; - - // Inherits these methods from MatcherDescriberInterface: - // virtual void DescribeTo(::std::ostream* os) const = 0; - // virtual void DescribeNegationTo(::std::ostream* os) const; -}; - -namespace internal { - -// Converts a MatcherInterface<T> to a MatcherInterface<const T&>. -template <typename T> -class MatcherInterfaceAdapter : public MatcherInterface<const T&> { - public: - explicit MatcherInterfaceAdapter(const MatcherInterface<T>* impl) - : impl_(impl) {} - ~MatcherInterfaceAdapter() override { delete impl_; } - - void DescribeTo(::std::ostream* os) const override { impl_->DescribeTo(os); } - - void DescribeNegationTo(::std::ostream* os) const override { - impl_->DescribeNegationTo(os); - } - - bool MatchAndExplain(const T& x, - MatchResultListener* listener) const override { - return impl_->MatchAndExplain(x, listener); - } - - private: - const MatcherInterface<T>* const impl_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(MatcherInterfaceAdapter); -}; - -struct AnyEq { - template <typename A, typename B> - bool operator()(const A& a, const B& b) const { return a == b; } -}; -struct AnyNe { - template <typename A, typename B> - bool operator()(const A& a, const B& b) const { return a != b; } -}; -struct AnyLt { - template <typename A, typename B> - bool operator()(const A& a, const B& b) const { return a < b; } -}; -struct AnyGt { - template <typename A, typename B> - bool operator()(const A& a, const B& b) const { return a > b; } -}; -struct AnyLe { - template <typename A, typename B> - bool operator()(const A& a, const B& b) const { return a <= b; } -}; -struct AnyGe { - template <typename A, typename B> - bool operator()(const A& a, const B& b) const { return a >= b; } -}; - -// A match result listener that ignores the explanation. -class DummyMatchResultListener : public MatchResultListener { - public: - DummyMatchResultListener() : MatchResultListener(nullptr) {} - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener); -}; - -// A match result listener that forwards the explanation to a given -// ostream. The difference between this and MatchResultListener is -// that the former is concrete. -class StreamMatchResultListener : public MatchResultListener { - public: - explicit StreamMatchResultListener(::std::ostream* os) - : MatchResultListener(os) {} - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener); -}; - -// An internal class for implementing Matcher<T>, which will derive -// from it. We put functionalities common to all Matcher<T> -// specializations here to avoid code duplication. -template <typename T> -class MatcherBase { - public: - // Returns true if and only if the matcher matches x; also explains the - // match result to 'listener'. - bool MatchAndExplain(const T& x, MatchResultListener* listener) const { - return impl_->MatchAndExplain(x, listener); - } - - // Returns true if and only if this matcher matches x. - bool Matches(const T& x) const { - DummyMatchResultListener dummy; - return MatchAndExplain(x, &dummy); - } - - // Describes this matcher to an ostream. - void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } - - // Describes the negation of this matcher to an ostream. - void DescribeNegationTo(::std::ostream* os) const { - impl_->DescribeNegationTo(os); - } - - // Explains why x matches, or doesn't match, the matcher. - void ExplainMatchResultTo(const T& x, ::std::ostream* os) const { - StreamMatchResultListener listener(os); - MatchAndExplain(x, &listener); - } - - // Returns the describer for this matcher object; retains ownership - // of the describer, which is only guaranteed to be alive when - // this matcher object is alive. - const MatcherDescriberInterface* GetDescriber() const { - return impl_.get(); - } - - protected: - MatcherBase() {} - - // Constructs a matcher from its implementation. - explicit MatcherBase(const MatcherInterface<const T&>* impl) : impl_(impl) {} - - template <typename U> - explicit MatcherBase( - const MatcherInterface<U>* impl, - typename std::enable_if<!std::is_same<U, const U&>::value>::type* = - nullptr) - : impl_(new internal::MatcherInterfaceAdapter<U>(impl)) {} - - MatcherBase(const MatcherBase&) = default; - MatcherBase& operator=(const MatcherBase&) = default; - MatcherBase(MatcherBase&&) = default; - MatcherBase& operator=(MatcherBase&&) = default; - - virtual ~MatcherBase() {} - - private: - std::shared_ptr<const MatcherInterface<const T&>> impl_; -}; - -} // namespace internal - -// A Matcher<T> is a copyable and IMMUTABLE (except by assignment) -// object that can check whether a value of type T matches. The -// implementation of Matcher<T> is just a std::shared_ptr to const -// MatcherInterface<T>. Don't inherit from Matcher! -template <typename T> -class Matcher : public internal::MatcherBase<T> { - public: - // Constructs a null matcher. Needed for storing Matcher objects in STL - // containers. A default-constructed matcher is not yet initialized. You - // cannot use it until a valid value has been assigned to it. - explicit Matcher() {} // NOLINT - - // Constructs a matcher from its implementation. - explicit Matcher(const MatcherInterface<const T&>* impl) - : internal::MatcherBase<T>(impl) {} - - template <typename U> - explicit Matcher( - const MatcherInterface<U>* impl, - typename std::enable_if<!std::is_same<U, const U&>::value>::type* = - nullptr) - : internal::MatcherBase<T>(impl) {} - - // Implicit constructor here allows people to write - // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes - Matcher(T value); // NOLINT -}; - -// The following two specializations allow the user to write str -// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string -// matcher is expected. -template <> -class GTEST_API_ Matcher<const std::string&> - : public internal::MatcherBase<const std::string&> { - public: - Matcher() {} - - explicit Matcher(const MatcherInterface<const std::string&>* impl) - : internal::MatcherBase<const std::string&>(impl) {} - - // Allows the user to write str instead of Eq(str) sometimes, where - // str is a std::string object. - Matcher(const std::string& s); // NOLINT - - // Allows the user to write "foo" instead of Eq("foo") sometimes. - Matcher(const char* s); // NOLINT -}; - -template <> -class GTEST_API_ Matcher<std::string> - : public internal::MatcherBase<std::string> { - public: - Matcher() {} - - explicit Matcher(const MatcherInterface<const std::string&>* impl) - : internal::MatcherBase<std::string>(impl) {} - explicit Matcher(const MatcherInterface<std::string>* impl) - : internal::MatcherBase<std::string>(impl) {} - - // Allows the user to write str instead of Eq(str) sometimes, where - // str is a string object. - Matcher(const std::string& s); // NOLINT - - // Allows the user to write "foo" instead of Eq("foo") sometimes. - Matcher(const char* s); // NOLINT -}; - -#if GTEST_HAS_ABSL -// The following two specializations allow the user to write str -// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view -// matcher is expected. -template <> -class GTEST_API_ Matcher<const absl::string_view&> - : public internal::MatcherBase<const absl::string_view&> { - public: - Matcher() {} - - explicit Matcher(const MatcherInterface<const absl::string_view&>* impl) - : internal::MatcherBase<const absl::string_view&>(impl) {} - - // Allows the user to write str instead of Eq(str) sometimes, where - // str is a std::string object. - Matcher(const std::string& s); // NOLINT - - // Allows the user to write "foo" instead of Eq("foo") sometimes. - Matcher(const char* s); // NOLINT - - // Allows the user to pass absl::string_views directly. - Matcher(absl::string_view s); // NOLINT -}; - -template <> -class GTEST_API_ Matcher<absl::string_view> - : public internal::MatcherBase<absl::string_view> { - public: - Matcher() {} - - explicit Matcher(const MatcherInterface<const absl::string_view&>* impl) - : internal::MatcherBase<absl::string_view>(impl) {} - explicit Matcher(const MatcherInterface<absl::string_view>* impl) - : internal::MatcherBase<absl::string_view>(impl) {} - - // Allows the user to write str instead of Eq(str) sometimes, where - // str is a std::string object. - Matcher(const std::string& s); // NOLINT - - // Allows the user to write "foo" instead of Eq("foo") sometimes. - Matcher(const char* s); // NOLINT - - // Allows the user to pass absl::string_views directly. - Matcher(absl::string_view s); // NOLINT -}; -#endif // GTEST_HAS_ABSL - -// Prints a matcher in a human-readable format. -template <typename T> -std::ostream& operator<<(std::ostream& os, const Matcher<T>& matcher) { - matcher.DescribeTo(&os); - return os; -} - -// The PolymorphicMatcher class template makes it easy to implement a -// polymorphic matcher (i.e. a matcher that can match values of more -// than one type, e.g. Eq(n) and NotNull()). -// -// To define a polymorphic matcher, a user should provide an Impl -// class that has a DescribeTo() method and a DescribeNegationTo() -// method, and define a member function (or member function template) -// -// bool MatchAndExplain(const Value& value, -// MatchResultListener* listener) const; -// -// See the definition of NotNull() for a complete example. -template <class Impl> -class PolymorphicMatcher { - public: - explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {} - - // Returns a mutable reference to the underlying matcher - // implementation object. - Impl& mutable_impl() { return impl_; } - - // Returns an immutable reference to the underlying matcher - // implementation object. - const Impl& impl() const { return impl_; } - - template <typename T> - operator Matcher<T>() const { - return Matcher<T>(new MonomorphicImpl<const T&>(impl_)); - } - - private: - template <typename T> - class MonomorphicImpl : public MatcherInterface<T> { - public: - explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} - - virtual void DescribeTo(::std::ostream* os) const { impl_.DescribeTo(os); } - - virtual void DescribeNegationTo(::std::ostream* os) const { - impl_.DescribeNegationTo(os); - } - - virtual bool MatchAndExplain(T x, MatchResultListener* listener) const { - return impl_.MatchAndExplain(x, listener); - } - - private: - const Impl impl_; - }; - - Impl impl_; -}; - -// Creates a matcher from its implementation. -// DEPRECATED: Especially in the generic code, prefer: -// Matcher<T>(new MyMatcherImpl<const T&>(...)); -// -// MakeMatcher may create a Matcher that accepts its argument by value, which -// leads to unnecessary copies & lack of support for non-copyable types. -template <typename T> -inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) { - return Matcher<T>(impl); -} - -// Creates a polymorphic matcher from its implementation. This is -// easier to use than the PolymorphicMatcher<Impl> constructor as it -// doesn't require you to explicitly write the template argument, e.g. -// -// MakePolymorphicMatcher(foo); -// vs -// PolymorphicMatcher<TypeOfFoo>(foo); -template <class Impl> -inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) { - return PolymorphicMatcher<Impl>(impl); -} - -namespace internal { -// Implements a matcher that compares a given value with a -// pre-supplied value using one of the ==, <=, <, etc, operators. The -// two values being compared don't have to have the same type. -// -// The matcher defined here is polymorphic (for example, Eq(5) can be -// used to match an int, a short, a double, etc). Therefore we use -// a template type conversion operator in the implementation. -// -// The following template definition assumes that the Rhs parameter is -// a "bare" type (i.e. neither 'const T' nor 'T&'). -template <typename D, typename Rhs, typename Op> -class ComparisonBase { - public: - explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {} - template <typename Lhs> - operator Matcher<Lhs>() const { - return Matcher<Lhs>(new Impl<const Lhs&>(rhs_)); - } - - private: - template <typename T> - static const T& Unwrap(const T& v) { return v; } - template <typename T> - static const T& Unwrap(std::reference_wrapper<T> v) { return v; } - - template <typename Lhs, typename = Rhs> - class Impl : public MatcherInterface<Lhs> { - public: - explicit Impl(const Rhs& rhs) : rhs_(rhs) {} - bool MatchAndExplain(Lhs lhs, - MatchResultListener* /* listener */) const override { - return Op()(lhs, Unwrap(rhs_)); - } - void DescribeTo(::std::ostream* os) const override { - *os << D::Desc() << " "; - UniversalPrint(Unwrap(rhs_), os); - } - void DescribeNegationTo(::std::ostream* os) const override { - *os << D::NegatedDesc() << " "; - UniversalPrint(Unwrap(rhs_), os); - } - - private: - Rhs rhs_; - }; - Rhs rhs_; -}; - -template <typename Rhs> -class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq> { - public: - explicit EqMatcher(const Rhs& rhs) - : ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq>(rhs) { } - static const char* Desc() { return "is equal to"; } - static const char* NegatedDesc() { return "isn't equal to"; } -}; -template <typename Rhs> -class NeMatcher : public ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe> { - public: - explicit NeMatcher(const Rhs& rhs) - : ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe>(rhs) { } - static const char* Desc() { return "isn't equal to"; } - static const char* NegatedDesc() { return "is equal to"; } -}; -template <typename Rhs> -class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt> { - public: - explicit LtMatcher(const Rhs& rhs) - : ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt>(rhs) { } - static const char* Desc() { return "is <"; } - static const char* NegatedDesc() { return "isn't <"; } -}; -template <typename Rhs> -class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt> { - public: - explicit GtMatcher(const Rhs& rhs) - : ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt>(rhs) { } - static const char* Desc() { return "is >"; } - static const char* NegatedDesc() { return "isn't >"; } -}; -template <typename Rhs> -class LeMatcher : public ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe> { - public: - explicit LeMatcher(const Rhs& rhs) - : ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe>(rhs) { } - static const char* Desc() { return "is <="; } - static const char* NegatedDesc() { return "isn't <="; } -}; -template <typename Rhs> -class GeMatcher : public ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe> { - public: - explicit GeMatcher(const Rhs& rhs) - : ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe>(rhs) { } - static const char* Desc() { return "is >="; } - static const char* NegatedDesc() { return "isn't >="; } -}; - -// Implements polymorphic matchers MatchesRegex(regex) and -// ContainsRegex(regex), which can be used as a Matcher<T> as long as -// T can be converted to a string. -class MatchesRegexMatcher { - public: - MatchesRegexMatcher(const RE* regex, bool full_match) - : regex_(regex), full_match_(full_match) {} - -#if GTEST_HAS_ABSL - bool MatchAndExplain(const absl::string_view& s, - MatchResultListener* listener) const { - return MatchAndExplain(std::string(s), listener); - } -#endif // GTEST_HAS_ABSL - - // Accepts pointer types, particularly: - // const char* - // char* - // const wchar_t* - // wchar_t* - template <typename CharType> - bool MatchAndExplain(CharType* s, MatchResultListener* listener) const { - return s != nullptr && MatchAndExplain(std::string(s), listener); - } - - // Matches anything that can convert to std::string. - // - // This is a template, not just a plain function with const std::string&, - // because absl::string_view has some interfering non-explicit constructors. - template <class MatcheeStringType> - bool MatchAndExplain(const MatcheeStringType& s, - MatchResultListener* /* listener */) const { - const std::string& s2(s); - return full_match_ ? RE::FullMatch(s2, *regex_) - : RE::PartialMatch(s2, *regex_); - } - - void DescribeTo(::std::ostream* os) const { - *os << (full_match_ ? "matches" : "contains") << " regular expression "; - UniversalPrinter<std::string>::Print(regex_->pattern(), os); - } - - void DescribeNegationTo(::std::ostream* os) const { - *os << "doesn't " << (full_match_ ? "match" : "contain") - << " regular expression "; - UniversalPrinter<std::string>::Print(regex_->pattern(), os); - } - - private: - const std::shared_ptr<const RE> regex_; - const bool full_match_; -}; -} // namespace internal - -// Matches a string that fully matches regular expression 'regex'. -// The matcher takes ownership of 'regex'. -inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex( - const internal::RE* regex) { - return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true)); -} -inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex( - const std::string& regex) { - return MatchesRegex(new internal::RE(regex)); -} - -// Matches a string that contains regular expression 'regex'. -// The matcher takes ownership of 'regex'. -inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex( - const internal::RE* regex) { - return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false)); -} -inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex( - const std::string& regex) { - return ContainsRegex(new internal::RE(regex)); -} - -// Creates a polymorphic matcher that matches anything equal to x. -// Note: if the parameter of Eq() were declared as const T&, Eq("foo") -// wouldn't compile. -template <typename T> -inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); } - -// Constructs a Matcher<T> from a 'value' of type T. The constructed -// matcher matches any value that's equal to 'value'. -template <typename T> -Matcher<T>::Matcher(T value) { *this = Eq(value); } - -// Creates a monomorphic matcher that matches anything with type Lhs -// and equal to rhs. A user may need to use this instead of Eq(...) -// in order to resolve an overloading ambiguity. -// -// TypedEq<T>(x) is just a convenient short-hand for Matcher<T>(Eq(x)) -// or Matcher<T>(x), but more readable than the latter. -// -// We could define similar monomorphic matchers for other comparison -// operations (e.g. TypedLt, TypedGe, and etc), but decided not to do -// it yet as those are used much less than Eq() in practice. A user -// can always write Matcher<T>(Lt(5)) to be explicit about the type, -// for example. -template <typename Lhs, typename Rhs> -inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); } - -// Creates a polymorphic matcher that matches anything >= x. -template <typename Rhs> -inline internal::GeMatcher<Rhs> Ge(Rhs x) { - return internal::GeMatcher<Rhs>(x); -} - -// Creates a polymorphic matcher that matches anything > x. -template <typename Rhs> -inline internal::GtMatcher<Rhs> Gt(Rhs x) { - return internal::GtMatcher<Rhs>(x); -} - -// Creates a polymorphic matcher that matches anything <= x. -template <typename Rhs> -inline internal::LeMatcher<Rhs> Le(Rhs x) { - return internal::LeMatcher<Rhs>(x); -} - -// Creates a polymorphic matcher that matches anything < x. -template <typename Rhs> -inline internal::LtMatcher<Rhs> Lt(Rhs x) { - return internal::LtMatcher<Rhs>(x); -} - -// Creates a polymorphic matcher that matches anything != x. -template <typename Rhs> -inline internal::NeMatcher<Rhs> Ne(Rhs x) { - return internal::NeMatcher<Rhs>(x); -} -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 5046 - -#endif // GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/gtest-message.h b/3rdParty/googletest/googletest/include/gtest/gtest-message.h deleted file mode 100644 index 4a80e11e6b2db017a27271002ae54c41d29b4a26..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/gtest-message.h +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// The Google C++ Testing and Mocking Framework (Google Test) -// -// This header file defines the Message class. -// -// IMPORTANT NOTE: Due to limitation of the C++ language, we have to -// leave some internal implementation details in this header file. -// They are clearly marked by comments like this: -// -// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -// -// Such code is NOT meant to be used by a user directly, and is subject -// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user -// program! - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ -#define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ - -#include <limits> -#include <memory> - -#include "gtest/internal/gtest-port.h" - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -// Ensures that there is at least one operator<< in the global namespace. -// See Message& operator<<(...) below for why. -void operator<<(const testing::internal::Secret&, int); - -namespace testing { - -// The Message class works like an ostream repeater. -// -// Typical usage: -// -// 1. You stream a bunch of values to a Message object. -// It will remember the text in a stringstream. -// 2. Then you stream the Message object to an ostream. -// This causes the text in the Message to be streamed -// to the ostream. -// -// For example; -// -// testing::Message foo; -// foo << 1 << " != " << 2; -// std::cout << foo; -// -// will print "1 != 2". -// -// Message is not intended to be inherited from. In particular, its -// destructor is not virtual. -// -// Note that stringstream behaves differently in gcc and in MSVC. You -// can stream a NULL char pointer to it in the former, but not in the -// latter (it causes an access violation if you do). The Message -// class hides this difference by treating a NULL char pointer as -// "(null)". -class GTEST_API_ Message { - private: - // The type of basic IO manipulators (endl, ends, and flush) for - // narrow streams. - typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&); - - public: - // Constructs an empty Message. - Message(); - - // Copy constructor. - Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT - *ss_ << msg.GetString(); - } - - // Constructs a Message from a C-string. - explicit Message(const char* str) : ss_(new ::std::stringstream) { - *ss_ << str; - } - - // Streams a non-pointer value to this object. - template <typename T> - inline Message& operator <<(const T& val) { - // Some libraries overload << for STL containers. These - // overloads are defined in the global namespace instead of ::std. - // - // C++'s symbol lookup rule (i.e. Koenig lookup) says that these - // overloads are visible in either the std namespace or the global - // namespace, but not other namespaces, including the testing - // namespace which Google Test's Message class is in. - // - // To allow STL containers (and other types that has a << operator - // defined in the global namespace) to be used in Google Test - // assertions, testing::Message must access the custom << operator - // from the global namespace. With this using declaration, - // overloads of << defined in the global namespace and those - // visible via Koenig lookup are both exposed in this function. - using ::operator <<; - *ss_ << val; - return *this; - } - - // Streams a pointer value to this object. - // - // This function is an overload of the previous one. When you - // stream a pointer to a Message, this definition will be used as it - // is more specialized. (The C++ Standard, section - // [temp.func.order].) If you stream a non-pointer, then the - // previous definition will be used. - // - // The reason for this overload is that streaming a NULL pointer to - // ostream is undefined behavior. Depending on the compiler, you - // may get "0", "(nil)", "(null)", or an access violation. To - // ensure consistent result across compilers, we always treat NULL - // as "(null)". - template <typename T> - inline Message& operator <<(T* const& pointer) { // NOLINT - if (pointer == nullptr) { - *ss_ << "(null)"; - } else { - *ss_ << pointer; - } - return *this; - } - - // Since the basic IO manipulators are overloaded for both narrow - // and wide streams, we have to provide this specialized definition - // of operator <<, even though its body is the same as the - // templatized version above. Without this definition, streaming - // endl or other basic IO manipulators to Message will confuse the - // compiler. - Message& operator <<(BasicNarrowIoManip val) { - *ss_ << val; - return *this; - } - - // Instead of 1/0, we want to see true/false for bool values. - Message& operator <<(bool b) { - return *this << (b ? "true" : "false"); - } - - // These two overloads allow streaming a wide C string to a Message - // using the UTF-8 encoding. - Message& operator <<(const wchar_t* wide_c_str); - Message& operator <<(wchar_t* wide_c_str); - -#if GTEST_HAS_STD_WSTRING - // Converts the given wide string to a narrow string using the UTF-8 - // encoding, and streams the result to this Message object. - Message& operator <<(const ::std::wstring& wstr); -#endif // GTEST_HAS_STD_WSTRING - - // Gets the text streamed to this object so far as an std::string. - // Each '\0' character in the buffer is replaced with "\\0". - // - // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. - std::string GetString() const; - - private: - // We'll hold the text streamed to this object here. - const std::unique_ptr< ::std::stringstream> ss_; - - // We declare (but don't implement) this to prevent the compiler - // from implementing the assignment operator. - void operator=(const Message&); -}; - -// Streams a Message to an ostream. -inline std::ostream& operator <<(std::ostream& os, const Message& sb) { - return os << sb.GetString(); -} - -namespace internal { - -// Converts a streamable value to an std::string. A NULL pointer is -// converted to "(null)". When the input value is a ::string, -// ::std::string, ::wstring, or ::std::wstring object, each NUL -// character in it is replaced with "\\0". -template <typename T> -std::string StreamableToString(const T& streamable) { - return (Message() << streamable).GetString(); -} - -} // namespace internal -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/gtest-param-test.h b/3rdParty/googletest/googletest/include/gtest/gtest-param-test.h deleted file mode 100644 index c2e6eae3d8326e5553598c65ae85a4ed085281e0..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/gtest-param-test.h +++ /dev/null @@ -1,503 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Macros and functions for implementing parameterized tests -// in Google C++ Testing and Mocking Framework (Google Test) -// -// This file is generated by a SCRIPT. DO NOT EDIT BY HAND! -// -// GOOGLETEST_CM0001 DO NOT DELETE -#ifndef GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ -#define GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ - - -// Value-parameterized tests allow you to test your code with different -// parameters without writing multiple copies of the same test. -// -// Here is how you use value-parameterized tests: - -#if 0 - -// To write value-parameterized tests, first you should define a fixture -// class. It is usually derived from testing::TestWithParam<T> (see below for -// another inheritance scheme that's sometimes useful in more complicated -// class hierarchies), where the type of your parameter values. -// TestWithParam<T> is itself derived from testing::Test. T can be any -// copyable type. If it's a raw pointer, you are responsible for managing the -// lifespan of the pointed values. - -class FooTest : public ::testing::TestWithParam<const char*> { - // You can implement all the usual class fixture members here. -}; - -// Then, use the TEST_P macro to define as many parameterized tests -// for this fixture as you want. The _P suffix is for "parameterized" -// or "pattern", whichever you prefer to think. - -TEST_P(FooTest, DoesBlah) { - // Inside a test, access the test parameter with the GetParam() method - // of the TestWithParam<T> class: - EXPECT_TRUE(foo.Blah(GetParam())); - ... -} - -TEST_P(FooTest, HasBlahBlah) { - ... -} - -// Finally, you can use INSTANTIATE_TEST_SUITE_P to instantiate the test -// case with any set of parameters you want. Google Test defines a number -// of functions for generating test parameters. They return what we call -// (surprise!) parameter generators. Here is a summary of them, which -// are all in the testing namespace: -// -// -// Range(begin, end [, step]) - Yields values {begin, begin+step, -// begin+step+step, ...}. The values do not -// include end. step defaults to 1. -// Values(v1, v2, ..., vN) - Yields values {v1, v2, ..., vN}. -// ValuesIn(container) - Yields values from a C-style array, an STL -// ValuesIn(begin,end) container, or an iterator range [begin, end). -// Bool() - Yields sequence {false, true}. -// Combine(g1, g2, ..., gN) - Yields all combinations (the Cartesian product -// for the math savvy) of the values generated -// by the N generators. -// -// For more details, see comments at the definitions of these functions below -// in this file. -// -// The following statement will instantiate tests from the FooTest test suite -// each with parameter values "meeny", "miny", and "moe". - -INSTANTIATE_TEST_SUITE_P(InstantiationName, - FooTest, - Values("meeny", "miny", "moe")); - -// To distinguish different instances of the pattern, (yes, you -// can instantiate it more than once) the first argument to the -// INSTANTIATE_TEST_SUITE_P macro is a prefix that will be added to the -// actual test suite name. Remember to pick unique prefixes for different -// instantiations. The tests from the instantiation above will have -// these names: -// -// * InstantiationName/FooTest.DoesBlah/0 for "meeny" -// * InstantiationName/FooTest.DoesBlah/1 for "miny" -// * InstantiationName/FooTest.DoesBlah/2 for "moe" -// * InstantiationName/FooTest.HasBlahBlah/0 for "meeny" -// * InstantiationName/FooTest.HasBlahBlah/1 for "miny" -// * InstantiationName/FooTest.HasBlahBlah/2 for "moe" -// -// You can use these names in --gtest_filter. -// -// This statement will instantiate all tests from FooTest again, each -// with parameter values "cat" and "dog": - -const char* pets[] = {"cat", "dog"}; -INSTANTIATE_TEST_SUITE_P(AnotherInstantiationName, FooTest, ValuesIn(pets)); - -// The tests from the instantiation above will have these names: -// -// * AnotherInstantiationName/FooTest.DoesBlah/0 for "cat" -// * AnotherInstantiationName/FooTest.DoesBlah/1 for "dog" -// * AnotherInstantiationName/FooTest.HasBlahBlah/0 for "cat" -// * AnotherInstantiationName/FooTest.HasBlahBlah/1 for "dog" -// -// Please note that INSTANTIATE_TEST_SUITE_P will instantiate all tests -// in the given test suite, whether their definitions come before or -// AFTER the INSTANTIATE_TEST_SUITE_P statement. -// -// Please also note that generator expressions (including parameters to the -// generators) are evaluated in InitGoogleTest(), after main() has started. -// This allows the user on one hand, to adjust generator parameters in order -// to dynamically determine a set of tests to run and on the other hand, -// give the user a chance to inspect the generated tests with Google Test -// reflection API before RUN_ALL_TESTS() is executed. -// -// You can see samples/sample7_unittest.cc and samples/sample8_unittest.cc -// for more examples. -// -// In the future, we plan to publish the API for defining new parameter -// generators. But for now this interface remains part of the internal -// implementation and is subject to change. -// -// -// A parameterized test fixture must be derived from testing::Test and from -// testing::WithParamInterface<T>, where T is the type of the parameter -// values. Inheriting from TestWithParam<T> satisfies that requirement because -// TestWithParam<T> inherits from both Test and WithParamInterface. In more -// complicated hierarchies, however, it is occasionally useful to inherit -// separately from Test and WithParamInterface. For example: - -class BaseTest : public ::testing::Test { - // You can inherit all the usual members for a non-parameterized test - // fixture here. -}; - -class DerivedTest : public BaseTest, public ::testing::WithParamInterface<int> { - // The usual test fixture members go here too. -}; - -TEST_F(BaseTest, HasFoo) { - // This is an ordinary non-parameterized test. -} - -TEST_P(DerivedTest, DoesBlah) { - // GetParam works just the same here as if you inherit from TestWithParam. - EXPECT_TRUE(foo.Blah(GetParam())); -} - -#endif // 0 - -#include <iterator> -#include <utility> - -#include "gtest/internal/gtest-internal.h" -#include "gtest/internal/gtest-param-util.h" -#include "gtest/internal/gtest-port.h" - -namespace testing { - -// Functions producing parameter generators. -// -// Google Test uses these generators to produce parameters for value- -// parameterized tests. When a parameterized test suite is instantiated -// with a particular generator, Google Test creates and runs tests -// for each element in the sequence produced by the generator. -// -// In the following sample, tests from test suite FooTest are instantiated -// each three times with parameter values 3, 5, and 8: -// -// class FooTest : public TestWithParam<int> { ... }; -// -// TEST_P(FooTest, TestThis) { -// } -// TEST_P(FooTest, TestThat) { -// } -// INSTANTIATE_TEST_SUITE_P(TestSequence, FooTest, Values(3, 5, 8)); -// - -// Range() returns generators providing sequences of values in a range. -// -// Synopsis: -// Range(start, end) -// - returns a generator producing a sequence of values {start, start+1, -// start+2, ..., }. -// Range(start, end, step) -// - returns a generator producing a sequence of values {start, start+step, -// start+step+step, ..., }. -// Notes: -// * The generated sequences never include end. For example, Range(1, 5) -// returns a generator producing a sequence {1, 2, 3, 4}. Range(1, 9, 2) -// returns a generator producing {1, 3, 5, 7}. -// * start and end must have the same type. That type may be any integral or -// floating-point type or a user defined type satisfying these conditions: -// * It must be assignable (have operator=() defined). -// * It must have operator+() (operator+(int-compatible type) for -// two-operand version). -// * It must have operator<() defined. -// Elements in the resulting sequences will also have that type. -// * Condition start < end must be satisfied in order for resulting sequences -// to contain any elements. -// -template <typename T, typename IncrementT> -internal::ParamGenerator<T> Range(T start, T end, IncrementT step) { - return internal::ParamGenerator<T>( - new internal::RangeGenerator<T, IncrementT>(start, end, step)); -} - -template <typename T> -internal::ParamGenerator<T> Range(T start, T end) { - return Range(start, end, 1); -} - -// ValuesIn() function allows generation of tests with parameters coming from -// a container. -// -// Synopsis: -// ValuesIn(const T (&array)[N]) -// - returns a generator producing sequences with elements from -// a C-style array. -// ValuesIn(const Container& container) -// - returns a generator producing sequences with elements from -// an STL-style container. -// ValuesIn(Iterator begin, Iterator end) -// - returns a generator producing sequences with elements from -// a range [begin, end) defined by a pair of STL-style iterators. These -// iterators can also be plain C pointers. -// -// Please note that ValuesIn copies the values from the containers -// passed in and keeps them to generate tests in RUN_ALL_TESTS(). -// -// Examples: -// -// This instantiates tests from test suite StringTest -// each with C-string values of "foo", "bar", and "baz": -// -// const char* strings[] = {"foo", "bar", "baz"}; -// INSTANTIATE_TEST_SUITE_P(StringSequence, StringTest, ValuesIn(strings)); -// -// This instantiates tests from test suite StlStringTest -// each with STL strings with values "a" and "b": -// -// ::std::vector< ::std::string> GetParameterStrings() { -// ::std::vector< ::std::string> v; -// v.push_back("a"); -// v.push_back("b"); -// return v; -// } -// -// INSTANTIATE_TEST_SUITE_P(CharSequence, -// StlStringTest, -// ValuesIn(GetParameterStrings())); -// -// -// This will also instantiate tests from CharTest -// each with parameter values 'a' and 'b': -// -// ::std::list<char> GetParameterChars() { -// ::std::list<char> list; -// list.push_back('a'); -// list.push_back('b'); -// return list; -// } -// ::std::list<char> l = GetParameterChars(); -// INSTANTIATE_TEST_SUITE_P(CharSequence2, -// CharTest, -// ValuesIn(l.begin(), l.end())); -// -template <typename ForwardIterator> -internal::ParamGenerator< - typename std::iterator_traits<ForwardIterator>::value_type> -ValuesIn(ForwardIterator begin, ForwardIterator end) { - typedef typename std::iterator_traits<ForwardIterator>::value_type ParamType; - return internal::ParamGenerator<ParamType>( - new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end)); -} - -template <typename T, size_t N> -internal::ParamGenerator<T> ValuesIn(const T (&array)[N]) { - return ValuesIn(array, array + N); -} - -template <class Container> -internal::ParamGenerator<typename Container::value_type> ValuesIn( - const Container& container) { - return ValuesIn(container.begin(), container.end()); -} - -// Values() allows generating tests from explicitly specified list of -// parameters. -// -// Synopsis: -// Values(T v1, T v2, ..., T vN) -// - returns a generator producing sequences with elements v1, v2, ..., vN. -// -// For example, this instantiates tests from test suite BarTest each -// with values "one", "two", and "three": -// -// INSTANTIATE_TEST_SUITE_P(NumSequence, -// BarTest, -// Values("one", "two", "three")); -// -// This instantiates tests from test suite BazTest each with values 1, 2, 3.5. -// The exact type of values will depend on the type of parameter in BazTest. -// -// INSTANTIATE_TEST_SUITE_P(FloatingNumbers, BazTest, Values(1, 2, 3.5)); -// -// -template <typename... T> -internal::ValueArray<T...> Values(T... v) { - return internal::ValueArray<T...>(std::move(v)...); -} - -// Bool() allows generating tests with parameters in a set of (false, true). -// -// Synopsis: -// Bool() -// - returns a generator producing sequences with elements {false, true}. -// -// It is useful when testing code that depends on Boolean flags. Combinations -// of multiple flags can be tested when several Bool()'s are combined using -// Combine() function. -// -// In the following example all tests in the test suite FlagDependentTest -// will be instantiated twice with parameters false and true. -// -// class FlagDependentTest : public testing::TestWithParam<bool> { -// virtual void SetUp() { -// external_flag = GetParam(); -// } -// } -// INSTANTIATE_TEST_SUITE_P(BoolSequence, FlagDependentTest, Bool()); -// -inline internal::ParamGenerator<bool> Bool() { - return Values(false, true); -} - -// Combine() allows the user to combine two or more sequences to produce -// values of a Cartesian product of those sequences' elements. -// -// Synopsis: -// Combine(gen1, gen2, ..., genN) -// - returns a generator producing sequences with elements coming from -// the Cartesian product of elements from the sequences generated by -// gen1, gen2, ..., genN. The sequence elements will have a type of -// std::tuple<T1, T2, ..., TN> where T1, T2, ..., TN are the types -// of elements from sequences produces by gen1, gen2, ..., genN. -// -// Combine can have up to 10 arguments. -// -// Example: -// -// This will instantiate tests in test suite AnimalTest each one with -// the parameter values tuple("cat", BLACK), tuple("cat", WHITE), -// tuple("dog", BLACK), and tuple("dog", WHITE): -// -// enum Color { BLACK, GRAY, WHITE }; -// class AnimalTest -// : public testing::TestWithParam<std::tuple<const char*, Color> > {...}; -// -// TEST_P(AnimalTest, AnimalLooksNice) {...} -// -// INSTANTIATE_TEST_SUITE_P(AnimalVariations, AnimalTest, -// Combine(Values("cat", "dog"), -// Values(BLACK, WHITE))); -// -// This will instantiate tests in FlagDependentTest with all variations of two -// Boolean flags: -// -// class FlagDependentTest -// : public testing::TestWithParam<std::tuple<bool, bool> > { -// virtual void SetUp() { -// // Assigns external_flag_1 and external_flag_2 values from the tuple. -// std::tie(external_flag_1, external_flag_2) = GetParam(); -// } -// }; -// -// TEST_P(FlagDependentTest, TestFeature1) { -// // Test your code using external_flag_1 and external_flag_2 here. -// } -// INSTANTIATE_TEST_SUITE_P(TwoBoolSequence, FlagDependentTest, -// Combine(Bool(), Bool())); -// -template <typename... Generator> -internal::CartesianProductHolder<Generator...> Combine(const Generator&... g) { - return internal::CartesianProductHolder<Generator...>(g...); -} - -#define TEST_P(test_suite_name, test_name) \ - class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ - : public test_suite_name { \ - public: \ - GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \ - virtual void TestBody(); \ - \ - private: \ - static int AddToRegistry() { \ - ::testing::UnitTest::GetInstance() \ - ->parameterized_test_registry() \ - .GetTestSuitePatternHolder<test_suite_name>( \ - #test_suite_name, \ - ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ - ->AddTestPattern( \ - GTEST_STRINGIFY_(test_suite_name), GTEST_STRINGIFY_(test_name), \ - new ::testing::internal::TestMetaFactory<GTEST_TEST_CLASS_NAME_( \ - test_suite_name, test_name)>()); \ - return 0; \ - } \ - static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \ - GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \ - test_name)); \ - }; \ - int GTEST_TEST_CLASS_NAME_(test_suite_name, \ - test_name)::gtest_registering_dummy_ = \ - GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \ - void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody() - -// The last argument to INSTANTIATE_TEST_SUITE_P allows the user to specify -// generator and an optional function or functor that generates custom test name -// suffixes based on the test parameters. Such a function or functor should -// accept one argument of type testing::TestParamInfo<class ParamType>, and -// return std::string. -// -// testing::PrintToStringParamName is a builtin test suffix generator that -// returns the value of testing::PrintToString(GetParam()). -// -// Note: test names must be non-empty, unique, and may only contain ASCII -// alphanumeric characters or underscore. Because PrintToString adds quotes -// to std::string and C strings, it won't work for these types. - -#define GTEST_EXPAND_(arg) arg -#define GTEST_GET_FIRST_(first, ...) first -#define GTEST_GET_SECOND_(first, second, ...) second - -#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \ - static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \ - gtest_##prefix##test_suite_name##_EvalGenerator_() { \ - return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \ - } \ - static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \ - const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \ - if (::testing::internal::AlwaysFalse()) { \ - ::testing::internal::TestNotEmpty(GTEST_EXPAND_(GTEST_GET_SECOND_( \ - __VA_ARGS__, \ - ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \ - DUMMY_PARAM_))); \ - auto t = std::make_tuple(__VA_ARGS__); \ - static_assert(std::tuple_size<decltype(t)>::value <= 2, \ - "Too Many Args!"); \ - } \ - return ((GTEST_EXPAND_(GTEST_GET_SECOND_( \ - __VA_ARGS__, \ - ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \ - DUMMY_PARAM_))))(info); \ - } \ - static int gtest_##prefix##test_suite_name##_dummy_ \ - GTEST_ATTRIBUTE_UNUSED_ = \ - ::testing::UnitTest::GetInstance() \ - ->parameterized_test_registry() \ - .GetTestSuitePatternHolder<test_suite_name>( \ - #test_suite_name, \ - ::testing::internal::CodeLocation(__FILE__, __LINE__)) \ - ->AddTestSuiteInstantiation( \ - #prefix, >est_##prefix##test_suite_name##_EvalGenerator_, \ - >est_##prefix##test_suite_name##_EvalGenerateName_, \ - __FILE__, __LINE__) - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -#define INSTANTIATE_TEST_CASE_P \ - static_assert(::testing::internal::InstantiateTestCase_P_IsDeprecated(), \ - ""); \ - INSTANTIATE_TEST_SUITE_P -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -} // namespace testing - -#endif // GTEST_INCLUDE_GTEST_GTEST_PARAM_TEST_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/gtest-printers.h b/3rdParty/googletest/googletest/include/gtest/gtest-printers.h deleted file mode 100644 index 56a05450ef5e4ce13f5915c7acd5ef3e1a3655a9..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/gtest-printers.h +++ /dev/null @@ -1,928 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Test - The Google C++ Testing and Mocking Framework -// -// This file implements a universal value printer that can print a -// value of any type T: -// -// void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr); -// -// A user can teach this function how to print a class type T by -// defining either operator<<() or PrintTo() in the namespace that -// defines T. More specifically, the FIRST defined function in the -// following list will be used (assuming T is defined in namespace -// foo): -// -// 1. foo::PrintTo(const T&, ostream*) -// 2. operator<<(ostream&, const T&) defined in either foo or the -// global namespace. -// -// However if T is an STL-style container then it is printed element-wise -// unless foo::PrintTo(const T&, ostream*) is defined. Note that -// operator<<() is ignored for container types. -// -// If none of the above is defined, it will print the debug string of -// the value if it is a protocol buffer, or print the raw bytes in the -// value otherwise. -// -// To aid debugging: when T is a reference type, the address of the -// value is also printed; when T is a (const) char pointer, both the -// pointer value and the NUL-terminated string it points to are -// printed. -// -// We also provide some convenient wrappers: -// -// // Prints a value to a string. For a (const or not) char -// // pointer, the NUL-terminated string (but not the pointer) is -// // printed. -// std::string ::testing::PrintToString(const T& value); -// -// // Prints a value tersely: for a reference type, the referenced -// // value (but not the address) is printed; for a (const or not) char -// // pointer, the NUL-terminated string (but not the pointer) is -// // printed. -// void ::testing::internal::UniversalTersePrint(const T& value, ostream*); -// -// // Prints value using the type inferred by the compiler. The difference -// // from UniversalTersePrint() is that this function prints both the -// // pointer and the NUL-terminated string for a (const or not) char pointer. -// void ::testing::internal::UniversalPrint(const T& value, ostream*); -// -// // Prints the fields of a tuple tersely to a string vector, one -// // element for each field. Tuple support must be enabled in -// // gtest-port.h. -// std::vector<string> UniversalTersePrintTupleFieldsToStrings( -// const Tuple& value); -// -// Known limitation: -// -// The print primitives print the elements of an STL-style container -// using the compiler-inferred type of *iter where iter is a -// const_iterator of the container. When const_iterator is an input -// iterator but not a forward iterator, this inferred type may not -// match value_type, and the print output may be incorrect. In -// practice, this is rarely a problem as for most containers -// const_iterator is a forward iterator. We'll fix this if there's an -// actual need for it. Note that this fix cannot rely on value_type -// being defined as many user-defined container types don't have -// value_type. - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ -#define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ - -#include <functional> -#include <ostream> // NOLINT -#include <sstream> -#include <string> -#include <tuple> -#include <type_traits> -#include <utility> -#include <vector> -#include "gtest/internal/gtest-internal.h" -#include "gtest/internal/gtest-port.h" - -#if GTEST_HAS_ABSL -#include "absl/strings/string_view.h" -#include "absl/types/optional.h" -#include "absl/types/variant.h" -#endif // GTEST_HAS_ABSL - -namespace testing { - -// Definitions in the 'internal' and 'internal2' name spaces are -// subject to change without notice. DO NOT USE THEM IN USER CODE! -namespace internal2 { - -// Prints the given number of bytes in the given object to the given -// ostream. -GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes, - size_t count, - ::std::ostream* os); - -// For selecting which printer to use when a given type has neither << -// nor PrintTo(). -enum TypeKind { - kProtobuf, // a protobuf type - kConvertibleToInteger, // a type implicitly convertible to BiggestInt - // (e.g. a named or unnamed enum type) -#if GTEST_HAS_ABSL - kConvertibleToStringView, // a type implicitly convertible to - // absl::string_view -#endif - kOtherType // anything else -}; - -// TypeWithoutFormatter<T, kTypeKind>::PrintValue(value, os) is called -// by the universal printer to print a value of type T when neither -// operator<< nor PrintTo() is defined for T, where kTypeKind is the -// "kind" of T as defined by enum TypeKind. -template <typename T, TypeKind kTypeKind> -class TypeWithoutFormatter { - public: - // This default version is called when kTypeKind is kOtherType. - static void PrintValue(const T& value, ::std::ostream* os) { - PrintBytesInObjectTo( - static_cast<const unsigned char*>( - reinterpret_cast<const void*>(std::addressof(value))), - sizeof(value), os); - } -}; - -// We print a protobuf using its ShortDebugString() when the string -// doesn't exceed this many characters; otherwise we print it using -// DebugString() for better readability. -const size_t kProtobufOneLinerMaxLength = 50; - -template <typename T> -class TypeWithoutFormatter<T, kProtobuf> { - public: - static void PrintValue(const T& value, ::std::ostream* os) { - std::string pretty_str = value.ShortDebugString(); - if (pretty_str.length() > kProtobufOneLinerMaxLength) { - pretty_str = "\n" + value.DebugString(); - } - *os << ("<" + pretty_str + ">"); - } -}; - -template <typename T> -class TypeWithoutFormatter<T, kConvertibleToInteger> { - public: - // Since T has no << operator or PrintTo() but can be implicitly - // converted to BiggestInt, we print it as a BiggestInt. - // - // Most likely T is an enum type (either named or unnamed), in which - // case printing it as an integer is the desired behavior. In case - // T is not an enum, printing it as an integer is the best we can do - // given that it has no user-defined printer. - static void PrintValue(const T& value, ::std::ostream* os) { - const internal::BiggestInt kBigInt = value; - *os << kBigInt; - } -}; - -#if GTEST_HAS_ABSL -template <typename T> -class TypeWithoutFormatter<T, kConvertibleToStringView> { - public: - // Since T has neither operator<< nor PrintTo() but can be implicitly - // converted to absl::string_view, we print it as a absl::string_view. - // - // Note: the implementation is further below, as it depends on - // internal::PrintTo symbol which is defined later in the file. - static void PrintValue(const T& value, ::std::ostream* os); -}; -#endif - -// Prints the given value to the given ostream. If the value is a -// protocol message, its debug string is printed; if it's an enum or -// of a type implicitly convertible to BiggestInt, it's printed as an -// integer; otherwise the bytes in the value are printed. This is -// what UniversalPrinter<T>::Print() does when it knows nothing about -// type T and T has neither << operator nor PrintTo(). -// -// A user can override this behavior for a class type Foo by defining -// a << operator in the namespace where Foo is defined. -// -// We put this operator in namespace 'internal2' instead of 'internal' -// to simplify the implementation, as much code in 'internal' needs to -// use << in STL, which would conflict with our own << were it defined -// in 'internal'. -// -// Note that this operator<< takes a generic std::basic_ostream<Char, -// CharTraits> type instead of the more restricted std::ostream. If -// we define it to take an std::ostream instead, we'll get an -// "ambiguous overloads" compiler error when trying to print a type -// Foo that supports streaming to std::basic_ostream<Char, -// CharTraits>, as the compiler cannot tell whether -// operator<<(std::ostream&, const T&) or -// operator<<(std::basic_stream<Char, CharTraits>, const Foo&) is more -// specific. -template <typename Char, typename CharTraits, typename T> -::std::basic_ostream<Char, CharTraits>& operator<<( - ::std::basic_ostream<Char, CharTraits>& os, const T& x) { - TypeWithoutFormatter<T, (internal::IsAProtocolMessage<T>::value - ? kProtobuf - : std::is_convertible< - const T&, internal::BiggestInt>::value - ? kConvertibleToInteger - : -#if GTEST_HAS_ABSL - std::is_convertible< - const T&, absl::string_view>::value - ? kConvertibleToStringView - : -#endif - kOtherType)>::PrintValue(x, &os); - return os; -} - -} // namespace internal2 -} // namespace testing - -// This namespace MUST NOT BE NESTED IN ::testing, or the name look-up -// magic needed for implementing UniversalPrinter won't work. -namespace testing_internal { - -// Used to print a value that is not an STL-style container when the -// user doesn't define PrintTo() for it. -template <typename T> -void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) { - // With the following statement, during unqualified name lookup, - // testing::internal2::operator<< appears as if it was declared in - // the nearest enclosing namespace that contains both - // ::testing_internal and ::testing::internal2, i.e. the global - // namespace. For more details, refer to the C++ Standard section - // 7.3.4-1 [namespace.udir]. This allows us to fall back onto - // testing::internal2::operator<< in case T doesn't come with a << - // operator. - // - // We cannot write 'using ::testing::internal2::operator<<;', which - // gcc 3.3 fails to compile due to a compiler bug. - using namespace ::testing::internal2; // NOLINT - - // Assuming T is defined in namespace foo, in the next statement, - // the compiler will consider all of: - // - // 1. foo::operator<< (thanks to Koenig look-up), - // 2. ::operator<< (as the current namespace is enclosed in ::), - // 3. testing::internal2::operator<< (thanks to the using statement above). - // - // The operator<< whose type matches T best will be picked. - // - // We deliberately allow #2 to be a candidate, as sometimes it's - // impossible to define #1 (e.g. when foo is ::std, defining - // anything in it is undefined behavior unless you are a compiler - // vendor.). - *os << value; -} - -} // namespace testing_internal - -namespace testing { -namespace internal { - -// FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a -// value of type ToPrint that is an operand of a comparison assertion -// (e.g. ASSERT_EQ). OtherOperand is the type of the other operand in -// the comparison, and is used to help determine the best way to -// format the value. In particular, when the value is a C string -// (char pointer) and the other operand is an STL string object, we -// want to format the C string as a string, since we know it is -// compared by value with the string object. If the value is a char -// pointer but the other operand is not an STL string object, we don't -// know whether the pointer is supposed to point to a NUL-terminated -// string, and thus want to print it as a pointer to be safe. -// -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. - -// The default case. -template <typename ToPrint, typename OtherOperand> -class FormatForComparison { - public: - static ::std::string Format(const ToPrint& value) { - return ::testing::PrintToString(value); - } -}; - -// Array. -template <typename ToPrint, size_t N, typename OtherOperand> -class FormatForComparison<ToPrint[N], OtherOperand> { - public: - static ::std::string Format(const ToPrint* value) { - return FormatForComparison<const ToPrint*, OtherOperand>::Format(value); - } -}; - -// By default, print C string as pointers to be safe, as we don't know -// whether they actually point to a NUL-terminated string. - -#define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType) \ - template <typename OtherOperand> \ - class FormatForComparison<CharType*, OtherOperand> { \ - public: \ - static ::std::string Format(CharType* value) { \ - return ::testing::PrintToString(static_cast<const void*>(value)); \ - } \ - } - -GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char); -GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char); -GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t); -GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t); - -#undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_ - -// If a C string is compared with an STL string object, we know it's meant -// to point to a NUL-terminated string, and thus can print it as a string. - -#define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \ - template <> \ - class FormatForComparison<CharType*, OtherStringType> { \ - public: \ - static ::std::string Format(CharType* value) { \ - return ::testing::PrintToString(value); \ - } \ - } - -GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string); -GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string); - -#if GTEST_HAS_STD_WSTRING -GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring); -GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring); -#endif - -#undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_ - -// Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc) -// operand to be used in a failure message. The type (but not value) -// of the other operand may affect the format. This allows us to -// print a char* as a raw pointer when it is compared against another -// char* or void*, and print it as a C string when it is compared -// against an std::string object, for example. -// -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -template <typename T1, typename T2> -std::string FormatForComparisonFailureMessage( - const T1& value, const T2& /* other_operand */) { - return FormatForComparison<T1, T2>::Format(value); -} - -// UniversalPrinter<T>::Print(value, ostream_ptr) prints the given -// value to the given ostream. The caller must ensure that -// 'ostream_ptr' is not NULL, or the behavior is undefined. -// -// We define UniversalPrinter as a class template (as opposed to a -// function template), as we need to partially specialize it for -// reference types, which cannot be done with function templates. -template <typename T> -class UniversalPrinter; - -template <typename T> -void UniversalPrint(const T& value, ::std::ostream* os); - -enum DefaultPrinterType { - kPrintContainer, - kPrintPointer, - kPrintFunctionPointer, - kPrintOther, -}; -template <DefaultPrinterType type> struct WrapPrinterType {}; - -// Used to print an STL-style container when the user doesn't define -// a PrintTo() for it. -template <typename C> -void DefaultPrintTo(WrapPrinterType<kPrintContainer> /* dummy */, - const C& container, ::std::ostream* os) { - const size_t kMaxCount = 32; // The maximum number of elements to print. - *os << '{'; - size_t count = 0; - for (typename C::const_iterator it = container.begin(); - it != container.end(); ++it, ++count) { - if (count > 0) { - *os << ','; - if (count == kMaxCount) { // Enough has been printed. - *os << " ..."; - break; - } - } - *os << ' '; - // We cannot call PrintTo(*it, os) here as PrintTo() doesn't - // handle *it being a native array. - internal::UniversalPrint(*it, os); - } - - if (count > 0) { - *os << ' '; - } - *os << '}'; -} - -// Used to print a pointer that is neither a char pointer nor a member -// pointer, when the user doesn't define PrintTo() for it. (A member -// variable pointer or member function pointer doesn't really point to -// a location in the address space. Their representation is -// implementation-defined. Therefore they will be printed as raw -// bytes.) -template <typename T> -void DefaultPrintTo(WrapPrinterType<kPrintPointer> /* dummy */, - T* p, ::std::ostream* os) { - if (p == nullptr) { - *os << "NULL"; - } else { - // T is not a function type. We just call << to print p, - // relying on ADL to pick up user-defined << for their pointer - // types, if any. - *os << p; - } -} -template <typename T> -void DefaultPrintTo(WrapPrinterType<kPrintFunctionPointer> /* dummy */, - T* p, ::std::ostream* os) { - if (p == nullptr) { - *os << "NULL"; - } else { - // T is a function type, so '*os << p' doesn't do what we want - // (it just prints p as bool). We want to print p as a const - // void*. - *os << reinterpret_cast<const void*>(p); - } -} - -// Used to print a non-container, non-pointer value when the user -// doesn't define PrintTo() for it. -template <typename T> -void DefaultPrintTo(WrapPrinterType<kPrintOther> /* dummy */, - const T& value, ::std::ostream* os) { - ::testing_internal::DefaultPrintNonContainerTo(value, os); -} - -// Prints the given value using the << operator if it has one; -// otherwise prints the bytes in it. This is what -// UniversalPrinter<T>::Print() does when PrintTo() is not specialized -// or overloaded for type T. -// -// A user can override this behavior for a class type Foo by defining -// an overload of PrintTo() in the namespace where Foo is defined. We -// give the user this option as sometimes defining a << operator for -// Foo is not desirable (e.g. the coding style may prevent doing it, -// or there is already a << operator but it doesn't do what the user -// wants). -template <typename T> -void PrintTo(const T& value, ::std::ostream* os) { - // DefaultPrintTo() is overloaded. The type of its first argument - // determines which version will be picked. - // - // Note that we check for container types here, prior to we check - // for protocol message types in our operator<<. The rationale is: - // - // For protocol messages, we want to give people a chance to - // override Google Mock's format by defining a PrintTo() or - // operator<<. For STL containers, other formats can be - // incompatible with Google Mock's format for the container - // elements; therefore we check for container types here to ensure - // that our format is used. - // - // Note that MSVC and clang-cl do allow an implicit conversion from - // pointer-to-function to pointer-to-object, but clang-cl warns on it. - // So don't use ImplicitlyConvertible if it can be helped since it will - // cause this warning, and use a separate overload of DefaultPrintTo for - // function pointers so that the `*os << p` in the object pointer overload - // doesn't cause that warning either. - DefaultPrintTo( - WrapPrinterType < - (sizeof(IsContainerTest<T>(0)) == sizeof(IsContainer)) && - !IsRecursiveContainer<T>::value - ? kPrintContainer - : !std::is_pointer<T>::value - ? kPrintOther - : std::is_function<typename std::remove_pointer<T>::type>::value - ? kPrintFunctionPointer - : kPrintPointer > (), - value, os); -} - -// The following list of PrintTo() overloads tells -// UniversalPrinter<T>::Print() how to print standard types (built-in -// types, strings, plain arrays, and pointers). - -// Overloads for various char types. -GTEST_API_ void PrintTo(unsigned char c, ::std::ostream* os); -GTEST_API_ void PrintTo(signed char c, ::std::ostream* os); -inline void PrintTo(char c, ::std::ostream* os) { - // When printing a plain char, we always treat it as unsigned. This - // way, the output won't be affected by whether the compiler thinks - // char is signed or not. - PrintTo(static_cast<unsigned char>(c), os); -} - -// Overloads for other simple built-in types. -inline void PrintTo(bool x, ::std::ostream* os) { - *os << (x ? "true" : "false"); -} - -// Overload for wchar_t type. -// Prints a wchar_t as a symbol if it is printable or as its internal -// code otherwise and also as its decimal code (except for L'\0'). -// The L'\0' char is printed as "L'\\0'". The decimal code is printed -// as signed integer when wchar_t is implemented by the compiler -// as a signed type and is printed as an unsigned integer when wchar_t -// is implemented as an unsigned type. -GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os); - -// Overloads for C strings. -GTEST_API_ void PrintTo(const char* s, ::std::ostream* os); -inline void PrintTo(char* s, ::std::ostream* os) { - PrintTo(ImplicitCast_<const char*>(s), os); -} - -// signed/unsigned char is often used for representing binary data, so -// we print pointers to it as void* to be safe. -inline void PrintTo(const signed char* s, ::std::ostream* os) { - PrintTo(ImplicitCast_<const void*>(s), os); -} -inline void PrintTo(signed char* s, ::std::ostream* os) { - PrintTo(ImplicitCast_<const void*>(s), os); -} -inline void PrintTo(const unsigned char* s, ::std::ostream* os) { - PrintTo(ImplicitCast_<const void*>(s), os); -} -inline void PrintTo(unsigned char* s, ::std::ostream* os) { - PrintTo(ImplicitCast_<const void*>(s), os); -} - -// MSVC can be configured to define wchar_t as a typedef of unsigned -// short. It defines _NATIVE_WCHAR_T_DEFINED when wchar_t is a native -// type. When wchar_t is a typedef, defining an overload for const -// wchar_t* would cause unsigned short* be printed as a wide string, -// possibly causing invalid memory accesses. -#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) -// Overloads for wide C strings -GTEST_API_ void PrintTo(const wchar_t* s, ::std::ostream* os); -inline void PrintTo(wchar_t* s, ::std::ostream* os) { - PrintTo(ImplicitCast_<const wchar_t*>(s), os); -} -#endif - -// Overload for C arrays. Multi-dimensional arrays are printed -// properly. - -// Prints the given number of elements in an array, without printing -// the curly braces. -template <typename T> -void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) { - UniversalPrint(a[0], os); - for (size_t i = 1; i != count; i++) { - *os << ", "; - UniversalPrint(a[i], os); - } -} - -// Overloads for ::std::string. -GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os); -inline void PrintTo(const ::std::string& s, ::std::ostream* os) { - PrintStringTo(s, os); -} - -// Overloads for ::std::wstring. -#if GTEST_HAS_STD_WSTRING -GTEST_API_ void PrintWideStringTo(const ::std::wstring&s, ::std::ostream* os); -inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) { - PrintWideStringTo(s, os); -} -#endif // GTEST_HAS_STD_WSTRING - -#if GTEST_HAS_ABSL -// Overload for absl::string_view. -inline void PrintTo(absl::string_view sp, ::std::ostream* os) { - PrintTo(::std::string(sp), os); -} -#endif // GTEST_HAS_ABSL - -inline void PrintTo(std::nullptr_t, ::std::ostream* os) { *os << "(nullptr)"; } - -template <typename T> -void PrintTo(std::reference_wrapper<T> ref, ::std::ostream* os) { - UniversalPrinter<T&>::Print(ref.get(), os); -} - -// Helper function for printing a tuple. T must be instantiated with -// a tuple type. -template <typename T> -void PrintTupleTo(const T&, std::integral_constant<size_t, 0>, - ::std::ostream*) {} - -template <typename T, size_t I> -void PrintTupleTo(const T& t, std::integral_constant<size_t, I>, - ::std::ostream* os) { - PrintTupleTo(t, std::integral_constant<size_t, I - 1>(), os); - GTEST_INTENTIONAL_CONST_COND_PUSH_() - if (I > 1) { - GTEST_INTENTIONAL_CONST_COND_POP_() - *os << ", "; - } - UniversalPrinter<typename std::tuple_element<I - 1, T>::type>::Print( - std::get<I - 1>(t), os); -} - -template <typename... Types> -void PrintTo(const ::std::tuple<Types...>& t, ::std::ostream* os) { - *os << "("; - PrintTupleTo(t, std::integral_constant<size_t, sizeof...(Types)>(), os); - *os << ")"; -} - -// Overload for std::pair. -template <typename T1, typename T2> -void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) { - *os << '('; - // We cannot use UniversalPrint(value.first, os) here, as T1 may be - // a reference type. The same for printing value.second. - UniversalPrinter<T1>::Print(value.first, os); - *os << ", "; - UniversalPrinter<T2>::Print(value.second, os); - *os << ')'; -} - -// Implements printing a non-reference type T by letting the compiler -// pick the right overload of PrintTo() for T. -template <typename T> -class UniversalPrinter { - public: - // MSVC warns about adding const to a function type, so we want to - // disable the warning. - GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180) - - // Note: we deliberately don't call this PrintTo(), as that name - // conflicts with ::testing::internal::PrintTo in the body of the - // function. - static void Print(const T& value, ::std::ostream* os) { - // By default, ::testing::internal::PrintTo() is used for printing - // the value. - // - // Thanks to Koenig look-up, if T is a class and has its own - // PrintTo() function defined in its namespace, that function will - // be visible here. Since it is more specific than the generic ones - // in ::testing::internal, it will be picked by the compiler in the - // following statement - exactly what we want. - PrintTo(value, os); - } - - GTEST_DISABLE_MSC_WARNINGS_POP_() -}; - -#if GTEST_HAS_ABSL - -// Printer for absl::optional - -template <typename T> -class UniversalPrinter<::absl::optional<T>> { - public: - static void Print(const ::absl::optional<T>& value, ::std::ostream* os) { - *os << '('; - if (!value) { - *os << "nullopt"; - } else { - UniversalPrint(*value, os); - } - *os << ')'; - } -}; - -// Printer for absl::variant - -template <typename... T> -class UniversalPrinter<::absl::variant<T...>> { - public: - static void Print(const ::absl::variant<T...>& value, ::std::ostream* os) { - *os << '('; - absl::visit(Visitor{os}, value); - *os << ')'; - } - - private: - struct Visitor { - template <typename U> - void operator()(const U& u) const { - *os << "'" << GetTypeName<U>() << "' with value "; - UniversalPrint(u, os); - } - ::std::ostream* os; - }; -}; - -#endif // GTEST_HAS_ABSL - -// UniversalPrintArray(begin, len, os) prints an array of 'len' -// elements, starting at address 'begin'. -template <typename T> -void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) { - if (len == 0) { - *os << "{}"; - } else { - *os << "{ "; - const size_t kThreshold = 18; - const size_t kChunkSize = 8; - // If the array has more than kThreshold elements, we'll have to - // omit some details by printing only the first and the last - // kChunkSize elements. - if (len <= kThreshold) { - PrintRawArrayTo(begin, len, os); - } else { - PrintRawArrayTo(begin, kChunkSize, os); - *os << ", ..., "; - PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os); - } - *os << " }"; - } -} -// This overload prints a (const) char array compactly. -GTEST_API_ void UniversalPrintArray( - const char* begin, size_t len, ::std::ostream* os); - -// This overload prints a (const) wchar_t array compactly. -GTEST_API_ void UniversalPrintArray( - const wchar_t* begin, size_t len, ::std::ostream* os); - -// Implements printing an array type T[N]. -template <typename T, size_t N> -class UniversalPrinter<T[N]> { - public: - // Prints the given array, omitting some elements when there are too - // many. - static void Print(const T (&a)[N], ::std::ostream* os) { - UniversalPrintArray(a, N, os); - } -}; - -// Implements printing a reference type T&. -template <typename T> -class UniversalPrinter<T&> { - public: - // MSVC warns about adding const to a function type, so we want to - // disable the warning. - GTEST_DISABLE_MSC_WARNINGS_PUSH_(4180) - - static void Print(const T& value, ::std::ostream* os) { - // Prints the address of the value. We use reinterpret_cast here - // as static_cast doesn't compile when T is a function type. - *os << "@" << reinterpret_cast<const void*>(&value) << " "; - - // Then prints the value itself. - UniversalPrint(value, os); - } - - GTEST_DISABLE_MSC_WARNINGS_POP_() -}; - -// Prints a value tersely: for a reference type, the referenced value -// (but not the address) is printed; for a (const) char pointer, the -// NUL-terminated string (but not the pointer) is printed. - -template <typename T> -class UniversalTersePrinter { - public: - static void Print(const T& value, ::std::ostream* os) { - UniversalPrint(value, os); - } -}; -template <typename T> -class UniversalTersePrinter<T&> { - public: - static void Print(const T& value, ::std::ostream* os) { - UniversalPrint(value, os); - } -}; -template <typename T, size_t N> -class UniversalTersePrinter<T[N]> { - public: - static void Print(const T (&value)[N], ::std::ostream* os) { - UniversalPrinter<T[N]>::Print(value, os); - } -}; -template <> -class UniversalTersePrinter<const char*> { - public: - static void Print(const char* str, ::std::ostream* os) { - if (str == nullptr) { - *os << "NULL"; - } else { - UniversalPrint(std::string(str), os); - } - } -}; -template <> -class UniversalTersePrinter<char*> { - public: - static void Print(char* str, ::std::ostream* os) { - UniversalTersePrinter<const char*>::Print(str, os); - } -}; - -#if GTEST_HAS_STD_WSTRING -template <> -class UniversalTersePrinter<const wchar_t*> { - public: - static void Print(const wchar_t* str, ::std::ostream* os) { - if (str == nullptr) { - *os << "NULL"; - } else { - UniversalPrint(::std::wstring(str), os); - } - } -}; -#endif - -template <> -class UniversalTersePrinter<wchar_t*> { - public: - static void Print(wchar_t* str, ::std::ostream* os) { - UniversalTersePrinter<const wchar_t*>::Print(str, os); - } -}; - -template <typename T> -void UniversalTersePrint(const T& value, ::std::ostream* os) { - UniversalTersePrinter<T>::Print(value, os); -} - -// Prints a value using the type inferred by the compiler. The -// difference between this and UniversalTersePrint() is that for a -// (const) char pointer, this prints both the pointer and the -// NUL-terminated string. -template <typename T> -void UniversalPrint(const T& value, ::std::ostream* os) { - // A workarond for the bug in VC++ 7.1 that prevents us from instantiating - // UniversalPrinter with T directly. - typedef T T1; - UniversalPrinter<T1>::Print(value, os); -} - -typedef ::std::vector< ::std::string> Strings; - - // Tersely prints the first N fields of a tuple to a string vector, - // one element for each field. -template <typename Tuple> -void TersePrintPrefixToStrings(const Tuple&, std::integral_constant<size_t, 0>, - Strings*) {} -template <typename Tuple, size_t I> -void TersePrintPrefixToStrings(const Tuple& t, - std::integral_constant<size_t, I>, - Strings* strings) { - TersePrintPrefixToStrings(t, std::integral_constant<size_t, I - 1>(), - strings); - ::std::stringstream ss; - UniversalTersePrint(std::get<I - 1>(t), &ss); - strings->push_back(ss.str()); -} - -// Prints the fields of a tuple tersely to a string vector, one -// element for each field. See the comment before -// UniversalTersePrint() for how we define "tersely". -template <typename Tuple> -Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) { - Strings result; - TersePrintPrefixToStrings( - value, std::integral_constant<size_t, std::tuple_size<Tuple>::value>(), - &result); - return result; -} - -} // namespace internal - -#if GTEST_HAS_ABSL -namespace internal2 { -template <typename T> -void TypeWithoutFormatter<T, kConvertibleToStringView>::PrintValue( - const T& value, ::std::ostream* os) { - internal::PrintTo(absl::string_view(value), os); -} -} // namespace internal2 -#endif - -template <typename T> -::std::string PrintToString(const T& value) { - ::std::stringstream ss; - internal::UniversalTersePrinter<T>::Print(value, &ss); - return ss.str(); -} - -} // namespace testing - -// Include any custom printer added by the local installation. -// We must include this header at the end to make sure it can use the -// declarations from this file. -#include "gtest/internal/custom/gtest-printers.h" - -#endif // GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/gtest-spi.h b/3rdParty/googletest/googletest/include/gtest/gtest-spi.h deleted file mode 100644 index aa38870e8e1c91294e73cf4e8cb41d7f32764e8e..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/gtest-spi.h +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// Utilities for testing Google Test itself and code that uses Google Test -// (e.g. frameworks built on top of Google Test). - -// GOOGLETEST_CM0004 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_ -#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_ - -#include "gtest/gtest.h" - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -namespace testing { - -// This helper class can be used to mock out Google Test failure reporting -// so that we can test Google Test or code that builds on Google Test. -// -// An object of this class appends a TestPartResult object to the -// TestPartResultArray object given in the constructor whenever a Google Test -// failure is reported. It can either intercept only failures that are -// generated in the same thread that created this object or it can intercept -// all generated failures. The scope of this mock object can be controlled with -// the second argument to the two arguments constructor. -class GTEST_API_ ScopedFakeTestPartResultReporter - : public TestPartResultReporterInterface { - public: - // The two possible mocking modes of this object. - enum InterceptMode { - INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures. - INTERCEPT_ALL_THREADS // Intercepts all failures. - }; - - // The c'tor sets this object as the test part result reporter used - // by Google Test. The 'result' parameter specifies where to report the - // results. This reporter will only catch failures generated in the current - // thread. DEPRECATED - explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result); - - // Same as above, but you can choose the interception scope of this object. - ScopedFakeTestPartResultReporter(InterceptMode intercept_mode, - TestPartResultArray* result); - - // The d'tor restores the previous test part result reporter. - ~ScopedFakeTestPartResultReporter() override; - - // Appends the TestPartResult object to the TestPartResultArray - // received in the constructor. - // - // This method is from the TestPartResultReporterInterface - // interface. - void ReportTestPartResult(const TestPartResult& result) override; - - private: - void Init(); - - const InterceptMode intercept_mode_; - TestPartResultReporterInterface* old_reporter_; - TestPartResultArray* const result_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter); -}; - -namespace internal { - -// A helper class for implementing EXPECT_FATAL_FAILURE() and -// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given -// TestPartResultArray contains exactly one failure that has the given -// type and contains the given substring. If that's not the case, a -// non-fatal failure will be generated. -class GTEST_API_ SingleFailureChecker { - public: - // The constructor remembers the arguments. - SingleFailureChecker(const TestPartResultArray* results, - TestPartResult::Type type, const std::string& substr); - ~SingleFailureChecker(); - private: - const TestPartResultArray* const results_; - const TestPartResult::Type type_; - const std::string substr_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker); -}; - -} // namespace internal - -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -// A set of macros for testing Google Test assertions or code that's expected -// to generate Google Test fatal failures. It verifies that the given -// statement will cause exactly one fatal Google Test failure with 'substr' -// being part of the failure message. -// -// There are two different versions of this macro. EXPECT_FATAL_FAILURE only -// affects and considers failures generated in the current thread and -// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads. -// -// The verification of the assertion is done correctly even when the statement -// throws an exception or aborts the current function. -// -// Known restrictions: -// - 'statement' cannot reference local non-static variables or -// non-static members of the current object. -// - 'statement' cannot return a value. -// - You cannot stream a failure message to this macro. -// -// Note that even though the implementations of the following two -// macros are much alike, we cannot refactor them to use a common -// helper macro, due to some peculiarity in how the preprocessor -// works. The AcceptsMacroThatExpandsToUnprotectedComma test in -// gtest_unittest.cc will fail to compile if we do that. -#define EXPECT_FATAL_FAILURE(statement, substr) \ - do { \ - class GTestExpectFatalFailureHelper {\ - public:\ - static void Execute() { statement; }\ - };\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ - >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter:: \ - INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ - GTestExpectFatalFailureHelper::Execute();\ - }\ - } while (::testing::internal::AlwaysFalse()) - -#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ - do { \ - class GTestExpectFatalFailureHelper {\ - public:\ - static void Execute() { statement; }\ - };\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ - >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter:: \ - INTERCEPT_ALL_THREADS, >est_failures);\ - GTestExpectFatalFailureHelper::Execute();\ - }\ - } while (::testing::internal::AlwaysFalse()) - -// A macro for testing Google Test assertions or code that's expected to -// generate Google Test non-fatal failures. It asserts that the given -// statement will cause exactly one non-fatal Google Test failure with 'substr' -// being part of the failure message. -// -// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only -// affects and considers failures generated in the current thread and -// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads. -// -// 'statement' is allowed to reference local variables and members of -// the current object. -// -// The verification of the assertion is done correctly even when the statement -// throws an exception or aborts the current function. -// -// Known restrictions: -// - You cannot stream a failure message to this macro. -// -// Note that even though the implementations of the following two -// macros are much alike, we cannot refactor them to use a common -// helper macro, due to some peculiarity in how the preprocessor -// works. If we do that, the code won't compile when the user gives -// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that -// expands to code containing an unprotected comma. The -// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc -// catches that. -// -// For the same reason, we have to write -// if (::testing::internal::AlwaysTrue()) { statement; } -// instead of -// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) -// to avoid an MSVC warning on unreachable code. -#define EXPECT_NONFATAL_FAILURE(statement, substr) \ - do {\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ - >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ - (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter:: \ - INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\ - if (::testing::internal::AlwaysTrue()) { statement; }\ - }\ - } while (::testing::internal::AlwaysFalse()) - -#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \ - do {\ - ::testing::TestPartResultArray gtest_failures;\ - ::testing::internal::SingleFailureChecker gtest_checker(\ - >est_failures, ::testing::TestPartResult::kNonFatalFailure, \ - (substr));\ - {\ - ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\ - ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \ - >est_failures);\ - if (::testing::internal::AlwaysTrue()) { statement; }\ - }\ - } while (::testing::internal::AlwaysFalse()) - -#endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/gtest-test-part.h b/3rdParty/googletest/googletest/include/gtest/gtest-test-part.h deleted file mode 100644 index 05a79853586a911c49ddf910fa1f0595e338265e..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/gtest-test-part.h +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ -#define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ - -#include <iosfwd> -#include <vector> -#include "gtest/internal/gtest-internal.h" -#include "gtest/internal/gtest-string.h" - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -namespace testing { - -// A copyable object representing the result of a test part (i.e. an -// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()). -// -// Don't inherit from TestPartResult as its destructor is not virtual. -class GTEST_API_ TestPartResult { - public: - // The possible outcomes of a test part (i.e. an assertion or an - // explicit SUCCEED(), FAIL(), or ADD_FAILURE()). - enum Type { - kSuccess, // Succeeded. - kNonFatalFailure, // Failed but the test can continue. - kFatalFailure, // Failed and the test should be terminated. - kSkip // Skipped. - }; - - // C'tor. TestPartResult does NOT have a default constructor. - // Always use this constructor (with parameters) to create a - // TestPartResult object. - TestPartResult(Type a_type, const char* a_file_name, int a_line_number, - const char* a_message) - : type_(a_type), - file_name_(a_file_name == nullptr ? "" : a_file_name), - line_number_(a_line_number), - summary_(ExtractSummary(a_message)), - message_(a_message) {} - - // Gets the outcome of the test part. - Type type() const { return type_; } - - // Gets the name of the source file where the test part took place, or - // NULL if it's unknown. - const char* file_name() const { - return file_name_.empty() ? nullptr : file_name_.c_str(); - } - - // Gets the line in the source file where the test part took place, - // or -1 if it's unknown. - int line_number() const { return line_number_; } - - // Gets the summary of the failure message. - const char* summary() const { return summary_.c_str(); } - - // Gets the message associated with the test part. - const char* message() const { return message_.c_str(); } - - // Returns true if and only if the test part was skipped. - bool skipped() const { return type_ == kSkip; } - - // Returns true if and only if the test part passed. - bool passed() const { return type_ == kSuccess; } - - // Returns true if and only if the test part non-fatally failed. - bool nonfatally_failed() const { return type_ == kNonFatalFailure; } - - // Returns true if and only if the test part fatally failed. - bool fatally_failed() const { return type_ == kFatalFailure; } - - // Returns true if and only if the test part failed. - bool failed() const { return fatally_failed() || nonfatally_failed(); } - - private: - Type type_; - - // Gets the summary of the failure message by omitting the stack - // trace in it. - static std::string ExtractSummary(const char* message); - - // The name of the source file where the test part took place, or - // "" if the source file is unknown. - std::string file_name_; - // The line in the source file where the test part took place, or -1 - // if the line number is unknown. - int line_number_; - std::string summary_; // The test failure summary. - std::string message_; // The test failure message. -}; - -// Prints a TestPartResult object. -std::ostream& operator<<(std::ostream& os, const TestPartResult& result); - -// An array of TestPartResult objects. -// -// Don't inherit from TestPartResultArray as its destructor is not -// virtual. -class GTEST_API_ TestPartResultArray { - public: - TestPartResultArray() {} - - // Appends the given TestPartResult to the array. - void Append(const TestPartResult& result); - - // Returns the TestPartResult at the given index (0-based). - const TestPartResult& GetTestPartResult(int index) const; - - // Returns the number of TestPartResult objects in the array. - int size() const; - - private: - std::vector<TestPartResult> array_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray); -}; - -// This interface knows how to report a test part result. -class GTEST_API_ TestPartResultReporterInterface { - public: - virtual ~TestPartResultReporterInterface() {} - - virtual void ReportTestPartResult(const TestPartResult& result) = 0; -}; - -namespace internal { - -// This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a -// statement generates new fatal failures. To do so it registers itself as the -// current test part result reporter. Besides checking if fatal failures were -// reported, it only delegates the reporting to the former result reporter. -// The original result reporter is restored in the destructor. -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -class GTEST_API_ HasNewFatalFailureHelper - : public TestPartResultReporterInterface { - public: - HasNewFatalFailureHelper(); - ~HasNewFatalFailureHelper() override; - void ReportTestPartResult(const TestPartResult& result) override; - bool has_new_fatal_failure() const { return has_new_fatal_failure_; } - private: - bool has_new_fatal_failure_; - TestPartResultReporterInterface* original_reporter_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper); -}; - -} // namespace internal - -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/gtest-typed-test.h b/3rdParty/googletest/googletest/include/gtest/gtest-typed-test.h deleted file mode 100644 index 095ce058022f892169664e29ea2bc528f960576b..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/gtest-typed-test.h +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright 2008 Google Inc. -// All Rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ -#define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ - -// This header implements typed tests and type-parameterized tests. - -// Typed (aka type-driven) tests repeat the same test for types in a -// list. You must know which types you want to test with when writing -// typed tests. Here's how you do it: - -#if 0 - -// First, define a fixture class template. It should be parameterized -// by a type. Remember to derive it from testing::Test. -template <typename T> -class FooTest : public testing::Test { - public: - ... - typedef std::list<T> List; - static T shared_; - T value_; -}; - -// Next, associate a list of types with the test suite, which will be -// repeated for each type in the list. The typedef is necessary for -// the macro to parse correctly. -typedef testing::Types<char, int, unsigned int> MyTypes; -TYPED_TEST_SUITE(FooTest, MyTypes); - -// If the type list contains only one type, you can write that type -// directly without Types<...>: -// TYPED_TEST_SUITE(FooTest, int); - -// Then, use TYPED_TEST() instead of TEST_F() to define as many typed -// tests for this test suite as you want. -TYPED_TEST(FooTest, DoesBlah) { - // Inside a test, refer to the special name TypeParam to get the type - // parameter. Since we are inside a derived class template, C++ requires - // us to visit the members of FooTest via 'this'. - TypeParam n = this->value_; - - // To visit static members of the fixture, add the TestFixture:: - // prefix. - n += TestFixture::shared_; - - // To refer to typedefs in the fixture, add the "typename - // TestFixture::" prefix. - typename TestFixture::List values; - values.push_back(n); - ... -} - -TYPED_TEST(FooTest, HasPropertyA) { ... } - -// TYPED_TEST_SUITE takes an optional third argument which allows to specify a -// class that generates custom test name suffixes based on the type. This should -// be a class which has a static template function GetName(int index) returning -// a string for each type. The provided integer index equals the index of the -// type in the provided type list. In many cases the index can be ignored. -// -// For example: -// class MyTypeNames { -// public: -// template <typename T> -// static std::string GetName(int) { -// if (std::is_same<T, char>()) return "char"; -// if (std::is_same<T, int>()) return "int"; -// if (std::is_same<T, unsigned int>()) return "unsignedInt"; -// } -// }; -// TYPED_TEST_SUITE(FooTest, MyTypes, MyTypeNames); - -#endif // 0 - -// Type-parameterized tests are abstract test patterns parameterized -// by a type. Compared with typed tests, type-parameterized tests -// allow you to define the test pattern without knowing what the type -// parameters are. The defined pattern can be instantiated with -// different types any number of times, in any number of translation -// units. -// -// If you are designing an interface or concept, you can define a -// suite of type-parameterized tests to verify properties that any -// valid implementation of the interface/concept should have. Then, -// each implementation can easily instantiate the test suite to verify -// that it conforms to the requirements, without having to write -// similar tests repeatedly. Here's an example: - -#if 0 - -// First, define a fixture class template. It should be parameterized -// by a type. Remember to derive it from testing::Test. -template <typename T> -class FooTest : public testing::Test { - ... -}; - -// Next, declare that you will define a type-parameterized test suite -// (the _P suffix is for "parameterized" or "pattern", whichever you -// prefer): -TYPED_TEST_SUITE_P(FooTest); - -// Then, use TYPED_TEST_P() to define as many type-parameterized tests -// for this type-parameterized test suite as you want. -TYPED_TEST_P(FooTest, DoesBlah) { - // Inside a test, refer to TypeParam to get the type parameter. - TypeParam n = 0; - ... -} - -TYPED_TEST_P(FooTest, HasPropertyA) { ... } - -// Now the tricky part: you need to register all test patterns before -// you can instantiate them. The first argument of the macro is the -// test suite name; the rest are the names of the tests in this test -// case. -REGISTER_TYPED_TEST_SUITE_P(FooTest, - DoesBlah, HasPropertyA); - -// Finally, you are free to instantiate the pattern with the types you -// want. If you put the above code in a header file, you can #include -// it in multiple C++ source files and instantiate it multiple times. -// -// To distinguish different instances of the pattern, the first -// argument to the INSTANTIATE_* macro is a prefix that will be added -// to the actual test suite name. Remember to pick unique prefixes for -// different instances. -typedef testing::Types<char, int, unsigned int> MyTypes; -INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); - -// If the type list contains only one type, you can write that type -// directly without Types<...>: -// INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, int); -// -// Similar to the optional argument of TYPED_TEST_SUITE above, -// INSTANTIATE_TEST_SUITE_P takes an optional fourth argument which allows to -// generate custom names. -// INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes, MyTypeNames); - -#endif // 0 - -#include "gtest/internal/gtest-port.h" -#include "gtest/internal/gtest-type-util.h" - -// Implements typed tests. - -#if GTEST_HAS_TYPED_TEST - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// -// Expands to the name of the typedef for the type parameters of the -// given test suite. -#define GTEST_TYPE_PARAMS_(TestSuiteName) gtest_type_params_##TestSuiteName##_ - -// Expands to the name of the typedef for the NameGenerator, responsible for -// creating the suffixes of the name. -#define GTEST_NAME_GENERATOR_(TestSuiteName) \ - gtest_type_params_##TestSuiteName##_NameGenerator - -#define TYPED_TEST_SUITE(CaseName, Types, ...) \ - typedef ::testing::internal::TypeList<Types>::type GTEST_TYPE_PARAMS_( \ - CaseName); \ - typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \ - GTEST_NAME_GENERATOR_(CaseName) - -# define TYPED_TEST(CaseName, TestName) \ - template <typename gtest_TypeParam_> \ - class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \ - : public CaseName<gtest_TypeParam_> { \ - private: \ - typedef CaseName<gtest_TypeParam_> TestFixture; \ - typedef gtest_TypeParam_ TypeParam; \ - virtual void TestBody(); \ - }; \ - static bool gtest_##CaseName##_##TestName##_registered_ \ - GTEST_ATTRIBUTE_UNUSED_ = \ - ::testing::internal::TypeParameterizedTest< \ - CaseName, \ - ::testing::internal::TemplateSel<GTEST_TEST_CLASS_NAME_(CaseName, \ - TestName)>, \ - GTEST_TYPE_PARAMS_( \ - CaseName)>::Register("", \ - ::testing::internal::CodeLocation( \ - __FILE__, __LINE__), \ - #CaseName, #TestName, 0, \ - ::testing::internal::GenerateNames< \ - GTEST_NAME_GENERATOR_(CaseName), \ - GTEST_TYPE_PARAMS_(CaseName)>()); \ - template <typename gtest_TypeParam_> \ - void GTEST_TEST_CLASS_NAME_(CaseName, \ - TestName)<gtest_TypeParam_>::TestBody() - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -#define TYPED_TEST_CASE \ - static_assert(::testing::internal::TypedTestCaseIsDeprecated(), ""); \ - TYPED_TEST_SUITE -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -#endif // GTEST_HAS_TYPED_TEST - -// Implements type-parameterized tests. - -#if GTEST_HAS_TYPED_TEST_P - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// -// Expands to the namespace name that the type-parameterized tests for -// the given type-parameterized test suite are defined in. The exact -// name of the namespace is subject to change without notice. -#define GTEST_SUITE_NAMESPACE_(TestSuiteName) gtest_suite_##TestSuiteName##_ - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// -// Expands to the name of the variable used to remember the names of -// the defined tests in the given test suite. -#define GTEST_TYPED_TEST_SUITE_P_STATE_(TestSuiteName) \ - gtest_typed_test_suite_p_state_##TestSuiteName##_ - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY. -// -// Expands to the name of the variable used to remember the names of -// the registered tests in the given test suite. -#define GTEST_REGISTERED_TEST_NAMES_(TestSuiteName) \ - gtest_registered_test_names_##TestSuiteName##_ - -// The variables defined in the type-parameterized test macros are -// static as typically these macros are used in a .h file that can be -// #included in multiple translation units linked together. -#define TYPED_TEST_SUITE_P(SuiteName) \ - static ::testing::internal::TypedTestSuitePState \ - GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName) - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -#define TYPED_TEST_CASE_P \ - static_assert(::testing::internal::TypedTestCase_P_IsDeprecated(), ""); \ - TYPED_TEST_SUITE_P -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -#define TYPED_TEST_P(SuiteName, TestName) \ - namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \ - template <typename gtest_TypeParam_> \ - class TestName : public SuiteName<gtest_TypeParam_> { \ - private: \ - typedef SuiteName<gtest_TypeParam_> TestFixture; \ - typedef gtest_TypeParam_ TypeParam; \ - virtual void TestBody(); \ - }; \ - static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \ - GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \ - __FILE__, __LINE__, #SuiteName, #TestName); \ - } \ - template <typename gtest_TypeParam_> \ - void GTEST_SUITE_NAMESPACE_( \ - SuiteName)::TestName<gtest_TypeParam_>::TestBody() - -#define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \ - namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \ - typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \ - } \ - static const char* const GTEST_REGISTERED_TEST_NAMES_( \ - SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \ - GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).VerifyRegisteredTestNames( \ - __FILE__, __LINE__, #__VA_ARGS__) - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -#define REGISTER_TYPED_TEST_CASE_P \ - static_assert(::testing::internal::RegisterTypedTestCase_P_IsDeprecated(), \ - ""); \ - REGISTER_TYPED_TEST_SUITE_P -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \ - static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \ - ::testing::internal::TypeParameterizedTestSuite< \ - SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \ - ::testing::internal::TypeList<Types>::type>:: \ - Register(#Prefix, \ - ::testing::internal::CodeLocation(__FILE__, __LINE__), \ - >EST_TYPED_TEST_SUITE_P_STATE_(SuiteName), #SuiteName, \ - GTEST_REGISTERED_TEST_NAMES_(SuiteName), \ - ::testing::internal::GenerateNames< \ - ::testing::internal::NameGeneratorSelector< \ - __VA_ARGS__>::type, \ - ::testing::internal::TypeList<Types>::type>()) - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -#define INSTANTIATE_TYPED_TEST_CASE_P \ - static_assert( \ - ::testing::internal::InstantiateTypedTestCase_P_IsDeprecated(), ""); \ - INSTANTIATE_TYPED_TEST_SUITE_P -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -#endif // GTEST_HAS_TYPED_TEST_P - -#endif // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/gtest.h b/3rdParty/googletest/googletest/include/gtest/gtest.h deleted file mode 100644 index dbe5b1c2c3f647f9d707e2e4ceb1d0c0d2aac7dd..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/gtest.h +++ /dev/null @@ -1,2478 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// The Google C++ Testing and Mocking Framework (Google Test) -// -// This header file defines the public API for Google Test. It should be -// included by any test program that uses Google Test. -// -// IMPORTANT NOTE: Due to limitation of the C++ language, we have to -// leave some internal implementation details in this header file. -// They are clearly marked by comments like this: -// -// // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -// -// Such code is NOT meant to be used by a user directly, and is subject -// to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user -// program! -// -// Acknowledgment: Google Test borrowed the idea of automatic test -// registration from Barthelemy Dagenais' (barthelemy@prologique.com) -// easyUnit framework. - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_GTEST_H_ -#define GTEST_INCLUDE_GTEST_GTEST_H_ - -#include <cstddef> -#include <limits> -#include <memory> -#include <ostream> -#include <type_traits> -#include <vector> - -#include "gtest/internal/gtest-internal.h" -#include "gtest/internal/gtest-string.h" -#include "gtest/gtest-death-test.h" -#include "gtest/gtest-matchers.h" -#include "gtest/gtest-message.h" -#include "gtest/gtest-param-test.h" -#include "gtest/gtest-printers.h" -#include "gtest/gtest_prod.h" -#include "gtest/gtest-test-part.h" -#include "gtest/gtest-typed-test.h" - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -namespace testing { - -// Silence C4100 (unreferenced formal parameter) and 4805 -// unsafe mix of type 'const int' and type 'const bool' -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4805) -# pragma warning(disable:4100) -#endif - - -// Declares the flags. - -// This flag temporary enables the disabled tests. -GTEST_DECLARE_bool_(also_run_disabled_tests); - -// This flag brings the debugger on an assertion failure. -GTEST_DECLARE_bool_(break_on_failure); - -// This flag controls whether Google Test catches all test-thrown exceptions -// and logs them as failures. -GTEST_DECLARE_bool_(catch_exceptions); - -// This flag enables using colors in terminal output. Available values are -// "yes" to enable colors, "no" (disable colors), or "auto" (the default) -// to let Google Test decide. -GTEST_DECLARE_string_(color); - -// This flag sets up the filter to select by name using a glob pattern -// the tests to run. If the filter is not given all tests are executed. -GTEST_DECLARE_string_(filter); - -// This flag controls whether Google Test installs a signal handler that dumps -// debugging information when fatal signals are raised. -GTEST_DECLARE_bool_(install_failure_signal_handler); - -// This flag causes the Google Test to list tests. None of the tests listed -// are actually run if the flag is provided. -GTEST_DECLARE_bool_(list_tests); - -// This flag controls whether Google Test emits a detailed XML report to a file -// in addition to its normal textual output. -GTEST_DECLARE_string_(output); - -// This flags control whether Google Test prints the elapsed time for each -// test. -GTEST_DECLARE_bool_(print_time); - -// This flags control whether Google Test prints UTF8 characters as text. -GTEST_DECLARE_bool_(print_utf8); - -// This flag specifies the random number seed. -GTEST_DECLARE_int32_(random_seed); - -// This flag sets how many times the tests are repeated. The default value -// is 1. If the value is -1 the tests are repeating forever. -GTEST_DECLARE_int32_(repeat); - -// This flag controls whether Google Test includes Google Test internal -// stack frames in failure stack traces. -GTEST_DECLARE_bool_(show_internal_stack_frames); - -// When this flag is specified, tests' order is randomized on every iteration. -GTEST_DECLARE_bool_(shuffle); - -// This flag specifies the maximum number of stack frames to be -// printed in a failure message. -GTEST_DECLARE_int32_(stack_trace_depth); - -// When this flag is specified, a failed assertion will throw an -// exception if exceptions are enabled, or exit the program with a -// non-zero code otherwise. For use with an external test framework. -GTEST_DECLARE_bool_(throw_on_failure); - -// When this flag is set with a "host:port" string, on supported -// platforms test results are streamed to the specified port on -// the specified host machine. -GTEST_DECLARE_string_(stream_result_to); - -#if GTEST_USE_OWN_FLAGFILE_FLAG_ -GTEST_DECLARE_string_(flagfile); -#endif // GTEST_USE_OWN_FLAGFILE_FLAG_ - -// The upper limit for valid stack trace depths. -const int kMaxStackTraceDepth = 100; - -namespace internal { - -class AssertHelper; -class DefaultGlobalTestPartResultReporter; -class ExecDeathTest; -class NoExecDeathTest; -class FinalSuccessChecker; -class GTestFlagSaver; -class StreamingListenerTest; -class TestResultAccessor; -class TestEventListenersAccessor; -class TestEventRepeater; -class UnitTestRecordPropertyTestHelper; -class WindowsDeathTest; -class FuchsiaDeathTest; -class UnitTestImpl* GetUnitTestImpl(); -void ReportFailureInUnknownLocation(TestPartResult::Type result_type, - const std::string& message); - -} // namespace internal - -// The friend relationship of some of these classes is cyclic. -// If we don't forward declare them the compiler might confuse the classes -// in friendship clauses with same named classes on the scope. -class Test; -class TestSuite; - -// Old API is still available but deprecated -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -using TestCase = TestSuite; -#endif -class TestInfo; -class UnitTest; - -// A class for indicating whether an assertion was successful. When -// the assertion wasn't successful, the AssertionResult object -// remembers a non-empty message that describes how it failed. -// -// To create an instance of this class, use one of the factory functions -// (AssertionSuccess() and AssertionFailure()). -// -// This class is useful for two purposes: -// 1. Defining predicate functions to be used with Boolean test assertions -// EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts -// 2. Defining predicate-format functions to be -// used with predicate assertions (ASSERT_PRED_FORMAT*, etc). -// -// For example, if you define IsEven predicate: -// -// testing::AssertionResult IsEven(int n) { -// if ((n % 2) == 0) -// return testing::AssertionSuccess(); -// else -// return testing::AssertionFailure() << n << " is odd"; -// } -// -// Then the failed expectation EXPECT_TRUE(IsEven(Fib(5))) -// will print the message -// -// Value of: IsEven(Fib(5)) -// Actual: false (5 is odd) -// Expected: true -// -// instead of a more opaque -// -// Value of: IsEven(Fib(5)) -// Actual: false -// Expected: true -// -// in case IsEven is a simple Boolean predicate. -// -// If you expect your predicate to be reused and want to support informative -// messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up -// about half as often as positive ones in our tests), supply messages for -// both success and failure cases: -// -// testing::AssertionResult IsEven(int n) { -// if ((n % 2) == 0) -// return testing::AssertionSuccess() << n << " is even"; -// else -// return testing::AssertionFailure() << n << " is odd"; -// } -// -// Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print -// -// Value of: IsEven(Fib(6)) -// Actual: true (8 is even) -// Expected: false -// -// NB: Predicates that support negative Boolean assertions have reduced -// performance in positive ones so be careful not to use them in tests -// that have lots (tens of thousands) of positive Boolean assertions. -// -// To use this class with EXPECT_PRED_FORMAT assertions such as: -// -// // Verifies that Foo() returns an even number. -// EXPECT_PRED_FORMAT1(IsEven, Foo()); -// -// you need to define: -// -// testing::AssertionResult IsEven(const char* expr, int n) { -// if ((n % 2) == 0) -// return testing::AssertionSuccess(); -// else -// return testing::AssertionFailure() -// << "Expected: " << expr << " is even\n Actual: it's " << n; -// } -// -// If Foo() returns 5, you will see the following message: -// -// Expected: Foo() is even -// Actual: it's 5 -// -class GTEST_API_ AssertionResult { - public: - // Copy constructor. - // Used in EXPECT_TRUE/FALSE(assertion_result). - AssertionResult(const AssertionResult& other); - -#if defined(_MSC_VER) && _MSC_VER < 1910 - GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */) -#endif - - // Used in the EXPECT_TRUE/FALSE(bool_expression). - // - // T must be contextually convertible to bool. - // - // The second parameter prevents this overload from being considered if - // the argument is implicitly convertible to AssertionResult. In that case - // we want AssertionResult's copy constructor to be used. - template <typename T> - explicit AssertionResult( - const T& success, - typename std::enable_if< - !std::is_convertible<T, AssertionResult>::value>::type* - /*enabler*/ - = nullptr) - : success_(success) {} - -#if defined(_MSC_VER) && _MSC_VER < 1910 - GTEST_DISABLE_MSC_WARNINGS_POP_() -#endif - - // Assignment operator. - AssertionResult& operator=(AssertionResult other) { - swap(other); - return *this; - } - - // Returns true if and only if the assertion succeeded. - operator bool() const { return success_; } // NOLINT - - // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE. - AssertionResult operator!() const; - - // Returns the text streamed into this AssertionResult. Test assertions - // use it when they fail (i.e., the predicate's outcome doesn't match the - // assertion's expectation). When nothing has been streamed into the - // object, returns an empty string. - const char* message() const { - return message_.get() != nullptr ? message_->c_str() : ""; - } - // Deprecated; please use message() instead. - const char* failure_message() const { return message(); } - - // Streams a custom failure message into this object. - template <typename T> AssertionResult& operator<<(const T& value) { - AppendMessage(Message() << value); - return *this; - } - - // Allows streaming basic output manipulators such as endl or flush into - // this object. - AssertionResult& operator<<( - ::std::ostream& (*basic_manipulator)(::std::ostream& stream)) { - AppendMessage(Message() << basic_manipulator); - return *this; - } - - private: - // Appends the contents of message to message_. - void AppendMessage(const Message& a_message) { - if (message_.get() == nullptr) message_.reset(new ::std::string); - message_->append(a_message.GetString().c_str()); - } - - // Swap the contents of this AssertionResult with other. - void swap(AssertionResult& other); - - // Stores result of the assertion predicate. - bool success_; - // Stores the message describing the condition in case the expectation - // construct is not satisfied with the predicate's outcome. - // Referenced via a pointer to avoid taking too much stack frame space - // with test assertions. - std::unique_ptr< ::std::string> message_; -}; - -// Makes a successful assertion result. -GTEST_API_ AssertionResult AssertionSuccess(); - -// Makes a failed assertion result. -GTEST_API_ AssertionResult AssertionFailure(); - -// Makes a failed assertion result with the given failure message. -// Deprecated; use AssertionFailure() << msg. -GTEST_API_ AssertionResult AssertionFailure(const Message& msg); - -} // namespace testing - -// Includes the auto-generated header that implements a family of generic -// predicate assertion macros. This include comes late because it relies on -// APIs declared above. -#include "gtest/gtest_pred_impl.h" - -namespace testing { - -// The abstract class that all tests inherit from. -// -// In Google Test, a unit test program contains one or many TestSuites, and -// each TestSuite contains one or many Tests. -// -// When you define a test using the TEST macro, you don't need to -// explicitly derive from Test - the TEST macro automatically does -// this for you. -// -// The only time you derive from Test is when defining a test fixture -// to be used in a TEST_F. For example: -// -// class FooTest : public testing::Test { -// protected: -// void SetUp() override { ... } -// void TearDown() override { ... } -// ... -// }; -// -// TEST_F(FooTest, Bar) { ... } -// TEST_F(FooTest, Baz) { ... } -// -// Test is not copyable. -class GTEST_API_ Test { - public: - friend class TestInfo; - - // The d'tor is virtual as we intend to inherit from Test. - virtual ~Test(); - - // Sets up the stuff shared by all tests in this test case. - // - // Google Test will call Foo::SetUpTestSuite() before running the first - // test in test case Foo. Hence a sub-class can define its own - // SetUpTestSuite() method to shadow the one defined in the super - // class. - // Failures that happen during SetUpTestSuite are logged but otherwise - // ignored. - static void SetUpTestSuite() {} - - // Tears down the stuff shared by all tests in this test suite. - // - // Google Test will call Foo::TearDownTestSuite() after running the last - // test in test case Foo. Hence a sub-class can define its own - // TearDownTestSuite() method to shadow the one defined in the super - // class. - // Failures that happen during TearDownTestSuite are logged but otherwise - // ignored. - static void TearDownTestSuite() {} - - // Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - static void TearDownTestCase() {} - static void SetUpTestCase() {} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - // Returns true if and only if the current test has a fatal failure. - static bool HasFatalFailure(); - - // Returns true if and only if the current test has a non-fatal failure. - static bool HasNonfatalFailure(); - - // Returns true if and only if the current test was skipped. - static bool IsSkipped(); - - // Returns true if and only if the current test has a (either fatal or - // non-fatal) failure. - static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); } - - // Logs a property for the current test, test suite, or for the entire - // invocation of the test program when used outside of the context of a - // test suite. Only the last value for a given key is remembered. These - // are public static so they can be called from utility functions that are - // not members of the test fixture. Calls to RecordProperty made during - // lifespan of the test (from the moment its constructor starts to the - // moment its destructor finishes) will be output in XML as attributes of - // the <testcase> element. Properties recorded from fixture's - // SetUpTestSuite or TearDownTestSuite are logged as attributes of the - // corresponding <testsuite> element. Calls to RecordProperty made in the - // global context (before or after invocation of RUN_ALL_TESTS and from - // SetUp/TearDown method of Environment objects registered with Google - // Test) will be output as attributes of the <testsuites> element. - static void RecordProperty(const std::string& key, const std::string& value); - static void RecordProperty(const std::string& key, int value); - - protected: - // Creates a Test object. - Test(); - - // Sets up the test fixture. - virtual void SetUp(); - - // Tears down the test fixture. - virtual void TearDown(); - - private: - // Returns true if and only if the current test has the same fixture class - // as the first test in the current test suite. - static bool HasSameFixtureClass(); - - // Runs the test after the test fixture has been set up. - // - // A sub-class must implement this to define the test logic. - // - // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM. - // Instead, use the TEST or TEST_F macro. - virtual void TestBody() = 0; - - // Sets up, executes, and tears down the test. - void Run(); - - // Deletes self. We deliberately pick an unusual name for this - // internal method to avoid clashing with names used in user TESTs. - void DeleteSelf_() { delete this; } - - const std::unique_ptr<GTEST_FLAG_SAVER_> gtest_flag_saver_; - - // Often a user misspells SetUp() as Setup() and spends a long time - // wondering why it is never called by Google Test. The declaration of - // the following method is solely for catching such an error at - // compile time: - // - // - The return type is deliberately chosen to be not void, so it - // will be a conflict if void Setup() is declared in the user's - // test fixture. - // - // - This method is private, so it will be another compiler error - // if the method is called from the user's test fixture. - // - // DO NOT OVERRIDE THIS FUNCTION. - // - // If you see an error about overriding the following function or - // about it being private, you have mis-spelled SetUp() as Setup(). - struct Setup_should_be_spelled_SetUp {}; - virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; } - - // We disallow copying Tests. - GTEST_DISALLOW_COPY_AND_ASSIGN_(Test); -}; - -typedef internal::TimeInMillis TimeInMillis; - -// A copyable object representing a user specified test property which can be -// output as a key/value string pair. -// -// Don't inherit from TestProperty as its destructor is not virtual. -class TestProperty { - public: - // C'tor. TestProperty does NOT have a default constructor. - // Always use this constructor (with parameters) to create a - // TestProperty object. - TestProperty(const std::string& a_key, const std::string& a_value) : - key_(a_key), value_(a_value) { - } - - // Gets the user supplied key. - const char* key() const { - return key_.c_str(); - } - - // Gets the user supplied value. - const char* value() const { - return value_.c_str(); - } - - // Sets a new value, overriding the one supplied in the constructor. - void SetValue(const std::string& new_value) { - value_ = new_value; - } - - private: - // The key supplied by the user. - std::string key_; - // The value supplied by the user. - std::string value_; -}; - -// The result of a single Test. This includes a list of -// TestPartResults, a list of TestProperties, a count of how many -// death tests there are in the Test, and how much time it took to run -// the Test. -// -// TestResult is not copyable. -class GTEST_API_ TestResult { - public: - // Creates an empty TestResult. - TestResult(); - - // D'tor. Do not inherit from TestResult. - ~TestResult(); - - // Gets the number of all test parts. This is the sum of the number - // of successful test parts and the number of failed test parts. - int total_part_count() const; - - // Returns the number of the test properties. - int test_property_count() const; - - // Returns true if and only if the test passed (i.e. no test part failed). - bool Passed() const { return !Skipped() && !Failed(); } - - // Returns true if and only if the test was skipped. - bool Skipped() const; - - // Returns true if and only if the test failed. - bool Failed() const; - - // Returns true if and only if the test fatally failed. - bool HasFatalFailure() const; - - // Returns true if and only if the test has a non-fatal failure. - bool HasNonfatalFailure() const; - - // Returns the elapsed time, in milliseconds. - TimeInMillis elapsed_time() const { return elapsed_time_; } - - // Gets the time of the test case start, in ms from the start of the - // UNIX epoch. - TimeInMillis start_timestamp() const { return start_timestamp_; } - - // Returns the i-th test part result among all the results. i can range from 0 - // to total_part_count() - 1. If i is not in that range, aborts the program. - const TestPartResult& GetTestPartResult(int i) const; - - // Returns the i-th test property. i can range from 0 to - // test_property_count() - 1. If i is not in that range, aborts the - // program. - const TestProperty& GetTestProperty(int i) const; - - private: - friend class TestInfo; - friend class TestSuite; - friend class UnitTest; - friend class internal::DefaultGlobalTestPartResultReporter; - friend class internal::ExecDeathTest; - friend class internal::TestResultAccessor; - friend class internal::UnitTestImpl; - friend class internal::WindowsDeathTest; - friend class internal::FuchsiaDeathTest; - - // Gets the vector of TestPartResults. - const std::vector<TestPartResult>& test_part_results() const { - return test_part_results_; - } - - // Gets the vector of TestProperties. - const std::vector<TestProperty>& test_properties() const { - return test_properties_; - } - - // Sets the start time. - void set_start_timestamp(TimeInMillis start) { start_timestamp_ = start; } - - // Sets the elapsed time. - void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; } - - // Adds a test property to the list. The property is validated and may add - // a non-fatal failure if invalid (e.g., if it conflicts with reserved - // key names). If a property is already recorded for the same key, the - // value will be updated, rather than storing multiple values for the same - // key. xml_element specifies the element for which the property is being - // recorded and is used for validation. - void RecordProperty(const std::string& xml_element, - const TestProperty& test_property); - - // Adds a failure if the key is a reserved attribute of Google Test - // testsuite tags. Returns true if the property is valid. - // FIXME: Validate attribute names are legal and human readable. - static bool ValidateTestProperty(const std::string& xml_element, - const TestProperty& test_property); - - // Adds a test part result to the list. - void AddTestPartResult(const TestPartResult& test_part_result); - - // Returns the death test count. - int death_test_count() const { return death_test_count_; } - - // Increments the death test count, returning the new count. - int increment_death_test_count() { return ++death_test_count_; } - - // Clears the test part results. - void ClearTestPartResults(); - - // Clears the object. - void Clear(); - - // Protects mutable state of the property vector and of owned - // properties, whose values may be updated. - internal::Mutex test_properites_mutex_; - - // The vector of TestPartResults - std::vector<TestPartResult> test_part_results_; - // The vector of TestProperties - std::vector<TestProperty> test_properties_; - // Running count of death tests. - int death_test_count_; - // The start time, in milliseconds since UNIX Epoch. - TimeInMillis start_timestamp_; - // The elapsed time, in milliseconds. - TimeInMillis elapsed_time_; - - // We disallow copying TestResult. - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult); -}; // class TestResult - -// A TestInfo object stores the following information about a test: -// -// Test suite name -// Test name -// Whether the test should be run -// A function pointer that creates the test object when invoked -// Test result -// -// The constructor of TestInfo registers itself with the UnitTest -// singleton such that the RUN_ALL_TESTS() macro knows which tests to -// run. -class GTEST_API_ TestInfo { - public: - // Destructs a TestInfo object. This function is not virtual, so - // don't inherit from TestInfo. - ~TestInfo(); - - // Returns the test suite name. - const char* test_suite_name() const { return test_suite_name_.c_str(); } - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - const char* test_case_name() const { return test_suite_name(); } -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - // Returns the test name. - const char* name() const { return name_.c_str(); } - - // Returns the name of the parameter type, or NULL if this is not a typed - // or a type-parameterized test. - const char* type_param() const { - if (type_param_.get() != nullptr) return type_param_->c_str(); - return nullptr; - } - - // Returns the text representation of the value parameter, or NULL if this - // is not a value-parameterized test. - const char* value_param() const { - if (value_param_.get() != nullptr) return value_param_->c_str(); - return nullptr; - } - - // Returns the file name where this test is defined. - const char* file() const { return location_.file.c_str(); } - - // Returns the line where this test is defined. - int line() const { return location_.line; } - - // Return true if this test should not be run because it's in another shard. - bool is_in_another_shard() const { return is_in_another_shard_; } - - // Returns true if this test should run, that is if the test is not - // disabled (or it is disabled but the also_run_disabled_tests flag has - // been specified) and its full name matches the user-specified filter. - // - // Google Test allows the user to filter the tests by their full names. - // The full name of a test Bar in test suite Foo is defined as - // "Foo.Bar". Only the tests that match the filter will run. - // - // A filter is a colon-separated list of glob (not regex) patterns, - // optionally followed by a '-' and a colon-separated list of - // negative patterns (tests to exclude). A test is run if it - // matches one of the positive patterns and does not match any of - // the negative patterns. - // - // For example, *A*:Foo.* is a filter that matches any string that - // contains the character 'A' or starts with "Foo.". - bool should_run() const { return should_run_; } - - // Returns true if and only if this test will appear in the XML report. - bool is_reportable() const { - // The XML report includes tests matching the filter, excluding those - // run in other shards. - return matches_filter_ && !is_in_another_shard_; - } - - // Returns the result of the test. - const TestResult* result() const { return &result_; } - - private: -#if GTEST_HAS_DEATH_TEST - friend class internal::DefaultDeathTestFactory; -#endif // GTEST_HAS_DEATH_TEST - friend class Test; - friend class TestSuite; - friend class internal::UnitTestImpl; - friend class internal::StreamingListenerTest; - friend TestInfo* internal::MakeAndRegisterTestInfo( - const char* test_suite_name, const char* name, const char* type_param, - const char* value_param, internal::CodeLocation code_location, - internal::TypeId fixture_class_id, internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc, - internal::TestFactoryBase* factory); - - // Constructs a TestInfo object. The newly constructed instance assumes - // ownership of the factory object. - TestInfo(const std::string& test_suite_name, const std::string& name, - const char* a_type_param, // NULL if not a type-parameterized test - const char* a_value_param, // NULL if not a value-parameterized test - internal::CodeLocation a_code_location, - internal::TypeId fixture_class_id, - internal::TestFactoryBase* factory); - - // Increments the number of death tests encountered in this test so - // far. - int increment_death_test_count() { - return result_.increment_death_test_count(); - } - - // Creates the test object, runs it, records its result, and then - // deletes it. - void Run(); - - static void ClearTestResult(TestInfo* test_info) { - test_info->result_.Clear(); - } - - // These fields are immutable properties of the test. - const std::string test_suite_name_; // test suite name - const std::string name_; // Test name - // Name of the parameter type, or NULL if this is not a typed or a - // type-parameterized test. - const std::unique_ptr<const ::std::string> type_param_; - // Text representation of the value parameter, or NULL if this is not a - // value-parameterized test. - const std::unique_ptr<const ::std::string> value_param_; - internal::CodeLocation location_; - const internal::TypeId fixture_class_id_; // ID of the test fixture class - bool should_run_; // True if and only if this test should run - bool is_disabled_; // True if and only if this test is disabled - bool matches_filter_; // True if this test matches the - // user-specified filter. - bool is_in_another_shard_; // Will be run in another shard. - internal::TestFactoryBase* const factory_; // The factory that creates - // the test object - - // This field is mutable and needs to be reset before running the - // test for the second time. - TestResult result_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo); -}; - -// A test suite, which consists of a vector of TestInfos. -// -// TestSuite is not copyable. -class GTEST_API_ TestSuite { - public: - // Creates a TestSuite with the given name. - // - // TestSuite does NOT have a default constructor. Always use this - // constructor to create a TestSuite object. - // - // Arguments: - // - // name: name of the test suite - // a_type_param: the name of the test's type parameter, or NULL if - // this is not a type-parameterized test. - // set_up_tc: pointer to the function that sets up the test suite - // tear_down_tc: pointer to the function that tears down the test suite - TestSuite(const char* name, const char* a_type_param, - internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc); - - // Destructor of TestSuite. - virtual ~TestSuite(); - - // Gets the name of the TestSuite. - const char* name() const { return name_.c_str(); } - - // Returns the name of the parameter type, or NULL if this is not a - // type-parameterized test suite. - const char* type_param() const { - if (type_param_.get() != nullptr) return type_param_->c_str(); - return nullptr; - } - - // Returns true if any test in this test suite should run. - bool should_run() const { return should_run_; } - - // Gets the number of successful tests in this test suite. - int successful_test_count() const; - - // Gets the number of skipped tests in this test suite. - int skipped_test_count() const; - - // Gets the number of failed tests in this test suite. - int failed_test_count() const; - - // Gets the number of disabled tests that will be reported in the XML report. - int reportable_disabled_test_count() const; - - // Gets the number of disabled tests in this test suite. - int disabled_test_count() const; - - // Gets the number of tests to be printed in the XML report. - int reportable_test_count() const; - - // Get the number of tests in this test suite that should run. - int test_to_run_count() const; - - // Gets the number of all tests in this test suite. - int total_test_count() const; - - // Returns true if and only if the test suite passed. - bool Passed() const { return !Failed(); } - - // Returns true if and only if the test suite failed. - bool Failed() const { return failed_test_count() > 0; } - - // Returns the elapsed time, in milliseconds. - TimeInMillis elapsed_time() const { return elapsed_time_; } - - // Gets the time of the test suite start, in ms from the start of the - // UNIX epoch. - TimeInMillis start_timestamp() const { return start_timestamp_; } - - // Returns the i-th test among all the tests. i can range from 0 to - // total_test_count() - 1. If i is not in that range, returns NULL. - const TestInfo* GetTestInfo(int i) const; - - // Returns the TestResult that holds test properties recorded during - // execution of SetUpTestSuite and TearDownTestSuite. - const TestResult& ad_hoc_test_result() const { return ad_hoc_test_result_; } - - private: - friend class Test; - friend class internal::UnitTestImpl; - - // Gets the (mutable) vector of TestInfos in this TestSuite. - std::vector<TestInfo*>& test_info_list() { return test_info_list_; } - - // Gets the (immutable) vector of TestInfos in this TestSuite. - const std::vector<TestInfo*>& test_info_list() const { - return test_info_list_; - } - - // Returns the i-th test among all the tests. i can range from 0 to - // total_test_count() - 1. If i is not in that range, returns NULL. - TestInfo* GetMutableTestInfo(int i); - - // Sets the should_run member. - void set_should_run(bool should) { should_run_ = should; } - - // Adds a TestInfo to this test suite. Will delete the TestInfo upon - // destruction of the TestSuite object. - void AddTestInfo(TestInfo * test_info); - - // Clears the results of all tests in this test suite. - void ClearResult(); - - // Clears the results of all tests in the given test suite. - static void ClearTestSuiteResult(TestSuite* test_suite) { - test_suite->ClearResult(); - } - - // Runs every test in this TestSuite. - void Run(); - - // Runs SetUpTestSuite() for this TestSuite. This wrapper is needed - // for catching exceptions thrown from SetUpTestSuite(). - void RunSetUpTestSuite() { - if (set_up_tc_ != nullptr) { - (*set_up_tc_)(); - } - } - - // Runs TearDownTestSuite() for this TestSuite. This wrapper is - // needed for catching exceptions thrown from TearDownTestSuite(). - void RunTearDownTestSuite() { - if (tear_down_tc_ != nullptr) { - (*tear_down_tc_)(); - } - } - - // Returns true if and only if test passed. - static bool TestPassed(const TestInfo* test_info) { - return test_info->should_run() && test_info->result()->Passed(); - } - - // Returns true if and only if test skipped. - static bool TestSkipped(const TestInfo* test_info) { - return test_info->should_run() && test_info->result()->Skipped(); - } - - // Returns true if and only if test failed. - static bool TestFailed(const TestInfo* test_info) { - return test_info->should_run() && test_info->result()->Failed(); - } - - // Returns true if and only if the test is disabled and will be reported in - // the XML report. - static bool TestReportableDisabled(const TestInfo* test_info) { - return test_info->is_reportable() && test_info->is_disabled_; - } - - // Returns true if and only if test is disabled. - static bool TestDisabled(const TestInfo* test_info) { - return test_info->is_disabled_; - } - - // Returns true if and only if this test will appear in the XML report. - static bool TestReportable(const TestInfo* test_info) { - return test_info->is_reportable(); - } - - // Returns true if the given test should run. - static bool ShouldRunTest(const TestInfo* test_info) { - return test_info->should_run(); - } - - // Shuffles the tests in this test suite. - void ShuffleTests(internal::Random* random); - - // Restores the test order to before the first shuffle. - void UnshuffleTests(); - - // Name of the test suite. - std::string name_; - // Name of the parameter type, or NULL if this is not a typed or a - // type-parameterized test. - const std::unique_ptr<const ::std::string> type_param_; - // The vector of TestInfos in their original order. It owns the - // elements in the vector. - std::vector<TestInfo*> test_info_list_; - // Provides a level of indirection for the test list to allow easy - // shuffling and restoring the test order. The i-th element in this - // vector is the index of the i-th test in the shuffled test list. - std::vector<int> test_indices_; - // Pointer to the function that sets up the test suite. - internal::SetUpTestSuiteFunc set_up_tc_; - // Pointer to the function that tears down the test suite. - internal::TearDownTestSuiteFunc tear_down_tc_; - // True if and only if any test in this test suite should run. - bool should_run_; - // The start time, in milliseconds since UNIX Epoch. - TimeInMillis start_timestamp_; - // Elapsed time, in milliseconds. - TimeInMillis elapsed_time_; - // Holds test properties recorded during execution of SetUpTestSuite and - // TearDownTestSuite. - TestResult ad_hoc_test_result_; - - // We disallow copying TestSuites. - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestSuite); -}; - -// An Environment object is capable of setting up and tearing down an -// environment. You should subclass this to define your own -// environment(s). -// -// An Environment object does the set-up and tear-down in virtual -// methods SetUp() and TearDown() instead of the constructor and the -// destructor, as: -// -// 1. You cannot safely throw from a destructor. This is a problem -// as in some cases Google Test is used where exceptions are enabled, and -// we may want to implement ASSERT_* using exceptions where they are -// available. -// 2. You cannot use ASSERT_* directly in a constructor or -// destructor. -class Environment { - public: - // The d'tor is virtual as we need to subclass Environment. - virtual ~Environment() {} - - // Override this to define how to set up the environment. - virtual void SetUp() {} - - // Override this to define how to tear down the environment. - virtual void TearDown() {} - private: - // If you see an error about overriding the following function or - // about it being private, you have mis-spelled SetUp() as Setup(). - struct Setup_should_be_spelled_SetUp {}; - virtual Setup_should_be_spelled_SetUp* Setup() { return nullptr; } -}; - -#if GTEST_HAS_EXCEPTIONS - -// Exception which can be thrown from TestEventListener::OnTestPartResult. -class GTEST_API_ AssertionException - : public internal::GoogleTestFailureException { - public: - explicit AssertionException(const TestPartResult& result) - : GoogleTestFailureException(result) {} -}; - -#endif // GTEST_HAS_EXCEPTIONS - -// The interface for tracing execution of tests. The methods are organized in -// the order the corresponding events are fired. -class TestEventListener { - public: - virtual ~TestEventListener() {} - - // Fired before any test activity starts. - virtual void OnTestProgramStart(const UnitTest& unit_test) = 0; - - // Fired before each iteration of tests starts. There may be more than - // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration - // index, starting from 0. - virtual void OnTestIterationStart(const UnitTest& unit_test, - int iteration) = 0; - - // Fired before environment set-up for each iteration of tests starts. - virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0; - - // Fired after environment set-up for each iteration of tests ends. - virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0; - - // Fired before the test suite starts. - virtual void OnTestSuiteStart(const TestSuite& /*test_suite*/) {} - - // Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - virtual void OnTestCaseStart(const TestCase& /*test_case*/) {} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - // Fired before the test starts. - virtual void OnTestStart(const TestInfo& test_info) = 0; - - // Fired after a failed assertion or a SUCCEED() invocation. - // If you want to throw an exception from this function to skip to the next - // TEST, it must be AssertionException defined above, or inherited from it. - virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0; - - // Fired after the test ends. - virtual void OnTestEnd(const TestInfo& test_info) = 0; - - // Fired after the test suite ends. - virtual void OnTestSuiteEnd(const TestSuite& /*test_suite*/) {} - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - // Fired before environment tear-down for each iteration of tests starts. - virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0; - - // Fired after environment tear-down for each iteration of tests ends. - virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0; - - // Fired after each iteration of tests finishes. - virtual void OnTestIterationEnd(const UnitTest& unit_test, - int iteration) = 0; - - // Fired after all test activities have ended. - virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0; -}; - -// The convenience class for users who need to override just one or two -// methods and are not concerned that a possible change to a signature of -// the methods they override will not be caught during the build. For -// comments about each method please see the definition of TestEventListener -// above. -class EmptyTestEventListener : public TestEventListener { - public: - void OnTestProgramStart(const UnitTest& /*unit_test*/) override {} - void OnTestIterationStart(const UnitTest& /*unit_test*/, - int /*iteration*/) override {} - void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) override {} - void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {} - void OnTestSuiteStart(const TestSuite& /*test_suite*/) override {} -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseStart(const TestCase& /*test_case*/) override {} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - void OnTestStart(const TestInfo& /*test_info*/) override {} - void OnTestPartResult(const TestPartResult& /*test_part_result*/) override {} - void OnTestEnd(const TestInfo& /*test_info*/) override {} - void OnTestSuiteEnd(const TestSuite& /*test_suite*/) override {} -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseEnd(const TestCase& /*test_case*/) override {} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) override {} - void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {} - void OnTestIterationEnd(const UnitTest& /*unit_test*/, - int /*iteration*/) override {} - void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {} -}; - -// TestEventListeners lets users add listeners to track events in Google Test. -class GTEST_API_ TestEventListeners { - public: - TestEventListeners(); - ~TestEventListeners(); - - // Appends an event listener to the end of the list. Google Test assumes - // the ownership of the listener (i.e. it will delete the listener when - // the test program finishes). - void Append(TestEventListener* listener); - - // Removes the given event listener from the list and returns it. It then - // becomes the caller's responsibility to delete the listener. Returns - // NULL if the listener is not found in the list. - TestEventListener* Release(TestEventListener* listener); - - // Returns the standard listener responsible for the default console - // output. Can be removed from the listeners list to shut down default - // console output. Note that removing this object from the listener list - // with Release transfers its ownership to the caller and makes this - // function return NULL the next time. - TestEventListener* default_result_printer() const { - return default_result_printer_; - } - - // Returns the standard listener responsible for the default XML output - // controlled by the --gtest_output=xml flag. Can be removed from the - // listeners list by users who want to shut down the default XML output - // controlled by this flag and substitute it with custom one. Note that - // removing this object from the listener list with Release transfers its - // ownership to the caller and makes this function return NULL the next - // time. - TestEventListener* default_xml_generator() const { - return default_xml_generator_; - } - - private: - friend class TestSuite; - friend class TestInfo; - friend class internal::DefaultGlobalTestPartResultReporter; - friend class internal::NoExecDeathTest; - friend class internal::TestEventListenersAccessor; - friend class internal::UnitTestImpl; - - // Returns repeater that broadcasts the TestEventListener events to all - // subscribers. - TestEventListener* repeater(); - - // Sets the default_result_printer attribute to the provided listener. - // The listener is also added to the listener list and previous - // default_result_printer is removed from it and deleted. The listener can - // also be NULL in which case it will not be added to the list. Does - // nothing if the previous and the current listener objects are the same. - void SetDefaultResultPrinter(TestEventListener* listener); - - // Sets the default_xml_generator attribute to the provided listener. The - // listener is also added to the listener list and previous - // default_xml_generator is removed from it and deleted. The listener can - // also be NULL in which case it will not be added to the list. Does - // nothing if the previous and the current listener objects are the same. - void SetDefaultXmlGenerator(TestEventListener* listener); - - // Controls whether events will be forwarded by the repeater to the - // listeners in the list. - bool EventForwardingEnabled() const; - void SuppressEventForwarding(); - - // The actual list of listeners. - internal::TestEventRepeater* repeater_; - // Listener responsible for the standard result output. - TestEventListener* default_result_printer_; - // Listener responsible for the creation of the XML output file. - TestEventListener* default_xml_generator_; - - // We disallow copying TestEventListeners. - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners); -}; - -// A UnitTest consists of a vector of TestSuites. -// -// This is a singleton class. The only instance of UnitTest is -// created when UnitTest::GetInstance() is first called. This -// instance is never deleted. -// -// UnitTest is not copyable. -// -// This class is thread-safe as long as the methods are called -// according to their specification. -class GTEST_API_ UnitTest { - public: - // Gets the singleton UnitTest object. The first time this method - // is called, a UnitTest object is constructed and returned. - // Consecutive calls will return the same object. - static UnitTest* GetInstance(); - - // Runs all tests in this UnitTest object and prints the result. - // Returns 0 if successful, or 1 otherwise. - // - // This method can only be called from the main thread. - // - // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. - int Run() GTEST_MUST_USE_RESULT_; - - // Returns the working directory when the first TEST() or TEST_F() - // was executed. The UnitTest object owns the string. - const char* original_working_dir() const; - - // Returns the TestSuite object for the test that's currently running, - // or NULL if no test is running. - const TestSuite* current_test_suite() const GTEST_LOCK_EXCLUDED_(mutex_); - -// Legacy API is still available but deprecated -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - const TestCase* current_test_case() const GTEST_LOCK_EXCLUDED_(mutex_); -#endif - - // Returns the TestInfo object for the test that's currently running, - // or NULL if no test is running. - const TestInfo* current_test_info() const - GTEST_LOCK_EXCLUDED_(mutex_); - - // Returns the random seed used at the start of the current test run. - int random_seed() const; - - // Returns the ParameterizedTestSuiteRegistry object used to keep track of - // value-parameterized tests and instantiate and register them. - // - // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. - internal::ParameterizedTestSuiteRegistry& parameterized_test_registry() - GTEST_LOCK_EXCLUDED_(mutex_); - - // Gets the number of successful test suites. - int successful_test_suite_count() const; - - // Gets the number of failed test suites. - int failed_test_suite_count() const; - - // Gets the number of all test suites. - int total_test_suite_count() const; - - // Gets the number of all test suites that contain at least one test - // that should run. - int test_suite_to_run_count() const; - - // Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - int successful_test_case_count() const; - int failed_test_case_count() const; - int total_test_case_count() const; - int test_case_to_run_count() const; -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - // Gets the number of successful tests. - int successful_test_count() const; - - // Gets the number of skipped tests. - int skipped_test_count() const; - - // Gets the number of failed tests. - int failed_test_count() const; - - // Gets the number of disabled tests that will be reported in the XML report. - int reportable_disabled_test_count() const; - - // Gets the number of disabled tests. - int disabled_test_count() const; - - // Gets the number of tests to be printed in the XML report. - int reportable_test_count() const; - - // Gets the number of all tests. - int total_test_count() const; - - // Gets the number of tests that should run. - int test_to_run_count() const; - - // Gets the time of the test program start, in ms from the start of the - // UNIX epoch. - TimeInMillis start_timestamp() const; - - // Gets the elapsed time, in milliseconds. - TimeInMillis elapsed_time() const; - - // Returns true if and only if the unit test passed (i.e. all test suites - // passed). - bool Passed() const; - - // Returns true if and only if the unit test failed (i.e. some test suite - // failed or something outside of all tests failed). - bool Failed() const; - - // Gets the i-th test suite among all the test suites. i can range from 0 to - // total_test_suite_count() - 1. If i is not in that range, returns NULL. - const TestSuite* GetTestSuite(int i) const; - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - const TestCase* GetTestCase(int i) const; -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - // Returns the TestResult containing information on test failures and - // properties logged outside of individual test suites. - const TestResult& ad_hoc_test_result() const; - - // Returns the list of event listeners that can be used to track events - // inside Google Test. - TestEventListeners& listeners(); - - private: - // Registers and returns a global test environment. When a test - // program is run, all global test environments will be set-up in - // the order they were registered. After all tests in the program - // have finished, all global test environments will be torn-down in - // the *reverse* order they were registered. - // - // The UnitTest object takes ownership of the given environment. - // - // This method can only be called from the main thread. - Environment* AddEnvironment(Environment* env); - - // Adds a TestPartResult to the current TestResult object. All - // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) - // eventually call this to report their results. The user code - // should use the assertion macros instead of calling this directly. - void AddTestPartResult(TestPartResult::Type result_type, - const char* file_name, - int line_number, - const std::string& message, - const std::string& os_stack_trace) - GTEST_LOCK_EXCLUDED_(mutex_); - - // Adds a TestProperty to the current TestResult object when invoked from - // inside a test, to current TestSuite's ad_hoc_test_result_ when invoked - // from SetUpTestSuite or TearDownTestSuite, or to the global property set - // when invoked elsewhere. If the result already contains a property with - // the same key, the value will be updated. - void RecordProperty(const std::string& key, const std::string& value); - - // Gets the i-th test suite among all the test suites. i can range from 0 to - // total_test_suite_count() - 1. If i is not in that range, returns NULL. - TestSuite* GetMutableTestSuite(int i); - - // Accessors for the implementation object. - internal::UnitTestImpl* impl() { return impl_; } - const internal::UnitTestImpl* impl() const { return impl_; } - - // These classes and functions are friends as they need to access private - // members of UnitTest. - friend class ScopedTrace; - friend class Test; - friend class internal::AssertHelper; - friend class internal::StreamingListenerTest; - friend class internal::UnitTestRecordPropertyTestHelper; - friend Environment* AddGlobalTestEnvironment(Environment* env); - friend internal::UnitTestImpl* internal::GetUnitTestImpl(); - friend void internal::ReportFailureInUnknownLocation( - TestPartResult::Type result_type, - const std::string& message); - - // Creates an empty UnitTest. - UnitTest(); - - // D'tor - virtual ~UnitTest(); - - // Pushes a trace defined by SCOPED_TRACE() on to the per-thread - // Google Test trace stack. - void PushGTestTrace(const internal::TraceInfo& trace) - GTEST_LOCK_EXCLUDED_(mutex_); - - // Pops a trace from the per-thread Google Test trace stack. - void PopGTestTrace() - GTEST_LOCK_EXCLUDED_(mutex_); - - // Protects mutable state in *impl_. This is mutable as some const - // methods need to lock it too. - mutable internal::Mutex mutex_; - - // Opaque implementation object. This field is never changed once - // the object is constructed. We don't mark it as const here, as - // doing so will cause a warning in the constructor of UnitTest. - // Mutable state in *impl_ is protected by mutex_. - internal::UnitTestImpl* impl_; - - // We disallow copying UnitTest. - GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest); -}; - -// A convenient wrapper for adding an environment for the test -// program. -// -// You should call this before RUN_ALL_TESTS() is called, probably in -// main(). If you use gtest_main, you need to call this before main() -// starts for it to take effect. For example, you can define a global -// variable like this: -// -// testing::Environment* const foo_env = -// testing::AddGlobalTestEnvironment(new FooEnvironment); -// -// However, we strongly recommend you to write your own main() and -// call AddGlobalTestEnvironment() there, as relying on initialization -// of global variables makes the code harder to read and may cause -// problems when you register multiple environments from different -// translation units and the environments have dependencies among them -// (remember that the compiler doesn't guarantee the order in which -// global variables from different translation units are initialized). -inline Environment* AddGlobalTestEnvironment(Environment* env) { - return UnitTest::GetInstance()->AddEnvironment(env); -} - -// Initializes Google Test. This must be called before calling -// RUN_ALL_TESTS(). In particular, it parses a command line for the -// flags that Google Test recognizes. Whenever a Google Test flag is -// seen, it is removed from argv, and *argc is decremented. -// -// No value is returned. Instead, the Google Test flag variables are -// updated. -// -// Calling the function for the second time has no user-visible effect. -GTEST_API_ void InitGoogleTest(int* argc, char** argv); - -// This overloaded version can be used in Windows programs compiled in -// UNICODE mode. -GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv); - -// This overloaded version can be used on Arduino/embedded platforms where -// there is no argc/argv. -GTEST_API_ void InitGoogleTest(); - -namespace internal { - -// Separate the error generating code from the code path to reduce the stack -// frame size of CmpHelperEQ. This helps reduce the overhead of some sanitizers -// when calling EXPECT_* in a tight loop. -template <typename T1, typename T2> -AssertionResult CmpHelperEQFailure(const char* lhs_expression, - const char* rhs_expression, - const T1& lhs, const T2& rhs) { - return EqFailure(lhs_expression, - rhs_expression, - FormatForComparisonFailureMessage(lhs, rhs), - FormatForComparisonFailureMessage(rhs, lhs), - false); -} - -// This block of code defines operator==/!= -// to block lexical scope lookup. -// It prevents using invalid operator==/!= defined at namespace scope. -struct faketype {}; -inline bool operator==(faketype, faketype) { return true; } -inline bool operator!=(faketype, faketype) { return false; } - -// The helper function for {ASSERT|EXPECT}_EQ. -template <typename T1, typename T2> -AssertionResult CmpHelperEQ(const char* lhs_expression, - const char* rhs_expression, - const T1& lhs, - const T2& rhs) { - if (lhs == rhs) { - return AssertionSuccess(); - } - - return CmpHelperEQFailure(lhs_expression, rhs_expression, lhs, rhs); -} - -// With this overloaded version, we allow anonymous enums to be used -// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums -// can be implicitly cast to BiggestInt. -GTEST_API_ AssertionResult CmpHelperEQ(const char* lhs_expression, - const char* rhs_expression, - BiggestInt lhs, - BiggestInt rhs); - -class EqHelper { - public: - // This templatized version is for the general case. - template < - typename T1, typename T2, - // Disable this overload for cases where one argument is a pointer - // and the other is the null pointer constant. - typename std::enable_if<!std::is_integral<T1>::value || - !std::is_pointer<T2>::value>::type* = nullptr> - static AssertionResult Compare(const char* lhs_expression, - const char* rhs_expression, const T1& lhs, - const T2& rhs) { - return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); - } - - // With this overloaded version, we allow anonymous enums to be used - // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous - // enums can be implicitly cast to BiggestInt. - // - // Even though its body looks the same as the above version, we - // cannot merge the two, as it will make anonymous enums unhappy. - static AssertionResult Compare(const char* lhs_expression, - const char* rhs_expression, - BiggestInt lhs, - BiggestInt rhs) { - return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs); - } - - template <typename T> - static AssertionResult Compare( - const char* lhs_expression, const char* rhs_expression, - // Handle cases where '0' is used as a null pointer literal. - std::nullptr_t /* lhs */, T* rhs) { - // We already know that 'lhs' is a null pointer. - return CmpHelperEQ(lhs_expression, rhs_expression, static_cast<T*>(nullptr), - rhs); - } -}; - -// Separate the error generating code from the code path to reduce the stack -// frame size of CmpHelperOP. This helps reduce the overhead of some sanitizers -// when calling EXPECT_OP in a tight loop. -template <typename T1, typename T2> -AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2, - const T1& val1, const T2& val2, - const char* op) { - return AssertionFailure() - << "Expected: (" << expr1 << ") " << op << " (" << expr2 - << "), actual: " << FormatForComparisonFailureMessage(val1, val2) - << " vs " << FormatForComparisonFailureMessage(val2, val1); -} - -// A macro for implementing the helper functions needed to implement -// ASSERT_?? and EXPECT_??. It is here just to avoid copy-and-paste -// of similar code. -// -// For each templatized helper function, we also define an overloaded -// version for BiggestInt in order to reduce code bloat and allow -// anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled -// with gcc 4. -// -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. - -#define GTEST_IMPL_CMP_HELPER_(op_name, op)\ -template <typename T1, typename T2>\ -AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ - const T1& val1, const T2& val2) {\ - if (val1 op val2) {\ - return AssertionSuccess();\ - } else {\ - return CmpHelperOpFailure(expr1, expr2, val1, val2, #op);\ - }\ -}\ -GTEST_API_ AssertionResult CmpHelper##op_name(\ - const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2) - -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. - -// Implements the helper function for {ASSERT|EXPECT}_NE -GTEST_IMPL_CMP_HELPER_(NE, !=); -// Implements the helper function for {ASSERT|EXPECT}_LE -GTEST_IMPL_CMP_HELPER_(LE, <=); -// Implements the helper function for {ASSERT|EXPECT}_LT -GTEST_IMPL_CMP_HELPER_(LT, <); -// Implements the helper function for {ASSERT|EXPECT}_GE -GTEST_IMPL_CMP_HELPER_(GE, >=); -// Implements the helper function for {ASSERT|EXPECT}_GT -GTEST_IMPL_CMP_HELPER_(GT, >); - -#undef GTEST_IMPL_CMP_HELPER_ - -// The helper function for {ASSERT|EXPECT}_STREQ. -// -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression, - const char* s2_expression, - const char* s1, - const char* s2); - -// The helper function for {ASSERT|EXPECT}_STRCASEEQ. -// -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* s1_expression, - const char* s2_expression, - const char* s1, - const char* s2); - -// The helper function for {ASSERT|EXPECT}_STRNE. -// -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression, - const char* s2_expression, - const char* s1, - const char* s2); - -// The helper function for {ASSERT|EXPECT}_STRCASENE. -// -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression, - const char* s2_expression, - const char* s1, - const char* s2); - - -// Helper function for *_STREQ on wide strings. -// -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -GTEST_API_ AssertionResult CmpHelperSTREQ(const char* s1_expression, - const char* s2_expression, - const wchar_t* s1, - const wchar_t* s2); - -// Helper function for *_STRNE on wide strings. -// -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression, - const char* s2_expression, - const wchar_t* s1, - const wchar_t* s2); - -} // namespace internal - -// IsSubstring() and IsNotSubstring() are intended to be used as the -// first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by -// themselves. They check whether needle is a substring of haystack -// (NULL is considered a substring of itself only), and return an -// appropriate error message when they fail. -// -// The {needle,haystack}_expr arguments are the stringified -// expressions that generated the two real arguments. -GTEST_API_ AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const char* needle, const char* haystack); -GTEST_API_ AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const wchar_t* needle, const wchar_t* haystack); -GTEST_API_ AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const char* needle, const char* haystack); -GTEST_API_ AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const wchar_t* needle, const wchar_t* haystack); -GTEST_API_ AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::string& needle, const ::std::string& haystack); -GTEST_API_ AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::string& needle, const ::std::string& haystack); - -#if GTEST_HAS_STD_WSTRING -GTEST_API_ AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::wstring& needle, const ::std::wstring& haystack); -GTEST_API_ AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::wstring& needle, const ::std::wstring& haystack); -#endif // GTEST_HAS_STD_WSTRING - -namespace internal { - -// Helper template function for comparing floating-points. -// -// Template parameter: -// -// RawType: the raw floating-point type (either float or double) -// -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -template <typename RawType> -AssertionResult CmpHelperFloatingPointEQ(const char* lhs_expression, - const char* rhs_expression, - RawType lhs_value, - RawType rhs_value) { - const FloatingPoint<RawType> lhs(lhs_value), rhs(rhs_value); - - if (lhs.AlmostEquals(rhs)) { - return AssertionSuccess(); - } - - ::std::stringstream lhs_ss; - lhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2) - << lhs_value; - - ::std::stringstream rhs_ss; - rhs_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2) - << rhs_value; - - return EqFailure(lhs_expression, - rhs_expression, - StringStreamToString(&lhs_ss), - StringStreamToString(&rhs_ss), - false); -} - -// Helper function for implementing ASSERT_NEAR. -// -// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. -GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1, - const char* expr2, - const char* abs_error_expr, - double val1, - double val2, - double abs_error); - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// A class that enables one to stream messages to assertion macros -class GTEST_API_ AssertHelper { - public: - // Constructor. - AssertHelper(TestPartResult::Type type, - const char* file, - int line, - const char* message); - ~AssertHelper(); - - // Message assignment is a semantic trick to enable assertion - // streaming; see the GTEST_MESSAGE_ macro below. - void operator=(const Message& message) const; - - private: - // We put our data in a struct so that the size of the AssertHelper class can - // be as small as possible. This is important because gcc is incapable of - // re-using stack space even for temporary variables, so every EXPECT_EQ - // reserves stack space for another AssertHelper. - struct AssertHelperData { - AssertHelperData(TestPartResult::Type t, - const char* srcfile, - int line_num, - const char* msg) - : type(t), file(srcfile), line(line_num), message(msg) { } - - TestPartResult::Type const type; - const char* const file; - int const line; - std::string const message; - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData); - }; - - AssertHelperData* const data_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper); -}; - -enum GTestColor { COLOR_DEFAULT, COLOR_RED, COLOR_GREEN, COLOR_YELLOW }; - -GTEST_API_ GTEST_ATTRIBUTE_PRINTF_(2, 3) void ColoredPrintf(GTestColor color, - const char* fmt, - ...); - -} // namespace internal - -// The pure interface class that all value-parameterized tests inherit from. -// A value-parameterized class must inherit from both ::testing::Test and -// ::testing::WithParamInterface. In most cases that just means inheriting -// from ::testing::TestWithParam, but more complicated test hierarchies -// may need to inherit from Test and WithParamInterface at different levels. -// -// This interface has support for accessing the test parameter value via -// the GetParam() method. -// -// Use it with one of the parameter generator defining functions, like Range(), -// Values(), ValuesIn(), Bool(), and Combine(). -// -// class FooTest : public ::testing::TestWithParam<int> { -// protected: -// FooTest() { -// // Can use GetParam() here. -// } -// ~FooTest() override { -// // Can use GetParam() here. -// } -// void SetUp() override { -// // Can use GetParam() here. -// } -// void TearDown override { -// // Can use GetParam() here. -// } -// }; -// TEST_P(FooTest, DoesBar) { -// // Can use GetParam() method here. -// Foo foo; -// ASSERT_TRUE(foo.DoesBar(GetParam())); -// } -// INSTANTIATE_TEST_SUITE_P(OneToTenRange, FooTest, ::testing::Range(1, 10)); - -template <typename T> -class WithParamInterface { - public: - typedef T ParamType; - virtual ~WithParamInterface() {} - - // The current parameter value. Is also available in the test fixture's - // constructor. - static const ParamType& GetParam() { - GTEST_CHECK_(parameter_ != nullptr) - << "GetParam() can only be called inside a value-parameterized test " - << "-- did you intend to write TEST_P instead of TEST_F?"; - return *parameter_; - } - - private: - // Sets parameter value. The caller is responsible for making sure the value - // remains alive and unchanged throughout the current test. - static void SetParam(const ParamType* parameter) { - parameter_ = parameter; - } - - // Static value used for accessing parameter during a test lifetime. - static const ParamType* parameter_; - - // TestClass must be a subclass of WithParamInterface<T> and Test. - template <class TestClass> friend class internal::ParameterizedTestFactory; -}; - -template <typename T> -const T* WithParamInterface<T>::parameter_ = nullptr; - -// Most value-parameterized classes can ignore the existence of -// WithParamInterface, and can just inherit from ::testing::TestWithParam. - -template <typename T> -class TestWithParam : public Test, public WithParamInterface<T> { -}; - -// Macros for indicating success/failure in test code. - -// Skips test in runtime. -// Skipping test aborts current function. -// Skipped tests are neither successful nor failed. -#define GTEST_SKIP() GTEST_SKIP_("Skipped") - -// ADD_FAILURE unconditionally adds a failure to the current test. -// SUCCEED generates a success - it doesn't automatically make the -// current test successful, as a test is only successful when it has -// no failure. -// -// EXPECT_* verifies that a certain condition is satisfied. If not, -// it behaves like ADD_FAILURE. In particular: -// -// EXPECT_TRUE verifies that a Boolean condition is true. -// EXPECT_FALSE verifies that a Boolean condition is false. -// -// FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except -// that they will also abort the current function on failure. People -// usually want the fail-fast behavior of FAIL and ASSERT_*, but those -// writing data-driven tests often find themselves using ADD_FAILURE -// and EXPECT_* more. - -// Generates a nonfatal failure with a generic message. -#define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed") - -// Generates a nonfatal failure at the given source file location with -// a generic message. -#define ADD_FAILURE_AT(file, line) \ - GTEST_MESSAGE_AT_(file, line, "Failed", \ - ::testing::TestPartResult::kNonFatalFailure) - -// Generates a fatal failure with a generic message. -#define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed") - -// Like GTEST_FAIL(), but at the given source file location. -#define GTEST_FAIL_AT(file, line) \ - GTEST_MESSAGE_AT_(file, line, "Failed", \ - ::testing::TestPartResult::kFatalFailure) - -// Define this macro to 1 to omit the definition of FAIL(), which is a -// generic name and clashes with some other libraries. -#if !GTEST_DONT_DEFINE_FAIL -# define FAIL() GTEST_FAIL() -#endif - -// Generates a success with a generic message. -#define GTEST_SUCCEED() GTEST_SUCCESS_("Succeeded") - -// Define this macro to 1 to omit the definition of SUCCEED(), which -// is a generic name and clashes with some other libraries. -#if !GTEST_DONT_DEFINE_SUCCEED -# define SUCCEED() GTEST_SUCCEED() -#endif - -// Macros for testing exceptions. -// -// * {ASSERT|EXPECT}_THROW(statement, expected_exception): -// Tests that the statement throws the expected exception. -// * {ASSERT|EXPECT}_NO_THROW(statement): -// Tests that the statement doesn't throw any exception. -// * {ASSERT|EXPECT}_ANY_THROW(statement): -// Tests that the statement throws an exception. - -#define EXPECT_THROW(statement, expected_exception) \ - GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_) -#define EXPECT_NO_THROW(statement) \ - GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_) -#define EXPECT_ANY_THROW(statement) \ - GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_) -#define ASSERT_THROW(statement, expected_exception) \ - GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_) -#define ASSERT_NO_THROW(statement) \ - GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_) -#define ASSERT_ANY_THROW(statement) \ - GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_) - -// Boolean assertions. Condition can be either a Boolean expression or an -// AssertionResult. For more information on how to use AssertionResult with -// these macros see comments on that class. -#define EXPECT_TRUE(condition) \ - GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \ - GTEST_NONFATAL_FAILURE_) -#define EXPECT_FALSE(condition) \ - GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ - GTEST_NONFATAL_FAILURE_) -#define ASSERT_TRUE(condition) \ - GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \ - GTEST_FATAL_FAILURE_) -#define ASSERT_FALSE(condition) \ - GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \ - GTEST_FATAL_FAILURE_) - -// Macros for testing equalities and inequalities. -// -// * {ASSERT|EXPECT}_EQ(v1, v2): Tests that v1 == v2 -// * {ASSERT|EXPECT}_NE(v1, v2): Tests that v1 != v2 -// * {ASSERT|EXPECT}_LT(v1, v2): Tests that v1 < v2 -// * {ASSERT|EXPECT}_LE(v1, v2): Tests that v1 <= v2 -// * {ASSERT|EXPECT}_GT(v1, v2): Tests that v1 > v2 -// * {ASSERT|EXPECT}_GE(v1, v2): Tests that v1 >= v2 -// -// When they are not, Google Test prints both the tested expressions and -// their actual values. The values must be compatible built-in types, -// or you will get a compiler error. By "compatible" we mean that the -// values can be compared by the respective operator. -// -// Note: -// -// 1. It is possible to make a user-defined type work with -// {ASSERT|EXPECT}_??(), but that requires overloading the -// comparison operators and is thus discouraged by the Google C++ -// Usage Guide. Therefore, you are advised to use the -// {ASSERT|EXPECT}_TRUE() macro to assert that two objects are -// equal. -// -// 2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on -// pointers (in particular, C strings). Therefore, if you use it -// with two C strings, you are testing how their locations in memory -// are related, not how their content is related. To compare two C -// strings by content, use {ASSERT|EXPECT}_STR*(). -// -// 3. {ASSERT|EXPECT}_EQ(v1, v2) is preferred to -// {ASSERT|EXPECT}_TRUE(v1 == v2), as the former tells you -// what the actual value is when it fails, and similarly for the -// other comparisons. -// -// 4. Do not depend on the order in which {ASSERT|EXPECT}_??() -// evaluate their arguments, which is undefined. -// -// 5. These macros evaluate their arguments exactly once. -// -// Examples: -// -// EXPECT_NE(Foo(), 5); -// EXPECT_EQ(a_pointer, NULL); -// ASSERT_LT(i, array_size); -// ASSERT_GT(records.size(), 0) << "There is no record left."; - -#define EXPECT_EQ(val1, val2) \ - EXPECT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2) -#define EXPECT_NE(val1, val2) \ - EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2) -#define EXPECT_LE(val1, val2) \ - EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2) -#define EXPECT_LT(val1, val2) \ - EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2) -#define EXPECT_GE(val1, val2) \ - EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2) -#define EXPECT_GT(val1, val2) \ - EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2) - -#define GTEST_ASSERT_EQ(val1, val2) \ - ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2) -#define GTEST_ASSERT_NE(val1, val2) \ - ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2) -#define GTEST_ASSERT_LE(val1, val2) \ - ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2) -#define GTEST_ASSERT_LT(val1, val2) \ - ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2) -#define GTEST_ASSERT_GE(val1, val2) \ - ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2) -#define GTEST_ASSERT_GT(val1, val2) \ - ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2) - -// Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of -// ASSERT_XY(), which clashes with some users' own code. - -#if !GTEST_DONT_DEFINE_ASSERT_EQ -# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2) -#endif - -#if !GTEST_DONT_DEFINE_ASSERT_NE -# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2) -#endif - -#if !GTEST_DONT_DEFINE_ASSERT_LE -# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2) -#endif - -#if !GTEST_DONT_DEFINE_ASSERT_LT -# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2) -#endif - -#if !GTEST_DONT_DEFINE_ASSERT_GE -# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2) -#endif - -#if !GTEST_DONT_DEFINE_ASSERT_GT -# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2) -#endif - -// C-string Comparisons. All tests treat NULL and any non-NULL string -// as different. Two NULLs are equal. -// -// * {ASSERT|EXPECT}_STREQ(s1, s2): Tests that s1 == s2 -// * {ASSERT|EXPECT}_STRNE(s1, s2): Tests that s1 != s2 -// * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case -// * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case -// -// For wide or narrow string objects, you can use the -// {ASSERT|EXPECT}_??() macros. -// -// Don't depend on the order in which the arguments are evaluated, -// which is undefined. -// -// These macros evaluate their arguments exactly once. - -#define EXPECT_STREQ(s1, s2) \ - EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2) -#define EXPECT_STRNE(s1, s2) \ - EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) -#define EXPECT_STRCASEEQ(s1, s2) \ - EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2) -#define EXPECT_STRCASENE(s1, s2)\ - EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) - -#define ASSERT_STREQ(s1, s2) \ - ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, s1, s2) -#define ASSERT_STRNE(s1, s2) \ - ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2) -#define ASSERT_STRCASEEQ(s1, s2) \ - ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, s1, s2) -#define ASSERT_STRCASENE(s1, s2)\ - ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2) - -// Macros for comparing floating-point numbers. -// -// * {ASSERT|EXPECT}_FLOAT_EQ(val1, val2): -// Tests that two float values are almost equal. -// * {ASSERT|EXPECT}_DOUBLE_EQ(val1, val2): -// Tests that two double values are almost equal. -// * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error): -// Tests that v1 and v2 are within the given distance to each other. -// -// Google Test uses ULP-based comparison to automatically pick a default -// error bound that is appropriate for the operands. See the -// FloatingPoint template class in gtest-internal.h if you are -// interested in the implementation details. - -#define EXPECT_FLOAT_EQ(val1, val2)\ - EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \ - val1, val2) - -#define EXPECT_DOUBLE_EQ(val1, val2)\ - EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \ - val1, val2) - -#define ASSERT_FLOAT_EQ(val1, val2)\ - ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<float>, \ - val1, val2) - -#define ASSERT_DOUBLE_EQ(val1, val2)\ - ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \ - val1, val2) - -#define EXPECT_NEAR(val1, val2, abs_error)\ - EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \ - val1, val2, abs_error) - -#define ASSERT_NEAR(val1, val2, abs_error)\ - ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \ - val1, val2, abs_error) - -// These predicate format functions work on floating-point values, and -// can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g. -// -// EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0); - -// Asserts that val1 is less than, or almost equal to, val2. Fails -// otherwise. In particular, it fails if either val1 or val2 is NaN. -GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2, - float val1, float val2); -GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2, - double val1, double val2); - - -#if GTEST_OS_WINDOWS - -// Macros that test for HRESULT failure and success, these are only useful -// on Windows, and rely on Windows SDK macros and APIs to compile. -// -// * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr) -// -// When expr unexpectedly fails or succeeds, Google Test prints the -// expected result and the actual result with both a human-readable -// string representation of the error, if available, as well as the -// hex result code. -# define EXPECT_HRESULT_SUCCEEDED(expr) \ - EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) - -# define ASSERT_HRESULT_SUCCEEDED(expr) \ - ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr)) - -# define EXPECT_HRESULT_FAILED(expr) \ - EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) - -# define ASSERT_HRESULT_FAILED(expr) \ - ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr)) - -#endif // GTEST_OS_WINDOWS - -// Macros that execute statement and check that it doesn't generate new fatal -// failures in the current thread. -// -// * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement); -// -// Examples: -// -// EXPECT_NO_FATAL_FAILURE(Process()); -// ASSERT_NO_FATAL_FAILURE(Process()) << "Process() failed"; -// -#define ASSERT_NO_FATAL_FAILURE(statement) \ - GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_) -#define EXPECT_NO_FATAL_FAILURE(statement) \ - GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_) - -// Causes a trace (including the given source file path and line number, -// and the given message) to be included in every test failure message generated -// by code in the scope of the lifetime of an instance of this class. The effect -// is undone with the destruction of the instance. -// -// The message argument can be anything streamable to std::ostream. -// -// Example: -// testing::ScopedTrace trace("file.cc", 123, "message"); -// -class GTEST_API_ ScopedTrace { - public: - // The c'tor pushes the given source file location and message onto - // a trace stack maintained by Google Test. - - // Template version. Uses Message() to convert the values into strings. - // Slow, but flexible. - template <typename T> - ScopedTrace(const char* file, int line, const T& message) { - PushTrace(file, line, (Message() << message).GetString()); - } - - // Optimize for some known types. - ScopedTrace(const char* file, int line, const char* message) { - PushTrace(file, line, message ? message : "(null)"); - } - - ScopedTrace(const char* file, int line, const std::string& message) { - PushTrace(file, line, message); - } - - // The d'tor pops the info pushed by the c'tor. - // - // Note that the d'tor is not virtual in order to be efficient. - // Don't inherit from ScopedTrace! - ~ScopedTrace(); - - private: - void PushTrace(const char* file, int line, std::string message); - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace); -} GTEST_ATTRIBUTE_UNUSED_; // A ScopedTrace object does its job in its - // c'tor and d'tor. Therefore it doesn't - // need to be used otherwise. - -// Causes a trace (including the source file path, the current line -// number, and the given message) to be included in every test failure -// message generated by code in the current scope. The effect is -// undone when the control leaves the current scope. -// -// The message argument can be anything streamable to std::ostream. -// -// In the implementation, we include the current line number as part -// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s -// to appear in the same block - as long as they are on different -// lines. -// -// Assuming that each thread maintains its own stack of traces. -// Therefore, a SCOPED_TRACE() would (correctly) only affect the -// assertions in its own thread. -#define SCOPED_TRACE(message) \ - ::testing::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\ - __FILE__, __LINE__, (message)) - -// Compile-time assertion for type equality. -// StaticAssertTypeEq<type1, type2>() compiles if and only if type1 and type2 -// are the same type. The value it returns is not interesting. -// -// Instead of making StaticAssertTypeEq a class template, we make it a -// function template that invokes a helper class template. This -// prevents a user from misusing StaticAssertTypeEq<T1, T2> by -// defining objects of that type. -// -// CAVEAT: -// -// When used inside a method of a class template, -// StaticAssertTypeEq<T1, T2>() is effective ONLY IF the method is -// instantiated. For example, given: -// -// template <typename T> class Foo { -// public: -// void Bar() { testing::StaticAssertTypeEq<int, T>(); } -// }; -// -// the code: -// -// void Test1() { Foo<bool> foo; } -// -// will NOT generate a compiler error, as Foo<bool>::Bar() is never -// actually instantiated. Instead, you need: -// -// void Test2() { Foo<bool> foo; foo.Bar(); } -// -// to cause a compiler error. -template <typename T1, typename T2> -constexpr bool StaticAssertTypeEq() noexcept { - static_assert(std::is_same<T1, T2>::value, - "type1 and type2 are not the same type"); - return true; -} - -// Defines a test. -// -// The first parameter is the name of the test suite, and the second -// parameter is the name of the test within the test suite. -// -// The convention is to end the test suite name with "Test". For -// example, a test suite for the Foo class can be named FooTest. -// -// Test code should appear between braces after an invocation of -// this macro. Example: -// -// TEST(FooTest, InitializesCorrectly) { -// Foo foo; -// EXPECT_TRUE(foo.StatusIsOK()); -// } - -// Note that we call GetTestTypeId() instead of GetTypeId< -// ::testing::Test>() here to get the type ID of testing::Test. This -// is to work around a suspected linker bug when using Google Test as -// a framework on Mac OS X. The bug causes GetTypeId< -// ::testing::Test>() to return different values depending on whether -// the call is from the Google Test framework itself or from user test -// code. GetTestTypeId() is guaranteed to always return the same -// value, as it always calls GetTypeId<>() from the Google Test -// framework. -#define GTEST_TEST(test_suite_name, test_name) \ - GTEST_TEST_(test_suite_name, test_name, ::testing::Test, \ - ::testing::internal::GetTestTypeId()) - -// Define this macro to 1 to omit the definition of TEST(), which -// is a generic name and clashes with some other libraries. -#if !GTEST_DONT_DEFINE_TEST -#define TEST(test_suite_name, test_name) GTEST_TEST(test_suite_name, test_name) -#endif - -// Defines a test that uses a test fixture. -// -// The first parameter is the name of the test fixture class, which -// also doubles as the test suite name. The second parameter is the -// name of the test within the test suite. -// -// A test fixture class must be declared earlier. The user should put -// the test code between braces after using this macro. Example: -// -// class FooTest : public testing::Test { -// protected: -// void SetUp() override { b_.AddElement(3); } -// -// Foo a_; -// Foo b_; -// }; -// -// TEST_F(FooTest, InitializesCorrectly) { -// EXPECT_TRUE(a_.StatusIsOK()); -// } -// -// TEST_F(FooTest, ReturnsElementCountCorrectly) { -// EXPECT_EQ(a_.size(), 0); -// EXPECT_EQ(b_.size(), 1); -// } -// -// GOOGLETEST_CM0011 DO NOT DELETE -#define TEST_F(test_fixture, test_name)\ - GTEST_TEST_(test_fixture, test_name, test_fixture, \ - ::testing::internal::GetTypeId<test_fixture>()) - -// Returns a path to temporary directory. -// Tries to determine an appropriate directory for the platform. -GTEST_API_ std::string TempDir(); - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -// Dynamically registers a test with the framework. -// -// This is an advanced API only to be used when the `TEST` macros are -// insufficient. The macros should be preferred when possible, as they avoid -// most of the complexity of calling this function. -// -// The `factory` argument is a factory callable (move-constructible) object or -// function pointer that creates a new instance of the Test object. It -// handles ownership to the caller. The signature of the callable is -// `Fixture*()`, where `Fixture` is the test fixture class for the test. All -// tests registered with the same `test_suite_name` must return the same -// fixture type. This is checked at runtime. -// -// The framework will infer the fixture class from the factory and will call -// the `SetUpTestSuite` and `TearDownTestSuite` for it. -// -// Must be called before `RUN_ALL_TESTS()` is invoked, otherwise behavior is -// undefined. -// -// Use case example: -// -// class MyFixture : public ::testing::Test { -// public: -// // All of these optional, just like in regular macro usage. -// static void SetUpTestSuite() { ... } -// static void TearDownTestSuite() { ... } -// void SetUp() override { ... } -// void TearDown() override { ... } -// }; -// -// class MyTest : public MyFixture { -// public: -// explicit MyTest(int data) : data_(data) {} -// void TestBody() override { ... } -// -// private: -// int data_; -// }; -// -// void RegisterMyTests(const std::vector<int>& values) { -// for (int v : values) { -// ::testing::RegisterTest( -// "MyFixture", ("Test" + std::to_string(v)).c_str(), nullptr, -// std::to_string(v).c_str(), -// __FILE__, __LINE__, -// // Important to use the fixture type as the return type here. -// [=]() -> MyFixture* { return new MyTest(v); }); -// } -// } -// ... -// int main(int argc, char** argv) { -// std::vector<int> values_to_test = LoadValuesFromConfig(); -// RegisterMyTests(values_to_test); -// ... -// return RUN_ALL_TESTS(); -// } -// -template <int&... ExplicitParameterBarrier, typename Factory> -TestInfo* RegisterTest(const char* test_suite_name, const char* test_name, - const char* type_param, const char* value_param, - const char* file, int line, Factory factory) { - using TestT = typename std::remove_pointer<decltype(factory())>::type; - - class FactoryImpl : public internal::TestFactoryBase { - public: - explicit FactoryImpl(Factory f) : factory_(std::move(f)) {} - Test* CreateTest() override { return factory_(); } - - private: - Factory factory_; - }; - - return internal::MakeAndRegisterTestInfo( - test_suite_name, test_name, type_param, value_param, - internal::CodeLocation(file, line), internal::GetTypeId<TestT>(), - internal::SuiteApiResolver<TestT>::GetSetUpCaseOrSuite(file, line), - internal::SuiteApiResolver<TestT>::GetTearDownCaseOrSuite(file, line), - new FactoryImpl{std::move(factory)}); -} - -} // namespace testing - -// Use this function in main() to run all tests. It returns 0 if all -// tests are successful, or 1 otherwise. -// -// RUN_ALL_TESTS() should be invoked after the command line has been -// parsed by InitGoogleTest(). -// -// This function was formerly a macro; thus, it is in the global -// namespace and has an all-caps name. -int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_; - -inline int RUN_ALL_TESTS() { - return ::testing::UnitTest::GetInstance()->Run(); -} - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -#endif // GTEST_INCLUDE_GTEST_GTEST_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/gtest_pred_impl.h b/3rdParty/googletest/googletest/include/gtest/gtest_pred_impl.h deleted file mode 100644 index d514255c733b76ae8c6cd01902d328f30b9a6de9..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/gtest_pred_impl.h +++ /dev/null @@ -1,359 +0,0 @@ -// Copyright 2006, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This file is AUTOMATICALLY GENERATED on 01/02/2019 by command -// 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND! -// -// Implements a family of generic predicate assertion macros. -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ -#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ - -#include "gtest/gtest.h" - -namespace testing { - -// This header implements a family of generic predicate assertion -// macros: -// -// ASSERT_PRED_FORMAT1(pred_format, v1) -// ASSERT_PRED_FORMAT2(pred_format, v1, v2) -// ... -// -// where pred_format is a function or functor that takes n (in the -// case of ASSERT_PRED_FORMATn) values and their source expression -// text, and returns a testing::AssertionResult. See the definition -// of ASSERT_EQ in gtest.h for an example. -// -// If you don't care about formatting, you can use the more -// restrictive version: -// -// ASSERT_PRED1(pred, v1) -// ASSERT_PRED2(pred, v1, v2) -// ... -// -// where pred is an n-ary function or functor that returns bool, -// and the values v1, v2, ..., must support the << operator for -// streaming to std::ostream. -// -// We also define the EXPECT_* variations. -// -// For now we only support predicates whose arity is at most 5. -// Please email googletestframework@googlegroups.com if you need -// support for higher arities. - -// GTEST_ASSERT_ is the basic statement to which all of the assertions -// in this file reduce. Don't use this in your code. - -#define GTEST_ASSERT_(expression, on_failure) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (const ::testing::AssertionResult gtest_ar = (expression)) \ - ; \ - else \ - on_failure(gtest_ar.failure_message()) - - -// Helper function for implementing {EXPECT|ASSERT}_PRED1. Don't use -// this in your code. -template <typename Pred, - typename T1> -AssertionResult AssertPred1Helper(const char* pred_text, - const char* e1, - Pred pred, - const T1& v1) { - if (pred(v1)) return AssertionSuccess(); - - return AssertionFailure() - << pred_text << "(" << e1 << ") evaluates to false, where" - << "\n" - << e1 << " evaluates to " << ::testing::PrintToString(v1); -} - -// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1. -// Don't use this in your code. -#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\ - GTEST_ASSERT_(pred_format(#v1, v1), \ - on_failure) - -// Internal macro for implementing {EXPECT|ASSERT}_PRED1. Don't use -// this in your code. -#define GTEST_PRED1_(pred, v1, on_failure)\ - GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \ - #v1, \ - pred, \ - v1), on_failure) - -// Unary predicate assertion macros. -#define EXPECT_PRED_FORMAT1(pred_format, v1) \ - GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_) -#define EXPECT_PRED1(pred, v1) \ - GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_) -#define ASSERT_PRED_FORMAT1(pred_format, v1) \ - GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_) -#define ASSERT_PRED1(pred, v1) \ - GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_) - - - -// Helper function for implementing {EXPECT|ASSERT}_PRED2. Don't use -// this in your code. -template <typename Pred, - typename T1, - typename T2> -AssertionResult AssertPred2Helper(const char* pred_text, - const char* e1, - const char* e2, - Pred pred, - const T1& v1, - const T2& v2) { - if (pred(v1, v2)) return AssertionSuccess(); - - return AssertionFailure() - << pred_text << "(" << e1 << ", " << e2 - << ") evaluates to false, where" - << "\n" - << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n" - << e2 << " evaluates to " << ::testing::PrintToString(v2); -} - -// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2. -// Don't use this in your code. -#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\ - GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \ - on_failure) - -// Internal macro for implementing {EXPECT|ASSERT}_PRED2. Don't use -// this in your code. -#define GTEST_PRED2_(pred, v1, v2, on_failure)\ - GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \ - #v1, \ - #v2, \ - pred, \ - v1, \ - v2), on_failure) - -// Binary predicate assertion macros. -#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \ - GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_) -#define EXPECT_PRED2(pred, v1, v2) \ - GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_) -#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \ - GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_) -#define ASSERT_PRED2(pred, v1, v2) \ - GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_) - - - -// Helper function for implementing {EXPECT|ASSERT}_PRED3. Don't use -// this in your code. -template <typename Pred, - typename T1, - typename T2, - typename T3> -AssertionResult AssertPred3Helper(const char* pred_text, - const char* e1, - const char* e2, - const char* e3, - Pred pred, - const T1& v1, - const T2& v2, - const T3& v3) { - if (pred(v1, v2, v3)) return AssertionSuccess(); - - return AssertionFailure() - << pred_text << "(" << e1 << ", " << e2 << ", " << e3 - << ") evaluates to false, where" - << "\n" - << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n" - << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n" - << e3 << " evaluates to " << ::testing::PrintToString(v3); -} - -// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3. -// Don't use this in your code. -#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\ - GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \ - on_failure) - -// Internal macro for implementing {EXPECT|ASSERT}_PRED3. Don't use -// this in your code. -#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\ - GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \ - #v1, \ - #v2, \ - #v3, \ - pred, \ - v1, \ - v2, \ - v3), on_failure) - -// Ternary predicate assertion macros. -#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \ - GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_) -#define EXPECT_PRED3(pred, v1, v2, v3) \ - GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_) -#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \ - GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_) -#define ASSERT_PRED3(pred, v1, v2, v3) \ - GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_) - - - -// Helper function for implementing {EXPECT|ASSERT}_PRED4. Don't use -// this in your code. -template <typename Pred, - typename T1, - typename T2, - typename T3, - typename T4> -AssertionResult AssertPred4Helper(const char* pred_text, - const char* e1, - const char* e2, - const char* e3, - const char* e4, - Pred pred, - const T1& v1, - const T2& v2, - const T3& v3, - const T4& v4) { - if (pred(v1, v2, v3, v4)) return AssertionSuccess(); - - return AssertionFailure() - << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4 - << ") evaluates to false, where" - << "\n" - << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n" - << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n" - << e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n" - << e4 << " evaluates to " << ::testing::PrintToString(v4); -} - -// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4. -// Don't use this in your code. -#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\ - GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \ - on_failure) - -// Internal macro for implementing {EXPECT|ASSERT}_PRED4. Don't use -// this in your code. -#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\ - GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \ - #v1, \ - #v2, \ - #v3, \ - #v4, \ - pred, \ - v1, \ - v2, \ - v3, \ - v4), on_failure) - -// 4-ary predicate assertion macros. -#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \ - GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_) -#define EXPECT_PRED4(pred, v1, v2, v3, v4) \ - GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_) -#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \ - GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_) -#define ASSERT_PRED4(pred, v1, v2, v3, v4) \ - GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_) - - - -// Helper function for implementing {EXPECT|ASSERT}_PRED5. Don't use -// this in your code. -template <typename Pred, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5> -AssertionResult AssertPred5Helper(const char* pred_text, - const char* e1, - const char* e2, - const char* e3, - const char* e4, - const char* e5, - Pred pred, - const T1& v1, - const T2& v2, - const T3& v3, - const T4& v4, - const T5& v5) { - if (pred(v1, v2, v3, v4, v5)) return AssertionSuccess(); - - return AssertionFailure() - << pred_text << "(" << e1 << ", " << e2 << ", " << e3 << ", " << e4 - << ", " << e5 << ") evaluates to false, where" - << "\n" - << e1 << " evaluates to " << ::testing::PrintToString(v1) << "\n" - << e2 << " evaluates to " << ::testing::PrintToString(v2) << "\n" - << e3 << " evaluates to " << ::testing::PrintToString(v3) << "\n" - << e4 << " evaluates to " << ::testing::PrintToString(v4) << "\n" - << e5 << " evaluates to " << ::testing::PrintToString(v5); -} - -// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5. -// Don't use this in your code. -#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\ - GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \ - on_failure) - -// Internal macro for implementing {EXPECT|ASSERT}_PRED5. Don't use -// this in your code. -#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\ - GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \ - #v1, \ - #v2, \ - #v3, \ - #v4, \ - #v5, \ - pred, \ - v1, \ - v2, \ - v3, \ - v4, \ - v5), on_failure) - -// 5-ary predicate assertion macros. -#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \ - GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_) -#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \ - GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_) -#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \ - GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_) -#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \ - GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_) - - - -} // namespace testing - -#endif // GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/gtest_prod.h b/3rdParty/googletest/googletest/include/gtest/gtest_prod.h deleted file mode 100644 index e651671ebde859fc731b5459bdc0661af0757cb6..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/gtest_prod.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2006, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// Google C++ Testing and Mocking Framework definitions useful in production code. -// GOOGLETEST_CM0003 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ -#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ - -// When you need to test the private or protected members of a class, -// use the FRIEND_TEST macro to declare your tests as friends of the -// class. For example: -// -// class MyClass { -// private: -// void PrivateMethod(); -// FRIEND_TEST(MyClassTest, PrivateMethodWorks); -// }; -// -// class MyClassTest : public testing::Test { -// // ... -// }; -// -// TEST_F(MyClassTest, PrivateMethodWorks) { -// // Can call MyClass::PrivateMethod() here. -// } -// -// Note: The test class must be in the same namespace as the class being tested. -// For example, putting MyClassTest in an anonymous namespace will not work. - -#define FRIEND_TEST(test_case_name, test_name)\ -friend class test_case_name##_##test_name##_Test - -#endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/custom/README.md b/3rdParty/googletest/googletest/include/gtest/internal/custom/README.md deleted file mode 100644 index ff391fb4e2b5765cac8c6943359b15bbd5f4f149..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/custom/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Customization Points - -The custom directory is an injection point for custom user configurations. - -## Header `gtest.h` - -### The following macros can be defined: - -* `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of - `OsStackTraceGetterInterface`. -* `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See - `testing::TempDir` for semantics and signature. - -## Header `gtest-port.h` - -The following macros can be defined: - -### Flag related macros: - -* `GTEST_FLAG(flag_name)` -* `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its - own flagfile flag parsing. -* `GTEST_DECLARE_bool_(name)` -* `GTEST_DECLARE_int32_(name)` -* `GTEST_DECLARE_string_(name)` -* `GTEST_DEFINE_bool_(name, default_val, doc)` -* `GTEST_DEFINE_int32_(name, default_val, doc)` -* `GTEST_DEFINE_string_(name, default_val, doc)` - -### Logging: - -* `GTEST_LOG_(severity)` -* `GTEST_CHECK_(condition)` -* Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too. - -### Threading: - -* `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. -* `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal` - are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` - and `GTEST_DEFINE_STATIC_MUTEX_(mutex)` -* `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` -* `GTEST_LOCK_EXCLUDED_(locks)` - -### Underlying library support features - -* `GTEST_HAS_CXXABI_H_` - -### Exporting API symbols: - -* `GTEST_API_` - Specifier for exported symbols. - -## Header `gtest-printers.h` - -* See documentation at `gtest/gtest-printers.h` for details on how to define a - custom printer. diff --git a/3rdParty/googletest/googletest/include/gtest/internal/custom/gtest-port.h b/3rdParty/googletest/googletest/include/gtest/internal/custom/gtest-port.h deleted file mode 100644 index cd85d956d2dc17bd537f2142340bdf58f4737118..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/custom/gtest-port.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Injection point for custom user configurations. See README for details -// -// ** Custom implementation starts here ** - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/custom/gtest-printers.h b/3rdParty/googletest/googletest/include/gtest/internal/custom/gtest-printers.h deleted file mode 100644 index eb4467abcabea7ff76f9d2d527387c9da810148b..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/custom/gtest-printers.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// This file provides an injection point for custom printers in a local -// installation of gTest. -// It will be included from gtest-printers.h and the overrides in this file -// will be visible to everyone. -// -// Injection point for custom user configurations. See README for details -// -// ** Custom implementation starts here ** - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/custom/gtest.h b/3rdParty/googletest/googletest/include/gtest/internal/custom/gtest.h deleted file mode 100644 index 4c8e07be23f1fd6159afef2eefd7444034dd0604..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/custom/gtest.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Injection point for custom user configurations. See README for details -// -// ** Custom implementation starts here ** - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h b/3rdParty/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h deleted file mode 100644 index 68bd3530618f264c44749a7796ce5ee581751e62..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h +++ /dev/null @@ -1,304 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// The Google C++ Testing and Mocking Framework (Google Test) -// -// This header file defines internal utilities needed for implementing -// death tests. They are subject to change without notice. -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ - -#include "gtest/gtest-matchers.h" -#include "gtest/internal/gtest-internal.h" - -#include <stdio.h> -#include <memory> - -namespace testing { -namespace internal { - -GTEST_DECLARE_string_(internal_run_death_test); - -// Names of the flags (needed for parsing Google Test flags). -const char kDeathTestStyleFlag[] = "death_test_style"; -const char kDeathTestUseFork[] = "death_test_use_fork"; -const char kInternalRunDeathTestFlag[] = "internal_run_death_test"; - -#if GTEST_HAS_DEATH_TEST - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -// DeathTest is a class that hides much of the complexity of the -// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method -// returns a concrete class that depends on the prevailing death test -// style, as defined by the --gtest_death_test_style and/or -// --gtest_internal_run_death_test flags. - -// In describing the results of death tests, these terms are used with -// the corresponding definitions: -// -// exit status: The integer exit information in the format specified -// by wait(2) -// exit code: The integer code passed to exit(3), _exit(2), or -// returned from main() -class GTEST_API_ DeathTest { - public: - // Create returns false if there was an error determining the - // appropriate action to take for the current death test; for example, - // if the gtest_death_test_style flag is set to an invalid value. - // The LastMessage method will return a more detailed message in that - // case. Otherwise, the DeathTest pointer pointed to by the "test" - // argument is set. If the death test should be skipped, the pointer - // is set to NULL; otherwise, it is set to the address of a new concrete - // DeathTest object that controls the execution of the current test. - static bool Create(const char* statement, Matcher<const std::string&> matcher, - const char* file, int line, DeathTest** test); - DeathTest(); - virtual ~DeathTest() { } - - // A helper class that aborts a death test when it's deleted. - class ReturnSentinel { - public: - explicit ReturnSentinel(DeathTest* test) : test_(test) { } - ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); } - private: - DeathTest* const test_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel); - } GTEST_ATTRIBUTE_UNUSED_; - - // An enumeration of possible roles that may be taken when a death - // test is encountered. EXECUTE means that the death test logic should - // be executed immediately. OVERSEE means that the program should prepare - // the appropriate environment for a child process to execute the death - // test, then wait for it to complete. - enum TestRole { OVERSEE_TEST, EXECUTE_TEST }; - - // An enumeration of the three reasons that a test might be aborted. - enum AbortReason { - TEST_ENCOUNTERED_RETURN_STATEMENT, - TEST_THREW_EXCEPTION, - TEST_DID_NOT_DIE - }; - - // Assumes one of the above roles. - virtual TestRole AssumeRole() = 0; - - // Waits for the death test to finish and returns its status. - virtual int Wait() = 0; - - // Returns true if the death test passed; that is, the test process - // exited during the test, its exit status matches a user-supplied - // predicate, and its stderr output matches a user-supplied regular - // expression. - // The user-supplied predicate may be a macro expression rather - // than a function pointer or functor, or else Wait and Passed could - // be combined. - virtual bool Passed(bool exit_status_ok) = 0; - - // Signals that the death test did not die as expected. - virtual void Abort(AbortReason reason) = 0; - - // Returns a human-readable outcome message regarding the outcome of - // the last death test. - static const char* LastMessage(); - - static void set_last_death_test_message(const std::string& message); - - private: - // A string containing a description of the outcome of the last death test. - static std::string last_death_test_message_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest); -}; - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -// Factory interface for death tests. May be mocked out for testing. -class DeathTestFactory { - public: - virtual ~DeathTestFactory() { } - virtual bool Create(const char* statement, - Matcher<const std::string&> matcher, const char* file, - int line, DeathTest** test) = 0; -}; - -// A concrete DeathTestFactory implementation for normal use. -class DefaultDeathTestFactory : public DeathTestFactory { - public: - bool Create(const char* statement, Matcher<const std::string&> matcher, - const char* file, int line, DeathTest** test) override; -}; - -// Returns true if exit_status describes a process that was terminated -// by a signal, or exited normally with a nonzero exit code. -GTEST_API_ bool ExitedUnsuccessfully(int exit_status); - -// A string passed to EXPECT_DEATH (etc.) is caught by one of these overloads -// and interpreted as a regex (rather than an Eq matcher) for legacy -// compatibility. -inline Matcher<const ::std::string&> MakeDeathTestMatcher( - ::testing::internal::RE regex) { - return ContainsRegex(regex.pattern()); -} -inline Matcher<const ::std::string&> MakeDeathTestMatcher(const char* regex) { - return ContainsRegex(regex); -} -inline Matcher<const ::std::string&> MakeDeathTestMatcher( - const ::std::string& regex) { - return ContainsRegex(regex); -} - -// If a Matcher<const ::std::string&> is passed to EXPECT_DEATH (etc.), it's -// used directly. -inline Matcher<const ::std::string&> MakeDeathTestMatcher( - Matcher<const ::std::string&> matcher) { - return matcher; -} - -// Traps C++ exceptions escaping statement and reports them as test -// failures. Note that trapping SEH exceptions is not implemented here. -# if GTEST_HAS_EXCEPTIONS -# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ - try { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } catch (const ::std::exception& gtest_exception) { \ - fprintf(\ - stderr, \ - "\n%s: Caught std::exception-derived exception escaping the " \ - "death test statement. Exception message: %s\n", \ - ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \ - gtest_exception.what()); \ - fflush(stderr); \ - death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \ - } catch (...) { \ - death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \ - } - -# else -# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) - -# endif - -// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*, -// ASSERT_EXIT*, and EXPECT_EXIT*. -#define GTEST_DEATH_TEST_(statement, predicate, regex_or_matcher, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ - ::testing::internal::DeathTest* gtest_dt; \ - if (!::testing::internal::DeathTest::Create( \ - #statement, \ - ::testing::internal::MakeDeathTestMatcher(regex_or_matcher), \ - __FILE__, __LINE__, >est_dt)) { \ - goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \ - } \ - if (gtest_dt != nullptr) { \ - std::unique_ptr< ::testing::internal::DeathTest> gtest_dt_ptr(gtest_dt); \ - switch (gtest_dt->AssumeRole()) { \ - case ::testing::internal::DeathTest::OVERSEE_TEST: \ - if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \ - goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \ - } \ - break; \ - case ::testing::internal::DeathTest::EXECUTE_TEST: { \ - ::testing::internal::DeathTest::ReturnSentinel gtest_sentinel( \ - gtest_dt); \ - GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, gtest_dt); \ - gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE); \ - break; \ - } \ - default: \ - break; \ - } \ - } \ - } else \ - GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__) \ - : fail(::testing::internal::DeathTest::LastMessage()) -// The symbol "fail" here expands to something into which a message -// can be streamed. - -// This macro is for implementing ASSERT/EXPECT_DEBUG_DEATH when compiled in -// NDEBUG mode. In this case we need the statements to be executed and the macro -// must accept a streamed message even though the message is never printed. -// The regex object is not evaluated, but it is used to prevent "unused" -// warnings and to avoid an expression that doesn't compile in debug mode. -#define GTEST_EXECUTE_STATEMENT_(statement, regex_or_matcher) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } else if (!::testing::internal::AlwaysTrue()) { \ - ::testing::internal::MakeDeathTestMatcher(regex_or_matcher); \ - } else \ - ::testing::Message() - -// A class representing the parsed contents of the -// --gtest_internal_run_death_test flag, as it existed when -// RUN_ALL_TESTS was called. -class InternalRunDeathTestFlag { - public: - InternalRunDeathTestFlag(const std::string& a_file, - int a_line, - int an_index, - int a_write_fd) - : file_(a_file), line_(a_line), index_(an_index), - write_fd_(a_write_fd) {} - - ~InternalRunDeathTestFlag() { - if (write_fd_ >= 0) - posix::Close(write_fd_); - } - - const std::string& file() const { return file_; } - int line() const { return line_; } - int index() const { return index_; } - int write_fd() const { return write_fd_; } - - private: - std::string file_; - int line_; - int index_; - int write_fd_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(InternalRunDeathTestFlag); -}; - -// Returns a newly created InternalRunDeathTestFlag object with fields -// initialized from the GTEST_FLAG(internal_run_death_test) flag if -// the flag is specified; otherwise returns NULL. -InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag(); - -#endif // GTEST_HAS_DEATH_TEST - -} // namespace internal -} // namespace testing - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_DEATH_TEST_INTERNAL_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/gtest-filepath.h b/3rdParty/googletest/googletest/include/gtest/internal/gtest-filepath.h deleted file mode 100644 index c11b101516e530aaa9510b65d97dd67bbc0690a6..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/gtest-filepath.h +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Google Test filepath utilities -// -// This header file declares classes and functions used internally by -// Google Test. They are subject to change without notice. -// -// This file is #included in gtest/internal/gtest-internal.h. -// Do not include this header file separately! - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ - -#include "gtest/internal/gtest-string.h" - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -namespace testing { -namespace internal { - -// FilePath - a class for file and directory pathname manipulation which -// handles platform-specific conventions (like the pathname separator). -// Used for helper functions for naming files in a directory for xml output. -// Except for Set methods, all methods are const or static, which provides an -// "immutable value object" -- useful for peace of mind. -// A FilePath with a value ending in a path separator ("like/this/") represents -// a directory, otherwise it is assumed to represent a file. In either case, -// it may or may not represent an actual file or directory in the file system. -// Names are NOT checked for syntax correctness -- no checking for illegal -// characters, malformed paths, etc. - -class GTEST_API_ FilePath { - public: - FilePath() : pathname_("") { } - FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { } - - explicit FilePath(const std::string& pathname) : pathname_(pathname) { - Normalize(); - } - - FilePath& operator=(const FilePath& rhs) { - Set(rhs); - return *this; - } - - void Set(const FilePath& rhs) { - pathname_ = rhs.pathname_; - } - - const std::string& string() const { return pathname_; } - const char* c_str() const { return pathname_.c_str(); } - - // Returns the current working directory, or "" if unsuccessful. - static FilePath GetCurrentDir(); - - // Given directory = "dir", base_name = "test", number = 0, - // extension = "xml", returns "dir/test.xml". If number is greater - // than zero (e.g., 12), returns "dir/test_12.xml". - // On Windows platform, uses \ as the separator rather than /. - static FilePath MakeFileName(const FilePath& directory, - const FilePath& base_name, - int number, - const char* extension); - - // Given directory = "dir", relative_path = "test.xml", - // returns "dir/test.xml". - // On Windows, uses \ as the separator rather than /. - static FilePath ConcatPaths(const FilePath& directory, - const FilePath& relative_path); - - // Returns a pathname for a file that does not currently exist. The pathname - // will be directory/base_name.extension or - // directory/base_name_<number>.extension if directory/base_name.extension - // already exists. The number will be incremented until a pathname is found - // that does not already exist. - // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'. - // There could be a race condition if two or more processes are calling this - // function at the same time -- they could both pick the same filename. - static FilePath GenerateUniqueFileName(const FilePath& directory, - const FilePath& base_name, - const char* extension); - - // Returns true if and only if the path is "". - bool IsEmpty() const { return pathname_.empty(); } - - // If input name has a trailing separator character, removes it and returns - // the name, otherwise return the name string unmodified. - // On Windows platform, uses \ as the separator, other platforms use /. - FilePath RemoveTrailingPathSeparator() const; - - // Returns a copy of the FilePath with the directory part removed. - // Example: FilePath("path/to/file").RemoveDirectoryName() returns - // FilePath("file"). If there is no directory part ("just_a_file"), it returns - // the FilePath unmodified. If there is no file part ("just_a_dir/") it - // returns an empty FilePath (""). - // On Windows platform, '\' is the path separator, otherwise it is '/'. - FilePath RemoveDirectoryName() const; - - // RemoveFileName returns the directory path with the filename removed. - // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/". - // If the FilePath is "a_file" or "/a_file", RemoveFileName returns - // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does - // not have a file, like "just/a/dir/", it returns the FilePath unmodified. - // On Windows platform, '\' is the path separator, otherwise it is '/'. - FilePath RemoveFileName() const; - - // Returns a copy of the FilePath with the case-insensitive extension removed. - // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns - // FilePath("dir/file"). If a case-insensitive extension is not - // found, returns a copy of the original FilePath. - FilePath RemoveExtension(const char* extension) const; - - // Creates directories so that path exists. Returns true if successful or if - // the directories already exist; returns false if unable to create - // directories for any reason. Will also return false if the FilePath does - // not represent a directory (that is, it doesn't end with a path separator). - bool CreateDirectoriesRecursively() const; - - // Create the directory so that path exists. Returns true if successful or - // if the directory already exists; returns false if unable to create the - // directory for any reason, including if the parent directory does not - // exist. Not named "CreateDirectory" because that's a macro on Windows. - bool CreateFolder() const; - - // Returns true if FilePath describes something in the file-system, - // either a file, directory, or whatever, and that something exists. - bool FileOrDirectoryExists() const; - - // Returns true if pathname describes a directory in the file-system - // that exists. - bool DirectoryExists() const; - - // Returns true if FilePath ends with a path separator, which indicates that - // it is intended to represent a directory. Returns false otherwise. - // This does NOT check that a directory (or file) actually exists. - bool IsDirectory() const; - - // Returns true if pathname describes a root directory. (Windows has one - // root directory per disk drive.) - bool IsRootDirectory() const; - - // Returns true if pathname describes an absolute path. - bool IsAbsolutePath() const; - - private: - // Replaces multiple consecutive separators with a single separator. - // For example, "bar///foo" becomes "bar/foo". Does not eliminate other - // redundancies that might be in a pathname involving "." or "..". - // - // A pathname with multiple consecutive separators may occur either through - // user error or as a result of some scripts or APIs that generate a pathname - // with a trailing separator. On other platforms the same API or script - // may NOT generate a pathname with a trailing "/". Then elsewhere that - // pathname may have another "/" and pathname components added to it, - // without checking for the separator already being there. - // The script language and operating system may allow paths like "foo//bar" - // but some of the functions in FilePath will not handle that correctly. In - // particular, RemoveTrailingPathSeparator() only removes one separator, and - // it is called in CreateDirectoriesRecursively() assuming that it will change - // a pathname from directory syntax (trailing separator) to filename syntax. - // - // On Windows this method also replaces the alternate path separator '/' with - // the primary path separator '\\', so that for example "bar\\/\\foo" becomes - // "bar\\foo". - - void Normalize(); - - // Returns a pointer to the last occurence of a valid path separator in - // the FilePath. On Windows, for example, both '/' and '\' are valid path - // separators. Returns NULL if no path separator was found. - const char* FindLastPathSeparator() const; - - std::string pathname_; -}; // class FilePath - -} // namespace internal -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/gtest-internal.h b/3rdParty/googletest/googletest/include/gtest/internal/gtest-internal.h deleted file mode 100644 index 94c816a28bdb170aec9568e02be4a448a9b4dc7f..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/gtest-internal.h +++ /dev/null @@ -1,1380 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// The Google C++ Testing and Mocking Framework (Google Test) -// -// This header file declares functions and macros used internally by -// Google Test. They are subject to change without notice. - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ - -#include "gtest/internal/gtest-port.h" - -#if GTEST_OS_LINUX -# include <stdlib.h> -# include <sys/types.h> -# include <sys/wait.h> -# include <unistd.h> -#endif // GTEST_OS_LINUX - -#if GTEST_HAS_EXCEPTIONS -# include <stdexcept> -#endif - -#include <ctype.h> -#include <float.h> -#include <string.h> -#include <iomanip> -#include <limits> -#include <map> -#include <set> -#include <string> -#include <type_traits> -#include <vector> - -#include "gtest/gtest-message.h" -#include "gtest/internal/gtest-filepath.h" -#include "gtest/internal/gtest-string.h" -#include "gtest/internal/gtest-type-util.h" - -// Due to C++ preprocessor weirdness, we need double indirection to -// concatenate two tokens when one of them is __LINE__. Writing -// -// foo ## __LINE__ -// -// will result in the token foo__LINE__, instead of foo followed by -// the current line number. For more details, see -// http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6 -#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar) -#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar - -// Stringifies its argument. -#define GTEST_STRINGIFY_(name) #name - -namespace proto2 { class Message; } - -namespace testing { - -// Forward declarations. - -class AssertionResult; // Result of an assertion. -class Message; // Represents a failure message. -class Test; // Represents a test. -class TestInfo; // Information about a test. -class TestPartResult; // Result of a test part. -class UnitTest; // A collection of test suites. - -template <typename T> -::std::string PrintToString(const T& value); - -namespace internal { - -struct TraceInfo; // Information about a trace point. -class TestInfoImpl; // Opaque implementation of TestInfo -class UnitTestImpl; // Opaque implementation of UnitTest - -// The text used in failure messages to indicate the start of the -// stack trace. -GTEST_API_ extern const char kStackTraceMarker[]; - -// An IgnoredValue object can be implicitly constructed from ANY value. -class IgnoredValue { - struct Sink {}; - public: - // This constructor template allows any value to be implicitly - // converted to IgnoredValue. The object has no data member and - // doesn't try to remember anything about the argument. We - // deliberately omit the 'explicit' keyword in order to allow the - // conversion to be implicit. - // Disable the conversion if T already has a magical conversion operator. - // Otherwise we get ambiguity. - template <typename T, - typename std::enable_if<!std::is_convertible<T, Sink>::value, - int>::type = 0> - IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit) -}; - -// Appends the user-supplied message to the Google-Test-generated message. -GTEST_API_ std::string AppendUserMessage( - const std::string& gtest_msg, const Message& user_msg); - -#if GTEST_HAS_EXCEPTIONS - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4275 \ -/* an exported class was derived from a class that was not exported */) - -// This exception is thrown by (and only by) a failed Google Test -// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions -// are enabled). We derive it from std::runtime_error, which is for -// errors presumably detectable only at run time. Since -// std::runtime_error inherits from std::exception, many testing -// frameworks know how to extract and print the message inside it. -class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error { - public: - explicit GoogleTestFailureException(const TestPartResult& failure); -}; - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4275 - -#endif // GTEST_HAS_EXCEPTIONS - -namespace edit_distance { -// Returns the optimal edits to go from 'left' to 'right'. -// All edits cost the same, with replace having lower priority than -// add/remove. -// Simple implementation of the Wagner-Fischer algorithm. -// See http://en.wikipedia.org/wiki/Wagner-Fischer_algorithm -enum EditType { kMatch, kAdd, kRemove, kReplace }; -GTEST_API_ std::vector<EditType> CalculateOptimalEdits( - const std::vector<size_t>& left, const std::vector<size_t>& right); - -// Same as above, but the input is represented as strings. -GTEST_API_ std::vector<EditType> CalculateOptimalEdits( - const std::vector<std::string>& left, - const std::vector<std::string>& right); - -// Create a diff of the input strings in Unified diff format. -GTEST_API_ std::string CreateUnifiedDiff(const std::vector<std::string>& left, - const std::vector<std::string>& right, - size_t context = 2); - -} // namespace edit_distance - -// Calculate the diff between 'left' and 'right' and return it in unified diff -// format. -// If not null, stores in 'total_line_count' the total number of lines found -// in left + right. -GTEST_API_ std::string DiffStrings(const std::string& left, - const std::string& right, - size_t* total_line_count); - -// Constructs and returns the message for an equality assertion -// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure. -// -// The first four parameters are the expressions used in the assertion -// and their values, as strings. For example, for ASSERT_EQ(foo, bar) -// where foo is 5 and bar is 6, we have: -// -// expected_expression: "foo" -// actual_expression: "bar" -// expected_value: "5" -// actual_value: "6" -// -// The ignoring_case parameter is true if and only if the assertion is a -// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will -// be inserted into the message. -GTEST_API_ AssertionResult EqFailure(const char* expected_expression, - const char* actual_expression, - const std::string& expected_value, - const std::string& actual_value, - bool ignoring_case); - -// Constructs a failure message for Boolean assertions such as EXPECT_TRUE. -GTEST_API_ std::string GetBoolAssertionFailureMessage( - const AssertionResult& assertion_result, - const char* expression_text, - const char* actual_predicate_value, - const char* expected_predicate_value); - -// This template class represents an IEEE floating-point number -// (either single-precision or double-precision, depending on the -// template parameters). -// -// The purpose of this class is to do more sophisticated number -// comparison. (Due to round-off error, etc, it's very unlikely that -// two floating-points will be equal exactly. Hence a naive -// comparison by the == operation often doesn't work.) -// -// Format of IEEE floating-point: -// -// The most-significant bit being the leftmost, an IEEE -// floating-point looks like -// -// sign_bit exponent_bits fraction_bits -// -// Here, sign_bit is a single bit that designates the sign of the -// number. -// -// For float, there are 8 exponent bits and 23 fraction bits. -// -// For double, there are 11 exponent bits and 52 fraction bits. -// -// More details can be found at -// http://en.wikipedia.org/wiki/IEEE_floating-point_standard. -// -// Template parameter: -// -// RawType: the raw floating-point type (either float or double) -template <typename RawType> -class FloatingPoint { - public: - // Defines the unsigned integer type that has the same size as the - // floating point number. - typedef typename TypeWithSize<sizeof(RawType)>::UInt Bits; - - // Constants. - - // # of bits in a number. - static const size_t kBitCount = 8*sizeof(RawType); - - // # of fraction bits in a number. - static const size_t kFractionBitCount = - std::numeric_limits<RawType>::digits - 1; - - // # of exponent bits in a number. - static const size_t kExponentBitCount = kBitCount - 1 - kFractionBitCount; - - // The mask for the sign bit. - static const Bits kSignBitMask = static_cast<Bits>(1) << (kBitCount - 1); - - // The mask for the fraction bits. - static const Bits kFractionBitMask = - ~static_cast<Bits>(0) >> (kExponentBitCount + 1); - - // The mask for the exponent bits. - static const Bits kExponentBitMask = ~(kSignBitMask | kFractionBitMask); - - // How many ULP's (Units in the Last Place) we want to tolerate when - // comparing two numbers. The larger the value, the more error we - // allow. A 0 value means that two numbers must be exactly the same - // to be considered equal. - // - // The maximum error of a single floating-point operation is 0.5 - // units in the last place. On Intel CPU's, all floating-point - // calculations are done with 80-bit precision, while double has 64 - // bits. Therefore, 4 should be enough for ordinary use. - // - // See the following article for more details on ULP: - // http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ - static const size_t kMaxUlps = 4; - - // Constructs a FloatingPoint from a raw floating-point number. - // - // On an Intel CPU, passing a non-normalized NAN (Not a Number) - // around may change its bits, although the new value is guaranteed - // to be also a NAN. Therefore, don't expect this constructor to - // preserve the bits in x when x is a NAN. - explicit FloatingPoint(const RawType& x) { u_.value_ = x; } - - // Static methods - - // Reinterprets a bit pattern as a floating-point number. - // - // This function is needed to test the AlmostEquals() method. - static RawType ReinterpretBits(const Bits bits) { - FloatingPoint fp(0); - fp.u_.bits_ = bits; - return fp.u_.value_; - } - - // Returns the floating-point number that represent positive infinity. - static RawType Infinity() { - return ReinterpretBits(kExponentBitMask); - } - - // Returns the maximum representable finite floating-point number. - static RawType Max(); - - // Non-static methods - - // Returns the bits that represents this number. - const Bits &bits() const { return u_.bits_; } - - // Returns the exponent bits of this number. - Bits exponent_bits() const { return kExponentBitMask & u_.bits_; } - - // Returns the fraction bits of this number. - Bits fraction_bits() const { return kFractionBitMask & u_.bits_; } - - // Returns the sign bit of this number. - Bits sign_bit() const { return kSignBitMask & u_.bits_; } - - // Returns true if and only if this is NAN (not a number). - bool is_nan() const { - // It's a NAN if the exponent bits are all ones and the fraction - // bits are not entirely zeros. - return (exponent_bits() == kExponentBitMask) && (fraction_bits() != 0); - } - - // Returns true if and only if this number is at most kMaxUlps ULP's away - // from rhs. In particular, this function: - // - // - returns false if either number is (or both are) NAN. - // - treats really large numbers as almost equal to infinity. - // - thinks +0.0 and -0.0 are 0 DLP's apart. - bool AlmostEquals(const FloatingPoint& rhs) const { - // The IEEE standard says that any comparison operation involving - // a NAN must return false. - if (is_nan() || rhs.is_nan()) return false; - - return DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_) - <= kMaxUlps; - } - - private: - // The data type used to store the actual floating-point number. - union FloatingPointUnion { - RawType value_; // The raw floating-point number. - Bits bits_; // The bits that represent the number. - }; - - // Converts an integer from the sign-and-magnitude representation to - // the biased representation. More precisely, let N be 2 to the - // power of (kBitCount - 1), an integer x is represented by the - // unsigned number x + N. - // - // For instance, - // - // -N + 1 (the most negative number representable using - // sign-and-magnitude) is represented by 1; - // 0 is represented by N; and - // N - 1 (the biggest number representable using - // sign-and-magnitude) is represented by 2N - 1. - // - // Read http://en.wikipedia.org/wiki/Signed_number_representations - // for more details on signed number representations. - static Bits SignAndMagnitudeToBiased(const Bits &sam) { - if (kSignBitMask & sam) { - // sam represents a negative number. - return ~sam + 1; - } else { - // sam represents a positive number. - return kSignBitMask | sam; - } - } - - // Given two numbers in the sign-and-magnitude representation, - // returns the distance between them as an unsigned number. - static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1, - const Bits &sam2) { - const Bits biased1 = SignAndMagnitudeToBiased(sam1); - const Bits biased2 = SignAndMagnitudeToBiased(sam2); - return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1); - } - - FloatingPointUnion u_; -}; - -// We cannot use std::numeric_limits<T>::max() as it clashes with the max() -// macro defined by <windows.h>. -template <> -inline float FloatingPoint<float>::Max() { return FLT_MAX; } -template <> -inline double FloatingPoint<double>::Max() { return DBL_MAX; } - -// Typedefs the instances of the FloatingPoint template class that we -// care to use. -typedef FloatingPoint<float> Float; -typedef FloatingPoint<double> Double; - -// In order to catch the mistake of putting tests that use different -// test fixture classes in the same test suite, we need to assign -// unique IDs to fixture classes and compare them. The TypeId type is -// used to hold such IDs. The user should treat TypeId as an opaque -// type: the only operation allowed on TypeId values is to compare -// them for equality using the == operator. -typedef const void* TypeId; - -template <typename T> -class TypeIdHelper { - public: - // dummy_ must not have a const type. Otherwise an overly eager - // compiler (e.g. MSVC 7.1 & 8.0) may try to merge - // TypeIdHelper<T>::dummy_ for different Ts as an "optimization". - static bool dummy_; -}; - -template <typename T> -bool TypeIdHelper<T>::dummy_ = false; - -// GetTypeId<T>() returns the ID of type T. Different values will be -// returned for different types. Calling the function twice with the -// same type argument is guaranteed to return the same ID. -template <typename T> -TypeId GetTypeId() { - // The compiler is required to allocate a different - // TypeIdHelper<T>::dummy_ variable for each T used to instantiate - // the template. Therefore, the address of dummy_ is guaranteed to - // be unique. - return &(TypeIdHelper<T>::dummy_); -} - -// Returns the type ID of ::testing::Test. Always call this instead -// of GetTypeId< ::testing::Test>() to get the type ID of -// ::testing::Test, as the latter may give the wrong result due to a -// suspected linker bug when compiling Google Test as a Mac OS X -// framework. -GTEST_API_ TypeId GetTestTypeId(); - -// Defines the abstract factory interface that creates instances -// of a Test object. -class TestFactoryBase { - public: - virtual ~TestFactoryBase() {} - - // Creates a test instance to run. The instance is both created and destroyed - // within TestInfoImpl::Run() - virtual Test* CreateTest() = 0; - - protected: - TestFactoryBase() {} - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase); -}; - -// This class provides implementation of TeastFactoryBase interface. -// It is used in TEST and TEST_F macros. -template <class TestClass> -class TestFactoryImpl : public TestFactoryBase { - public: - Test* CreateTest() override { return new TestClass; } -}; - -#if GTEST_OS_WINDOWS - -// Predicate-formatters for implementing the HRESULT checking macros -// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED} -// We pass a long instead of HRESULT to avoid causing an -// include dependency for the HRESULT type. -GTEST_API_ AssertionResult IsHRESULTSuccess(const char* expr, - long hr); // NOLINT -GTEST_API_ AssertionResult IsHRESULTFailure(const char* expr, - long hr); // NOLINT - -#endif // GTEST_OS_WINDOWS - -// Types of SetUpTestSuite() and TearDownTestSuite() functions. -using SetUpTestSuiteFunc = void (*)(); -using TearDownTestSuiteFunc = void (*)(); - -struct CodeLocation { - CodeLocation(const std::string& a_file, int a_line) - : file(a_file), line(a_line) {} - - std::string file; - int line; -}; - -// Helper to identify which setup function for TestCase / TestSuite to call. -// Only one function is allowed, either TestCase or TestSute but not both. - -// Utility functions to help SuiteApiResolver -using SetUpTearDownSuiteFuncType = void (*)(); - -inline SetUpTearDownSuiteFuncType GetNotDefaultOrNull( - SetUpTearDownSuiteFuncType a, SetUpTearDownSuiteFuncType def) { - return a == def ? nullptr : a; -} - -template <typename T> -// Note that SuiteApiResolver inherits from T because -// SetUpTestSuite()/TearDownTestSuite() could be protected. Ths way -// SuiteApiResolver can access them. -struct SuiteApiResolver : T { - // testing::Test is only forward declared at this point. So we make it a - // dependend class for the compiler to be OK with it. - using Test = - typename std::conditional<sizeof(T) != 0, ::testing::Test, void>::type; - - static SetUpTearDownSuiteFuncType GetSetUpCaseOrSuite(const char* filename, - int line_num) { - SetUpTearDownSuiteFuncType test_case_fp = - GetNotDefaultOrNull(&T::SetUpTestCase, &Test::SetUpTestCase); - SetUpTearDownSuiteFuncType test_suite_fp = - GetNotDefaultOrNull(&T::SetUpTestSuite, &Test::SetUpTestSuite); - - GTEST_CHECK_(!test_case_fp || !test_suite_fp) - << "Test can not provide both SetUpTestSuite and SetUpTestCase, please " - "make sure there is only one present at " - << filename << ":" << line_num; - - return test_case_fp != nullptr ? test_case_fp : test_suite_fp; - } - - static SetUpTearDownSuiteFuncType GetTearDownCaseOrSuite(const char* filename, - int line_num) { - SetUpTearDownSuiteFuncType test_case_fp = - GetNotDefaultOrNull(&T::TearDownTestCase, &Test::TearDownTestCase); - SetUpTearDownSuiteFuncType test_suite_fp = - GetNotDefaultOrNull(&T::TearDownTestSuite, &Test::TearDownTestSuite); - - GTEST_CHECK_(!test_case_fp || !test_suite_fp) - << "Test can not provide both TearDownTestSuite and TearDownTestCase," - " please make sure there is only one present at" - << filename << ":" << line_num; - - return test_case_fp != nullptr ? test_case_fp : test_suite_fp; - } -}; - -// Creates a new TestInfo object and registers it with Google Test; -// returns the created object. -// -// Arguments: -// -// test_suite_name: name of the test suite -// name: name of the test -// type_param the name of the test's type parameter, or NULL if -// this is not a typed or a type-parameterized test. -// value_param text representation of the test's value parameter, -// or NULL if this is not a type-parameterized test. -// code_location: code location where the test is defined -// fixture_class_id: ID of the test fixture class -// set_up_tc: pointer to the function that sets up the test suite -// tear_down_tc: pointer to the function that tears down the test suite -// factory: pointer to the factory that creates a test object. -// The newly created TestInfo instance will assume -// ownership of the factory object. -GTEST_API_ TestInfo* MakeAndRegisterTestInfo( - const char* test_suite_name, const char* name, const char* type_param, - const char* value_param, CodeLocation code_location, - TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc, - TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory); - -// If *pstr starts with the given prefix, modifies *pstr to be right -// past the prefix and returns true; otherwise leaves *pstr unchanged -// and returns false. None of pstr, *pstr, and prefix can be NULL. -GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr); - -#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -// State of the definition of a type-parameterized test suite. -class GTEST_API_ TypedTestSuitePState { - public: - TypedTestSuitePState() : registered_(false) {} - - // Adds the given test name to defined_test_names_ and return true - // if the test suite hasn't been registered; otherwise aborts the - // program. - bool AddTestName(const char* file, int line, const char* case_name, - const char* test_name) { - if (registered_) { - fprintf(stderr, - "%s Test %s must be defined before " - "REGISTER_TYPED_TEST_SUITE_P(%s, ...).\n", - FormatFileLocation(file, line).c_str(), test_name, case_name); - fflush(stderr); - posix::Abort(); - } - registered_tests_.insert( - ::std::make_pair(test_name, CodeLocation(file, line))); - return true; - } - - bool TestExists(const std::string& test_name) const { - return registered_tests_.count(test_name) > 0; - } - - const CodeLocation& GetCodeLocation(const std::string& test_name) const { - RegisteredTestsMap::const_iterator it = registered_tests_.find(test_name); - GTEST_CHECK_(it != registered_tests_.end()); - return it->second; - } - - // Verifies that registered_tests match the test names in - // defined_test_names_; returns registered_tests if successful, or - // aborts the program otherwise. - const char* VerifyRegisteredTestNames( - const char* file, int line, const char* registered_tests); - - private: - typedef ::std::map<std::string, CodeLocation> RegisteredTestsMap; - - bool registered_; - RegisteredTestsMap registered_tests_; -}; - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -using TypedTestCasePState = TypedTestSuitePState; -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -// Skips to the first non-space char after the first comma in 'str'; -// returns NULL if no comma is found in 'str'. -inline const char* SkipComma(const char* str) { - const char* comma = strchr(str, ','); - if (comma == nullptr) { - return nullptr; - } - while (IsSpace(*(++comma))) {} - return comma; -} - -// Returns the prefix of 'str' before the first comma in it; returns -// the entire string if it contains no comma. -inline std::string GetPrefixUntilComma(const char* str) { - const char* comma = strchr(str, ','); - return comma == nullptr ? str : std::string(str, comma); -} - -// Splits a given string on a given delimiter, populating a given -// vector with the fields. -void SplitString(const ::std::string& str, char delimiter, - ::std::vector< ::std::string>* dest); - -// The default argument to the template below for the case when the user does -// not provide a name generator. -struct DefaultNameGenerator { - template <typename T> - static std::string GetName(int i) { - return StreamableToString(i); - } -}; - -template <typename Provided = DefaultNameGenerator> -struct NameGeneratorSelector { - typedef Provided type; -}; - -template <typename NameGenerator> -void GenerateNamesRecursively(Types0, std::vector<std::string>*, int) {} - -template <typename NameGenerator, typename Types> -void GenerateNamesRecursively(Types, std::vector<std::string>* result, int i) { - result->push_back(NameGenerator::template GetName<typename Types::Head>(i)); - GenerateNamesRecursively<NameGenerator>(typename Types::Tail(), result, - i + 1); -} - -template <typename NameGenerator, typename Types> -std::vector<std::string> GenerateNames() { - std::vector<std::string> result; - GenerateNamesRecursively<NameGenerator>(Types(), &result, 0); - return result; -} - -// TypeParameterizedTest<Fixture, TestSel, Types>::Register() -// registers a list of type-parameterized tests with Google Test. The -// return value is insignificant - we just need to return something -// such that we can call this function in a namespace scope. -// -// Implementation note: The GTEST_TEMPLATE_ macro declares a template -// template parameter. It's defined in gtest-type-util.h. -template <GTEST_TEMPLATE_ Fixture, class TestSel, typename Types> -class TypeParameterizedTest { - public: - // 'index' is the index of the test in the type list 'Types' - // specified in INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, TestSuite, - // Types). Valid values for 'index' are [0, N - 1] where N is the - // length of Types. - static bool Register(const char* prefix, const CodeLocation& code_location, - const char* case_name, const char* test_names, int index, - const std::vector<std::string>& type_names = - GenerateNames<DefaultNameGenerator, Types>()) { - typedef typename Types::Head Type; - typedef Fixture<Type> FixtureClass; - typedef typename GTEST_BIND_(TestSel, Type) TestClass; - - // First, registers the first type-parameterized test in the type - // list. - MakeAndRegisterTestInfo( - (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + - "/" + type_names[static_cast<size_t>(index)]) - .c_str(), - StripTrailingSpaces(GetPrefixUntilComma(test_names)).c_str(), - GetTypeName<Type>().c_str(), - nullptr, // No value parameter. - code_location, GetTypeId<FixtureClass>(), - SuiteApiResolver<TestClass>::GetSetUpCaseOrSuite( - code_location.file.c_str(), code_location.line), - SuiteApiResolver<TestClass>::GetTearDownCaseOrSuite( - code_location.file.c_str(), code_location.line), - new TestFactoryImpl<TestClass>); - - // Next, recurses (at compile time) with the tail of the type list. - return TypeParameterizedTest<Fixture, TestSel, - typename Types::Tail>::Register(prefix, - code_location, - case_name, - test_names, - index + 1, - type_names); - } -}; - -// The base case for the compile time recursion. -template <GTEST_TEMPLATE_ Fixture, class TestSel> -class TypeParameterizedTest<Fixture, TestSel, Types0> { - public: - static bool Register(const char* /*prefix*/, const CodeLocation&, - const char* /*case_name*/, const char* /*test_names*/, - int /*index*/, - const std::vector<std::string>& = - std::vector<std::string>() /*type_names*/) { - return true; - } -}; - -// TypeParameterizedTestSuite<Fixture, Tests, Types>::Register() -// registers *all combinations* of 'Tests' and 'Types' with Google -// Test. The return value is insignificant - we just need to return -// something such that we can call this function in a namespace scope. -template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types> -class TypeParameterizedTestSuite { - public: - static bool Register(const char* prefix, CodeLocation code_location, - const TypedTestSuitePState* state, const char* case_name, - const char* test_names, - const std::vector<std::string>& type_names = - GenerateNames<DefaultNameGenerator, Types>()) { - std::string test_name = StripTrailingSpaces( - GetPrefixUntilComma(test_names)); - if (!state->TestExists(test_name)) { - fprintf(stderr, "Failed to get code location for test %s.%s at %s.", - case_name, test_name.c_str(), - FormatFileLocation(code_location.file.c_str(), - code_location.line).c_str()); - fflush(stderr); - posix::Abort(); - } - const CodeLocation& test_location = state->GetCodeLocation(test_name); - - typedef typename Tests::Head Head; - - // First, register the first test in 'Test' for each type in 'Types'. - TypeParameterizedTest<Fixture, Head, Types>::Register( - prefix, test_location, case_name, test_names, 0, type_names); - - // Next, recurses (at compile time) with the tail of the test list. - return TypeParameterizedTestSuite<Fixture, typename Tests::Tail, - Types>::Register(prefix, code_location, - state, case_name, - SkipComma(test_names), - type_names); - } -}; - -// The base case for the compile time recursion. -template <GTEST_TEMPLATE_ Fixture, typename Types> -class TypeParameterizedTestSuite<Fixture, Templates0, Types> { - public: - static bool Register(const char* /*prefix*/, const CodeLocation&, - const TypedTestSuitePState* /*state*/, - const char* /*case_name*/, const char* /*test_names*/, - const std::vector<std::string>& = - std::vector<std::string>() /*type_names*/) { - return true; - } -}; - -#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P - -// Returns the current OS stack trace as an std::string. -// -// The maximum number of stack frames to be included is specified by -// the gtest_stack_trace_depth flag. The skip_count parameter -// specifies the number of top frames to be skipped, which doesn't -// count against the number of frames to be included. -// -// For example, if Foo() calls Bar(), which in turn calls -// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in -// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. -GTEST_API_ std::string GetCurrentOsStackTraceExceptTop( - UnitTest* unit_test, int skip_count); - -// Helpers for suppressing warnings on unreachable code or constant -// condition. - -// Always returns true. -GTEST_API_ bool AlwaysTrue(); - -// Always returns false. -inline bool AlwaysFalse() { return !AlwaysTrue(); } - -// Helper for suppressing false warning from Clang on a const char* -// variable declared in a conditional expression always being NULL in -// the else branch. -struct GTEST_API_ ConstCharPtr { - ConstCharPtr(const char* str) : value(str) {} - operator bool() const { return true; } - const char* value; -}; - -// A simple Linear Congruential Generator for generating random -// numbers with a uniform distribution. Unlike rand() and srand(), it -// doesn't use global state (and therefore can't interfere with user -// code). Unlike rand_r(), it's portable. An LCG isn't very random, -// but it's good enough for our purposes. -class GTEST_API_ Random { - public: - static const UInt32 kMaxRange = 1u << 31; - - explicit Random(UInt32 seed) : state_(seed) {} - - void Reseed(UInt32 seed) { state_ = seed; } - - // Generates a random number from [0, range). Crashes if 'range' is - // 0 or greater than kMaxRange. - UInt32 Generate(UInt32 range); - - private: - UInt32 state_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(Random); -}; - -// Turns const U&, U&, const U, and U all into U. -#define GTEST_REMOVE_REFERENCE_AND_CONST_(T) \ - typename std::remove_const<typename std::remove_reference<T>::type>::type - -// IsAProtocolMessage<T>::value is a compile-time bool constant that's -// true if and only if T is type proto2::Message or a subclass of it. -template <typename T> -struct IsAProtocolMessage - : public bool_constant< - std::is_convertible<const T*, const ::proto2::Message*>::value> {}; - -// When the compiler sees expression IsContainerTest<C>(0), if C is an -// STL-style container class, the first overload of IsContainerTest -// will be viable (since both C::iterator* and C::const_iterator* are -// valid types and NULL can be implicitly converted to them). It will -// be picked over the second overload as 'int' is a perfect match for -// the type of argument 0. If C::iterator or C::const_iterator is not -// a valid type, the first overload is not viable, and the second -// overload will be picked. Therefore, we can determine whether C is -// a container class by checking the type of IsContainerTest<C>(0). -// The value of the expression is insignificant. -// -// In C++11 mode we check the existence of a const_iterator and that an -// iterator is properly implemented for the container. -// -// For pre-C++11 that we look for both C::iterator and C::const_iterator. -// The reason is that C++ injects the name of a class as a member of the -// class itself (e.g. you can refer to class iterator as either -// 'iterator' or 'iterator::iterator'). If we look for C::iterator -// only, for example, we would mistakenly think that a class named -// iterator is an STL container. -// -// Also note that the simpler approach of overloading -// IsContainerTest(typename C::const_iterator*) and -// IsContainerTest(...) doesn't work with Visual Age C++ and Sun C++. -typedef int IsContainer; -template <class C, - class Iterator = decltype(::std::declval<const C&>().begin()), - class = decltype(::std::declval<const C&>().end()), - class = decltype(++::std::declval<Iterator&>()), - class = decltype(*::std::declval<Iterator>()), - class = typename C::const_iterator> -IsContainer IsContainerTest(int /* dummy */) { - return 0; -} - -typedef char IsNotContainer; -template <class C> -IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; } - -// Trait to detect whether a type T is a hash table. -// The heuristic used is that the type contains an inner type `hasher` and does -// not contain an inner type `reverse_iterator`. -// If the container is iterable in reverse, then order might actually matter. -template <typename T> -struct IsHashTable { - private: - template <typename U> - static char test(typename U::hasher*, typename U::reverse_iterator*); - template <typename U> - static int test(typename U::hasher*, ...); - template <typename U> - static char test(...); - - public: - static const bool value = sizeof(test<T>(nullptr, nullptr)) == sizeof(int); -}; - -template <typename T> -const bool IsHashTable<T>::value; - -template <typename C, - bool = sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer)> -struct IsRecursiveContainerImpl; - -template <typename C> -struct IsRecursiveContainerImpl<C, false> : public std::false_type {}; - -// Since the IsRecursiveContainerImpl depends on the IsContainerTest we need to -// obey the same inconsistencies as the IsContainerTest, namely check if -// something is a container is relying on only const_iterator in C++11 and -// is relying on both const_iterator and iterator otherwise -template <typename C> -struct IsRecursiveContainerImpl<C, true> { - using value_type = decltype(*std::declval<typename C::const_iterator>()); - using type = - std::is_same<typename std::remove_const< - typename std::remove_reference<value_type>::type>::type, - C>; -}; - -// IsRecursiveContainer<Type> is a unary compile-time predicate that -// evaluates whether C is a recursive container type. A recursive container -// type is a container type whose value_type is equal to the container type -// itself. An example for a recursive container type is -// boost::filesystem::path, whose iterator has a value_type that is equal to -// boost::filesystem::path. -template <typename C> -struct IsRecursiveContainer : public IsRecursiveContainerImpl<C>::type {}; - -// Utilities for native arrays. - -// ArrayEq() compares two k-dimensional native arrays using the -// elements' operator==, where k can be any integer >= 0. When k is -// 0, ArrayEq() degenerates into comparing a single pair of values. - -template <typename T, typename U> -bool ArrayEq(const T* lhs, size_t size, const U* rhs); - -// This generic version is used when k is 0. -template <typename T, typename U> -inline bool ArrayEq(const T& lhs, const U& rhs) { return lhs == rhs; } - -// This overload is used when k >= 1. -template <typename T, typename U, size_t N> -inline bool ArrayEq(const T(&lhs)[N], const U(&rhs)[N]) { - return internal::ArrayEq(lhs, N, rhs); -} - -// This helper reduces code bloat. If we instead put its logic inside -// the previous ArrayEq() function, arrays with different sizes would -// lead to different copies of the template code. -template <typename T, typename U> -bool ArrayEq(const T* lhs, size_t size, const U* rhs) { - for (size_t i = 0; i != size; i++) { - if (!internal::ArrayEq(lhs[i], rhs[i])) - return false; - } - return true; -} - -// Finds the first element in the iterator range [begin, end) that -// equals elem. Element may be a native array type itself. -template <typename Iter, typename Element> -Iter ArrayAwareFind(Iter begin, Iter end, const Element& elem) { - for (Iter it = begin; it != end; ++it) { - if (internal::ArrayEq(*it, elem)) - return it; - } - return end; -} - -// CopyArray() copies a k-dimensional native array using the elements' -// operator=, where k can be any integer >= 0. When k is 0, -// CopyArray() degenerates into copying a single value. - -template <typename T, typename U> -void CopyArray(const T* from, size_t size, U* to); - -// This generic version is used when k is 0. -template <typename T, typename U> -inline void CopyArray(const T& from, U* to) { *to = from; } - -// This overload is used when k >= 1. -template <typename T, typename U, size_t N> -inline void CopyArray(const T(&from)[N], U(*to)[N]) { - internal::CopyArray(from, N, *to); -} - -// This helper reduces code bloat. If we instead put its logic inside -// the previous CopyArray() function, arrays with different sizes -// would lead to different copies of the template code. -template <typename T, typename U> -void CopyArray(const T* from, size_t size, U* to) { - for (size_t i = 0; i != size; i++) { - internal::CopyArray(from[i], to + i); - } -} - -// The relation between an NativeArray object (see below) and the -// native array it represents. -// We use 2 different structs to allow non-copyable types to be used, as long -// as RelationToSourceReference() is passed. -struct RelationToSourceReference {}; -struct RelationToSourceCopy {}; - -// Adapts a native array to a read-only STL-style container. Instead -// of the complete STL container concept, this adaptor only implements -// members useful for Google Mock's container matchers. New members -// should be added as needed. To simplify the implementation, we only -// support Element being a raw type (i.e. having no top-level const or -// reference modifier). It's the client's responsibility to satisfy -// this requirement. Element can be an array type itself (hence -// multi-dimensional arrays are supported). -template <typename Element> -class NativeArray { - public: - // STL-style container typedefs. - typedef Element value_type; - typedef Element* iterator; - typedef const Element* const_iterator; - - // Constructs from a native array. References the source. - NativeArray(const Element* array, size_t count, RelationToSourceReference) { - InitRef(array, count); - } - - // Constructs from a native array. Copies the source. - NativeArray(const Element* array, size_t count, RelationToSourceCopy) { - InitCopy(array, count); - } - - // Copy constructor. - NativeArray(const NativeArray& rhs) { - (this->*rhs.clone_)(rhs.array_, rhs.size_); - } - - ~NativeArray() { - if (clone_ != &NativeArray::InitRef) - delete[] array_; - } - - // STL-style container methods. - size_t size() const { return size_; } - const_iterator begin() const { return array_; } - const_iterator end() const { return array_ + size_; } - bool operator==(const NativeArray& rhs) const { - return size() == rhs.size() && - ArrayEq(begin(), size(), rhs.begin()); - } - - private: - static_assert(!std::is_const<Element>::value, "Type must not be const"); - static_assert(!std::is_reference<Element>::value, - "Type must not be a reference"); - - // Initializes this object with a copy of the input. - void InitCopy(const Element* array, size_t a_size) { - Element* const copy = new Element[a_size]; - CopyArray(array, a_size, copy); - array_ = copy; - size_ = a_size; - clone_ = &NativeArray::InitCopy; - } - - // Initializes this object with a reference of the input. - void InitRef(const Element* array, size_t a_size) { - array_ = array; - size_ = a_size; - clone_ = &NativeArray::InitRef; - } - - const Element* array_; - size_t size_; - void (NativeArray::*clone_)(const Element*, size_t); - - GTEST_DISALLOW_ASSIGN_(NativeArray); -}; - -// Backport of std::index_sequence. -template <size_t... Is> -struct IndexSequence { - using type = IndexSequence; -}; - -// Double the IndexSequence, and one if plus_one is true. -template <bool plus_one, typename T, size_t sizeofT> -struct DoubleSequence; -template <size_t... I, size_t sizeofT> -struct DoubleSequence<true, IndexSequence<I...>, sizeofT> { - using type = IndexSequence<I..., (sizeofT + I)..., 2 * sizeofT>; -}; -template <size_t... I, size_t sizeofT> -struct DoubleSequence<false, IndexSequence<I...>, sizeofT> { - using type = IndexSequence<I..., (sizeofT + I)...>; -}; - -// Backport of std::make_index_sequence. -// It uses O(ln(N)) instantiation depth. -template <size_t N> -struct MakeIndexSequence - : DoubleSequence<N % 2 == 1, typename MakeIndexSequence<N / 2>::type, - N / 2>::type {}; - -template <> -struct MakeIndexSequence<0> : IndexSequence<> {}; - -// FIXME: This implementation of ElemFromList is O(1) in instantiation depth, -// but it is O(N^2) in total instantiations. Not sure if this is the best -// tradeoff, as it will make it somewhat slow to compile. -template <typename T, size_t, size_t> -struct ElemFromListImpl {}; - -template <typename T, size_t I> -struct ElemFromListImpl<T, I, I> { - using type = T; -}; - -// Get the Nth element from T... -// It uses O(1) instantiation depth. -template <size_t N, typename I, typename... T> -struct ElemFromList; - -template <size_t N, size_t... I, typename... T> -struct ElemFromList<N, IndexSequence<I...>, T...> - : ElemFromListImpl<T, N, I>... {}; - -template <typename... T> -class FlatTuple; - -template <typename Derived, size_t I> -struct FlatTupleElemBase; - -template <typename... T, size_t I> -struct FlatTupleElemBase<FlatTuple<T...>, I> { - using value_type = - typename ElemFromList<I, typename MakeIndexSequence<sizeof...(T)>::type, - T...>::type; - FlatTupleElemBase() = default; - explicit FlatTupleElemBase(value_type t) : value(std::move(t)) {} - value_type value; -}; - -template <typename Derived, typename Idx> -struct FlatTupleBase; - -template <size_t... Idx, typename... T> -struct FlatTupleBase<FlatTuple<T...>, IndexSequence<Idx...>> - : FlatTupleElemBase<FlatTuple<T...>, Idx>... { - using Indices = IndexSequence<Idx...>; - FlatTupleBase() = default; - explicit FlatTupleBase(T... t) - : FlatTupleElemBase<FlatTuple<T...>, Idx>(std::move(t))... {} -}; - -// Analog to std::tuple but with different tradeoffs. -// This class minimizes the template instantiation depth, thus allowing more -// elements that std::tuple would. std::tuple has been seen to require an -// instantiation depth of more than 10x the number of elements in some -// implementations. -// FlatTuple and ElemFromList are not recursive and have a fixed depth -// regardless of T... -// MakeIndexSequence, on the other hand, it is recursive but with an -// instantiation depth of O(ln(N)). -template <typename... T> -class FlatTuple - : private FlatTupleBase<FlatTuple<T...>, - typename MakeIndexSequence<sizeof...(T)>::type> { - using Indices = typename FlatTuple::FlatTupleBase::Indices; - - public: - FlatTuple() = default; - explicit FlatTuple(T... t) : FlatTuple::FlatTupleBase(std::move(t)...) {} - - template <size_t I> - const typename ElemFromList<I, Indices, T...>::type& Get() const { - return static_cast<const FlatTupleElemBase<FlatTuple, I>*>(this)->value; - } - - template <size_t I> - typename ElemFromList<I, Indices, T...>::type& Get() { - return static_cast<FlatTupleElemBase<FlatTuple, I>*>(this)->value; - } -}; - -// Utility functions to be called with static_assert to induce deprecation -// warnings. -GTEST_INTERNAL_DEPRECATED( - "INSTANTIATE_TEST_CASE_P is deprecated, please use " - "INSTANTIATE_TEST_SUITE_P") -constexpr bool InstantiateTestCase_P_IsDeprecated() { return true; } - -GTEST_INTERNAL_DEPRECATED( - "TYPED_TEST_CASE_P is deprecated, please use " - "TYPED_TEST_SUITE_P") -constexpr bool TypedTestCase_P_IsDeprecated() { return true; } - -GTEST_INTERNAL_DEPRECATED( - "TYPED_TEST_CASE is deprecated, please use " - "TYPED_TEST_SUITE") -constexpr bool TypedTestCaseIsDeprecated() { return true; } - -GTEST_INTERNAL_DEPRECATED( - "REGISTER_TYPED_TEST_CASE_P is deprecated, please use " - "REGISTER_TYPED_TEST_SUITE_P") -constexpr bool RegisterTypedTestCase_P_IsDeprecated() { return true; } - -GTEST_INTERNAL_DEPRECATED( - "INSTANTIATE_TYPED_TEST_CASE_P is deprecated, please use " - "INSTANTIATE_TYPED_TEST_SUITE_P") -constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; } - -} // namespace internal -} // namespace testing - -#define GTEST_MESSAGE_AT_(file, line, message, result_type) \ - ::testing::internal::AssertHelper(result_type, file, line, message) \ - = ::testing::Message() - -#define GTEST_MESSAGE_(message, result_type) \ - GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type) - -#define GTEST_FATAL_FAILURE_(message) \ - return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure) - -#define GTEST_NONFATAL_FAILURE_(message) \ - GTEST_MESSAGE_(message, ::testing::TestPartResult::kNonFatalFailure) - -#define GTEST_SUCCESS_(message) \ - GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess) - -#define GTEST_SKIP_(message) \ - return GTEST_MESSAGE_(message, ::testing::TestPartResult::kSkip) - -// Suppress MSVC warning 4072 (unreachable code) for the code following -// statement if it returns or throws (or doesn't return or throw in some -// situations). -#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \ - if (::testing::internal::AlwaysTrue()) { statement; } - -#define GTEST_TEST_THROW_(statement, expected_exception, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::ConstCharPtr gtest_msg = "") { \ - bool gtest_caught_expected = false; \ - try { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } \ - catch (expected_exception const&) { \ - gtest_caught_expected = true; \ - } \ - catch (...) { \ - gtest_msg.value = \ - "Expected: " #statement " throws an exception of type " \ - #expected_exception ".\n Actual: it throws a different type."; \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ - } \ - if (!gtest_caught_expected) { \ - gtest_msg.value = \ - "Expected: " #statement " throws an exception of type " \ - #expected_exception ".\n Actual: it throws nothing."; \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \ - } \ - } else \ - GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \ - fail(gtest_msg.value) - -#define GTEST_TEST_NO_THROW_(statement, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ - try { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } \ - catch (...) { \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \ - } \ - } else \ - GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \ - fail("Expected: " #statement " doesn't throw an exception.\n" \ - " Actual: it throws.") - -#define GTEST_TEST_ANY_THROW_(statement, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ - bool gtest_caught_any = false; \ - try { \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - } \ - catch (...) { \ - gtest_caught_any = true; \ - } \ - if (!gtest_caught_any) { \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \ - } \ - } else \ - GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \ - fail("Expected: " #statement " throws an exception.\n" \ - " Actual: it doesn't.") - - -// Implements Boolean test assertions such as EXPECT_TRUE. expression can be -// either a boolean expression or an AssertionResult. text is a textual -// represenation of expression as it was passed into the EXPECT_TRUE. -#define GTEST_TEST_BOOLEAN_(expression, text, actual, expected, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (const ::testing::AssertionResult gtest_ar_ = \ - ::testing::AssertionResult(expression)) \ - ; \ - else \ - fail(::testing::internal::GetBoolAssertionFailureMessage(\ - gtest_ar_, text, #actual, #expected).c_str()) - -#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::AlwaysTrue()) { \ - ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \ - GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ - if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \ - goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \ - } \ - } else \ - GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \ - fail("Expected: " #statement " doesn't generate new fatal " \ - "failures in the current thread.\n" \ - " Actual: it does.") - -// Expands to the name of the class that implements the given test. -#define GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ - test_suite_name##_##test_name##_Test - -// Helper macro for defining tests. -#define GTEST_TEST_(test_suite_name, test_name, parent_class, parent_id) \ - static_assert(sizeof(GTEST_STRINGIFY_(test_suite_name)) > 1, \ - "test_suite_name must not be empty"); \ - static_assert(sizeof(GTEST_STRINGIFY_(test_name)) > 1, \ - "test_name must not be empty"); \ - class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \ - : public parent_class { \ - public: \ - GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \ - \ - private: \ - virtual void TestBody(); \ - static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_; \ - GTEST_DISALLOW_COPY_AND_ASSIGN_(GTEST_TEST_CLASS_NAME_(test_suite_name, \ - test_name)); \ - }; \ - \ - ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_suite_name, \ - test_name)::test_info_ = \ - ::testing::internal::MakeAndRegisterTestInfo( \ - #test_suite_name, #test_name, nullptr, nullptr, \ - ::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \ - ::testing::internal::SuiteApiResolver< \ - parent_class>::GetSetUpCaseOrSuite(__FILE__, __LINE__), \ - ::testing::internal::SuiteApiResolver< \ - parent_class>::GetTearDownCaseOrSuite(__FILE__, __LINE__), \ - new ::testing::internal::TestFactoryImpl<GTEST_TEST_CLASS_NAME_( \ - test_suite_name, test_name)>); \ - void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody() - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/gtest-param-util.h b/3rdParty/googletest/googletest/include/gtest/internal/gtest-param-util.h deleted file mode 100644 index 97533993c0c3ce9beb489f1bfa25317b88f879a1..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/gtest-param-util.h +++ /dev/null @@ -1,883 +0,0 @@ -// Copyright 2008 Google Inc. -// All Rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Type and function utilities for implementing parameterized tests. - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ - -#include <ctype.h> - -#include <cassert> -#include <iterator> -#include <memory> -#include <set> -#include <tuple> -#include <utility> -#include <vector> - -#include "gtest/internal/gtest-internal.h" -#include "gtest/internal/gtest-port.h" -#include "gtest/gtest-printers.h" - -namespace testing { -// Input to a parameterized test name generator, describing a test parameter. -// Consists of the parameter value and the integer parameter index. -template <class ParamType> -struct TestParamInfo { - TestParamInfo(const ParamType& a_param, size_t an_index) : - param(a_param), - index(an_index) {} - ParamType param; - size_t index; -}; - -// A builtin parameterized test name generator which returns the result of -// testing::PrintToString. -struct PrintToStringParamName { - template <class ParamType> - std::string operator()(const TestParamInfo<ParamType>& info) const { - return PrintToString(info.param); - } -}; - -namespace internal { - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// Utility Functions - -// Outputs a message explaining invalid registration of different -// fixture class for the same test suite. This may happen when -// TEST_P macro is used to define two tests with the same name -// but in different namespaces. -GTEST_API_ void ReportInvalidTestSuiteType(const char* test_suite_name, - CodeLocation code_location); - -template <typename> class ParamGeneratorInterface; -template <typename> class ParamGenerator; - -// Interface for iterating over elements provided by an implementation -// of ParamGeneratorInterface<T>. -template <typename T> -class ParamIteratorInterface { - public: - virtual ~ParamIteratorInterface() {} - // A pointer to the base generator instance. - // Used only for the purposes of iterator comparison - // to make sure that two iterators belong to the same generator. - virtual const ParamGeneratorInterface<T>* BaseGenerator() const = 0; - // Advances iterator to point to the next element - // provided by the generator. The caller is responsible - // for not calling Advance() on an iterator equal to - // BaseGenerator()->End(). - virtual void Advance() = 0; - // Clones the iterator object. Used for implementing copy semantics - // of ParamIterator<T>. - virtual ParamIteratorInterface* Clone() const = 0; - // Dereferences the current iterator and provides (read-only) access - // to the pointed value. It is the caller's responsibility not to call - // Current() on an iterator equal to BaseGenerator()->End(). - // Used for implementing ParamGenerator<T>::operator*(). - virtual const T* Current() const = 0; - // Determines whether the given iterator and other point to the same - // element in the sequence generated by the generator. - // Used for implementing ParamGenerator<T>::operator==(). - virtual bool Equals(const ParamIteratorInterface& other) const = 0; -}; - -// Class iterating over elements provided by an implementation of -// ParamGeneratorInterface<T>. It wraps ParamIteratorInterface<T> -// and implements the const forward iterator concept. -template <typename T> -class ParamIterator { - public: - typedef T value_type; - typedef const T& reference; - typedef ptrdiff_t difference_type; - - // ParamIterator assumes ownership of the impl_ pointer. - ParamIterator(const ParamIterator& other) : impl_(other.impl_->Clone()) {} - ParamIterator& operator=(const ParamIterator& other) { - if (this != &other) - impl_.reset(other.impl_->Clone()); - return *this; - } - - const T& operator*() const { return *impl_->Current(); } - const T* operator->() const { return impl_->Current(); } - // Prefix version of operator++. - ParamIterator& operator++() { - impl_->Advance(); - return *this; - } - // Postfix version of operator++. - ParamIterator operator++(int /*unused*/) { - ParamIteratorInterface<T>* clone = impl_->Clone(); - impl_->Advance(); - return ParamIterator(clone); - } - bool operator==(const ParamIterator& other) const { - return impl_.get() == other.impl_.get() || impl_->Equals(*other.impl_); - } - bool operator!=(const ParamIterator& other) const { - return !(*this == other); - } - - private: - friend class ParamGenerator<T>; - explicit ParamIterator(ParamIteratorInterface<T>* impl) : impl_(impl) {} - std::unique_ptr<ParamIteratorInterface<T> > impl_; -}; - -// ParamGeneratorInterface<T> is the binary interface to access generators -// defined in other translation units. -template <typename T> -class ParamGeneratorInterface { - public: - typedef T ParamType; - - virtual ~ParamGeneratorInterface() {} - - // Generator interface definition - virtual ParamIteratorInterface<T>* Begin() const = 0; - virtual ParamIteratorInterface<T>* End() const = 0; -}; - -// Wraps ParamGeneratorInterface<T> and provides general generator syntax -// compatible with the STL Container concept. -// This class implements copy initialization semantics and the contained -// ParamGeneratorInterface<T> instance is shared among all copies -// of the original object. This is possible because that instance is immutable. -template<typename T> -class ParamGenerator { - public: - typedef ParamIterator<T> iterator; - - explicit ParamGenerator(ParamGeneratorInterface<T>* impl) : impl_(impl) {} - ParamGenerator(const ParamGenerator& other) : impl_(other.impl_) {} - - ParamGenerator& operator=(const ParamGenerator& other) { - impl_ = other.impl_; - return *this; - } - - iterator begin() const { return iterator(impl_->Begin()); } - iterator end() const { return iterator(impl_->End()); } - - private: - std::shared_ptr<const ParamGeneratorInterface<T> > impl_; -}; - -// Generates values from a range of two comparable values. Can be used to -// generate sequences of user-defined types that implement operator+() and -// operator<(). -// This class is used in the Range() function. -template <typename T, typename IncrementT> -class RangeGenerator : public ParamGeneratorInterface<T> { - public: - RangeGenerator(T begin, T end, IncrementT step) - : begin_(begin), end_(end), - step_(step), end_index_(CalculateEndIndex(begin, end, step)) {} - ~RangeGenerator() override {} - - ParamIteratorInterface<T>* Begin() const override { - return new Iterator(this, begin_, 0, step_); - } - ParamIteratorInterface<T>* End() const override { - return new Iterator(this, end_, end_index_, step_); - } - - private: - class Iterator : public ParamIteratorInterface<T> { - public: - Iterator(const ParamGeneratorInterface<T>* base, T value, int index, - IncrementT step) - : base_(base), value_(value), index_(index), step_(step) {} - ~Iterator() override {} - - const ParamGeneratorInterface<T>* BaseGenerator() const override { - return base_; - } - void Advance() override { - value_ = static_cast<T>(value_ + step_); - index_++; - } - ParamIteratorInterface<T>* Clone() const override { - return new Iterator(*this); - } - const T* Current() const override { return &value_; } - bool Equals(const ParamIteratorInterface<T>& other) const override { - // Having the same base generator guarantees that the other - // iterator is of the same type and we can downcast. - GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) - << "The program attempted to compare iterators " - << "from different generators." << std::endl; - const int other_index = - CheckedDowncastToActualType<const Iterator>(&other)->index_; - return index_ == other_index; - } - - private: - Iterator(const Iterator& other) - : ParamIteratorInterface<T>(), - base_(other.base_), value_(other.value_), index_(other.index_), - step_(other.step_) {} - - // No implementation - assignment is unsupported. - void operator=(const Iterator& other); - - const ParamGeneratorInterface<T>* const base_; - T value_; - int index_; - const IncrementT step_; - }; // class RangeGenerator::Iterator - - static int CalculateEndIndex(const T& begin, - const T& end, - const IncrementT& step) { - int end_index = 0; - for (T i = begin; i < end; i = static_cast<T>(i + step)) - end_index++; - return end_index; - } - - // No implementation - assignment is unsupported. - void operator=(const RangeGenerator& other); - - const T begin_; - const T end_; - const IncrementT step_; - // The index for the end() iterator. All the elements in the generated - // sequence are indexed (0-based) to aid iterator comparison. - const int end_index_; -}; // class RangeGenerator - - -// Generates values from a pair of STL-style iterators. Used in the -// ValuesIn() function. The elements are copied from the source range -// since the source can be located on the stack, and the generator -// is likely to persist beyond that stack frame. -template <typename T> -class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> { - public: - template <typename ForwardIterator> - ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end) - : container_(begin, end) {} - ~ValuesInIteratorRangeGenerator() override {} - - ParamIteratorInterface<T>* Begin() const override { - return new Iterator(this, container_.begin()); - } - ParamIteratorInterface<T>* End() const override { - return new Iterator(this, container_.end()); - } - - private: - typedef typename ::std::vector<T> ContainerType; - - class Iterator : public ParamIteratorInterface<T> { - public: - Iterator(const ParamGeneratorInterface<T>* base, - typename ContainerType::const_iterator iterator) - : base_(base), iterator_(iterator) {} - ~Iterator() override {} - - const ParamGeneratorInterface<T>* BaseGenerator() const override { - return base_; - } - void Advance() override { - ++iterator_; - value_.reset(); - } - ParamIteratorInterface<T>* Clone() const override { - return new Iterator(*this); - } - // We need to use cached value referenced by iterator_ because *iterator_ - // can return a temporary object (and of type other then T), so just - // having "return &*iterator_;" doesn't work. - // value_ is updated here and not in Advance() because Advance() - // can advance iterator_ beyond the end of the range, and we cannot - // detect that fact. The client code, on the other hand, is - // responsible for not calling Current() on an out-of-range iterator. - const T* Current() const override { - if (value_.get() == nullptr) value_.reset(new T(*iterator_)); - return value_.get(); - } - bool Equals(const ParamIteratorInterface<T>& other) const override { - // Having the same base generator guarantees that the other - // iterator is of the same type and we can downcast. - GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) - << "The program attempted to compare iterators " - << "from different generators." << std::endl; - return iterator_ == - CheckedDowncastToActualType<const Iterator>(&other)->iterator_; - } - - private: - Iterator(const Iterator& other) - // The explicit constructor call suppresses a false warning - // emitted by gcc when supplied with the -Wextra option. - : ParamIteratorInterface<T>(), - base_(other.base_), - iterator_(other.iterator_) {} - - const ParamGeneratorInterface<T>* const base_; - typename ContainerType::const_iterator iterator_; - // A cached value of *iterator_. We keep it here to allow access by - // pointer in the wrapping iterator's operator->(). - // value_ needs to be mutable to be accessed in Current(). - // Use of std::unique_ptr helps manage cached value's lifetime, - // which is bound by the lifespan of the iterator itself. - mutable std::unique_ptr<const T> value_; - }; // class ValuesInIteratorRangeGenerator::Iterator - - // No implementation - assignment is unsupported. - void operator=(const ValuesInIteratorRangeGenerator& other); - - const ContainerType container_; -}; // class ValuesInIteratorRangeGenerator - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// -// Default parameterized test name generator, returns a string containing the -// integer test parameter index. -template <class ParamType> -std::string DefaultParamName(const TestParamInfo<ParamType>& info) { - Message name_stream; - name_stream << info.index; - return name_stream.GetString(); -} - -template <typename T = int> -void TestNotEmpty() { - static_assert(sizeof(T) == 0, "Empty arguments are not allowed."); -} -template <typename T = int> -void TestNotEmpty(const T&) {} - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// -// Stores a parameter value and later creates tests parameterized with that -// value. -template <class TestClass> -class ParameterizedTestFactory : public TestFactoryBase { - public: - typedef typename TestClass::ParamType ParamType; - explicit ParameterizedTestFactory(ParamType parameter) : - parameter_(parameter) {} - Test* CreateTest() override { - TestClass::SetParam(¶meter_); - return new TestClass(); - } - - private: - const ParamType parameter_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestFactory); -}; - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// -// TestMetaFactoryBase is a base class for meta-factories that create -// test factories for passing into MakeAndRegisterTestInfo function. -template <class ParamType> -class TestMetaFactoryBase { - public: - virtual ~TestMetaFactoryBase() {} - - virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0; -}; - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// -// TestMetaFactory creates test factories for passing into -// MakeAndRegisterTestInfo function. Since MakeAndRegisterTestInfo receives -// ownership of test factory pointer, same factory object cannot be passed -// into that method twice. But ParameterizedTestSuiteInfo is going to call -// it for each Test/Parameter value combination. Thus it needs meta factory -// creator class. -template <class TestSuite> -class TestMetaFactory - : public TestMetaFactoryBase<typename TestSuite::ParamType> { - public: - using ParamType = typename TestSuite::ParamType; - - TestMetaFactory() {} - - TestFactoryBase* CreateTestFactory(ParamType parameter) override { - return new ParameterizedTestFactory<TestSuite>(parameter); - } - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestMetaFactory); -}; - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// -// ParameterizedTestSuiteInfoBase is a generic interface -// to ParameterizedTestSuiteInfo classes. ParameterizedTestSuiteInfoBase -// accumulates test information provided by TEST_P macro invocations -// and generators provided by INSTANTIATE_TEST_SUITE_P macro invocations -// and uses that information to register all resulting test instances -// in RegisterTests method. The ParameterizeTestSuiteRegistry class holds -// a collection of pointers to the ParameterizedTestSuiteInfo objects -// and calls RegisterTests() on each of them when asked. -class ParameterizedTestSuiteInfoBase { - public: - virtual ~ParameterizedTestSuiteInfoBase() {} - - // Base part of test suite name for display purposes. - virtual const std::string& GetTestSuiteName() const = 0; - // Test case id to verify identity. - virtual TypeId GetTestSuiteTypeId() const = 0; - // UnitTest class invokes this method to register tests in this - // test suite right before running them in RUN_ALL_TESTS macro. - // This method should not be called more than once on any single - // instance of a ParameterizedTestSuiteInfoBase derived class. - virtual void RegisterTests() = 0; - - protected: - ParameterizedTestSuiteInfoBase() {} - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfoBase); -}; - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// -// ParameterizedTestSuiteInfo accumulates tests obtained from TEST_P -// macro invocations for a particular test suite and generators -// obtained from INSTANTIATE_TEST_SUITE_P macro invocations for that -// test suite. It registers tests with all values generated by all -// generators when asked. -template <class TestSuite> -class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase { - public: - // ParamType and GeneratorCreationFunc are private types but are required - // for declarations of public methods AddTestPattern() and - // AddTestSuiteInstantiation(). - using ParamType = typename TestSuite::ParamType; - // A function that returns an instance of appropriate generator type. - typedef ParamGenerator<ParamType>(GeneratorCreationFunc)(); - using ParamNameGeneratorFunc = std::string(const TestParamInfo<ParamType>&); - - explicit ParameterizedTestSuiteInfo(const char* name, - CodeLocation code_location) - : test_suite_name_(name), code_location_(code_location) {} - - // Test case base name for display purposes. - const std::string& GetTestSuiteName() const override { - return test_suite_name_; - } - // Test case id to verify identity. - TypeId GetTestSuiteTypeId() const override { return GetTypeId<TestSuite>(); } - // TEST_P macro uses AddTestPattern() to record information - // about a single test in a LocalTestInfo structure. - // test_suite_name is the base name of the test suite (without invocation - // prefix). test_base_name is the name of an individual test without - // parameter index. For the test SequenceA/FooTest.DoBar/1 FooTest is - // test suite base name and DoBar is test base name. - void AddTestPattern(const char* test_suite_name, const char* test_base_name, - TestMetaFactoryBase<ParamType>* meta_factory) { - tests_.push_back(std::shared_ptr<TestInfo>( - new TestInfo(test_suite_name, test_base_name, meta_factory))); - } - // INSTANTIATE_TEST_SUITE_P macro uses AddGenerator() to record information - // about a generator. - int AddTestSuiteInstantiation(const std::string& instantiation_name, - GeneratorCreationFunc* func, - ParamNameGeneratorFunc* name_func, - const char* file, int line) { - instantiations_.push_back( - InstantiationInfo(instantiation_name, func, name_func, file, line)); - return 0; // Return value used only to run this method in namespace scope. - } - // UnitTest class invokes this method to register tests in this test suite - // test suites right before running tests in RUN_ALL_TESTS macro. - // This method should not be called more than once on any single - // instance of a ParameterizedTestSuiteInfoBase derived class. - // UnitTest has a guard to prevent from calling this method more than once. - void RegisterTests() override { - for (typename TestInfoContainer::iterator test_it = tests_.begin(); - test_it != tests_.end(); ++test_it) { - std::shared_ptr<TestInfo> test_info = *test_it; - for (typename InstantiationContainer::iterator gen_it = - instantiations_.begin(); gen_it != instantiations_.end(); - ++gen_it) { - const std::string& instantiation_name = gen_it->name; - ParamGenerator<ParamType> generator((*gen_it->generator)()); - ParamNameGeneratorFunc* name_func = gen_it->name_func; - const char* file = gen_it->file; - int line = gen_it->line; - - std::string test_suite_name; - if ( !instantiation_name.empty() ) - test_suite_name = instantiation_name + "/"; - test_suite_name += test_info->test_suite_base_name; - - size_t i = 0; - std::set<std::string> test_param_names; - for (typename ParamGenerator<ParamType>::iterator param_it = - generator.begin(); - param_it != generator.end(); ++param_it, ++i) { - Message test_name_stream; - - std::string param_name = name_func( - TestParamInfo<ParamType>(*param_it, i)); - - GTEST_CHECK_(IsValidParamName(param_name)) - << "Parameterized test name '" << param_name - << "' is invalid, in " << file - << " line " << line << std::endl; - - GTEST_CHECK_(test_param_names.count(param_name) == 0) - << "Duplicate parameterized test name '" << param_name - << "', in " << file << " line " << line << std::endl; - - test_param_names.insert(param_name); - - if (!test_info->test_base_name.empty()) { - test_name_stream << test_info->test_base_name << "/"; - } - test_name_stream << param_name; - MakeAndRegisterTestInfo( - test_suite_name.c_str(), test_name_stream.GetString().c_str(), - nullptr, // No type parameter. - PrintToString(*param_it).c_str(), code_location_, - GetTestSuiteTypeId(), - SuiteApiResolver<TestSuite>::GetSetUpCaseOrSuite(file, line), - SuiteApiResolver<TestSuite>::GetTearDownCaseOrSuite(file, line), - test_info->test_meta_factory->CreateTestFactory(*param_it)); - } // for param_it - } // for gen_it - } // for test_it - } // RegisterTests - - private: - // LocalTestInfo structure keeps information about a single test registered - // with TEST_P macro. - struct TestInfo { - TestInfo(const char* a_test_suite_base_name, const char* a_test_base_name, - TestMetaFactoryBase<ParamType>* a_test_meta_factory) - : test_suite_base_name(a_test_suite_base_name), - test_base_name(a_test_base_name), - test_meta_factory(a_test_meta_factory) {} - - const std::string test_suite_base_name; - const std::string test_base_name; - const std::unique_ptr<TestMetaFactoryBase<ParamType> > test_meta_factory; - }; - using TestInfoContainer = ::std::vector<std::shared_ptr<TestInfo> >; - // Records data received from INSTANTIATE_TEST_SUITE_P macros: - // <Instantiation name, Sequence generator creation function, - // Name generator function, Source file, Source line> - struct InstantiationInfo { - InstantiationInfo(const std::string &name_in, - GeneratorCreationFunc* generator_in, - ParamNameGeneratorFunc* name_func_in, - const char* file_in, - int line_in) - : name(name_in), - generator(generator_in), - name_func(name_func_in), - file(file_in), - line(line_in) {} - - std::string name; - GeneratorCreationFunc* generator; - ParamNameGeneratorFunc* name_func; - const char* file; - int line; - }; - typedef ::std::vector<InstantiationInfo> InstantiationContainer; - - static bool IsValidParamName(const std::string& name) { - // Check for empty string - if (name.empty()) - return false; - - // Check for invalid characters - for (std::string::size_type index = 0; index < name.size(); ++index) { - if (!isalnum(name[index]) && name[index] != '_') - return false; - } - - return true; - } - - const std::string test_suite_name_; - CodeLocation code_location_; - TestInfoContainer tests_; - InstantiationContainer instantiations_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteInfo); -}; // class ParameterizedTestSuiteInfo - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -template <class TestCase> -using ParameterizedTestCaseInfo = ParameterizedTestSuiteInfo<TestCase>; -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// -// ParameterizedTestSuiteRegistry contains a map of -// ParameterizedTestSuiteInfoBase classes accessed by test suite names. TEST_P -// and INSTANTIATE_TEST_SUITE_P macros use it to locate their corresponding -// ParameterizedTestSuiteInfo descriptors. -class ParameterizedTestSuiteRegistry { - public: - ParameterizedTestSuiteRegistry() {} - ~ParameterizedTestSuiteRegistry() { - for (auto& test_suite_info : test_suite_infos_) { - delete test_suite_info; - } - } - - // Looks up or creates and returns a structure containing information about - // tests and instantiations of a particular test suite. - template <class TestSuite> - ParameterizedTestSuiteInfo<TestSuite>* GetTestSuitePatternHolder( - const char* test_suite_name, CodeLocation code_location) { - ParameterizedTestSuiteInfo<TestSuite>* typed_test_info = nullptr; - for (auto& test_suite_info : test_suite_infos_) { - if (test_suite_info->GetTestSuiteName() == test_suite_name) { - if (test_suite_info->GetTestSuiteTypeId() != GetTypeId<TestSuite>()) { - // Complain about incorrect usage of Google Test facilities - // and terminate the program since we cannot guaranty correct - // test suite setup and tear-down in this case. - ReportInvalidTestSuiteType(test_suite_name, code_location); - posix::Abort(); - } else { - // At this point we are sure that the object we found is of the same - // type we are looking for, so we downcast it to that type - // without further checks. - typed_test_info = CheckedDowncastToActualType< - ParameterizedTestSuiteInfo<TestSuite> >(test_suite_info); - } - break; - } - } - if (typed_test_info == nullptr) { - typed_test_info = new ParameterizedTestSuiteInfo<TestSuite>( - test_suite_name, code_location); - test_suite_infos_.push_back(typed_test_info); - } - return typed_test_info; - } - void RegisterTests() { - for (auto& test_suite_info : test_suite_infos_) { - test_suite_info->RegisterTests(); - } - } -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - template <class TestCase> - ParameterizedTestCaseInfo<TestCase>* GetTestCasePatternHolder( - const char* test_case_name, CodeLocation code_location) { - return GetTestSuitePatternHolder<TestCase>(test_case_name, code_location); - } - -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - private: - using TestSuiteInfoContainer = ::std::vector<ParameterizedTestSuiteInfoBase*>; - - TestSuiteInfoContainer test_suite_infos_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ParameterizedTestSuiteRegistry); -}; - -} // namespace internal - -// Forward declarations of ValuesIn(), which is implemented in -// include/gtest/gtest-param-test.h. -template <class Container> -internal::ParamGenerator<typename Container::value_type> ValuesIn( - const Container& container); - -namespace internal { -// Used in the Values() function to provide polymorphic capabilities. - -template <typename... Ts> -class ValueArray { - public: - ValueArray(Ts... v) : v_{std::move(v)...} {} - - template <typename T> - operator ParamGenerator<T>() const { // NOLINT - return ValuesIn(MakeVector<T>(MakeIndexSequence<sizeof...(Ts)>())); - } - - private: - template <typename T, size_t... I> - std::vector<T> MakeVector(IndexSequence<I...>) const { - return std::vector<T>{static_cast<T>(v_.template Get<I>())...}; - } - - FlatTuple<Ts...> v_; -}; - -template <typename... T> -class CartesianProductGenerator - : public ParamGeneratorInterface<::std::tuple<T...>> { - public: - typedef ::std::tuple<T...> ParamType; - - CartesianProductGenerator(const std::tuple<ParamGenerator<T>...>& g) - : generators_(g) {} - ~CartesianProductGenerator() override {} - - ParamIteratorInterface<ParamType>* Begin() const override { - return new Iterator(this, generators_, false); - } - ParamIteratorInterface<ParamType>* End() const override { - return new Iterator(this, generators_, true); - } - - private: - template <class I> - class IteratorImpl; - template <size_t... I> - class IteratorImpl<IndexSequence<I...>> - : public ParamIteratorInterface<ParamType> { - public: - IteratorImpl(const ParamGeneratorInterface<ParamType>* base, - const std::tuple<ParamGenerator<T>...>& generators, bool is_end) - : base_(base), - begin_(std::get<I>(generators).begin()...), - end_(std::get<I>(generators).end()...), - current_(is_end ? end_ : begin_) { - ComputeCurrentValue(); - } - ~IteratorImpl() override {} - - const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { - return base_; - } - // Advance should not be called on beyond-of-range iterators - // so no component iterators must be beyond end of range, either. - void Advance() override { - assert(!AtEnd()); - // Advance the last iterator. - ++std::get<sizeof...(T) - 1>(current_); - // if that reaches end, propagate that up. - AdvanceIfEnd<sizeof...(T) - 1>(); - ComputeCurrentValue(); - } - ParamIteratorInterface<ParamType>* Clone() const override { - return new IteratorImpl(*this); - } - - const ParamType* Current() const override { return current_value_.get(); } - - bool Equals(const ParamIteratorInterface<ParamType>& other) const override { - // Having the same base generator guarantees that the other - // iterator is of the same type and we can downcast. - GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) - << "The program attempted to compare iterators " - << "from different generators." << std::endl; - const IteratorImpl* typed_other = - CheckedDowncastToActualType<const IteratorImpl>(&other); - - // We must report iterators equal if they both point beyond their - // respective ranges. That can happen in a variety of fashions, - // so we have to consult AtEnd(). - if (AtEnd() && typed_other->AtEnd()) return true; - - bool same = true; - bool dummy[] = { - (same = same && std::get<I>(current_) == - std::get<I>(typed_other->current_))...}; - (void)dummy; - return same; - } - - private: - template <size_t ThisI> - void AdvanceIfEnd() { - if (std::get<ThisI>(current_) != std::get<ThisI>(end_)) return; - - bool last = ThisI == 0; - if (last) { - // We are done. Nothing else to propagate. - return; - } - - constexpr size_t NextI = ThisI - (ThisI != 0); - std::get<ThisI>(current_) = std::get<ThisI>(begin_); - ++std::get<NextI>(current_); - AdvanceIfEnd<NextI>(); - } - - void ComputeCurrentValue() { - if (!AtEnd()) - current_value_ = std::make_shared<ParamType>(*std::get<I>(current_)...); - } - bool AtEnd() const { - bool at_end = false; - bool dummy[] = { - (at_end = at_end || std::get<I>(current_) == std::get<I>(end_))...}; - (void)dummy; - return at_end; - } - - const ParamGeneratorInterface<ParamType>* const base_; - std::tuple<typename ParamGenerator<T>::iterator...> begin_; - std::tuple<typename ParamGenerator<T>::iterator...> end_; - std::tuple<typename ParamGenerator<T>::iterator...> current_; - std::shared_ptr<ParamType> current_value_; - }; - - using Iterator = IteratorImpl<typename MakeIndexSequence<sizeof...(T)>::type>; - - std::tuple<ParamGenerator<T>...> generators_; -}; - -template <class... Gen> -class CartesianProductHolder { - public: - CartesianProductHolder(const Gen&... g) : generators_(g...) {} - template <typename... T> - operator ParamGenerator<::std::tuple<T...>>() const { - return ParamGenerator<::std::tuple<T...>>( - new CartesianProductGenerator<T...>(generators_)); - } - - private: - std::tuple<Gen...> generators_; -}; - -} // namespace internal -} // namespace testing - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/gtest-port-arch.h b/3rdParty/googletest/googletest/include/gtest/internal/gtest-port-arch.h deleted file mode 100644 index cece93dba12d4983c7ef0b3413b7964c4477abca..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/gtest-port-arch.h +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// The Google C++ Testing and Mocking Framework (Google Test) -// -// This header file defines the GTEST_OS_* macro. -// It is separate from gtest-port.h so that custom/gtest-port.h can include it. - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ - -// Determines the platform on which Google Test is compiled. -#ifdef __CYGWIN__ -# define GTEST_OS_CYGWIN 1 -# elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__) -# define GTEST_OS_WINDOWS_MINGW 1 -# define GTEST_OS_WINDOWS 1 -#elif defined _WIN32 -# define GTEST_OS_WINDOWS 1 -# ifdef _WIN32_WCE -# define GTEST_OS_WINDOWS_MOBILE 1 -# elif defined(WINAPI_FAMILY) -# include <winapifamily.h> -# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -# define GTEST_OS_WINDOWS_DESKTOP 1 -# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) -# define GTEST_OS_WINDOWS_PHONE 1 -# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) -# define GTEST_OS_WINDOWS_RT 1 -# elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE) -# define GTEST_OS_WINDOWS_PHONE 1 -# define GTEST_OS_WINDOWS_TV_TITLE 1 -# else - // WINAPI_FAMILY defined but no known partition matched. - // Default to desktop. -# define GTEST_OS_WINDOWS_DESKTOP 1 -# endif -# else -# define GTEST_OS_WINDOWS_DESKTOP 1 -# endif // _WIN32_WCE -#elif defined __OS2__ -# define GTEST_OS_OS2 1 -#elif defined __APPLE__ -# define GTEST_OS_MAC 1 -# if TARGET_OS_IPHONE -# define GTEST_OS_IOS 1 -# endif -#elif defined __DragonFly__ -# define GTEST_OS_DRAGONFLY 1 -#elif defined __FreeBSD__ -# define GTEST_OS_FREEBSD 1 -#elif defined __Fuchsia__ -# define GTEST_OS_FUCHSIA 1 -#elif defined(__GLIBC__) && defined(__FreeBSD_kernel__) -# define GTEST_OS_GNU_KFREEBSD 1 -#elif defined __linux__ -# define GTEST_OS_LINUX 1 -# if defined __ANDROID__ -# define GTEST_OS_LINUX_ANDROID 1 -# endif -#elif defined __MVS__ -# define GTEST_OS_ZOS 1 -#elif defined(__sun) && defined(__SVR4) -# define GTEST_OS_SOLARIS 1 -#elif defined(_AIX) -# define GTEST_OS_AIX 1 -#elif defined(__hpux) -# define GTEST_OS_HPUX 1 -#elif defined __native_client__ -# define GTEST_OS_NACL 1 -#elif defined __NetBSD__ -# define GTEST_OS_NETBSD 1 -#elif defined __OpenBSD__ -# define GTEST_OS_OPENBSD 1 -#elif defined __QNX__ -# define GTEST_OS_QNX 1 -#elif defined(__HAIKU__) -#define GTEST_OS_HAIKU 1 -#endif // __CYGWIN__ - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/gtest-port.h b/3rdParty/googletest/googletest/include/gtest/internal/gtest-port.h deleted file mode 100644 index 063fcb1083babb5226ff1098339b2bac06f08250..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/gtest-port.h +++ /dev/null @@ -1,2231 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Low-level types and utilities for porting Google Test to various -// platforms. All macros ending with _ and symbols defined in an -// internal namespace are subject to change without notice. Code -// outside Google Test MUST NOT USE THEM DIRECTLY. Macros that don't -// end with _ are part of Google Test's public API and can be used by -// code outside Google Test. -// -// This file is fundamental to Google Test. All other Google Test source -// files are expected to #include this. Therefore, it cannot #include -// any other Google Test header. - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ - -// Environment-describing macros -// ----------------------------- -// -// Google Test can be used in many different environments. Macros in -// this section tell Google Test what kind of environment it is being -// used in, such that Google Test can provide environment-specific -// features and implementations. -// -// Google Test tries to automatically detect the properties of its -// environment, so users usually don't need to worry about these -// macros. However, the automatic detection is not perfect. -// Sometimes it's necessary for a user to define some of the following -// macros in the build script to override Google Test's decisions. -// -// If the user doesn't define a macro in the list, Google Test will -// provide a default definition. After this header is #included, all -// macros in this list will be defined to either 1 or 0. -// -// Notes to maintainers: -// - Each macro here is a user-tweakable knob; do not grow the list -// lightly. -// - Use #if to key off these macros. Don't use #ifdef or "#if -// defined(...)", which will not work as these macros are ALWAYS -// defined. -// -// GTEST_HAS_CLONE - Define it to 1/0 to indicate that clone(2) -// is/isn't available. -// GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions -// are enabled. -// GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular -// expressions are/aren't available. -// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h> -// is/isn't available. -// GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/isn't -// enabled. -// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that -// std::wstring does/doesn't work (Google Test can -// be used where std::wstring is unavailable). -// GTEST_HAS_SEH - Define it to 1/0 to indicate whether the -// compiler supports Microsoft's "Structured -// Exception Handling". -// GTEST_HAS_STREAM_REDIRECTION -// - Define it to 1/0 to indicate whether the -// platform supports I/O stream redirection using -// dup() and dup2(). -// GTEST_LINKED_AS_SHARED_LIBRARY -// - Define to 1 when compiling tests that use -// Google Test as a shared library (known as -// DLL on Windows). -// GTEST_CREATE_SHARED_LIBRARY -// - Define to 1 when compiling Google Test itself -// as a shared library. -// GTEST_DEFAULT_DEATH_TEST_STYLE -// - The default value of --gtest_death_test_style. -// The legacy default has been "fast" in the open -// source version since 2008. The recommended value -// is "threadsafe", and can be set in -// custom/gtest-port.h. - -// Platform-indicating macros -// -------------------------- -// -// Macros indicating the platform on which Google Test is being used -// (a macro is defined to 1 if compiled on the given platform; -// otherwise UNDEFINED -- it's never defined to 0.). Google Test -// defines these macros automatically. Code outside Google Test MUST -// NOT define them. -// -// GTEST_OS_AIX - IBM AIX -// GTEST_OS_CYGWIN - Cygwin -// GTEST_OS_DRAGONFLY - DragonFlyBSD -// GTEST_OS_FREEBSD - FreeBSD -// GTEST_OS_FUCHSIA - Fuchsia -// GTEST_OS_GNU_KFREEBSD - GNU/kFreeBSD -// GTEST_OS_HAIKU - Haiku -// GTEST_OS_HPUX - HP-UX -// GTEST_OS_LINUX - Linux -// GTEST_OS_LINUX_ANDROID - Google Android -// GTEST_OS_MAC - Mac OS X -// GTEST_OS_IOS - iOS -// GTEST_OS_NACL - Google Native Client (NaCl) -// GTEST_OS_NETBSD - NetBSD -// GTEST_OS_OPENBSD - OpenBSD -// GTEST_OS_OS2 - OS/2 -// GTEST_OS_QNX - QNX -// GTEST_OS_SOLARIS - Sun Solaris -// GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile) -// GTEST_OS_WINDOWS_DESKTOP - Windows Desktop -// GTEST_OS_WINDOWS_MINGW - MinGW -// GTEST_OS_WINDOWS_MOBILE - Windows Mobile -// GTEST_OS_WINDOWS_PHONE - Windows Phone -// GTEST_OS_WINDOWS_RT - Windows Store App/WinRT -// GTEST_OS_ZOS - z/OS -// -// Among the platforms, Cygwin, Linux, Mac OS X, and Windows have the -// most stable support. Since core members of the Google Test project -// don't have access to other platforms, support for them may be less -// stable. If you notice any problems on your platform, please notify -// googletestframework@googlegroups.com (patches for fixing them are -// even more welcome!). -// -// It is possible that none of the GTEST_OS_* macros are defined. - -// Feature-indicating macros -// ------------------------- -// -// Macros indicating which Google Test features are available (a macro -// is defined to 1 if the corresponding feature is supported; -// otherwise UNDEFINED -- it's never defined to 0.). Google Test -// defines these macros automatically. Code outside Google Test MUST -// NOT define them. -// -// These macros are public so that portable tests can be written. -// Such tests typically surround code using a feature with an #if -// which controls that code. For example: -// -// #if GTEST_HAS_DEATH_TEST -// EXPECT_DEATH(DoSomethingDeadly()); -// #endif -// -// GTEST_HAS_DEATH_TEST - death tests -// GTEST_HAS_TYPED_TEST - typed tests -// GTEST_HAS_TYPED_TEST_P - type-parameterized tests -// GTEST_IS_THREADSAFE - Google Test is thread-safe. -// GOOGLETEST_CM0007 DO NOT DELETE -// GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with -// GTEST_HAS_POSIX_RE (see above) which users can -// define themselves. -// GTEST_USES_SIMPLE_RE - our own simple regex is used; -// the above RE\b(s) are mutually exclusive. - -// Misc public macros -// ------------------ -// -// GTEST_FLAG(flag_name) - references the variable corresponding to -// the given Google Test flag. - -// Internal utilities -// ------------------ -// -// The following macros and utilities are for Google Test's INTERNAL -// use only. Code outside Google Test MUST NOT USE THEM DIRECTLY. -// -// Macros for basic C++ coding: -// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning. -// GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a -// variable don't have to be used. -// GTEST_DISALLOW_ASSIGN_ - disables operator=. -// GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=. -// GTEST_MUST_USE_RESULT_ - declares that a function's result must be used. -// GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is -// suppressed (constant conditional). -// GTEST_INTENTIONAL_CONST_COND_POP_ - finish code section where MSVC C4127 -// is suppressed. -// -// Synchronization: -// Mutex, MutexLock, ThreadLocal, GetThreadCount() -// - synchronization primitives. -// -// Regular expressions: -// RE - a simple regular expression class using the POSIX -// Extended Regular Expression syntax on UNIX-like platforms -// GOOGLETEST_CM0008 DO NOT DELETE -// or a reduced regular exception syntax on other -// platforms, including Windows. -// Logging: -// GTEST_LOG_() - logs messages at the specified severity level. -// LogToStderr() - directs all log messages to stderr. -// FlushInfoLog() - flushes informational log messages. -// -// Stdout and stderr capturing: -// CaptureStdout() - starts capturing stdout. -// GetCapturedStdout() - stops capturing stdout and returns the captured -// string. -// CaptureStderr() - starts capturing stderr. -// GetCapturedStderr() - stops capturing stderr and returns the captured -// string. -// -// Integer types: -// TypeWithSize - maps an integer to a int type. -// Int32, UInt32, Int64, UInt64, TimeInMillis -// - integers of known sizes. -// BiggestInt - the biggest signed integer type. -// -// Command-line utilities: -// GTEST_DECLARE_*() - declares a flag. -// GTEST_DEFINE_*() - defines a flag. -// GetInjectableArgvs() - returns the command line as a vector of strings. -// -// Environment variable utilities: -// GetEnv() - gets the value of an environment variable. -// BoolFromGTestEnv() - parses a bool environment variable. -// Int32FromGTestEnv() - parses an Int32 environment variable. -// StringFromGTestEnv() - parses a string environment variable. -// -// Deprecation warnings: -// GTEST_INTERNAL_DEPRECATED(message) - attribute marking a function as -// deprecated; calling a marked function -// should generate a compiler warning - -#include <ctype.h> // for isspace, etc -#include <stddef.h> // for ptrdiff_t -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <memory> -#include <type_traits> - -#ifndef _WIN32_WCE -# include <sys/types.h> -# include <sys/stat.h> -#endif // !_WIN32_WCE - -#if defined __APPLE__ -# include <AvailabilityMacros.h> -# include <TargetConditionals.h> -#endif - -#include <algorithm> // NOLINT -#include <iostream> // NOLINT -#include <sstream> // NOLINT -#include <string> // NOLINT -#include <tuple> -#include <utility> -#include <vector> // NOLINT - -#include "gtest/internal/gtest-port-arch.h" -#include "gtest/internal/custom/gtest-port.h" - -#if !defined(GTEST_DEV_EMAIL_) -# define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com" -# define GTEST_FLAG_PREFIX_ "gtest_" -# define GTEST_FLAG_PREFIX_DASH_ "gtest-" -# define GTEST_FLAG_PREFIX_UPPER_ "GTEST_" -# define GTEST_NAME_ "Google Test" -# define GTEST_PROJECT_URL_ "https://github.com/google/googletest/" -#endif // !defined(GTEST_DEV_EMAIL_) - -#if !defined(GTEST_INIT_GOOGLE_TEST_NAME_) -# define GTEST_INIT_GOOGLE_TEST_NAME_ "testing::InitGoogleTest" -#endif // !defined(GTEST_INIT_GOOGLE_TEST_NAME_) - -// Determines the version of gcc that is used to compile this. -#ifdef __GNUC__ -// 40302 means version 4.3.2. -# define GTEST_GCC_VER_ \ - (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__) -#endif // __GNUC__ - -// Macros for disabling Microsoft Visual C++ warnings. -// -// GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385) -// /* code that triggers warnings C4800 and C4385 */ -// GTEST_DISABLE_MSC_WARNINGS_POP_() -#if defined(_MSC_VER) -# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \ - __pragma(warning(push)) \ - __pragma(warning(disable: warnings)) -# define GTEST_DISABLE_MSC_WARNINGS_POP_() \ - __pragma(warning(pop)) -#else -// Not all compilers are MSVC -# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) -# define GTEST_DISABLE_MSC_WARNINGS_POP_() -#endif - -// Clang on Windows does not understand MSVC's pragma warning. -// We need clang-specific way to disable function deprecation warning. -#ifdef __clang__ -# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \ - _Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"") -#define GTEST_DISABLE_MSC_DEPRECATED_POP_() \ - _Pragma("clang diagnostic pop") -#else -# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \ - GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996) -# define GTEST_DISABLE_MSC_DEPRECATED_POP_() \ - GTEST_DISABLE_MSC_WARNINGS_POP_() -#endif - -// Brings in definitions for functions used in the testing::internal::posix -// namespace (read, write, close, chdir, isatty, stat). We do not currently -// use them on Windows Mobile. -#if GTEST_OS_WINDOWS -# if !GTEST_OS_WINDOWS_MOBILE -# include <direct.h> -# include <io.h> -# endif -// In order to avoid having to include <windows.h>, use forward declaration -#if GTEST_OS_WINDOWS_MINGW && !defined(__MINGW64_VERSION_MAJOR) -// MinGW defined _CRITICAL_SECTION and _RTL_CRITICAL_SECTION as two -// separate (equivalent) structs, instead of using typedef -typedef struct _CRITICAL_SECTION GTEST_CRITICAL_SECTION; -#else -// Assume CRITICAL_SECTION is a typedef of _RTL_CRITICAL_SECTION. -// This assumption is verified by -// WindowsTypesTest.CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION. -typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; -#endif -#else -// This assumes that non-Windows OSes provide unistd.h. For OSes where this -// is not the case, we need to include headers that provide the functions -// mentioned above. -# include <unistd.h> -# include <strings.h> -#endif // GTEST_OS_WINDOWS - -#if GTEST_OS_LINUX_ANDROID -// Used to define __ANDROID_API__ matching the target NDK API level. -# include <android/api-level.h> // NOLINT -#endif - -// Defines this to true if and only if Google Test can use POSIX regular -// expressions. -#ifndef GTEST_HAS_POSIX_RE -# if GTEST_OS_LINUX_ANDROID -// On Android, <regex.h> is only available starting with Gingerbread. -# define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9) -# else -# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS) -# endif -#endif - -#if GTEST_USES_PCRE -// The appropriate headers have already been included. - -#elif GTEST_HAS_POSIX_RE - -// On some platforms, <regex.h> needs someone to define size_t, and -// won't compile otherwise. We can #include it here as we already -// included <stdlib.h>, which is guaranteed to define size_t through -// <stddef.h>. -# include <regex.h> // NOLINT - -# define GTEST_USES_POSIX_RE 1 - -#elif GTEST_OS_WINDOWS - -// <regex.h> is not available on Windows. Use our own simple regex -// implementation instead. -# define GTEST_USES_SIMPLE_RE 1 - -#else - -// <regex.h> may not be available on this platform. Use our own -// simple regex implementation instead. -# define GTEST_USES_SIMPLE_RE 1 - -#endif // GTEST_USES_PCRE - -#ifndef GTEST_HAS_EXCEPTIONS -// The user didn't tell us whether exceptions are enabled, so we need -// to figure it out. -# if defined(_MSC_VER) && defined(_CPPUNWIND) -// MSVC defines _CPPUNWIND to 1 if and only if exceptions are enabled. -# define GTEST_HAS_EXCEPTIONS 1 -# elif defined(__BORLANDC__) -// C++Builder's implementation of the STL uses the _HAS_EXCEPTIONS -// macro to enable exceptions, so we'll do the same. -// Assumes that exceptions are enabled by default. -# ifndef _HAS_EXCEPTIONS -# define _HAS_EXCEPTIONS 1 -# endif // _HAS_EXCEPTIONS -# define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS -# elif defined(__clang__) -// clang defines __EXCEPTIONS if and only if exceptions are enabled before clang -// 220714, but if and only if cleanups are enabled after that. In Obj-C++ files, -// there can be cleanups for ObjC exceptions which also need cleanups, even if -// C++ exceptions are disabled. clang has __has_feature(cxx_exceptions) which -// checks for C++ exceptions starting at clang r206352, but which checked for -// cleanups prior to that. To reliably check for C++ exception availability with -// clang, check for -// __EXCEPTIONS && __has_feature(cxx_exceptions). -# define GTEST_HAS_EXCEPTIONS (__EXCEPTIONS && __has_feature(cxx_exceptions)) -# elif defined(__GNUC__) && __EXCEPTIONS -// gcc defines __EXCEPTIONS to 1 if and only if exceptions are enabled. -# define GTEST_HAS_EXCEPTIONS 1 -# elif defined(__SUNPRO_CC) -// Sun Pro CC supports exceptions. However, there is no compile-time way of -// detecting whether they are enabled or not. Therefore, we assume that -// they are enabled unless the user tells us otherwise. -# define GTEST_HAS_EXCEPTIONS 1 -# elif defined(__IBMCPP__) && __EXCEPTIONS -// xlC defines __EXCEPTIONS to 1 if and only if exceptions are enabled. -# define GTEST_HAS_EXCEPTIONS 1 -# elif defined(__HP_aCC) -// Exception handling is in effect by default in HP aCC compiler. It has to -// be turned of by +noeh compiler option if desired. -# define GTEST_HAS_EXCEPTIONS 1 -# else -// For other compilers, we assume exceptions are disabled to be -// conservative. -# define GTEST_HAS_EXCEPTIONS 0 -# endif // defined(_MSC_VER) || defined(__BORLANDC__) -#endif // GTEST_HAS_EXCEPTIONS - -#if !defined(GTEST_HAS_STD_STRING) -// Even though we don't use this macro any longer, we keep it in case -// some clients still depend on it. -# define GTEST_HAS_STD_STRING 1 -#elif !GTEST_HAS_STD_STRING -// The user told us that ::std::string isn't available. -# error "::std::string isn't available." -#endif // !defined(GTEST_HAS_STD_STRING) - -#ifndef GTEST_HAS_STD_WSTRING -// The user didn't tell us whether ::std::wstring is available, so we need -// to figure it out. -// Cygwin 1.7 and below doesn't support ::std::wstring. -// Solaris' libc++ doesn't support it either. Android has -// no support for it at least as recent as Froyo (2.2). -#define GTEST_HAS_STD_WSTRING \ - (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \ - GTEST_OS_HAIKU)) - -#endif // GTEST_HAS_STD_WSTRING - -// Determines whether RTTI is available. -#ifndef GTEST_HAS_RTTI -// The user didn't tell us whether RTTI is enabled, so we need to -// figure it out. - -# ifdef _MSC_VER - -#ifdef _CPPRTTI // MSVC defines this macro if and only if RTTI is enabled. -# define GTEST_HAS_RTTI 1 -# else -# define GTEST_HAS_RTTI 0 -# endif - -// Starting with version 4.3.2, gcc defines __GXX_RTTI if and only if RTTI is -// enabled. -# elif defined(__GNUC__) - -# ifdef __GXX_RTTI -// When building against STLport with the Android NDK and with -// -frtti -fno-exceptions, the build fails at link time with undefined -// references to __cxa_bad_typeid. Note sure if STL or toolchain bug, -// so disable RTTI when detected. -# if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \ - !defined(__EXCEPTIONS) -# define GTEST_HAS_RTTI 0 -# else -# define GTEST_HAS_RTTI 1 -# endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS -# else -# define GTEST_HAS_RTTI 0 -# endif // __GXX_RTTI - -// Clang defines __GXX_RTTI starting with version 3.0, but its manual recommends -// using has_feature instead. has_feature(cxx_rtti) is supported since 2.7, the -// first version with C++ support. -# elif defined(__clang__) - -# define GTEST_HAS_RTTI __has_feature(cxx_rtti) - -// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if -// both the typeid and dynamic_cast features are present. -# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) - -# ifdef __RTTI_ALL__ -# define GTEST_HAS_RTTI 1 -# else -# define GTEST_HAS_RTTI 0 -# endif - -# else - -// For all other compilers, we assume RTTI is enabled. -# define GTEST_HAS_RTTI 1 - -# endif // _MSC_VER - -#endif // GTEST_HAS_RTTI - -// It's this header's responsibility to #include <typeinfo> when RTTI -// is enabled. -#if GTEST_HAS_RTTI -# include <typeinfo> -#endif - -// Determines whether Google Test can use the pthreads library. -#ifndef GTEST_HAS_PTHREAD -// The user didn't tell us explicitly, so we make reasonable assumptions about -// which platforms have pthreads support. -// -// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0 -// to your compiler flags. -#define GTEST_HAS_PTHREAD \ - (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX || GTEST_OS_QNX || \ - GTEST_OS_FREEBSD || GTEST_OS_NACL || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA || \ - GTEST_OS_DRAGONFLY || GTEST_OS_GNU_KFREEBSD || GTEST_OS_OPENBSD || \ - GTEST_OS_HAIKU) -#endif // GTEST_HAS_PTHREAD - -#if GTEST_HAS_PTHREAD -// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is -// true. -# include <pthread.h> // NOLINT - -// For timespec and nanosleep, used below. -# include <time.h> // NOLINT -#endif - -// Determines whether clone(2) is supported. -// Usually it will only be available on Linux, excluding -// Linux on the Itanium architecture. -// Also see http://linux.die.net/man/2/clone. -#ifndef GTEST_HAS_CLONE -// The user didn't tell us, so we need to figure it out. - -# if GTEST_OS_LINUX && !defined(__ia64__) -# if GTEST_OS_LINUX_ANDROID -// On Android, clone() became available at different API levels for each 32-bit -// architecture. -# if defined(__LP64__) || \ - (defined(__arm__) && __ANDROID_API__ >= 9) || \ - (defined(__mips__) && __ANDROID_API__ >= 12) || \ - (defined(__i386__) && __ANDROID_API__ >= 17) -# define GTEST_HAS_CLONE 1 -# else -# define GTEST_HAS_CLONE 0 -# endif -# else -# define GTEST_HAS_CLONE 1 -# endif -# else -# define GTEST_HAS_CLONE 0 -# endif // GTEST_OS_LINUX && !defined(__ia64__) - -#endif // GTEST_HAS_CLONE - -// Determines whether to support stream redirection. This is used to test -// output correctness and to implement death tests. -#ifndef GTEST_HAS_STREAM_REDIRECTION -// By default, we assume that stream redirection is supported on all -// platforms except known mobile ones. -# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT -# define GTEST_HAS_STREAM_REDIRECTION 0 -# else -# define GTEST_HAS_STREAM_REDIRECTION 1 -# endif // !GTEST_OS_WINDOWS_MOBILE -#endif // GTEST_HAS_STREAM_REDIRECTION - -// Determines whether to support death tests. -// pops up a dialog window that cannot be suppressed programmatically. -#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \ - (GTEST_OS_MAC && !GTEST_OS_IOS) || \ - (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER) || GTEST_OS_WINDOWS_MINGW || \ - GTEST_OS_AIX || GTEST_OS_HPUX || GTEST_OS_OPENBSD || GTEST_OS_QNX || \ - GTEST_OS_FREEBSD || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA || \ - GTEST_OS_DRAGONFLY || GTEST_OS_GNU_KFREEBSD || GTEST_OS_HAIKU) -# define GTEST_HAS_DEATH_TEST 1 -#endif - -// Determines whether to support type-driven tests. - -// Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0, -// Sun Pro CC, IBM Visual Age, and HP aCC support. -#if defined(__GNUC__) || defined(_MSC_VER) || defined(__SUNPRO_CC) || \ - defined(__IBMCPP__) || defined(__HP_aCC) -# define GTEST_HAS_TYPED_TEST 1 -# define GTEST_HAS_TYPED_TEST_P 1 -#endif - -// Determines whether the system compiler uses UTF-16 for encoding wide strings. -#define GTEST_WIDE_STRING_USES_UTF16_ \ - (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_AIX || GTEST_OS_OS2) - -// Determines whether test results can be streamed to a socket. -#if GTEST_OS_LINUX || GTEST_OS_GNU_KFREEBSD || GTEST_OS_DRAGONFLY || \ - GTEST_OS_FREEBSD || GTEST_OS_NETBSD || GTEST_OS_OPENBSD -# define GTEST_CAN_STREAM_RESULTS_ 1 -#endif - -// Defines some utility macros. - -// The GNU compiler emits a warning if nested "if" statements are followed by -// an "else" statement and braces are not used to explicitly disambiguate the -// "else" binding. This leads to problems with code like: -// -// if (gate) -// ASSERT_*(condition) << "Some message"; -// -// The "switch (0) case 0:" idiom is used to suppress this. -#ifdef __INTEL_COMPILER -# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ -#else -# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT -#endif - -// Use this annotation at the end of a struct/class definition to -// prevent the compiler from optimizing away instances that are never -// used. This is useful when all interesting logic happens inside the -// c'tor and / or d'tor. Example: -// -// struct Foo { -// Foo() { ... } -// } GTEST_ATTRIBUTE_UNUSED_; -// -// Also use it after a variable or parameter declaration to tell the -// compiler the variable/parameter does not have to be used. -#if defined(__GNUC__) && !defined(COMPILER_ICC) -# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) -#elif defined(__clang__) -# if __has_attribute(unused) -# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) -# endif -#endif -#ifndef GTEST_ATTRIBUTE_UNUSED_ -# define GTEST_ATTRIBUTE_UNUSED_ -#endif - -// Use this annotation before a function that takes a printf format string. -#if (defined(__GNUC__) || defined(__clang__)) && !defined(COMPILER_ICC) -# if defined(__MINGW_PRINTF_FORMAT) -// MinGW has two different printf implementations. Ensure the format macro -// matches the selected implementation. See -// https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/. -# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \ - __attribute__((__format__(__MINGW_PRINTF_FORMAT, string_index, \ - first_to_check))) -# else -# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \ - __attribute__((__format__(__printf__, string_index, first_to_check))) -# endif -#else -# define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) -#endif - - -// A macro to disallow operator= -// This should be used in the private: declarations for a class. -#define GTEST_DISALLOW_ASSIGN_(type) \ - void operator=(type const &) = delete - -// A macro to disallow copy constructor and operator= -// This should be used in the private: declarations for a class. -#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \ - type(type const &) = delete; \ - GTEST_DISALLOW_ASSIGN_(type) - -// Tell the compiler to warn about unused return values for functions declared -// with this macro. The macro should be used on function declarations -// following the argument list: -// -// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_; -#if defined(__GNUC__) && !defined(COMPILER_ICC) -# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result)) -#else -# define GTEST_MUST_USE_RESULT_ -#endif // __GNUC__ && !COMPILER_ICC - -// MS C++ compiler emits warning when a conditional expression is compile time -// constant. In some contexts this warning is false positive and needs to be -// suppressed. Use the following two macros in such cases: -// -// GTEST_INTENTIONAL_CONST_COND_PUSH_() -// while (true) { -// GTEST_INTENTIONAL_CONST_COND_POP_() -// } -# define GTEST_INTENTIONAL_CONST_COND_PUSH_() \ - GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127) -# define GTEST_INTENTIONAL_CONST_COND_POP_() \ - GTEST_DISABLE_MSC_WARNINGS_POP_() - -// Determine whether the compiler supports Microsoft's Structured Exception -// Handling. This is supported by several Windows compilers but generally -// does not exist on any other system. -#ifndef GTEST_HAS_SEH -// The user didn't tell us, so we need to figure it out. - -# if defined(_MSC_VER) || defined(__BORLANDC__) -// These two compilers are known to support SEH. -# define GTEST_HAS_SEH 1 -# else -// Assume no SEH. -# define GTEST_HAS_SEH 0 -# endif - -#endif // GTEST_HAS_SEH - -#ifndef GTEST_IS_THREADSAFE - -#define GTEST_IS_THREADSAFE \ - (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ || \ - (GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT) || \ - GTEST_HAS_PTHREAD) - -#endif // GTEST_IS_THREADSAFE - -// GTEST_API_ qualifies all symbols that must be exported. The definitions below -// are guarded by #ifndef to give embedders a chance to define GTEST_API_ in -// gtest/internal/custom/gtest-port.h -#ifndef GTEST_API_ - -#ifdef _MSC_VER -# if GTEST_LINKED_AS_SHARED_LIBRARY -# define GTEST_API_ __declspec(dllimport) -# elif GTEST_CREATE_SHARED_LIBRARY -# define GTEST_API_ __declspec(dllexport) -# endif -#elif __GNUC__ >= 4 || defined(__clang__) -# define GTEST_API_ __attribute__((visibility ("default"))) -#endif // _MSC_VER - -#endif // GTEST_API_ - -#ifndef GTEST_API_ -# define GTEST_API_ -#endif // GTEST_API_ - -#ifndef GTEST_DEFAULT_DEATH_TEST_STYLE -# define GTEST_DEFAULT_DEATH_TEST_STYLE "fast" -#endif // GTEST_DEFAULT_DEATH_TEST_STYLE - -#ifdef __GNUC__ -// Ask the compiler to never inline a given function. -# define GTEST_NO_INLINE_ __attribute__((noinline)) -#else -# define GTEST_NO_INLINE_ -#endif - -// _LIBCPP_VERSION is defined by the libc++ library from the LLVM project. -#if !defined(GTEST_HAS_CXXABI_H_) -# if defined(__GLIBCXX__) || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)) -# define GTEST_HAS_CXXABI_H_ 1 -# else -# define GTEST_HAS_CXXABI_H_ 0 -# endif -#endif - -// A function level attribute to disable checking for use of uninitialized -// memory when built with MemorySanitizer. -#if defined(__clang__) -# if __has_feature(memory_sanitizer) -# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ \ - __attribute__((no_sanitize_memory)) -# else -# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ -# endif // __has_feature(memory_sanitizer) -#else -# define GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ -#endif // __clang__ - -// A function level attribute to disable AddressSanitizer instrumentation. -#if defined(__clang__) -# if __has_feature(address_sanitizer) -# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ \ - __attribute__((no_sanitize_address)) -# else -# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -# endif // __has_feature(address_sanitizer) -#else -# define GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -#endif // __clang__ - -// A function level attribute to disable HWAddressSanitizer instrumentation. -#if defined(__clang__) -# if __has_feature(hwaddress_sanitizer) -# define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ \ - __attribute__((no_sanitize("hwaddress"))) -# else -# define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -# endif // __has_feature(hwaddress_sanitizer) -#else -# define GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -#endif // __clang__ - -// A function level attribute to disable ThreadSanitizer instrumentation. -#if defined(__clang__) -# if __has_feature(thread_sanitizer) -# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ \ - __attribute__((no_sanitize_thread)) -# else -# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ -# endif // __has_feature(thread_sanitizer) -#else -# define GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ -#endif // __clang__ - -namespace testing { - -class Message; - -// Legacy imports for backwards compatibility. -// New code should use std:: names directly. -using std::get; -using std::make_tuple; -using std::tuple; -using std::tuple_element; -using std::tuple_size; - -namespace internal { - -// A secret type that Google Test users don't know about. It has no -// definition on purpose. Therefore it's impossible to create a -// Secret object, which is what we want. -class Secret; - -// The GTEST_COMPILE_ASSERT_ is a legacy macro used to verify that a compile -// time expression is true (in new code, use static_assert instead). For -// example, you could use it to verify the size of a static array: -// -// GTEST_COMPILE_ASSERT_(GTEST_ARRAY_SIZE_(names) == NUM_NAMES, -// names_incorrect_size); -// -// The second argument to the macro must be a valid C++ identifier. If the -// expression is false, compiler will issue an error containing this identifier. -#define GTEST_COMPILE_ASSERT_(expr, msg) static_assert(expr, #msg) - -// Evaluates to the number of elements in 'array'. -#define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0])) - -// A helper for suppressing warnings on constant condition. It just -// returns 'condition'. -GTEST_API_ bool IsTrue(bool condition); - -// Defines RE. - -#if GTEST_USES_PCRE -// if used, PCRE is injected by custom/gtest-port.h -#elif GTEST_USES_POSIX_RE || GTEST_USES_SIMPLE_RE - -// A simple C++ wrapper for <regex.h>. It uses the POSIX Extended -// Regular Expression syntax. -class GTEST_API_ RE { - public: - // A copy constructor is required by the Standard to initialize object - // references from r-values. - RE(const RE& other) { Init(other.pattern()); } - - // Constructs an RE from a string. - RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT - - RE(const char* regex) { Init(regex); } // NOLINT - ~RE(); - - // Returns the string representation of the regex. - const char* pattern() const { return pattern_; } - - // FullMatch(str, re) returns true if and only if regular expression re - // matches the entire str. - // PartialMatch(str, re) returns true if and only if regular expression re - // matches a substring of str (including str itself). - static bool FullMatch(const ::std::string& str, const RE& re) { - return FullMatch(str.c_str(), re); - } - static bool PartialMatch(const ::std::string& str, const RE& re) { - return PartialMatch(str.c_str(), re); - } - - static bool FullMatch(const char* str, const RE& re); - static bool PartialMatch(const char* str, const RE& re); - - private: - void Init(const char* regex); - const char* pattern_; - bool is_valid_; - -# if GTEST_USES_POSIX_RE - - regex_t full_regex_; // For FullMatch(). - regex_t partial_regex_; // For PartialMatch(). - -# else // GTEST_USES_SIMPLE_RE - - const char* full_pattern_; // For FullMatch(); - -# endif - - GTEST_DISALLOW_ASSIGN_(RE); -}; - -#endif // GTEST_USES_PCRE - -// Formats a source file path and a line number as they would appear -// in an error message from the compiler used to compile this code. -GTEST_API_ ::std::string FormatFileLocation(const char* file, int line); - -// Formats a file location for compiler-independent XML output. -// Although this function is not platform dependent, we put it next to -// FormatFileLocation in order to contrast the two functions. -GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file, - int line); - -// Defines logging utilities: -// GTEST_LOG_(severity) - logs messages at the specified severity level. The -// message itself is streamed into the macro. -// LogToStderr() - directs all log messages to stderr. -// FlushInfoLog() - flushes informational log messages. - -enum GTestLogSeverity { - GTEST_INFO, - GTEST_WARNING, - GTEST_ERROR, - GTEST_FATAL -}; - -// Formats log entry severity, provides a stream object for streaming the -// log message, and terminates the message with a newline when going out of -// scope. -class GTEST_API_ GTestLog { - public: - GTestLog(GTestLogSeverity severity, const char* file, int line); - - // Flushes the buffers and, if severity is GTEST_FATAL, aborts the program. - ~GTestLog(); - - ::std::ostream& GetStream() { return ::std::cerr; } - - private: - const GTestLogSeverity severity_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog); -}; - -#if !defined(GTEST_LOG_) - -# define GTEST_LOG_(severity) \ - ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \ - __FILE__, __LINE__).GetStream() - -inline void LogToStderr() {} -inline void FlushInfoLog() { fflush(nullptr); } - -#endif // !defined(GTEST_LOG_) - -#if !defined(GTEST_CHECK_) -// INTERNAL IMPLEMENTATION - DO NOT USE. -// -// GTEST_CHECK_ is an all-mode assert. It aborts the program if the condition -// is not satisfied. -// Synopsys: -// GTEST_CHECK_(boolean_condition); -// or -// GTEST_CHECK_(boolean_condition) << "Additional message"; -// -// This checks the condition and if the condition is not satisfied -// it prints message about the condition violation, including the -// condition itself, plus additional message streamed into it, if any, -// and then it aborts the program. It aborts the program irrespective of -// whether it is built in the debug mode or not. -# define GTEST_CHECK_(condition) \ - GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ - if (::testing::internal::IsTrue(condition)) \ - ; \ - else \ - GTEST_LOG_(FATAL) << "Condition " #condition " failed. " -#endif // !defined(GTEST_CHECK_) - -// An all-mode assert to verify that the given POSIX-style function -// call returns 0 (indicating success). Known limitation: this -// doesn't expand to a balanced 'if' statement, so enclose the macro -// in {} if you need to use it as the only statement in an 'if' -// branch. -#define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \ - if (const int gtest_error = (posix_call)) \ - GTEST_LOG_(FATAL) << #posix_call << "failed with error " \ - << gtest_error - -// Transforms "T" into "const T&" according to standard reference collapsing -// rules (this is only needed as a backport for C++98 compilers that do not -// support reference collapsing). Specifically, it transforms: -// -// char ==> const char& -// const char ==> const char& -// char& ==> char& -// const char& ==> const char& -// -// Note that the non-const reference will not have "const" added. This is -// standard, and necessary so that "T" can always bind to "const T&". -template <typename T> -struct ConstRef { typedef const T& type; }; -template <typename T> -struct ConstRef<T&> { typedef T& type; }; - -// The argument T must depend on some template parameters. -#define GTEST_REFERENCE_TO_CONST_(T) \ - typename ::testing::internal::ConstRef<T>::type - -// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. -// -// Use ImplicitCast_ as a safe version of static_cast for upcasting in -// the type hierarchy (e.g. casting a Foo* to a SuperclassOfFoo* or a -// const Foo*). When you use ImplicitCast_, the compiler checks that -// the cast is safe. Such explicit ImplicitCast_s are necessary in -// surprisingly many situations where C++ demands an exact type match -// instead of an argument type convertable to a target type. -// -// The syntax for using ImplicitCast_ is the same as for static_cast: -// -// ImplicitCast_<ToType>(expr) -// -// ImplicitCast_ would have been part of the C++ standard library, -// but the proposal was submitted too late. It will probably make -// its way into the language in the future. -// -// This relatively ugly name is intentional. It prevents clashes with -// similar functions users may have (e.g., implicit_cast). The internal -// namespace alone is not enough because the function can be found by ADL. -template<typename To> -inline To ImplicitCast_(To x) { return x; } - -// When you upcast (that is, cast a pointer from type Foo to type -// SuperclassOfFoo), it's fine to use ImplicitCast_<>, since upcasts -// always succeed. When you downcast (that is, cast a pointer from -// type Foo to type SubclassOfFoo), static_cast<> isn't safe, because -// how do you know the pointer is really of type SubclassOfFoo? It -// could be a bare Foo, or of type DifferentSubclassOfFoo. Thus, -// when you downcast, you should use this macro. In debug mode, we -// use dynamic_cast<> to double-check the downcast is legal (we die -// if it's not). In normal mode, we do the efficient static_cast<> -// instead. Thus, it's important to test in debug mode to make sure -// the cast is legal! -// This is the only place in the code we should use dynamic_cast<>. -// In particular, you SHOULDN'T be using dynamic_cast<> in order to -// do RTTI (eg code like this: -// if (dynamic_cast<Subclass1>(foo)) HandleASubclass1Object(foo); -// if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo); -// You should design the code some other way not to need this. -// -// This relatively ugly name is intentional. It prevents clashes with -// similar functions users may have (e.g., down_cast). The internal -// namespace alone is not enough because the function can be found by ADL. -template<typename To, typename From> // use like this: DownCast_<T*>(foo); -inline To DownCast_(From* f) { // so we only accept pointers - // Ensures that To is a sub-type of From *. This test is here only - // for compile-time type checking, and has no overhead in an - // optimized build at run-time, as it will be optimized away - // completely. - GTEST_INTENTIONAL_CONST_COND_PUSH_() - if (false) { - GTEST_INTENTIONAL_CONST_COND_POP_() - const To to = nullptr; - ::testing::internal::ImplicitCast_<From*>(to); - } - -#if GTEST_HAS_RTTI - // RTTI: debug mode only! - GTEST_CHECK_(f == nullptr || dynamic_cast<To>(f) != nullptr); -#endif - return static_cast<To>(f); -} - -// Downcasts the pointer of type Base to Derived. -// Derived must be a subclass of Base. The parameter MUST -// point to a class of type Derived, not any subclass of it. -// When RTTI is available, the function performs a runtime -// check to enforce this. -template <class Derived, class Base> -Derived* CheckedDowncastToActualType(Base* base) { -#if GTEST_HAS_RTTI - GTEST_CHECK_(typeid(*base) == typeid(Derived)); -#endif - -#if GTEST_HAS_DOWNCAST_ - return ::down_cast<Derived*>(base); -#elif GTEST_HAS_RTTI - return dynamic_cast<Derived*>(base); // NOLINT -#else - return static_cast<Derived*>(base); // Poor man's downcast. -#endif -} - -#if GTEST_HAS_STREAM_REDIRECTION - -// Defines the stderr capturer: -// CaptureStdout - starts capturing stdout. -// GetCapturedStdout - stops capturing stdout and returns the captured string. -// CaptureStderr - starts capturing stderr. -// GetCapturedStderr - stops capturing stderr and returns the captured string. -// -GTEST_API_ void CaptureStdout(); -GTEST_API_ std::string GetCapturedStdout(); -GTEST_API_ void CaptureStderr(); -GTEST_API_ std::string GetCapturedStderr(); - -#endif // GTEST_HAS_STREAM_REDIRECTION -// Returns the size (in bytes) of a file. -GTEST_API_ size_t GetFileSize(FILE* file); - -// Reads the entire content of a file as a string. -GTEST_API_ std::string ReadEntireFile(FILE* file); - -// All command line arguments. -GTEST_API_ std::vector<std::string> GetArgvs(); - -#if GTEST_HAS_DEATH_TEST - -std::vector<std::string> GetInjectableArgvs(); -// Deprecated: pass the args vector by value instead. -void SetInjectableArgvs(const std::vector<std::string>* new_argvs); -void SetInjectableArgvs(const std::vector<std::string>& new_argvs); -void ClearInjectableArgvs(); - -#endif // GTEST_HAS_DEATH_TEST - -// Defines synchronization primitives. -#if GTEST_IS_THREADSAFE -# if GTEST_HAS_PTHREAD -// Sleeps for (roughly) n milliseconds. This function is only for testing -// Google Test's own constructs. Don't use it in user tests, either -// directly or indirectly. -inline void SleepMilliseconds(int n) { - const timespec time = { - 0, // 0 seconds. - n * 1000L * 1000L, // And n ms. - }; - nanosleep(&time, nullptr); -} -# endif // GTEST_HAS_PTHREAD - -# if GTEST_HAS_NOTIFICATION_ -// Notification has already been imported into the namespace. -// Nothing to do here. - -# elif GTEST_HAS_PTHREAD -// Allows a controller thread to pause execution of newly created -// threads until notified. Instances of this class must be created -// and destroyed in the controller thread. -// -// This class is only for testing Google Test's own constructs. Do not -// use it in user tests, either directly or indirectly. -class Notification { - public: - Notification() : notified_(false) { - GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, nullptr)); - } - ~Notification() { - pthread_mutex_destroy(&mutex_); - } - - // Notifies all threads created with this notification to start. Must - // be called from the controller thread. - void Notify() { - pthread_mutex_lock(&mutex_); - notified_ = true; - pthread_mutex_unlock(&mutex_); - } - - // Blocks until the controller thread notifies. Must be called from a test - // thread. - void WaitForNotification() { - for (;;) { - pthread_mutex_lock(&mutex_); - const bool notified = notified_; - pthread_mutex_unlock(&mutex_); - if (notified) - break; - SleepMilliseconds(10); - } - } - - private: - pthread_mutex_t mutex_; - bool notified_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification); -}; - -# elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT - -GTEST_API_ void SleepMilliseconds(int n); - -// Provides leak-safe Windows kernel handle ownership. -// Used in death tests and in threading support. -class GTEST_API_ AutoHandle { - public: - // Assume that Win32 HANDLE type is equivalent to void*. Doing so allows us to - // avoid including <windows.h> in this header file. Including <windows.h> is - // undesirable because it defines a lot of symbols and macros that tend to - // conflict with client code. This assumption is verified by - // WindowsTypesTest.HANDLEIsVoidStar. - typedef void* Handle; - AutoHandle(); - explicit AutoHandle(Handle handle); - - ~AutoHandle(); - - Handle Get() const; - void Reset(); - void Reset(Handle handle); - - private: - // Returns true if and only if the handle is a valid handle object that can be - // closed. - bool IsCloseable() const; - - Handle handle_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle); -}; - -// Allows a controller thread to pause execution of newly created -// threads until notified. Instances of this class must be created -// and destroyed in the controller thread. -// -// This class is only for testing Google Test's own constructs. Do not -// use it in user tests, either directly or indirectly. -class GTEST_API_ Notification { - public: - Notification(); - void Notify(); - void WaitForNotification(); - - private: - AutoHandle event_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(Notification); -}; -# endif // GTEST_HAS_NOTIFICATION_ - -// On MinGW, we can have both GTEST_OS_WINDOWS and GTEST_HAS_PTHREAD -// defined, but we don't want to use MinGW's pthreads implementation, which -// has conformance problems with some versions of the POSIX standard. -# if GTEST_HAS_PTHREAD && !GTEST_OS_WINDOWS_MINGW - -// As a C-function, ThreadFuncWithCLinkage cannot be templated itself. -// Consequently, it cannot select a correct instantiation of ThreadWithParam -// in order to call its Run(). Introducing ThreadWithParamBase as a -// non-templated base class for ThreadWithParam allows us to bypass this -// problem. -class ThreadWithParamBase { - public: - virtual ~ThreadWithParamBase() {} - virtual void Run() = 0; -}; - -// pthread_create() accepts a pointer to a function type with the C linkage. -// According to the Standard (7.5/1), function types with different linkages -// are different even if they are otherwise identical. Some compilers (for -// example, SunStudio) treat them as different types. Since class methods -// cannot be defined with C-linkage we need to define a free C-function to -// pass into pthread_create(). -extern "C" inline void* ThreadFuncWithCLinkage(void* thread) { - static_cast<ThreadWithParamBase*>(thread)->Run(); - return nullptr; -} - -// Helper class for testing Google Test's multi-threading constructs. -// To use it, write: -// -// void ThreadFunc(int param) { /* Do things with param */ } -// Notification thread_can_start; -// ... -// // The thread_can_start parameter is optional; you can supply NULL. -// ThreadWithParam<int> thread(&ThreadFunc, 5, &thread_can_start); -// thread_can_start.Notify(); -// -// These classes are only for testing Google Test's own constructs. Do -// not use them in user tests, either directly or indirectly. -template <typename T> -class ThreadWithParam : public ThreadWithParamBase { - public: - typedef void UserThreadFunc(T); - - ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start) - : func_(func), - param_(param), - thread_can_start_(thread_can_start), - finished_(false) { - ThreadWithParamBase* const base = this; - // The thread can be created only after all fields except thread_ - // have been initialized. - GTEST_CHECK_POSIX_SUCCESS_( - pthread_create(&thread_, nullptr, &ThreadFuncWithCLinkage, base)); - } - ~ThreadWithParam() override { Join(); } - - void Join() { - if (!finished_) { - GTEST_CHECK_POSIX_SUCCESS_(pthread_join(thread_, nullptr)); - finished_ = true; - } - } - - void Run() override { - if (thread_can_start_ != nullptr) thread_can_start_->WaitForNotification(); - func_(param_); - } - - private: - UserThreadFunc* const func_; // User-supplied thread function. - const T param_; // User-supplied parameter to the thread function. - // When non-NULL, used to block execution until the controller thread - // notifies. - Notification* const thread_can_start_; - bool finished_; // true if and only if we know that the thread function has - // finished. - pthread_t thread_; // The native thread object. - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam); -}; -# endif // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD || - // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - -# if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ -// Mutex and ThreadLocal have already been imported into the namespace. -// Nothing to do here. - -# elif GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT - -// Mutex implements mutex on Windows platforms. It is used in conjunction -// with class MutexLock: -// -// Mutex mutex; -// ... -// MutexLock lock(&mutex); // Acquires the mutex and releases it at the -// // end of the current scope. -// -// A static Mutex *must* be defined or declared using one of the following -// macros: -// GTEST_DEFINE_STATIC_MUTEX_(g_some_mutex); -// GTEST_DECLARE_STATIC_MUTEX_(g_some_mutex); -// -// (A non-static Mutex is defined/declared in the usual way). -class GTEST_API_ Mutex { - public: - enum MutexType { kStatic = 0, kDynamic = 1 }; - // We rely on kStaticMutex being 0 as it is to what the linker initializes - // type_ in static mutexes. critical_section_ will be initialized lazily - // in ThreadSafeLazyInit(). - enum StaticConstructorSelector { kStaticMutex = 0 }; - - // This constructor intentionally does nothing. It relies on type_ being - // statically initialized to 0 (effectively setting it to kStatic) and on - // ThreadSafeLazyInit() to lazily initialize the rest of the members. - explicit Mutex(StaticConstructorSelector /*dummy*/) {} - - Mutex(); - ~Mutex(); - - void Lock(); - - void Unlock(); - - // Does nothing if the current thread holds the mutex. Otherwise, crashes - // with high probability. - void AssertHeld(); - - private: - // Initializes owner_thread_id_ and critical_section_ in static mutexes. - void ThreadSafeLazyInit(); - - // Per https://blogs.msdn.microsoft.com/oldnewthing/20040223-00/?p=40503, - // we assume that 0 is an invalid value for thread IDs. - unsigned int owner_thread_id_; - - // For static mutexes, we rely on these members being initialized to zeros - // by the linker. - MutexType type_; - long critical_section_init_phase_; // NOLINT - GTEST_CRITICAL_SECTION* critical_section_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); -}; - -# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ - extern ::testing::internal::Mutex mutex - -# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ - ::testing::internal::Mutex mutex(::testing::internal::Mutex::kStaticMutex) - -// We cannot name this class MutexLock because the ctor declaration would -// conflict with a macro named MutexLock, which is defined on some -// platforms. That macro is used as a defensive measure to prevent against -// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than -// "MutexLock l(&mu)". Hence the typedef trick below. -class GTestMutexLock { - public: - explicit GTestMutexLock(Mutex* mutex) - : mutex_(mutex) { mutex_->Lock(); } - - ~GTestMutexLock() { mutex_->Unlock(); } - - private: - Mutex* const mutex_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock); -}; - -typedef GTestMutexLock MutexLock; - -// Base class for ValueHolder<T>. Allows a caller to hold and delete a value -// without knowing its type. -class ThreadLocalValueHolderBase { - public: - virtual ~ThreadLocalValueHolderBase() {} -}; - -// Provides a way for a thread to send notifications to a ThreadLocal -// regardless of its parameter type. -class ThreadLocalBase { - public: - // Creates a new ValueHolder<T> object holding a default value passed to - // this ThreadLocal<T>'s constructor and returns it. It is the caller's - // responsibility not to call this when the ThreadLocal<T> instance already - // has a value on the current thread. - virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0; - - protected: - ThreadLocalBase() {} - virtual ~ThreadLocalBase() {} - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocalBase); -}; - -// Maps a thread to a set of ThreadLocals that have values instantiated on that -// thread and notifies them when the thread exits. A ThreadLocal instance is -// expected to persist until all threads it has values on have terminated. -class GTEST_API_ ThreadLocalRegistry { - public: - // Registers thread_local_instance as having value on the current thread. - // Returns a value that can be used to identify the thread from other threads. - static ThreadLocalValueHolderBase* GetValueOnCurrentThread( - const ThreadLocalBase* thread_local_instance); - - // Invoked when a ThreadLocal instance is destroyed. - static void OnThreadLocalDestroyed( - const ThreadLocalBase* thread_local_instance); -}; - -class GTEST_API_ ThreadWithParamBase { - public: - void Join(); - - protected: - class Runnable { - public: - virtual ~Runnable() {} - virtual void Run() = 0; - }; - - ThreadWithParamBase(Runnable *runnable, Notification* thread_can_start); - virtual ~ThreadWithParamBase(); - - private: - AutoHandle thread_; -}; - -// Helper class for testing Google Test's multi-threading constructs. -template <typename T> -class ThreadWithParam : public ThreadWithParamBase { - public: - typedef void UserThreadFunc(T); - - ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start) - : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) { - } - virtual ~ThreadWithParam() {} - - private: - class RunnableImpl : public Runnable { - public: - RunnableImpl(UserThreadFunc* func, T param) - : func_(func), - param_(param) { - } - virtual ~RunnableImpl() {} - virtual void Run() { - func_(param_); - } - - private: - UserThreadFunc* const func_; - const T param_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(RunnableImpl); - }; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParam); -}; - -// Implements thread-local storage on Windows systems. -// -// // Thread 1 -// ThreadLocal<int> tl(100); // 100 is the default value for each thread. -// -// // Thread 2 -// tl.set(150); // Changes the value for thread 2 only. -// EXPECT_EQ(150, tl.get()); -// -// // Thread 1 -// EXPECT_EQ(100, tl.get()); // In thread 1, tl has the original value. -// tl.set(200); -// EXPECT_EQ(200, tl.get()); -// -// The template type argument T must have a public copy constructor. -// In addition, the default ThreadLocal constructor requires T to have -// a public default constructor. -// -// The users of a TheadLocal instance have to make sure that all but one -// threads (including the main one) using that instance have exited before -// destroying it. Otherwise, the per-thread objects managed for them by the -// ThreadLocal instance are not guaranteed to be destroyed on all platforms. -// -// Google Test only uses global ThreadLocal objects. That means they -// will die after main() has returned. Therefore, no per-thread -// object managed by Google Test will be leaked as long as all threads -// using Google Test have exited when main() returns. -template <typename T> -class ThreadLocal : public ThreadLocalBase { - public: - ThreadLocal() : default_factory_(new DefaultValueHolderFactory()) {} - explicit ThreadLocal(const T& value) - : default_factory_(new InstanceValueHolderFactory(value)) {} - - ~ThreadLocal() { ThreadLocalRegistry::OnThreadLocalDestroyed(this); } - - T* pointer() { return GetOrCreateValue(); } - const T* pointer() const { return GetOrCreateValue(); } - const T& get() const { return *pointer(); } - void set(const T& value) { *pointer() = value; } - - private: - // Holds a value of T. Can be deleted via its base class without the caller - // knowing the type of T. - class ValueHolder : public ThreadLocalValueHolderBase { - public: - ValueHolder() : value_() {} - explicit ValueHolder(const T& value) : value_(value) {} - - T* pointer() { return &value_; } - - private: - T value_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder); - }; - - - T* GetOrCreateValue() const { - return static_cast<ValueHolder*>( - ThreadLocalRegistry::GetValueOnCurrentThread(this))->pointer(); - } - - virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const { - return default_factory_->MakeNewHolder(); - } - - class ValueHolderFactory { - public: - ValueHolderFactory() {} - virtual ~ValueHolderFactory() {} - virtual ValueHolder* MakeNewHolder() const = 0; - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory); - }; - - class DefaultValueHolderFactory : public ValueHolderFactory { - public: - DefaultValueHolderFactory() {} - virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); } - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); - }; - - class InstanceValueHolderFactory : public ValueHolderFactory { - public: - explicit InstanceValueHolderFactory(const T& value) : value_(value) {} - virtual ValueHolder* MakeNewHolder() const { - return new ValueHolder(value_); - } - - private: - const T value_; // The value for each thread. - - GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory); - }; - - std::unique_ptr<ValueHolderFactory> default_factory_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal); -}; - -# elif GTEST_HAS_PTHREAD - -// MutexBase and Mutex implement mutex on pthreads-based platforms. -class MutexBase { - public: - // Acquires this mutex. - void Lock() { - GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&mutex_)); - owner_ = pthread_self(); - has_owner_ = true; - } - - // Releases this mutex. - void Unlock() { - // Since the lock is being released the owner_ field should no longer be - // considered valid. We don't protect writing to has_owner_ here, as it's - // the caller's responsibility to ensure that the current thread holds the - // mutex when this is called. - has_owner_ = false; - GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&mutex_)); - } - - // Does nothing if the current thread holds the mutex. Otherwise, crashes - // with high probability. - void AssertHeld() const { - GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self())) - << "The current thread is not holding the mutex @" << this; - } - - // A static mutex may be used before main() is entered. It may even - // be used before the dynamic initialization stage. Therefore we - // must be able to initialize a static mutex object at link time. - // This means MutexBase has to be a POD and its member variables - // have to be public. - public: - pthread_mutex_t mutex_; // The underlying pthread mutex. - // has_owner_ indicates whether the owner_ field below contains a valid thread - // ID and is therefore safe to inspect (e.g., to use in pthread_equal()). All - // accesses to the owner_ field should be protected by a check of this field. - // An alternative might be to memset() owner_ to all zeros, but there's no - // guarantee that a zero'd pthread_t is necessarily invalid or even different - // from pthread_self(). - bool has_owner_; - pthread_t owner_; // The thread holding the mutex. -}; - -// Forward-declares a static mutex. -# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ - extern ::testing::internal::MutexBase mutex - -// Defines and statically (i.e. at link time) initializes a static mutex. -// The initialization list here does not explicitly initialize each field, -// instead relying on default initialization for the unspecified fields. In -// particular, the owner_ field (a pthread_t) is not explicitly initialized. -// This allows initialization to work whether pthread_t is a scalar or struct. -// The flag -Wmissing-field-initializers must not be specified for this to work. -#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ - ::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false, 0} - -// The Mutex class can only be used for mutexes created at runtime. It -// shares its API with MutexBase otherwise. -class Mutex : public MutexBase { - public: - Mutex() { - GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_init(&mutex_, nullptr)); - has_owner_ = false; - } - ~Mutex() { - GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&mutex_)); - } - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(Mutex); -}; - -// We cannot name this class MutexLock because the ctor declaration would -// conflict with a macro named MutexLock, which is defined on some -// platforms. That macro is used as a defensive measure to prevent against -// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than -// "MutexLock l(&mu)". Hence the typedef trick below. -class GTestMutexLock { - public: - explicit GTestMutexLock(MutexBase* mutex) - : mutex_(mutex) { mutex_->Lock(); } - - ~GTestMutexLock() { mutex_->Unlock(); } - - private: - MutexBase* const mutex_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestMutexLock); -}; - -typedef GTestMutexLock MutexLock; - -// Helpers for ThreadLocal. - -// pthread_key_create() requires DeleteThreadLocalValue() to have -// C-linkage. Therefore it cannot be templatized to access -// ThreadLocal<T>. Hence the need for class -// ThreadLocalValueHolderBase. -class ThreadLocalValueHolderBase { - public: - virtual ~ThreadLocalValueHolderBase() {} -}; - -// Called by pthread to delete thread-local data stored by -// pthread_setspecific(). -extern "C" inline void DeleteThreadLocalValue(void* value_holder) { - delete static_cast<ThreadLocalValueHolderBase*>(value_holder); -} - -// Implements thread-local storage on pthreads-based systems. -template <typename T> -class GTEST_API_ ThreadLocal { - public: - ThreadLocal() - : key_(CreateKey()), default_factory_(new DefaultValueHolderFactory()) {} - explicit ThreadLocal(const T& value) - : key_(CreateKey()), - default_factory_(new InstanceValueHolderFactory(value)) {} - - ~ThreadLocal() { - // Destroys the managed object for the current thread, if any. - DeleteThreadLocalValue(pthread_getspecific(key_)); - - // Releases resources associated with the key. This will *not* - // delete managed objects for other threads. - GTEST_CHECK_POSIX_SUCCESS_(pthread_key_delete(key_)); - } - - T* pointer() { return GetOrCreateValue(); } - const T* pointer() const { return GetOrCreateValue(); } - const T& get() const { return *pointer(); } - void set(const T& value) { *pointer() = value; } - - private: - // Holds a value of type T. - class ValueHolder : public ThreadLocalValueHolderBase { - public: - ValueHolder() : value_() {} - explicit ValueHolder(const T& value) : value_(value) {} - - T* pointer() { return &value_; } - - private: - T value_; - GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolder); - }; - - static pthread_key_t CreateKey() { - pthread_key_t key; - // When a thread exits, DeleteThreadLocalValue() will be called on - // the object managed for that thread. - GTEST_CHECK_POSIX_SUCCESS_( - pthread_key_create(&key, &DeleteThreadLocalValue)); - return key; - } - - T* GetOrCreateValue() const { - ThreadLocalValueHolderBase* const holder = - static_cast<ThreadLocalValueHolderBase*>(pthread_getspecific(key_)); - if (holder != nullptr) { - return CheckedDowncastToActualType<ValueHolder>(holder)->pointer(); - } - - ValueHolder* const new_holder = default_factory_->MakeNewHolder(); - ThreadLocalValueHolderBase* const holder_base = new_holder; - GTEST_CHECK_POSIX_SUCCESS_(pthread_setspecific(key_, holder_base)); - return new_holder->pointer(); - } - - class ValueHolderFactory { - public: - ValueHolderFactory() {} - virtual ~ValueHolderFactory() {} - virtual ValueHolder* MakeNewHolder() const = 0; - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(ValueHolderFactory); - }; - - class DefaultValueHolderFactory : public ValueHolderFactory { - public: - DefaultValueHolderFactory() {} - virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); } - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); - }; - - class InstanceValueHolderFactory : public ValueHolderFactory { - public: - explicit InstanceValueHolderFactory(const T& value) : value_(value) {} - virtual ValueHolder* MakeNewHolder() const { - return new ValueHolder(value_); - } - - private: - const T value_; // The value for each thread. - - GTEST_DISALLOW_COPY_AND_ASSIGN_(InstanceValueHolderFactory); - }; - - // A key pthreads uses for looking up per-thread values. - const pthread_key_t key_; - std::unique_ptr<ValueHolderFactory> default_factory_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal); -}; - -# endif // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - -#else // GTEST_IS_THREADSAFE - -// A dummy implementation of synchronization primitives (mutex, lock, -// and thread-local variable). Necessary for compiling Google Test where -// mutex is not supported - using Google Test in multiple threads is not -// supported on such platforms. - -class Mutex { - public: - Mutex() {} - void Lock() {} - void Unlock() {} - void AssertHeld() const {} -}; - -# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ - extern ::testing::internal::Mutex mutex - -# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex - -// We cannot name this class MutexLock because the ctor declaration would -// conflict with a macro named MutexLock, which is defined on some -// platforms. That macro is used as a defensive measure to prevent against -// inadvertent misuses of MutexLock like "MutexLock(&mu)" rather than -// "MutexLock l(&mu)". Hence the typedef trick below. -class GTestMutexLock { - public: - explicit GTestMutexLock(Mutex*) {} // NOLINT -}; - -typedef GTestMutexLock MutexLock; - -template <typename T> -class GTEST_API_ ThreadLocal { - public: - ThreadLocal() : value_() {} - explicit ThreadLocal(const T& value) : value_(value) {} - T* pointer() { return &value_; } - const T* pointer() const { return &value_; } - const T& get() const { return value_; } - void set(const T& value) { value_ = value; } - private: - T value_; -}; - -#endif // GTEST_IS_THREADSAFE - -// Returns the number of threads running in the process, or 0 to indicate that -// we cannot detect it. -GTEST_API_ size_t GetThreadCount(); - -template <bool B> -using bool_constant = std::integral_constant<bool, B>; - -#if GTEST_OS_WINDOWS -# define GTEST_PATH_SEP_ "\\" -# define GTEST_HAS_ALT_PATH_SEP_ 1 -// The biggest signed integer type the compiler supports. -typedef __int64 BiggestInt; -#else -# define GTEST_PATH_SEP_ "/" -# define GTEST_HAS_ALT_PATH_SEP_ 0 -typedef long long BiggestInt; // NOLINT -#endif // GTEST_OS_WINDOWS - -// Utilities for char. - -// isspace(int ch) and friends accept an unsigned char or EOF. char -// may be signed, depending on the compiler (or compiler flags). -// Therefore we need to cast a char to unsigned char before calling -// isspace(), etc. - -inline bool IsAlpha(char ch) { - return isalpha(static_cast<unsigned char>(ch)) != 0; -} -inline bool IsAlNum(char ch) { - return isalnum(static_cast<unsigned char>(ch)) != 0; -} -inline bool IsDigit(char ch) { - return isdigit(static_cast<unsigned char>(ch)) != 0; -} -inline bool IsLower(char ch) { - return islower(static_cast<unsigned char>(ch)) != 0; -} -inline bool IsSpace(char ch) { - return isspace(static_cast<unsigned char>(ch)) != 0; -} -inline bool IsUpper(char ch) { - return isupper(static_cast<unsigned char>(ch)) != 0; -} -inline bool IsXDigit(char ch) { - return isxdigit(static_cast<unsigned char>(ch)) != 0; -} -inline bool IsXDigit(wchar_t ch) { - const unsigned char low_byte = static_cast<unsigned char>(ch); - return ch == low_byte && isxdigit(low_byte) != 0; -} - -inline char ToLower(char ch) { - return static_cast<char>(tolower(static_cast<unsigned char>(ch))); -} -inline char ToUpper(char ch) { - return static_cast<char>(toupper(static_cast<unsigned char>(ch))); -} - -inline std::string StripTrailingSpaces(std::string str) { - std::string::iterator it = str.end(); - while (it != str.begin() && IsSpace(*--it)) - it = str.erase(it); - return str; -} - -// The testing::internal::posix namespace holds wrappers for common -// POSIX functions. These wrappers hide the differences between -// Windows/MSVC and POSIX systems. Since some compilers define these -// standard functions as macros, the wrapper cannot have the same name -// as the wrapped function. - -namespace posix { - -// Functions with a different name on Windows. - -#if GTEST_OS_WINDOWS - -typedef struct _stat StatStruct; - -# ifdef __BORLANDC__ -inline int IsATTY(int fd) { return isatty(fd); } -inline int StrCaseCmp(const char* s1, const char* s2) { - return stricmp(s1, s2); -} -inline char* StrDup(const char* src) { return strdup(src); } -# else // !__BORLANDC__ -# if GTEST_OS_WINDOWS_MOBILE -inline int IsATTY(int /* fd */) { return 0; } -# else -inline int IsATTY(int fd) { return _isatty(fd); } -# endif // GTEST_OS_WINDOWS_MOBILE -inline int StrCaseCmp(const char* s1, const char* s2) { - return _stricmp(s1, s2); -} -inline char* StrDup(const char* src) { return _strdup(src); } -# endif // __BORLANDC__ - -# if GTEST_OS_WINDOWS_MOBILE -inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); } -// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this -// time and thus not defined there. -# else -inline int FileNo(FILE* file) { return _fileno(file); } -inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); } -inline int RmDir(const char* dir) { return _rmdir(dir); } -inline bool IsDir(const StatStruct& st) { - return (_S_IFDIR & st.st_mode) != 0; -} -# endif // GTEST_OS_WINDOWS_MOBILE - -#else - -typedef struct stat StatStruct; - -inline int FileNo(FILE* file) { return fileno(file); } -inline int IsATTY(int fd) { return isatty(fd); } -inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf); } -inline int StrCaseCmp(const char* s1, const char* s2) { - return strcasecmp(s1, s2); -} -inline char* StrDup(const char* src) { return strdup(src); } -inline int RmDir(const char* dir) { return rmdir(dir); } -inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); } - -#endif // GTEST_OS_WINDOWS - -// Functions deprecated by MSVC 8.0. - -GTEST_DISABLE_MSC_DEPRECATED_PUSH_() - -inline const char* StrNCpy(char* dest, const char* src, size_t n) { - return strncpy(dest, src, n); -} - -// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and -// StrError() aren't needed on Windows CE at this time and thus not -// defined there. - -#if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT -inline int ChDir(const char* dir) { return chdir(dir); } -#endif -inline FILE* FOpen(const char* path, const char* mode) { - return fopen(path, mode); -} -#if !GTEST_OS_WINDOWS_MOBILE -inline FILE *FReopen(const char* path, const char* mode, FILE* stream) { - return freopen(path, mode, stream); -} -inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); } -#endif -inline int FClose(FILE* fp) { return fclose(fp); } -#if !GTEST_OS_WINDOWS_MOBILE -inline int Read(int fd, void* buf, unsigned int count) { - return static_cast<int>(read(fd, buf, count)); -} -inline int Write(int fd, const void* buf, unsigned int count) { - return static_cast<int>(write(fd, buf, count)); -} -inline int Close(int fd) { return close(fd); } -inline const char* StrError(int errnum) { return strerror(errnum); } -#endif -inline const char* GetEnv(const char* name) { -#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT - // We are on Windows CE, which has no environment variables. - static_cast<void>(name); // To prevent 'unused argument' warning. - return nullptr; -#elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9) - // Environment variables which we programmatically clear will be set to the - // empty string rather than unset (NULL). Handle that case. - const char* const env = getenv(name); - return (env != nullptr && env[0] != '\0') ? env : nullptr; -#else - return getenv(name); -#endif -} - -GTEST_DISABLE_MSC_DEPRECATED_POP_() - -#if GTEST_OS_WINDOWS_MOBILE -// Windows CE has no C library. The abort() function is used in -// several places in Google Test. This implementation provides a reasonable -// imitation of standard behaviour. -[[noreturn]] void Abort(); -#else -[[noreturn]] inline void Abort() { abort(); } -#endif // GTEST_OS_WINDOWS_MOBILE - -} // namespace posix - -// MSVC "deprecates" snprintf and issues warnings wherever it is used. In -// order to avoid these warnings, we need to use _snprintf or _snprintf_s on -// MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate -// function in order to achieve that. We use macro definition here because -// snprintf is a variadic function. -#if _MSC_VER && !GTEST_OS_WINDOWS_MOBILE -// MSVC 2005 and above support variadic macros. -# define GTEST_SNPRINTF_(buffer, size, format, ...) \ - _snprintf_s(buffer, size, size, format, __VA_ARGS__) -#elif defined(_MSC_VER) -// Windows CE does not define _snprintf_s -# define GTEST_SNPRINTF_ _snprintf -#else -# define GTEST_SNPRINTF_ snprintf -#endif - -// The maximum number a BiggestInt can represent. This definition -// works no matter BiggestInt is represented in one's complement or -// two's complement. -// -// We cannot rely on numeric_limits in STL, as __int64 and long long -// are not part of standard C++ and numeric_limits doesn't need to be -// defined for them. -const BiggestInt kMaxBiggestInt = - ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1)); - -// This template class serves as a compile-time function from size to -// type. It maps a size in bytes to a primitive type with that -// size. e.g. -// -// TypeWithSize<4>::UInt -// -// is typedef-ed to be unsigned int (unsigned integer made up of 4 -// bytes). -// -// Such functionality should belong to STL, but I cannot find it -// there. -// -// Google Test uses this class in the implementation of floating-point -// comparison. -// -// For now it only handles UInt (unsigned int) as that's all Google Test -// needs. Other types can be easily added in the future if need -// arises. -template <size_t size> -class TypeWithSize { - public: - // This prevents the user from using TypeWithSize<N> with incorrect - // values of N. - typedef void UInt; -}; - -// The specialization for size 4. -template <> -class TypeWithSize<4> { - public: - // unsigned int has size 4 in both gcc and MSVC. - // - // As base/basictypes.h doesn't compile on Windows, we cannot use - // uint32, uint64, and etc here. - typedef int Int; - typedef unsigned int UInt; -}; - -// The specialization for size 8. -template <> -class TypeWithSize<8> { - public: -#if GTEST_OS_WINDOWS - typedef __int64 Int; - typedef unsigned __int64 UInt; -#else - typedef long long Int; // NOLINT - typedef unsigned long long UInt; // NOLINT -#endif // GTEST_OS_WINDOWS -}; - -// Integer types of known sizes. -typedef TypeWithSize<4>::Int Int32; -typedef TypeWithSize<4>::UInt UInt32; -typedef TypeWithSize<8>::Int Int64; -typedef TypeWithSize<8>::UInt UInt64; -typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds. - -// Utilities for command line flags and environment variables. - -// Macro for referencing flags. -#if !defined(GTEST_FLAG) -# define GTEST_FLAG(name) FLAGS_gtest_##name -#endif // !defined(GTEST_FLAG) - -#if !defined(GTEST_USE_OWN_FLAGFILE_FLAG_) -# define GTEST_USE_OWN_FLAGFILE_FLAG_ 1 -#endif // !defined(GTEST_USE_OWN_FLAGFILE_FLAG_) - -#if !defined(GTEST_DECLARE_bool_) -# define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver - -// Macros for declaring flags. -# define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name) -# define GTEST_DECLARE_int32_(name) \ - GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name) -# define GTEST_DECLARE_string_(name) \ - GTEST_API_ extern ::std::string GTEST_FLAG(name) - -// Macros for defining flags. -# define GTEST_DEFINE_bool_(name, default_val, doc) \ - GTEST_API_ bool GTEST_FLAG(name) = (default_val) -# define GTEST_DEFINE_int32_(name, default_val, doc) \ - GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val) -# define GTEST_DEFINE_string_(name, default_val, doc) \ - GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val) - -#endif // !defined(GTEST_DECLARE_bool_) - -// Thread annotations -#if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_) -# define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) -# define GTEST_LOCK_EXCLUDED_(locks) -#endif // !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_) - -// Parses 'str' for a 32-bit signed integer. If successful, writes the result -// to *value and returns true; otherwise leaves *value unchanged and returns -// false. -bool ParseInt32(const Message& src_text, const char* str, Int32* value); - -// Parses a bool/Int32/string from the environment variable -// corresponding to the given Google Test flag. -bool BoolFromGTestEnv(const char* flag, bool default_val); -GTEST_API_ Int32 Int32FromGTestEnv(const char* flag, Int32 default_val); -std::string OutputFlagAlsoCheckEnvVar(); -const char* StringFromGTestEnv(const char* flag, const char* default_val); - -} // namespace internal -} // namespace testing - -#if !defined(GTEST_INTERNAL_DEPRECATED) - -// Internal Macro to mark an API deprecated, for googletest usage only -// Usage: class GTEST_INTERNAL_DEPRECATED(message) MyClass or -// GTEST_INTERNAL_DEPRECATED(message) <return_type> myFunction(); Every usage of -// a deprecated entity will trigger a warning when compiled with -// `-Wdeprecated-declarations` option (clang, gcc, any __GNUC__ compiler). -// For msvc /W3 option will need to be used -// Note that for 'other' compilers this macro evaluates to nothing to prevent -// compilations errors. -#if defined(_MSC_VER) -#define GTEST_INTERNAL_DEPRECATED(message) __declspec(deprecated(message)) -#elif defined(__GNUC__) -#define GTEST_INTERNAL_DEPRECATED(message) __attribute__((deprecated(message))) -#else -#define GTEST_INTERNAL_DEPRECATED(message) -#endif - -#endif // !defined(GTEST_INTERNAL_DEPRECATED) - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/gtest-string.h b/3rdParty/googletest/googletest/include/gtest/internal/gtest-string.h deleted file mode 100644 index 82aaa63bf4657569772b45746c390bcf1206ab56..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/gtest-string.h +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// The Google C++ Testing and Mocking Framework (Google Test) -// -// This header file declares the String class and functions used internally by -// Google Test. They are subject to change without notice. They should not used -// by code external to Google Test. -// -// This header file is #included by gtest-internal.h. -// It should not be #included by other files. - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ - -#ifdef __BORLANDC__ -// string.h is not guaranteed to provide strcpy on C++ Builder. -# include <mem.h> -#endif - -#include <string.h> -#include <string> - -#include "gtest/internal/gtest-port.h" - -namespace testing { -namespace internal { - -// String - an abstract class holding static string utilities. -class GTEST_API_ String { - public: - // Static utility methods - - // Clones a 0-terminated C string, allocating memory using new. The - // caller is responsible for deleting the return value using - // delete[]. Returns the cloned string, or NULL if the input is - // NULL. - // - // This is different from strdup() in string.h, which allocates - // memory using malloc(). - static const char* CloneCString(const char* c_str); - -#if GTEST_OS_WINDOWS_MOBILE - // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be - // able to pass strings to Win32 APIs on CE we need to convert them - // to 'Unicode', UTF-16. - - // Creates a UTF-16 wide string from the given ANSI string, allocating - // memory using new. The caller is responsible for deleting the return - // value using delete[]. Returns the wide string, or NULL if the - // input is NULL. - // - // The wide string is created using the ANSI codepage (CP_ACP) to - // match the behaviour of the ANSI versions of Win32 calls and the - // C runtime. - static LPCWSTR AnsiToUtf16(const char* c_str); - - // Creates an ANSI string from the given wide string, allocating - // memory using new. The caller is responsible for deleting the return - // value using delete[]. Returns the ANSI string, or NULL if the - // input is NULL. - // - // The returned string is created using the ANSI codepage (CP_ACP) to - // match the behaviour of the ANSI versions of Win32 calls and the - // C runtime. - static const char* Utf16ToAnsi(LPCWSTR utf16_str); -#endif - - // Compares two C strings. Returns true if and only if they have the same - // content. - // - // Unlike strcmp(), this function can handle NULL argument(s). A - // NULL C string is considered different to any non-NULL C string, - // including the empty string. - static bool CStringEquals(const char* lhs, const char* rhs); - - // Converts a wide C string to a String using the UTF-8 encoding. - // NULL will be converted to "(null)". If an error occurred during - // the conversion, "(failed to convert from wide string)" is - // returned. - static std::string ShowWideCString(const wchar_t* wide_c_str); - - // Compares two wide C strings. Returns true if and only if they have the - // same content. - // - // Unlike wcscmp(), this function can handle NULL argument(s). A - // NULL C string is considered different to any non-NULL C string, - // including the empty string. - static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs); - - // Compares two C strings, ignoring case. Returns true if and only if - // they have the same content. - // - // Unlike strcasecmp(), this function can handle NULL argument(s). - // A NULL C string is considered different to any non-NULL C string, - // including the empty string. - static bool CaseInsensitiveCStringEquals(const char* lhs, - const char* rhs); - - // Compares two wide C strings, ignoring case. Returns true if and only if - // they have the same content. - // - // Unlike wcscasecmp(), this function can handle NULL argument(s). - // A NULL C string is considered different to any non-NULL wide C string, - // including the empty string. - // NB: The implementations on different platforms slightly differ. - // On windows, this method uses _wcsicmp which compares according to LC_CTYPE - // environment variable. On GNU platform this method uses wcscasecmp - // which compares according to LC_CTYPE category of the current locale. - // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the - // current locale. - static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs, - const wchar_t* rhs); - - // Returns true if and only if the given string ends with the given suffix, - // ignoring case. Any string is considered to end with an empty suffix. - static bool EndsWithCaseInsensitive( - const std::string& str, const std::string& suffix); - - // Formats an int value as "%02d". - static std::string FormatIntWidth2(int value); // "%02d" for width == 2 - - // Formats an int value as "%X". - static std::string FormatHexInt(int value); - - // Formats an int value as "%X". - static std::string FormatHexUInt32(UInt32 value); - - // Formats a byte as "%02X". - static std::string FormatByte(unsigned char value); - - private: - String(); // Not meant to be instantiated. -}; // class String - -// Gets the content of the stringstream's buffer as an std::string. Each '\0' -// character in the buffer is replaced with "\\0". -GTEST_API_ std::string StringStreamToString(::std::stringstream* stream); - -} // namespace internal -} // namespace testing - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/gtest-type-util.h b/3rdParty/googletest/googletest/include/gtest/internal/gtest-type-util.h deleted file mode 100644 index 3d7542d1fb3502bc22d6b844fb438be83d442aa3..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/gtest-type-util.h +++ /dev/null @@ -1,3335 +0,0 @@ -// This file was GENERATED by command: -// pump.py gtest-type-util.h.pump -// DO NOT EDIT BY HAND!!! - -// Copyright 2008 Google Inc. -// All Rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Type utilities needed for implementing typed and type-parameterized -// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND! -// -// Currently we support at most 50 types in a list, and at most 50 -// type-parameterized tests in one type-parameterized test suite. -// Please contact googletestframework@googlegroups.com if you need -// more. - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ - -#include "gtest/internal/gtest-port.h" - -// #ifdef __GNUC__ is too general here. It is possible to use gcc without using -// libstdc++ (which is where cxxabi.h comes from). -# if GTEST_HAS_CXXABI_H_ -# include <cxxabi.h> -# elif defined(__HP_aCC) -# include <acxx_demangle.h> -# endif // GTEST_HASH_CXXABI_H_ - -namespace testing { -namespace internal { - -// Canonicalizes a given name with respect to the Standard C++ Library. -// This handles removing the inline namespace within `std` that is -// used by various standard libraries (e.g., `std::__1`). Names outside -// of namespace std are returned unmodified. -inline std::string CanonicalizeForStdLibVersioning(std::string s) { - static const char prefix[] = "std::__"; - if (s.compare(0, strlen(prefix), prefix) == 0) { - std::string::size_type end = s.find("::", strlen(prefix)); - if (end != s.npos) { - // Erase everything between the initial `std` and the second `::`. - s.erase(strlen("std"), end - strlen("std")); - } - } - return s; -} - -// GetTypeName<T>() returns a human-readable name of type T. -// NB: This function is also used in Google Mock, so don't move it inside of -// the typed-test-only section below. -template <typename T> -std::string GetTypeName() { -# if GTEST_HAS_RTTI - - const char* const name = typeid(T).name(); -# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC) - int status = 0; - // gcc's implementation of typeid(T).name() mangles the type name, - // so we have to demangle it. -# if GTEST_HAS_CXXABI_H_ - using abi::__cxa_demangle; -# endif // GTEST_HAS_CXXABI_H_ - char* const readable_name = __cxa_demangle(name, nullptr, nullptr, &status); - const std::string name_str(status == 0 ? readable_name : name); - free(readable_name); - return CanonicalizeForStdLibVersioning(name_str); -# else - return name; -# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC - -# else - - return "<type>"; - -# endif // GTEST_HAS_RTTI -} - -#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P - -// A unique type used as the default value for the arguments of class -// template Types. This allows us to simulate variadic templates -// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't -// support directly. -struct None {}; - -// The following family of struct and struct templates are used to -// represent type lists. In particular, TypesN<T1, T2, ..., TN> -// represents a type list with N types (T1, T2, ..., and TN) in it. -// Except for Types0, every struct in the family has two member types: -// Head for the first type in the list, and Tail for the rest of the -// list. - -// The empty type list. -struct Types0 {}; - -// Type lists of length 1, 2, 3, and so on. - -template <typename T1> -struct Types1 { - typedef T1 Head; - typedef Types0 Tail; -}; -template <typename T1, typename T2> -struct Types2 { - typedef T1 Head; - typedef Types1<T2> Tail; -}; - -template <typename T1, typename T2, typename T3> -struct Types3 { - typedef T1 Head; - typedef Types2<T2, T3> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4> -struct Types4 { - typedef T1 Head; - typedef Types3<T2, T3, T4> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5> -struct Types5 { - typedef T1 Head; - typedef Types4<T2, T3, T4, T5> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6> -struct Types6 { - typedef T1 Head; - typedef Types5<T2, T3, T4, T5, T6> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7> -struct Types7 { - typedef T1 Head; - typedef Types6<T2, T3, T4, T5, T6, T7> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8> -struct Types8 { - typedef T1 Head; - typedef Types7<T2, T3, T4, T5, T6, T7, T8> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9> -struct Types9 { - typedef T1 Head; - typedef Types8<T2, T3, T4, T5, T6, T7, T8, T9> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10> -struct Types10 { - typedef T1 Head; - typedef Types9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11> -struct Types11 { - typedef T1 Head; - typedef Types10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12> -struct Types12 { - typedef T1 Head; - typedef Types11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13> -struct Types13 { - typedef T1 Head; - typedef Types12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14> -struct Types14 { - typedef T1 Head; - typedef Types13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15> -struct Types15 { - typedef T1 Head; - typedef Types14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16> -struct Types16 { - typedef T1 Head; - typedef Types15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17> -struct Types17 { - typedef T1 Head; - typedef Types16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18> -struct Types18 { - typedef T1 Head; - typedef Types17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19> -struct Types19 { - typedef T1 Head; - typedef Types18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20> -struct Types20 { - typedef T1 Head; - typedef Types19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21> -struct Types21 { - typedef T1 Head; - typedef Types20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22> -struct Types22 { - typedef T1 Head; - typedef Types21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23> -struct Types23 { - typedef T1 Head; - typedef Types22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24> -struct Types24 { - typedef T1 Head; - typedef Types23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25> -struct Types25 { - typedef T1 Head; - typedef Types24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26> -struct Types26 { - typedef T1 Head; - typedef Types25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27> -struct Types27 { - typedef T1 Head; - typedef Types26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28> -struct Types28 { - typedef T1 Head; - typedef Types27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29> -struct Types29 { - typedef T1 Head; - typedef Types28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30> -struct Types30 { - typedef T1 Head; - typedef Types29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31> -struct Types31 { - typedef T1 Head; - typedef Types30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32> -struct Types32 { - typedef T1 Head; - typedef Types31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33> -struct Types33 { - typedef T1 Head; - typedef Types32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34> -struct Types34 { - typedef T1 Head; - typedef Types33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35> -struct Types35 { - typedef T1 Head; - typedef Types34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36> -struct Types36 { - typedef T1 Head; - typedef Types35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37> -struct Types37 { - typedef T1 Head; - typedef Types36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38> -struct Types38 { - typedef T1 Head; - typedef Types37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39> -struct Types39 { - typedef T1 Head; - typedef Types38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40> -struct Types40 { - typedef T1 Head; - typedef Types39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41> -struct Types41 { - typedef T1 Head; - typedef Types40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42> -struct Types42 { - typedef T1 Head; - typedef Types41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43> -struct Types43 { - typedef T1 Head; - typedef Types42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44> -struct Types44 { - typedef T1 Head; - typedef Types43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45> -struct Types45 { - typedef T1 Head; - typedef Types44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46> -struct Types46 { - typedef T1 Head; - typedef Types45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47> -struct Types47 { - typedef T1 Head; - typedef Types46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46, T47> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48> -struct Types48 { - typedef T1 Head; - typedef Types47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46, T47, T48> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48, typename T49> -struct Types49 { - typedef T1 Head; - typedef Types48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46, T47, T48, T49> Tail; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48, typename T49, typename T50> -struct Types50 { - typedef T1 Head; - typedef Types49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46, T47, T48, T49, T50> Tail; -}; - - -} // namespace internal - -// We don't want to require the users to write TypesN<...> directly, -// as that would require them to count the length. Types<...> is much -// easier to write, but generates horrible messages when there is a -// compiler error, as gcc insists on printing out each template -// argument, even if it has the default value (this means Types<int> -// will appear as Types<int, None, None, ..., None> in the compiler -// errors). -// -// Our solution is to combine the best part of the two approaches: a -// user would write Types<T1, ..., TN>, and Google Test will translate -// that to TypesN<T1, ..., TN> internally to make error messages -// readable. The translation is done by the 'type' member of the -// Types template. -template <typename T1 = internal::None, typename T2 = internal::None, - typename T3 = internal::None, typename T4 = internal::None, - typename T5 = internal::None, typename T6 = internal::None, - typename T7 = internal::None, typename T8 = internal::None, - typename T9 = internal::None, typename T10 = internal::None, - typename T11 = internal::None, typename T12 = internal::None, - typename T13 = internal::None, typename T14 = internal::None, - typename T15 = internal::None, typename T16 = internal::None, - typename T17 = internal::None, typename T18 = internal::None, - typename T19 = internal::None, typename T20 = internal::None, - typename T21 = internal::None, typename T22 = internal::None, - typename T23 = internal::None, typename T24 = internal::None, - typename T25 = internal::None, typename T26 = internal::None, - typename T27 = internal::None, typename T28 = internal::None, - typename T29 = internal::None, typename T30 = internal::None, - typename T31 = internal::None, typename T32 = internal::None, - typename T33 = internal::None, typename T34 = internal::None, - typename T35 = internal::None, typename T36 = internal::None, - typename T37 = internal::None, typename T38 = internal::None, - typename T39 = internal::None, typename T40 = internal::None, - typename T41 = internal::None, typename T42 = internal::None, - typename T43 = internal::None, typename T44 = internal::None, - typename T45 = internal::None, typename T46 = internal::None, - typename T47 = internal::None, typename T48 = internal::None, - typename T49 = internal::None, typename T50 = internal::None> -struct Types { - typedef internal::Types50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46, T47, T48, T49, T50> type; -}; - -template <> -struct Types<internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types0 type; -}; -template <typename T1> -struct Types<T1, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types1<T1> type; -}; -template <typename T1, typename T2> -struct Types<T1, T2, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types2<T1, T2> type; -}; -template <typename T1, typename T2, typename T3> -struct Types<T1, T2, T3, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types3<T1, T2, T3> type; -}; -template <typename T1, typename T2, typename T3, typename T4> -struct Types<T1, T2, T3, T4, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types4<T1, T2, T3, T4> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5> -struct Types<T1, T2, T3, T4, T5, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types5<T1, T2, T3, T4, T5> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6> -struct Types<T1, T2, T3, T4, T5, T6, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types6<T1, T2, T3, T4, T5, T6> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7> -struct Types<T1, T2, T3, T4, T5, T6, T7, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types7<T1, T2, T3, T4, T5, T6, T7> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types8<T1, T2, T3, T4, T5, T6, T7, T8> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, - T12> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, - T26> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, - T40> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, internal::None, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None, internal::None> { - typedef internal::Types43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - internal::None, internal::None, internal::None, internal::None, - internal::None, internal::None> { - typedef internal::Types44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, - internal::None, internal::None, internal::None, internal::None, - internal::None> { - typedef internal::Types45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, - T46, internal::None, internal::None, internal::None, internal::None> { - typedef internal::Types46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, - T46, T47, internal::None, internal::None, internal::None> { - typedef internal::Types47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46, T47> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, - T46, T47, T48, internal::None, internal::None> { - typedef internal::Types48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46, T47, T48> type; -}; -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48, typename T49> -struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, - T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, - T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, - T46, T47, T48, T49, internal::None> { - typedef internal::Types49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46, T47, T48, T49> type; -}; - -namespace internal { - -# define GTEST_TEMPLATE_ template <typename T> class - -// The template "selector" struct TemplateSel<Tmpl> is used to -// represent Tmpl, which must be a class template with one type -// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined -// as the type Tmpl<T>. This allows us to actually instantiate the -// template "selected" by TemplateSel<Tmpl>. -// -// This trick is necessary for simulating typedef for class templates, -// which C++ doesn't support directly. -template <GTEST_TEMPLATE_ Tmpl> -struct TemplateSel { - template <typename T> - struct Bind { - typedef Tmpl<T> type; - }; -}; - -# define GTEST_BIND_(TmplSel, T) \ - TmplSel::template Bind<T>::type - -// A unique struct template used as the default value for the -// arguments of class template Templates. This allows us to simulate -// variadic templates (e.g. Templates<int>, Templates<int, double>, -// and etc), which C++ doesn't support directly. -template <typename T> -struct NoneT {}; - -// The following family of struct and struct templates are used to -// represent template lists. In particular, TemplatesN<T1, T2, ..., -// TN> represents a list of N templates (T1, T2, ..., and TN). Except -// for Templates0, every struct in the family has two member types: -// Head for the selector of the first template in the list, and Tail -// for the rest of the list. - -// The empty template list. -struct Templates0 {}; - -// Template lists of length 1, 2, 3, and so on. - -template <GTEST_TEMPLATE_ T1> -struct Templates1 { - typedef TemplateSel<T1> Head; - typedef Templates0 Tail; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2> -struct Templates2 { - typedef TemplateSel<T1> Head; - typedef Templates1<T2> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3> -struct Templates3 { - typedef TemplateSel<T1> Head; - typedef Templates2<T2, T3> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4> -struct Templates4 { - typedef TemplateSel<T1> Head; - typedef Templates3<T2, T3, T4> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5> -struct Templates5 { - typedef TemplateSel<T1> Head; - typedef Templates4<T2, T3, T4, T5> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6> -struct Templates6 { - typedef TemplateSel<T1> Head; - typedef Templates5<T2, T3, T4, T5, T6> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7> -struct Templates7 { - typedef TemplateSel<T1> Head; - typedef Templates6<T2, T3, T4, T5, T6, T7> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8> -struct Templates8 { - typedef TemplateSel<T1> Head; - typedef Templates7<T2, T3, T4, T5, T6, T7, T8> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9> -struct Templates9 { - typedef TemplateSel<T1> Head; - typedef Templates8<T2, T3, T4, T5, T6, T7, T8, T9> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10> -struct Templates10 { - typedef TemplateSel<T1> Head; - typedef Templates9<T2, T3, T4, T5, T6, T7, T8, T9, T10> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11> -struct Templates11 { - typedef TemplateSel<T1> Head; - typedef Templates10<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12> -struct Templates12 { - typedef TemplateSel<T1> Head; - typedef Templates11<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13> -struct Templates13 { - typedef TemplateSel<T1> Head; - typedef Templates12<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14> -struct Templates14 { - typedef TemplateSel<T1> Head; - typedef Templates13<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15> -struct Templates15 { - typedef TemplateSel<T1> Head; - typedef Templates14<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16> -struct Templates16 { - typedef TemplateSel<T1> Head; - typedef Templates15<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17> -struct Templates17 { - typedef TemplateSel<T1> Head; - typedef Templates16<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18> -struct Templates18 { - typedef TemplateSel<T1> Head; - typedef Templates17<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19> -struct Templates19 { - typedef TemplateSel<T1> Head; - typedef Templates18<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20> -struct Templates20 { - typedef TemplateSel<T1> Head; - typedef Templates19<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21> -struct Templates21 { - typedef TemplateSel<T1> Head; - typedef Templates20<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22> -struct Templates22 { - typedef TemplateSel<T1> Head; - typedef Templates21<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23> -struct Templates23 { - typedef TemplateSel<T1> Head; - typedef Templates22<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24> -struct Templates24 { - typedef TemplateSel<T1> Head; - typedef Templates23<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25> -struct Templates25 { - typedef TemplateSel<T1> Head; - typedef Templates24<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26> -struct Templates26 { - typedef TemplateSel<T1> Head; - typedef Templates25<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27> -struct Templates27 { - typedef TemplateSel<T1> Head; - typedef Templates26<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28> -struct Templates28 { - typedef TemplateSel<T1> Head; - typedef Templates27<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29> -struct Templates29 { - typedef TemplateSel<T1> Head; - typedef Templates28<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30> -struct Templates30 { - typedef TemplateSel<T1> Head; - typedef Templates29<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31> -struct Templates31 { - typedef TemplateSel<T1> Head; - typedef Templates30<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32> -struct Templates32 { - typedef TemplateSel<T1> Head; - typedef Templates31<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33> -struct Templates33 { - typedef TemplateSel<T1> Head; - typedef Templates32<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34> -struct Templates34 { - typedef TemplateSel<T1> Head; - typedef Templates33<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35> -struct Templates35 { - typedef TemplateSel<T1> Head; - typedef Templates34<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36> -struct Templates36 { - typedef TemplateSel<T1> Head; - typedef Templates35<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37> -struct Templates37 { - typedef TemplateSel<T1> Head; - typedef Templates36<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38> -struct Templates38 { - typedef TemplateSel<T1> Head; - typedef Templates37<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39> -struct Templates39 { - typedef TemplateSel<T1> Head; - typedef Templates38<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40> -struct Templates40 { - typedef TemplateSel<T1> Head; - typedef Templates39<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41> -struct Templates41 { - typedef TemplateSel<T1> Head; - typedef Templates40<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42> -struct Templates42 { - typedef TemplateSel<T1> Head; - typedef Templates41<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43> -struct Templates43 { - typedef TemplateSel<T1> Head; - typedef Templates42<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44> -struct Templates44 { - typedef TemplateSel<T1> Head; - typedef Templates43<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45> -struct Templates45 { - typedef TemplateSel<T1> Head; - typedef Templates44<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46> -struct Templates46 { - typedef TemplateSel<T1> Head; - typedef Templates45<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45, T46> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47> -struct Templates47 { - typedef TemplateSel<T1> Head; - typedef Templates46<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45, T46, T47> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48> -struct Templates48 { - typedef TemplateSel<T1> Head; - typedef Templates47<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45, T46, T47, T48> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48, - GTEST_TEMPLATE_ T49> -struct Templates49 { - typedef TemplateSel<T1> Head; - typedef Templates48<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45, T46, T47, T48, T49> Tail; -}; - -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48, - GTEST_TEMPLATE_ T49, GTEST_TEMPLATE_ T50> -struct Templates50 { - typedef TemplateSel<T1> Head; - typedef Templates49<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, - T43, T44, T45, T46, T47, T48, T49, T50> Tail; -}; - - -// We don't want to require the users to write TemplatesN<...> directly, -// as that would require them to count the length. Templates<...> is much -// easier to write, but generates horrible messages when there is a -// compiler error, as gcc insists on printing out each template -// argument, even if it has the default value (this means Templates<list> -// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler -// errors). -// -// Our solution is to combine the best part of the two approaches: a -// user would write Templates<T1, ..., TN>, and Google Test will translate -// that to TemplatesN<T1, ..., TN> internally to make error messages -// readable. The translation is done by the 'type' member of the -// Templates template. -template <GTEST_TEMPLATE_ T1 = NoneT, GTEST_TEMPLATE_ T2 = NoneT, - GTEST_TEMPLATE_ T3 = NoneT, GTEST_TEMPLATE_ T4 = NoneT, - GTEST_TEMPLATE_ T5 = NoneT, GTEST_TEMPLATE_ T6 = NoneT, - GTEST_TEMPLATE_ T7 = NoneT, GTEST_TEMPLATE_ T8 = NoneT, - GTEST_TEMPLATE_ T9 = NoneT, GTEST_TEMPLATE_ T10 = NoneT, - GTEST_TEMPLATE_ T11 = NoneT, GTEST_TEMPLATE_ T12 = NoneT, - GTEST_TEMPLATE_ T13 = NoneT, GTEST_TEMPLATE_ T14 = NoneT, - GTEST_TEMPLATE_ T15 = NoneT, GTEST_TEMPLATE_ T16 = NoneT, - GTEST_TEMPLATE_ T17 = NoneT, GTEST_TEMPLATE_ T18 = NoneT, - GTEST_TEMPLATE_ T19 = NoneT, GTEST_TEMPLATE_ T20 = NoneT, - GTEST_TEMPLATE_ T21 = NoneT, GTEST_TEMPLATE_ T22 = NoneT, - GTEST_TEMPLATE_ T23 = NoneT, GTEST_TEMPLATE_ T24 = NoneT, - GTEST_TEMPLATE_ T25 = NoneT, GTEST_TEMPLATE_ T26 = NoneT, - GTEST_TEMPLATE_ T27 = NoneT, GTEST_TEMPLATE_ T28 = NoneT, - GTEST_TEMPLATE_ T29 = NoneT, GTEST_TEMPLATE_ T30 = NoneT, - GTEST_TEMPLATE_ T31 = NoneT, GTEST_TEMPLATE_ T32 = NoneT, - GTEST_TEMPLATE_ T33 = NoneT, GTEST_TEMPLATE_ T34 = NoneT, - GTEST_TEMPLATE_ T35 = NoneT, GTEST_TEMPLATE_ T36 = NoneT, - GTEST_TEMPLATE_ T37 = NoneT, GTEST_TEMPLATE_ T38 = NoneT, - GTEST_TEMPLATE_ T39 = NoneT, GTEST_TEMPLATE_ T40 = NoneT, - GTEST_TEMPLATE_ T41 = NoneT, GTEST_TEMPLATE_ T42 = NoneT, - GTEST_TEMPLATE_ T43 = NoneT, GTEST_TEMPLATE_ T44 = NoneT, - GTEST_TEMPLATE_ T45 = NoneT, GTEST_TEMPLATE_ T46 = NoneT, - GTEST_TEMPLATE_ T47 = NoneT, GTEST_TEMPLATE_ T48 = NoneT, - GTEST_TEMPLATE_ T49 = NoneT, GTEST_TEMPLATE_ T50 = NoneT> -struct Templates { - typedef Templates50<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45, T46, T47, T48, T49, T50> type; -}; - -template <> -struct Templates<NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT> { - typedef Templates0 type; -}; -template <GTEST_TEMPLATE_ T1> -struct Templates<T1, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT> { - typedef Templates1<T1> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2> -struct Templates<T1, T2, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT> { - typedef Templates2<T1, T2> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3> -struct Templates<T1, T2, T3, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates3<T1, T2, T3> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4> -struct Templates<T1, T2, T3, T4, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates4<T1, T2, T3, T4> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5> -struct Templates<T1, T2, T3, T4, T5, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates5<T1, T2, T3, T4, T5> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6> -struct Templates<T1, T2, T3, T4, T5, T6, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates6<T1, T2, T3, T4, T5, T6> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7> -struct Templates<T1, T2, T3, T4, T5, T6, T7, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates7<T1, T2, T3, T4, T5, T6, T7> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates8<T1, T2, T3, T4, T5, T6, T7, T8> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates9<T1, T2, T3, T4, T5, T6, T7, T8, T9> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT> { - typedef Templates18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT> { - typedef Templates19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT> { - typedef Templates20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT> { - typedef Templates21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT> { - typedef Templates22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT> { - typedef Templates23<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT> { - typedef Templates24<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT> { - typedef Templates25<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT> { - typedef Templates26<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT> { - typedef Templates27<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT> { - typedef Templates28<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT> { - typedef Templates29<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates30<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates31<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates32<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates33<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates34<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates35<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates36<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, NoneT, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates37<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, NoneT, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates38<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates39<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, NoneT, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, NoneT, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates41<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, NoneT, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates42<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates43<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - NoneT, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates44<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - T45, NoneT, NoneT, NoneT, NoneT, NoneT> { - typedef Templates45<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - T45, T46, NoneT, NoneT, NoneT, NoneT> { - typedef Templates46<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45, T46> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - T45, T46, T47, NoneT, NoneT, NoneT> { - typedef Templates47<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45, T46, T47> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - T45, T46, T47, T48, NoneT, NoneT> { - typedef Templates48<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45, T46, T47, T48> type; -}; -template <GTEST_TEMPLATE_ T1, GTEST_TEMPLATE_ T2, GTEST_TEMPLATE_ T3, - GTEST_TEMPLATE_ T4, GTEST_TEMPLATE_ T5, GTEST_TEMPLATE_ T6, - GTEST_TEMPLATE_ T7, GTEST_TEMPLATE_ T8, GTEST_TEMPLATE_ T9, - GTEST_TEMPLATE_ T10, GTEST_TEMPLATE_ T11, GTEST_TEMPLATE_ T12, - GTEST_TEMPLATE_ T13, GTEST_TEMPLATE_ T14, GTEST_TEMPLATE_ T15, - GTEST_TEMPLATE_ T16, GTEST_TEMPLATE_ T17, GTEST_TEMPLATE_ T18, - GTEST_TEMPLATE_ T19, GTEST_TEMPLATE_ T20, GTEST_TEMPLATE_ T21, - GTEST_TEMPLATE_ T22, GTEST_TEMPLATE_ T23, GTEST_TEMPLATE_ T24, - GTEST_TEMPLATE_ T25, GTEST_TEMPLATE_ T26, GTEST_TEMPLATE_ T27, - GTEST_TEMPLATE_ T28, GTEST_TEMPLATE_ T29, GTEST_TEMPLATE_ T30, - GTEST_TEMPLATE_ T31, GTEST_TEMPLATE_ T32, GTEST_TEMPLATE_ T33, - GTEST_TEMPLATE_ T34, GTEST_TEMPLATE_ T35, GTEST_TEMPLATE_ T36, - GTEST_TEMPLATE_ T37, GTEST_TEMPLATE_ T38, GTEST_TEMPLATE_ T39, - GTEST_TEMPLATE_ T40, GTEST_TEMPLATE_ T41, GTEST_TEMPLATE_ T42, - GTEST_TEMPLATE_ T43, GTEST_TEMPLATE_ T44, GTEST_TEMPLATE_ T45, - GTEST_TEMPLATE_ T46, GTEST_TEMPLATE_ T47, GTEST_TEMPLATE_ T48, - GTEST_TEMPLATE_ T49> -struct Templates<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, - T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, - T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, - T45, T46, T47, T48, T49, NoneT> { - typedef Templates49<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, - T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, - T42, T43, T44, T45, T46, T47, T48, T49> type; -}; - -// The TypeList template makes it possible to use either a single type -// or a Types<...> list in TYPED_TEST_SUITE() and -// INSTANTIATE_TYPED_TEST_SUITE_P(). - -template <typename T> -struct TypeList { - typedef Types1<T> type; -}; - -template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17, typename T18, typename T19, typename T20, - typename T21, typename T22, typename T23, typename T24, typename T25, - typename T26, typename T27, typename T28, typename T29, typename T30, - typename T31, typename T32, typename T33, typename T34, typename T35, - typename T36, typename T37, typename T38, typename T39, typename T40, - typename T41, typename T42, typename T43, typename T44, typename T45, - typename T46, typename T47, typename T48, typename T49, typename T50> -struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, - T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, - T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, - T44, T45, T46, T47, T48, T49, T50> > { - typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, - T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, - T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, - T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type; -}; - -#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P - -} // namespace internal -} // namespace testing - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ diff --git a/3rdParty/googletest/googletest/include/gtest/internal/gtest-type-util.h.pump b/3rdParty/googletest/googletest/include/gtest/internal/gtest-type-util.h.pump deleted file mode 100644 index 5e31b7b3206b284a3da32769faea0de185e054a8..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/include/gtest/internal/gtest-type-util.h.pump +++ /dev/null @@ -1,302 +0,0 @@ -$$ -*- mode: c++; -*- -$var n = 50 $$ Maximum length of type lists we want to support. -// Copyright 2008 Google Inc. -// All Rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Type utilities needed for implementing typed and type-parameterized -// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND! -// -// Currently we support at most $n types in a list, and at most $n -// type-parameterized tests in one type-parameterized test suite. -// Please contact googletestframework@googlegroups.com if you need -// more. - -// GOOGLETEST_CM0001 DO NOT DELETE - -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ - -#include "gtest/internal/gtest-port.h" - -// #ifdef __GNUC__ is too general here. It is possible to use gcc without using -// libstdc++ (which is where cxxabi.h comes from). -# if GTEST_HAS_CXXABI_H_ -# include <cxxabi.h> -# elif defined(__HP_aCC) -# include <acxx_demangle.h> -# endif // GTEST_HASH_CXXABI_H_ - -namespace testing { -namespace internal { - -// Canonicalizes a given name with respect to the Standard C++ Library. -// This handles removing the inline namespace within `std` that is -// used by various standard libraries (e.g., `std::__1`). Names outside -// of namespace std are returned unmodified. -inline std::string CanonicalizeForStdLibVersioning(std::string s) { - static const char prefix[] = "std::__"; - if (s.compare(0, strlen(prefix), prefix) == 0) { - std::string::size_type end = s.find("::", strlen(prefix)); - if (end != s.npos) { - // Erase everything between the initial `std` and the second `::`. - s.erase(strlen("std"), end - strlen("std")); - } - } - return s; -} - -// GetTypeName<T>() returns a human-readable name of type T. -// NB: This function is also used in Google Mock, so don't move it inside of -// the typed-test-only section below. -template <typename T> -std::string GetTypeName() { -# if GTEST_HAS_RTTI - - const char* const name = typeid(T).name(); -# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC) - int status = 0; - // gcc's implementation of typeid(T).name() mangles the type name, - // so we have to demangle it. -# if GTEST_HAS_CXXABI_H_ - using abi::__cxa_demangle; -# endif // GTEST_HAS_CXXABI_H_ - char* const readable_name = __cxa_demangle(name, nullptr, nullptr, &status); - const std::string name_str(status == 0 ? readable_name : name); - free(readable_name); - return CanonicalizeForStdLibVersioning(name_str); -# else - return name; -# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC - -# else - - return "<type>"; - -# endif // GTEST_HAS_RTTI -} - -#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P - -// A unique type used as the default value for the arguments of class -// template Types. This allows us to simulate variadic templates -// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't -// support directly. -struct None {}; - -// The following family of struct and struct templates are used to -// represent type lists. In particular, TypesN<T1, T2, ..., TN> -// represents a type list with N types (T1, T2, ..., and TN) in it. -// Except for Types0, every struct in the family has two member types: -// Head for the first type in the list, and Tail for the rest of the -// list. - -// The empty type list. -struct Types0 {}; - -// Type lists of length 1, 2, 3, and so on. - -template <typename T1> -struct Types1 { - typedef T1 Head; - typedef Types0 Tail; -}; - -$range i 2..n - -$for i [[ -$range j 1..i -$range k 2..i -template <$for j, [[typename T$j]]> -struct Types$i { - typedef T1 Head; - typedef Types$(i-1)<$for k, [[T$k]]> Tail; -}; - - -]] - -} // namespace internal - -// We don't want to require the users to write TypesN<...> directly, -// as that would require them to count the length. Types<...> is much -// easier to write, but generates horrible messages when there is a -// compiler error, as gcc insists on printing out each template -// argument, even if it has the default value (this means Types<int> -// will appear as Types<int, None, None, ..., None> in the compiler -// errors). -// -// Our solution is to combine the best part of the two approaches: a -// user would write Types<T1, ..., TN>, and Google Test will translate -// that to TypesN<T1, ..., TN> internally to make error messages -// readable. The translation is done by the 'type' member of the -// Types template. - -$range i 1..n -template <$for i, [[typename T$i = internal::None]]> -struct Types { - typedef internal::Types$n<$for i, [[T$i]]> type; -}; - -template <> -struct Types<$for i, [[internal::None]]> { - typedef internal::Types0 type; -}; - -$range i 1..n-1 -$for i [[ -$range j 1..i -$range k i+1..n -template <$for j, [[typename T$j]]> -struct Types<$for j, [[T$j]]$for k[[, internal::None]]> { - typedef internal::Types$i<$for j, [[T$j]]> type; -}; - -]] - -namespace internal { - -# define GTEST_TEMPLATE_ template <typename T> class - -// The template "selector" struct TemplateSel<Tmpl> is used to -// represent Tmpl, which must be a class template with one type -// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined -// as the type Tmpl<T>. This allows us to actually instantiate the -// template "selected" by TemplateSel<Tmpl>. -// -// This trick is necessary for simulating typedef for class templates, -// which C++ doesn't support directly. -template <GTEST_TEMPLATE_ Tmpl> -struct TemplateSel { - template <typename T> - struct Bind { - typedef Tmpl<T> type; - }; -}; - -# define GTEST_BIND_(TmplSel, T) \ - TmplSel::template Bind<T>::type - -// A unique struct template used as the default value for the -// arguments of class template Templates. This allows us to simulate -// variadic templates (e.g. Templates<int>, Templates<int, double>, -// and etc), which C++ doesn't support directly. -template <typename T> -struct NoneT {}; - -// The following family of struct and struct templates are used to -// represent template lists. In particular, TemplatesN<T1, T2, ..., -// TN> represents a list of N templates (T1, T2, ..., and TN). Except -// for Templates0, every struct in the family has two member types: -// Head for the selector of the first template in the list, and Tail -// for the rest of the list. - -// The empty template list. -struct Templates0 {}; - -// Template lists of length 1, 2, 3, and so on. - -template <GTEST_TEMPLATE_ T1> -struct Templates1 { - typedef TemplateSel<T1> Head; - typedef Templates0 Tail; -}; - -$range i 2..n - -$for i [[ -$range j 1..i -$range k 2..i -template <$for j, [[GTEST_TEMPLATE_ T$j]]> -struct Templates$i { - typedef TemplateSel<T1> Head; - typedef Templates$(i-1)<$for k, [[T$k]]> Tail; -}; - - -]] - -// We don't want to require the users to write TemplatesN<...> directly, -// as that would require them to count the length. Templates<...> is much -// easier to write, but generates horrible messages when there is a -// compiler error, as gcc insists on printing out each template -// argument, even if it has the default value (this means Templates<list> -// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler -// errors). -// -// Our solution is to combine the best part of the two approaches: a -// user would write Templates<T1, ..., TN>, and Google Test will translate -// that to TemplatesN<T1, ..., TN> internally to make error messages -// readable. The translation is done by the 'type' member of the -// Templates template. - -$range i 1..n -template <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]> -struct Templates { - typedef Templates$n<$for i, [[T$i]]> type; -}; - -template <> -struct Templates<$for i, [[NoneT]]> { - typedef Templates0 type; -}; - -$range i 1..n-1 -$for i [[ -$range j 1..i -$range k i+1..n -template <$for j, [[GTEST_TEMPLATE_ T$j]]> -struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> { - typedef Templates$i<$for j, [[T$j]]> type; -}; - -]] - -// The TypeList template makes it possible to use either a single type -// or a Types<...> list in TYPED_TEST_SUITE() and -// INSTANTIATE_TYPED_TEST_SUITE_P(). - -template <typename T> -struct TypeList { - typedef Types1<T> type; -}; - - -$range i 1..n -template <$for i, [[typename T$i]]> -struct TypeList<Types<$for i, [[T$i]]> > { - typedef typename Types<$for i, [[T$i]]>::type type; -}; - -#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P - -} // namespace internal -} // namespace testing - -#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_ diff --git a/3rdParty/googletest/googletest/src/gtest-all.cc b/3rdParty/googletest/googletest/src/gtest-all.cc deleted file mode 100644 index ad292905cf381d69eba9008f5196cf6477a56c1a..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/src/gtest-all.cc +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// Google C++ Testing and Mocking Framework (Google Test) -// -// Sometimes it's desirable to build Google Test by compiling a single file. -// This file serves this purpose. - -// This line ensures that gtest.h can be compiled on its own, even -// when it's fused. -#include "gtest/gtest.h" - -// The following lines pull in the real gtest *.cc files. -#include "src/gtest.cc" -#include "src/gtest-death-test.cc" -#include "src/gtest-filepath.cc" -#include "src/gtest-matchers.cc" -#include "src/gtest-port.cc" -#include "src/gtest-printers.cc" -#include "src/gtest-test-part.cc" -#include "src/gtest-typed-test.cc" diff --git a/3rdParty/googletest/googletest/src/gtest-death-test.cc b/3rdParty/googletest/googletest/src/gtest-death-test.cc deleted file mode 100644 index da09a1cfc23a550b14251ac0e0ba9a6a8375c535..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/src/gtest-death-test.cc +++ /dev/null @@ -1,1653 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// This file implements death tests. - -#include "gtest/gtest-death-test.h" - -#include <utility> - -#include "gtest/internal/gtest-port.h" -#include "gtest/internal/custom/gtest.h" - -#if GTEST_HAS_DEATH_TEST - -# if GTEST_OS_MAC -# include <crt_externs.h> -# endif // GTEST_OS_MAC - -# include <errno.h> -# include <fcntl.h> -# include <limits.h> - -# if GTEST_OS_LINUX -# include <signal.h> -# endif // GTEST_OS_LINUX - -# include <stdarg.h> - -# if GTEST_OS_WINDOWS -# include <windows.h> -# else -# include <sys/mman.h> -# include <sys/wait.h> -# endif // GTEST_OS_WINDOWS - -# if GTEST_OS_QNX -# include <spawn.h> -# endif // GTEST_OS_QNX - -# if GTEST_OS_FUCHSIA -# include <lib/fdio/fd.h> -# include <lib/fdio/io.h> -# include <lib/fdio/spawn.h> -# include <lib/zx/channel.h> -# include <lib/zx/port.h> -# include <lib/zx/process.h> -# include <lib/zx/socket.h> -# include <zircon/processargs.h> -# include <zircon/syscalls.h> -# include <zircon/syscalls/policy.h> -# include <zircon/syscalls/port.h> -# endif // GTEST_OS_FUCHSIA - -#endif // GTEST_HAS_DEATH_TEST - -#include "gtest/gtest-message.h" -#include "gtest/internal/gtest-string.h" -#include "src/gtest-internal-inl.h" - -namespace testing { - -// Constants. - -// The default death test style. -// -// This is defined in internal/gtest-port.h as "fast", but can be overridden by -// a definition in internal/custom/gtest-port.h. The recommended value, which is -// used internally at Google, is "threadsafe". -static const char kDefaultDeathTestStyle[] = GTEST_DEFAULT_DEATH_TEST_STYLE; - -GTEST_DEFINE_string_( - death_test_style, - internal::StringFromGTestEnv("death_test_style", kDefaultDeathTestStyle), - "Indicates how to run a death test in a forked child process: " - "\"threadsafe\" (child process re-executes the test binary " - "from the beginning, running only the specific death test) or " - "\"fast\" (child process runs the death test immediately " - "after forking)."); - -GTEST_DEFINE_bool_( - death_test_use_fork, - internal::BoolFromGTestEnv("death_test_use_fork", false), - "Instructs to use fork()/_exit() instead of clone() in death tests. " - "Ignored and always uses fork() on POSIX systems where clone() is not " - "implemented. Useful when running under valgrind or similar tools if " - "those do not support clone(). Valgrind 3.3.1 will just fail if " - "it sees an unsupported combination of clone() flags. " - "It is not recommended to use this flag w/o valgrind though it will " - "work in 99% of the cases. Once valgrind is fixed, this flag will " - "most likely be removed."); - -namespace internal { -GTEST_DEFINE_string_( - internal_run_death_test, "", - "Indicates the file, line number, temporal index of " - "the single death test to run, and a file descriptor to " - "which a success code may be sent, all separated by " - "the '|' characters. This flag is specified if and only if the " - "current process is a sub-process launched for running a thread-safe " - "death test. FOR INTERNAL USE ONLY."); -} // namespace internal - -#if GTEST_HAS_DEATH_TEST - -namespace internal { - -// Valid only for fast death tests. Indicates the code is running in the -// child process of a fast style death test. -# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA -static bool g_in_fast_death_test_child = false; -# endif - -// Returns a Boolean value indicating whether the caller is currently -// executing in the context of the death test child process. Tools such as -// Valgrind heap checkers may need this to modify their behavior in death -// tests. IMPORTANT: This is an internal utility. Using it may break the -// implementation of death tests. User code MUST NOT use it. -bool InDeathTestChild() { -# if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA - - // On Windows and Fuchsia, death tests are thread-safe regardless of the value - // of the death_test_style flag. - return !GTEST_FLAG(internal_run_death_test).empty(); - -# else - - if (GTEST_FLAG(death_test_style) == "threadsafe") - return !GTEST_FLAG(internal_run_death_test).empty(); - else - return g_in_fast_death_test_child; -#endif -} - -} // namespace internal - -// ExitedWithCode constructor. -ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) { -} - -// ExitedWithCode function-call operator. -bool ExitedWithCode::operator()(int exit_status) const { -# if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA - - return exit_status == exit_code_; - -# else - - return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_; - -# endif // GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA -} - -# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA -// KilledBySignal constructor. -KilledBySignal::KilledBySignal(int signum) : signum_(signum) { -} - -// KilledBySignal function-call operator. -bool KilledBySignal::operator()(int exit_status) const { -# if defined(GTEST_KILLED_BY_SIGNAL_OVERRIDE_) - { - bool result; - if (GTEST_KILLED_BY_SIGNAL_OVERRIDE_(signum_, exit_status, &result)) { - return result; - } - } -# endif // defined(GTEST_KILLED_BY_SIGNAL_OVERRIDE_) - return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_; -} -# endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA - -namespace internal { - -// Utilities needed for death tests. - -// Generates a textual description of a given exit code, in the format -// specified by wait(2). -static std::string ExitSummary(int exit_code) { - Message m; - -# if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA - - m << "Exited with exit status " << exit_code; - -# else - - if (WIFEXITED(exit_code)) { - m << "Exited with exit status " << WEXITSTATUS(exit_code); - } else if (WIFSIGNALED(exit_code)) { - m << "Terminated by signal " << WTERMSIG(exit_code); - } -# ifdef WCOREDUMP - if (WCOREDUMP(exit_code)) { - m << " (core dumped)"; - } -# endif -# endif // GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA - - return m.GetString(); -} - -// Returns true if exit_status describes a process that was terminated -// by a signal, or exited normally with a nonzero exit code. -bool ExitedUnsuccessfully(int exit_status) { - return !ExitedWithCode(0)(exit_status); -} - -# if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA -// Generates a textual failure message when a death test finds more than -// one thread running, or cannot determine the number of threads, prior -// to executing the given statement. It is the responsibility of the -// caller not to pass a thread_count of 1. -static std::string DeathTestThreadWarning(size_t thread_count) { - Message msg; - msg << "Death tests use fork(), which is unsafe particularly" - << " in a threaded context. For this test, " << GTEST_NAME_ << " "; - if (thread_count == 0) { - msg << "couldn't detect the number of threads."; - } else { - msg << "detected " << thread_count << " threads."; - } - msg << " See " - "https://github.com/google/googletest/blob/master/googletest/docs/" - "advanced.md#death-tests-and-threads" - << " for more explanation and suggested solutions, especially if" - << " this is the last message you see before your test times out."; - return msg.GetString(); -} -# endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA - -// Flag characters for reporting a death test that did not die. -static const char kDeathTestLived = 'L'; -static const char kDeathTestReturned = 'R'; -static const char kDeathTestThrew = 'T'; -static const char kDeathTestInternalError = 'I'; - -#if GTEST_OS_FUCHSIA - -// File descriptor used for the pipe in the child process. -static const int kFuchsiaReadPipeFd = 3; - -#endif - -// An enumeration describing all of the possible ways that a death test can -// conclude. DIED means that the process died while executing the test -// code; LIVED means that process lived beyond the end of the test code; -// RETURNED means that the test statement attempted to execute a return -// statement, which is not allowed; THREW means that the test statement -// returned control by throwing an exception. IN_PROGRESS means the test -// has not yet concluded. -enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW }; - -// Routine for aborting the program which is safe to call from an -// exec-style death test child process, in which case the error -// message is propagated back to the parent process. Otherwise, the -// message is simply printed to stderr. In either case, the program -// then exits with status 1. -static void DeathTestAbort(const std::string& message) { - // On a POSIX system, this function may be called from a threadsafe-style - // death test child process, which operates on a very small stack. Use - // the heap for any additional non-minuscule memory requirements. - const InternalRunDeathTestFlag* const flag = - GetUnitTestImpl()->internal_run_death_test_flag(); - if (flag != nullptr) { - FILE* parent = posix::FDOpen(flag->write_fd(), "w"); - fputc(kDeathTestInternalError, parent); - fprintf(parent, "%s", message.c_str()); - fflush(parent); - _exit(1); - } else { - fprintf(stderr, "%s", message.c_str()); - fflush(stderr); - posix::Abort(); - } -} - -// A replacement for CHECK that calls DeathTestAbort if the assertion -// fails. -# define GTEST_DEATH_TEST_CHECK_(expression) \ - do { \ - if (!::testing::internal::IsTrue(expression)) { \ - DeathTestAbort( \ - ::std::string("CHECK failed: File ") + __FILE__ + ", line " \ - + ::testing::internal::StreamableToString(__LINE__) + ": " \ - + #expression); \ - } \ - } while (::testing::internal::AlwaysFalse()) - -// This macro is similar to GTEST_DEATH_TEST_CHECK_, but it is meant for -// evaluating any system call that fulfills two conditions: it must return -// -1 on failure, and set errno to EINTR when it is interrupted and -// should be tried again. The macro expands to a loop that repeatedly -// evaluates the expression as long as it evaluates to -1 and sets -// errno to EINTR. If the expression evaluates to -1 but errno is -// something other than EINTR, DeathTestAbort is called. -# define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \ - do { \ - int gtest_retval; \ - do { \ - gtest_retval = (expression); \ - } while (gtest_retval == -1 && errno == EINTR); \ - if (gtest_retval == -1) { \ - DeathTestAbort( \ - ::std::string("CHECK failed: File ") + __FILE__ + ", line " \ - + ::testing::internal::StreamableToString(__LINE__) + ": " \ - + #expression + " != -1"); \ - } \ - } while (::testing::internal::AlwaysFalse()) - -// Returns the message describing the last system error in errno. -std::string GetLastErrnoDescription() { - return errno == 0 ? "" : posix::StrError(errno); -} - -// This is called from a death test parent process to read a failure -// message from the death test child process and log it with the FATAL -// severity. On Windows, the message is read from a pipe handle. On other -// platforms, it is read from a file descriptor. -static void FailFromInternalError(int fd) { - Message error; - char buffer[256]; - int num_read; - - do { - while ((num_read = posix::Read(fd, buffer, 255)) > 0) { - buffer[num_read] = '\0'; - error << buffer; - } - } while (num_read == -1 && errno == EINTR); - - if (num_read == 0) { - GTEST_LOG_(FATAL) << error.GetString(); - } else { - const int last_error = errno; - GTEST_LOG_(FATAL) << "Error while reading death test internal: " - << GetLastErrnoDescription() << " [" << last_error << "]"; - } -} - -// Death test constructor. Increments the running death test count -// for the current test. -DeathTest::DeathTest() { - TestInfo* const info = GetUnitTestImpl()->current_test_info(); - if (info == nullptr) { - DeathTestAbort("Cannot run a death test outside of a TEST or " - "TEST_F construct"); - } -} - -// Creates and returns a death test by dispatching to the current -// death test factory. -bool DeathTest::Create(const char* statement, - Matcher<const std::string&> matcher, const char* file, - int line, DeathTest** test) { - return GetUnitTestImpl()->death_test_factory()->Create( - statement, std::move(matcher), file, line, test); -} - -const char* DeathTest::LastMessage() { - return last_death_test_message_.c_str(); -} - -void DeathTest::set_last_death_test_message(const std::string& message) { - last_death_test_message_ = message; -} - -std::string DeathTest::last_death_test_message_; - -// Provides cross platform implementation for some death functionality. -class DeathTestImpl : public DeathTest { - protected: - DeathTestImpl(const char* a_statement, Matcher<const std::string&> matcher) - : statement_(a_statement), - matcher_(std::move(matcher)), - spawned_(false), - status_(-1), - outcome_(IN_PROGRESS), - read_fd_(-1), - write_fd_(-1) {} - - // read_fd_ is expected to be closed and cleared by a derived class. - ~DeathTestImpl() override { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); } - - void Abort(AbortReason reason) override; - bool Passed(bool status_ok) override; - - const char* statement() const { return statement_; } - bool spawned() const { return spawned_; } - void set_spawned(bool is_spawned) { spawned_ = is_spawned; } - int status() const { return status_; } - void set_status(int a_status) { status_ = a_status; } - DeathTestOutcome outcome() const { return outcome_; } - void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outcome; } - int read_fd() const { return read_fd_; } - void set_read_fd(int fd) { read_fd_ = fd; } - int write_fd() const { return write_fd_; } - void set_write_fd(int fd) { write_fd_ = fd; } - - // Called in the parent process only. Reads the result code of the death - // test child process via a pipe, interprets it to set the outcome_ - // member, and closes read_fd_. Outputs diagnostics and terminates in - // case of unexpected codes. - void ReadAndInterpretStatusByte(); - - // Returns stderr output from the child process. - virtual std::string GetErrorLogs(); - - private: - // The textual content of the code this object is testing. This class - // doesn't own this string and should not attempt to delete it. - const char* const statement_; - // A matcher that's expected to match the stderr output by the child process. - Matcher<const std::string&> matcher_; - // True if the death test child process has been successfully spawned. - bool spawned_; - // The exit status of the child process. - int status_; - // How the death test concluded. - DeathTestOutcome outcome_; - // Descriptor to the read end of the pipe to the child process. It is - // always -1 in the child process. The child keeps its write end of the - // pipe in write_fd_. - int read_fd_; - // Descriptor to the child's write end of the pipe to the parent process. - // It is always -1 in the parent process. The parent keeps its end of the - // pipe in read_fd_. - int write_fd_; -}; - -// Called in the parent process only. Reads the result code of the death -// test child process via a pipe, interprets it to set the outcome_ -// member, and closes read_fd_. Outputs diagnostics and terminates in -// case of unexpected codes. -void DeathTestImpl::ReadAndInterpretStatusByte() { - char flag; - int bytes_read; - - // The read() here blocks until data is available (signifying the - // failure of the death test) or until the pipe is closed (signifying - // its success), so it's okay to call this in the parent before - // the child process has exited. - do { - bytes_read = posix::Read(read_fd(), &flag, 1); - } while (bytes_read == -1 && errno == EINTR); - - if (bytes_read == 0) { - set_outcome(DIED); - } else if (bytes_read == 1) { - switch (flag) { - case kDeathTestReturned: - set_outcome(RETURNED); - break; - case kDeathTestThrew: - set_outcome(THREW); - break; - case kDeathTestLived: - set_outcome(LIVED); - break; - case kDeathTestInternalError: - FailFromInternalError(read_fd()); // Does not return. - break; - default: - GTEST_LOG_(FATAL) << "Death test child process reported " - << "unexpected status byte (" - << static_cast<unsigned int>(flag) << ")"; - } - } else { - GTEST_LOG_(FATAL) << "Read from death test child process failed: " - << GetLastErrnoDescription(); - } - GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Close(read_fd())); - set_read_fd(-1); -} - -std::string DeathTestImpl::GetErrorLogs() { - return GetCapturedStderr(); -} - -// Signals that the death test code which should have exited, didn't. -// Should be called only in a death test child process. -// Writes a status byte to the child's status file descriptor, then -// calls _exit(1). -void DeathTestImpl::Abort(AbortReason reason) { - // The parent process considers the death test to be a failure if - // it finds any data in our pipe. So, here we write a single flag byte - // to the pipe, then exit. - const char status_ch = - reason == TEST_DID_NOT_DIE ? kDeathTestLived : - reason == TEST_THREW_EXCEPTION ? kDeathTestThrew : kDeathTestReturned; - - GTEST_DEATH_TEST_CHECK_SYSCALL_(posix::Write(write_fd(), &status_ch, 1)); - // We are leaking the descriptor here because on some platforms (i.e., - // when built as Windows DLL), destructors of global objects will still - // run after calling _exit(). On such systems, write_fd_ will be - // indirectly closed from the destructor of UnitTestImpl, causing double - // close if it is also closed here. On debug configurations, double close - // may assert. As there are no in-process buffers to flush here, we are - // relying on the OS to close the descriptor after the process terminates - // when the destructors are not run. - _exit(1); // Exits w/o any normal exit hooks (we were supposed to crash) -} - -// Returns an indented copy of stderr output for a death test. -// This makes distinguishing death test output lines from regular log lines -// much easier. -static ::std::string FormatDeathTestOutput(const ::std::string& output) { - ::std::string ret; - for (size_t at = 0; ; ) { - const size_t line_end = output.find('\n', at); - ret += "[ DEATH ] "; - if (line_end == ::std::string::npos) { - ret += output.substr(at); - break; - } - ret += output.substr(at, line_end + 1 - at); - at = line_end + 1; - } - return ret; -} - -// Assesses the success or failure of a death test, using both private -// members which have previously been set, and one argument: -// -// Private data members: -// outcome: An enumeration describing how the death test -// concluded: DIED, LIVED, THREW, or RETURNED. The death test -// fails in the latter three cases. -// status: The exit status of the child process. On *nix, it is in the -// in the format specified by wait(2). On Windows, this is the -// value supplied to the ExitProcess() API or a numeric code -// of the exception that terminated the program. -// matcher_: A matcher that's expected to match the stderr output by the child -// process. -// -// Argument: -// status_ok: true if exit_status is acceptable in the context of -// this particular death test, which fails if it is false -// -// Returns true if and only if all of the above conditions are met. Otherwise, -// the first failing condition, in the order given above, is the one that is -// reported. Also sets the last death test message string. -bool DeathTestImpl::Passed(bool status_ok) { - if (!spawned()) - return false; - - const std::string error_message = GetErrorLogs(); - - bool success = false; - Message buffer; - - buffer << "Death test: " << statement() << "\n"; - switch (outcome()) { - case LIVED: - buffer << " Result: failed to die.\n" - << " Error msg:\n" << FormatDeathTestOutput(error_message); - break; - case THREW: - buffer << " Result: threw an exception.\n" - << " Error msg:\n" << FormatDeathTestOutput(error_message); - break; - case RETURNED: - buffer << " Result: illegal return in test statement.\n" - << " Error msg:\n" << FormatDeathTestOutput(error_message); - break; - case DIED: - if (status_ok) { - if (matcher_.Matches(error_message)) { - success = true; - } else { - std::ostringstream stream; - matcher_.DescribeTo(&stream); - buffer << " Result: died but not with expected error.\n" - << " Expected: " << stream.str() << "\n" - << "Actual msg:\n" - << FormatDeathTestOutput(error_message); - } - } else { - buffer << " Result: died but not with expected exit code:\n" - << " " << ExitSummary(status()) << "\n" - << "Actual msg:\n" << FormatDeathTestOutput(error_message); - } - break; - case IN_PROGRESS: - default: - GTEST_LOG_(FATAL) - << "DeathTest::Passed somehow called before conclusion of test"; - } - - DeathTest::set_last_death_test_message(buffer.GetString()); - return success; -} - -# if GTEST_OS_WINDOWS -// WindowsDeathTest implements death tests on Windows. Due to the -// specifics of starting new processes on Windows, death tests there are -// always threadsafe, and Google Test considers the -// --gtest_death_test_style=fast setting to be equivalent to -// --gtest_death_test_style=threadsafe there. -// -// A few implementation notes: Like the Linux version, the Windows -// implementation uses pipes for child-to-parent communication. But due to -// the specifics of pipes on Windows, some extra steps are required: -// -// 1. The parent creates a communication pipe and stores handles to both -// ends of it. -// 2. The parent starts the child and provides it with the information -// necessary to acquire the handle to the write end of the pipe. -// 3. The child acquires the write end of the pipe and signals the parent -// using a Windows event. -// 4. Now the parent can release the write end of the pipe on its side. If -// this is done before step 3, the object's reference count goes down to -// 0 and it is destroyed, preventing the child from acquiring it. The -// parent now has to release it, or read operations on the read end of -// the pipe will not return when the child terminates. -// 5. The parent reads child's output through the pipe (outcome code and -// any possible error messages) from the pipe, and its stderr and then -// determines whether to fail the test. -// -// Note: to distinguish Win32 API calls from the local method and function -// calls, the former are explicitly resolved in the global namespace. -// -class WindowsDeathTest : public DeathTestImpl { - public: - WindowsDeathTest(const char* a_statement, Matcher<const std::string&> matcher, - const char* file, int line) - : DeathTestImpl(a_statement, std::move(matcher)), - file_(file), - line_(line) {} - - // All of these virtual functions are inherited from DeathTest. - virtual int Wait(); - virtual TestRole AssumeRole(); - - private: - // The name of the file in which the death test is located. - const char* const file_; - // The line number on which the death test is located. - const int line_; - // Handle to the write end of the pipe to the child process. - AutoHandle write_handle_; - // Child process handle. - AutoHandle child_handle_; - // Event the child process uses to signal the parent that it has - // acquired the handle to the write end of the pipe. After seeing this - // event the parent can release its own handles to make sure its - // ReadFile() calls return when the child terminates. - AutoHandle event_handle_; -}; - -// Waits for the child in a death test to exit, returning its exit -// status, or 0 if no child process exists. As a side effect, sets the -// outcome data member. -int WindowsDeathTest::Wait() { - if (!spawned()) - return 0; - - // Wait until the child either signals that it has acquired the write end - // of the pipe or it dies. - const HANDLE wait_handles[2] = { child_handle_.Get(), event_handle_.Get() }; - switch (::WaitForMultipleObjects(2, - wait_handles, - FALSE, // Waits for any of the handles. - INFINITE)) { - case WAIT_OBJECT_0: - case WAIT_OBJECT_0 + 1: - break; - default: - GTEST_DEATH_TEST_CHECK_(false); // Should not get here. - } - - // The child has acquired the write end of the pipe or exited. - // We release the handle on our side and continue. - write_handle_.Reset(); - event_handle_.Reset(); - - ReadAndInterpretStatusByte(); - - // Waits for the child process to exit if it haven't already. This - // returns immediately if the child has already exited, regardless of - // whether previous calls to WaitForMultipleObjects synchronized on this - // handle or not. - GTEST_DEATH_TEST_CHECK_( - WAIT_OBJECT_0 == ::WaitForSingleObject(child_handle_.Get(), - INFINITE)); - DWORD status_code; - GTEST_DEATH_TEST_CHECK_( - ::GetExitCodeProcess(child_handle_.Get(), &status_code) != FALSE); - child_handle_.Reset(); - set_status(static_cast<int>(status_code)); - return status(); -} - -// The AssumeRole process for a Windows death test. It creates a child -// process with the same executable as the current process to run the -// death test. The child process is given the --gtest_filter and -// --gtest_internal_run_death_test flags such that it knows to run the -// current death test only. -DeathTest::TestRole WindowsDeathTest::AssumeRole() { - const UnitTestImpl* const impl = GetUnitTestImpl(); - const InternalRunDeathTestFlag* const flag = - impl->internal_run_death_test_flag(); - const TestInfo* const info = impl->current_test_info(); - const int death_test_index = info->result()->death_test_count(); - - if (flag != nullptr) { - // ParseInternalRunDeathTestFlag() has performed all the necessary - // processing. - set_write_fd(flag->write_fd()); - return EXECUTE_TEST; - } - - // WindowsDeathTest uses an anonymous pipe to communicate results of - // a death test. - SECURITY_ATTRIBUTES handles_are_inheritable = {sizeof(SECURITY_ATTRIBUTES), - nullptr, TRUE}; - HANDLE read_handle, write_handle; - GTEST_DEATH_TEST_CHECK_( - ::CreatePipe(&read_handle, &write_handle, &handles_are_inheritable, - 0) // Default buffer size. - != FALSE); - set_read_fd(::_open_osfhandle(reinterpret_cast<intptr_t>(read_handle), - O_RDONLY)); - write_handle_.Reset(write_handle); - event_handle_.Reset(::CreateEvent( - &handles_are_inheritable, - TRUE, // The event will automatically reset to non-signaled state. - FALSE, // The initial state is non-signalled. - nullptr)); // The even is unnamed. - GTEST_DEATH_TEST_CHECK_(event_handle_.Get() != nullptr); - const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ + - kFilterFlag + "=" + info->test_suite_name() + - "." + info->name(); - const std::string internal_flag = - std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + - "=" + file_ + "|" + StreamableToString(line_) + "|" + - StreamableToString(death_test_index) + "|" + - StreamableToString(static_cast<unsigned int>(::GetCurrentProcessId())) + - // size_t has the same width as pointers on both 32-bit and 64-bit - // Windows platforms. - // See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx. - "|" + StreamableToString(reinterpret_cast<size_t>(write_handle)) + - "|" + StreamableToString(reinterpret_cast<size_t>(event_handle_.Get())); - - char executable_path[_MAX_PATH + 1]; // NOLINT - GTEST_DEATH_TEST_CHECK_(_MAX_PATH + 1 != ::GetModuleFileNameA(nullptr, - executable_path, - _MAX_PATH)); - - std::string command_line = - std::string(::GetCommandLineA()) + " " + filter_flag + " \"" + - internal_flag + "\""; - - DeathTest::set_last_death_test_message(""); - - CaptureStderr(); - // Flush the log buffers since the log streams are shared with the child. - FlushInfoLog(); - - // The child process will share the standard handles with the parent. - STARTUPINFOA startup_info; - memset(&startup_info, 0, sizeof(STARTUPINFO)); - startup_info.dwFlags = STARTF_USESTDHANDLES; - startup_info.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE); - startup_info.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE); - startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE); - - PROCESS_INFORMATION process_info; - GTEST_DEATH_TEST_CHECK_( - ::CreateProcessA( - executable_path, const_cast<char*>(command_line.c_str()), - nullptr, // Retuned process handle is not inheritable. - nullptr, // Retuned thread handle is not inheritable. - TRUE, // Child inherits all inheritable handles (for write_handle_). - 0x0, // Default creation flags. - nullptr, // Inherit the parent's environment. - UnitTest::GetInstance()->original_working_dir(), &startup_info, - &process_info) != FALSE); - child_handle_.Reset(process_info.hProcess); - ::CloseHandle(process_info.hThread); - set_spawned(true); - return OVERSEE_TEST; -} - -# elif GTEST_OS_FUCHSIA - -class FuchsiaDeathTest : public DeathTestImpl { - public: - FuchsiaDeathTest(const char* a_statement, Matcher<const std::string&> matcher, - const char* file, int line) - : DeathTestImpl(a_statement, std::move(matcher)), - file_(file), - line_(line) {} - - // All of these virtual functions are inherited from DeathTest. - int Wait() override; - TestRole AssumeRole() override; - std::string GetErrorLogs() override; - - private: - // The name of the file in which the death test is located. - const char* const file_; - // The line number on which the death test is located. - const int line_; - // The stderr data captured by the child process. - std::string captured_stderr_; - - zx::process child_process_; - zx::channel exception_channel_; - zx::socket stderr_socket_; -}; - -// Utility class for accumulating command-line arguments. -class Arguments { - public: - Arguments() { args_.push_back(nullptr); } - - ~Arguments() { - for (std::vector<char*>::iterator i = args_.begin(); i != args_.end(); - ++i) { - free(*i); - } - } - void AddArgument(const char* argument) { - args_.insert(args_.end() - 1, posix::StrDup(argument)); - } - - template <typename Str> - void AddArguments(const ::std::vector<Str>& arguments) { - for (typename ::std::vector<Str>::const_iterator i = arguments.begin(); - i != arguments.end(); - ++i) { - args_.insert(args_.end() - 1, posix::StrDup(i->c_str())); - } - } - char* const* Argv() { - return &args_[0]; - } - - int size() { - return args_.size() - 1; - } - - private: - std::vector<char*> args_; -}; - -// Waits for the child in a death test to exit, returning its exit -// status, or 0 if no child process exists. As a side effect, sets the -// outcome data member. -int FuchsiaDeathTest::Wait() { - const int kProcessKey = 0; - const int kSocketKey = 1; - const int kExceptionKey = 2; - - if (!spawned()) - return 0; - - // Create a port to wait for socket/task/exception events. - zx_status_t status_zx; - zx::port port; - status_zx = zx::port::create(0, &port); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - // Register to wait for the child process to terminate. - status_zx = child_process_.wait_async( - port, kProcessKey, ZX_PROCESS_TERMINATED, ZX_WAIT_ASYNC_ONCE); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - // Register to wait for the socket to be readable or closed. - status_zx = stderr_socket_.wait_async( - port, kSocketKey, ZX_SOCKET_READABLE | ZX_SOCKET_PEER_CLOSED, - ZX_WAIT_ASYNC_ONCE); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - // Register to wait for an exception. - status_zx = exception_channel_.wait_async( - port, kExceptionKey, ZX_CHANNEL_READABLE, ZX_WAIT_ASYNC_ONCE); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - bool process_terminated = false; - bool socket_closed = false; - do { - zx_port_packet_t packet = {}; - status_zx = port.wait(zx::time::infinite(), &packet); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - if (packet.key == kExceptionKey) { - // Process encountered an exception. Kill it directly rather than - // letting other handlers process the event. We will get a kProcessKey - // event when the process actually terminates. - status_zx = child_process_.kill(); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - } else if (packet.key == kProcessKey) { - // Process terminated. - GTEST_DEATH_TEST_CHECK_(ZX_PKT_IS_SIGNAL_ONE(packet.type)); - GTEST_DEATH_TEST_CHECK_(packet.signal.observed & ZX_PROCESS_TERMINATED); - process_terminated = true; - } else if (packet.key == kSocketKey) { - GTEST_DEATH_TEST_CHECK_(ZX_PKT_IS_SIGNAL_ONE(packet.type)); - if (packet.signal.observed & ZX_SOCKET_READABLE) { - // Read data from the socket. - constexpr size_t kBufferSize = 1024; - do { - size_t old_length = captured_stderr_.length(); - size_t bytes_read = 0; - captured_stderr_.resize(old_length + kBufferSize); - status_zx = stderr_socket_.read( - 0, &captured_stderr_.front() + old_length, kBufferSize, - &bytes_read); - captured_stderr_.resize(old_length + bytes_read); - } while (status_zx == ZX_OK); - if (status_zx == ZX_ERR_PEER_CLOSED) { - socket_closed = true; - } else { - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_ERR_SHOULD_WAIT); - status_zx = stderr_socket_.wait_async( - port, kSocketKey, ZX_SOCKET_READABLE | ZX_SOCKET_PEER_CLOSED, - ZX_WAIT_ASYNC_ONCE); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - } - } else { - GTEST_DEATH_TEST_CHECK_(packet.signal.observed & ZX_SOCKET_PEER_CLOSED); - socket_closed = true; - } - } - } while (!process_terminated && !socket_closed); - - ReadAndInterpretStatusByte(); - - zx_info_process_t buffer; - status_zx = child_process_.get_info( - ZX_INFO_PROCESS, &buffer, sizeof(buffer), nullptr, nullptr); - GTEST_DEATH_TEST_CHECK_(status_zx == ZX_OK); - - GTEST_DEATH_TEST_CHECK_(buffer.exited); - set_status(buffer.return_code); - return status(); -} - -// The AssumeRole process for a Fuchsia death test. It creates a child -// process with the same executable as the current process to run the -// death test. The child process is given the --gtest_filter and -// --gtest_internal_run_death_test flags such that it knows to run the -// current death test only. -DeathTest::TestRole FuchsiaDeathTest::AssumeRole() { - const UnitTestImpl* const impl = GetUnitTestImpl(); - const InternalRunDeathTestFlag* const flag = - impl->internal_run_death_test_flag(); - const TestInfo* const info = impl->current_test_info(); - const int death_test_index = info->result()->death_test_count(); - - if (flag != nullptr) { - // ParseInternalRunDeathTestFlag() has performed all the necessary - // processing. - set_write_fd(kFuchsiaReadPipeFd); - return EXECUTE_TEST; - } - - // Flush the log buffers since the log streams are shared with the child. - FlushInfoLog(); - - // Build the child process command line. - const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ + - kFilterFlag + "=" + info->test_suite_name() + - "." + info->name(); - const std::string internal_flag = - std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "=" - + file_ + "|" - + StreamableToString(line_) + "|" - + StreamableToString(death_test_index); - Arguments args; - args.AddArguments(GetInjectableArgvs()); - args.AddArgument(filter_flag.c_str()); - args.AddArgument(internal_flag.c_str()); - - // Build the pipe for communication with the child. - zx_status_t status; - zx_handle_t child_pipe_handle; - int child_pipe_fd; - status = fdio_pipe_half(&child_pipe_fd, &child_pipe_handle); - GTEST_DEATH_TEST_CHECK_(status == ZX_OK); - set_read_fd(child_pipe_fd); - - // Set the pipe handle for the child. - fdio_spawn_action_t spawn_actions[2] = {}; - fdio_spawn_action_t* add_handle_action = &spawn_actions[0]; - add_handle_action->action = FDIO_SPAWN_ACTION_ADD_HANDLE; - add_handle_action->h.id = PA_HND(PA_FD, kFuchsiaReadPipeFd); - add_handle_action->h.handle = child_pipe_handle; - - // Create a socket pair will be used to receive the child process' stderr. - zx::socket stderr_producer_socket; - status = - zx::socket::create(0, &stderr_producer_socket, &stderr_socket_); - GTEST_DEATH_TEST_CHECK_(status >= 0); - int stderr_producer_fd = -1; - status = - fdio_fd_create(stderr_producer_socket.release(), &stderr_producer_fd); - GTEST_DEATH_TEST_CHECK_(status >= 0); - - // Make the stderr socket nonblocking. - GTEST_DEATH_TEST_CHECK_(fcntl(stderr_producer_fd, F_SETFL, 0) == 0); - - fdio_spawn_action_t* add_stderr_action = &spawn_actions[1]; - add_stderr_action->action = FDIO_SPAWN_ACTION_CLONE_FD; - add_stderr_action->fd.local_fd = stderr_producer_fd; - add_stderr_action->fd.target_fd = STDERR_FILENO; - - // Create a child job. - zx_handle_t child_job = ZX_HANDLE_INVALID; - status = zx_job_create(zx_job_default(), 0, & child_job); - GTEST_DEATH_TEST_CHECK_(status == ZX_OK); - zx_policy_basic_t policy; - policy.condition = ZX_POL_NEW_ANY; - policy.policy = ZX_POL_ACTION_ALLOW; - status = zx_job_set_policy( - child_job, ZX_JOB_POL_RELATIVE, ZX_JOB_POL_BASIC, &policy, 1); - GTEST_DEATH_TEST_CHECK_(status == ZX_OK); - - // Create an exception channel attached to the |child_job|, to allow - // us to suppress the system default exception handler from firing. - status = - zx_task_create_exception_channel( - child_job, 0, exception_channel_.reset_and_get_address()); - GTEST_DEATH_TEST_CHECK_(status == ZX_OK); - - // Spawn the child process. - status = fdio_spawn_etc( - child_job, FDIO_SPAWN_CLONE_ALL, args.Argv()[0], args.Argv(), nullptr, - 2, spawn_actions, child_process_.reset_and_get_address(), nullptr); - GTEST_DEATH_TEST_CHECK_(status == ZX_OK); - - set_spawned(true); - return OVERSEE_TEST; -} - -std::string FuchsiaDeathTest::GetErrorLogs() { - return captured_stderr_; -} - -#else // We are neither on Windows, nor on Fuchsia. - -// ForkingDeathTest provides implementations for most of the abstract -// methods of the DeathTest interface. Only the AssumeRole method is -// left undefined. -class ForkingDeathTest : public DeathTestImpl { - public: - ForkingDeathTest(const char* statement, Matcher<const std::string&> matcher); - - // All of these virtual functions are inherited from DeathTest. - int Wait() override; - - protected: - void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; } - - private: - // PID of child process during death test; 0 in the child process itself. - pid_t child_pid_; -}; - -// Constructs a ForkingDeathTest. -ForkingDeathTest::ForkingDeathTest(const char* a_statement, - Matcher<const std::string&> matcher) - : DeathTestImpl(a_statement, std::move(matcher)), child_pid_(-1) {} - -// Waits for the child in a death test to exit, returning its exit -// status, or 0 if no child process exists. As a side effect, sets the -// outcome data member. -int ForkingDeathTest::Wait() { - if (!spawned()) - return 0; - - ReadAndInterpretStatusByte(); - - int status_value; - GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_value, 0)); - set_status(status_value); - return status_value; -} - -// A concrete death test class that forks, then immediately runs the test -// in the child process. -class NoExecDeathTest : public ForkingDeathTest { - public: - NoExecDeathTest(const char* a_statement, Matcher<const std::string&> matcher) - : ForkingDeathTest(a_statement, std::move(matcher)) {} - TestRole AssumeRole() override; -}; - -// The AssumeRole process for a fork-and-run death test. It implements a -// straightforward fork, with a simple pipe to transmit the status byte. -DeathTest::TestRole NoExecDeathTest::AssumeRole() { - const size_t thread_count = GetThreadCount(); - if (thread_count != 1) { - GTEST_LOG_(WARNING) << DeathTestThreadWarning(thread_count); - } - - int pipe_fd[2]; - GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1); - - DeathTest::set_last_death_test_message(""); - CaptureStderr(); - // When we fork the process below, the log file buffers are copied, but the - // file descriptors are shared. We flush all log files here so that closing - // the file descriptors in the child process doesn't throw off the - // synchronization between descriptors and buffers in the parent process. - // This is as close to the fork as possible to avoid a race condition in case - // there are multiple threads running before the death test, and another - // thread writes to the log file. - FlushInfoLog(); - - const pid_t child_pid = fork(); - GTEST_DEATH_TEST_CHECK_(child_pid != -1); - set_child_pid(child_pid); - if (child_pid == 0) { - GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0])); - set_write_fd(pipe_fd[1]); - // Redirects all logging to stderr in the child process to prevent - // concurrent writes to the log files. We capture stderr in the parent - // process and append the child process' output to a log. - LogToStderr(); - // Event forwarding to the listeners of event listener API mush be shut - // down in death test subprocesses. - GetUnitTestImpl()->listeners()->SuppressEventForwarding(); - g_in_fast_death_test_child = true; - return EXECUTE_TEST; - } else { - GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1])); - set_read_fd(pipe_fd[0]); - set_spawned(true); - return OVERSEE_TEST; - } -} - -// A concrete death test class that forks and re-executes the main -// program from the beginning, with command-line flags set that cause -// only this specific death test to be run. -class ExecDeathTest : public ForkingDeathTest { - public: - ExecDeathTest(const char* a_statement, Matcher<const std::string&> matcher, - const char* file, int line) - : ForkingDeathTest(a_statement, std::move(matcher)), - file_(file), - line_(line) {} - TestRole AssumeRole() override; - - private: - static ::std::vector<std::string> GetArgvsForDeathTestChildProcess() { - ::std::vector<std::string> args = GetInjectableArgvs(); -# if defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_) - ::std::vector<std::string> extra_args = - GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_(); - args.insert(args.end(), extra_args.begin(), extra_args.end()); -# endif // defined(GTEST_EXTRA_DEATH_TEST_COMMAND_LINE_ARGS_) - return args; - } - // The name of the file in which the death test is located. - const char* const file_; - // The line number on which the death test is located. - const int line_; -}; - -// Utility class for accumulating command-line arguments. -class Arguments { - public: - Arguments() { args_.push_back(nullptr); } - - ~Arguments() { - for (std::vector<char*>::iterator i = args_.begin(); i != args_.end(); - ++i) { - free(*i); - } - } - void AddArgument(const char* argument) { - args_.insert(args_.end() - 1, posix::StrDup(argument)); - } - - template <typename Str> - void AddArguments(const ::std::vector<Str>& arguments) { - for (typename ::std::vector<Str>::const_iterator i = arguments.begin(); - i != arguments.end(); - ++i) { - args_.insert(args_.end() - 1, posix::StrDup(i->c_str())); - } - } - char* const* Argv() { - return &args_[0]; - } - - private: - std::vector<char*> args_; -}; - -// A struct that encompasses the arguments to the child process of a -// threadsafe-style death test process. -struct ExecDeathTestArgs { - char* const* argv; // Command-line arguments for the child's call to exec - int close_fd; // File descriptor to close; the read end of a pipe -}; - -# if GTEST_OS_MAC -inline char** GetEnviron() { - // When Google Test is built as a framework on MacOS X, the environ variable - // is unavailable. Apple's documentation (man environ) recommends using - // _NSGetEnviron() instead. - return *_NSGetEnviron(); -} -# else -// Some POSIX platforms expect you to declare environ. extern "C" makes -// it reside in the global namespace. -extern "C" char** environ; -inline char** GetEnviron() { return environ; } -# endif // GTEST_OS_MAC - -# if !GTEST_OS_QNX -// The main function for a threadsafe-style death test child process. -// This function is called in a clone()-ed process and thus must avoid -// any potentially unsafe operations like malloc or libc functions. -static int ExecDeathTestChildMain(void* child_arg) { - ExecDeathTestArgs* const args = static_cast<ExecDeathTestArgs*>(child_arg); - GTEST_DEATH_TEST_CHECK_SYSCALL_(close(args->close_fd)); - - // We need to execute the test program in the same environment where - // it was originally invoked. Therefore we change to the original - // working directory first. - const char* const original_dir = - UnitTest::GetInstance()->original_working_dir(); - // We can safely call chdir() as it's a direct system call. - if (chdir(original_dir) != 0) { - DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " + - GetLastErrnoDescription()); - return EXIT_FAILURE; - } - - // We can safely call execve() as it's a direct system call. We - // cannot use execvp() as it's a libc function and thus potentially - // unsafe. Since execve() doesn't search the PATH, the user must - // invoke the test program via a valid path that contains at least - // one path separator. - execve(args->argv[0], args->argv, GetEnviron()); - DeathTestAbort(std::string("execve(") + args->argv[0] + ", ...) in " + - original_dir + " failed: " + - GetLastErrnoDescription()); - return EXIT_FAILURE; -} -# endif // !GTEST_OS_QNX - -# if GTEST_HAS_CLONE -// Two utility routines that together determine the direction the stack -// grows. -// This could be accomplished more elegantly by a single recursive -// function, but we want to guard against the unlikely possibility of -// a smart compiler optimizing the recursion away. -// -// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining -// StackLowerThanAddress into StackGrowsDown, which then doesn't give -// correct answer. -static void StackLowerThanAddress(const void* ptr, - bool* result) GTEST_NO_INLINE_; -// HWAddressSanitizer add a random tag to the MSB of the local variable address, -// making comparison result unpredictable. -GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -static void StackLowerThanAddress(const void* ptr, bool* result) { - int dummy; - *result = (&dummy < ptr); -} - -// Make sure AddressSanitizer does not tamper with the stack here. -GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -static bool StackGrowsDown() { - int dummy; - bool result; - StackLowerThanAddress(&dummy, &result); - return result; -} -# endif // GTEST_HAS_CLONE - -// Spawns a child process with the same executable as the current process in -// a thread-safe manner and instructs it to run the death test. The -// implementation uses fork(2) + exec. On systems where clone(2) is -// available, it is used instead, being slightly more thread-safe. On QNX, -// fork supports only single-threaded environments, so this function uses -// spawn(2) there instead. The function dies with an error message if -// anything goes wrong. -static pid_t ExecDeathTestSpawnChild(char* const* argv, int close_fd) { - ExecDeathTestArgs args = { argv, close_fd }; - pid_t child_pid = -1; - -# if GTEST_OS_QNX - // Obtains the current directory and sets it to be closed in the child - // process. - const int cwd_fd = open(".", O_RDONLY); - GTEST_DEATH_TEST_CHECK_(cwd_fd != -1); - GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(cwd_fd, F_SETFD, FD_CLOEXEC)); - // We need to execute the test program in the same environment where - // it was originally invoked. Therefore we change to the original - // working directory first. - const char* const original_dir = - UnitTest::GetInstance()->original_working_dir(); - // We can safely call chdir() as it's a direct system call. - if (chdir(original_dir) != 0) { - DeathTestAbort(std::string("chdir(\"") + original_dir + "\") failed: " + - GetLastErrnoDescription()); - return EXIT_FAILURE; - } - - int fd_flags; - // Set close_fd to be closed after spawn. - GTEST_DEATH_TEST_CHECK_SYSCALL_(fd_flags = fcntl(close_fd, F_GETFD)); - GTEST_DEATH_TEST_CHECK_SYSCALL_(fcntl(close_fd, F_SETFD, - fd_flags | FD_CLOEXEC)); - struct inheritance inherit = {0}; - // spawn is a system call. - child_pid = - spawn(args.argv[0], 0, nullptr, &inherit, args.argv, GetEnviron()); - // Restores the current working directory. - GTEST_DEATH_TEST_CHECK_(fchdir(cwd_fd) != -1); - GTEST_DEATH_TEST_CHECK_SYSCALL_(close(cwd_fd)); - -# else // GTEST_OS_QNX -# if GTEST_OS_LINUX - // When a SIGPROF signal is received while fork() or clone() are executing, - // the process may hang. To avoid this, we ignore SIGPROF here and re-enable - // it after the call to fork()/clone() is complete. - struct sigaction saved_sigprof_action; - struct sigaction ignore_sigprof_action; - memset(&ignore_sigprof_action, 0, sizeof(ignore_sigprof_action)); - sigemptyset(&ignore_sigprof_action.sa_mask); - ignore_sigprof_action.sa_handler = SIG_IGN; - GTEST_DEATH_TEST_CHECK_SYSCALL_(sigaction( - SIGPROF, &ignore_sigprof_action, &saved_sigprof_action)); -# endif // GTEST_OS_LINUX - -# if GTEST_HAS_CLONE - const bool use_fork = GTEST_FLAG(death_test_use_fork); - - if (!use_fork) { - static const bool stack_grows_down = StackGrowsDown(); - const auto stack_size = static_cast<size_t>(getpagesize()); - // MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead. - void* const stack = mmap(nullptr, stack_size, PROT_READ | PROT_WRITE, - MAP_ANON | MAP_PRIVATE, -1, 0); - GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED); - - // Maximum stack alignment in bytes: For a downward-growing stack, this - // amount is subtracted from size of the stack space to get an address - // that is within the stack space and is aligned on all systems we care - // about. As far as I know there is no ABI with stack alignment greater - // than 64. We assume stack and stack_size already have alignment of - // kMaxStackAlignment. - const size_t kMaxStackAlignment = 64; - void* const stack_top = - static_cast<char*>(stack) + - (stack_grows_down ? stack_size - kMaxStackAlignment : 0); - GTEST_DEATH_TEST_CHECK_( - static_cast<size_t>(stack_size) > kMaxStackAlignment && - reinterpret_cast<uintptr_t>(stack_top) % kMaxStackAlignment == 0); - - child_pid = clone(&ExecDeathTestChildMain, stack_top, SIGCHLD, &args); - - GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1); - } -# else - const bool use_fork = true; -# endif // GTEST_HAS_CLONE - - if (use_fork && (child_pid = fork()) == 0) { - ExecDeathTestChildMain(&args); - _exit(0); - } -# endif // GTEST_OS_QNX -# if GTEST_OS_LINUX - GTEST_DEATH_TEST_CHECK_SYSCALL_( - sigaction(SIGPROF, &saved_sigprof_action, nullptr)); -# endif // GTEST_OS_LINUX - - GTEST_DEATH_TEST_CHECK_(child_pid != -1); - return child_pid; -} - -// The AssumeRole process for a fork-and-exec death test. It re-executes the -// main program from the beginning, setting the --gtest_filter -// and --gtest_internal_run_death_test flags to cause only the current -// death test to be re-run. -DeathTest::TestRole ExecDeathTest::AssumeRole() { - const UnitTestImpl* const impl = GetUnitTestImpl(); - const InternalRunDeathTestFlag* const flag = - impl->internal_run_death_test_flag(); - const TestInfo* const info = impl->current_test_info(); - const int death_test_index = info->result()->death_test_count(); - - if (flag != nullptr) { - set_write_fd(flag->write_fd()); - return EXECUTE_TEST; - } - - int pipe_fd[2]; - GTEST_DEATH_TEST_CHECK_(pipe(pipe_fd) != -1); - // Clear the close-on-exec flag on the write end of the pipe, lest - // it be closed when the child process does an exec: - GTEST_DEATH_TEST_CHECK_(fcntl(pipe_fd[1], F_SETFD, 0) != -1); - - const std::string filter_flag = std::string("--") + GTEST_FLAG_PREFIX_ + - kFilterFlag + "=" + info->test_suite_name() + - "." + info->name(); - const std::string internal_flag = - std::string("--") + GTEST_FLAG_PREFIX_ + kInternalRunDeathTestFlag + "=" - + file_ + "|" + StreamableToString(line_) + "|" - + StreamableToString(death_test_index) + "|" - + StreamableToString(pipe_fd[1]); - Arguments args; - args.AddArguments(GetArgvsForDeathTestChildProcess()); - args.AddArgument(filter_flag.c_str()); - args.AddArgument(internal_flag.c_str()); - - DeathTest::set_last_death_test_message(""); - - CaptureStderr(); - // See the comment in NoExecDeathTest::AssumeRole for why the next line - // is necessary. - FlushInfoLog(); - - const pid_t child_pid = ExecDeathTestSpawnChild(args.Argv(), pipe_fd[0]); - GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1])); - set_child_pid(child_pid); - set_read_fd(pipe_fd[0]); - set_spawned(true); - return OVERSEE_TEST; -} - -# endif // !GTEST_OS_WINDOWS - -// Creates a concrete DeathTest-derived class that depends on the -// --gtest_death_test_style flag, and sets the pointer pointed to -// by the "test" argument to its address. If the test should be -// skipped, sets that pointer to NULL. Returns true, unless the -// flag is set to an invalid value. -bool DefaultDeathTestFactory::Create(const char* statement, - Matcher<const std::string&> matcher, - const char* file, int line, - DeathTest** test) { - UnitTestImpl* const impl = GetUnitTestImpl(); - const InternalRunDeathTestFlag* const flag = - impl->internal_run_death_test_flag(); - const int death_test_index = impl->current_test_info() - ->increment_death_test_count(); - - if (flag != nullptr) { - if (death_test_index > flag->index()) { - DeathTest::set_last_death_test_message( - "Death test count (" + StreamableToString(death_test_index) - + ") somehow exceeded expected maximum (" - + StreamableToString(flag->index()) + ")"); - return false; - } - - if (!(flag->file() == file && flag->line() == line && - flag->index() == death_test_index)) { - *test = nullptr; - return true; - } - } - -# if GTEST_OS_WINDOWS - - if (GTEST_FLAG(death_test_style) == "threadsafe" || - GTEST_FLAG(death_test_style) == "fast") { - *test = new WindowsDeathTest(statement, std::move(matcher), file, line); - } - -# elif GTEST_OS_FUCHSIA - - if (GTEST_FLAG(death_test_style) == "threadsafe" || - GTEST_FLAG(death_test_style) == "fast") { - *test = new FuchsiaDeathTest(statement, std::move(matcher), file, line); - } - -# else - - if (GTEST_FLAG(death_test_style) == "threadsafe") { - *test = new ExecDeathTest(statement, std::move(matcher), file, line); - } else if (GTEST_FLAG(death_test_style) == "fast") { - *test = new NoExecDeathTest(statement, std::move(matcher)); - } - -# endif // GTEST_OS_WINDOWS - - else { // NOLINT - this is more readable than unbalanced brackets inside #if. - DeathTest::set_last_death_test_message( - "Unknown death test style \"" + GTEST_FLAG(death_test_style) - + "\" encountered"); - return false; - } - - return true; -} - -# if GTEST_OS_WINDOWS -// Recreates the pipe and event handles from the provided parameters, -// signals the event, and returns a file descriptor wrapped around the pipe -// handle. This function is called in the child process only. -static int GetStatusFileDescriptor(unsigned int parent_process_id, - size_t write_handle_as_size_t, - size_t event_handle_as_size_t) { - AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE, - FALSE, // Non-inheritable. - parent_process_id)); - if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) { - DeathTestAbort("Unable to open parent process " + - StreamableToString(parent_process_id)); - } - - GTEST_CHECK_(sizeof(HANDLE) <= sizeof(size_t)); - - const HANDLE write_handle = - reinterpret_cast<HANDLE>(write_handle_as_size_t); - HANDLE dup_write_handle; - - // The newly initialized handle is accessible only in the parent - // process. To obtain one accessible within the child, we need to use - // DuplicateHandle. - if (!::DuplicateHandle(parent_process_handle.Get(), write_handle, - ::GetCurrentProcess(), &dup_write_handle, - 0x0, // Requested privileges ignored since - // DUPLICATE_SAME_ACCESS is used. - FALSE, // Request non-inheritable handler. - DUPLICATE_SAME_ACCESS)) { - DeathTestAbort("Unable to duplicate the pipe handle " + - StreamableToString(write_handle_as_size_t) + - " from the parent process " + - StreamableToString(parent_process_id)); - } - - const HANDLE event_handle = reinterpret_cast<HANDLE>(event_handle_as_size_t); - HANDLE dup_event_handle; - - if (!::DuplicateHandle(parent_process_handle.Get(), event_handle, - ::GetCurrentProcess(), &dup_event_handle, - 0x0, - FALSE, - DUPLICATE_SAME_ACCESS)) { - DeathTestAbort("Unable to duplicate the event handle " + - StreamableToString(event_handle_as_size_t) + - " from the parent process " + - StreamableToString(parent_process_id)); - } - - const int write_fd = - ::_open_osfhandle(reinterpret_cast<intptr_t>(dup_write_handle), O_APPEND); - if (write_fd == -1) { - DeathTestAbort("Unable to convert pipe handle " + - StreamableToString(write_handle_as_size_t) + - " to a file descriptor"); - } - - // Signals the parent that the write end of the pipe has been acquired - // so the parent can release its own write end. - ::SetEvent(dup_event_handle); - - return write_fd; -} -# endif // GTEST_OS_WINDOWS - -// Returns a newly created InternalRunDeathTestFlag object with fields -// initialized from the GTEST_FLAG(internal_run_death_test) flag if -// the flag is specified; otherwise returns NULL. -InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() { - if (GTEST_FLAG(internal_run_death_test) == "") return nullptr; - - // GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we - // can use it here. - int line = -1; - int index = -1; - ::std::vector< ::std::string> fields; - SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields); - int write_fd = -1; - -# if GTEST_OS_WINDOWS - - unsigned int parent_process_id = 0; - size_t write_handle_as_size_t = 0; - size_t event_handle_as_size_t = 0; - - if (fields.size() != 6 - || !ParseNaturalNumber(fields[1], &line) - || !ParseNaturalNumber(fields[2], &index) - || !ParseNaturalNumber(fields[3], &parent_process_id) - || !ParseNaturalNumber(fields[4], &write_handle_as_size_t) - || !ParseNaturalNumber(fields[5], &event_handle_as_size_t)) { - DeathTestAbort("Bad --gtest_internal_run_death_test flag: " + - GTEST_FLAG(internal_run_death_test)); - } - write_fd = GetStatusFileDescriptor(parent_process_id, - write_handle_as_size_t, - event_handle_as_size_t); - -# elif GTEST_OS_FUCHSIA - - if (fields.size() != 3 - || !ParseNaturalNumber(fields[1], &line) - || !ParseNaturalNumber(fields[2], &index)) { - DeathTestAbort("Bad --gtest_internal_run_death_test flag: " - + GTEST_FLAG(internal_run_death_test)); - } - -# else - - if (fields.size() != 4 - || !ParseNaturalNumber(fields[1], &line) - || !ParseNaturalNumber(fields[2], &index) - || !ParseNaturalNumber(fields[3], &write_fd)) { - DeathTestAbort("Bad --gtest_internal_run_death_test flag: " - + GTEST_FLAG(internal_run_death_test)); - } - -# endif // GTEST_OS_WINDOWS - - return new InternalRunDeathTestFlag(fields[0], line, index, write_fd); -} - -} // namespace internal - -#endif // GTEST_HAS_DEATH_TEST - -} // namespace testing diff --git a/3rdParty/googletest/googletest/src/gtest-filepath.cc b/3rdParty/googletest/googletest/src/gtest-filepath.cc deleted file mode 100644 index bd7b99ff03e49616afd07ce961351dd7928ebe8f..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/src/gtest-filepath.cc +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "gtest/internal/gtest-filepath.h" - -#include <stdlib.h> -#include "gtest/internal/gtest-port.h" -#include "gtest/gtest-message.h" - -#if GTEST_OS_WINDOWS_MOBILE -# include <windows.h> -#elif GTEST_OS_WINDOWS -# include <direct.h> -# include <io.h> -#else -# include <limits.h> -# include <climits> // Some Linux distributions define PATH_MAX here. -#endif // GTEST_OS_WINDOWS_MOBILE - -#include "gtest/internal/gtest-string.h" - -#if GTEST_OS_WINDOWS -# define GTEST_PATH_MAX_ _MAX_PATH -#elif defined(PATH_MAX) -# define GTEST_PATH_MAX_ PATH_MAX -#elif defined(_XOPEN_PATH_MAX) -# define GTEST_PATH_MAX_ _XOPEN_PATH_MAX -#else -# define GTEST_PATH_MAX_ _POSIX_PATH_MAX -#endif // GTEST_OS_WINDOWS - -namespace testing { -namespace internal { - -#if GTEST_OS_WINDOWS -// On Windows, '\\' is the standard path separator, but many tools and the -// Windows API also accept '/' as an alternate path separator. Unless otherwise -// noted, a file path can contain either kind of path separators, or a mixture -// of them. -const char kPathSeparator = '\\'; -const char kAlternatePathSeparator = '/'; -const char kAlternatePathSeparatorString[] = "/"; -# if GTEST_OS_WINDOWS_MOBILE -// Windows CE doesn't have a current directory. You should not use -// the current directory in tests on Windows CE, but this at least -// provides a reasonable fallback. -const char kCurrentDirectoryString[] = "\\"; -// Windows CE doesn't define INVALID_FILE_ATTRIBUTES -const DWORD kInvalidFileAttributes = 0xffffffff; -# else -const char kCurrentDirectoryString[] = ".\\"; -# endif // GTEST_OS_WINDOWS_MOBILE -#else -const char kPathSeparator = '/'; -const char kCurrentDirectoryString[] = "./"; -#endif // GTEST_OS_WINDOWS - -// Returns whether the given character is a valid path separator. -static bool IsPathSeparator(char c) { -#if GTEST_HAS_ALT_PATH_SEP_ - return (c == kPathSeparator) || (c == kAlternatePathSeparator); -#else - return c == kPathSeparator; -#endif -} - -// Returns the current working directory, or "" if unsuccessful. -FilePath FilePath::GetCurrentDir() { -#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \ - GTEST_OS_WINDOWS_RT || ARDUINO || defined(ESP_PLATFORM) - // These platforms do not have a current directory, so we just return - // something reasonable. - return FilePath(kCurrentDirectoryString); -#elif GTEST_OS_WINDOWS - char cwd[GTEST_PATH_MAX_ + 1] = { '\0' }; - return FilePath(_getcwd(cwd, sizeof(cwd)) == nullptr ? "" : cwd); -#else - char cwd[GTEST_PATH_MAX_ + 1] = { '\0' }; - char* result = getcwd(cwd, sizeof(cwd)); -# if GTEST_OS_NACL - // getcwd will likely fail in NaCl due to the sandbox, so return something - // reasonable. The user may have provided a shim implementation for getcwd, - // however, so fallback only when failure is detected. - return FilePath(result == nullptr ? kCurrentDirectoryString : cwd); -# endif // GTEST_OS_NACL - return FilePath(result == nullptr ? "" : cwd); -#endif // GTEST_OS_WINDOWS_MOBILE -} - -// Returns a copy of the FilePath with the case-insensitive extension removed. -// Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns -// FilePath("dir/file"). If a case-insensitive extension is not -// found, returns a copy of the original FilePath. -FilePath FilePath::RemoveExtension(const char* extension) const { - const std::string dot_extension = std::string(".") + extension; - if (String::EndsWithCaseInsensitive(pathname_, dot_extension)) { - return FilePath(pathname_.substr( - 0, pathname_.length() - dot_extension.length())); - } - return *this; -} - -// Returns a pointer to the last occurrence of a valid path separator in -// the FilePath. On Windows, for example, both '/' and '\' are valid path -// separators. Returns NULL if no path separator was found. -const char* FilePath::FindLastPathSeparator() const { - const char* const last_sep = strrchr(c_str(), kPathSeparator); -#if GTEST_HAS_ALT_PATH_SEP_ - const char* const last_alt_sep = strrchr(c_str(), kAlternatePathSeparator); - // Comparing two pointers of which only one is NULL is undefined. - if (last_alt_sep != nullptr && - (last_sep == nullptr || last_alt_sep > last_sep)) { - return last_alt_sep; - } -#endif - return last_sep; -} - -// Returns a copy of the FilePath with the directory part removed. -// Example: FilePath("path/to/file").RemoveDirectoryName() returns -// FilePath("file"). If there is no directory part ("just_a_file"), it returns -// the FilePath unmodified. If there is no file part ("just_a_dir/") it -// returns an empty FilePath (""). -// On Windows platform, '\' is the path separator, otherwise it is '/'. -FilePath FilePath::RemoveDirectoryName() const { - const char* const last_sep = FindLastPathSeparator(); - return last_sep ? FilePath(last_sep + 1) : *this; -} - -// RemoveFileName returns the directory path with the filename removed. -// Example: FilePath("path/to/file").RemoveFileName() returns "path/to/". -// If the FilePath is "a_file" or "/a_file", RemoveFileName returns -// FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does -// not have a file, like "just/a/dir/", it returns the FilePath unmodified. -// On Windows platform, '\' is the path separator, otherwise it is '/'. -FilePath FilePath::RemoveFileName() const { - const char* const last_sep = FindLastPathSeparator(); - std::string dir; - if (last_sep) { - dir = std::string(c_str(), static_cast<size_t>(last_sep + 1 - c_str())); - } else { - dir = kCurrentDirectoryString; - } - return FilePath(dir); -} - -// Helper functions for naming files in a directory for xml output. - -// Given directory = "dir", base_name = "test", number = 0, -// extension = "xml", returns "dir/test.xml". If number is greater -// than zero (e.g., 12), returns "dir/test_12.xml". -// On Windows platform, uses \ as the separator rather than /. -FilePath FilePath::MakeFileName(const FilePath& directory, - const FilePath& base_name, - int number, - const char* extension) { - std::string file; - if (number == 0) { - file = base_name.string() + "." + extension; - } else { - file = base_name.string() + "_" + StreamableToString(number) - + "." + extension; - } - return ConcatPaths(directory, FilePath(file)); -} - -// Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml". -// On Windows, uses \ as the separator rather than /. -FilePath FilePath::ConcatPaths(const FilePath& directory, - const FilePath& relative_path) { - if (directory.IsEmpty()) - return relative_path; - const FilePath dir(directory.RemoveTrailingPathSeparator()); - return FilePath(dir.string() + kPathSeparator + relative_path.string()); -} - -// Returns true if pathname describes something findable in the file-system, -// either a file, directory, or whatever. -bool FilePath::FileOrDirectoryExists() const { -#if GTEST_OS_WINDOWS_MOBILE - LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str()); - const DWORD attributes = GetFileAttributes(unicode); - delete [] unicode; - return attributes != kInvalidFileAttributes; -#else - posix::StatStruct file_stat; - return posix::Stat(pathname_.c_str(), &file_stat) == 0; -#endif // GTEST_OS_WINDOWS_MOBILE -} - -// Returns true if pathname describes a directory in the file-system -// that exists. -bool FilePath::DirectoryExists() const { - bool result = false; -#if GTEST_OS_WINDOWS - // Don't strip off trailing separator if path is a root directory on - // Windows (like "C:\\"). - const FilePath& path(IsRootDirectory() ? *this : - RemoveTrailingPathSeparator()); -#else - const FilePath& path(*this); -#endif - -#if GTEST_OS_WINDOWS_MOBILE - LPCWSTR unicode = String::AnsiToUtf16(path.c_str()); - const DWORD attributes = GetFileAttributes(unicode); - delete [] unicode; - if ((attributes != kInvalidFileAttributes) && - (attributes & FILE_ATTRIBUTE_DIRECTORY)) { - result = true; - } -#else - posix::StatStruct file_stat; - result = posix::Stat(path.c_str(), &file_stat) == 0 && - posix::IsDir(file_stat); -#endif // GTEST_OS_WINDOWS_MOBILE - - return result; -} - -// Returns true if pathname describes a root directory. (Windows has one -// root directory per disk drive.) -bool FilePath::IsRootDirectory() const { -#if GTEST_OS_WINDOWS - return pathname_.length() == 3 && IsAbsolutePath(); -#else - return pathname_.length() == 1 && IsPathSeparator(pathname_.c_str()[0]); -#endif -} - -// Returns true if pathname describes an absolute path. -bool FilePath::IsAbsolutePath() const { - const char* const name = pathname_.c_str(); -#if GTEST_OS_WINDOWS - return pathname_.length() >= 3 && - ((name[0] >= 'a' && name[0] <= 'z') || - (name[0] >= 'A' && name[0] <= 'Z')) && - name[1] == ':' && - IsPathSeparator(name[2]); -#else - return IsPathSeparator(name[0]); -#endif -} - -// Returns a pathname for a file that does not currently exist. The pathname -// will be directory/base_name.extension or -// directory/base_name_<number>.extension if directory/base_name.extension -// already exists. The number will be incremented until a pathname is found -// that does not already exist. -// Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'. -// There could be a race condition if two or more processes are calling this -// function at the same time -- they could both pick the same filename. -FilePath FilePath::GenerateUniqueFileName(const FilePath& directory, - const FilePath& base_name, - const char* extension) { - FilePath full_pathname; - int number = 0; - do { - full_pathname.Set(MakeFileName(directory, base_name, number++, extension)); - } while (full_pathname.FileOrDirectoryExists()); - return full_pathname; -} - -// Returns true if FilePath ends with a path separator, which indicates that -// it is intended to represent a directory. Returns false otherwise. -// This does NOT check that a directory (or file) actually exists. -bool FilePath::IsDirectory() const { - return !pathname_.empty() && - IsPathSeparator(pathname_.c_str()[pathname_.length() - 1]); -} - -// Create directories so that path exists. Returns true if successful or if -// the directories already exist; returns false if unable to create directories -// for any reason. -bool FilePath::CreateDirectoriesRecursively() const { - if (!this->IsDirectory()) { - return false; - } - - if (pathname_.length() == 0 || this->DirectoryExists()) { - return true; - } - - const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName()); - return parent.CreateDirectoriesRecursively() && this->CreateFolder(); -} - -// Create the directory so that path exists. Returns true if successful or -// if the directory already exists; returns false if unable to create the -// directory for any reason, including if the parent directory does not -// exist. Not named "CreateDirectory" because that's a macro on Windows. -bool FilePath::CreateFolder() const { -#if GTEST_OS_WINDOWS_MOBILE - FilePath removed_sep(this->RemoveTrailingPathSeparator()); - LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str()); - int result = CreateDirectory(unicode, nullptr) ? 0 : -1; - delete [] unicode; -#elif GTEST_OS_WINDOWS - int result = _mkdir(pathname_.c_str()); -#else - int result = mkdir(pathname_.c_str(), 0777); -#endif // GTEST_OS_WINDOWS_MOBILE - - if (result == -1) { - return this->DirectoryExists(); // An error is OK if the directory exists. - } - return true; // No error. -} - -// If input name has a trailing separator character, remove it and return the -// name, otherwise return the name string unmodified. -// On Windows platform, uses \ as the separator, other platforms use /. -FilePath FilePath::RemoveTrailingPathSeparator() const { - return IsDirectory() - ? FilePath(pathname_.substr(0, pathname_.length() - 1)) - : *this; -} - -// Removes any redundant separators that might be in the pathname. -// For example, "bar///foo" becomes "bar/foo". Does not eliminate other -// redundancies that might be in a pathname involving "." or "..". -void FilePath::Normalize() { - if (pathname_.c_str() == nullptr) { - pathname_ = ""; - return; - } - const char* src = pathname_.c_str(); - char* const dest = new char[pathname_.length() + 1]; - char* dest_ptr = dest; - memset(dest_ptr, 0, pathname_.length() + 1); - - while (*src != '\0') { - *dest_ptr = *src; - if (!IsPathSeparator(*src)) { - src++; - } else { -#if GTEST_HAS_ALT_PATH_SEP_ - if (*dest_ptr == kAlternatePathSeparator) { - *dest_ptr = kPathSeparator; - } -#endif - while (IsPathSeparator(*src)) - src++; - } - dest_ptr++; - } - *dest_ptr = '\0'; - pathname_ = dest; - delete[] dest; -} - -} // namespace internal -} // namespace testing diff --git a/3rdParty/googletest/googletest/src/gtest-internal-inl.h b/3rdParty/googletest/googletest/src/gtest-internal-inl.h deleted file mode 100644 index 8ed70daab0943969d5a3b3b88b1196775f0b1d3a..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/src/gtest-internal-inl.h +++ /dev/null @@ -1,1211 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Utility functions and classes used by the Google C++ testing framework.// -// This file contains purely Google Test's internal implementation. Please -// DO NOT #INCLUDE IT IN A USER PROGRAM. - -#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_ -#define GTEST_SRC_GTEST_INTERNAL_INL_H_ - -#ifndef _WIN32_WCE -# include <errno.h> -#endif // !_WIN32_WCE -#include <stddef.h> -#include <stdlib.h> // For strtoll/_strtoul64/malloc/free. -#include <string.h> // For memmove. - -#include <algorithm> -#include <memory> -#include <string> -#include <vector> - -#include "gtest/internal/gtest-port.h" - -#if GTEST_CAN_STREAM_RESULTS_ -# include <arpa/inet.h> // NOLINT -# include <netdb.h> // NOLINT -#endif - -#if GTEST_OS_WINDOWS -# include <windows.h> // NOLINT -#endif // GTEST_OS_WINDOWS - -#include "gtest/gtest.h" -#include "gtest/gtest-spi.h" - -GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ -/* class A needs to have dll-interface to be used by clients of class B */) - -namespace testing { - -// Declares the flags. -// -// We don't want the users to modify this flag in the code, but want -// Google Test's own unit tests to be able to access it. Therefore we -// declare it here as opposed to in gtest.h. -GTEST_DECLARE_bool_(death_test_use_fork); - -namespace internal { - -// The value of GetTestTypeId() as seen from within the Google Test -// library. This is solely for testing GetTestTypeId(). -GTEST_API_ extern const TypeId kTestTypeIdInGoogleTest; - -// Names of the flags (needed for parsing Google Test flags). -const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests"; -const char kBreakOnFailureFlag[] = "break_on_failure"; -const char kCatchExceptionsFlag[] = "catch_exceptions"; -const char kColorFlag[] = "color"; -const char kFilterFlag[] = "filter"; -const char kListTestsFlag[] = "list_tests"; -const char kOutputFlag[] = "output"; -const char kPrintTimeFlag[] = "print_time"; -const char kPrintUTF8Flag[] = "print_utf8"; -const char kRandomSeedFlag[] = "random_seed"; -const char kRepeatFlag[] = "repeat"; -const char kShuffleFlag[] = "shuffle"; -const char kStackTraceDepthFlag[] = "stack_trace_depth"; -const char kStreamResultToFlag[] = "stream_result_to"; -const char kThrowOnFailureFlag[] = "throw_on_failure"; -const char kFlagfileFlag[] = "flagfile"; - -// A valid random seed must be in [1, kMaxRandomSeed]. -const int kMaxRandomSeed = 99999; - -// g_help_flag is true if and only if the --help flag or an equivalent form -// is specified on the command line. -GTEST_API_ extern bool g_help_flag; - -// Returns the current time in milliseconds. -GTEST_API_ TimeInMillis GetTimeInMillis(); - -// Returns true if and only if Google Test should use colors in the output. -GTEST_API_ bool ShouldUseColor(bool stdout_is_tty); - -// Formats the given time in milliseconds as seconds. -GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms); - -// Converts the given time in milliseconds to a date string in the ISO 8601 -// format, without the timezone information. N.B.: due to the use the -// non-reentrant localtime() function, this function is not thread safe. Do -// not use it in any code that can be called from multiple threads. -GTEST_API_ std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms); - -// Parses a string for an Int32 flag, in the form of "--flag=value". -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -GTEST_API_ bool ParseInt32Flag( - const char* str, const char* flag, Int32* value); - -// Returns a random seed in range [1, kMaxRandomSeed] based on the -// given --gtest_random_seed flag value. -inline int GetRandomSeedFromFlag(Int32 random_seed_flag) { - const unsigned int raw_seed = (random_seed_flag == 0) ? - static_cast<unsigned int>(GetTimeInMillis()) : - static_cast<unsigned int>(random_seed_flag); - - // Normalizes the actual seed to range [1, kMaxRandomSeed] such that - // it's easy to type. - const int normalized_seed = - static_cast<int>((raw_seed - 1U) % - static_cast<unsigned int>(kMaxRandomSeed)) + 1; - return normalized_seed; -} - -// Returns the first valid random seed after 'seed'. The behavior is -// undefined if 'seed' is invalid. The seed after kMaxRandomSeed is -// considered to be 1. -inline int GetNextRandomSeed(int seed) { - GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed) - << "Invalid random seed " << seed << " - must be in [1, " - << kMaxRandomSeed << "]."; - const int next_seed = seed + 1; - return (next_seed > kMaxRandomSeed) ? 1 : next_seed; -} - -// This class saves the values of all Google Test flags in its c'tor, and -// restores them in its d'tor. -class GTestFlagSaver { - public: - // The c'tor. - GTestFlagSaver() { - also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests); - break_on_failure_ = GTEST_FLAG(break_on_failure); - catch_exceptions_ = GTEST_FLAG(catch_exceptions); - color_ = GTEST_FLAG(color); - death_test_style_ = GTEST_FLAG(death_test_style); - death_test_use_fork_ = GTEST_FLAG(death_test_use_fork); - filter_ = GTEST_FLAG(filter); - internal_run_death_test_ = GTEST_FLAG(internal_run_death_test); - list_tests_ = GTEST_FLAG(list_tests); - output_ = GTEST_FLAG(output); - print_time_ = GTEST_FLAG(print_time); - print_utf8_ = GTEST_FLAG(print_utf8); - random_seed_ = GTEST_FLAG(random_seed); - repeat_ = GTEST_FLAG(repeat); - shuffle_ = GTEST_FLAG(shuffle); - stack_trace_depth_ = GTEST_FLAG(stack_trace_depth); - stream_result_to_ = GTEST_FLAG(stream_result_to); - throw_on_failure_ = GTEST_FLAG(throw_on_failure); - } - - // The d'tor is not virtual. DO NOT INHERIT FROM THIS CLASS. - ~GTestFlagSaver() { - GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_; - GTEST_FLAG(break_on_failure) = break_on_failure_; - GTEST_FLAG(catch_exceptions) = catch_exceptions_; - GTEST_FLAG(color) = color_; - GTEST_FLAG(death_test_style) = death_test_style_; - GTEST_FLAG(death_test_use_fork) = death_test_use_fork_; - GTEST_FLAG(filter) = filter_; - GTEST_FLAG(internal_run_death_test) = internal_run_death_test_; - GTEST_FLAG(list_tests) = list_tests_; - GTEST_FLAG(output) = output_; - GTEST_FLAG(print_time) = print_time_; - GTEST_FLAG(print_utf8) = print_utf8_; - GTEST_FLAG(random_seed) = random_seed_; - GTEST_FLAG(repeat) = repeat_; - GTEST_FLAG(shuffle) = shuffle_; - GTEST_FLAG(stack_trace_depth) = stack_trace_depth_; - GTEST_FLAG(stream_result_to) = stream_result_to_; - GTEST_FLAG(throw_on_failure) = throw_on_failure_; - } - - private: - // Fields for saving the original values of flags. - bool also_run_disabled_tests_; - bool break_on_failure_; - bool catch_exceptions_; - std::string color_; - std::string death_test_style_; - bool death_test_use_fork_; - std::string filter_; - std::string internal_run_death_test_; - bool list_tests_; - std::string output_; - bool print_time_; - bool print_utf8_; - internal::Int32 random_seed_; - internal::Int32 repeat_; - bool shuffle_; - internal::Int32 stack_trace_depth_; - std::string stream_result_to_; - bool throw_on_failure_; -} GTEST_ATTRIBUTE_UNUSED_; - -// Converts a Unicode code point to a narrow string in UTF-8 encoding. -// code_point parameter is of type UInt32 because wchar_t may not be -// wide enough to contain a code point. -// If the code_point is not a valid Unicode code point -// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted -// to "(Invalid Unicode 0xXXXXXXXX)". -GTEST_API_ std::string CodePointToUtf8(UInt32 code_point); - -// Converts a wide string to a narrow string in UTF-8 encoding. -// The wide string is assumed to have the following encoding: -// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin) -// UTF-32 if sizeof(wchar_t) == 4 (on Linux) -// Parameter str points to a null-terminated wide string. -// Parameter num_chars may additionally limit the number -// of wchar_t characters processed. -1 is used when the entire string -// should be processed. -// If the string contains code points that are not valid Unicode code points -// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output -// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding -// and contains invalid UTF-16 surrogate pairs, values in those pairs -// will be encoded as individual Unicode characters from Basic Normal Plane. -GTEST_API_ std::string WideStringToUtf8(const wchar_t* str, int num_chars); - -// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file -// if the variable is present. If a file already exists at this location, this -// function will write over it. If the variable is present, but the file cannot -// be created, prints an error and exits. -void WriteToShardStatusFileIfNeeded(); - -// Checks whether sharding is enabled by examining the relevant -// environment variable values. If the variables are present, -// but inconsistent (e.g., shard_index >= total_shards), prints -// an error and exits. If in_subprocess_for_death_test, sharding is -// disabled because it must only be applied to the original test -// process. Otherwise, we could filter out death tests we intended to execute. -GTEST_API_ bool ShouldShard(const char* total_shards_str, - const char* shard_index_str, - bool in_subprocess_for_death_test); - -// Parses the environment variable var as an Int32. If it is unset, -// returns default_val. If it is not an Int32, prints an error and -// and aborts. -GTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val); - -// Given the total number of shards, the shard index, and the test id, -// returns true if and only if the test should be run on this shard. The test id -// is some arbitrary but unique non-negative integer assigned to each test -// method. Assumes that 0 <= shard_index < total_shards. -GTEST_API_ bool ShouldRunTestOnShard( - int total_shards, int shard_index, int test_id); - -// STL container utilities. - -// Returns the number of elements in the given container that satisfy -// the given predicate. -template <class Container, typename Predicate> -inline int CountIf(const Container& c, Predicate predicate) { - // Implemented as an explicit loop since std::count_if() in libCstd on - // Solaris has a non-standard signature. - int count = 0; - for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) { - if (predicate(*it)) - ++count; - } - return count; -} - -// Applies a function/functor to each element in the container. -template <class Container, typename Functor> -void ForEach(const Container& c, Functor functor) { - std::for_each(c.begin(), c.end(), functor); -} - -// Returns the i-th element of the vector, or default_value if i is not -// in range [0, v.size()). -template <typename E> -inline E GetElementOr(const std::vector<E>& v, int i, E default_value) { - return (i < 0 || i >= static_cast<int>(v.size())) ? default_value - : v[static_cast<size_t>(i)]; -} - -// Performs an in-place shuffle of a range of the vector's elements. -// 'begin' and 'end' are element indices as an STL-style range; -// i.e. [begin, end) are shuffled, where 'end' == size() means to -// shuffle to the end of the vector. -template <typename E> -void ShuffleRange(internal::Random* random, int begin, int end, - std::vector<E>* v) { - const int size = static_cast<int>(v->size()); - GTEST_CHECK_(0 <= begin && begin <= size) - << "Invalid shuffle range start " << begin << ": must be in range [0, " - << size << "]."; - GTEST_CHECK_(begin <= end && end <= size) - << "Invalid shuffle range finish " << end << ": must be in range [" - << begin << ", " << size << "]."; - - // Fisher-Yates shuffle, from - // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle - for (int range_width = end - begin; range_width >= 2; range_width--) { - const int last_in_range = begin + range_width - 1; - const int selected = - begin + - static_cast<int>(random->Generate(static_cast<UInt32>(range_width))); - std::swap((*v)[static_cast<size_t>(selected)], - (*v)[static_cast<size_t>(last_in_range)]); - } -} - -// Performs an in-place shuffle of the vector's elements. -template <typename E> -inline void Shuffle(internal::Random* random, std::vector<E>* v) { - ShuffleRange(random, 0, static_cast<int>(v->size()), v); -} - -// A function for deleting an object. Handy for being used as a -// functor. -template <typename T> -static void Delete(T* x) { - delete x; -} - -// A predicate that checks the key of a TestProperty against a known key. -// -// TestPropertyKeyIs is copyable. -class TestPropertyKeyIs { - public: - // Constructor. - // - // TestPropertyKeyIs has NO default constructor. - explicit TestPropertyKeyIs(const std::string& key) : key_(key) {} - - // Returns true if and only if the test name of test property matches on key_. - bool operator()(const TestProperty& test_property) const { - return test_property.key() == key_; - } - - private: - std::string key_; -}; - -// Class UnitTestOptions. -// -// This class contains functions for processing options the user -// specifies when running the tests. It has only static members. -// -// In most cases, the user can specify an option using either an -// environment variable or a command line flag. E.g. you can set the -// test filter using either GTEST_FILTER or --gtest_filter. If both -// the variable and the flag are present, the latter overrides the -// former. -class GTEST_API_ UnitTestOptions { - public: - // Functions for processing the gtest_output flag. - - // Returns the output format, or "" for normal printed output. - static std::string GetOutputFormat(); - - // Returns the absolute path of the requested output file, or the - // default (test_detail.xml in the original working directory) if - // none was explicitly specified. - static std::string GetAbsolutePathToOutputFile(); - - // Functions for processing the gtest_filter flag. - - // Returns true if and only if the wildcard pattern matches the string. - // The first ':' or '\0' character in pattern marks the end of it. - // - // This recursive algorithm isn't very efficient, but is clear and - // works well enough for matching test names, which are short. - static bool PatternMatchesString(const char *pattern, const char *str); - - // Returns true if and only if the user-specified filter matches the test - // suite name and the test name. - static bool FilterMatchesTest(const std::string& test_suite_name, - const std::string& test_name); - -#if GTEST_OS_WINDOWS - // Function for supporting the gtest_catch_exception flag. - - // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the - // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise. - // This function is useful as an __except condition. - static int GTestShouldProcessSEH(DWORD exception_code); -#endif // GTEST_OS_WINDOWS - - // Returns true if "name" matches the ':' separated list of glob-style - // filters in "filter". - static bool MatchesFilter(const std::string& name, const char* filter); -}; - -// Returns the current application's name, removing directory path if that -// is present. Used by UnitTestOptions::GetOutputFile. -GTEST_API_ FilePath GetCurrentExecutableName(); - -// The role interface for getting the OS stack trace as a string. -class OsStackTraceGetterInterface { - public: - OsStackTraceGetterInterface() {} - virtual ~OsStackTraceGetterInterface() {} - - // Returns the current OS stack trace as an std::string. Parameters: - // - // max_depth - the maximum number of stack frames to be included - // in the trace. - // skip_count - the number of top frames to be skipped; doesn't count - // against max_depth. - virtual std::string CurrentStackTrace(int max_depth, int skip_count) = 0; - - // UponLeavingGTest() should be called immediately before Google Test calls - // user code. It saves some information about the current stack that - // CurrentStackTrace() will use to find and hide Google Test stack frames. - virtual void UponLeavingGTest() = 0; - - // This string is inserted in place of stack frames that are part of - // Google Test's implementation. - static const char* const kElidedFramesMarker; - - private: - GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface); -}; - -// A working implementation of the OsStackTraceGetterInterface interface. -class OsStackTraceGetter : public OsStackTraceGetterInterface { - public: - OsStackTraceGetter() {} - - std::string CurrentStackTrace(int max_depth, int skip_count) override; - void UponLeavingGTest() override; - - private: -#if GTEST_HAS_ABSL - Mutex mutex_; // Protects all internal state. - - // We save the stack frame below the frame that calls user code. - // We do this because the address of the frame immediately below - // the user code changes between the call to UponLeavingGTest() - // and any calls to the stack trace code from within the user code. - void* caller_frame_ = nullptr; -#endif // GTEST_HAS_ABSL - - GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter); -}; - -// Information about a Google Test trace point. -struct TraceInfo { - const char* file; - int line; - std::string message; -}; - -// This is the default global test part result reporter used in UnitTestImpl. -// This class should only be used by UnitTestImpl. -class DefaultGlobalTestPartResultReporter - : public TestPartResultReporterInterface { - public: - explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test); - // Implements the TestPartResultReporterInterface. Reports the test part - // result in the current test. - void ReportTestPartResult(const TestPartResult& result) override; - - private: - UnitTestImpl* const unit_test_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter); -}; - -// This is the default per thread test part result reporter used in -// UnitTestImpl. This class should only be used by UnitTestImpl. -class DefaultPerThreadTestPartResultReporter - : public TestPartResultReporterInterface { - public: - explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test); - // Implements the TestPartResultReporterInterface. The implementation just - // delegates to the current global test part result reporter of *unit_test_. - void ReportTestPartResult(const TestPartResult& result) override; - - private: - UnitTestImpl* const unit_test_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter); -}; - -// The private implementation of the UnitTest class. We don't protect -// the methods under a mutex, as this class is not accessible by a -// user and the UnitTest class that delegates work to this class does -// proper locking. -class GTEST_API_ UnitTestImpl { - public: - explicit UnitTestImpl(UnitTest* parent); - virtual ~UnitTestImpl(); - - // There are two different ways to register your own TestPartResultReporter. - // You can register your own repoter to listen either only for test results - // from the current thread or for results from all threads. - // By default, each per-thread test result repoter just passes a new - // TestPartResult to the global test result reporter, which registers the - // test part result for the currently running test. - - // Returns the global test part result reporter. - TestPartResultReporterInterface* GetGlobalTestPartResultReporter(); - - // Sets the global test part result reporter. - void SetGlobalTestPartResultReporter( - TestPartResultReporterInterface* reporter); - - // Returns the test part result reporter for the current thread. - TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread(); - - // Sets the test part result reporter for the current thread. - void SetTestPartResultReporterForCurrentThread( - TestPartResultReporterInterface* reporter); - - // Gets the number of successful test suites. - int successful_test_suite_count() const; - - // Gets the number of failed test suites. - int failed_test_suite_count() const; - - // Gets the number of all test suites. - int total_test_suite_count() const; - - // Gets the number of all test suites that contain at least one test - // that should run. - int test_suite_to_run_count() const; - - // Gets the number of successful tests. - int successful_test_count() const; - - // Gets the number of skipped tests. - int skipped_test_count() const; - - // Gets the number of failed tests. - int failed_test_count() const; - - // Gets the number of disabled tests that will be reported in the XML report. - int reportable_disabled_test_count() const; - - // Gets the number of disabled tests. - int disabled_test_count() const; - - // Gets the number of tests to be printed in the XML report. - int reportable_test_count() const; - - // Gets the number of all tests. - int total_test_count() const; - - // Gets the number of tests that should run. - int test_to_run_count() const; - - // Gets the time of the test program start, in ms from the start of the - // UNIX epoch. - TimeInMillis start_timestamp() const { return start_timestamp_; } - - // Gets the elapsed time, in milliseconds. - TimeInMillis elapsed_time() const { return elapsed_time_; } - - // Returns true if and only if the unit test passed (i.e. all test suites - // passed). - bool Passed() const { return !Failed(); } - - // Returns true if and only if the unit test failed (i.e. some test suite - // failed or something outside of all tests failed). - bool Failed() const { - return failed_test_suite_count() > 0 || ad_hoc_test_result()->Failed(); - } - - // Gets the i-th test suite among all the test suites. i can range from 0 to - // total_test_suite_count() - 1. If i is not in that range, returns NULL. - const TestSuite* GetTestSuite(int i) const { - const int index = GetElementOr(test_suite_indices_, i, -1); - return index < 0 ? nullptr : test_suites_[static_cast<size_t>(i)]; - } - - // Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - const TestCase* GetTestCase(int i) const { return GetTestSuite(i); } -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - // Gets the i-th test suite among all the test suites. i can range from 0 to - // total_test_suite_count() - 1. If i is not in that range, returns NULL. - TestSuite* GetMutableSuiteCase(int i) { - const int index = GetElementOr(test_suite_indices_, i, -1); - return index < 0 ? nullptr : test_suites_[static_cast<size_t>(index)]; - } - - // Provides access to the event listener list. - TestEventListeners* listeners() { return &listeners_; } - - // Returns the TestResult for the test that's currently running, or - // the TestResult for the ad hoc test if no test is running. - TestResult* current_test_result(); - - // Returns the TestResult for the ad hoc test. - const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; } - - // Sets the OS stack trace getter. - // - // Does nothing if the input and the current OS stack trace getter - // are the same; otherwise, deletes the old getter and makes the - // input the current getter. - void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter); - - // Returns the current OS stack trace getter if it is not NULL; - // otherwise, creates an OsStackTraceGetter, makes it the current - // getter, and returns it. - OsStackTraceGetterInterface* os_stack_trace_getter(); - - // Returns the current OS stack trace as an std::string. - // - // The maximum number of stack frames to be included is specified by - // the gtest_stack_trace_depth flag. The skip_count parameter - // specifies the number of top frames to be skipped, which doesn't - // count against the number of frames to be included. - // - // For example, if Foo() calls Bar(), which in turn calls - // CurrentOsStackTraceExceptTop(1), Foo() will be included in the - // trace but Bar() and CurrentOsStackTraceExceptTop() won't. - std::string CurrentOsStackTraceExceptTop(int skip_count) GTEST_NO_INLINE_; - - // Finds and returns a TestSuite with the given name. If one doesn't - // exist, creates one and returns it. - // - // Arguments: - // - // test_suite_name: name of the test suite - // type_param: the name of the test's type parameter, or NULL if - // this is not a typed or a type-parameterized test. - // set_up_tc: pointer to the function that sets up the test suite - // tear_down_tc: pointer to the function that tears down the test suite - TestSuite* GetTestSuite(const char* test_suite_name, const char* type_param, - internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc); - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - TestCase* GetTestCase(const char* test_case_name, const char* type_param, - internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc) { - return GetTestSuite(test_case_name, type_param, set_up_tc, tear_down_tc); - } -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - // Adds a TestInfo to the unit test. - // - // Arguments: - // - // set_up_tc: pointer to the function that sets up the test suite - // tear_down_tc: pointer to the function that tears down the test suite - // test_info: the TestInfo object - void AddTestInfo(internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc, - TestInfo* test_info) { - // In order to support thread-safe death tests, we need to - // remember the original working directory when the test program - // was first invoked. We cannot do this in RUN_ALL_TESTS(), as - // the user may have changed the current directory before calling - // RUN_ALL_TESTS(). Therefore we capture the current directory in - // AddTestInfo(), which is called to register a TEST or TEST_F - // before main() is reached. - if (original_working_dir_.IsEmpty()) { - original_working_dir_.Set(FilePath::GetCurrentDir()); - GTEST_CHECK_(!original_working_dir_.IsEmpty()) - << "Failed to get the current working directory."; - } - - GetTestSuite(test_info->test_suite_name(), test_info->type_param(), - set_up_tc, tear_down_tc) - ->AddTestInfo(test_info); - } - - // Returns ParameterizedTestSuiteRegistry object used to keep track of - // value-parameterized tests and instantiate and register them. - internal::ParameterizedTestSuiteRegistry& parameterized_test_registry() { - return parameterized_test_registry_; - } - - // Sets the TestSuite object for the test that's currently running. - void set_current_test_suite(TestSuite* a_current_test_suite) { - current_test_suite_ = a_current_test_suite; - } - - // Sets the TestInfo object for the test that's currently running. If - // current_test_info is NULL, the assertion results will be stored in - // ad_hoc_test_result_. - void set_current_test_info(TestInfo* a_current_test_info) { - current_test_info_ = a_current_test_info; - } - - // Registers all parameterized tests defined using TEST_P and - // INSTANTIATE_TEST_SUITE_P, creating regular tests for each test/parameter - // combination. This method can be called more then once; it has guards - // protecting from registering the tests more then once. If - // value-parameterized tests are disabled, RegisterParameterizedTests is - // present but does nothing. - void RegisterParameterizedTests(); - - // Runs all tests in this UnitTest object, prints the result, and - // returns true if all tests are successful. If any exception is - // thrown during a test, this test is considered to be failed, but - // the rest of the tests will still be run. - bool RunAllTests(); - - // Clears the results of all tests, except the ad hoc tests. - void ClearNonAdHocTestResult() { - ForEach(test_suites_, TestSuite::ClearTestSuiteResult); - } - - // Clears the results of ad-hoc test assertions. - void ClearAdHocTestResult() { - ad_hoc_test_result_.Clear(); - } - - // Adds a TestProperty to the current TestResult object when invoked in a - // context of a test or a test suite, or to the global property set. If the - // result already contains a property with the same key, the value will be - // updated. - void RecordProperty(const TestProperty& test_property); - - enum ReactionToSharding { - HONOR_SHARDING_PROTOCOL, - IGNORE_SHARDING_PROTOCOL - }; - - // Matches the full name of each test against the user-specified - // filter to decide whether the test should run, then records the - // result in each TestSuite and TestInfo object. - // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests - // based on sharding variables in the environment. - // Returns the number of tests that should run. - int FilterTests(ReactionToSharding shard_tests); - - // Prints the names of the tests matching the user-specified filter flag. - void ListTestsMatchingFilter(); - - const TestSuite* current_test_suite() const { return current_test_suite_; } - TestInfo* current_test_info() { return current_test_info_; } - const TestInfo* current_test_info() const { return current_test_info_; } - - // Returns the vector of environments that need to be set-up/torn-down - // before/after the tests are run. - std::vector<Environment*>& environments() { return environments_; } - - // Getters for the per-thread Google Test trace stack. - std::vector<TraceInfo>& gtest_trace_stack() { - return *(gtest_trace_stack_.pointer()); - } - const std::vector<TraceInfo>& gtest_trace_stack() const { - return gtest_trace_stack_.get(); - } - -#if GTEST_HAS_DEATH_TEST - void InitDeathTestSubprocessControlInfo() { - internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag()); - } - // Returns a pointer to the parsed --gtest_internal_run_death_test - // flag, or NULL if that flag was not specified. - // This information is useful only in a death test child process. - // Must not be called before a call to InitGoogleTest. - const InternalRunDeathTestFlag* internal_run_death_test_flag() const { - return internal_run_death_test_flag_.get(); - } - - // Returns a pointer to the current death test factory. - internal::DeathTestFactory* death_test_factory() { - return death_test_factory_.get(); - } - - void SuppressTestEventsIfInSubprocess(); - - friend class ReplaceDeathTestFactory; -#endif // GTEST_HAS_DEATH_TEST - - // Initializes the event listener performing XML output as specified by - // UnitTestOptions. Must not be called before InitGoogleTest. - void ConfigureXmlOutput(); - -#if GTEST_CAN_STREAM_RESULTS_ - // Initializes the event listener for streaming test results to a socket. - // Must not be called before InitGoogleTest. - void ConfigureStreamingOutput(); -#endif - - // Performs initialization dependent upon flag values obtained in - // ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to - // ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest - // this function is also called from RunAllTests. Since this function can be - // called more than once, it has to be idempotent. - void PostFlagParsingInit(); - - // Gets the random seed used at the start of the current test iteration. - int random_seed() const { return random_seed_; } - - // Gets the random number generator. - internal::Random* random() { return &random_; } - - // Shuffles all test suites, and the tests within each test suite, - // making sure that death tests are still run first. - void ShuffleTests(); - - // Restores the test suites and tests to their order before the first shuffle. - void UnshuffleTests(); - - // Returns the value of GTEST_FLAG(catch_exceptions) at the moment - // UnitTest::Run() starts. - bool catch_exceptions() const { return catch_exceptions_; } - - private: - friend class ::testing::UnitTest; - - // Used by UnitTest::Run() to capture the state of - // GTEST_FLAG(catch_exceptions) at the moment it starts. - void set_catch_exceptions(bool value) { catch_exceptions_ = value; } - - // The UnitTest object that owns this implementation object. - UnitTest* const parent_; - - // The working directory when the first TEST() or TEST_F() was - // executed. - internal::FilePath original_working_dir_; - - // The default test part result reporters. - DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_; - DefaultPerThreadTestPartResultReporter - default_per_thread_test_part_result_reporter_; - - // Points to (but doesn't own) the global test part result reporter. - TestPartResultReporterInterface* global_test_part_result_repoter_; - - // Protects read and write access to global_test_part_result_reporter_. - internal::Mutex global_test_part_result_reporter_mutex_; - - // Points to (but doesn't own) the per-thread test part result reporter. - internal::ThreadLocal<TestPartResultReporterInterface*> - per_thread_test_part_result_reporter_; - - // The vector of environments that need to be set-up/torn-down - // before/after the tests are run. - std::vector<Environment*> environments_; - - // The vector of TestSuites in their original order. It owns the - // elements in the vector. - std::vector<TestSuite*> test_suites_; - - // Provides a level of indirection for the test suite list to allow - // easy shuffling and restoring the test suite order. The i-th - // element of this vector is the index of the i-th test suite in the - // shuffled order. - std::vector<int> test_suite_indices_; - - // ParameterizedTestRegistry object used to register value-parameterized - // tests. - internal::ParameterizedTestSuiteRegistry parameterized_test_registry_; - - // Indicates whether RegisterParameterizedTests() has been called already. - bool parameterized_tests_registered_; - - // Index of the last death test suite registered. Initially -1. - int last_death_test_suite_; - - // This points to the TestSuite for the currently running test. It - // changes as Google Test goes through one test suite after another. - // When no test is running, this is set to NULL and Google Test - // stores assertion results in ad_hoc_test_result_. Initially NULL. - TestSuite* current_test_suite_; - - // This points to the TestInfo for the currently running test. It - // changes as Google Test goes through one test after another. When - // no test is running, this is set to NULL and Google Test stores - // assertion results in ad_hoc_test_result_. Initially NULL. - TestInfo* current_test_info_; - - // Normally, a user only writes assertions inside a TEST or TEST_F, - // or inside a function called by a TEST or TEST_F. Since Google - // Test keeps track of which test is current running, it can - // associate such an assertion with the test it belongs to. - // - // If an assertion is encountered when no TEST or TEST_F is running, - // Google Test attributes the assertion result to an imaginary "ad hoc" - // test, and records the result in ad_hoc_test_result_. - TestResult ad_hoc_test_result_; - - // The list of event listeners that can be used to track events inside - // Google Test. - TestEventListeners listeners_; - - // The OS stack trace getter. Will be deleted when the UnitTest - // object is destructed. By default, an OsStackTraceGetter is used, - // but the user can set this field to use a custom getter if that is - // desired. - OsStackTraceGetterInterface* os_stack_trace_getter_; - - // True if and only if PostFlagParsingInit() has been called. - bool post_flag_parse_init_performed_; - - // The random number seed used at the beginning of the test run. - int random_seed_; - - // Our random number generator. - internal::Random random_; - - // The time of the test program start, in ms from the start of the - // UNIX epoch. - TimeInMillis start_timestamp_; - - // How long the test took to run, in milliseconds. - TimeInMillis elapsed_time_; - -#if GTEST_HAS_DEATH_TEST - // The decomposed components of the gtest_internal_run_death_test flag, - // parsed when RUN_ALL_TESTS is called. - std::unique_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_; - std::unique_ptr<internal::DeathTestFactory> death_test_factory_; -#endif // GTEST_HAS_DEATH_TEST - - // A per-thread stack of traces created by the SCOPED_TRACE() macro. - internal::ThreadLocal<std::vector<TraceInfo> > gtest_trace_stack_; - - // The value of GTEST_FLAG(catch_exceptions) at the moment RunAllTests() - // starts. - bool catch_exceptions_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl); -}; // class UnitTestImpl - -// Convenience function for accessing the global UnitTest -// implementation object. -inline UnitTestImpl* GetUnitTestImpl() { - return UnitTest::GetInstance()->impl(); -} - -#if GTEST_USES_SIMPLE_RE - -// Internal helper functions for implementing the simple regular -// expression matcher. -GTEST_API_ bool IsInSet(char ch, const char* str); -GTEST_API_ bool IsAsciiDigit(char ch); -GTEST_API_ bool IsAsciiPunct(char ch); -GTEST_API_ bool IsRepeat(char ch); -GTEST_API_ bool IsAsciiWhiteSpace(char ch); -GTEST_API_ bool IsAsciiWordChar(char ch); -GTEST_API_ bool IsValidEscape(char ch); -GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch); -GTEST_API_ bool ValidateRegex(const char* regex); -GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str); -GTEST_API_ bool MatchRepetitionAndRegexAtHead( - bool escaped, char ch, char repeat, const char* regex, const char* str); -GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str); - -#endif // GTEST_USES_SIMPLE_RE - -// Parses the command line for Google Test flags, without initializing -// other parts of Google Test. -GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv); -GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv); - -#if GTEST_HAS_DEATH_TEST - -// Returns the message describing the last system error, regardless of the -// platform. -GTEST_API_ std::string GetLastErrnoDescription(); - -// Attempts to parse a string into a positive integer pointed to by the -// number parameter. Returns true if that is possible. -// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use -// it here. -template <typename Integer> -bool ParseNaturalNumber(const ::std::string& str, Integer* number) { - // Fail fast if the given string does not begin with a digit; - // this bypasses strtoXXX's "optional leading whitespace and plus - // or minus sign" semantics, which are undesirable here. - if (str.empty() || !IsDigit(str[0])) { - return false; - } - errno = 0; - - char* end; - // BiggestConvertible is the largest integer type that system-provided - // string-to-number conversion routines can return. - -# if GTEST_OS_WINDOWS && !defined(__GNUC__) - - // MSVC and C++ Builder define __int64 instead of the standard long long. - typedef unsigned __int64 BiggestConvertible; - const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10); - -# else - - typedef unsigned long long BiggestConvertible; // NOLINT - const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10); - -# endif // GTEST_OS_WINDOWS && !defined(__GNUC__) - - const bool parse_success = *end == '\0' && errno == 0; - - GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed)); - - const Integer result = static_cast<Integer>(parsed); - if (parse_success && static_cast<BiggestConvertible>(result) == parsed) { - *number = result; - return true; - } - return false; -} -#endif // GTEST_HAS_DEATH_TEST - -// TestResult contains some private methods that should be hidden from -// Google Test user but are required for testing. This class allow our tests -// to access them. -// -// This class is supplied only for the purpose of testing Google Test's own -// constructs. Do not use it in user tests, either directly or indirectly. -class TestResultAccessor { - public: - static void RecordProperty(TestResult* test_result, - const std::string& xml_element, - const TestProperty& property) { - test_result->RecordProperty(xml_element, property); - } - - static void ClearTestPartResults(TestResult* test_result) { - test_result->ClearTestPartResults(); - } - - static const std::vector<testing::TestPartResult>& test_part_results( - const TestResult& test_result) { - return test_result.test_part_results(); - } -}; - -#if GTEST_CAN_STREAM_RESULTS_ - -// Streams test results to the given port on the given host machine. -class StreamingListener : public EmptyTestEventListener { - public: - // Abstract base class for writing strings to a socket. - class AbstractSocketWriter { - public: - virtual ~AbstractSocketWriter() {} - - // Sends a string to the socket. - virtual void Send(const std::string& message) = 0; - - // Closes the socket. - virtual void CloseConnection() {} - - // Sends a string and a newline to the socket. - void SendLn(const std::string& message) { Send(message + "\n"); } - }; - - // Concrete class for actually writing strings to a socket. - class SocketWriter : public AbstractSocketWriter { - public: - SocketWriter(const std::string& host, const std::string& port) - : sockfd_(-1), host_name_(host), port_num_(port) { - MakeConnection(); - } - - ~SocketWriter() override { - if (sockfd_ != -1) - CloseConnection(); - } - - // Sends a string to the socket. - void Send(const std::string& message) override { - GTEST_CHECK_(sockfd_ != -1) - << "Send() can be called only when there is a connection."; - - const auto len = static_cast<size_t>(message.length()); - if (write(sockfd_, message.c_str(), len) != static_cast<ssize_t>(len)) { - GTEST_LOG_(WARNING) - << "stream_result_to: failed to stream to " - << host_name_ << ":" << port_num_; - } - } - - private: - // Creates a client socket and connects to the server. - void MakeConnection(); - - // Closes the socket. - void CloseConnection() override { - GTEST_CHECK_(sockfd_ != -1) - << "CloseConnection() can be called only when there is a connection."; - - close(sockfd_); - sockfd_ = -1; - } - - int sockfd_; // socket file descriptor - const std::string host_name_; - const std::string port_num_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(SocketWriter); - }; // class SocketWriter - - // Escapes '=', '&', '%', and '\n' characters in str as "%xx". - static std::string UrlEncode(const char* str); - - StreamingListener(const std::string& host, const std::string& port) - : socket_writer_(new SocketWriter(host, port)) { - Start(); - } - - explicit StreamingListener(AbstractSocketWriter* socket_writer) - : socket_writer_(socket_writer) { Start(); } - - void OnTestProgramStart(const UnitTest& /* unit_test */) override { - SendLn("event=TestProgramStart"); - } - - void OnTestProgramEnd(const UnitTest& unit_test) override { - // Note that Google Test current only report elapsed time for each - // test iteration, not for the entire test program. - SendLn("event=TestProgramEnd&passed=" + FormatBool(unit_test.Passed())); - - // Notify the streaming server to stop. - socket_writer_->CloseConnection(); - } - - void OnTestIterationStart(const UnitTest& /* unit_test */, - int iteration) override { - SendLn("event=TestIterationStart&iteration=" + - StreamableToString(iteration)); - } - - void OnTestIterationEnd(const UnitTest& unit_test, - int /* iteration */) override { - SendLn("event=TestIterationEnd&passed=" + - FormatBool(unit_test.Passed()) + "&elapsed_time=" + - StreamableToString(unit_test.elapsed_time()) + "ms"); - } - - // Note that "event=TestCaseStart" is a wire format and has to remain - // "case" for compatibilty - void OnTestCaseStart(const TestCase& test_case) override { - SendLn(std::string("event=TestCaseStart&name=") + test_case.name()); - } - - // Note that "event=TestCaseEnd" is a wire format and has to remain - // "case" for compatibilty - void OnTestCaseEnd(const TestCase& test_case) override { - SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed()) + - "&elapsed_time=" + StreamableToString(test_case.elapsed_time()) + - "ms"); - } - - void OnTestStart(const TestInfo& test_info) override { - SendLn(std::string("event=TestStart&name=") + test_info.name()); - } - - void OnTestEnd(const TestInfo& test_info) override { - SendLn("event=TestEnd&passed=" + - FormatBool((test_info.result())->Passed()) + - "&elapsed_time=" + - StreamableToString((test_info.result())->elapsed_time()) + "ms"); - } - - void OnTestPartResult(const TestPartResult& test_part_result) override { - const char* file_name = test_part_result.file_name(); - if (file_name == nullptr) file_name = ""; - SendLn("event=TestPartResult&file=" + UrlEncode(file_name) + - "&line=" + StreamableToString(test_part_result.line_number()) + - "&message=" + UrlEncode(test_part_result.message())); - } - - private: - // Sends the given message and a newline to the socket. - void SendLn(const std::string& message) { socket_writer_->SendLn(message); } - - // Called at the start of streaming to notify the receiver what - // protocol we are using. - void Start() { SendLn("gtest_streaming_protocol_version=1.0"); } - - std::string FormatBool(bool value) { return value ? "1" : "0"; } - - const std::unique_ptr<AbstractSocketWriter> socket_writer_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamingListener); -}; // class StreamingListener - -#endif // GTEST_CAN_STREAM_RESULTS_ - -} // namespace internal -} // namespace testing - -GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 - -#endif // GTEST_SRC_GTEST_INTERNAL_INL_H_ diff --git a/3rdParty/googletest/googletest/src/gtest-matchers.cc b/3rdParty/googletest/googletest/src/gtest-matchers.cc deleted file mode 100644 index 7d2fb6851ec4173af6dddc7ae0720e43e43ace52..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/src/gtest-matchers.cc +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// The Google C++ Testing and Mocking Framework (Google Test) -// -// This file implements just enough of the matcher interface to allow -// EXPECT_DEATH and friends to accept a matcher argument. - -#include "gtest/internal/gtest-internal.h" -#include "gtest/internal/gtest-port.h" -#include "gtest/gtest-matchers.h" - -#include <string> - -namespace testing { - -// Constructs a matcher that matches a const std::string& whose value is -// equal to s. -Matcher<const std::string&>::Matcher(const std::string& s) { *this = Eq(s); } - -// Constructs a matcher that matches a const std::string& whose value is -// equal to s. -Matcher<const std::string&>::Matcher(const char* s) { - *this = Eq(std::string(s)); -} - -// Constructs a matcher that matches a std::string whose value is equal to -// s. -Matcher<std::string>::Matcher(const std::string& s) { *this = Eq(s); } - -// Constructs a matcher that matches a std::string whose value is equal to -// s. -Matcher<std::string>::Matcher(const char* s) { *this = Eq(std::string(s)); } - -#if GTEST_HAS_ABSL -// Constructs a matcher that matches a const absl::string_view& whose value is -// equal to s. -Matcher<const absl::string_view&>::Matcher(const std::string& s) { - *this = Eq(s); -} - -// Constructs a matcher that matches a const absl::string_view& whose value is -// equal to s. -Matcher<const absl::string_view&>::Matcher(const char* s) { - *this = Eq(std::string(s)); -} - -// Constructs a matcher that matches a const absl::string_view& whose value is -// equal to s. -Matcher<const absl::string_view&>::Matcher(absl::string_view s) { - *this = Eq(std::string(s)); -} - -// Constructs a matcher that matches a absl::string_view whose value is equal to -// s. -Matcher<absl::string_view>::Matcher(const std::string& s) { *this = Eq(s); } - -// Constructs a matcher that matches a absl::string_view whose value is equal to -// s. -Matcher<absl::string_view>::Matcher(const char* s) { - *this = Eq(std::string(s)); -} - -// Constructs a matcher that matches a absl::string_view whose value is equal to -// s. -Matcher<absl::string_view>::Matcher(absl::string_view s) { - *this = Eq(std::string(s)); -} -#endif // GTEST_HAS_ABSL - -} // namespace testing diff --git a/3rdParty/googletest/googletest/src/gtest-port.cc b/3rdParty/googletest/googletest/src/gtest-port.cc deleted file mode 100644 index fc5ba6becc55fd2cd6bb178454a7edc56998b1ab..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/src/gtest-port.cc +++ /dev/null @@ -1,1399 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#include "gtest/internal/gtest-port.h" - -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <fstream> -#include <memory> - -#if GTEST_OS_WINDOWS -# include <windows.h> -# include <io.h> -# include <sys/stat.h> -# include <map> // Used in ThreadLocal. -# ifdef _MSC_VER -# include <crtdbg.h> -# endif // _MSC_VER -#else -# include <unistd.h> -#endif // GTEST_OS_WINDOWS - -#if GTEST_OS_MAC -# include <mach/mach_init.h> -# include <mach/task.h> -# include <mach/vm_map.h> -#endif // GTEST_OS_MAC - -#if GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD || \ - GTEST_OS_NETBSD || GTEST_OS_OPENBSD -# include <sys/sysctl.h> -# if GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD -# include <sys/user.h> -# endif -#endif - -#if GTEST_OS_QNX -# include <devctl.h> -# include <fcntl.h> -# include <sys/procfs.h> -#endif // GTEST_OS_QNX - -#if GTEST_OS_AIX -# include <procinfo.h> -# include <sys/types.h> -#endif // GTEST_OS_AIX - -#if GTEST_OS_FUCHSIA -# include <zircon/process.h> -# include <zircon/syscalls.h> -#endif // GTEST_OS_FUCHSIA - -#include "gtest/gtest-spi.h" -#include "gtest/gtest-message.h" -#include "gtest/internal/gtest-internal.h" -#include "gtest/internal/gtest-string.h" -#include "src/gtest-internal-inl.h" - -namespace testing { -namespace internal { - -#if defined(_MSC_VER) || defined(__BORLANDC__) -// MSVC and C++Builder do not provide a definition of STDERR_FILENO. -const int kStdOutFileno = 1; -const int kStdErrFileno = 2; -#else -const int kStdOutFileno = STDOUT_FILENO; -const int kStdErrFileno = STDERR_FILENO; -#endif // _MSC_VER - -#if GTEST_OS_LINUX - -namespace { -template <typename T> -T ReadProcFileField(const std::string& filename, int field) { - std::string dummy; - std::ifstream file(filename.c_str()); - while (field-- > 0) { - file >> dummy; - } - T output = 0; - file >> output; - return output; -} -} // namespace - -// Returns the number of active threads, or 0 when there is an error. -size_t GetThreadCount() { - const std::string filename = - (Message() << "/proc/" << getpid() << "/stat").GetString(); - return ReadProcFileField<size_t>(filename, 19); -} - -#elif GTEST_OS_MAC - -size_t GetThreadCount() { - const task_t task = mach_task_self(); - mach_msg_type_number_t thread_count; - thread_act_array_t thread_list; - const kern_return_t status = task_threads(task, &thread_list, &thread_count); - if (status == KERN_SUCCESS) { - // task_threads allocates resources in thread_list and we need to free them - // to avoid leaks. - vm_deallocate(task, - reinterpret_cast<vm_address_t>(thread_list), - sizeof(thread_t) * thread_count); - return static_cast<size_t>(thread_count); - } else { - return 0; - } -} - -#elif GTEST_OS_DRAGONFLY || GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD || \ - GTEST_OS_NETBSD - -#if GTEST_OS_NETBSD -#undef KERN_PROC -#define KERN_PROC KERN_PROC2 -#define kinfo_proc kinfo_proc2 -#endif - -#if GTEST_OS_DRAGONFLY -#define KP_NLWP(kp) (kp.kp_nthreads) -#elif GTEST_OS_FREEBSD || GTEST_OS_GNU_KFREEBSD -#define KP_NLWP(kp) (kp.ki_numthreads) -#elif GTEST_OS_NETBSD -#define KP_NLWP(kp) (kp.p_nlwps) -#endif - -// Returns the number of threads running in the process, or 0 to indicate that -// we cannot detect it. -size_t GetThreadCount() { - int mib[] = { - CTL_KERN, - KERN_PROC, - KERN_PROC_PID, - getpid(), -#if GTEST_OS_NETBSD - sizeof(struct kinfo_proc), - 1, -#endif - }; - u_int miblen = sizeof(mib) / sizeof(mib[0]); - struct kinfo_proc info; - size_t size = sizeof(info); - if (sysctl(mib, miblen, &info, &size, NULL, 0)) { - return 0; - } - return static_cast<size_t>(KP_NLWP(info)); -} -#elif GTEST_OS_OPENBSD - -// Returns the number of threads running in the process, or 0 to indicate that -// we cannot detect it. -size_t GetThreadCount() { - int mib[] = { - CTL_KERN, - KERN_PROC, - KERN_PROC_PID | KERN_PROC_SHOW_THREADS, - getpid(), - sizeof(struct kinfo_proc), - 0, - }; - u_int miblen = sizeof(mib) / sizeof(mib[0]); - - // get number of structs - size_t size; - if (sysctl(mib, miblen, NULL, &size, NULL, 0)) { - return 0; - } - mib[5] = size / mib[4]; - - // populate array of structs - struct kinfo_proc info[mib[5]]; - if (sysctl(mib, miblen, &info, &size, NULL, 0)) { - return 0; - } - - // exclude empty members - int nthreads = 0; - for (int i = 0; i < size / mib[4]; i++) { - if (info[i].p_tid != -1) - nthreads++; - } - return nthreads; -} - -#elif GTEST_OS_QNX - -// Returns the number of threads running in the process, or 0 to indicate that -// we cannot detect it. -size_t GetThreadCount() { - const int fd = open("/proc/self/as", O_RDONLY); - if (fd < 0) { - return 0; - } - procfs_info process_info; - const int status = - devctl(fd, DCMD_PROC_INFO, &process_info, sizeof(process_info), nullptr); - close(fd); - if (status == EOK) { - return static_cast<size_t>(process_info.num_threads); - } else { - return 0; - } -} - -#elif GTEST_OS_AIX - -size_t GetThreadCount() { - struct procentry64 entry; - pid_t pid = getpid(); - int status = getprocs64(&entry, sizeof(entry), nullptr, 0, &pid, 1); - if (status == 1) { - return entry.pi_thcount; - } else { - return 0; - } -} - -#elif GTEST_OS_FUCHSIA - -size_t GetThreadCount() { - int dummy_buffer; - size_t avail; - zx_status_t status = zx_object_get_info( - zx_process_self(), - ZX_INFO_PROCESS_THREADS, - &dummy_buffer, - 0, - nullptr, - &avail); - if (status == ZX_OK) { - return avail; - } else { - return 0; - } -} - -#else - -size_t GetThreadCount() { - // There's no portable way to detect the number of threads, so we just - // return 0 to indicate that we cannot detect it. - return 0; -} - -#endif // GTEST_OS_LINUX - -#if GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS - -void SleepMilliseconds(int n) { - ::Sleep(static_cast<DWORD>(n)); -} - -AutoHandle::AutoHandle() - : handle_(INVALID_HANDLE_VALUE) {} - -AutoHandle::AutoHandle(Handle handle) - : handle_(handle) {} - -AutoHandle::~AutoHandle() { - Reset(); -} - -AutoHandle::Handle AutoHandle::Get() const { - return handle_; -} - -void AutoHandle::Reset() { - Reset(INVALID_HANDLE_VALUE); -} - -void AutoHandle::Reset(HANDLE handle) { - // Resetting with the same handle we already own is invalid. - if (handle_ != handle) { - if (IsCloseable()) { - ::CloseHandle(handle_); - } - handle_ = handle; - } else { - GTEST_CHECK_(!IsCloseable()) - << "Resetting a valid handle to itself is likely a programmer error " - "and thus not allowed."; - } -} - -bool AutoHandle::IsCloseable() const { - // Different Windows APIs may use either of these values to represent an - // invalid handle. - return handle_ != nullptr && handle_ != INVALID_HANDLE_VALUE; -} - -Notification::Notification() - : event_(::CreateEvent(nullptr, // Default security attributes. - TRUE, // Do not reset automatically. - FALSE, // Initially unset. - nullptr)) { // Anonymous event. - GTEST_CHECK_(event_.Get() != nullptr); -} - -void Notification::Notify() { - GTEST_CHECK_(::SetEvent(event_.Get()) != FALSE); -} - -void Notification::WaitForNotification() { - GTEST_CHECK_( - ::WaitForSingleObject(event_.Get(), INFINITE) == WAIT_OBJECT_0); -} - -Mutex::Mutex() - : owner_thread_id_(0), - type_(kDynamic), - critical_section_init_phase_(0), - critical_section_(new CRITICAL_SECTION) { - ::InitializeCriticalSection(critical_section_); -} - -Mutex::~Mutex() { - // Static mutexes are leaked intentionally. It is not thread-safe to try - // to clean them up. - if (type_ == kDynamic) { - ::DeleteCriticalSection(critical_section_); - delete critical_section_; - critical_section_ = nullptr; - } -} - -void Mutex::Lock() { - ThreadSafeLazyInit(); - ::EnterCriticalSection(critical_section_); - owner_thread_id_ = ::GetCurrentThreadId(); -} - -void Mutex::Unlock() { - ThreadSafeLazyInit(); - // We don't protect writing to owner_thread_id_ here, as it's the - // caller's responsibility to ensure that the current thread holds the - // mutex when this is called. - owner_thread_id_ = 0; - ::LeaveCriticalSection(critical_section_); -} - -// Does nothing if the current thread holds the mutex. Otherwise, crashes -// with high probability. -void Mutex::AssertHeld() { - ThreadSafeLazyInit(); - GTEST_CHECK_(owner_thread_id_ == ::GetCurrentThreadId()) - << "The current thread is not holding the mutex @" << this; -} - -namespace { - -#ifdef _MSC_VER -// Use the RAII idiom to flag mem allocs that are intentionally never -// deallocated. The motivation is to silence the false positive mem leaks -// that are reported by the debug version of MS's CRT which can only detect -// if an alloc is missing a matching deallocation. -// Example: -// MemoryIsNotDeallocated memory_is_not_deallocated; -// critical_section_ = new CRITICAL_SECTION; -// -class MemoryIsNotDeallocated -{ - public: - MemoryIsNotDeallocated() : old_crtdbg_flag_(0) { - old_crtdbg_flag_ = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); - // Set heap allocation block type to _IGNORE_BLOCK so that MS debug CRT - // doesn't report mem leak if there's no matching deallocation. - _CrtSetDbgFlag(old_crtdbg_flag_ & ~_CRTDBG_ALLOC_MEM_DF); - } - - ~MemoryIsNotDeallocated() { - // Restore the original _CRTDBG_ALLOC_MEM_DF flag - _CrtSetDbgFlag(old_crtdbg_flag_); - } - - private: - int old_crtdbg_flag_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(MemoryIsNotDeallocated); -}; -#endif // _MSC_VER - -} // namespace - -// Initializes owner_thread_id_ and critical_section_ in static mutexes. -void Mutex::ThreadSafeLazyInit() { - // Dynamic mutexes are initialized in the constructor. - if (type_ == kStatic) { - switch ( - ::InterlockedCompareExchange(&critical_section_init_phase_, 1L, 0L)) { - case 0: - // If critical_section_init_phase_ was 0 before the exchange, we - // are the first to test it and need to perform the initialization. - owner_thread_id_ = 0; - { - // Use RAII to flag that following mem alloc is never deallocated. -#ifdef _MSC_VER - MemoryIsNotDeallocated memory_is_not_deallocated; -#endif // _MSC_VER - critical_section_ = new CRITICAL_SECTION; - } - ::InitializeCriticalSection(critical_section_); - // Updates the critical_section_init_phase_ to 2 to signal - // initialization complete. - GTEST_CHECK_(::InterlockedCompareExchange( - &critical_section_init_phase_, 2L, 1L) == - 1L); - break; - case 1: - // Somebody else is already initializing the mutex; spin until they - // are done. - while (::InterlockedCompareExchange(&critical_section_init_phase_, - 2L, - 2L) != 2L) { - // Possibly yields the rest of the thread's time slice to other - // threads. - ::Sleep(0); - } - break; - - case 2: - break; // The mutex is already initialized and ready for use. - - default: - GTEST_CHECK_(false) - << "Unexpected value of critical_section_init_phase_ " - << "while initializing a static mutex."; - } - } -} - -namespace { - -class ThreadWithParamSupport : public ThreadWithParamBase { - public: - static HANDLE CreateThread(Runnable* runnable, - Notification* thread_can_start) { - ThreadMainParam* param = new ThreadMainParam(runnable, thread_can_start); - DWORD thread_id; - HANDLE thread_handle = ::CreateThread( - nullptr, // Default security. - 0, // Default stack size. - &ThreadWithParamSupport::ThreadMain, - param, // Parameter to ThreadMainStatic - 0x0, // Default creation flags. - &thread_id); // Need a valid pointer for the call to work under Win98. - GTEST_CHECK_(thread_handle != nullptr) - << "CreateThread failed with error " << ::GetLastError() << "."; - if (thread_handle == nullptr) { - delete param; - } - return thread_handle; - } - - private: - struct ThreadMainParam { - ThreadMainParam(Runnable* runnable, Notification* thread_can_start) - : runnable_(runnable), - thread_can_start_(thread_can_start) { - } - std::unique_ptr<Runnable> runnable_; - // Does not own. - Notification* thread_can_start_; - }; - - static DWORD WINAPI ThreadMain(void* ptr) { - // Transfers ownership. - std::unique_ptr<ThreadMainParam> param(static_cast<ThreadMainParam*>(ptr)); - if (param->thread_can_start_ != nullptr) - param->thread_can_start_->WaitForNotification(); - param->runnable_->Run(); - return 0; - } - - // Prohibit instantiation. - ThreadWithParamSupport(); - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadWithParamSupport); -}; - -} // namespace - -ThreadWithParamBase::ThreadWithParamBase(Runnable *runnable, - Notification* thread_can_start) - : thread_(ThreadWithParamSupport::CreateThread(runnable, - thread_can_start)) { -} - -ThreadWithParamBase::~ThreadWithParamBase() { - Join(); -} - -void ThreadWithParamBase::Join() { - GTEST_CHECK_(::WaitForSingleObject(thread_.Get(), INFINITE) == WAIT_OBJECT_0) - << "Failed to join the thread with error " << ::GetLastError() << "."; -} - -// Maps a thread to a set of ThreadIdToThreadLocals that have values -// instantiated on that thread and notifies them when the thread exits. A -// ThreadLocal instance is expected to persist until all threads it has -// values on have terminated. -class ThreadLocalRegistryImpl { - public: - // Registers thread_local_instance as having value on the current thread. - // Returns a value that can be used to identify the thread from other threads. - static ThreadLocalValueHolderBase* GetValueOnCurrentThread( - const ThreadLocalBase* thread_local_instance) { - DWORD current_thread = ::GetCurrentThreadId(); - MutexLock lock(&mutex_); - ThreadIdToThreadLocals* const thread_to_thread_locals = - GetThreadLocalsMapLocked(); - ThreadIdToThreadLocals::iterator thread_local_pos = - thread_to_thread_locals->find(current_thread); - if (thread_local_pos == thread_to_thread_locals->end()) { - thread_local_pos = thread_to_thread_locals->insert( - std::make_pair(current_thread, ThreadLocalValues())).first; - StartWatcherThreadFor(current_thread); - } - ThreadLocalValues& thread_local_values = thread_local_pos->second; - ThreadLocalValues::iterator value_pos = - thread_local_values.find(thread_local_instance); - if (value_pos == thread_local_values.end()) { - value_pos = - thread_local_values - .insert(std::make_pair( - thread_local_instance, - std::shared_ptr<ThreadLocalValueHolderBase>( - thread_local_instance->NewValueForCurrentThread()))) - .first; - } - return value_pos->second.get(); - } - - static void OnThreadLocalDestroyed( - const ThreadLocalBase* thread_local_instance) { - std::vector<std::shared_ptr<ThreadLocalValueHolderBase> > value_holders; - // Clean up the ThreadLocalValues data structure while holding the lock, but - // defer the destruction of the ThreadLocalValueHolderBases. - { - MutexLock lock(&mutex_); - ThreadIdToThreadLocals* const thread_to_thread_locals = - GetThreadLocalsMapLocked(); - for (ThreadIdToThreadLocals::iterator it = - thread_to_thread_locals->begin(); - it != thread_to_thread_locals->end(); - ++it) { - ThreadLocalValues& thread_local_values = it->second; - ThreadLocalValues::iterator value_pos = - thread_local_values.find(thread_local_instance); - if (value_pos != thread_local_values.end()) { - value_holders.push_back(value_pos->second); - thread_local_values.erase(value_pos); - // This 'if' can only be successful at most once, so theoretically we - // could break out of the loop here, but we don't bother doing so. - } - } - } - // Outside the lock, let the destructor for 'value_holders' deallocate the - // ThreadLocalValueHolderBases. - } - - static void OnThreadExit(DWORD thread_id) { - GTEST_CHECK_(thread_id != 0) << ::GetLastError(); - std::vector<std::shared_ptr<ThreadLocalValueHolderBase> > value_holders; - // Clean up the ThreadIdToThreadLocals data structure while holding the - // lock, but defer the destruction of the ThreadLocalValueHolderBases. - { - MutexLock lock(&mutex_); - ThreadIdToThreadLocals* const thread_to_thread_locals = - GetThreadLocalsMapLocked(); - ThreadIdToThreadLocals::iterator thread_local_pos = - thread_to_thread_locals->find(thread_id); - if (thread_local_pos != thread_to_thread_locals->end()) { - ThreadLocalValues& thread_local_values = thread_local_pos->second; - for (ThreadLocalValues::iterator value_pos = - thread_local_values.begin(); - value_pos != thread_local_values.end(); - ++value_pos) { - value_holders.push_back(value_pos->second); - } - thread_to_thread_locals->erase(thread_local_pos); - } - } - // Outside the lock, let the destructor for 'value_holders' deallocate the - // ThreadLocalValueHolderBases. - } - - private: - // In a particular thread, maps a ThreadLocal object to its value. - typedef std::map<const ThreadLocalBase*, - std::shared_ptr<ThreadLocalValueHolderBase> > - ThreadLocalValues; - // Stores all ThreadIdToThreadLocals having values in a thread, indexed by - // thread's ID. - typedef std::map<DWORD, ThreadLocalValues> ThreadIdToThreadLocals; - - // Holds the thread id and thread handle that we pass from - // StartWatcherThreadFor to WatcherThreadFunc. - typedef std::pair<DWORD, HANDLE> ThreadIdAndHandle; - - static void StartWatcherThreadFor(DWORD thread_id) { - // The returned handle will be kept in thread_map and closed by - // watcher_thread in WatcherThreadFunc. - HANDLE thread = ::OpenThread(SYNCHRONIZE | THREAD_QUERY_INFORMATION, - FALSE, - thread_id); - GTEST_CHECK_(thread != nullptr); - // We need to pass a valid thread ID pointer into CreateThread for it - // to work correctly under Win98. - DWORD watcher_thread_id; - HANDLE watcher_thread = ::CreateThread( - nullptr, // Default security. - 0, // Default stack size - &ThreadLocalRegistryImpl::WatcherThreadFunc, - reinterpret_cast<LPVOID>(new ThreadIdAndHandle(thread_id, thread)), - CREATE_SUSPENDED, &watcher_thread_id); - GTEST_CHECK_(watcher_thread != nullptr); - // Give the watcher thread the same priority as ours to avoid being - // blocked by it. - ::SetThreadPriority(watcher_thread, - ::GetThreadPriority(::GetCurrentThread())); - ::ResumeThread(watcher_thread); - ::CloseHandle(watcher_thread); - } - - // Monitors exit from a given thread and notifies those - // ThreadIdToThreadLocals about thread termination. - static DWORD WINAPI WatcherThreadFunc(LPVOID param) { - const ThreadIdAndHandle* tah = - reinterpret_cast<const ThreadIdAndHandle*>(param); - GTEST_CHECK_( - ::WaitForSingleObject(tah->second, INFINITE) == WAIT_OBJECT_0); - OnThreadExit(tah->first); - ::CloseHandle(tah->second); - delete tah; - return 0; - } - - // Returns map of thread local instances. - static ThreadIdToThreadLocals* GetThreadLocalsMapLocked() { - mutex_.AssertHeld(); -#ifdef _MSC_VER - MemoryIsNotDeallocated memory_is_not_deallocated; -#endif // _MSC_VER - static ThreadIdToThreadLocals* map = new ThreadIdToThreadLocals(); - return map; - } - - // Protects access to GetThreadLocalsMapLocked() and its return value. - static Mutex mutex_; - // Protects access to GetThreadMapLocked() and its return value. - static Mutex thread_map_mutex_; -}; - -Mutex ThreadLocalRegistryImpl::mutex_(Mutex::kStaticMutex); -Mutex ThreadLocalRegistryImpl::thread_map_mutex_(Mutex::kStaticMutex); - -ThreadLocalValueHolderBase* ThreadLocalRegistry::GetValueOnCurrentThread( - const ThreadLocalBase* thread_local_instance) { - return ThreadLocalRegistryImpl::GetValueOnCurrentThread( - thread_local_instance); -} - -void ThreadLocalRegistry::OnThreadLocalDestroyed( - const ThreadLocalBase* thread_local_instance) { - ThreadLocalRegistryImpl::OnThreadLocalDestroyed(thread_local_instance); -} - -#endif // GTEST_IS_THREADSAFE && GTEST_OS_WINDOWS - -#if GTEST_USES_POSIX_RE - -// Implements RE. Currently only needed for death tests. - -RE::~RE() { - if (is_valid_) { - // regfree'ing an invalid regex might crash because the content - // of the regex is undefined. Since the regex's are essentially - // the same, one cannot be valid (or invalid) without the other - // being so too. - regfree(&partial_regex_); - regfree(&full_regex_); - } - free(const_cast<char*>(pattern_)); -} - -// Returns true if and only if regular expression re matches the entire str. -bool RE::FullMatch(const char* str, const RE& re) { - if (!re.is_valid_) return false; - - regmatch_t match; - return regexec(&re.full_regex_, str, 1, &match, 0) == 0; -} - -// Returns true if and only if regular expression re matches a substring of -// str (including str itself). -bool RE::PartialMatch(const char* str, const RE& re) { - if (!re.is_valid_) return false; - - regmatch_t match; - return regexec(&re.partial_regex_, str, 1, &match, 0) == 0; -} - -// Initializes an RE from its string representation. -void RE::Init(const char* regex) { - pattern_ = posix::StrDup(regex); - - // Reserves enough bytes to hold the regular expression used for a - // full match. - const size_t full_regex_len = strlen(regex) + 10; - char* const full_pattern = new char[full_regex_len]; - - snprintf(full_pattern, full_regex_len, "^(%s)$", regex); - is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0; - // We want to call regcomp(&partial_regex_, ...) even if the - // previous expression returns false. Otherwise partial_regex_ may - // not be properly initialized can may cause trouble when it's - // freed. - // - // Some implementation of POSIX regex (e.g. on at least some - // versions of Cygwin) doesn't accept the empty string as a valid - // regex. We change it to an equivalent form "()" to be safe. - if (is_valid_) { - const char* const partial_regex = (*regex == '\0') ? "()" : regex; - is_valid_ = regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0; - } - EXPECT_TRUE(is_valid_) - << "Regular expression \"" << regex - << "\" is not a valid POSIX Extended regular expression."; - - delete[] full_pattern; -} - -#elif GTEST_USES_SIMPLE_RE - -// Returns true if and only if ch appears anywhere in str (excluding the -// terminating '\0' character). -bool IsInSet(char ch, const char* str) { - return ch != '\0' && strchr(str, ch) != nullptr; -} - -// Returns true if and only if ch belongs to the given classification. -// Unlike similar functions in <ctype.h>, these aren't affected by the -// current locale. -bool IsAsciiDigit(char ch) { return '0' <= ch && ch <= '9'; } -bool IsAsciiPunct(char ch) { - return IsInSet(ch, "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"); -} -bool IsRepeat(char ch) { return IsInSet(ch, "?*+"); } -bool IsAsciiWhiteSpace(char ch) { return IsInSet(ch, " \f\n\r\t\v"); } -bool IsAsciiWordChar(char ch) { - return ('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') || - ('0' <= ch && ch <= '9') || ch == '_'; -} - -// Returns true if and only if "\\c" is a supported escape sequence. -bool IsValidEscape(char c) { - return (IsAsciiPunct(c) || IsInSet(c, "dDfnrsStvwW")); -} - -// Returns true if and only if the given atom (specified by escaped and -// pattern) matches ch. The result is undefined if the atom is invalid. -bool AtomMatchesChar(bool escaped, char pattern_char, char ch) { - if (escaped) { // "\\p" where p is pattern_char. - switch (pattern_char) { - case 'd': return IsAsciiDigit(ch); - case 'D': return !IsAsciiDigit(ch); - case 'f': return ch == '\f'; - case 'n': return ch == '\n'; - case 'r': return ch == '\r'; - case 's': return IsAsciiWhiteSpace(ch); - case 'S': return !IsAsciiWhiteSpace(ch); - case 't': return ch == '\t'; - case 'v': return ch == '\v'; - case 'w': return IsAsciiWordChar(ch); - case 'W': return !IsAsciiWordChar(ch); - } - return IsAsciiPunct(pattern_char) && pattern_char == ch; - } - - return (pattern_char == '.' && ch != '\n') || pattern_char == ch; -} - -// Helper function used by ValidateRegex() to format error messages. -static std::string FormatRegexSyntaxError(const char* regex, int index) { - return (Message() << "Syntax error at index " << index - << " in simple regular expression \"" << regex << "\": ").GetString(); -} - -// Generates non-fatal failures and returns false if regex is invalid; -// otherwise returns true. -bool ValidateRegex(const char* regex) { - if (regex == nullptr) { - ADD_FAILURE() << "NULL is not a valid simple regular expression."; - return false; - } - - bool is_valid = true; - - // True if and only if ?, *, or + can follow the previous atom. - bool prev_repeatable = false; - for (int i = 0; regex[i]; i++) { - if (regex[i] == '\\') { // An escape sequence - i++; - if (regex[i] == '\0') { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1) - << "'\\' cannot appear at the end."; - return false; - } - - if (!IsValidEscape(regex[i])) { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i - 1) - << "invalid escape sequence \"\\" << regex[i] << "\"."; - is_valid = false; - } - prev_repeatable = true; - } else { // Not an escape sequence. - const char ch = regex[i]; - - if (ch == '^' && i > 0) { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i) - << "'^' can only appear at the beginning."; - is_valid = false; - } else if (ch == '$' && regex[i + 1] != '\0') { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i) - << "'$' can only appear at the end."; - is_valid = false; - } else if (IsInSet(ch, "()[]{}|")) { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i) - << "'" << ch << "' is unsupported."; - is_valid = false; - } else if (IsRepeat(ch) && !prev_repeatable) { - ADD_FAILURE() << FormatRegexSyntaxError(regex, i) - << "'" << ch << "' can only follow a repeatable token."; - is_valid = false; - } - - prev_repeatable = !IsInSet(ch, "^$?*+"); - } - } - - return is_valid; -} - -// Matches a repeated regex atom followed by a valid simple regular -// expression. The regex atom is defined as c if escaped is false, -// or \c otherwise. repeat is the repetition meta character (?, *, -// or +). The behavior is undefined if str contains too many -// characters to be indexable by size_t, in which case the test will -// probably time out anyway. We are fine with this limitation as -// std::string has it too. -bool MatchRepetitionAndRegexAtHead( - bool escaped, char c, char repeat, const char* regex, - const char* str) { - const size_t min_count = (repeat == '+') ? 1 : 0; - const size_t max_count = (repeat == '?') ? 1 : - static_cast<size_t>(-1) - 1; - // We cannot call numeric_limits::max() as it conflicts with the - // max() macro on Windows. - - for (size_t i = 0; i <= max_count; ++i) { - // We know that the atom matches each of the first i characters in str. - if (i >= min_count && MatchRegexAtHead(regex, str + i)) { - // We have enough matches at the head, and the tail matches too. - // Since we only care about *whether* the pattern matches str - // (as opposed to *how* it matches), there is no need to find a - // greedy match. - return true; - } - if (str[i] == '\0' || !AtomMatchesChar(escaped, c, str[i])) - return false; - } - return false; -} - -// Returns true if and only if regex matches a prefix of str. regex must -// be a valid simple regular expression and not start with "^", or the -// result is undefined. -bool MatchRegexAtHead(const char* regex, const char* str) { - if (*regex == '\0') // An empty regex matches a prefix of anything. - return true; - - // "$" only matches the end of a string. Note that regex being - // valid guarantees that there's nothing after "$" in it. - if (*regex == '$') - return *str == '\0'; - - // Is the first thing in regex an escape sequence? - const bool escaped = *regex == '\\'; - if (escaped) - ++regex; - if (IsRepeat(regex[1])) { - // MatchRepetitionAndRegexAtHead() calls MatchRegexAtHead(), so - // here's an indirect recursion. It terminates as the regex gets - // shorter in each recursion. - return MatchRepetitionAndRegexAtHead( - escaped, regex[0], regex[1], regex + 2, str); - } else { - // regex isn't empty, isn't "$", and doesn't start with a - // repetition. We match the first atom of regex with the first - // character of str and recurse. - return (*str != '\0') && AtomMatchesChar(escaped, *regex, *str) && - MatchRegexAtHead(regex + 1, str + 1); - } -} - -// Returns true if and only if regex matches any substring of str. regex must -// be a valid simple regular expression, or the result is undefined. -// -// The algorithm is recursive, but the recursion depth doesn't exceed -// the regex length, so we won't need to worry about running out of -// stack space normally. In rare cases the time complexity can be -// exponential with respect to the regex length + the string length, -// but usually it's must faster (often close to linear). -bool MatchRegexAnywhere(const char* regex, const char* str) { - if (regex == nullptr || str == nullptr) return false; - - if (*regex == '^') - return MatchRegexAtHead(regex + 1, str); - - // A successful match can be anywhere in str. - do { - if (MatchRegexAtHead(regex, str)) - return true; - } while (*str++ != '\0'); - return false; -} - -// Implements the RE class. - -RE::~RE() { - free(const_cast<char*>(pattern_)); - free(const_cast<char*>(full_pattern_)); -} - -// Returns true if and only if regular expression re matches the entire str. -bool RE::FullMatch(const char* str, const RE& re) { - return re.is_valid_ && MatchRegexAnywhere(re.full_pattern_, str); -} - -// Returns true if and only if regular expression re matches a substring of -// str (including str itself). -bool RE::PartialMatch(const char* str, const RE& re) { - return re.is_valid_ && MatchRegexAnywhere(re.pattern_, str); -} - -// Initializes an RE from its string representation. -void RE::Init(const char* regex) { - pattern_ = full_pattern_ = nullptr; - if (regex != nullptr) { - pattern_ = posix::StrDup(regex); - } - - is_valid_ = ValidateRegex(regex); - if (!is_valid_) { - // No need to calculate the full pattern when the regex is invalid. - return; - } - - const size_t len = strlen(regex); - // Reserves enough bytes to hold the regular expression used for a - // full match: we need space to prepend a '^', append a '$', and - // terminate the string with '\0'. - char* buffer = static_cast<char*>(malloc(len + 3)); - full_pattern_ = buffer; - - if (*regex != '^') - *buffer++ = '^'; // Makes sure full_pattern_ starts with '^'. - - // We don't use snprintf or strncpy, as they trigger a warning when - // compiled with VC++ 8.0. - memcpy(buffer, regex, len); - buffer += len; - - if (len == 0 || regex[len - 1] != '$') - *buffer++ = '$'; // Makes sure full_pattern_ ends with '$'. - - *buffer = '\0'; -} - -#endif // GTEST_USES_POSIX_RE - -const char kUnknownFile[] = "unknown file"; - -// Formats a source file path and a line number as they would appear -// in an error message from the compiler used to compile this code. -GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) { - const std::string file_name(file == nullptr ? kUnknownFile : file); - - if (line < 0) { - return file_name + ":"; - } -#ifdef _MSC_VER - return file_name + "(" + StreamableToString(line) + "):"; -#else - return file_name + ":" + StreamableToString(line) + ":"; -#endif // _MSC_VER -} - -// Formats a file location for compiler-independent XML output. -// Although this function is not platform dependent, we put it next to -// FormatFileLocation in order to contrast the two functions. -// Note that FormatCompilerIndependentFileLocation() does NOT append colon -// to the file location it produces, unlike FormatFileLocation(). -GTEST_API_ ::std::string FormatCompilerIndependentFileLocation( - const char* file, int line) { - const std::string file_name(file == nullptr ? kUnknownFile : file); - - if (line < 0) - return file_name; - else - return file_name + ":" + StreamableToString(line); -} - -GTestLog::GTestLog(GTestLogSeverity severity, const char* file, int line) - : severity_(severity) { - const char* const marker = - severity == GTEST_INFO ? "[ INFO ]" : - severity == GTEST_WARNING ? "[WARNING]" : - severity == GTEST_ERROR ? "[ ERROR ]" : "[ FATAL ]"; - GetStream() << ::std::endl << marker << " " - << FormatFileLocation(file, line).c_str() << ": "; -} - -// Flushes the buffers and, if severity is GTEST_FATAL, aborts the program. -GTestLog::~GTestLog() { - GetStream() << ::std::endl; - if (severity_ == GTEST_FATAL) { - fflush(stderr); - posix::Abort(); - } -} - -// Disable Microsoft deprecation warnings for POSIX functions called from -// this class (creat, dup, dup2, and close) -GTEST_DISABLE_MSC_DEPRECATED_PUSH_() - -#if GTEST_HAS_STREAM_REDIRECTION - -// Object that captures an output stream (stdout/stderr). -class CapturedStream { - public: - // The ctor redirects the stream to a temporary file. - explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) { -# if GTEST_OS_WINDOWS - char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT - char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT - - ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path); - const UINT success = ::GetTempFileNameA(temp_dir_path, - "gtest_redir", - 0, // Generate unique file name. - temp_file_path); - GTEST_CHECK_(success != 0) - << "Unable to create a temporary file in " << temp_dir_path; - const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE); - GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file " - << temp_file_path; - filename_ = temp_file_path; -# else - // There's no guarantee that a test has write access to the current - // directory, so we create the temporary file in the /tmp directory - // instead. We use /tmp on most systems, and /sdcard on Android. - // That's because Android doesn't have /tmp. -# if GTEST_OS_LINUX_ANDROID - // Note: Android applications are expected to call the framework's - // Context.getExternalStorageDirectory() method through JNI to get - // the location of the world-writable SD Card directory. However, - // this requires a Context handle, which cannot be retrieved - // globally from native code. Doing so also precludes running the - // code as part of a regular standalone executable, which doesn't - // run in a Dalvik process (e.g. when running it through 'adb shell'). - // - // The location /data/local/tmp is directly accessible from native code. - // '/sdcard' and other variants cannot be relied on, as they are not - // guaranteed to be mounted, or may have a delay in mounting. - char name_template[] = "/data/local/tmp/gtest_captured_stream.XXXXXX"; -# else - char name_template[] = "/tmp/captured_stream.XXXXXX"; -# endif // GTEST_OS_LINUX_ANDROID - const int captured_fd = mkstemp(name_template); - if (captured_fd == -1) { - GTEST_LOG_(WARNING) - << "Failed to create tmp file " << name_template - << " for test; does the test have access to the /tmp directory?"; - } - filename_ = name_template; -# endif // GTEST_OS_WINDOWS - fflush(nullptr); - dup2(captured_fd, fd_); - close(captured_fd); - } - - ~CapturedStream() { - remove(filename_.c_str()); - } - - std::string GetCapturedString() { - if (uncaptured_fd_ != -1) { - // Restores the original stream. - fflush(nullptr); - dup2(uncaptured_fd_, fd_); - close(uncaptured_fd_); - uncaptured_fd_ = -1; - } - - FILE* const file = posix::FOpen(filename_.c_str(), "r"); - if (file == nullptr) { - GTEST_LOG_(FATAL) << "Failed to open tmp file " << filename_ - << " for capturing stream."; - } - const std::string content = ReadEntireFile(file); - posix::FClose(file); - return content; - } - - private: - const int fd_; // A stream to capture. - int uncaptured_fd_; - // Name of the temporary file holding the stderr output. - ::std::string filename_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream); -}; - -GTEST_DISABLE_MSC_DEPRECATED_POP_() - -static CapturedStream* g_captured_stderr = nullptr; -static CapturedStream* g_captured_stdout = nullptr; - -// Starts capturing an output stream (stdout/stderr). -static void CaptureStream(int fd, const char* stream_name, - CapturedStream** stream) { - if (*stream != nullptr) { - GTEST_LOG_(FATAL) << "Only one " << stream_name - << " capturer can exist at a time."; - } - *stream = new CapturedStream(fd); -} - -// Stops capturing the output stream and returns the captured string. -static std::string GetCapturedStream(CapturedStream** captured_stream) { - const std::string content = (*captured_stream)->GetCapturedString(); - - delete *captured_stream; - *captured_stream = nullptr; - - return content; -} - -// Starts capturing stdout. -void CaptureStdout() { - CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout); -} - -// Starts capturing stderr. -void CaptureStderr() { - CaptureStream(kStdErrFileno, "stderr", &g_captured_stderr); -} - -// Stops capturing stdout and returns the captured string. -std::string GetCapturedStdout() { - return GetCapturedStream(&g_captured_stdout); -} - -// Stops capturing stderr and returns the captured string. -std::string GetCapturedStderr() { - return GetCapturedStream(&g_captured_stderr); -} - -#endif // GTEST_HAS_STREAM_REDIRECTION - - - - - -size_t GetFileSize(FILE* file) { - fseek(file, 0, SEEK_END); - return static_cast<size_t>(ftell(file)); -} - -std::string ReadEntireFile(FILE* file) { - const size_t file_size = GetFileSize(file); - char* const buffer = new char[file_size]; - - size_t bytes_last_read = 0; // # of bytes read in the last fread() - size_t bytes_read = 0; // # of bytes read so far - - fseek(file, 0, SEEK_SET); - - // Keeps reading the file until we cannot read further or the - // pre-determined file size is reached. - do { - bytes_last_read = fread(buffer+bytes_read, 1, file_size-bytes_read, file); - bytes_read += bytes_last_read; - } while (bytes_last_read > 0 && bytes_read < file_size); - - const std::string content(buffer, bytes_read); - delete[] buffer; - - return content; -} - -#if GTEST_HAS_DEATH_TEST -static const std::vector<std::string>* g_injected_test_argvs = - nullptr; // Owned. - -std::vector<std::string> GetInjectableArgvs() { - if (g_injected_test_argvs != nullptr) { - return *g_injected_test_argvs; - } - return GetArgvs(); -} - -void SetInjectableArgvs(const std::vector<std::string>* new_argvs) { - if (g_injected_test_argvs != new_argvs) delete g_injected_test_argvs; - g_injected_test_argvs = new_argvs; -} - -void SetInjectableArgvs(const std::vector<std::string>& new_argvs) { - SetInjectableArgvs( - new std::vector<std::string>(new_argvs.begin(), new_argvs.end())); -} - -void ClearInjectableArgvs() { - delete g_injected_test_argvs; - g_injected_test_argvs = nullptr; -} -#endif // GTEST_HAS_DEATH_TEST - -#if GTEST_OS_WINDOWS_MOBILE -namespace posix { -void Abort() { - DebugBreak(); - TerminateProcess(GetCurrentProcess(), 1); -} -} // namespace posix -#endif // GTEST_OS_WINDOWS_MOBILE - -// Returns the name of the environment variable corresponding to the -// given flag. For example, FlagToEnvVar("foo") will return -// "GTEST_FOO" in the open-source version. -static std::string FlagToEnvVar(const char* flag) { - const std::string full_flag = - (Message() << GTEST_FLAG_PREFIX_ << flag).GetString(); - - Message env_var; - for (size_t i = 0; i != full_flag.length(); i++) { - env_var << ToUpper(full_flag.c_str()[i]); - } - - return env_var.GetString(); -} - -// Parses 'str' for a 32-bit signed integer. If successful, writes -// the result to *value and returns true; otherwise leaves *value -// unchanged and returns false. -bool ParseInt32(const Message& src_text, const char* str, Int32* value) { - // Parses the environment variable as a decimal integer. - char* end = nullptr; - const long long_value = strtol(str, &end, 10); // NOLINT - - // Has strtol() consumed all characters in the string? - if (*end != '\0') { - // No - an invalid character was encountered. - Message msg; - msg << "WARNING: " << src_text - << " is expected to be a 32-bit integer, but actually" - << " has value \"" << str << "\".\n"; - printf("%s", msg.GetString().c_str()); - fflush(stdout); - return false; - } - - // Is the parsed value in the range of an Int32? - const Int32 result = static_cast<Int32>(long_value); - if (long_value == LONG_MAX || long_value == LONG_MIN || - // The parsed value overflows as a long. (strtol() returns - // LONG_MAX or LONG_MIN when the input overflows.) - result != long_value - // The parsed value overflows as an Int32. - ) { - Message msg; - msg << "WARNING: " << src_text - << " is expected to be a 32-bit integer, but actually" - << " has value " << str << ", which overflows.\n"; - printf("%s", msg.GetString().c_str()); - fflush(stdout); - return false; - } - - *value = result; - return true; -} - -// Reads and returns the Boolean environment variable corresponding to -// the given flag; if it's not set, returns default_value. -// -// The value is considered true if and only if it's not "0". -bool BoolFromGTestEnv(const char* flag, bool default_value) { -#if defined(GTEST_GET_BOOL_FROM_ENV_) - return GTEST_GET_BOOL_FROM_ENV_(flag, default_value); -#else - const std::string env_var = FlagToEnvVar(flag); - const char* const string_value = posix::GetEnv(env_var.c_str()); - return string_value == nullptr ? default_value - : strcmp(string_value, "0") != 0; -#endif // defined(GTEST_GET_BOOL_FROM_ENV_) -} - -// Reads and returns a 32-bit integer stored in the environment -// variable corresponding to the given flag; if it isn't set or -// doesn't represent a valid 32-bit integer, returns default_value. -Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) { -#if defined(GTEST_GET_INT32_FROM_ENV_) - return GTEST_GET_INT32_FROM_ENV_(flag, default_value); -#else - const std::string env_var = FlagToEnvVar(flag); - const char* const string_value = posix::GetEnv(env_var.c_str()); - if (string_value == nullptr) { - // The environment variable is not set. - return default_value; - } - - Int32 result = default_value; - if (!ParseInt32(Message() << "Environment variable " << env_var, - string_value, &result)) { - printf("The default value %s is used.\n", - (Message() << default_value).GetString().c_str()); - fflush(stdout); - return default_value; - } - - return result; -#endif // defined(GTEST_GET_INT32_FROM_ENV_) -} - -// As a special case for the 'output' flag, if GTEST_OUTPUT is not -// set, we look for XML_OUTPUT_FILE, which is set by the Bazel build -// system. The value of XML_OUTPUT_FILE is a filename without the -// "xml:" prefix of GTEST_OUTPUT. -// Note that this is meant to be called at the call site so it does -// not check that the flag is 'output' -// In essence this checks an env variable called XML_OUTPUT_FILE -// and if it is set we prepend "xml:" to its value, if it not set we return "" -std::string OutputFlagAlsoCheckEnvVar(){ - std::string default_value_for_output_flag = ""; - const char* xml_output_file_env = posix::GetEnv("XML_OUTPUT_FILE"); - if (nullptr != xml_output_file_env) { - default_value_for_output_flag = std::string("xml:") + xml_output_file_env; - } - return default_value_for_output_flag; -} - -// Reads and returns the string environment variable corresponding to -// the given flag; if it's not set, returns default_value. -const char* StringFromGTestEnv(const char* flag, const char* default_value) { -#if defined(GTEST_GET_STRING_FROM_ENV_) - return GTEST_GET_STRING_FROM_ENV_(flag, default_value); -#else - const std::string env_var = FlagToEnvVar(flag); - const char* const value = posix::GetEnv(env_var.c_str()); - return value == nullptr ? default_value : value; -#endif // defined(GTEST_GET_STRING_FROM_ENV_) -} - -} // namespace internal -} // namespace testing diff --git a/3rdParty/googletest/googletest/src/gtest-printers.cc b/3rdParty/googletest/googletest/src/gtest-printers.cc deleted file mode 100644 index 3337be312ea400ff78c78766ec4a5ba229b0206d..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/src/gtest-printers.cc +++ /dev/null @@ -1,442 +0,0 @@ -// Copyright 2007, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -// Google Test - The Google C++ Testing and Mocking Framework -// -// This file implements a universal value printer that can print a -// value of any type T: -// -// void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr); -// -// It uses the << operator when possible, and prints the bytes in the -// object otherwise. A user can override its behavior for a class -// type Foo by defining either operator<<(::std::ostream&, const Foo&) -// or void PrintTo(const Foo&, ::std::ostream*) in the namespace that -// defines Foo. - -#include "gtest/gtest-printers.h" -#include <stdio.h> -#include <cctype> -#include <cwchar> -#include <ostream> // NOLINT -#include <string> -#include "gtest/internal/gtest-port.h" -#include "src/gtest-internal-inl.h" - -namespace testing { - -namespace { - -using ::std::ostream; - -// Prints a segment of bytes in the given object. -GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ -GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ -void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start, - size_t count, ostream* os) { - char text[5] = ""; - for (size_t i = 0; i != count; i++) { - const size_t j = start + i; - if (i != 0) { - // Organizes the bytes into groups of 2 for easy parsing by - // human. - if ((j % 2) == 0) - *os << ' '; - else - *os << '-'; - } - GTEST_SNPRINTF_(text, sizeof(text), "%02X", obj_bytes[j]); - *os << text; - } -} - -// Prints the bytes in the given value to the given ostream. -void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count, - ostream* os) { - // Tells the user how big the object is. - *os << count << "-byte object <"; - - const size_t kThreshold = 132; - const size_t kChunkSize = 64; - // If the object size is bigger than kThreshold, we'll have to omit - // some details by printing only the first and the last kChunkSize - // bytes. - if (count < kThreshold) { - PrintByteSegmentInObjectTo(obj_bytes, 0, count, os); - } else { - PrintByteSegmentInObjectTo(obj_bytes, 0, kChunkSize, os); - *os << " ... "; - // Rounds up to 2-byte boundary. - const size_t resume_pos = (count - kChunkSize + 1)/2*2; - PrintByteSegmentInObjectTo(obj_bytes, resume_pos, count - resume_pos, os); - } - *os << ">"; -} - -} // namespace - -namespace internal2 { - -// Delegates to PrintBytesInObjectToImpl() to print the bytes in the -// given object. The delegation simplifies the implementation, which -// uses the << operator and thus is easier done outside of the -// ::testing::internal namespace, which contains a << operator that -// sometimes conflicts with the one in STL. -void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count, - ostream* os) { - PrintBytesInObjectToImpl(obj_bytes, count, os); -} - -} // namespace internal2 - -namespace internal { - -// Depending on the value of a char (or wchar_t), we print it in one -// of three formats: -// - as is if it's a printable ASCII (e.g. 'a', '2', ' '), -// - as a hexadecimal escape sequence (e.g. '\x7F'), or -// - as a special escape sequence (e.g. '\r', '\n'). -enum CharFormat { - kAsIs, - kHexEscape, - kSpecialEscape -}; - -// Returns true if c is a printable ASCII character. We test the -// value of c directly instead of calling isprint(), which is buggy on -// Windows Mobile. -inline bool IsPrintableAscii(wchar_t c) { - return 0x20 <= c && c <= 0x7E; -} - -// Prints a wide or narrow char c as a character literal without the -// quotes, escaping it when necessary; returns how c was formatted. -// The template argument UnsignedChar is the unsigned version of Char, -// which is the type of c. -template <typename UnsignedChar, typename Char> -static CharFormat PrintAsCharLiteralTo(Char c, ostream* os) { - wchar_t w_c = static_cast<wchar_t>(c); - switch (w_c) { - case L'\0': - *os << "\\0"; - break; - case L'\'': - *os << "\\'"; - break; - case L'\\': - *os << "\\\\"; - break; - case L'\a': - *os << "\\a"; - break; - case L'\b': - *os << "\\b"; - break; - case L'\f': - *os << "\\f"; - break; - case L'\n': - *os << "\\n"; - break; - case L'\r': - *os << "\\r"; - break; - case L'\t': - *os << "\\t"; - break; - case L'\v': - *os << "\\v"; - break; - default: - if (IsPrintableAscii(w_c)) { - *os << static_cast<char>(c); - return kAsIs; - } else { - ostream::fmtflags flags = os->flags(); - *os << "\\x" << std::hex << std::uppercase - << static_cast<int>(static_cast<UnsignedChar>(c)); - os->flags(flags); - return kHexEscape; - } - } - return kSpecialEscape; -} - -// Prints a wchar_t c as if it's part of a string literal, escaping it when -// necessary; returns how c was formatted. -static CharFormat PrintAsStringLiteralTo(wchar_t c, ostream* os) { - switch (c) { - case L'\'': - *os << "'"; - return kAsIs; - case L'"': - *os << "\\\""; - return kSpecialEscape; - default: - return PrintAsCharLiteralTo<wchar_t>(c, os); - } -} - -// Prints a char c as if it's part of a string literal, escaping it when -// necessary; returns how c was formatted. -static CharFormat PrintAsStringLiteralTo(char c, ostream* os) { - return PrintAsStringLiteralTo( - static_cast<wchar_t>(static_cast<unsigned char>(c)), os); -} - -// Prints a wide or narrow character c and its code. '\0' is printed -// as "'\\0'", other unprintable characters are also properly escaped -// using the standard C++ escape sequence. The template argument -// UnsignedChar is the unsigned version of Char, which is the type of c. -template <typename UnsignedChar, typename Char> -void PrintCharAndCodeTo(Char c, ostream* os) { - // First, print c as a literal in the most readable form we can find. - *os << ((sizeof(c) > 1) ? "L'" : "'"); - const CharFormat format = PrintAsCharLiteralTo<UnsignedChar>(c, os); - *os << "'"; - - // To aid user debugging, we also print c's code in decimal, unless - // it's 0 (in which case c was printed as '\\0', making the code - // obvious). - if (c == 0) - return; - *os << " (" << static_cast<int>(c); - - // For more convenience, we print c's code again in hexadecimal, - // unless c was already printed in the form '\x##' or the code is in - // [1, 9]. - if (format == kHexEscape || (1 <= c && c <= 9)) { - // Do nothing. - } else { - *os << ", 0x" << String::FormatHexInt(static_cast<int>(c)); - } - *os << ")"; -} - -void PrintTo(unsigned char c, ::std::ostream* os) { - PrintCharAndCodeTo<unsigned char>(c, os); -} -void PrintTo(signed char c, ::std::ostream* os) { - PrintCharAndCodeTo<unsigned char>(c, os); -} - -// Prints a wchar_t as a symbol if it is printable or as its internal -// code otherwise and also as its code. L'\0' is printed as "L'\\0'". -void PrintTo(wchar_t wc, ostream* os) { - PrintCharAndCodeTo<wchar_t>(wc, os); -} - -// Prints the given array of characters to the ostream. CharType must be either -// char or wchar_t. -// The array starts at begin, the length is len, it may include '\0' characters -// and may not be NUL-terminated. -template <typename CharType> -GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ -GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ -static CharFormat PrintCharsAsStringTo( - const CharType* begin, size_t len, ostream* os) { - const char* const kQuoteBegin = sizeof(CharType) == 1 ? "\"" : "L\""; - *os << kQuoteBegin; - bool is_previous_hex = false; - CharFormat print_format = kAsIs; - for (size_t index = 0; index < len; ++index) { - const CharType cur = begin[index]; - if (is_previous_hex && IsXDigit(cur)) { - // Previous character is of '\x..' form and this character can be - // interpreted as another hexadecimal digit in its number. Break string to - // disambiguate. - *os << "\" " << kQuoteBegin; - } - is_previous_hex = PrintAsStringLiteralTo(cur, os) == kHexEscape; - // Remember if any characters required hex escaping. - if (is_previous_hex) { - print_format = kHexEscape; - } - } - *os << "\""; - return print_format; -} - -// Prints a (const) char/wchar_t array of 'len' elements, starting at address -// 'begin'. CharType must be either char or wchar_t. -template <typename CharType> -GTEST_ATTRIBUTE_NO_SANITIZE_MEMORY_ -GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_ -GTEST_ATTRIBUTE_NO_SANITIZE_THREAD_ -static void UniversalPrintCharArray( - const CharType* begin, size_t len, ostream* os) { - // The code - // const char kFoo[] = "foo"; - // generates an array of 4, not 3, elements, with the last one being '\0'. - // - // Therefore when printing a char array, we don't print the last element if - // it's '\0', such that the output matches the string literal as it's - // written in the source code. - if (len > 0 && begin[len - 1] == '\0') { - PrintCharsAsStringTo(begin, len - 1, os); - return; - } - - // If, however, the last element in the array is not '\0', e.g. - // const char kFoo[] = { 'f', 'o', 'o' }; - // we must print the entire array. We also print a message to indicate - // that the array is not NUL-terminated. - PrintCharsAsStringTo(begin, len, os); - *os << " (no terminating NUL)"; -} - -// Prints a (const) char array of 'len' elements, starting at address 'begin'. -void UniversalPrintArray(const char* begin, size_t len, ostream* os) { - UniversalPrintCharArray(begin, len, os); -} - -// Prints a (const) wchar_t array of 'len' elements, starting at address -// 'begin'. -void UniversalPrintArray(const wchar_t* begin, size_t len, ostream* os) { - UniversalPrintCharArray(begin, len, os); -} - -// Prints the given C string to the ostream. -void PrintTo(const char* s, ostream* os) { - if (s == nullptr) { - *os << "NULL"; - } else { - *os << ImplicitCast_<const void*>(s) << " pointing to "; - PrintCharsAsStringTo(s, strlen(s), os); - } -} - -// MSVC compiler can be configured to define whar_t as a typedef -// of unsigned short. Defining an overload for const wchar_t* in that case -// would cause pointers to unsigned shorts be printed as wide strings, -// possibly accessing more memory than intended and causing invalid -// memory accesses. MSVC defines _NATIVE_WCHAR_T_DEFINED symbol when -// wchar_t is implemented as a native type. -#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) -// Prints the given wide C string to the ostream. -void PrintTo(const wchar_t* s, ostream* os) { - if (s == nullptr) { - *os << "NULL"; - } else { - *os << ImplicitCast_<const void*>(s) << " pointing to "; - PrintCharsAsStringTo(s, wcslen(s), os); - } -} -#endif // wchar_t is native - -namespace { - -bool ContainsUnprintableControlCodes(const char* str, size_t length) { - const unsigned char *s = reinterpret_cast<const unsigned char *>(str); - - for (size_t i = 0; i < length; i++) { - unsigned char ch = *s++; - if (std::iscntrl(ch)) { - switch (ch) { - case '\t': - case '\n': - case '\r': - break; - default: - return true; - } - } - } - return false; -} - -bool IsUTF8TrailByte(unsigned char t) { return 0x80 <= t && t<= 0xbf; } - -bool IsValidUTF8(const char* str, size_t length) { - const unsigned char *s = reinterpret_cast<const unsigned char *>(str); - - for (size_t i = 0; i < length;) { - unsigned char lead = s[i++]; - - if (lead <= 0x7f) { - continue; // single-byte character (ASCII) 0..7F - } - if (lead < 0xc2) { - return false; // trail byte or non-shortest form - } else if (lead <= 0xdf && (i + 1) <= length && IsUTF8TrailByte(s[i])) { - ++i; // 2-byte character - } else if (0xe0 <= lead && lead <= 0xef && (i + 2) <= length && - IsUTF8TrailByte(s[i]) && - IsUTF8TrailByte(s[i + 1]) && - // check for non-shortest form and surrogate - (lead != 0xe0 || s[i] >= 0xa0) && - (lead != 0xed || s[i] < 0xa0)) { - i += 2; // 3-byte character - } else if (0xf0 <= lead && lead <= 0xf4 && (i + 3) <= length && - IsUTF8TrailByte(s[i]) && - IsUTF8TrailByte(s[i + 1]) && - IsUTF8TrailByte(s[i + 2]) && - // check for non-shortest form - (lead != 0xf0 || s[i] >= 0x90) && - (lead != 0xf4 || s[i] < 0x90)) { - i += 3; // 4-byte character - } else { - return false; - } - } - return true; -} - -void ConditionalPrintAsText(const char* str, size_t length, ostream* os) { - if (!ContainsUnprintableControlCodes(str, length) && - IsValidUTF8(str, length)) { - *os << "\n As Text: \"" << str << "\""; - } -} - -} // anonymous namespace - -void PrintStringTo(const ::std::string& s, ostream* os) { - if (PrintCharsAsStringTo(s.data(), s.size(), os) == kHexEscape) { - if (GTEST_FLAG(print_utf8)) { - ConditionalPrintAsText(s.data(), s.size(), os); - } - } -} - -#if GTEST_HAS_STD_WSTRING -void PrintWideStringTo(const ::std::wstring& s, ostream* os) { - PrintCharsAsStringTo(s.data(), s.size(), os); -} -#endif // GTEST_HAS_STD_WSTRING - -} // namespace internal - -} // namespace testing diff --git a/3rdParty/googletest/googletest/src/gtest-test-part.cc b/3rdParty/googletest/googletest/src/gtest-test-part.cc deleted file mode 100644 index 178317a6bcdbd0f60a0db2317104e90ad0678713..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/src/gtest-test-part.cc +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// The Google C++ Testing and Mocking Framework (Google Test) - -#include "gtest/gtest-test-part.h" -#include "src/gtest-internal-inl.h" - -namespace testing { - -using internal::GetUnitTestImpl; - -// Gets the summary of the failure message by omitting the stack trace -// in it. -std::string TestPartResult::ExtractSummary(const char* message) { - const char* const stack_trace = strstr(message, internal::kStackTraceMarker); - return stack_trace == nullptr ? message : std::string(message, stack_trace); -} - -// Prints a TestPartResult object. -std::ostream& operator<<(std::ostream& os, const TestPartResult& result) { - return os << result.file_name() << ":" << result.line_number() << ": " - << (result.type() == TestPartResult::kSuccess - ? "Success" - : result.type() == TestPartResult::kSkip - ? "Skipped" - : result.type() == TestPartResult::kFatalFailure - ? "Fatal failure" - : "Non-fatal failure") - << ":\n" - << result.message() << std::endl; -} - -// Appends a TestPartResult to the array. -void TestPartResultArray::Append(const TestPartResult& result) { - array_.push_back(result); -} - -// Returns the TestPartResult at the given index (0-based). -const TestPartResult& TestPartResultArray::GetTestPartResult(int index) const { - if (index < 0 || index >= size()) { - printf("\nInvalid index (%d) into TestPartResultArray.\n", index); - internal::posix::Abort(); - } - - return array_[static_cast<size_t>(index)]; -} - -// Returns the number of TestPartResult objects in the array. -int TestPartResultArray::size() const { - return static_cast<int>(array_.size()); -} - -namespace internal { - -HasNewFatalFailureHelper::HasNewFatalFailureHelper() - : has_new_fatal_failure_(false), - original_reporter_(GetUnitTestImpl()-> - GetTestPartResultReporterForCurrentThread()) { - GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread(this); -} - -HasNewFatalFailureHelper::~HasNewFatalFailureHelper() { - GetUnitTestImpl()->SetTestPartResultReporterForCurrentThread( - original_reporter_); -} - -void HasNewFatalFailureHelper::ReportTestPartResult( - const TestPartResult& result) { - if (result.fatally_failed()) - has_new_fatal_failure_ = true; - original_reporter_->ReportTestPartResult(result); -} - -} // namespace internal - -} // namespace testing diff --git a/3rdParty/googletest/googletest/src/gtest-typed-test.cc b/3rdParty/googletest/googletest/src/gtest-typed-test.cc deleted file mode 100644 index 8677caf732b4239408313ac3ef98ba0474ba3665..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/src/gtest-typed-test.cc +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2008 Google Inc. -// All Rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#include "gtest/gtest-typed-test.h" - -#include "gtest/gtest.h" - -namespace testing { -namespace internal { - -#if GTEST_HAS_TYPED_TEST_P - -// Skips to the first non-space char in str. Returns an empty string if str -// contains only whitespace characters. -static const char* SkipSpaces(const char* str) { - while (IsSpace(*str)) - str++; - return str; -} - -static std::vector<std::string> SplitIntoTestNames(const char* src) { - std::vector<std::string> name_vec; - src = SkipSpaces(src); - for (; src != nullptr; src = SkipComma(src)) { - name_vec.push_back(StripTrailingSpaces(GetPrefixUntilComma(src))); - } - return name_vec; -} - -// Verifies that registered_tests match the test names in -// registered_tests_; returns registered_tests if successful, or -// aborts the program otherwise. -const char* TypedTestSuitePState::VerifyRegisteredTestNames( - const char* file, int line, const char* registered_tests) { - typedef RegisteredTestsMap::const_iterator RegisteredTestIter; - registered_ = true; - - std::vector<std::string> name_vec = SplitIntoTestNames(registered_tests); - - Message errors; - - std::set<std::string> tests; - for (std::vector<std::string>::const_iterator name_it = name_vec.begin(); - name_it != name_vec.end(); ++name_it) { - const std::string& name = *name_it; - if (tests.count(name) != 0) { - errors << "Test " << name << " is listed more than once.\n"; - continue; - } - - bool found = false; - for (RegisteredTestIter it = registered_tests_.begin(); - it != registered_tests_.end(); - ++it) { - if (name == it->first) { - found = true; - break; - } - } - - if (found) { - tests.insert(name); - } else { - errors << "No test named " << name - << " can be found in this test suite.\n"; - } - } - - for (RegisteredTestIter it = registered_tests_.begin(); - it != registered_tests_.end(); - ++it) { - if (tests.count(it->first) == 0) { - errors << "You forgot to list test " << it->first << ".\n"; - } - } - - const std::string& errors_str = errors.GetString(); - if (errors_str != "") { - fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(), - errors_str.c_str()); - fflush(stderr); - posix::Abort(); - } - - return registered_tests; -} - -#endif // GTEST_HAS_TYPED_TEST_P - -} // namespace internal -} // namespace testing diff --git a/3rdParty/googletest/googletest/src/gtest.cc b/3rdParty/googletest/googletest/src/gtest.cc deleted file mode 100644 index a5b4e5ac78ca1f00259d1ec5bfa7c3feaeee55ea..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/src/gtest.cc +++ /dev/null @@ -1,6177 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// The Google C++ Testing and Mocking Framework (Google Test) - -#include "gtest/gtest.h" -#include "gtest/internal/custom/gtest.h" -#include "gtest/gtest-spi.h" - -#include <ctype.h> -#include <math.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <time.h> -#include <wchar.h> -#include <wctype.h> - -#include <algorithm> -#include <iomanip> -#include <limits> -#include <list> -#include <map> -#include <ostream> // NOLINT -#include <sstream> -#include <vector> - -#if GTEST_OS_LINUX - -# define GTEST_HAS_GETTIMEOFDAY_ 1 - -# include <fcntl.h> // NOLINT -# include <limits.h> // NOLINT -# include <sched.h> // NOLINT -// Declares vsnprintf(). This header is not available on Windows. -# include <strings.h> // NOLINT -# include <sys/mman.h> // NOLINT -# include <sys/time.h> // NOLINT -# include <unistd.h> // NOLINT -# include <string> - -#elif GTEST_OS_ZOS -# define GTEST_HAS_GETTIMEOFDAY_ 1 -# include <sys/time.h> // NOLINT - -// On z/OS we additionally need strings.h for strcasecmp. -# include <strings.h> // NOLINT - -#elif GTEST_OS_WINDOWS_MOBILE // We are on Windows CE. - -# include <windows.h> // NOLINT -# undef min - -#elif GTEST_OS_WINDOWS // We are on Windows proper. - -# include <windows.h> // NOLINT -# undef min - -# include <crtdbg.h> // NOLINT -# include <debugapi.h> // NOLINT -# include <io.h> // NOLINT -# include <sys/timeb.h> // NOLINT -# include <sys/types.h> // NOLINT -# include <sys/stat.h> // NOLINT - -# if GTEST_OS_WINDOWS_MINGW -// MinGW has gettimeofday() but not _ftime64(). -# define GTEST_HAS_GETTIMEOFDAY_ 1 -# include <sys/time.h> // NOLINT -# endif // GTEST_OS_WINDOWS_MINGW - -#else - -// Assume other platforms have gettimeofday(). -# define GTEST_HAS_GETTIMEOFDAY_ 1 - -// cpplint thinks that the header is already included, so we want to -// silence it. -# include <sys/time.h> // NOLINT -# include <unistd.h> // NOLINT - -#endif // GTEST_OS_LINUX - -#if GTEST_HAS_EXCEPTIONS -# include <stdexcept> -#endif - -#if GTEST_CAN_STREAM_RESULTS_ -# include <arpa/inet.h> // NOLINT -# include <netdb.h> // NOLINT -# include <sys/socket.h> // NOLINT -# include <sys/types.h> // NOLINT -#endif - -#include "src/gtest-internal-inl.h" - -#if GTEST_OS_WINDOWS -# define vsnprintf _vsnprintf -#endif // GTEST_OS_WINDOWS - -#if GTEST_OS_MAC -#ifndef GTEST_OS_IOS -#include <crt_externs.h> -#endif -#endif - -#if GTEST_HAS_ABSL -#include "absl/debugging/failure_signal_handler.h" -#include "absl/debugging/stacktrace.h" -#include "absl/debugging/symbolize.h" -#include "absl/strings/str_cat.h" -#endif // GTEST_HAS_ABSL - -namespace testing { - -using internal::CountIf; -using internal::ForEach; -using internal::GetElementOr; -using internal::Shuffle; - -// Constants. - -// A test whose test suite name or test name matches this filter is -// disabled and not run. -static const char kDisableTestFilter[] = "DISABLED_*:*/DISABLED_*"; - -// A test suite whose name matches this filter is considered a death -// test suite and will be run before test suites whose name doesn't -// match this filter. -static const char kDeathTestSuiteFilter[] = "*DeathTest:*DeathTest/*"; - -// A test filter that matches everything. -static const char kUniversalFilter[] = "*"; - -// The default output format. -static const char kDefaultOutputFormat[] = "xml"; -// The default output file. -static const char kDefaultOutputFile[] = "test_detail"; - -// The environment variable name for the test shard index. -static const char kTestShardIndex[] = "GTEST_SHARD_INDEX"; -// The environment variable name for the total number of test shards. -static const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS"; -// The environment variable name for the test shard status file. -static const char kTestShardStatusFile[] = "GTEST_SHARD_STATUS_FILE"; - -namespace internal { - -// The text used in failure messages to indicate the start of the -// stack trace. -const char kStackTraceMarker[] = "\nStack trace:\n"; - -// g_help_flag is true if and only if the --help flag or an equivalent form -// is specified on the command line. -bool g_help_flag = false; - -// Utilty function to Open File for Writing -static FILE* OpenFileForWriting(const std::string& output_file) { - FILE* fileout = nullptr; - FilePath output_file_path(output_file); - FilePath output_dir(output_file_path.RemoveFileName()); - - if (output_dir.CreateDirectoriesRecursively()) { - fileout = posix::FOpen(output_file.c_str(), "w"); - } - if (fileout == nullptr) { - GTEST_LOG_(FATAL) << "Unable to open file \"" << output_file << "\""; - } - return fileout; -} - -} // namespace internal - -// Bazel passes in the argument to '--test_filter' via the TESTBRIDGE_TEST_ONLY -// environment variable. -static const char* GetDefaultFilter() { - const char* const testbridge_test_only = - internal::posix::GetEnv("TESTBRIDGE_TEST_ONLY"); - if (testbridge_test_only != nullptr) { - return testbridge_test_only; - } - return kUniversalFilter; -} - -GTEST_DEFINE_bool_( - also_run_disabled_tests, - internal::BoolFromGTestEnv("also_run_disabled_tests", false), - "Run disabled tests too, in addition to the tests normally being run."); - -GTEST_DEFINE_bool_( - break_on_failure, internal::BoolFromGTestEnv("break_on_failure", false), - "True if and only if a failed assertion should be a debugger " - "break-point."); - -GTEST_DEFINE_bool_(catch_exceptions, - internal::BoolFromGTestEnv("catch_exceptions", true), - "True if and only if " GTEST_NAME_ - " should catch exceptions and treat them as test failures."); - -GTEST_DEFINE_string_( - color, - internal::StringFromGTestEnv("color", "auto"), - "Whether to use colors in the output. Valid values: yes, no, " - "and auto. 'auto' means to use colors if the output is " - "being sent to a terminal and the TERM environment variable " - "is set to a terminal type that supports colors."); - -GTEST_DEFINE_string_( - filter, - internal::StringFromGTestEnv("filter", GetDefaultFilter()), - "A colon-separated list of glob (not regex) patterns " - "for filtering the tests to run, optionally followed by a " - "'-' and a : separated list of negative patterns (tests to " - "exclude). A test is run if it matches one of the positive " - "patterns and does not match any of the negative patterns."); - -GTEST_DEFINE_bool_( - install_failure_signal_handler, - internal::BoolFromGTestEnv("install_failure_signal_handler", false), - "If true and supported on the current platform, " GTEST_NAME_ " should " - "install a signal handler that dumps debugging information when fatal " - "signals are raised."); - -GTEST_DEFINE_bool_(list_tests, false, - "List all tests without running them."); - -// The net priority order after flag processing is thus: -// --gtest_output command line flag -// GTEST_OUTPUT environment variable -// XML_OUTPUT_FILE environment variable -// '' -GTEST_DEFINE_string_( - output, - internal::StringFromGTestEnv("output", - internal::OutputFlagAlsoCheckEnvVar().c_str()), - "A format (defaults to \"xml\" but can be specified to be \"json\"), " - "optionally followed by a colon and an output file name or directory. " - "A directory is indicated by a trailing pathname separator. " - "Examples: \"xml:filename.xml\", \"xml::directoryname/\". " - "If a directory is specified, output files will be created " - "within that directory, with file-names based on the test " - "executable's name and, if necessary, made unique by adding " - "digits."); - -GTEST_DEFINE_bool_(print_time, internal::BoolFromGTestEnv("print_time", true), - "True if and only if " GTEST_NAME_ - " should display elapsed time in text output."); - -GTEST_DEFINE_bool_(print_utf8, internal::BoolFromGTestEnv("print_utf8", true), - "True if and only if " GTEST_NAME_ - " prints UTF8 characters as text."); - -GTEST_DEFINE_int32_( - random_seed, - internal::Int32FromGTestEnv("random_seed", 0), - "Random number seed to use when shuffling test orders. Must be in range " - "[1, 99999], or 0 to use a seed based on the current time."); - -GTEST_DEFINE_int32_( - repeat, - internal::Int32FromGTestEnv("repeat", 1), - "How many times to repeat each test. Specify a negative number " - "for repeating forever. Useful for shaking out flaky tests."); - -GTEST_DEFINE_bool_(show_internal_stack_frames, false, - "True if and only if " GTEST_NAME_ - " should include internal stack frames when " - "printing test failure stack traces."); - -GTEST_DEFINE_bool_(shuffle, internal::BoolFromGTestEnv("shuffle", false), - "True if and only if " GTEST_NAME_ - " should randomize tests' order on every run."); - -GTEST_DEFINE_int32_( - stack_trace_depth, - internal::Int32FromGTestEnv("stack_trace_depth", kMaxStackTraceDepth), - "The maximum number of stack frames to print when an " - "assertion fails. The valid range is 0 through 100, inclusive."); - -GTEST_DEFINE_string_( - stream_result_to, - internal::StringFromGTestEnv("stream_result_to", ""), - "This flag specifies the host name and the port number on which to stream " - "test results. Example: \"localhost:555\". The flag is effective only on " - "Linux."); - -GTEST_DEFINE_bool_( - throw_on_failure, - internal::BoolFromGTestEnv("throw_on_failure", false), - "When this flag is specified, a failed assertion will throw an exception " - "if exceptions are enabled or exit the program with a non-zero code " - "otherwise. For use with an external test framework."); - -#if GTEST_USE_OWN_FLAGFILE_FLAG_ -GTEST_DEFINE_string_( - flagfile, - internal::StringFromGTestEnv("flagfile", ""), - "This flag specifies the flagfile to read command-line flags from."); -#endif // GTEST_USE_OWN_FLAGFILE_FLAG_ - -namespace internal { - -// Generates a random number from [0, range), using a Linear -// Congruential Generator (LCG). Crashes if 'range' is 0 or greater -// than kMaxRange. -UInt32 Random::Generate(UInt32 range) { - // These constants are the same as are used in glibc's rand(3). - // Use wider types than necessary to prevent unsigned overflow diagnostics. - state_ = static_cast<UInt32>(1103515245ULL*state_ + 12345U) % kMaxRange; - - GTEST_CHECK_(range > 0) - << "Cannot generate a number in the range [0, 0)."; - GTEST_CHECK_(range <= kMaxRange) - << "Generation of a number in [0, " << range << ") was requested, " - << "but this can only generate numbers in [0, " << kMaxRange << ")."; - - // Converting via modulus introduces a bit of downward bias, but - // it's simple, and a linear congruential generator isn't too good - // to begin with. - return state_ % range; -} - -// GTestIsInitialized() returns true if and only if the user has initialized -// Google Test. Useful for catching the user mistake of not initializing -// Google Test before calling RUN_ALL_TESTS(). -static bool GTestIsInitialized() { return GetArgvs().size() > 0; } - -// Iterates over a vector of TestSuites, keeping a running sum of the -// results of calling a given int-returning method on each. -// Returns the sum. -static int SumOverTestSuiteList(const std::vector<TestSuite*>& case_list, - int (TestSuite::*method)() const) { - int sum = 0; - for (size_t i = 0; i < case_list.size(); i++) { - sum += (case_list[i]->*method)(); - } - return sum; -} - -// Returns true if and only if the test suite passed. -static bool TestSuitePassed(const TestSuite* test_suite) { - return test_suite->should_run() && test_suite->Passed(); -} - -// Returns true if and only if the test suite failed. -static bool TestSuiteFailed(const TestSuite* test_suite) { - return test_suite->should_run() && test_suite->Failed(); -} - -// Returns true if and only if test_suite contains at least one test that -// should run. -static bool ShouldRunTestSuite(const TestSuite* test_suite) { - return test_suite->should_run(); -} - -// AssertHelper constructor. -AssertHelper::AssertHelper(TestPartResult::Type type, - const char* file, - int line, - const char* message) - : data_(new AssertHelperData(type, file, line, message)) { -} - -AssertHelper::~AssertHelper() { - delete data_; -} - -// Message assignment, for assertion streaming support. -void AssertHelper::operator=(const Message& message) const { - UnitTest::GetInstance()-> - AddTestPartResult(data_->type, data_->file, data_->line, - AppendUserMessage(data_->message, message), - UnitTest::GetInstance()->impl() - ->CurrentOsStackTraceExceptTop(1) - // Skips the stack frame for this function itself. - ); // NOLINT -} - -// A copy of all command line arguments. Set by InitGoogleTest(). -static ::std::vector<std::string> g_argvs; - -::std::vector<std::string> GetArgvs() { -#if defined(GTEST_CUSTOM_GET_ARGVS_) - // GTEST_CUSTOM_GET_ARGVS_() may return a container of std::string or - // ::string. This code converts it to the appropriate type. - const auto& custom = GTEST_CUSTOM_GET_ARGVS_(); - return ::std::vector<std::string>(custom.begin(), custom.end()); -#else // defined(GTEST_CUSTOM_GET_ARGVS_) - return g_argvs; -#endif // defined(GTEST_CUSTOM_GET_ARGVS_) -} - -// Returns the current application's name, removing directory path if that -// is present. -FilePath GetCurrentExecutableName() { - FilePath result; - -#if GTEST_OS_WINDOWS || GTEST_OS_OS2 - result.Set(FilePath(GetArgvs()[0]).RemoveExtension("exe")); -#else - result.Set(FilePath(GetArgvs()[0])); -#endif // GTEST_OS_WINDOWS - - return result.RemoveDirectoryName(); -} - -// Functions for processing the gtest_output flag. - -// Returns the output format, or "" for normal printed output. -std::string UnitTestOptions::GetOutputFormat() { - const char* const gtest_output_flag = GTEST_FLAG(output).c_str(); - const char* const colon = strchr(gtest_output_flag, ':'); - return (colon == nullptr) - ? std::string(gtest_output_flag) - : std::string(gtest_output_flag, - static_cast<size_t>(colon - gtest_output_flag)); -} - -// Returns the name of the requested output file, or the default if none -// was explicitly specified. -std::string UnitTestOptions::GetAbsolutePathToOutputFile() { - const char* const gtest_output_flag = GTEST_FLAG(output).c_str(); - - std::string format = GetOutputFormat(); - if (format.empty()) - format = std::string(kDefaultOutputFormat); - - const char* const colon = strchr(gtest_output_flag, ':'); - if (colon == nullptr) - return internal::FilePath::MakeFileName( - internal::FilePath( - UnitTest::GetInstance()->original_working_dir()), - internal::FilePath(kDefaultOutputFile), 0, - format.c_str()).string(); - - internal::FilePath output_name(colon + 1); - if (!output_name.IsAbsolutePath()) - output_name = internal::FilePath::ConcatPaths( - internal::FilePath(UnitTest::GetInstance()->original_working_dir()), - internal::FilePath(colon + 1)); - - if (!output_name.IsDirectory()) - return output_name.string(); - - internal::FilePath result(internal::FilePath::GenerateUniqueFileName( - output_name, internal::GetCurrentExecutableName(), - GetOutputFormat().c_str())); - return result.string(); -} - -// Returns true if and only if the wildcard pattern matches the string. -// The first ':' or '\0' character in pattern marks the end of it. -// -// This recursive algorithm isn't very efficient, but is clear and -// works well enough for matching test names, which are short. -bool UnitTestOptions::PatternMatchesString(const char *pattern, - const char *str) { - switch (*pattern) { - case '\0': - case ':': // Either ':' or '\0' marks the end of the pattern. - return *str == '\0'; - case '?': // Matches any single character. - return *str != '\0' && PatternMatchesString(pattern + 1, str + 1); - case '*': // Matches any string (possibly empty) of characters. - return (*str != '\0' && PatternMatchesString(pattern, str + 1)) || - PatternMatchesString(pattern + 1, str); - default: // Non-special character. Matches itself. - return *pattern == *str && - PatternMatchesString(pattern + 1, str + 1); - } -} - -bool UnitTestOptions::MatchesFilter( - const std::string& name, const char* filter) { - const char *cur_pattern = filter; - for (;;) { - if (PatternMatchesString(cur_pattern, name.c_str())) { - return true; - } - - // Finds the next pattern in the filter. - cur_pattern = strchr(cur_pattern, ':'); - - // Returns if no more pattern can be found. - if (cur_pattern == nullptr) { - return false; - } - - // Skips the pattern separater (the ':' character). - cur_pattern++; - } -} - -// Returns true if and only if the user-specified filter matches the test -// suite name and the test name. -bool UnitTestOptions::FilterMatchesTest(const std::string& test_suite_name, - const std::string& test_name) { - const std::string& full_name = test_suite_name + "." + test_name.c_str(); - - // Split --gtest_filter at '-', if there is one, to separate into - // positive filter and negative filter portions - const char* const p = GTEST_FLAG(filter).c_str(); - const char* const dash = strchr(p, '-'); - std::string positive; - std::string negative; - if (dash == nullptr) { - positive = GTEST_FLAG(filter).c_str(); // Whole string is a positive filter - negative = ""; - } else { - positive = std::string(p, dash); // Everything up to the dash - negative = std::string(dash + 1); // Everything after the dash - if (positive.empty()) { - // Treat '-test1' as the same as '*-test1' - positive = kUniversalFilter; - } - } - - // A filter is a colon-separated list of patterns. It matches a - // test if any pattern in it matches the test. - return (MatchesFilter(full_name, positive.c_str()) && - !MatchesFilter(full_name, negative.c_str())); -} - -#if GTEST_HAS_SEH -// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the -// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise. -// This function is useful as an __except condition. -int UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) { - // Google Test should handle a SEH exception if: - // 1. the user wants it to, AND - // 2. this is not a breakpoint exception, AND - // 3. this is not a C++ exception (VC++ implements them via SEH, - // apparently). - // - // SEH exception code for C++ exceptions. - // (see http://support.microsoft.com/kb/185294 for more information). - const DWORD kCxxExceptionCode = 0xe06d7363; - - bool should_handle = true; - - if (!GTEST_FLAG(catch_exceptions)) - should_handle = false; - else if (exception_code == EXCEPTION_BREAKPOINT) - should_handle = false; - else if (exception_code == kCxxExceptionCode) - should_handle = false; - - return should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH; -} -#endif // GTEST_HAS_SEH - -} // namespace internal - -// The c'tor sets this object as the test part result reporter used by -// Google Test. The 'result' parameter specifies where to report the -// results. Intercepts only failures from the current thread. -ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter( - TestPartResultArray* result) - : intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD), - result_(result) { - Init(); -} - -// The c'tor sets this object as the test part result reporter used by -// Google Test. The 'result' parameter specifies where to report the -// results. -ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter( - InterceptMode intercept_mode, TestPartResultArray* result) - : intercept_mode_(intercept_mode), - result_(result) { - Init(); -} - -void ScopedFakeTestPartResultReporter::Init() { - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - if (intercept_mode_ == INTERCEPT_ALL_THREADS) { - old_reporter_ = impl->GetGlobalTestPartResultReporter(); - impl->SetGlobalTestPartResultReporter(this); - } else { - old_reporter_ = impl->GetTestPartResultReporterForCurrentThread(); - impl->SetTestPartResultReporterForCurrentThread(this); - } -} - -// The d'tor restores the test part result reporter used by Google Test -// before. -ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() { - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - if (intercept_mode_ == INTERCEPT_ALL_THREADS) { - impl->SetGlobalTestPartResultReporter(old_reporter_); - } else { - impl->SetTestPartResultReporterForCurrentThread(old_reporter_); - } -} - -// Increments the test part result count and remembers the result. -// This method is from the TestPartResultReporterInterface interface. -void ScopedFakeTestPartResultReporter::ReportTestPartResult( - const TestPartResult& result) { - result_->Append(result); -} - -namespace internal { - -// Returns the type ID of ::testing::Test. We should always call this -// instead of GetTypeId< ::testing::Test>() to get the type ID of -// testing::Test. This is to work around a suspected linker bug when -// using Google Test as a framework on Mac OS X. The bug causes -// GetTypeId< ::testing::Test>() to return different values depending -// on whether the call is from the Google Test framework itself or -// from user test code. GetTestTypeId() is guaranteed to always -// return the same value, as it always calls GetTypeId<>() from the -// gtest.cc, which is within the Google Test framework. -TypeId GetTestTypeId() { - return GetTypeId<Test>(); -} - -// The value of GetTestTypeId() as seen from within the Google Test -// library. This is solely for testing GetTestTypeId(). -extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId(); - -// This predicate-formatter checks that 'results' contains a test part -// failure of the given type and that the failure message contains the -// given substring. -static AssertionResult HasOneFailure(const char* /* results_expr */, - const char* /* type_expr */, - const char* /* substr_expr */, - const TestPartResultArray& results, - TestPartResult::Type type, - const std::string& substr) { - const std::string expected(type == TestPartResult::kFatalFailure ? - "1 fatal failure" : - "1 non-fatal failure"); - Message msg; - if (results.size() != 1) { - msg << "Expected: " << expected << "\n" - << " Actual: " << results.size() << " failures"; - for (int i = 0; i < results.size(); i++) { - msg << "\n" << results.GetTestPartResult(i); - } - return AssertionFailure() << msg; - } - - const TestPartResult& r = results.GetTestPartResult(0); - if (r.type() != type) { - return AssertionFailure() << "Expected: " << expected << "\n" - << " Actual:\n" - << r; - } - - if (strstr(r.message(), substr.c_str()) == nullptr) { - return AssertionFailure() << "Expected: " << expected << " containing \"" - << substr << "\"\n" - << " Actual:\n" - << r; - } - - return AssertionSuccess(); -} - -// The constructor of SingleFailureChecker remembers where to look up -// test part results, what type of failure we expect, and what -// substring the failure message should contain. -SingleFailureChecker::SingleFailureChecker(const TestPartResultArray* results, - TestPartResult::Type type, - const std::string& substr) - : results_(results), type_(type), substr_(substr) {} - -// The destructor of SingleFailureChecker verifies that the given -// TestPartResultArray contains exactly one failure that has the given -// type and contains the given substring. If that's not the case, a -// non-fatal failure will be generated. -SingleFailureChecker::~SingleFailureChecker() { - EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_); -} - -DefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter( - UnitTestImpl* unit_test) : unit_test_(unit_test) {} - -void DefaultGlobalTestPartResultReporter::ReportTestPartResult( - const TestPartResult& result) { - unit_test_->current_test_result()->AddTestPartResult(result); - unit_test_->listeners()->repeater()->OnTestPartResult(result); -} - -DefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter( - UnitTestImpl* unit_test) : unit_test_(unit_test) {} - -void DefaultPerThreadTestPartResultReporter::ReportTestPartResult( - const TestPartResult& result) { - unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result); -} - -// Returns the global test part result reporter. -TestPartResultReporterInterface* -UnitTestImpl::GetGlobalTestPartResultReporter() { - internal::MutexLock lock(&global_test_part_result_reporter_mutex_); - return global_test_part_result_repoter_; -} - -// Sets the global test part result reporter. -void UnitTestImpl::SetGlobalTestPartResultReporter( - TestPartResultReporterInterface* reporter) { - internal::MutexLock lock(&global_test_part_result_reporter_mutex_); - global_test_part_result_repoter_ = reporter; -} - -// Returns the test part result reporter for the current thread. -TestPartResultReporterInterface* -UnitTestImpl::GetTestPartResultReporterForCurrentThread() { - return per_thread_test_part_result_reporter_.get(); -} - -// Sets the test part result reporter for the current thread. -void UnitTestImpl::SetTestPartResultReporterForCurrentThread( - TestPartResultReporterInterface* reporter) { - per_thread_test_part_result_reporter_.set(reporter); -} - -// Gets the number of successful test suites. -int UnitTestImpl::successful_test_suite_count() const { - return CountIf(test_suites_, TestSuitePassed); -} - -// Gets the number of failed test suites. -int UnitTestImpl::failed_test_suite_count() const { - return CountIf(test_suites_, TestSuiteFailed); -} - -// Gets the number of all test suites. -int UnitTestImpl::total_test_suite_count() const { - return static_cast<int>(test_suites_.size()); -} - -// Gets the number of all test suites that contain at least one test -// that should run. -int UnitTestImpl::test_suite_to_run_count() const { - return CountIf(test_suites_, ShouldRunTestSuite); -} - -// Gets the number of successful tests. -int UnitTestImpl::successful_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::successful_test_count); -} - -// Gets the number of skipped tests. -int UnitTestImpl::skipped_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::skipped_test_count); -} - -// Gets the number of failed tests. -int UnitTestImpl::failed_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::failed_test_count); -} - -// Gets the number of disabled tests that will be reported in the XML report. -int UnitTestImpl::reportable_disabled_test_count() const { - return SumOverTestSuiteList(test_suites_, - &TestSuite::reportable_disabled_test_count); -} - -// Gets the number of disabled tests. -int UnitTestImpl::disabled_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::disabled_test_count); -} - -// Gets the number of tests to be printed in the XML report. -int UnitTestImpl::reportable_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::reportable_test_count); -} - -// Gets the number of all tests. -int UnitTestImpl::total_test_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::total_test_count); -} - -// Gets the number of tests that should run. -int UnitTestImpl::test_to_run_count() const { - return SumOverTestSuiteList(test_suites_, &TestSuite::test_to_run_count); -} - -// Returns the current OS stack trace as an std::string. -// -// The maximum number of stack frames to be included is specified by -// the gtest_stack_trace_depth flag. The skip_count parameter -// specifies the number of top frames to be skipped, which doesn't -// count against the number of frames to be included. -// -// For example, if Foo() calls Bar(), which in turn calls -// CurrentOsStackTraceExceptTop(1), Foo() will be included in the -// trace but Bar() and CurrentOsStackTraceExceptTop() won't. -std::string UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) { - return os_stack_trace_getter()->CurrentStackTrace( - static_cast<int>(GTEST_FLAG(stack_trace_depth)), - skip_count + 1 - // Skips the user-specified number of frames plus this function - // itself. - ); // NOLINT -} - -// Returns the current time in milliseconds. -TimeInMillis GetTimeInMillis() { -#if GTEST_OS_WINDOWS_MOBILE || defined(__BORLANDC__) - // Difference between 1970-01-01 and 1601-01-01 in milliseconds. - // http://analogous.blogspot.com/2005/04/epoch.html - const TimeInMillis kJavaEpochToWinFileTimeDelta = - static_cast<TimeInMillis>(116444736UL) * 100000UL; - const DWORD kTenthMicrosInMilliSecond = 10000; - - SYSTEMTIME now_systime; - FILETIME now_filetime; - ULARGE_INTEGER now_int64; - GetSystemTime(&now_systime); - if (SystemTimeToFileTime(&now_systime, &now_filetime)) { - now_int64.LowPart = now_filetime.dwLowDateTime; - now_int64.HighPart = now_filetime.dwHighDateTime; - now_int64.QuadPart = (now_int64.QuadPart / kTenthMicrosInMilliSecond) - - kJavaEpochToWinFileTimeDelta; - return now_int64.QuadPart; - } - return 0; -#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_ - __timeb64 now; - - // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996 - // (deprecated function) there. - GTEST_DISABLE_MSC_DEPRECATED_PUSH_() - _ftime64(&now); - GTEST_DISABLE_MSC_DEPRECATED_POP_() - - return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm; -#elif GTEST_HAS_GETTIMEOFDAY_ - struct timeval now; - gettimeofday(&now, nullptr); - return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000; -#else -# error "Don't know how to get the current time on your system." -#endif -} - -// Utilities - -// class String. - -#if GTEST_OS_WINDOWS_MOBILE -// Creates a UTF-16 wide string from the given ANSI string, allocating -// memory using new. The caller is responsible for deleting the return -// value using delete[]. Returns the wide string, or NULL if the -// input is NULL. -LPCWSTR String::AnsiToUtf16(const char* ansi) { - if (!ansi) return nullptr; - const int length = strlen(ansi); - const int unicode_length = - MultiByteToWideChar(CP_ACP, 0, ansi, length, nullptr, 0); - WCHAR* unicode = new WCHAR[unicode_length + 1]; - MultiByteToWideChar(CP_ACP, 0, ansi, length, - unicode, unicode_length); - unicode[unicode_length] = 0; - return unicode; -} - -// Creates an ANSI string from the given wide string, allocating -// memory using new. The caller is responsible for deleting the return -// value using delete[]. Returns the ANSI string, or NULL if the -// input is NULL. -const char* String::Utf16ToAnsi(LPCWSTR utf16_str) { - if (!utf16_str) return nullptr; - const int ansi_length = WideCharToMultiByte(CP_ACP, 0, utf16_str, -1, nullptr, - 0, nullptr, nullptr); - char* ansi = new char[ansi_length + 1]; - WideCharToMultiByte(CP_ACP, 0, utf16_str, -1, ansi, ansi_length, nullptr, - nullptr); - ansi[ansi_length] = 0; - return ansi; -} - -#endif // GTEST_OS_WINDOWS_MOBILE - -// Compares two C strings. Returns true if and only if they have the same -// content. -// -// Unlike strcmp(), this function can handle NULL argument(s). A NULL -// C string is considered different to any non-NULL C string, -// including the empty string. -bool String::CStringEquals(const char * lhs, const char * rhs) { - if (lhs == nullptr) return rhs == nullptr; - - if (rhs == nullptr) return false; - - return strcmp(lhs, rhs) == 0; -} - -#if GTEST_HAS_STD_WSTRING - -// Converts an array of wide chars to a narrow string using the UTF-8 -// encoding, and streams the result to the given Message object. -static void StreamWideCharsToMessage(const wchar_t* wstr, size_t length, - Message* msg) { - for (size_t i = 0; i != length; ) { // NOLINT - if (wstr[i] != L'\0') { - *msg << WideStringToUtf8(wstr + i, static_cast<int>(length - i)); - while (i != length && wstr[i] != L'\0') - i++; - } else { - *msg << '\0'; - i++; - } - } -} - -#endif // GTEST_HAS_STD_WSTRING - -void SplitString(const ::std::string& str, char delimiter, - ::std::vector< ::std::string>* dest) { - ::std::vector< ::std::string> parsed; - ::std::string::size_type pos = 0; - while (::testing::internal::AlwaysTrue()) { - const ::std::string::size_type colon = str.find(delimiter, pos); - if (colon == ::std::string::npos) { - parsed.push_back(str.substr(pos)); - break; - } else { - parsed.push_back(str.substr(pos, colon - pos)); - pos = colon + 1; - } - } - dest->swap(parsed); -} - -} // namespace internal - -// Constructs an empty Message. -// We allocate the stringstream separately because otherwise each use of -// ASSERT/EXPECT in a procedure adds over 200 bytes to the procedure's -// stack frame leading to huge stack frames in some cases; gcc does not reuse -// the stack space. -Message::Message() : ss_(new ::std::stringstream) { - // By default, we want there to be enough precision when printing - // a double to a Message. - *ss_ << std::setprecision(std::numeric_limits<double>::digits10 + 2); -} - -// These two overloads allow streaming a wide C string to a Message -// using the UTF-8 encoding. -Message& Message::operator <<(const wchar_t* wide_c_str) { - return *this << internal::String::ShowWideCString(wide_c_str); -} -Message& Message::operator <<(wchar_t* wide_c_str) { - return *this << internal::String::ShowWideCString(wide_c_str); -} - -#if GTEST_HAS_STD_WSTRING -// Converts the given wide string to a narrow string using the UTF-8 -// encoding, and streams the result to this Message object. -Message& Message::operator <<(const ::std::wstring& wstr) { - internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this); - return *this; -} -#endif // GTEST_HAS_STD_WSTRING - -// Gets the text streamed to this object so far as an std::string. -// Each '\0' character in the buffer is replaced with "\\0". -std::string Message::GetString() const { - return internal::StringStreamToString(ss_.get()); -} - -// AssertionResult constructors. -// Used in EXPECT_TRUE/FALSE(assertion_result). -AssertionResult::AssertionResult(const AssertionResult& other) - : success_(other.success_), - message_(other.message_.get() != nullptr - ? new ::std::string(*other.message_) - : static_cast< ::std::string*>(nullptr)) {} - -// Swaps two AssertionResults. -void AssertionResult::swap(AssertionResult& other) { - using std::swap; - swap(success_, other.success_); - swap(message_, other.message_); -} - -// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE. -AssertionResult AssertionResult::operator!() const { - AssertionResult negation(!success_); - if (message_.get() != nullptr) negation << *message_; - return negation; -} - -// Makes a successful assertion result. -AssertionResult AssertionSuccess() { - return AssertionResult(true); -} - -// Makes a failed assertion result. -AssertionResult AssertionFailure() { - return AssertionResult(false); -} - -// Makes a failed assertion result with the given failure message. -// Deprecated; use AssertionFailure() << message. -AssertionResult AssertionFailure(const Message& message) { - return AssertionFailure() << message; -} - -namespace internal { - -namespace edit_distance { -std::vector<EditType> CalculateOptimalEdits(const std::vector<size_t>& left, - const std::vector<size_t>& right) { - std::vector<std::vector<double> > costs( - left.size() + 1, std::vector<double>(right.size() + 1)); - std::vector<std::vector<EditType> > best_move( - left.size() + 1, std::vector<EditType>(right.size() + 1)); - - // Populate for empty right. - for (size_t l_i = 0; l_i < costs.size(); ++l_i) { - costs[l_i][0] = static_cast<double>(l_i); - best_move[l_i][0] = kRemove; - } - // Populate for empty left. - for (size_t r_i = 1; r_i < costs[0].size(); ++r_i) { - costs[0][r_i] = static_cast<double>(r_i); - best_move[0][r_i] = kAdd; - } - - for (size_t l_i = 0; l_i < left.size(); ++l_i) { - for (size_t r_i = 0; r_i < right.size(); ++r_i) { - if (left[l_i] == right[r_i]) { - // Found a match. Consume it. - costs[l_i + 1][r_i + 1] = costs[l_i][r_i]; - best_move[l_i + 1][r_i + 1] = kMatch; - continue; - } - - const double add = costs[l_i + 1][r_i]; - const double remove = costs[l_i][r_i + 1]; - const double replace = costs[l_i][r_i]; - if (add < remove && add < replace) { - costs[l_i + 1][r_i + 1] = add + 1; - best_move[l_i + 1][r_i + 1] = kAdd; - } else if (remove < add && remove < replace) { - costs[l_i + 1][r_i + 1] = remove + 1; - best_move[l_i + 1][r_i + 1] = kRemove; - } else { - // We make replace a little more expensive than add/remove to lower - // their priority. - costs[l_i + 1][r_i + 1] = replace + 1.00001; - best_move[l_i + 1][r_i + 1] = kReplace; - } - } - } - - // Reconstruct the best path. We do it in reverse order. - std::vector<EditType> best_path; - for (size_t l_i = left.size(), r_i = right.size(); l_i > 0 || r_i > 0;) { - EditType move = best_move[l_i][r_i]; - best_path.push_back(move); - l_i -= move != kAdd; - r_i -= move != kRemove; - } - std::reverse(best_path.begin(), best_path.end()); - return best_path; -} - -namespace { - -// Helper class to convert string into ids with deduplication. -class InternalStrings { - public: - size_t GetId(const std::string& str) { - IdMap::iterator it = ids_.find(str); - if (it != ids_.end()) return it->second; - size_t id = ids_.size(); - return ids_[str] = id; - } - - private: - typedef std::map<std::string, size_t> IdMap; - IdMap ids_; -}; - -} // namespace - -std::vector<EditType> CalculateOptimalEdits( - const std::vector<std::string>& left, - const std::vector<std::string>& right) { - std::vector<size_t> left_ids, right_ids; - { - InternalStrings intern_table; - for (size_t i = 0; i < left.size(); ++i) { - left_ids.push_back(intern_table.GetId(left[i])); - } - for (size_t i = 0; i < right.size(); ++i) { - right_ids.push_back(intern_table.GetId(right[i])); - } - } - return CalculateOptimalEdits(left_ids, right_ids); -} - -namespace { - -// Helper class that holds the state for one hunk and prints it out to the -// stream. -// It reorders adds/removes when possible to group all removes before all -// adds. It also adds the hunk header before printint into the stream. -class Hunk { - public: - Hunk(size_t left_start, size_t right_start) - : left_start_(left_start), - right_start_(right_start), - adds_(), - removes_(), - common_() {} - - void PushLine(char edit, const char* line) { - switch (edit) { - case ' ': - ++common_; - FlushEdits(); - hunk_.push_back(std::make_pair(' ', line)); - break; - case '-': - ++removes_; - hunk_removes_.push_back(std::make_pair('-', line)); - break; - case '+': - ++adds_; - hunk_adds_.push_back(std::make_pair('+', line)); - break; - } - } - - void PrintTo(std::ostream* os) { - PrintHeader(os); - FlushEdits(); - for (std::list<std::pair<char, const char*> >::const_iterator it = - hunk_.begin(); - it != hunk_.end(); ++it) { - *os << it->first << it->second << "\n"; - } - } - - bool has_edits() const { return adds_ || removes_; } - - private: - void FlushEdits() { - hunk_.splice(hunk_.end(), hunk_removes_); - hunk_.splice(hunk_.end(), hunk_adds_); - } - - // Print a unified diff header for one hunk. - // The format is - // "@@ -<left_start>,<left_length> +<right_start>,<right_length> @@" - // where the left/right parts are omitted if unnecessary. - void PrintHeader(std::ostream* ss) const { - *ss << "@@ "; - if (removes_) { - *ss << "-" << left_start_ << "," << (removes_ + common_); - } - if (removes_ && adds_) { - *ss << " "; - } - if (adds_) { - *ss << "+" << right_start_ << "," << (adds_ + common_); - } - *ss << " @@\n"; - } - - size_t left_start_, right_start_; - size_t adds_, removes_, common_; - std::list<std::pair<char, const char*> > hunk_, hunk_adds_, hunk_removes_; -}; - -} // namespace - -// Create a list of diff hunks in Unified diff format. -// Each hunk has a header generated by PrintHeader above plus a body with -// lines prefixed with ' ' for no change, '-' for deletion and '+' for -// addition. -// 'context' represents the desired unchanged prefix/suffix around the diff. -// If two hunks are close enough that their contexts overlap, then they are -// joined into one hunk. -std::string CreateUnifiedDiff(const std::vector<std::string>& left, - const std::vector<std::string>& right, - size_t context) { - const std::vector<EditType> edits = CalculateOptimalEdits(left, right); - - size_t l_i = 0, r_i = 0, edit_i = 0; - std::stringstream ss; - while (edit_i < edits.size()) { - // Find first edit. - while (edit_i < edits.size() && edits[edit_i] == kMatch) { - ++l_i; - ++r_i; - ++edit_i; - } - - // Find the first line to include in the hunk. - const size_t prefix_context = std::min(l_i, context); - Hunk hunk(l_i - prefix_context + 1, r_i - prefix_context + 1); - for (size_t i = prefix_context; i > 0; --i) { - hunk.PushLine(' ', left[l_i - i].c_str()); - } - - // Iterate the edits until we found enough suffix for the hunk or the input - // is over. - size_t n_suffix = 0; - for (; edit_i < edits.size(); ++edit_i) { - if (n_suffix >= context) { - // Continue only if the next hunk is very close. - auto it = edits.begin() + static_cast<int>(edit_i); - while (it != edits.end() && *it == kMatch) ++it; - if (it == edits.end() || - static_cast<size_t>(it - edits.begin()) - edit_i >= context) { - // There is no next edit or it is too far away. - break; - } - } - - EditType edit = edits[edit_i]; - // Reset count when a non match is found. - n_suffix = edit == kMatch ? n_suffix + 1 : 0; - - if (edit == kMatch || edit == kRemove || edit == kReplace) { - hunk.PushLine(edit == kMatch ? ' ' : '-', left[l_i].c_str()); - } - if (edit == kAdd || edit == kReplace) { - hunk.PushLine('+', right[r_i].c_str()); - } - - // Advance indices, depending on edit type. - l_i += edit != kAdd; - r_i += edit != kRemove; - } - - if (!hunk.has_edits()) { - // We are done. We don't want this hunk. - break; - } - - hunk.PrintTo(&ss); - } - return ss.str(); -} - -} // namespace edit_distance - -namespace { - -// The string representation of the values received in EqFailure() are already -// escaped. Split them on escaped '\n' boundaries. Leave all other escaped -// characters the same. -std::vector<std::string> SplitEscapedString(const std::string& str) { - std::vector<std::string> lines; - size_t start = 0, end = str.size(); - if (end > 2 && str[0] == '"' && str[end - 1] == '"') { - ++start; - --end; - } - bool escaped = false; - for (size_t i = start; i + 1 < end; ++i) { - if (escaped) { - escaped = false; - if (str[i] == 'n') { - lines.push_back(str.substr(start, i - start - 1)); - start = i + 1; - } - } else { - escaped = str[i] == '\\'; - } - } - lines.push_back(str.substr(start, end - start)); - return lines; -} - -} // namespace - -// Constructs and returns the message for an equality assertion -// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure. -// -// The first four parameters are the expressions used in the assertion -// and their values, as strings. For example, for ASSERT_EQ(foo, bar) -// where foo is 5 and bar is 6, we have: -// -// lhs_expression: "foo" -// rhs_expression: "bar" -// lhs_value: "5" -// rhs_value: "6" -// -// The ignoring_case parameter is true if and only if the assertion is a -// *_STRCASEEQ*. When it's true, the string "Ignoring case" will -// be inserted into the message. -AssertionResult EqFailure(const char* lhs_expression, - const char* rhs_expression, - const std::string& lhs_value, - const std::string& rhs_value, - bool ignoring_case) { - Message msg; - msg << "Expected equality of these values:"; - msg << "\n " << lhs_expression; - if (lhs_value != lhs_expression) { - msg << "\n Which is: " << lhs_value; - } - msg << "\n " << rhs_expression; - if (rhs_value != rhs_expression) { - msg << "\n Which is: " << rhs_value; - } - - if (ignoring_case) { - msg << "\nIgnoring case"; - } - - if (!lhs_value.empty() && !rhs_value.empty()) { - const std::vector<std::string> lhs_lines = - SplitEscapedString(lhs_value); - const std::vector<std::string> rhs_lines = - SplitEscapedString(rhs_value); - if (lhs_lines.size() > 1 || rhs_lines.size() > 1) { - msg << "\nWith diff:\n" - << edit_distance::CreateUnifiedDiff(lhs_lines, rhs_lines); - } - } - - return AssertionFailure() << msg; -} - -// Constructs a failure message for Boolean assertions such as EXPECT_TRUE. -std::string GetBoolAssertionFailureMessage( - const AssertionResult& assertion_result, - const char* expression_text, - const char* actual_predicate_value, - const char* expected_predicate_value) { - const char* actual_message = assertion_result.message(); - Message msg; - msg << "Value of: " << expression_text - << "\n Actual: " << actual_predicate_value; - if (actual_message[0] != '\0') - msg << " (" << actual_message << ")"; - msg << "\nExpected: " << expected_predicate_value; - return msg.GetString(); -} - -// Helper function for implementing ASSERT_NEAR. -AssertionResult DoubleNearPredFormat(const char* expr1, - const char* expr2, - const char* abs_error_expr, - double val1, - double val2, - double abs_error) { - const double diff = fabs(val1 - val2); - if (diff <= abs_error) return AssertionSuccess(); - - return AssertionFailure() - << "The difference between " << expr1 << " and " << expr2 - << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n" - << expr1 << " evaluates to " << val1 << ",\n" - << expr2 << " evaluates to " << val2 << ", and\n" - << abs_error_expr << " evaluates to " << abs_error << "."; -} - - -// Helper template for implementing FloatLE() and DoubleLE(). -template <typename RawType> -AssertionResult FloatingPointLE(const char* expr1, - const char* expr2, - RawType val1, - RawType val2) { - // Returns success if val1 is less than val2, - if (val1 < val2) { - return AssertionSuccess(); - } - - // or if val1 is almost equal to val2. - const FloatingPoint<RawType> lhs(val1), rhs(val2); - if (lhs.AlmostEquals(rhs)) { - return AssertionSuccess(); - } - - // Note that the above two checks will both fail if either val1 or - // val2 is NaN, as the IEEE floating-point standard requires that - // any predicate involving a NaN must return false. - - ::std::stringstream val1_ss; - val1_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2) - << val1; - - ::std::stringstream val2_ss; - val2_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2) - << val2; - - return AssertionFailure() - << "Expected: (" << expr1 << ") <= (" << expr2 << ")\n" - << " Actual: " << StringStreamToString(&val1_ss) << " vs " - << StringStreamToString(&val2_ss); -} - -} // namespace internal - -// Asserts that val1 is less than, or almost equal to, val2. Fails -// otherwise. In particular, it fails if either val1 or val2 is NaN. -AssertionResult FloatLE(const char* expr1, const char* expr2, - float val1, float val2) { - return internal::FloatingPointLE<float>(expr1, expr2, val1, val2); -} - -// Asserts that val1 is less than, or almost equal to, val2. Fails -// otherwise. In particular, it fails if either val1 or val2 is NaN. -AssertionResult DoubleLE(const char* expr1, const char* expr2, - double val1, double val2) { - return internal::FloatingPointLE<double>(expr1, expr2, val1, val2); -} - -namespace internal { - -// The helper function for {ASSERT|EXPECT}_EQ with int or enum -// arguments. -AssertionResult CmpHelperEQ(const char* lhs_expression, - const char* rhs_expression, - BiggestInt lhs, - BiggestInt rhs) { - if (lhs == rhs) { - return AssertionSuccess(); - } - - return EqFailure(lhs_expression, - rhs_expression, - FormatForComparisonFailureMessage(lhs, rhs), - FormatForComparisonFailureMessage(rhs, lhs), - false); -} - -// A macro for implementing the helper functions needed to implement -// ASSERT_?? and EXPECT_?? with integer or enum arguments. It is here -// just to avoid copy-and-paste of similar code. -#define GTEST_IMPL_CMP_HELPER_(op_name, op)\ -AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \ - BiggestInt val1, BiggestInt val2) {\ - if (val1 op val2) {\ - return AssertionSuccess();\ - } else {\ - return AssertionFailure() \ - << "Expected: (" << expr1 << ") " #op " (" << expr2\ - << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\ - << " vs " << FormatForComparisonFailureMessage(val2, val1);\ - }\ -} - -// Implements the helper function for {ASSERT|EXPECT}_NE with int or -// enum arguments. -GTEST_IMPL_CMP_HELPER_(NE, !=) -// Implements the helper function for {ASSERT|EXPECT}_LE with int or -// enum arguments. -GTEST_IMPL_CMP_HELPER_(LE, <=) -// Implements the helper function for {ASSERT|EXPECT}_LT with int or -// enum arguments. -GTEST_IMPL_CMP_HELPER_(LT, < ) -// Implements the helper function for {ASSERT|EXPECT}_GE with int or -// enum arguments. -GTEST_IMPL_CMP_HELPER_(GE, >=) -// Implements the helper function for {ASSERT|EXPECT}_GT with int or -// enum arguments. -GTEST_IMPL_CMP_HELPER_(GT, > ) - -#undef GTEST_IMPL_CMP_HELPER_ - -// The helper function for {ASSERT|EXPECT}_STREQ. -AssertionResult CmpHelperSTREQ(const char* lhs_expression, - const char* rhs_expression, - const char* lhs, - const char* rhs) { - if (String::CStringEquals(lhs, rhs)) { - return AssertionSuccess(); - } - - return EqFailure(lhs_expression, - rhs_expression, - PrintToString(lhs), - PrintToString(rhs), - false); -} - -// The helper function for {ASSERT|EXPECT}_STRCASEEQ. -AssertionResult CmpHelperSTRCASEEQ(const char* lhs_expression, - const char* rhs_expression, - const char* lhs, - const char* rhs) { - if (String::CaseInsensitiveCStringEquals(lhs, rhs)) { - return AssertionSuccess(); - } - - return EqFailure(lhs_expression, - rhs_expression, - PrintToString(lhs), - PrintToString(rhs), - true); -} - -// The helper function for {ASSERT|EXPECT}_STRNE. -AssertionResult CmpHelperSTRNE(const char* s1_expression, - const char* s2_expression, - const char* s1, - const char* s2) { - if (!String::CStringEquals(s1, s2)) { - return AssertionSuccess(); - } else { - return AssertionFailure() << "Expected: (" << s1_expression << ") != (" - << s2_expression << "), actual: \"" - << s1 << "\" vs \"" << s2 << "\""; - } -} - -// The helper function for {ASSERT|EXPECT}_STRCASENE. -AssertionResult CmpHelperSTRCASENE(const char* s1_expression, - const char* s2_expression, - const char* s1, - const char* s2) { - if (!String::CaseInsensitiveCStringEquals(s1, s2)) { - return AssertionSuccess(); - } else { - return AssertionFailure() - << "Expected: (" << s1_expression << ") != (" - << s2_expression << ") (ignoring case), actual: \"" - << s1 << "\" vs \"" << s2 << "\""; - } -} - -} // namespace internal - -namespace { - -// Helper functions for implementing IsSubString() and IsNotSubstring(). - -// This group of overloaded functions return true if and only if needle -// is a substring of haystack. NULL is considered a substring of -// itself only. - -bool IsSubstringPred(const char* needle, const char* haystack) { - if (needle == nullptr || haystack == nullptr) return needle == haystack; - - return strstr(haystack, needle) != nullptr; -} - -bool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) { - if (needle == nullptr || haystack == nullptr) return needle == haystack; - - return wcsstr(haystack, needle) != nullptr; -} - -// StringType here can be either ::std::string or ::std::wstring. -template <typename StringType> -bool IsSubstringPred(const StringType& needle, - const StringType& haystack) { - return haystack.find(needle) != StringType::npos; -} - -// This function implements either IsSubstring() or IsNotSubstring(), -// depending on the value of the expected_to_be_substring parameter. -// StringType here can be const char*, const wchar_t*, ::std::string, -// or ::std::wstring. -template <typename StringType> -AssertionResult IsSubstringImpl( - bool expected_to_be_substring, - const char* needle_expr, const char* haystack_expr, - const StringType& needle, const StringType& haystack) { - if (IsSubstringPred(needle, haystack) == expected_to_be_substring) - return AssertionSuccess(); - - const bool is_wide_string = sizeof(needle[0]) > 1; - const char* const begin_string_quote = is_wide_string ? "L\"" : "\""; - return AssertionFailure() - << "Value of: " << needle_expr << "\n" - << " Actual: " << begin_string_quote << needle << "\"\n" - << "Expected: " << (expected_to_be_substring ? "" : "not ") - << "a substring of " << haystack_expr << "\n" - << "Which is: " << begin_string_quote << haystack << "\""; -} - -} // namespace - -// IsSubstring() and IsNotSubstring() check whether needle is a -// substring of haystack (NULL is considered a substring of itself -// only), and return an appropriate error message when they fail. - -AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const char* needle, const char* haystack) { - return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const wchar_t* needle, const wchar_t* haystack) { - return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const char* needle, const char* haystack) { - return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const wchar_t* needle, const wchar_t* haystack) { - return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::string& needle, const ::std::string& haystack) { - return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::string& needle, const ::std::string& haystack) { - return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); -} - -#if GTEST_HAS_STD_WSTRING -AssertionResult IsSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::wstring& needle, const ::std::wstring& haystack) { - return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack); -} - -AssertionResult IsNotSubstring( - const char* needle_expr, const char* haystack_expr, - const ::std::wstring& needle, const ::std::wstring& haystack) { - return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack); -} -#endif // GTEST_HAS_STD_WSTRING - -namespace internal { - -#if GTEST_OS_WINDOWS - -namespace { - -// Helper function for IsHRESULT{SuccessFailure} predicates -AssertionResult HRESULTFailureHelper(const char* expr, - const char* expected, - long hr) { // NOLINT -# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_TV_TITLE - - // Windows CE doesn't support FormatMessage. - const char error_text[] = ""; - -# else - - // Looks up the human-readable system message for the HRESULT code - // and since we're not passing any params to FormatMessage, we don't - // want inserts expanded. - const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS; - const DWORD kBufSize = 4096; - // Gets the system's human readable message string for this HRESULT. - char error_text[kBufSize] = { '\0' }; - DWORD message_length = ::FormatMessageA(kFlags, - 0, // no source, we're asking system - static_cast<DWORD>(hr), // the error - 0, // no line width restrictions - error_text, // output buffer - kBufSize, // buf size - nullptr); // no arguments for inserts - // Trims tailing white space (FormatMessage leaves a trailing CR-LF) - for (; message_length && IsSpace(error_text[message_length - 1]); - --message_length) { - error_text[message_length - 1] = '\0'; - } - -# endif // GTEST_OS_WINDOWS_MOBILE - - const std::string error_hex("0x" + String::FormatHexInt(hr)); - return ::testing::AssertionFailure() - << "Expected: " << expr << " " << expected << ".\n" - << " Actual: " << error_hex << " " << error_text << "\n"; -} - -} // namespace - -AssertionResult IsHRESULTSuccess(const char* expr, long hr) { // NOLINT - if (SUCCEEDED(hr)) { - return AssertionSuccess(); - } - return HRESULTFailureHelper(expr, "succeeds", hr); -} - -AssertionResult IsHRESULTFailure(const char* expr, long hr) { // NOLINT - if (FAILED(hr)) { - return AssertionSuccess(); - } - return HRESULTFailureHelper(expr, "fails", hr); -} - -#endif // GTEST_OS_WINDOWS - -// Utility functions for encoding Unicode text (wide strings) in -// UTF-8. - -// A Unicode code-point can have up to 21 bits, and is encoded in UTF-8 -// like this: -// -// Code-point length Encoding -// 0 - 7 bits 0xxxxxxx -// 8 - 11 bits 110xxxxx 10xxxxxx -// 12 - 16 bits 1110xxxx 10xxxxxx 10xxxxxx -// 17 - 21 bits 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - -// The maximum code-point a one-byte UTF-8 sequence can represent. -const UInt32 kMaxCodePoint1 = (static_cast<UInt32>(1) << 7) - 1; - -// The maximum code-point a two-byte UTF-8 sequence can represent. -const UInt32 kMaxCodePoint2 = (static_cast<UInt32>(1) << (5 + 6)) - 1; - -// The maximum code-point a three-byte UTF-8 sequence can represent. -const UInt32 kMaxCodePoint3 = (static_cast<UInt32>(1) << (4 + 2*6)) - 1; - -// The maximum code-point a four-byte UTF-8 sequence can represent. -const UInt32 kMaxCodePoint4 = (static_cast<UInt32>(1) << (3 + 3*6)) - 1; - -// Chops off the n lowest bits from a bit pattern. Returns the n -// lowest bits. As a side effect, the original bit pattern will be -// shifted to the right by n bits. -inline UInt32 ChopLowBits(UInt32* bits, int n) { - const UInt32 low_bits = *bits & ((static_cast<UInt32>(1) << n) - 1); - *bits >>= n; - return low_bits; -} - -// Converts a Unicode code point to a narrow string in UTF-8 encoding. -// code_point parameter is of type UInt32 because wchar_t may not be -// wide enough to contain a code point. -// If the code_point is not a valid Unicode code point -// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be converted -// to "(Invalid Unicode 0xXXXXXXXX)". -std::string CodePointToUtf8(UInt32 code_point) { - if (code_point > kMaxCodePoint4) { - return "(Invalid Unicode 0x" + String::FormatHexUInt32(code_point) + ")"; - } - - char str[5]; // Big enough for the largest valid code point. - if (code_point <= kMaxCodePoint1) { - str[1] = '\0'; - str[0] = static_cast<char>(code_point); // 0xxxxxxx - } else if (code_point <= kMaxCodePoint2) { - str[2] = '\0'; - str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[0] = static_cast<char>(0xC0 | code_point); // 110xxxxx - } else if (code_point <= kMaxCodePoint3) { - str[3] = '\0'; - str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[0] = static_cast<char>(0xE0 | code_point); // 1110xxxx - } else { // code_point <= kMaxCodePoint4 - str[4] = '\0'; - str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6)); // 10xxxxxx - str[0] = static_cast<char>(0xF0 | code_point); // 11110xxx - } - return str; -} - -// The following two functions only make sense if the system -// uses UTF-16 for wide string encoding. All supported systems -// with 16 bit wchar_t (Windows, Cygwin) do use UTF-16. - -// Determines if the arguments constitute UTF-16 surrogate pair -// and thus should be combined into a single Unicode code point -// using CreateCodePointFromUtf16SurrogatePair. -inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) { - return sizeof(wchar_t) == 2 && - (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00; -} - -// Creates a Unicode code point from UTF16 surrogate pair. -inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first, - wchar_t second) { - const auto first_u = static_cast<UInt32>(first); - const auto second_u = static_cast<UInt32>(second); - const UInt32 mask = (1 << 10) - 1; - return (sizeof(wchar_t) == 2) - ? (((first_u & mask) << 10) | (second_u & mask)) + 0x10000 - : - // This function should not be called when the condition is - // false, but we provide a sensible default in case it is. - first_u; -} - -// Converts a wide string to a narrow string in UTF-8 encoding. -// The wide string is assumed to have the following encoding: -// UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin) -// UTF-32 if sizeof(wchar_t) == 4 (on Linux) -// Parameter str points to a null-terminated wide string. -// Parameter num_chars may additionally limit the number -// of wchar_t characters processed. -1 is used when the entire string -// should be processed. -// If the string contains code points that are not valid Unicode code points -// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output -// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding -// and contains invalid UTF-16 surrogate pairs, values in those pairs -// will be encoded as individual Unicode characters from Basic Normal Plane. -std::string WideStringToUtf8(const wchar_t* str, int num_chars) { - if (num_chars == -1) - num_chars = static_cast<int>(wcslen(str)); - - ::std::stringstream stream; - for (int i = 0; i < num_chars; ++i) { - UInt32 unicode_code_point; - - if (str[i] == L'\0') { - break; - } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) { - unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i], - str[i + 1]); - i++; - } else { - unicode_code_point = static_cast<UInt32>(str[i]); - } - - stream << CodePointToUtf8(unicode_code_point); - } - return StringStreamToString(&stream); -} - -// Converts a wide C string to an std::string using the UTF-8 encoding. -// NULL will be converted to "(null)". -std::string String::ShowWideCString(const wchar_t * wide_c_str) { - if (wide_c_str == nullptr) return "(null)"; - - return internal::WideStringToUtf8(wide_c_str, -1); -} - -// Compares two wide C strings. Returns true if and only if they have the -// same content. -// -// Unlike wcscmp(), this function can handle NULL argument(s). A NULL -// C string is considered different to any non-NULL C string, -// including the empty string. -bool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) { - if (lhs == nullptr) return rhs == nullptr; - - if (rhs == nullptr) return false; - - return wcscmp(lhs, rhs) == 0; -} - -// Helper function for *_STREQ on wide strings. -AssertionResult CmpHelperSTREQ(const char* lhs_expression, - const char* rhs_expression, - const wchar_t* lhs, - const wchar_t* rhs) { - if (String::WideCStringEquals(lhs, rhs)) { - return AssertionSuccess(); - } - - return EqFailure(lhs_expression, - rhs_expression, - PrintToString(lhs), - PrintToString(rhs), - false); -} - -// Helper function for *_STRNE on wide strings. -AssertionResult CmpHelperSTRNE(const char* s1_expression, - const char* s2_expression, - const wchar_t* s1, - const wchar_t* s2) { - if (!String::WideCStringEquals(s1, s2)) { - return AssertionSuccess(); - } - - return AssertionFailure() << "Expected: (" << s1_expression << ") != (" - << s2_expression << "), actual: " - << PrintToString(s1) - << " vs " << PrintToString(s2); -} - -// Compares two C strings, ignoring case. Returns true if and only if they have -// the same content. -// -// Unlike strcasecmp(), this function can handle NULL argument(s). A -// NULL C string is considered different to any non-NULL C string, -// including the empty string. -bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) { - if (lhs == nullptr) return rhs == nullptr; - if (rhs == nullptr) return false; - return posix::StrCaseCmp(lhs, rhs) == 0; -} - -// Compares two wide C strings, ignoring case. Returns true if and only if they -// have the same content. -// -// Unlike wcscasecmp(), this function can handle NULL argument(s). -// A NULL C string is considered different to any non-NULL wide C string, -// including the empty string. -// NB: The implementations on different platforms slightly differ. -// On windows, this method uses _wcsicmp which compares according to LC_CTYPE -// environment variable. On GNU platform this method uses wcscasecmp -// which compares according to LC_CTYPE category of the current locale. -// On MacOS X, it uses towlower, which also uses LC_CTYPE category of the -// current locale. -bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs, - const wchar_t* rhs) { - if (lhs == nullptr) return rhs == nullptr; - - if (rhs == nullptr) return false; - -#if GTEST_OS_WINDOWS - return _wcsicmp(lhs, rhs) == 0; -#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID - return wcscasecmp(lhs, rhs) == 0; -#else - // Android, Mac OS X and Cygwin don't define wcscasecmp. - // Other unknown OSes may not define it either. - wint_t left, right; - do { - left = towlower(static_cast<wint_t>(*lhs++)); - right = towlower(static_cast<wint_t>(*rhs++)); - } while (left && left == right); - return left == right; -#endif // OS selector -} - -// Returns true if and only if str ends with the given suffix, ignoring case. -// Any string is considered to end with an empty suffix. -bool String::EndsWithCaseInsensitive( - const std::string& str, const std::string& suffix) { - const size_t str_len = str.length(); - const size_t suffix_len = suffix.length(); - return (str_len >= suffix_len) && - CaseInsensitiveCStringEquals(str.c_str() + str_len - suffix_len, - suffix.c_str()); -} - -// Formats an int value as "%02d". -std::string String::FormatIntWidth2(int value) { - std::stringstream ss; - ss << std::setfill('0') << std::setw(2) << value; - return ss.str(); -} - -// Formats an int value as "%X". -std::string String::FormatHexUInt32(UInt32 value) { - std::stringstream ss; - ss << std::hex << std::uppercase << value; - return ss.str(); -} - -// Formats an int value as "%X". -std::string String::FormatHexInt(int value) { - return FormatHexUInt32(static_cast<UInt32>(value)); -} - -// Formats a byte as "%02X". -std::string String::FormatByte(unsigned char value) { - std::stringstream ss; - ss << std::setfill('0') << std::setw(2) << std::hex << std::uppercase - << static_cast<unsigned int>(value); - return ss.str(); -} - -// Converts the buffer in a stringstream to an std::string, converting NUL -// bytes to "\\0" along the way. -std::string StringStreamToString(::std::stringstream* ss) { - const ::std::string& str = ss->str(); - const char* const start = str.c_str(); - const char* const end = start + str.length(); - - std::string result; - result.reserve(static_cast<size_t>(2 * (end - start))); - for (const char* ch = start; ch != end; ++ch) { - if (*ch == '\0') { - result += "\\0"; // Replaces NUL with "\\0"; - } else { - result += *ch; - } - } - - return result; -} - -// Appends the user-supplied message to the Google-Test-generated message. -std::string AppendUserMessage(const std::string& gtest_msg, - const Message& user_msg) { - // Appends the user message if it's non-empty. - const std::string user_msg_string = user_msg.GetString(); - if (user_msg_string.empty()) { - return gtest_msg; - } - - return gtest_msg + "\n" + user_msg_string; -} - -} // namespace internal - -// class TestResult - -// Creates an empty TestResult. -TestResult::TestResult() - : death_test_count_(0), start_timestamp_(0), elapsed_time_(0) {} - -// D'tor. -TestResult::~TestResult() { -} - -// Returns the i-th test part result among all the results. i can -// range from 0 to total_part_count() - 1. If i is not in that range, -// aborts the program. -const TestPartResult& TestResult::GetTestPartResult(int i) const { - if (i < 0 || i >= total_part_count()) - internal::posix::Abort(); - return test_part_results_.at(static_cast<size_t>(i)); -} - -// Returns the i-th test property. i can range from 0 to -// test_property_count() - 1. If i is not in that range, aborts the -// program. -const TestProperty& TestResult::GetTestProperty(int i) const { - if (i < 0 || i >= test_property_count()) - internal::posix::Abort(); - return test_properties_.at(static_cast<size_t>(i)); -} - -// Clears the test part results. -void TestResult::ClearTestPartResults() { - test_part_results_.clear(); -} - -// Adds a test part result to the list. -void TestResult::AddTestPartResult(const TestPartResult& test_part_result) { - test_part_results_.push_back(test_part_result); -} - -// Adds a test property to the list. If a property with the same key as the -// supplied property is already represented, the value of this test_property -// replaces the old value for that key. -void TestResult::RecordProperty(const std::string& xml_element, - const TestProperty& test_property) { - if (!ValidateTestProperty(xml_element, test_property)) { - return; - } - internal::MutexLock lock(&test_properites_mutex_); - const std::vector<TestProperty>::iterator property_with_matching_key = - std::find_if(test_properties_.begin(), test_properties_.end(), - internal::TestPropertyKeyIs(test_property.key())); - if (property_with_matching_key == test_properties_.end()) { - test_properties_.push_back(test_property); - return; - } - property_with_matching_key->SetValue(test_property.value()); -} - -// The list of reserved attributes used in the <testsuites> element of XML -// output. -static const char* const kReservedTestSuitesAttributes[] = { - "disabled", - "errors", - "failures", - "name", - "random_seed", - "tests", - "time", - "timestamp" -}; - -// The list of reserved attributes used in the <testsuite> element of XML -// output. -static const char* const kReservedTestSuiteAttributes[] = { - "disabled", "errors", "failures", "name", "tests", "time", "timestamp"}; - -// The list of reserved attributes used in the <testcase> element of XML output. -static const char* const kReservedTestCaseAttributes[] = { - "classname", "name", "status", "time", "type_param", - "value_param", "file", "line"}; - -// Use a slightly different set for allowed output to ensure existing tests can -// still RecordProperty("result") or "RecordProperty(timestamp") -static const char* const kReservedOutputTestCaseAttributes[] = { - "classname", "name", "status", "time", "type_param", - "value_param", "file", "line", "result", "timestamp"}; - -template <int kSize> -std::vector<std::string> ArrayAsVector(const char* const (&array)[kSize]) { - return std::vector<std::string>(array, array + kSize); -} - -static std::vector<std::string> GetReservedAttributesForElement( - const std::string& xml_element) { - if (xml_element == "testsuites") { - return ArrayAsVector(kReservedTestSuitesAttributes); - } else if (xml_element == "testsuite") { - return ArrayAsVector(kReservedTestSuiteAttributes); - } else if (xml_element == "testcase") { - return ArrayAsVector(kReservedTestCaseAttributes); - } else { - GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element; - } - // This code is unreachable but some compilers may not realizes that. - return std::vector<std::string>(); -} - -// TODO(jdesprez): Merge the two getReserved attributes once skip is improved -static std::vector<std::string> GetReservedOutputAttributesForElement( - const std::string& xml_element) { - if (xml_element == "testsuites") { - return ArrayAsVector(kReservedTestSuitesAttributes); - } else if (xml_element == "testsuite") { - return ArrayAsVector(kReservedTestSuiteAttributes); - } else if (xml_element == "testcase") { - return ArrayAsVector(kReservedOutputTestCaseAttributes); - } else { - GTEST_CHECK_(false) << "Unrecognized xml_element provided: " << xml_element; - } - // This code is unreachable but some compilers may not realizes that. - return std::vector<std::string>(); -} - -static std::string FormatWordList(const std::vector<std::string>& words) { - Message word_list; - for (size_t i = 0; i < words.size(); ++i) { - if (i > 0 && words.size() > 2) { - word_list << ", "; - } - if (i == words.size() - 1) { - word_list << "and "; - } - word_list << "'" << words[i] << "'"; - } - return word_list.GetString(); -} - -static bool ValidateTestPropertyName( - const std::string& property_name, - const std::vector<std::string>& reserved_names) { - if (std::find(reserved_names.begin(), reserved_names.end(), property_name) != - reserved_names.end()) { - ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name - << " (" << FormatWordList(reserved_names) - << " are reserved by " << GTEST_NAME_ << ")"; - return false; - } - return true; -} - -// Adds a failure if the key is a reserved attribute of the element named -// xml_element. Returns true if the property is valid. -bool TestResult::ValidateTestProperty(const std::string& xml_element, - const TestProperty& test_property) { - return ValidateTestPropertyName(test_property.key(), - GetReservedAttributesForElement(xml_element)); -} - -// Clears the object. -void TestResult::Clear() { - test_part_results_.clear(); - test_properties_.clear(); - death_test_count_ = 0; - elapsed_time_ = 0; -} - -// Returns true off the test part was skipped. -static bool TestPartSkipped(const TestPartResult& result) { - return result.skipped(); -} - -// Returns true if and only if the test was skipped. -bool TestResult::Skipped() const { - return !Failed() && CountIf(test_part_results_, TestPartSkipped) > 0; -} - -// Returns true if and only if the test failed. -bool TestResult::Failed() const { - for (int i = 0; i < total_part_count(); ++i) { - if (GetTestPartResult(i).failed()) - return true; - } - return false; -} - -// Returns true if and only if the test part fatally failed. -static bool TestPartFatallyFailed(const TestPartResult& result) { - return result.fatally_failed(); -} - -// Returns true if and only if the test fatally failed. -bool TestResult::HasFatalFailure() const { - return CountIf(test_part_results_, TestPartFatallyFailed) > 0; -} - -// Returns true if and only if the test part non-fatally failed. -static bool TestPartNonfatallyFailed(const TestPartResult& result) { - return result.nonfatally_failed(); -} - -// Returns true if and only if the test has a non-fatal failure. -bool TestResult::HasNonfatalFailure() const { - return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0; -} - -// Gets the number of all test parts. This is the sum of the number -// of successful test parts and the number of failed test parts. -int TestResult::total_part_count() const { - return static_cast<int>(test_part_results_.size()); -} - -// Returns the number of the test properties. -int TestResult::test_property_count() const { - return static_cast<int>(test_properties_.size()); -} - -// class Test - -// Creates a Test object. - -// The c'tor saves the states of all flags. -Test::Test() - : gtest_flag_saver_(new GTEST_FLAG_SAVER_) { -} - -// The d'tor restores the states of all flags. The actual work is -// done by the d'tor of the gtest_flag_saver_ field, and thus not -// visible here. -Test::~Test() { -} - -// Sets up the test fixture. -// -// A sub-class may override this. -void Test::SetUp() { -} - -// Tears down the test fixture. -// -// A sub-class may override this. -void Test::TearDown() { -} - -// Allows user supplied key value pairs to be recorded for later output. -void Test::RecordProperty(const std::string& key, const std::string& value) { - UnitTest::GetInstance()->RecordProperty(key, value); -} - -// Allows user supplied key value pairs to be recorded for later output. -void Test::RecordProperty(const std::string& key, int value) { - Message value_message; - value_message << value; - RecordProperty(key, value_message.GetString().c_str()); -} - -namespace internal { - -void ReportFailureInUnknownLocation(TestPartResult::Type result_type, - const std::string& message) { - // This function is a friend of UnitTest and as such has access to - // AddTestPartResult. - UnitTest::GetInstance()->AddTestPartResult( - result_type, - nullptr, // No info about the source file where the exception occurred. - -1, // We have no info on which line caused the exception. - message, - ""); // No stack trace, either. -} - -} // namespace internal - -// Google Test requires all tests in the same test suite to use the same test -// fixture class. This function checks if the current test has the -// same fixture class as the first test in the current test suite. If -// yes, it returns true; otherwise it generates a Google Test failure and -// returns false. -bool Test::HasSameFixtureClass() { - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - const TestSuite* const test_suite = impl->current_test_suite(); - - // Info about the first test in the current test suite. - const TestInfo* const first_test_info = test_suite->test_info_list()[0]; - const internal::TypeId first_fixture_id = first_test_info->fixture_class_id_; - const char* const first_test_name = first_test_info->name(); - - // Info about the current test. - const TestInfo* const this_test_info = impl->current_test_info(); - const internal::TypeId this_fixture_id = this_test_info->fixture_class_id_; - const char* const this_test_name = this_test_info->name(); - - if (this_fixture_id != first_fixture_id) { - // Is the first test defined using TEST? - const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId(); - // Is this test defined using TEST? - const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId(); - - if (first_is_TEST || this_is_TEST) { - // Both TEST and TEST_F appear in same test suite, which is incorrect. - // Tell the user how to fix this. - - // Gets the name of the TEST and the name of the TEST_F. Note - // that first_is_TEST and this_is_TEST cannot both be true, as - // the fixture IDs are different for the two tests. - const char* const TEST_name = - first_is_TEST ? first_test_name : this_test_name; - const char* const TEST_F_name = - first_is_TEST ? this_test_name : first_test_name; - - ADD_FAILURE() - << "All tests in the same test suite must use the same test fixture\n" - << "class, so mixing TEST_F and TEST in the same test suite is\n" - << "illegal. In test suite " << this_test_info->test_suite_name() - << ",\n" - << "test " << TEST_F_name << " is defined using TEST_F but\n" - << "test " << TEST_name << " is defined using TEST. You probably\n" - << "want to change the TEST to TEST_F or move it to another test\n" - << "case."; - } else { - // Two fixture classes with the same name appear in two different - // namespaces, which is not allowed. Tell the user how to fix this. - ADD_FAILURE() - << "All tests in the same test suite must use the same test fixture\n" - << "class. However, in test suite " - << this_test_info->test_suite_name() << ",\n" - << "you defined test " << first_test_name << " and test " - << this_test_name << "\n" - << "using two different test fixture classes. This can happen if\n" - << "the two classes are from different namespaces or translation\n" - << "units and have the same name. You should probably rename one\n" - << "of the classes to put the tests into different test suites."; - } - return false; - } - - return true; -} - -#if GTEST_HAS_SEH - -// Adds an "exception thrown" fatal failure to the current test. This -// function returns its result via an output parameter pointer because VC++ -// prohibits creation of objects with destructors on stack in functions -// using __try (see error C2712). -static std::string* FormatSehExceptionMessage(DWORD exception_code, - const char* location) { - Message message; - message << "SEH exception with code 0x" << std::setbase(16) << - exception_code << std::setbase(10) << " thrown in " << location << "."; - - return new std::string(message.GetString()); -} - -#endif // GTEST_HAS_SEH - -namespace internal { - -#if GTEST_HAS_EXCEPTIONS - -// Adds an "exception thrown" fatal failure to the current test. -static std::string FormatCxxExceptionMessage(const char* description, - const char* location) { - Message message; - if (description != nullptr) { - message << "C++ exception with description \"" << description << "\""; - } else { - message << "Unknown C++ exception"; - } - message << " thrown in " << location << "."; - - return message.GetString(); -} - -static std::string PrintTestPartResultToString( - const TestPartResult& test_part_result); - -GoogleTestFailureException::GoogleTestFailureException( - const TestPartResult& failure) - : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {} - -#endif // GTEST_HAS_EXCEPTIONS - -// We put these helper functions in the internal namespace as IBM's xlC -// compiler rejects the code if they were declared static. - -// Runs the given method and handles SEH exceptions it throws, when -// SEH is supported; returns the 0-value for type Result in case of an -// SEH exception. (Microsoft compilers cannot handle SEH and C++ -// exceptions in the same function. Therefore, we provide a separate -// wrapper function for handling SEH exceptions.) -template <class T, typename Result> -Result HandleSehExceptionsInMethodIfSupported( - T* object, Result (T::*method)(), const char* location) { -#if GTEST_HAS_SEH - __try { - return (object->*method)(); - } __except (internal::UnitTestOptions::GTestShouldProcessSEH( // NOLINT - GetExceptionCode())) { - // We create the exception message on the heap because VC++ prohibits - // creation of objects with destructors on stack in functions using __try - // (see error C2712). - std::string* exception_message = FormatSehExceptionMessage( - GetExceptionCode(), location); - internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure, - *exception_message); - delete exception_message; - return static_cast<Result>(0); - } -#else - (void)location; - return (object->*method)(); -#endif // GTEST_HAS_SEH -} - -// Runs the given method and catches and reports C++ and/or SEH-style -// exceptions, if they are supported; returns the 0-value for type -// Result in case of an SEH exception. -template <class T, typename Result> -Result HandleExceptionsInMethodIfSupported( - T* object, Result (T::*method)(), const char* location) { - // NOTE: The user code can affect the way in which Google Test handles - // exceptions by setting GTEST_FLAG(catch_exceptions), but only before - // RUN_ALL_TESTS() starts. It is technically possible to check the flag - // after the exception is caught and either report or re-throw the - // exception based on the flag's value: - // - // try { - // // Perform the test method. - // } catch (...) { - // if (GTEST_FLAG(catch_exceptions)) - // // Report the exception as failure. - // else - // throw; // Re-throws the original exception. - // } - // - // However, the purpose of this flag is to allow the program to drop into - // the debugger when the exception is thrown. On most platforms, once the - // control enters the catch block, the exception origin information is - // lost and the debugger will stop the program at the point of the - // re-throw in this function -- instead of at the point of the original - // throw statement in the code under test. For this reason, we perform - // the check early, sacrificing the ability to affect Google Test's - // exception handling in the method where the exception is thrown. - if (internal::GetUnitTestImpl()->catch_exceptions()) { -#if GTEST_HAS_EXCEPTIONS - try { - return HandleSehExceptionsInMethodIfSupported(object, method, location); - } catch (const AssertionException&) { // NOLINT - // This failure was reported already. - } catch (const internal::GoogleTestFailureException&) { // NOLINT - // This exception type can only be thrown by a failed Google - // Test assertion with the intention of letting another testing - // framework catch it. Therefore we just re-throw it. - throw; - } catch (const std::exception& e) { // NOLINT - internal::ReportFailureInUnknownLocation( - TestPartResult::kFatalFailure, - FormatCxxExceptionMessage(e.what(), location)); - } catch (...) { // NOLINT - internal::ReportFailureInUnknownLocation( - TestPartResult::kFatalFailure, - FormatCxxExceptionMessage(nullptr, location)); - } - return static_cast<Result>(0); -#else - return HandleSehExceptionsInMethodIfSupported(object, method, location); -#endif // GTEST_HAS_EXCEPTIONS - } else { - return (object->*method)(); - } -} - -} // namespace internal - -// Runs the test and updates the test result. -void Test::Run() { - if (!HasSameFixtureClass()) return; - - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()"); - // We will run the test only if SetUp() was successful and didn't call - // GTEST_SKIP(). - if (!HasFatalFailure() && !IsSkipped()) { - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported( - this, &Test::TestBody, "the test body"); - } - - // However, we want to clean up as much as possible. Hence we will - // always call TearDown(), even if SetUp() or the test body has - // failed. - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported( - this, &Test::TearDown, "TearDown()"); -} - -// Returns true if and only if the current test has a fatal failure. -bool Test::HasFatalFailure() { - return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure(); -} - -// Returns true if and only if the current test has a non-fatal failure. -bool Test::HasNonfatalFailure() { - return internal::GetUnitTestImpl()->current_test_result()-> - HasNonfatalFailure(); -} - -// Returns true if and only if the current test was skipped. -bool Test::IsSkipped() { - return internal::GetUnitTestImpl()->current_test_result()->Skipped(); -} - -// class TestInfo - -// Constructs a TestInfo object. It assumes ownership of the test factory -// object. -TestInfo::TestInfo(const std::string& a_test_suite_name, - const std::string& a_name, const char* a_type_param, - const char* a_value_param, - internal::CodeLocation a_code_location, - internal::TypeId fixture_class_id, - internal::TestFactoryBase* factory) - : test_suite_name_(a_test_suite_name), - name_(a_name), - type_param_(a_type_param ? new std::string(a_type_param) : nullptr), - value_param_(a_value_param ? new std::string(a_value_param) : nullptr), - location_(a_code_location), - fixture_class_id_(fixture_class_id), - should_run_(false), - is_disabled_(false), - matches_filter_(false), - factory_(factory), - result_() {} - -// Destructs a TestInfo object. -TestInfo::~TestInfo() { delete factory_; } - -namespace internal { - -// Creates a new TestInfo object and registers it with Google Test; -// returns the created object. -// -// Arguments: -// -// test_suite_name: name of the test suite -// name: name of the test -// type_param: the name of the test's type parameter, or NULL if -// this is not a typed or a type-parameterized test. -// value_param: text representation of the test's value parameter, -// or NULL if this is not a value-parameterized test. -// code_location: code location where the test is defined -// fixture_class_id: ID of the test fixture class -// set_up_tc: pointer to the function that sets up the test suite -// tear_down_tc: pointer to the function that tears down the test suite -// factory: pointer to the factory that creates a test object. -// The newly created TestInfo instance will assume -// ownership of the factory object. -TestInfo* MakeAndRegisterTestInfo( - const char* test_suite_name, const char* name, const char* type_param, - const char* value_param, CodeLocation code_location, - TypeId fixture_class_id, SetUpTestSuiteFunc set_up_tc, - TearDownTestSuiteFunc tear_down_tc, TestFactoryBase* factory) { - TestInfo* const test_info = - new TestInfo(test_suite_name, name, type_param, value_param, - code_location, fixture_class_id, factory); - GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info); - return test_info; -} - -void ReportInvalidTestSuiteType(const char* test_suite_name, - CodeLocation code_location) { - Message errors; - errors - << "Attempted redefinition of test suite " << test_suite_name << ".\n" - << "All tests in the same test suite must use the same test fixture\n" - << "class. However, in test suite " << test_suite_name << ", you tried\n" - << "to define a test using a fixture class different from the one\n" - << "used earlier. This can happen if the two fixture classes are\n" - << "from different namespaces and have the same name. You should\n" - << "probably rename one of the classes to put the tests into different\n" - << "test suites."; - - GTEST_LOG_(ERROR) << FormatFileLocation(code_location.file.c_str(), - code_location.line) - << " " << errors.GetString(); -} -} // namespace internal - -namespace { - -// A predicate that checks the test name of a TestInfo against a known -// value. -// -// This is used for implementation of the TestSuite class only. We put -// it in the anonymous namespace to prevent polluting the outer -// namespace. -// -// TestNameIs is copyable. -class TestNameIs { - public: - // Constructor. - // - // TestNameIs has NO default constructor. - explicit TestNameIs(const char* name) - : name_(name) {} - - // Returns true if and only if the test name of test_info matches name_. - bool operator()(const TestInfo * test_info) const { - return test_info && test_info->name() == name_; - } - - private: - std::string name_; -}; - -} // namespace - -namespace internal { - -// This method expands all parameterized tests registered with macros TEST_P -// and INSTANTIATE_TEST_SUITE_P into regular tests and registers those. -// This will be done just once during the program runtime. -void UnitTestImpl::RegisterParameterizedTests() { - if (!parameterized_tests_registered_) { - parameterized_test_registry_.RegisterTests(); - parameterized_tests_registered_ = true; - } -} - -} // namespace internal - -// Creates the test object, runs it, records its result, and then -// deletes it. -void TestInfo::Run() { - if (!should_run_) return; - - // Tells UnitTest where to store test result. - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - impl->set_current_test_info(this); - - TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater(); - - // Notifies the unit test event listeners that a test is about to start. - repeater->OnTestStart(*this); - - const TimeInMillis start = internal::GetTimeInMillis(); - - impl->os_stack_trace_getter()->UponLeavingGTest(); - - // Creates the test object. - Test* const test = internal::HandleExceptionsInMethodIfSupported( - factory_, &internal::TestFactoryBase::CreateTest, - "the test fixture's constructor"); - - // Runs the test if the constructor didn't generate a fatal failure or invoke - // GTEST_SKIP(). - // Note that the object will not be null - if (!Test::HasFatalFailure() && !Test::IsSkipped()) { - // This doesn't throw as all user code that can throw are wrapped into - // exception handling code. - test->Run(); - } - - if (test != nullptr) { - // Deletes the test object. - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported( - test, &Test::DeleteSelf_, "the test fixture's destructor"); - } - - result_.set_start_timestamp(start); - result_.set_elapsed_time(internal::GetTimeInMillis() - start); - - // Notifies the unit test event listener that a test has just finished. - repeater->OnTestEnd(*this); - - // Tells UnitTest to stop associating assertion results to this - // test. - impl->set_current_test_info(nullptr); -} - -// class TestSuite - -// Gets the number of successful tests in this test suite. -int TestSuite::successful_test_count() const { - return CountIf(test_info_list_, TestPassed); -} - -// Gets the number of successful tests in this test suite. -int TestSuite::skipped_test_count() const { - return CountIf(test_info_list_, TestSkipped); -} - -// Gets the number of failed tests in this test suite. -int TestSuite::failed_test_count() const { - return CountIf(test_info_list_, TestFailed); -} - -// Gets the number of disabled tests that will be reported in the XML report. -int TestSuite::reportable_disabled_test_count() const { - return CountIf(test_info_list_, TestReportableDisabled); -} - -// Gets the number of disabled tests in this test suite. -int TestSuite::disabled_test_count() const { - return CountIf(test_info_list_, TestDisabled); -} - -// Gets the number of tests to be printed in the XML report. -int TestSuite::reportable_test_count() const { - return CountIf(test_info_list_, TestReportable); -} - -// Get the number of tests in this test suite that should run. -int TestSuite::test_to_run_count() const { - return CountIf(test_info_list_, ShouldRunTest); -} - -// Gets the number of all tests. -int TestSuite::total_test_count() const { - return static_cast<int>(test_info_list_.size()); -} - -// Creates a TestSuite with the given name. -// -// Arguments: -// -// name: name of the test suite -// a_type_param: the name of the test suite's type parameter, or NULL if -// this is not a typed or a type-parameterized test suite. -// set_up_tc: pointer to the function that sets up the test suite -// tear_down_tc: pointer to the function that tears down the test suite -TestSuite::TestSuite(const char* a_name, const char* a_type_param, - internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc) - : name_(a_name), - type_param_(a_type_param ? new std::string(a_type_param) : nullptr), - set_up_tc_(set_up_tc), - tear_down_tc_(tear_down_tc), - should_run_(false), - start_timestamp_(0), - elapsed_time_(0) {} - -// Destructor of TestSuite. -TestSuite::~TestSuite() { - // Deletes every Test in the collection. - ForEach(test_info_list_, internal::Delete<TestInfo>); -} - -// Returns the i-th test among all the tests. i can range from 0 to -// total_test_count() - 1. If i is not in that range, returns NULL. -const TestInfo* TestSuite::GetTestInfo(int i) const { - const int index = GetElementOr(test_indices_, i, -1); - return index < 0 ? nullptr : test_info_list_[static_cast<size_t>(index)]; -} - -// Returns the i-th test among all the tests. i can range from 0 to -// total_test_count() - 1. If i is not in that range, returns NULL. -TestInfo* TestSuite::GetMutableTestInfo(int i) { - const int index = GetElementOr(test_indices_, i, -1); - return index < 0 ? nullptr : test_info_list_[static_cast<size_t>(index)]; -} - -// Adds a test to this test suite. Will delete the test upon -// destruction of the TestSuite object. -void TestSuite::AddTestInfo(TestInfo* test_info) { - test_info_list_.push_back(test_info); - test_indices_.push_back(static_cast<int>(test_indices_.size())); -} - -// Runs every test in this TestSuite. -void TestSuite::Run() { - if (!should_run_) return; - - internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); - impl->set_current_test_suite(this); - - TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater(); - - // Call both legacy and the new API - repeater->OnTestSuiteStart(*this); -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI - repeater->OnTestCaseStart(*this); -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI - - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported( - this, &TestSuite::RunSetUpTestSuite, "SetUpTestSuite()"); - - start_timestamp_ = internal::GetTimeInMillis(); - for (int i = 0; i < total_test_count(); i++) { - GetMutableTestInfo(i)->Run(); - } - elapsed_time_ = internal::GetTimeInMillis() - start_timestamp_; - - impl->os_stack_trace_getter()->UponLeavingGTest(); - internal::HandleExceptionsInMethodIfSupported( - this, &TestSuite::RunTearDownTestSuite, "TearDownTestSuite()"); - - // Call both legacy and the new API - repeater->OnTestSuiteEnd(*this); -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI - repeater->OnTestCaseEnd(*this); -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI - - impl->set_current_test_suite(nullptr); -} - -// Clears the results of all tests in this test suite. -void TestSuite::ClearResult() { - ad_hoc_test_result_.Clear(); - ForEach(test_info_list_, TestInfo::ClearTestResult); -} - -// Shuffles the tests in this test suite. -void TestSuite::ShuffleTests(internal::Random* random) { - Shuffle(random, &test_indices_); -} - -// Restores the test order to before the first shuffle. -void TestSuite::UnshuffleTests() { - for (size_t i = 0; i < test_indices_.size(); i++) { - test_indices_[i] = static_cast<int>(i); - } -} - -// Formats a countable noun. Depending on its quantity, either the -// singular form or the plural form is used. e.g. -// -// FormatCountableNoun(1, "formula", "formuli") returns "1 formula". -// FormatCountableNoun(5, "book", "books") returns "5 books". -static std::string FormatCountableNoun(int count, - const char * singular_form, - const char * plural_form) { - return internal::StreamableToString(count) + " " + - (count == 1 ? singular_form : plural_form); -} - -// Formats the count of tests. -static std::string FormatTestCount(int test_count) { - return FormatCountableNoun(test_count, "test", "tests"); -} - -// Formats the count of test suites. -static std::string FormatTestSuiteCount(int test_suite_count) { - return FormatCountableNoun(test_suite_count, "test suite", "test suites"); -} - -// Converts a TestPartResult::Type enum to human-friendly string -// representation. Both kNonFatalFailure and kFatalFailure are translated -// to "Failure", as the user usually doesn't care about the difference -// between the two when viewing the test result. -static const char * TestPartResultTypeToString(TestPartResult::Type type) { - switch (type) { - case TestPartResult::kSkip: - return "Skipped"; - case TestPartResult::kSuccess: - return "Success"; - - case TestPartResult::kNonFatalFailure: - case TestPartResult::kFatalFailure: -#ifdef _MSC_VER - return "error: "; -#else - return "Failure\n"; -#endif - default: - return "Unknown result type"; - } -} - -namespace internal { - -// Prints a TestPartResult to an std::string. -static std::string PrintTestPartResultToString( - const TestPartResult& test_part_result) { - return (Message() - << internal::FormatFileLocation(test_part_result.file_name(), - test_part_result.line_number()) - << " " << TestPartResultTypeToString(test_part_result.type()) - << test_part_result.message()).GetString(); -} - -// Prints a TestPartResult. -static void PrintTestPartResult(const TestPartResult& test_part_result) { - const std::string& result = - PrintTestPartResultToString(test_part_result); - printf("%s\n", result.c_str()); - fflush(stdout); - // If the test program runs in Visual Studio or a debugger, the - // following statements add the test part result message to the Output - // window such that the user can double-click on it to jump to the - // corresponding source code location; otherwise they do nothing. -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE - // We don't call OutputDebugString*() on Windows Mobile, as printing - // to stdout is done by OutputDebugString() there already - we don't - // want the same message printed twice. - ::OutputDebugStringA(result.c_str()); - ::OutputDebugStringA("\n"); -#endif -} - -// class PrettyUnitTestResultPrinter -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \ - !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW - -// Returns the character attribute for the given color. -static WORD GetColorAttribute(GTestColor color) { - switch (color) { - case COLOR_RED: return FOREGROUND_RED; - case COLOR_GREEN: return FOREGROUND_GREEN; - case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN; - default: return 0; - } -} - -static int GetBitOffset(WORD color_mask) { - if (color_mask == 0) return 0; - - int bitOffset = 0; - while ((color_mask & 1) == 0) { - color_mask >>= 1; - ++bitOffset; - } - return bitOffset; -} - -static WORD GetNewColor(GTestColor color, WORD old_color_attrs) { - // Let's reuse the BG - static const WORD background_mask = BACKGROUND_BLUE | BACKGROUND_GREEN | - BACKGROUND_RED | BACKGROUND_INTENSITY; - static const WORD foreground_mask = FOREGROUND_BLUE | FOREGROUND_GREEN | - FOREGROUND_RED | FOREGROUND_INTENSITY; - const WORD existing_bg = old_color_attrs & background_mask; - - WORD new_color = - GetColorAttribute(color) | existing_bg | FOREGROUND_INTENSITY; - static const int bg_bitOffset = GetBitOffset(background_mask); - static const int fg_bitOffset = GetBitOffset(foreground_mask); - - if (((new_color & background_mask) >> bg_bitOffset) == - ((new_color & foreground_mask) >> fg_bitOffset)) { - new_color ^= FOREGROUND_INTENSITY; // invert intensity - } - return new_color; -} - -#else - -// Returns the ANSI color code for the given color. COLOR_DEFAULT is -// an invalid input. -static const char* GetAnsiColorCode(GTestColor color) { - switch (color) { - case COLOR_RED: return "1"; - case COLOR_GREEN: return "2"; - case COLOR_YELLOW: return "3"; - default: - return nullptr; - } -} - -#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE - -// Returns true if and only if Google Test should use colors in the output. -bool ShouldUseColor(bool stdout_is_tty) { - const char* const gtest_color = GTEST_FLAG(color).c_str(); - - if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) { -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW - // On Windows the TERM variable is usually not set, but the - // console there does support colors. - return stdout_is_tty; -#else - // On non-Windows platforms, we rely on the TERM variable. - const char* const term = posix::GetEnv("TERM"); - const bool term_supports_color = - String::CStringEquals(term, "xterm") || - String::CStringEquals(term, "xterm-color") || - String::CStringEquals(term, "xterm-256color") || - String::CStringEquals(term, "screen") || - String::CStringEquals(term, "screen-256color") || - String::CStringEquals(term, "tmux") || - String::CStringEquals(term, "tmux-256color") || - String::CStringEquals(term, "rxvt-unicode") || - String::CStringEquals(term, "rxvt-unicode-256color") || - String::CStringEquals(term, "linux") || - String::CStringEquals(term, "cygwin"); - return stdout_is_tty && term_supports_color; -#endif // GTEST_OS_WINDOWS - } - - return String::CaseInsensitiveCStringEquals(gtest_color, "yes") || - String::CaseInsensitiveCStringEquals(gtest_color, "true") || - String::CaseInsensitiveCStringEquals(gtest_color, "t") || - String::CStringEquals(gtest_color, "1"); - // We take "yes", "true", "t", and "1" as meaning "yes". If the - // value is neither one of these nor "auto", we treat it as "no" to - // be conservative. -} - -// Helpers for printing colored strings to stdout. Note that on Windows, we -// cannot simply emit special characters and have the terminal change colors. -// This routine must actually emit the characters rather than return a string -// that would be colored when printed, as can be done on Linux. -void ColoredPrintf(GTestColor color, const char* fmt, ...) { - va_list args; - va_start(args, fmt); - -#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS || GTEST_OS_IOS || \ - GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT || defined(ESP_PLATFORM) - const bool use_color = AlwaysFalse(); -#else - static const bool in_color_mode = - ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0); - const bool use_color = in_color_mode && (color != COLOR_DEFAULT); -#endif // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS - - if (!use_color) { - vprintf(fmt, args); - va_end(args); - return; - } - -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE && \ - !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW - const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); - - // Gets the current text color. - CONSOLE_SCREEN_BUFFER_INFO buffer_info; - GetConsoleScreenBufferInfo(stdout_handle, &buffer_info); - const WORD old_color_attrs = buffer_info.wAttributes; - const WORD new_color = GetNewColor(color, old_color_attrs); - - // We need to flush the stream buffers into the console before each - // SetConsoleTextAttribute call lest it affect the text that is already - // printed but has not yet reached the console. - fflush(stdout); - SetConsoleTextAttribute(stdout_handle, new_color); - - vprintf(fmt, args); - - fflush(stdout); - // Restores the text color. - SetConsoleTextAttribute(stdout_handle, old_color_attrs); -#else - printf("\033[0;3%sm", GetAnsiColorCode(color)); - vprintf(fmt, args); - printf("\033[m"); // Resets the terminal to default. -#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE - va_end(args); -} - -// Text printed in Google Test's text output and --gtest_list_tests -// output to label the type parameter and value parameter for a test. -static const char kTypeParamLabel[] = "TypeParam"; -static const char kValueParamLabel[] = "GetParam()"; - -static void PrintFullTestCommentIfPresent(const TestInfo& test_info) { - const char* const type_param = test_info.type_param(); - const char* const value_param = test_info.value_param(); - - if (type_param != nullptr || value_param != nullptr) { - printf(", where "); - if (type_param != nullptr) { - printf("%s = %s", kTypeParamLabel, type_param); - if (value_param != nullptr) printf(" and "); - } - if (value_param != nullptr) { - printf("%s = %s", kValueParamLabel, value_param); - } - } -} - -// This class implements the TestEventListener interface. -// -// Class PrettyUnitTestResultPrinter is copyable. -class PrettyUnitTestResultPrinter : public TestEventListener { - public: - PrettyUnitTestResultPrinter() {} - static void PrintTestName(const char* test_suite, const char* test) { - printf("%s.%s", test_suite, test); - } - - // The following methods override what's in the TestEventListener class. - void OnTestProgramStart(const UnitTest& /*unit_test*/) override {} - void OnTestIterationStart(const UnitTest& unit_test, int iteration) override; - void OnEnvironmentsSetUpStart(const UnitTest& unit_test) override; - void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {} -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseStart(const TestCase& test_case) override; -#else - void OnTestSuiteStart(const TestSuite& test_suite) override; -#endif // OnTestCaseStart - - void OnTestStart(const TestInfo& test_info) override; - - void OnTestPartResult(const TestPartResult& result) override; - void OnTestEnd(const TestInfo& test_info) override; -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseEnd(const TestCase& test_case) override; -#else - void OnTestSuiteEnd(const TestSuite& test_suite) override; -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - - void OnEnvironmentsTearDownStart(const UnitTest& unit_test) override; - void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {} - void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override; - void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {} - - private: - static void PrintFailedTests(const UnitTest& unit_test); - static void PrintSkippedTests(const UnitTest& unit_test); -}; - - // Fired before each iteration of tests starts. -void PrettyUnitTestResultPrinter::OnTestIterationStart( - const UnitTest& unit_test, int iteration) { - if (GTEST_FLAG(repeat) != 1) - printf("\nRepeating all tests (iteration %d) . . .\n\n", iteration + 1); - - const char* const filter = GTEST_FLAG(filter).c_str(); - - // Prints the filter if it's not *. This reminds the user that some - // tests may be skipped. - if (!String::CStringEquals(filter, kUniversalFilter)) { - ColoredPrintf(COLOR_YELLOW, - "Note: %s filter = %s\n", GTEST_NAME_, filter); - } - - if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) { - const Int32 shard_index = Int32FromEnvOrDie(kTestShardIndex, -1); - ColoredPrintf(COLOR_YELLOW, - "Note: This is test shard %d of %s.\n", - static_cast<int>(shard_index) + 1, - internal::posix::GetEnv(kTestTotalShards)); - } - - if (GTEST_FLAG(shuffle)) { - ColoredPrintf(COLOR_YELLOW, - "Note: Randomizing tests' orders with a seed of %d .\n", - unit_test.random_seed()); - } - - ColoredPrintf(COLOR_GREEN, "[==========] "); - printf("Running %s from %s.\n", - FormatTestCount(unit_test.test_to_run_count()).c_str(), - FormatTestSuiteCount(unit_test.test_suite_to_run_count()).c_str()); - fflush(stdout); -} - -void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart( - const UnitTest& /*unit_test*/) { - ColoredPrintf(COLOR_GREEN, "[----------] "); - printf("Global test environment set-up.\n"); - fflush(stdout); -} - -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) { - const std::string counts = - FormatCountableNoun(test_case.test_to_run_count(), "test", "tests"); - ColoredPrintf(COLOR_GREEN, "[----------] "); - printf("%s from %s", counts.c_str(), test_case.name()); - if (test_case.type_param() == nullptr) { - printf("\n"); - } else { - printf(", where %s = %s\n", kTypeParamLabel, test_case.type_param()); - } - fflush(stdout); -} -#else -void PrettyUnitTestResultPrinter::OnTestSuiteStart( - const TestSuite& test_suite) { - const std::string counts = - FormatCountableNoun(test_suite.test_to_run_count(), "test", "tests"); - ColoredPrintf(COLOR_GREEN, "[----------] "); - printf("%s from %s", counts.c_str(), test_suite.name()); - if (test_suite.type_param() == nullptr) { - printf("\n"); - } else { - printf(", where %s = %s\n", kTypeParamLabel, test_suite.type_param()); - } - fflush(stdout); -} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) { - ColoredPrintf(COLOR_GREEN, "[ RUN ] "); - PrintTestName(test_info.test_suite_name(), test_info.name()); - printf("\n"); - fflush(stdout); -} - -// Called after an assertion failure. -void PrettyUnitTestResultPrinter::OnTestPartResult( - const TestPartResult& result) { - switch (result.type()) { - // If the test part succeeded, or was skipped, - // we don't need to do anything. - case TestPartResult::kSkip: - case TestPartResult::kSuccess: - return; - default: - // Print failure message from the assertion - // (e.g. expected this and got that). - PrintTestPartResult(result); - fflush(stdout); - } -} - -void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) { - if (test_info.result()->Passed()) { - ColoredPrintf(COLOR_GREEN, "[ OK ] "); - } else if (test_info.result()->Skipped()) { - ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); - } else { - ColoredPrintf(COLOR_RED, "[ FAILED ] "); - } - PrintTestName(test_info.test_suite_name(), test_info.name()); - if (test_info.result()->Failed()) - PrintFullTestCommentIfPresent(test_info); - - if (GTEST_FLAG(print_time)) { - printf(" (%s ms)\n", internal::StreamableToString( - test_info.result()->elapsed_time()).c_str()); - } else { - printf("\n"); - } - fflush(stdout); -} - -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) { - if (!GTEST_FLAG(print_time)) return; - - const std::string counts = - FormatCountableNoun(test_case.test_to_run_count(), "test", "tests"); - ColoredPrintf(COLOR_GREEN, "[----------] "); - printf("%s from %s (%s ms total)\n\n", counts.c_str(), test_case.name(), - internal::StreamableToString(test_case.elapsed_time()).c_str()); - fflush(stdout); -} -#else -void PrettyUnitTestResultPrinter::OnTestSuiteEnd(const TestSuite& test_suite) { - if (!GTEST_FLAG(print_time)) return; - - const std::string counts = - FormatCountableNoun(test_suite.test_to_run_count(), "test", "tests"); - ColoredPrintf(COLOR_GREEN, "[----------] "); - printf("%s from %s (%s ms total)\n\n", counts.c_str(), test_suite.name(), - internal::StreamableToString(test_suite.elapsed_time()).c_str()); - fflush(stdout); -} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -void PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart( - const UnitTest& /*unit_test*/) { - ColoredPrintf(COLOR_GREEN, "[----------] "); - printf("Global test environment tear-down\n"); - fflush(stdout); -} - -// Internal helper for printing the list of failed tests. -void PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) { - const int failed_test_count = unit_test.failed_test_count(); - if (failed_test_count == 0) { - return; - } - - for (int i = 0; i < unit_test.total_test_suite_count(); ++i) { - const TestSuite& test_suite = *unit_test.GetTestSuite(i); - if (!test_suite.should_run() || (test_suite.failed_test_count() == 0)) { - continue; - } - for (int j = 0; j < test_suite.total_test_count(); ++j) { - const TestInfo& test_info = *test_suite.GetTestInfo(j); - if (!test_info.should_run() || !test_info.result()->Failed()) { - continue; - } - ColoredPrintf(COLOR_RED, "[ FAILED ] "); - printf("%s.%s", test_suite.name(), test_info.name()); - PrintFullTestCommentIfPresent(test_info); - printf("\n"); - } - } -} - -// Internal helper for printing the list of skipped tests. -void PrettyUnitTestResultPrinter::PrintSkippedTests(const UnitTest& unit_test) { - const int skipped_test_count = unit_test.skipped_test_count(); - if (skipped_test_count == 0) { - return; - } - - for (int i = 0; i < unit_test.total_test_suite_count(); ++i) { - const TestSuite& test_suite = *unit_test.GetTestSuite(i); - if (!test_suite.should_run() || (test_suite.skipped_test_count() == 0)) { - continue; - } - for (int j = 0; j < test_suite.total_test_count(); ++j) { - const TestInfo& test_info = *test_suite.GetTestInfo(j); - if (!test_info.should_run() || !test_info.result()->Skipped()) { - continue; - } - ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); - printf("%s.%s", test_suite.name(), test_info.name()); - printf("\n"); - } - } -} - -void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, - int /*iteration*/) { - ColoredPrintf(COLOR_GREEN, "[==========] "); - printf("%s from %s ran.", - FormatTestCount(unit_test.test_to_run_count()).c_str(), - FormatTestSuiteCount(unit_test.test_suite_to_run_count()).c_str()); - if (GTEST_FLAG(print_time)) { - printf(" (%s ms total)", - internal::StreamableToString(unit_test.elapsed_time()).c_str()); - } - printf("\n"); - ColoredPrintf(COLOR_GREEN, "[ PASSED ] "); - printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str()); - - const int skipped_test_count = unit_test.skipped_test_count(); - if (skipped_test_count > 0) { - ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); - printf("%s, listed below:\n", FormatTestCount(skipped_test_count).c_str()); - PrintSkippedTests(unit_test); - } - - int num_failures = unit_test.failed_test_count(); - if (!unit_test.Passed()) { - const int failed_test_count = unit_test.failed_test_count(); - ColoredPrintf(COLOR_RED, "[ FAILED ] "); - printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str()); - PrintFailedTests(unit_test); - printf("\n%2d FAILED %s\n", num_failures, - num_failures == 1 ? "TEST" : "TESTS"); - } - - int num_disabled = unit_test.reportable_disabled_test_count(); - if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) { - if (!num_failures) { - printf("\n"); // Add a spacer if no FAILURE banner is displayed. - } - ColoredPrintf(COLOR_YELLOW, - " YOU HAVE %d DISABLED %s\n\n", - num_disabled, - num_disabled == 1 ? "TEST" : "TESTS"); - } - // Ensure that Google Test output is printed before, e.g., heapchecker output. - fflush(stdout); -} - -// End PrettyUnitTestResultPrinter - -// class TestEventRepeater -// -// This class forwards events to other event listeners. -class TestEventRepeater : public TestEventListener { - public: - TestEventRepeater() : forwarding_enabled_(true) {} - ~TestEventRepeater() override; - void Append(TestEventListener *listener); - TestEventListener* Release(TestEventListener* listener); - - // Controls whether events will be forwarded to listeners_. Set to false - // in death test child processes. - bool forwarding_enabled() const { return forwarding_enabled_; } - void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; } - - void OnTestProgramStart(const UnitTest& unit_test) override; - void OnTestIterationStart(const UnitTest& unit_test, int iteration) override; - void OnEnvironmentsSetUpStart(const UnitTest& unit_test) override; - void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) override; -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseStart(const TestSuite& parameter) override; -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestSuiteStart(const TestSuite& parameter) override; - void OnTestStart(const TestInfo& test_info) override; - void OnTestPartResult(const TestPartResult& result) override; - void OnTestEnd(const TestInfo& test_info) override; -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestCaseEnd(const TestCase& parameter) override; -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - void OnTestSuiteEnd(const TestSuite& parameter) override; - void OnEnvironmentsTearDownStart(const UnitTest& unit_test) override; - void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) override; - void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override; - void OnTestProgramEnd(const UnitTest& unit_test) override; - - private: - // Controls whether events will be forwarded to listeners_. Set to false - // in death test child processes. - bool forwarding_enabled_; - // The list of listeners that receive events. - std::vector<TestEventListener*> listeners_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater); -}; - -TestEventRepeater::~TestEventRepeater() { - ForEach(listeners_, Delete<TestEventListener>); -} - -void TestEventRepeater::Append(TestEventListener *listener) { - listeners_.push_back(listener); -} - -TestEventListener* TestEventRepeater::Release(TestEventListener *listener) { - for (size_t i = 0; i < listeners_.size(); ++i) { - if (listeners_[i] == listener) { - listeners_.erase(listeners_.begin() + static_cast<int>(i)); - return listener; - } - } - - return nullptr; -} - -// Since most methods are very similar, use macros to reduce boilerplate. -// This defines a member that forwards the call to all listeners. -#define GTEST_REPEATER_METHOD_(Name, Type) \ -void TestEventRepeater::Name(const Type& parameter) { \ - if (forwarding_enabled_) { \ - for (size_t i = 0; i < listeners_.size(); i++) { \ - listeners_[i]->Name(parameter); \ - } \ - } \ -} -// This defines a member that forwards the call to all listeners in reverse -// order. -#define GTEST_REVERSE_REPEATER_METHOD_(Name, Type) \ - void TestEventRepeater::Name(const Type& parameter) { \ - if (forwarding_enabled_) { \ - for (size_t i = listeners_.size(); i != 0; i--) { \ - listeners_[i - 1]->Name(parameter); \ - } \ - } \ - } - -GTEST_REPEATER_METHOD_(OnTestProgramStart, UnitTest) -GTEST_REPEATER_METHOD_(OnEnvironmentsSetUpStart, UnitTest) -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -GTEST_REPEATER_METHOD_(OnTestCaseStart, TestSuite) -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -GTEST_REPEATER_METHOD_(OnTestSuiteStart, TestSuite) -GTEST_REPEATER_METHOD_(OnTestStart, TestInfo) -GTEST_REPEATER_METHOD_(OnTestPartResult, TestPartResult) -GTEST_REPEATER_METHOD_(OnEnvironmentsTearDownStart, UnitTest) -GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsSetUpEnd, UnitTest) -GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsTearDownEnd, UnitTest) -GTEST_REVERSE_REPEATER_METHOD_(OnTestEnd, TestInfo) -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -GTEST_REVERSE_REPEATER_METHOD_(OnTestCaseEnd, TestSuite) -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -GTEST_REVERSE_REPEATER_METHOD_(OnTestSuiteEnd, TestSuite) -GTEST_REVERSE_REPEATER_METHOD_(OnTestProgramEnd, UnitTest) - -#undef GTEST_REPEATER_METHOD_ -#undef GTEST_REVERSE_REPEATER_METHOD_ - -void TestEventRepeater::OnTestIterationStart(const UnitTest& unit_test, - int iteration) { - if (forwarding_enabled_) { - for (size_t i = 0; i < listeners_.size(); i++) { - listeners_[i]->OnTestIterationStart(unit_test, iteration); - } - } -} - -void TestEventRepeater::OnTestIterationEnd(const UnitTest& unit_test, - int iteration) { - if (forwarding_enabled_) { - for (size_t i = listeners_.size(); i > 0; i--) { - listeners_[i - 1]->OnTestIterationEnd(unit_test, iteration); - } - } -} - -// End TestEventRepeater - -// This class generates an XML output file. -class XmlUnitTestResultPrinter : public EmptyTestEventListener { - public: - explicit XmlUnitTestResultPrinter(const char* output_file); - - void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override; - void ListTestsMatchingFilter(const std::vector<TestSuite*>& test_suites); - - // Prints an XML summary of all unit tests. - static void PrintXmlTestsList(std::ostream* stream, - const std::vector<TestSuite*>& test_suites); - - private: - // Is c a whitespace character that is normalized to a space character - // when it appears in an XML attribute value? - static bool IsNormalizableWhitespace(char c) { - return c == 0x9 || c == 0xA || c == 0xD; - } - - // May c appear in a well-formed XML document? - static bool IsValidXmlCharacter(char c) { - return IsNormalizableWhitespace(c) || c >= 0x20; - } - - // Returns an XML-escaped copy of the input string str. If - // is_attribute is true, the text is meant to appear as an attribute - // value, and normalizable whitespace is preserved by replacing it - // with character references. - static std::string EscapeXml(const std::string& str, bool is_attribute); - - // Returns the given string with all characters invalid in XML removed. - static std::string RemoveInvalidXmlCharacters(const std::string& str); - - // Convenience wrapper around EscapeXml when str is an attribute value. - static std::string EscapeXmlAttribute(const std::string& str) { - return EscapeXml(str, true); - } - - // Convenience wrapper around EscapeXml when str is not an attribute value. - static std::string EscapeXmlText(const char* str) { - return EscapeXml(str, false); - } - - // Verifies that the given attribute belongs to the given element and - // streams the attribute as XML. - static void OutputXmlAttribute(std::ostream* stream, - const std::string& element_name, - const std::string& name, - const std::string& value); - - // Streams an XML CDATA section, escaping invalid CDATA sequences as needed. - static void OutputXmlCDataSection(::std::ostream* stream, const char* data); - - // Streams an XML representation of a TestInfo object. - static void OutputXmlTestInfo(::std::ostream* stream, - const char* test_suite_name, - const TestInfo& test_info); - - // Prints an XML representation of a TestSuite object - static void PrintXmlTestSuite(::std::ostream* stream, - const TestSuite& test_suite); - - // Prints an XML summary of unit_test to output stream out. - static void PrintXmlUnitTest(::std::ostream* stream, - const UnitTest& unit_test); - - // Produces a string representing the test properties in a result as space - // delimited XML attributes based on the property key="value" pairs. - // When the std::string is not empty, it includes a space at the beginning, - // to delimit this attribute from prior attributes. - static std::string TestPropertiesAsXmlAttributes(const TestResult& result); - - // Streams an XML representation of the test properties of a TestResult - // object. - static void OutputXmlTestProperties(std::ostream* stream, - const TestResult& result); - - // The output file. - const std::string output_file_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter); -}; - -// Creates a new XmlUnitTestResultPrinter. -XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file) - : output_file_(output_file) { - if (output_file_.empty()) { - GTEST_LOG_(FATAL) << "XML output file may not be null"; - } -} - -// Called after the unit test ends. -void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, - int /*iteration*/) { - FILE* xmlout = OpenFileForWriting(output_file_); - std::stringstream stream; - PrintXmlUnitTest(&stream, unit_test); - fprintf(xmlout, "%s", StringStreamToString(&stream).c_str()); - fclose(xmlout); -} - -void XmlUnitTestResultPrinter::ListTestsMatchingFilter( - const std::vector<TestSuite*>& test_suites) { - FILE* xmlout = OpenFileForWriting(output_file_); - std::stringstream stream; - PrintXmlTestsList(&stream, test_suites); - fprintf(xmlout, "%s", StringStreamToString(&stream).c_str()); - fclose(xmlout); -} - -// Returns an XML-escaped copy of the input string str. If is_attribute -// is true, the text is meant to appear as an attribute value, and -// normalizable whitespace is preserved by replacing it with character -// references. -// -// Invalid XML characters in str, if any, are stripped from the output. -// It is expected that most, if not all, of the text processed by this -// module will consist of ordinary English text. -// If this module is ever modified to produce version 1.1 XML output, -// most invalid characters can be retained using character references. -std::string XmlUnitTestResultPrinter::EscapeXml( - const std::string& str, bool is_attribute) { - Message m; - - for (size_t i = 0; i < str.size(); ++i) { - const char ch = str[i]; - switch (ch) { - case '<': - m << "<"; - break; - case '>': - m << ">"; - break; - case '&': - m << "&"; - break; - case '\'': - if (is_attribute) - m << "'"; - else - m << '\''; - break; - case '"': - if (is_attribute) - m << """; - else - m << '"'; - break; - default: - if (IsValidXmlCharacter(ch)) { - if (is_attribute && IsNormalizableWhitespace(ch)) - m << "&#x" << String::FormatByte(static_cast<unsigned char>(ch)) - << ";"; - else - m << ch; - } - break; - } - } - - return m.GetString(); -} - -// Returns the given string with all characters invalid in XML removed. -// Currently invalid characters are dropped from the string. An -// alternative is to replace them with certain characters such as . or ?. -std::string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters( - const std::string& str) { - std::string output; - output.reserve(str.size()); - for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) - if (IsValidXmlCharacter(*it)) - output.push_back(*it); - - return output; -} - -// The following routines generate an XML representation of a UnitTest -// object. -// GOOGLETEST_CM0009 DO NOT DELETE -// -// This is how Google Test concepts map to the DTD: -// -// <testsuites name="AllTests"> <-- corresponds to a UnitTest object -// <testsuite name="testcase-name"> <-- corresponds to a TestSuite object -// <testcase name="test-name"> <-- corresponds to a TestInfo object -// <failure message="...">...</failure> -// <failure message="...">...</failure> -// <failure message="...">...</failure> -// <-- individual assertion failures -// </testcase> -// </testsuite> -// </testsuites> - -// Formats the given time in milliseconds as seconds. -std::string FormatTimeInMillisAsSeconds(TimeInMillis ms) { - ::std::stringstream ss; - ss << (static_cast<double>(ms) * 1e-3); - return ss.str(); -} - -static bool PortableLocaltime(time_t seconds, struct tm* out) { -#if defined(_MSC_VER) - return localtime_s(out, &seconds) == 0; -#elif defined(__MINGW32__) || defined(__MINGW64__) - // MINGW <time.h> provides neither localtime_r nor localtime_s, but uses - // Windows' localtime(), which has a thread-local tm buffer. - struct tm* tm_ptr = localtime(&seconds); // NOLINT - if (tm_ptr == nullptr) return false; - *out = *tm_ptr; - return true; -#else - return localtime_r(&seconds, out) != nullptr; -#endif -} - -// Converts the given epoch time in milliseconds to a date string in the ISO -// 8601 format, without the timezone information. -std::string FormatEpochTimeInMillisAsIso8601(TimeInMillis ms) { - struct tm time_struct; - if (!PortableLocaltime(static_cast<time_t>(ms / 1000), &time_struct)) - return ""; - // YYYY-MM-DDThh:mm:ss - return StreamableToString(time_struct.tm_year + 1900) + "-" + - String::FormatIntWidth2(time_struct.tm_mon + 1) + "-" + - String::FormatIntWidth2(time_struct.tm_mday) + "T" + - String::FormatIntWidth2(time_struct.tm_hour) + ":" + - String::FormatIntWidth2(time_struct.tm_min) + ":" + - String::FormatIntWidth2(time_struct.tm_sec); -} - -// Streams an XML CDATA section, escaping invalid CDATA sequences as needed. -void XmlUnitTestResultPrinter::OutputXmlCDataSection(::std::ostream* stream, - const char* data) { - const char* segment = data; - *stream << "<![CDATA["; - for (;;) { - const char* const next_segment = strstr(segment, "]]>"); - if (next_segment != nullptr) { - stream->write( - segment, static_cast<std::streamsize>(next_segment - segment)); - *stream << "]]>]]><![CDATA["; - segment = next_segment + strlen("]]>"); - } else { - *stream << segment; - break; - } - } - *stream << "]]>"; -} - -void XmlUnitTestResultPrinter::OutputXmlAttribute( - std::ostream* stream, - const std::string& element_name, - const std::string& name, - const std::string& value) { - const std::vector<std::string>& allowed_names = - GetReservedOutputAttributesForElement(element_name); - - GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != - allowed_names.end()) - << "Attribute " << name << " is not allowed for element <" << element_name - << ">."; - - *stream << " " << name << "=\"" << EscapeXmlAttribute(value) << "\""; -} - -// Prints an XML representation of a TestInfo object. -void XmlUnitTestResultPrinter::OutputXmlTestInfo(::std::ostream* stream, - const char* test_suite_name, - const TestInfo& test_info) { - const TestResult& result = *test_info.result(); - const std::string kTestsuite = "testcase"; - - if (test_info.is_in_another_shard()) { - return; - } - - *stream << " <testcase"; - OutputXmlAttribute(stream, kTestsuite, "name", test_info.name()); - - if (test_info.value_param() != nullptr) { - OutputXmlAttribute(stream, kTestsuite, "value_param", - test_info.value_param()); - } - if (test_info.type_param() != nullptr) { - OutputXmlAttribute(stream, kTestsuite, "type_param", - test_info.type_param()); - } - if (GTEST_FLAG(list_tests)) { - OutputXmlAttribute(stream, kTestsuite, "file", test_info.file()); - OutputXmlAttribute(stream, kTestsuite, "line", - StreamableToString(test_info.line())); - *stream << " />\n"; - return; - } - - OutputXmlAttribute(stream, kTestsuite, "status", - test_info.should_run() ? "run" : "notrun"); - OutputXmlAttribute(stream, kTestsuite, "result", - test_info.should_run() - ? (result.Skipped() ? "skipped" : "completed") - : "suppressed"); - OutputXmlAttribute(stream, kTestsuite, "time", - FormatTimeInMillisAsSeconds(result.elapsed_time())); - OutputXmlAttribute( - stream, kTestsuite, "timestamp", - FormatEpochTimeInMillisAsIso8601(result.start_timestamp())); - OutputXmlAttribute(stream, kTestsuite, "classname", test_suite_name); - - int failures = 0; - for (int i = 0; i < result.total_part_count(); ++i) { - const TestPartResult& part = result.GetTestPartResult(i); - if (part.failed()) { - if (++failures == 1) { - *stream << ">\n"; - } - const std::string location = - internal::FormatCompilerIndependentFileLocation(part.file_name(), - part.line_number()); - const std::string summary = location + "\n" + part.summary(); - *stream << " <failure message=\"" - << EscapeXmlAttribute(summary.c_str()) - << "\" type=\"\">"; - const std::string detail = location + "\n" + part.message(); - OutputXmlCDataSection(stream, RemoveInvalidXmlCharacters(detail).c_str()); - *stream << "</failure>\n"; - } - } - - if (failures == 0 && result.test_property_count() == 0) { - *stream << " />\n"; - } else { - if (failures == 0) { - *stream << ">\n"; - } - OutputXmlTestProperties(stream, result); - *stream << " </testcase>\n"; - } -} - -// Prints an XML representation of a TestSuite object -void XmlUnitTestResultPrinter::PrintXmlTestSuite(std::ostream* stream, - const TestSuite& test_suite) { - const std::string kTestsuite = "testsuite"; - *stream << " <" << kTestsuite; - OutputXmlAttribute(stream, kTestsuite, "name", test_suite.name()); - OutputXmlAttribute(stream, kTestsuite, "tests", - StreamableToString(test_suite.reportable_test_count())); - if (!GTEST_FLAG(list_tests)) { - OutputXmlAttribute(stream, kTestsuite, "failures", - StreamableToString(test_suite.failed_test_count())); - OutputXmlAttribute( - stream, kTestsuite, "disabled", - StreamableToString(test_suite.reportable_disabled_test_count())); - OutputXmlAttribute(stream, kTestsuite, "errors", "0"); - OutputXmlAttribute(stream, kTestsuite, "time", - FormatTimeInMillisAsSeconds(test_suite.elapsed_time())); - OutputXmlAttribute( - stream, kTestsuite, "timestamp", - FormatEpochTimeInMillisAsIso8601(test_suite.start_timestamp())); - *stream << TestPropertiesAsXmlAttributes(test_suite.ad_hoc_test_result()); - } - *stream << ">\n"; - for (int i = 0; i < test_suite.total_test_count(); ++i) { - if (test_suite.GetTestInfo(i)->is_reportable()) - OutputXmlTestInfo(stream, test_suite.name(), *test_suite.GetTestInfo(i)); - } - *stream << " </" << kTestsuite << ">\n"; -} - -// Prints an XML summary of unit_test to output stream out. -void XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream, - const UnitTest& unit_test) { - const std::string kTestsuites = "testsuites"; - - *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; - *stream << "<" << kTestsuites; - - OutputXmlAttribute(stream, kTestsuites, "tests", - StreamableToString(unit_test.reportable_test_count())); - OutputXmlAttribute(stream, kTestsuites, "failures", - StreamableToString(unit_test.failed_test_count())); - OutputXmlAttribute( - stream, kTestsuites, "disabled", - StreamableToString(unit_test.reportable_disabled_test_count())); - OutputXmlAttribute(stream, kTestsuites, "errors", "0"); - OutputXmlAttribute(stream, kTestsuites, "time", - FormatTimeInMillisAsSeconds(unit_test.elapsed_time())); - OutputXmlAttribute( - stream, kTestsuites, "timestamp", - FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp())); - - if (GTEST_FLAG(shuffle)) { - OutputXmlAttribute(stream, kTestsuites, "random_seed", - StreamableToString(unit_test.random_seed())); - } - *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result()); - - OutputXmlAttribute(stream, kTestsuites, "name", "AllTests"); - *stream << ">\n"; - - for (int i = 0; i < unit_test.total_test_suite_count(); ++i) { - if (unit_test.GetTestSuite(i)->reportable_test_count() > 0) - PrintXmlTestSuite(stream, *unit_test.GetTestSuite(i)); - } - *stream << "</" << kTestsuites << ">\n"; -} - -void XmlUnitTestResultPrinter::PrintXmlTestsList( - std::ostream* stream, const std::vector<TestSuite*>& test_suites) { - const std::string kTestsuites = "testsuites"; - - *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; - *stream << "<" << kTestsuites; - - int total_tests = 0; - for (auto test_suite : test_suites) { - total_tests += test_suite->total_test_count(); - } - OutputXmlAttribute(stream, kTestsuites, "tests", - StreamableToString(total_tests)); - OutputXmlAttribute(stream, kTestsuites, "name", "AllTests"); - *stream << ">\n"; - - for (auto test_suite : test_suites) { - PrintXmlTestSuite(stream, *test_suite); - } - *stream << "</" << kTestsuites << ">\n"; -} - -// Produces a string representing the test properties in a result as space -// delimited XML attributes based on the property key="value" pairs. -std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes( - const TestResult& result) { - Message attributes; - for (int i = 0; i < result.test_property_count(); ++i) { - const TestProperty& property = result.GetTestProperty(i); - attributes << " " << property.key() << "=" - << "\"" << EscapeXmlAttribute(property.value()) << "\""; - } - return attributes.GetString(); -} - -void XmlUnitTestResultPrinter::OutputXmlTestProperties( - std::ostream* stream, const TestResult& result) { - const std::string kProperties = "properties"; - const std::string kProperty = "property"; - - if (result.test_property_count() <= 0) { - return; - } - - *stream << "<" << kProperties << ">\n"; - for (int i = 0; i < result.test_property_count(); ++i) { - const TestProperty& property = result.GetTestProperty(i); - *stream << "<" << kProperty; - *stream << " name=\"" << EscapeXmlAttribute(property.key()) << "\""; - *stream << " value=\"" << EscapeXmlAttribute(property.value()) << "\""; - *stream << "/>\n"; - } - *stream << "</" << kProperties << ">\n"; -} - -// End XmlUnitTestResultPrinter - -// This class generates an JSON output file. -class JsonUnitTestResultPrinter : public EmptyTestEventListener { - public: - explicit JsonUnitTestResultPrinter(const char* output_file); - - void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override; - - // Prints an JSON summary of all unit tests. - static void PrintJsonTestList(::std::ostream* stream, - const std::vector<TestSuite*>& test_suites); - - private: - // Returns an JSON-escaped copy of the input string str. - static std::string EscapeJson(const std::string& str); - - //// Verifies that the given attribute belongs to the given element and - //// streams the attribute as JSON. - static void OutputJsonKey(std::ostream* stream, - const std::string& element_name, - const std::string& name, - const std::string& value, - const std::string& indent, - bool comma = true); - static void OutputJsonKey(std::ostream* stream, - const std::string& element_name, - const std::string& name, - int value, - const std::string& indent, - bool comma = true); - - // Streams a JSON representation of a TestInfo object. - static void OutputJsonTestInfo(::std::ostream* stream, - const char* test_suite_name, - const TestInfo& test_info); - - // Prints a JSON representation of a TestSuite object - static void PrintJsonTestSuite(::std::ostream* stream, - const TestSuite& test_suite); - - // Prints a JSON summary of unit_test to output stream out. - static void PrintJsonUnitTest(::std::ostream* stream, - const UnitTest& unit_test); - - // Produces a string representing the test properties in a result as - // a JSON dictionary. - static std::string TestPropertiesAsJson(const TestResult& result, - const std::string& indent); - - // The output file. - const std::string output_file_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(JsonUnitTestResultPrinter); -}; - -// Creates a new JsonUnitTestResultPrinter. -JsonUnitTestResultPrinter::JsonUnitTestResultPrinter(const char* output_file) - : output_file_(output_file) { - if (output_file_.empty()) { - GTEST_LOG_(FATAL) << "JSON output file may not be null"; - } -} - -void JsonUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, - int /*iteration*/) { - FILE* jsonout = OpenFileForWriting(output_file_); - std::stringstream stream; - PrintJsonUnitTest(&stream, unit_test); - fprintf(jsonout, "%s", StringStreamToString(&stream).c_str()); - fclose(jsonout); -} - -// Returns an JSON-escaped copy of the input string str. -std::string JsonUnitTestResultPrinter::EscapeJson(const std::string& str) { - Message m; - - for (size_t i = 0; i < str.size(); ++i) { - const char ch = str[i]; - switch (ch) { - case '\\': - case '"': - case '/': - m << '\\' << ch; - break; - case '\b': - m << "\\b"; - break; - case '\t': - m << "\\t"; - break; - case '\n': - m << "\\n"; - break; - case '\f': - m << "\\f"; - break; - case '\r': - m << "\\r"; - break; - default: - if (ch < ' ') { - m << "\\u00" << String::FormatByte(static_cast<unsigned char>(ch)); - } else { - m << ch; - } - break; - } - } - - return m.GetString(); -} - -// The following routines generate an JSON representation of a UnitTest -// object. - -// Formats the given time in milliseconds as seconds. -static std::string FormatTimeInMillisAsDuration(TimeInMillis ms) { - ::std::stringstream ss; - ss << (static_cast<double>(ms) * 1e-3) << "s"; - return ss.str(); -} - -// Converts the given epoch time in milliseconds to a date string in the -// RFC3339 format, without the timezone information. -static std::string FormatEpochTimeInMillisAsRFC3339(TimeInMillis ms) { - struct tm time_struct; - if (!PortableLocaltime(static_cast<time_t>(ms / 1000), &time_struct)) - return ""; - // YYYY-MM-DDThh:mm:ss - return StreamableToString(time_struct.tm_year + 1900) + "-" + - String::FormatIntWidth2(time_struct.tm_mon + 1) + "-" + - String::FormatIntWidth2(time_struct.tm_mday) + "T" + - String::FormatIntWidth2(time_struct.tm_hour) + ":" + - String::FormatIntWidth2(time_struct.tm_min) + ":" + - String::FormatIntWidth2(time_struct.tm_sec) + "Z"; -} - -static inline std::string Indent(size_t width) { - return std::string(width, ' '); -} - -void JsonUnitTestResultPrinter::OutputJsonKey( - std::ostream* stream, - const std::string& element_name, - const std::string& name, - const std::string& value, - const std::string& indent, - bool comma) { - const std::vector<std::string>& allowed_names = - GetReservedOutputAttributesForElement(element_name); - - GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != - allowed_names.end()) - << "Key \"" << name << "\" is not allowed for value \"" << element_name - << "\"."; - - *stream << indent << "\"" << name << "\": \"" << EscapeJson(value) << "\""; - if (comma) - *stream << ",\n"; -} - -void JsonUnitTestResultPrinter::OutputJsonKey( - std::ostream* stream, - const std::string& element_name, - const std::string& name, - int value, - const std::string& indent, - bool comma) { - const std::vector<std::string>& allowed_names = - GetReservedOutputAttributesForElement(element_name); - - GTEST_CHECK_(std::find(allowed_names.begin(), allowed_names.end(), name) != - allowed_names.end()) - << "Key \"" << name << "\" is not allowed for value \"" << element_name - << "\"."; - - *stream << indent << "\"" << name << "\": " << StreamableToString(value); - if (comma) - *stream << ",\n"; -} - -// Prints a JSON representation of a TestInfo object. -void JsonUnitTestResultPrinter::OutputJsonTestInfo(::std::ostream* stream, - const char* test_suite_name, - const TestInfo& test_info) { - const TestResult& result = *test_info.result(); - const std::string kTestsuite = "testcase"; - const std::string kIndent = Indent(10); - - *stream << Indent(8) << "{\n"; - OutputJsonKey(stream, kTestsuite, "name", test_info.name(), kIndent); - - if (test_info.value_param() != nullptr) { - OutputJsonKey(stream, kTestsuite, "value_param", test_info.value_param(), - kIndent); - } - if (test_info.type_param() != nullptr) { - OutputJsonKey(stream, kTestsuite, "type_param", test_info.type_param(), - kIndent); - } - if (GTEST_FLAG(list_tests)) { - OutputJsonKey(stream, kTestsuite, "file", test_info.file(), kIndent); - OutputJsonKey(stream, kTestsuite, "line", test_info.line(), kIndent, false); - *stream << "\n" << Indent(8) << "}"; - return; - } - - OutputJsonKey(stream, kTestsuite, "status", - test_info.should_run() ? "RUN" : "NOTRUN", kIndent); - OutputJsonKey(stream, kTestsuite, "result", - test_info.should_run() - ? (result.Skipped() ? "SKIPPED" : "COMPLETED") - : "SUPPRESSED", - kIndent); - OutputJsonKey(stream, kTestsuite, "timestamp", - FormatEpochTimeInMillisAsRFC3339(result.start_timestamp()), - kIndent); - OutputJsonKey(stream, kTestsuite, "time", - FormatTimeInMillisAsDuration(result.elapsed_time()), kIndent); - OutputJsonKey(stream, kTestsuite, "classname", test_suite_name, kIndent, - false); - *stream << TestPropertiesAsJson(result, kIndent); - - int failures = 0; - for (int i = 0; i < result.total_part_count(); ++i) { - const TestPartResult& part = result.GetTestPartResult(i); - if (part.failed()) { - *stream << ",\n"; - if (++failures == 1) { - *stream << kIndent << "\"" << "failures" << "\": [\n"; - } - const std::string location = - internal::FormatCompilerIndependentFileLocation(part.file_name(), - part.line_number()); - const std::string message = EscapeJson(location + "\n" + part.message()); - *stream << kIndent << " {\n" - << kIndent << " \"failure\": \"" << message << "\",\n" - << kIndent << " \"type\": \"\"\n" - << kIndent << " }"; - } - } - - if (failures > 0) - *stream << "\n" << kIndent << "]"; - *stream << "\n" << Indent(8) << "}"; -} - -// Prints an JSON representation of a TestSuite object -void JsonUnitTestResultPrinter::PrintJsonTestSuite( - std::ostream* stream, const TestSuite& test_suite) { - const std::string kTestsuite = "testsuite"; - const std::string kIndent = Indent(6); - - *stream << Indent(4) << "{\n"; - OutputJsonKey(stream, kTestsuite, "name", test_suite.name(), kIndent); - OutputJsonKey(stream, kTestsuite, "tests", test_suite.reportable_test_count(), - kIndent); - if (!GTEST_FLAG(list_tests)) { - OutputJsonKey(stream, kTestsuite, "failures", - test_suite.failed_test_count(), kIndent); - OutputJsonKey(stream, kTestsuite, "disabled", - test_suite.reportable_disabled_test_count(), kIndent); - OutputJsonKey(stream, kTestsuite, "errors", 0, kIndent); - OutputJsonKey( - stream, kTestsuite, "timestamp", - FormatEpochTimeInMillisAsRFC3339(test_suite.start_timestamp()), - kIndent); - OutputJsonKey(stream, kTestsuite, "time", - FormatTimeInMillisAsDuration(test_suite.elapsed_time()), - kIndent, false); - *stream << TestPropertiesAsJson(test_suite.ad_hoc_test_result(), kIndent) - << ",\n"; - } - - *stream << kIndent << "\"" << kTestsuite << "\": [\n"; - - bool comma = false; - for (int i = 0; i < test_suite.total_test_count(); ++i) { - if (test_suite.GetTestInfo(i)->is_reportable()) { - if (comma) { - *stream << ",\n"; - } else { - comma = true; - } - OutputJsonTestInfo(stream, test_suite.name(), *test_suite.GetTestInfo(i)); - } - } - *stream << "\n" << kIndent << "]\n" << Indent(4) << "}"; -} - -// Prints a JSON summary of unit_test to output stream out. -void JsonUnitTestResultPrinter::PrintJsonUnitTest(std::ostream* stream, - const UnitTest& unit_test) { - const std::string kTestsuites = "testsuites"; - const std::string kIndent = Indent(2); - *stream << "{\n"; - - OutputJsonKey(stream, kTestsuites, "tests", unit_test.reportable_test_count(), - kIndent); - OutputJsonKey(stream, kTestsuites, "failures", unit_test.failed_test_count(), - kIndent); - OutputJsonKey(stream, kTestsuites, "disabled", - unit_test.reportable_disabled_test_count(), kIndent); - OutputJsonKey(stream, kTestsuites, "errors", 0, kIndent); - if (GTEST_FLAG(shuffle)) { - OutputJsonKey(stream, kTestsuites, "random_seed", unit_test.random_seed(), - kIndent); - } - OutputJsonKey(stream, kTestsuites, "timestamp", - FormatEpochTimeInMillisAsRFC3339(unit_test.start_timestamp()), - kIndent); - OutputJsonKey(stream, kTestsuites, "time", - FormatTimeInMillisAsDuration(unit_test.elapsed_time()), kIndent, - false); - - *stream << TestPropertiesAsJson(unit_test.ad_hoc_test_result(), kIndent) - << ",\n"; - - OutputJsonKey(stream, kTestsuites, "name", "AllTests", kIndent); - *stream << kIndent << "\"" << kTestsuites << "\": [\n"; - - bool comma = false; - for (int i = 0; i < unit_test.total_test_suite_count(); ++i) { - if (unit_test.GetTestSuite(i)->reportable_test_count() > 0) { - if (comma) { - *stream << ",\n"; - } else { - comma = true; - } - PrintJsonTestSuite(stream, *unit_test.GetTestSuite(i)); - } - } - - *stream << "\n" << kIndent << "]\n" << "}\n"; -} - -void JsonUnitTestResultPrinter::PrintJsonTestList( - std::ostream* stream, const std::vector<TestSuite*>& test_suites) { - const std::string kTestsuites = "testsuites"; - const std::string kIndent = Indent(2); - *stream << "{\n"; - int total_tests = 0; - for (auto test_suite : test_suites) { - total_tests += test_suite->total_test_count(); - } - OutputJsonKey(stream, kTestsuites, "tests", total_tests, kIndent); - - OutputJsonKey(stream, kTestsuites, "name", "AllTests", kIndent); - *stream << kIndent << "\"" << kTestsuites << "\": [\n"; - - for (size_t i = 0; i < test_suites.size(); ++i) { - if (i != 0) { - *stream << ",\n"; - } - PrintJsonTestSuite(stream, *test_suites[i]); - } - - *stream << "\n" - << kIndent << "]\n" - << "}\n"; -} -// Produces a string representing the test properties in a result as -// a JSON dictionary. -std::string JsonUnitTestResultPrinter::TestPropertiesAsJson( - const TestResult& result, const std::string& indent) { - Message attributes; - for (int i = 0; i < result.test_property_count(); ++i) { - const TestProperty& property = result.GetTestProperty(i); - attributes << ",\n" << indent << "\"" << property.key() << "\": " - << "\"" << EscapeJson(property.value()) << "\""; - } - return attributes.GetString(); -} - -// End JsonUnitTestResultPrinter - -#if GTEST_CAN_STREAM_RESULTS_ - -// Checks if str contains '=', '&', '%' or '\n' characters. If yes, -// replaces them by "%xx" where xx is their hexadecimal value. For -// example, replaces "=" with "%3D". This algorithm is O(strlen(str)) -// in both time and space -- important as the input str may contain an -// arbitrarily long test failure message and stack trace. -std::string StreamingListener::UrlEncode(const char* str) { - std::string result; - result.reserve(strlen(str) + 1); - for (char ch = *str; ch != '\0'; ch = *++str) { - switch (ch) { - case '%': - case '=': - case '&': - case '\n': - result.append("%" + String::FormatByte(static_cast<unsigned char>(ch))); - break; - default: - result.push_back(ch); - break; - } - } - return result; -} - -void StreamingListener::SocketWriter::MakeConnection() { - GTEST_CHECK_(sockfd_ == -1) - << "MakeConnection() can't be called when there is already a connection."; - - addrinfo hints; - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; // To allow both IPv4 and IPv6 addresses. - hints.ai_socktype = SOCK_STREAM; - addrinfo* servinfo = nullptr; - - // Use the getaddrinfo() to get a linked list of IP addresses for - // the given host name. - const int error_num = getaddrinfo( - host_name_.c_str(), port_num_.c_str(), &hints, &servinfo); - if (error_num != 0) { - GTEST_LOG_(WARNING) << "stream_result_to: getaddrinfo() failed: " - << gai_strerror(error_num); - } - - // Loop through all the results and connect to the first we can. - for (addrinfo* cur_addr = servinfo; sockfd_ == -1 && cur_addr != nullptr; - cur_addr = cur_addr->ai_next) { - sockfd_ = socket( - cur_addr->ai_family, cur_addr->ai_socktype, cur_addr->ai_protocol); - if (sockfd_ != -1) { - // Connect the client socket to the server socket. - if (connect(sockfd_, cur_addr->ai_addr, cur_addr->ai_addrlen) == -1) { - close(sockfd_); - sockfd_ = -1; - } - } - } - - freeaddrinfo(servinfo); // all done with this structure - - if (sockfd_ == -1) { - GTEST_LOG_(WARNING) << "stream_result_to: failed to connect to " - << host_name_ << ":" << port_num_; - } -} - -// End of class Streaming Listener -#endif // GTEST_CAN_STREAM_RESULTS__ - -// class OsStackTraceGetter - -const char* const OsStackTraceGetterInterface::kElidedFramesMarker = - "... " GTEST_NAME_ " internal frames ..."; - -std::string OsStackTraceGetter::CurrentStackTrace(int max_depth, int skip_count) - GTEST_LOCK_EXCLUDED_(mutex_) { -#if GTEST_HAS_ABSL - std::string result; - - if (max_depth <= 0) { - return result; - } - - max_depth = std::min(max_depth, kMaxStackTraceDepth); - - std::vector<void*> raw_stack(max_depth); - // Skips the frames requested by the caller, plus this function. - const int raw_stack_size = - absl::GetStackTrace(&raw_stack[0], max_depth, skip_count + 1); - - void* caller_frame = nullptr; - { - MutexLock lock(&mutex_); - caller_frame = caller_frame_; - } - - for (int i = 0; i < raw_stack_size; ++i) { - if (raw_stack[i] == caller_frame && - !GTEST_FLAG(show_internal_stack_frames)) { - // Add a marker to the trace and stop adding frames. - absl::StrAppend(&result, kElidedFramesMarker, "\n"); - break; - } - - char tmp[1024]; - const char* symbol = "(unknown)"; - if (absl::Symbolize(raw_stack[i], tmp, sizeof(tmp))) { - symbol = tmp; - } - - char line[1024]; - snprintf(line, sizeof(line), " %p: %s\n", raw_stack[i], symbol); - result += line; - } - - return result; - -#else // !GTEST_HAS_ABSL - static_cast<void>(max_depth); - static_cast<void>(skip_count); - return ""; -#endif // GTEST_HAS_ABSL -} - -void OsStackTraceGetter::UponLeavingGTest() GTEST_LOCK_EXCLUDED_(mutex_) { -#if GTEST_HAS_ABSL - void* caller_frame = nullptr; - if (absl::GetStackTrace(&caller_frame, 1, 3) <= 0) { - caller_frame = nullptr; - } - - MutexLock lock(&mutex_); - caller_frame_ = caller_frame; -#endif // GTEST_HAS_ABSL -} - -// A helper class that creates the premature-exit file in its -// constructor and deletes the file in its destructor. -class ScopedPrematureExitFile { - public: - explicit ScopedPrematureExitFile(const char* premature_exit_filepath) - : premature_exit_filepath_(premature_exit_filepath ? - premature_exit_filepath : "") { - // If a path to the premature-exit file is specified... - if (!premature_exit_filepath_.empty()) { - // create the file with a single "0" character in it. I/O - // errors are ignored as there's nothing better we can do and we - // don't want to fail the test because of this. - FILE* pfile = posix::FOpen(premature_exit_filepath, "w"); - fwrite("0", 1, 1, pfile); - fclose(pfile); - } - } - - ~ScopedPrematureExitFile() { - if (!premature_exit_filepath_.empty()) { - int retval = remove(premature_exit_filepath_.c_str()); - if (retval) { - GTEST_LOG_(ERROR) << "Failed to remove premature exit filepath \"" - << premature_exit_filepath_ << "\" with error " - << retval; - } - } - } - - private: - const std::string premature_exit_filepath_; - - GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedPrematureExitFile); -}; - -} // namespace internal - -// class TestEventListeners - -TestEventListeners::TestEventListeners() - : repeater_(new internal::TestEventRepeater()), - default_result_printer_(nullptr), - default_xml_generator_(nullptr) {} - -TestEventListeners::~TestEventListeners() { delete repeater_; } - -// Returns the standard listener responsible for the default console -// output. Can be removed from the listeners list to shut down default -// console output. Note that removing this object from the listener list -// with Release transfers its ownership to the user. -void TestEventListeners::Append(TestEventListener* listener) { - repeater_->Append(listener); -} - -// Removes the given event listener from the list and returns it. It then -// becomes the caller's responsibility to delete the listener. Returns -// NULL if the listener is not found in the list. -TestEventListener* TestEventListeners::Release(TestEventListener* listener) { - if (listener == default_result_printer_) - default_result_printer_ = nullptr; - else if (listener == default_xml_generator_) - default_xml_generator_ = nullptr; - return repeater_->Release(listener); -} - -// Returns repeater that broadcasts the TestEventListener events to all -// subscribers. -TestEventListener* TestEventListeners::repeater() { return repeater_; } - -// Sets the default_result_printer attribute to the provided listener. -// The listener is also added to the listener list and previous -// default_result_printer is removed from it and deleted. The listener can -// also be NULL in which case it will not be added to the list. Does -// nothing if the previous and the current listener objects are the same. -void TestEventListeners::SetDefaultResultPrinter(TestEventListener* listener) { - if (default_result_printer_ != listener) { - // It is an error to pass this method a listener that is already in the - // list. - delete Release(default_result_printer_); - default_result_printer_ = listener; - if (listener != nullptr) Append(listener); - } -} - -// Sets the default_xml_generator attribute to the provided listener. The -// listener is also added to the listener list and previous -// default_xml_generator is removed from it and deleted. The listener can -// also be NULL in which case it will not be added to the list. Does -// nothing if the previous and the current listener objects are the same. -void TestEventListeners::SetDefaultXmlGenerator(TestEventListener* listener) { - if (default_xml_generator_ != listener) { - // It is an error to pass this method a listener that is already in the - // list. - delete Release(default_xml_generator_); - default_xml_generator_ = listener; - if (listener != nullptr) Append(listener); - } -} - -// Controls whether events will be forwarded by the repeater to the -// listeners in the list. -bool TestEventListeners::EventForwardingEnabled() const { - return repeater_->forwarding_enabled(); -} - -void TestEventListeners::SuppressEventForwarding() { - repeater_->set_forwarding_enabled(false); -} - -// class UnitTest - -// Gets the singleton UnitTest object. The first time this method is -// called, a UnitTest object is constructed and returned. Consecutive -// calls will return the same object. -// -// We don't protect this under mutex_ as a user is not supposed to -// call this before main() starts, from which point on the return -// value will never change. -UnitTest* UnitTest::GetInstance() { - // CodeGear C++Builder insists on a public destructor for the - // default implementation. Use this implementation to keep good OO - // design with private destructor. - -#if defined(__BORLANDC__) - static UnitTest* const instance = new UnitTest; - return instance; -#else - static UnitTest instance; - return &instance; -#endif // defined(__BORLANDC__) -} - -// Gets the number of successful test suites. -int UnitTest::successful_test_suite_count() const { - return impl()->successful_test_suite_count(); -} - -// Gets the number of failed test suites. -int UnitTest::failed_test_suite_count() const { - return impl()->failed_test_suite_count(); -} - -// Gets the number of all test suites. -int UnitTest::total_test_suite_count() const { - return impl()->total_test_suite_count(); -} - -// Gets the number of all test suites that contain at least one test -// that should run. -int UnitTest::test_suite_to_run_count() const { - return impl()->test_suite_to_run_count(); -} - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -int UnitTest::successful_test_case_count() const { - return impl()->successful_test_suite_count(); -} -int UnitTest::failed_test_case_count() const { - return impl()->failed_test_suite_count(); -} -int UnitTest::total_test_case_count() const { - return impl()->total_test_suite_count(); -} -int UnitTest::test_case_to_run_count() const { - return impl()->test_suite_to_run_count(); -} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -// Gets the number of successful tests. -int UnitTest::successful_test_count() const { - return impl()->successful_test_count(); -} - -// Gets the number of skipped tests. -int UnitTest::skipped_test_count() const { - return impl()->skipped_test_count(); -} - -// Gets the number of failed tests. -int UnitTest::failed_test_count() const { return impl()->failed_test_count(); } - -// Gets the number of disabled tests that will be reported in the XML report. -int UnitTest::reportable_disabled_test_count() const { - return impl()->reportable_disabled_test_count(); -} - -// Gets the number of disabled tests. -int UnitTest::disabled_test_count() const { - return impl()->disabled_test_count(); -} - -// Gets the number of tests to be printed in the XML report. -int UnitTest::reportable_test_count() const { - return impl()->reportable_test_count(); -} - -// Gets the number of all tests. -int UnitTest::total_test_count() const { return impl()->total_test_count(); } - -// Gets the number of tests that should run. -int UnitTest::test_to_run_count() const { return impl()->test_to_run_count(); } - -// Gets the time of the test program start, in ms from the start of the -// UNIX epoch. -internal::TimeInMillis UnitTest::start_timestamp() const { - return impl()->start_timestamp(); -} - -// Gets the elapsed time, in milliseconds. -internal::TimeInMillis UnitTest::elapsed_time() const { - return impl()->elapsed_time(); -} - -// Returns true if and only if the unit test passed (i.e. all test suites -// passed). -bool UnitTest::Passed() const { return impl()->Passed(); } - -// Returns true if and only if the unit test failed (i.e. some test suite -// failed or something outside of all tests failed). -bool UnitTest::Failed() const { return impl()->Failed(); } - -// Gets the i-th test suite among all the test suites. i can range from 0 to -// total_test_suite_count() - 1. If i is not in that range, returns NULL. -const TestSuite* UnitTest::GetTestSuite(int i) const { - return impl()->GetTestSuite(i); -} - -// Legacy API is deprecated but still available -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -const TestCase* UnitTest::GetTestCase(int i) const { - return impl()->GetTestCase(i); -} -#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_ - -// Returns the TestResult containing information on test failures and -// properties logged outside of individual test suites. -const TestResult& UnitTest::ad_hoc_test_result() const { - return *impl()->ad_hoc_test_result(); -} - -// Gets the i-th test suite among all the test suites. i can range from 0 to -// total_test_suite_count() - 1. If i is not in that range, returns NULL. -TestSuite* UnitTest::GetMutableTestSuite(int i) { - return impl()->GetMutableSuiteCase(i); -} - -// Returns the list of event listeners that can be used to track events -// inside Google Test. -TestEventListeners& UnitTest::listeners() { - return *impl()->listeners(); -} - -// Registers and returns a global test environment. When a test -// program is run, all global test environments will be set-up in the -// order they were registered. After all tests in the program have -// finished, all global test environments will be torn-down in the -// *reverse* order they were registered. -// -// The UnitTest object takes ownership of the given environment. -// -// We don't protect this under mutex_, as we only support calling it -// from the main thread. -Environment* UnitTest::AddEnvironment(Environment* env) { - if (env == nullptr) { - return nullptr; - } - - impl_->environments().push_back(env); - return env; -} - -// Adds a TestPartResult to the current TestResult object. All Google Test -// assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) eventually call -// this to report their results. The user code should use the -// assertion macros instead of calling this directly. -void UnitTest::AddTestPartResult( - TestPartResult::Type result_type, - const char* file_name, - int line_number, - const std::string& message, - const std::string& os_stack_trace) GTEST_LOCK_EXCLUDED_(mutex_) { - Message msg; - msg << message; - - internal::MutexLock lock(&mutex_); - if (impl_->gtest_trace_stack().size() > 0) { - msg << "\n" << GTEST_NAME_ << " trace:"; - - for (size_t i = impl_->gtest_trace_stack().size(); i > 0; --i) { - const internal::TraceInfo& trace = impl_->gtest_trace_stack()[i - 1]; - msg << "\n" << internal::FormatFileLocation(trace.file, trace.line) - << " " << trace.message; - } - } - - if (os_stack_trace.c_str() != nullptr && !os_stack_trace.empty()) { - msg << internal::kStackTraceMarker << os_stack_trace; - } - - const TestPartResult result = TestPartResult( - result_type, file_name, line_number, msg.GetString().c_str()); - impl_->GetTestPartResultReporterForCurrentThread()-> - ReportTestPartResult(result); - - if (result_type != TestPartResult::kSuccess && - result_type != TestPartResult::kSkip) { - // gtest_break_on_failure takes precedence over - // gtest_throw_on_failure. This allows a user to set the latter - // in the code (perhaps in order to use Google Test assertions - // with another testing framework) and specify the former on the - // command line for debugging. - if (GTEST_FLAG(break_on_failure)) { -#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT - // Using DebugBreak on Windows allows gtest to still break into a debugger - // when a failure happens and both the --gtest_break_on_failure and - // the --gtest_catch_exceptions flags are specified. - DebugBreak(); -#elif (!defined(__native_client__)) && \ - ((defined(__clang__) || defined(__GNUC__)) && \ - (defined(__x86_64__) || defined(__i386__))) - // with clang/gcc we can achieve the same effect on x86 by invoking int3 - asm("int3"); -#else - // Dereference nullptr through a volatile pointer to prevent the compiler - // from removing. We use this rather than abort() or __builtin_trap() for - // portability: some debuggers don't correctly trap abort(). - *static_cast<volatile int*>(nullptr) = 1; -#endif // GTEST_OS_WINDOWS - } else if (GTEST_FLAG(throw_on_failure)) { -#if GTEST_HAS_EXCEPTIONS - throw internal::GoogleTestFailureException(result); -#else - // We cannot call abort() as it generates a pop-up in debug mode - // that cannot be suppressed in VC 7.1 or below. - exit(1); -#endif - } - } -} - -// Adds a TestProperty to the current TestResult object when invoked from -// inside a test, to current TestSuite's ad_hoc_test_result_ when invoked -// from SetUpTestSuite or TearDownTestSuite, or to the global property set -// when invoked elsewhere. If the result already contains a property with -// the same key, the value will be updated. -void UnitTest::RecordProperty(const std::string& key, - const std::string& value) { - impl_->RecordProperty(TestProperty(key, value)); -} - -// Runs all tests in this UnitTest object and prints the result. -// Returns 0 if successful, or 1 otherwise. -// -// We don't protect this under mutex_, as we only support calling it -// from the main thread. -int UnitTest::Run() { - const bool in_death_test_child_process = - internal::GTEST_FLAG(internal_run_death_test).length() > 0; - - // Google Test implements this protocol for catching that a test - // program exits before returning control to Google Test: - // - // 1. Upon start, Google Test creates a file whose absolute path - // is specified by the environment variable - // TEST_PREMATURE_EXIT_FILE. - // 2. When Google Test has finished its work, it deletes the file. - // - // This allows a test runner to set TEST_PREMATURE_EXIT_FILE before - // running a Google-Test-based test program and check the existence - // of the file at the end of the test execution to see if it has - // exited prematurely. - - // If we are in the child process of a death test, don't - // create/delete the premature exit file, as doing so is unnecessary - // and will confuse the parent process. Otherwise, create/delete - // the file upon entering/leaving this function. If the program - // somehow exits before this function has a chance to return, the - // premature-exit file will be left undeleted, causing a test runner - // that understands the premature-exit-file protocol to report the - // test as having failed. - const internal::ScopedPrematureExitFile premature_exit_file( - in_death_test_child_process - ? nullptr - : internal::posix::GetEnv("TEST_PREMATURE_EXIT_FILE")); - - // Captures the value of GTEST_FLAG(catch_exceptions). This value will be - // used for the duration of the program. - impl()->set_catch_exceptions(GTEST_FLAG(catch_exceptions)); - -#if GTEST_OS_WINDOWS - // Either the user wants Google Test to catch exceptions thrown by the - // tests or this is executing in the context of death test child - // process. In either case the user does not want to see pop-up dialogs - // about crashes - they are expected. - if (impl()->catch_exceptions() || in_death_test_child_process) { -# if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT - // SetErrorMode doesn't exist on CE. - SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT | - SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); -# endif // !GTEST_OS_WINDOWS_MOBILE - -# if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE - // Death test children can be terminated with _abort(). On Windows, - // _abort() can show a dialog with a warning message. This forces the - // abort message to go to stderr instead. - _set_error_mode(_OUT_TO_STDERR); -# endif - -# if defined(_MSC_VER) && !GTEST_OS_WINDOWS_MOBILE - // In the debug version, Visual Studio pops up a separate dialog - // offering a choice to debug the aborted program. We need to suppress - // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement - // executed. Google Test will notify the user of any unexpected - // failure via stderr. - if (!GTEST_FLAG(break_on_failure)) - _set_abort_behavior( - 0x0, // Clear the following flags: - _WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump. -# endif - - // In debug mode, the Windows CRT can crash with an assertion over invalid - // input (e.g. passing an invalid file descriptor). The default handling - // for these assertions is to pop up a dialog and wait for user input. - // Instead ask the CRT to dump such assertions to stderr non-interactively. - if (!IsDebuggerPresent()) { - (void)_CrtSetReportMode(_CRT_ASSERT, - _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); - (void)_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); - } - } -#endif // GTEST_OS_WINDOWS - - return internal::HandleExceptionsInMethodIfSupported( - impl(), - &internal::UnitTestImpl::RunAllTests, - "auxiliary test code (environments or event listeners)") ? 0 : 1; -} - -// Returns the working directory when the first TEST() or TEST_F() was -// executed. -const char* UnitTest::original_working_dir() const { - return impl_->original_working_dir_.c_str(); -} - -// Returns the TestSuite object for the test that's currently running, -// or NULL if no test is running. -const TestSuite* UnitTest::current_test_suite() const - GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); - return impl_->current_test_suite(); -} - -// Legacy API is still available but deprecated -#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ -const TestCase* UnitTest::current_test_case() const - GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); - return impl_->current_test_suite(); -} -#endif - -// Returns the TestInfo object for the test that's currently running, -// or NULL if no test is running. -const TestInfo* UnitTest::current_test_info() const - GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); - return impl_->current_test_info(); -} - -// Returns the random seed used at the start of the current test run. -int UnitTest::random_seed() const { return impl_->random_seed(); } - -// Returns ParameterizedTestSuiteRegistry object used to keep track of -// value-parameterized tests and instantiate and register them. -internal::ParameterizedTestSuiteRegistry& -UnitTest::parameterized_test_registry() GTEST_LOCK_EXCLUDED_(mutex_) { - return impl_->parameterized_test_registry(); -} - -// Creates an empty UnitTest. -UnitTest::UnitTest() { - impl_ = new internal::UnitTestImpl(this); -} - -// Destructor of UnitTest. -UnitTest::~UnitTest() { - delete impl_; -} - -// Pushes a trace defined by SCOPED_TRACE() on to the per-thread -// Google Test trace stack. -void UnitTest::PushGTestTrace(const internal::TraceInfo& trace) - GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); - impl_->gtest_trace_stack().push_back(trace); -} - -// Pops a trace from the per-thread Google Test trace stack. -void UnitTest::PopGTestTrace() - GTEST_LOCK_EXCLUDED_(mutex_) { - internal::MutexLock lock(&mutex_); - impl_->gtest_trace_stack().pop_back(); -} - -namespace internal { - -UnitTestImpl::UnitTestImpl(UnitTest* parent) - : parent_(parent), - GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355 /* using this in initializer */) - default_global_test_part_result_reporter_(this), - default_per_thread_test_part_result_reporter_(this), - GTEST_DISABLE_MSC_WARNINGS_POP_() global_test_part_result_repoter_( - &default_global_test_part_result_reporter_), - per_thread_test_part_result_reporter_( - &default_per_thread_test_part_result_reporter_), - parameterized_test_registry_(), - parameterized_tests_registered_(false), - last_death_test_suite_(-1), - current_test_suite_(nullptr), - current_test_info_(nullptr), - ad_hoc_test_result_(), - os_stack_trace_getter_(nullptr), - post_flag_parse_init_performed_(false), - random_seed_(0), // Will be overridden by the flag before first use. - random_(0), // Will be reseeded before first use. - start_timestamp_(0), - elapsed_time_(0), -#if GTEST_HAS_DEATH_TEST - death_test_factory_(new DefaultDeathTestFactory), -#endif - // Will be overridden by the flag before first use. - catch_exceptions_(false) { - listeners()->SetDefaultResultPrinter(new PrettyUnitTestResultPrinter); -} - -UnitTestImpl::~UnitTestImpl() { - // Deletes every TestSuite. - ForEach(test_suites_, internal::Delete<TestSuite>); - - // Deletes every Environment. - ForEach(environments_, internal::Delete<Environment>); - - delete os_stack_trace_getter_; -} - -// Adds a TestProperty to the current TestResult object when invoked in a -// context of a test, to current test suite's ad_hoc_test_result when invoke -// from SetUpTestSuite/TearDownTestSuite, or to the global property set -// otherwise. If the result already contains a property with the same key, -// the value will be updated. -void UnitTestImpl::RecordProperty(const TestProperty& test_property) { - std::string xml_element; - TestResult* test_result; // TestResult appropriate for property recording. - - if (current_test_info_ != nullptr) { - xml_element = "testcase"; - test_result = &(current_test_info_->result_); - } else if (current_test_suite_ != nullptr) { - xml_element = "testsuite"; - test_result = &(current_test_suite_->ad_hoc_test_result_); - } else { - xml_element = "testsuites"; - test_result = &ad_hoc_test_result_; - } - test_result->RecordProperty(xml_element, test_property); -} - -#if GTEST_HAS_DEATH_TEST -// Disables event forwarding if the control is currently in a death test -// subprocess. Must not be called before InitGoogleTest. -void UnitTestImpl::SuppressTestEventsIfInSubprocess() { - if (internal_run_death_test_flag_.get() != nullptr) - listeners()->SuppressEventForwarding(); -} -#endif // GTEST_HAS_DEATH_TEST - -// Initializes event listeners performing XML output as specified by -// UnitTestOptions. Must not be called before InitGoogleTest. -void UnitTestImpl::ConfigureXmlOutput() { - const std::string& output_format = UnitTestOptions::GetOutputFormat(); - if (output_format == "xml") { - listeners()->SetDefaultXmlGenerator(new XmlUnitTestResultPrinter( - UnitTestOptions::GetAbsolutePathToOutputFile().c_str())); - } else if (output_format == "json") { - listeners()->SetDefaultXmlGenerator(new JsonUnitTestResultPrinter( - UnitTestOptions::GetAbsolutePathToOutputFile().c_str())); - } else if (output_format != "") { - GTEST_LOG_(WARNING) << "WARNING: unrecognized output format \"" - << output_format << "\" ignored."; - } -} - -#if GTEST_CAN_STREAM_RESULTS_ -// Initializes event listeners for streaming test results in string form. -// Must not be called before InitGoogleTest. -void UnitTestImpl::ConfigureStreamingOutput() { - const std::string& target = GTEST_FLAG(stream_result_to); - if (!target.empty()) { - const size_t pos = target.find(':'); - if (pos != std::string::npos) { - listeners()->Append(new StreamingListener(target.substr(0, pos), - target.substr(pos+1))); - } else { - GTEST_LOG_(WARNING) << "unrecognized streaming target \"" << target - << "\" ignored."; - } - } -} -#endif // GTEST_CAN_STREAM_RESULTS_ - -// Performs initialization dependent upon flag values obtained in -// ParseGoogleTestFlagsOnly. Is called from InitGoogleTest after the call to -// ParseGoogleTestFlagsOnly. In case a user neglects to call InitGoogleTest -// this function is also called from RunAllTests. Since this function can be -// called more than once, it has to be idempotent. -void UnitTestImpl::PostFlagParsingInit() { - // Ensures that this function does not execute more than once. - if (!post_flag_parse_init_performed_) { - post_flag_parse_init_performed_ = true; - -#if defined(GTEST_CUSTOM_TEST_EVENT_LISTENER_) - // Register to send notifications about key process state changes. - listeners()->Append(new GTEST_CUSTOM_TEST_EVENT_LISTENER_()); -#endif // defined(GTEST_CUSTOM_TEST_EVENT_LISTENER_) - -#if GTEST_HAS_DEATH_TEST - InitDeathTestSubprocessControlInfo(); - SuppressTestEventsIfInSubprocess(); -#endif // GTEST_HAS_DEATH_TEST - - // Registers parameterized tests. This makes parameterized tests - // available to the UnitTest reflection API without running - // RUN_ALL_TESTS. - RegisterParameterizedTests(); - - // Configures listeners for XML output. This makes it possible for users - // to shut down the default XML output before invoking RUN_ALL_TESTS. - ConfigureXmlOutput(); - -#if GTEST_CAN_STREAM_RESULTS_ - // Configures listeners for streaming test results to the specified server. - ConfigureStreamingOutput(); -#endif // GTEST_CAN_STREAM_RESULTS_ - -#if GTEST_HAS_ABSL - if (GTEST_FLAG(install_failure_signal_handler)) { - absl::FailureSignalHandlerOptions options; - absl::InstallFailureSignalHandler(options); - } -#endif // GTEST_HAS_ABSL - } -} - -// A predicate that checks the name of a TestSuite against a known -// value. -// -// This is used for implementation of the UnitTest class only. We put -// it in the anonymous namespace to prevent polluting the outer -// namespace. -// -// TestSuiteNameIs is copyable. -class TestSuiteNameIs { - public: - // Constructor. - explicit TestSuiteNameIs(const std::string& name) : name_(name) {} - - // Returns true if and only if the name of test_suite matches name_. - bool operator()(const TestSuite* test_suite) const { - return test_suite != nullptr && - strcmp(test_suite->name(), name_.c_str()) == 0; - } - - private: - std::string name_; -}; - -// Finds and returns a TestSuite with the given name. If one doesn't -// exist, creates one and returns it. It's the CALLER'S -// RESPONSIBILITY to ensure that this function is only called WHEN THE -// TESTS ARE NOT SHUFFLED. -// -// Arguments: -// -// test_suite_name: name of the test suite -// type_param: the name of the test suite's type parameter, or NULL if -// this is not a typed or a type-parameterized test suite. -// set_up_tc: pointer to the function that sets up the test suite -// tear_down_tc: pointer to the function that tears down the test suite -TestSuite* UnitTestImpl::GetTestSuite( - const char* test_suite_name, const char* type_param, - internal::SetUpTestSuiteFunc set_up_tc, - internal::TearDownTestSuiteFunc tear_down_tc) { - // Can we find a TestSuite with the given name? - const auto test_suite = - std::find_if(test_suites_.rbegin(), test_suites_.rend(), - TestSuiteNameIs(test_suite_name)); - - if (test_suite != test_suites_.rend()) return *test_suite; - - // No. Let's create one. - auto* const new_test_suite = - new TestSuite(test_suite_name, type_param, set_up_tc, tear_down_tc); - - // Is this a death test suite? - if (internal::UnitTestOptions::MatchesFilter(test_suite_name, - kDeathTestSuiteFilter)) { - // Yes. Inserts the test suite after the last death test suite - // defined so far. This only works when the test suites haven't - // been shuffled. Otherwise we may end up running a death test - // after a non-death test. - ++last_death_test_suite_; - test_suites_.insert(test_suites_.begin() + last_death_test_suite_, - new_test_suite); - } else { - // No. Appends to the end of the list. - test_suites_.push_back(new_test_suite); - } - - test_suite_indices_.push_back(static_cast<int>(test_suite_indices_.size())); - return new_test_suite; -} - -// Helpers for setting up / tearing down the given environment. They -// are for use in the ForEach() function. -static void SetUpEnvironment(Environment* env) { env->SetUp(); } -static void TearDownEnvironment(Environment* env) { env->TearDown(); } - -// Runs all tests in this UnitTest object, prints the result, and -// returns true if all tests are successful. If any exception is -// thrown during a test, the test is considered to be failed, but the -// rest of the tests will still be run. -// -// When parameterized tests are enabled, it expands and registers -// parameterized tests first in RegisterParameterizedTests(). -// All other functions called from RunAllTests() may safely assume that -// parameterized tests are ready to be counted and run. -bool UnitTestImpl::RunAllTests() { - // True if and only if Google Test is initialized before RUN_ALL_TESTS() is - // called. - const bool gtest_is_initialized_before_run_all_tests = GTestIsInitialized(); - - // Do not run any test if the --help flag was specified. - if (g_help_flag) - return true; - - // Repeats the call to the post-flag parsing initialization in case the - // user didn't call InitGoogleTest. - PostFlagParsingInit(); - - // Even if sharding is not on, test runners may want to use the - // GTEST_SHARD_STATUS_FILE to query whether the test supports the sharding - // protocol. - internal::WriteToShardStatusFileIfNeeded(); - - // True if and only if we are in a subprocess for running a thread-safe-style - // death test. - bool in_subprocess_for_death_test = false; - -#if GTEST_HAS_DEATH_TEST - in_subprocess_for_death_test = - (internal_run_death_test_flag_.get() != nullptr); -# if defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_) - if (in_subprocess_for_death_test) { - GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_(); - } -# endif // defined(GTEST_EXTRA_DEATH_TEST_CHILD_SETUP_) -#endif // GTEST_HAS_DEATH_TEST - - const bool should_shard = ShouldShard(kTestTotalShards, kTestShardIndex, - in_subprocess_for_death_test); - - // Compares the full test names with the filter to decide which - // tests to run. - const bool has_tests_to_run = FilterTests(should_shard - ? HONOR_SHARDING_PROTOCOL - : IGNORE_SHARDING_PROTOCOL) > 0; - - // Lists the tests and exits if the --gtest_list_tests flag was specified. - if (GTEST_FLAG(list_tests)) { - // This must be called *after* FilterTests() has been called. - ListTestsMatchingFilter(); - return true; - } - - random_seed_ = GTEST_FLAG(shuffle) ? - GetRandomSeedFromFlag(GTEST_FLAG(random_seed)) : 0; - - // True if and only if at least one test has failed. - bool failed = false; - - TestEventListener* repeater = listeners()->repeater(); - - start_timestamp_ = GetTimeInMillis(); - repeater->OnTestProgramStart(*parent_); - - // How many times to repeat the tests? We don't want to repeat them - // when we are inside the subprocess of a death test. - const int repeat = in_subprocess_for_death_test ? 1 : GTEST_FLAG(repeat); - // Repeats forever if the repeat count is negative. - const bool gtest_repeat_forever = repeat < 0; - for (int i = 0; gtest_repeat_forever || i != repeat; i++) { - // We want to preserve failures generated by ad-hoc test - // assertions executed before RUN_ALL_TESTS(). - ClearNonAdHocTestResult(); - - const TimeInMillis start = GetTimeInMillis(); - - // Shuffles test suites and tests if requested. - if (has_tests_to_run && GTEST_FLAG(shuffle)) { - random()->Reseed(static_cast<UInt32>(random_seed_)); - // This should be done before calling OnTestIterationStart(), - // such that a test event listener can see the actual test order - // in the event. - ShuffleTests(); - } - - // Tells the unit test event listeners that the tests are about to start. - repeater->OnTestIterationStart(*parent_, i); - - // Runs each test suite if there is at least one test to run. - if (has_tests_to_run) { - // Sets up all environments beforehand. - repeater->OnEnvironmentsSetUpStart(*parent_); - ForEach(environments_, SetUpEnvironment); - repeater->OnEnvironmentsSetUpEnd(*parent_); - - // Runs the tests only if there was no fatal failure or skip triggered - // during global set-up. - if (Test::IsSkipped()) { - // Emit diagnostics when global set-up calls skip, as it will not be - // emitted by default. - TestResult& test_result = - *internal::GetUnitTestImpl()->current_test_result(); - for (int j = 0; j < test_result.total_part_count(); ++j) { - const TestPartResult& test_part_result = - test_result.GetTestPartResult(j); - if (test_part_result.type() == TestPartResult::kSkip) { - const std::string& result = test_part_result.message(); - printf("%s\n", result.c_str()); - } - } - fflush(stdout); - } else if (!Test::HasFatalFailure()) { - for (int test_index = 0; test_index < total_test_suite_count(); - test_index++) { - GetMutableSuiteCase(test_index)->Run(); - } - } - - // Tears down all environments in reverse order afterwards. - repeater->OnEnvironmentsTearDownStart(*parent_); - std::for_each(environments_.rbegin(), environments_.rend(), - TearDownEnvironment); - repeater->OnEnvironmentsTearDownEnd(*parent_); - } - - elapsed_time_ = GetTimeInMillis() - start; - - // Tells the unit test event listener that the tests have just finished. - repeater->OnTestIterationEnd(*parent_, i); - - // Gets the result and clears it. - if (!Passed()) { - failed = true; - } - - // Restores the original test order after the iteration. This - // allows the user to quickly repro a failure that happens in the - // N-th iteration without repeating the first (N - 1) iterations. - // This is not enclosed in "if (GTEST_FLAG(shuffle)) { ... }", in - // case the user somehow changes the value of the flag somewhere - // (it's always safe to unshuffle the tests). - UnshuffleTests(); - - if (GTEST_FLAG(shuffle)) { - // Picks a new random seed for each iteration. - random_seed_ = GetNextRandomSeed(random_seed_); - } - } - - repeater->OnTestProgramEnd(*parent_); - - if (!gtest_is_initialized_before_run_all_tests) { - ColoredPrintf( - COLOR_RED, - "\nIMPORTANT NOTICE - DO NOT IGNORE:\n" - "This test program did NOT call " GTEST_INIT_GOOGLE_TEST_NAME_ - "() before calling RUN_ALL_TESTS(). This is INVALID. Soon " GTEST_NAME_ - " will start to enforce the valid usage. " - "Please fix it ASAP, or IT WILL START TO FAIL.\n"); // NOLINT -#if GTEST_FOR_GOOGLE_ - ColoredPrintf(COLOR_RED, - "For more details, see http://wiki/Main/ValidGUnitMain.\n"); -#endif // GTEST_FOR_GOOGLE_ - } - - return !failed; -} - -// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file -// if the variable is present. If a file already exists at this location, this -// function will write over it. If the variable is present, but the file cannot -// be created, prints an error and exits. -void WriteToShardStatusFileIfNeeded() { - const char* const test_shard_file = posix::GetEnv(kTestShardStatusFile); - if (test_shard_file != nullptr) { - FILE* const file = posix::FOpen(test_shard_file, "w"); - if (file == nullptr) { - ColoredPrintf(COLOR_RED, - "Could not write to the test shard status file \"%s\" " - "specified by the %s environment variable.\n", - test_shard_file, kTestShardStatusFile); - fflush(stdout); - exit(EXIT_FAILURE); - } - fclose(file); - } -} - -// Checks whether sharding is enabled by examining the relevant -// environment variable values. If the variables are present, -// but inconsistent (i.e., shard_index >= total_shards), prints -// an error and exits. If in_subprocess_for_death_test, sharding is -// disabled because it must only be applied to the original test -// process. Otherwise, we could filter out death tests we intended to execute. -bool ShouldShard(const char* total_shards_env, - const char* shard_index_env, - bool in_subprocess_for_death_test) { - if (in_subprocess_for_death_test) { - return false; - } - - const Int32 total_shards = Int32FromEnvOrDie(total_shards_env, -1); - const Int32 shard_index = Int32FromEnvOrDie(shard_index_env, -1); - - if (total_shards == -1 && shard_index == -1) { - return false; - } else if (total_shards == -1 && shard_index != -1) { - const Message msg = Message() - << "Invalid environment variables: you have " - << kTestShardIndex << " = " << shard_index - << ", but have left " << kTestTotalShards << " unset.\n"; - ColoredPrintf(COLOR_RED, "%s", msg.GetString().c_str()); - fflush(stdout); - exit(EXIT_FAILURE); - } else if (total_shards != -1 && shard_index == -1) { - const Message msg = Message() - << "Invalid environment variables: you have " - << kTestTotalShards << " = " << total_shards - << ", but have left " << kTestShardIndex << " unset.\n"; - ColoredPrintf(COLOR_RED, "%s", msg.GetString().c_str()); - fflush(stdout); - exit(EXIT_FAILURE); - } else if (shard_index < 0 || shard_index >= total_shards) { - const Message msg = Message() - << "Invalid environment variables: we require 0 <= " - << kTestShardIndex << " < " << kTestTotalShards - << ", but you have " << kTestShardIndex << "=" << shard_index - << ", " << kTestTotalShards << "=" << total_shards << ".\n"; - ColoredPrintf(COLOR_RED, "%s", msg.GetString().c_str()); - fflush(stdout); - exit(EXIT_FAILURE); - } - - return total_shards > 1; -} - -// Parses the environment variable var as an Int32. If it is unset, -// returns default_val. If it is not an Int32, prints an error -// and aborts. -Int32 Int32FromEnvOrDie(const char* var, Int32 default_val) { - const char* str_val = posix::GetEnv(var); - if (str_val == nullptr) { - return default_val; - } - - Int32 result; - if (!ParseInt32(Message() << "The value of environment variable " << var, - str_val, &result)) { - exit(EXIT_FAILURE); - } - return result; -} - -// Given the total number of shards, the shard index, and the test id, -// returns true if and only if the test should be run on this shard. The test id -// is some arbitrary but unique non-negative integer assigned to each test -// method. Assumes that 0 <= shard_index < total_shards. -bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) { - return (test_id % total_shards) == shard_index; -} - -// Compares the name of each test with the user-specified filter to -// decide whether the test should be run, then records the result in -// each TestSuite and TestInfo object. -// If shard_tests == true, further filters tests based on sharding -// variables in the environment - see -// https://github.com/google/googletest/blob/master/googletest/docs/advanced.md -// . Returns the number of tests that should run. -int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) { - const Int32 total_shards = shard_tests == HONOR_SHARDING_PROTOCOL ? - Int32FromEnvOrDie(kTestTotalShards, -1) : -1; - const Int32 shard_index = shard_tests == HONOR_SHARDING_PROTOCOL ? - Int32FromEnvOrDie(kTestShardIndex, -1) : -1; - - // num_runnable_tests are the number of tests that will - // run across all shards (i.e., match filter and are not disabled). - // num_selected_tests are the number of tests to be run on - // this shard. - int num_runnable_tests = 0; - int num_selected_tests = 0; - for (auto* test_suite : test_suites_) { - const std::string& test_suite_name = test_suite->name(); - test_suite->set_should_run(false); - - for (size_t j = 0; j < test_suite->test_info_list().size(); j++) { - TestInfo* const test_info = test_suite->test_info_list()[j]; - const std::string test_name(test_info->name()); - // A test is disabled if test suite name or test name matches - // kDisableTestFilter. - const bool is_disabled = internal::UnitTestOptions::MatchesFilter( - test_suite_name, kDisableTestFilter) || - internal::UnitTestOptions::MatchesFilter( - test_name, kDisableTestFilter); - test_info->is_disabled_ = is_disabled; - - const bool matches_filter = internal::UnitTestOptions::FilterMatchesTest( - test_suite_name, test_name); - test_info->matches_filter_ = matches_filter; - - const bool is_runnable = - (GTEST_FLAG(also_run_disabled_tests) || !is_disabled) && - matches_filter; - - const bool is_in_another_shard = - shard_tests != IGNORE_SHARDING_PROTOCOL && - !ShouldRunTestOnShard(total_shards, shard_index, num_runnable_tests); - test_info->is_in_another_shard_ = is_in_another_shard; - const bool is_selected = is_runnable && !is_in_another_shard; - - num_runnable_tests += is_runnable; - num_selected_tests += is_selected; - - test_info->should_run_ = is_selected; - test_suite->set_should_run(test_suite->should_run() || is_selected); - } - } - return num_selected_tests; -} - -// Prints the given C-string on a single line by replacing all '\n' -// characters with string "\\n". If the output takes more than -// max_length characters, only prints the first max_length characters -// and "...". -static void PrintOnOneLine(const char* str, int max_length) { - if (str != nullptr) { - for (int i = 0; *str != '\0'; ++str) { - if (i >= max_length) { - printf("..."); - break; - } - if (*str == '\n') { - printf("\\n"); - i += 2; - } else { - printf("%c", *str); - ++i; - } - } - } -} - -// Prints the names of the tests matching the user-specified filter flag. -void UnitTestImpl::ListTestsMatchingFilter() { - // Print at most this many characters for each type/value parameter. - const int kMaxParamLength = 250; - - for (auto* test_suite : test_suites_) { - bool printed_test_suite_name = false; - - for (size_t j = 0; j < test_suite->test_info_list().size(); j++) { - const TestInfo* const test_info = test_suite->test_info_list()[j]; - if (test_info->matches_filter_) { - if (!printed_test_suite_name) { - printed_test_suite_name = true; - printf("%s.", test_suite->name()); - if (test_suite->type_param() != nullptr) { - printf(" # %s = ", kTypeParamLabel); - // We print the type parameter on a single line to make - // the output easy to parse by a program. - PrintOnOneLine(test_suite->type_param(), kMaxParamLength); - } - printf("\n"); - } - printf(" %s", test_info->name()); - if (test_info->value_param() != nullptr) { - printf(" # %s = ", kValueParamLabel); - // We print the value parameter on a single line to make the - // output easy to parse by a program. - PrintOnOneLine(test_info->value_param(), kMaxParamLength); - } - printf("\n"); - } - } - } - fflush(stdout); - const std::string& output_format = UnitTestOptions::GetOutputFormat(); - if (output_format == "xml" || output_format == "json") { - FILE* fileout = OpenFileForWriting( - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()); - std::stringstream stream; - if (output_format == "xml") { - XmlUnitTestResultPrinter( - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()) - .PrintXmlTestsList(&stream, test_suites_); - } else if (output_format == "json") { - JsonUnitTestResultPrinter( - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()) - .PrintJsonTestList(&stream, test_suites_); - } - fprintf(fileout, "%s", StringStreamToString(&stream).c_str()); - fclose(fileout); - } -} - -// Sets the OS stack trace getter. -// -// Does nothing if the input and the current OS stack trace getter are -// the same; otherwise, deletes the old getter and makes the input the -// current getter. -void UnitTestImpl::set_os_stack_trace_getter( - OsStackTraceGetterInterface* getter) { - if (os_stack_trace_getter_ != getter) { - delete os_stack_trace_getter_; - os_stack_trace_getter_ = getter; - } -} - -// Returns the current OS stack trace getter if it is not NULL; -// otherwise, creates an OsStackTraceGetter, makes it the current -// getter, and returns it. -OsStackTraceGetterInterface* UnitTestImpl::os_stack_trace_getter() { - if (os_stack_trace_getter_ == nullptr) { -#ifdef GTEST_OS_STACK_TRACE_GETTER_ - os_stack_trace_getter_ = new GTEST_OS_STACK_TRACE_GETTER_; -#else - os_stack_trace_getter_ = new OsStackTraceGetter; -#endif // GTEST_OS_STACK_TRACE_GETTER_ - } - - return os_stack_trace_getter_; -} - -// Returns the most specific TestResult currently running. -TestResult* UnitTestImpl::current_test_result() { - if (current_test_info_ != nullptr) { - return ¤t_test_info_->result_; - } - if (current_test_suite_ != nullptr) { - return ¤t_test_suite_->ad_hoc_test_result_; - } - return &ad_hoc_test_result_; -} - -// Shuffles all test suites, and the tests within each test suite, -// making sure that death tests are still run first. -void UnitTestImpl::ShuffleTests() { - // Shuffles the death test suites. - ShuffleRange(random(), 0, last_death_test_suite_ + 1, &test_suite_indices_); - - // Shuffles the non-death test suites. - ShuffleRange(random(), last_death_test_suite_ + 1, - static_cast<int>(test_suites_.size()), &test_suite_indices_); - - // Shuffles the tests inside each test suite. - for (auto& test_suite : test_suites_) { - test_suite->ShuffleTests(random()); - } -} - -// Restores the test suites and tests to their order before the first shuffle. -void UnitTestImpl::UnshuffleTests() { - for (size_t i = 0; i < test_suites_.size(); i++) { - // Unshuffles the tests in each test suite. - test_suites_[i]->UnshuffleTests(); - // Resets the index of each test suite. - test_suite_indices_[i] = static_cast<int>(i); - } -} - -// Returns the current OS stack trace as an std::string. -// -// The maximum number of stack frames to be included is specified by -// the gtest_stack_trace_depth flag. The skip_count parameter -// specifies the number of top frames to be skipped, which doesn't -// count against the number of frames to be included. -// -// For example, if Foo() calls Bar(), which in turn calls -// GetCurrentOsStackTraceExceptTop(..., 1), Foo() will be included in -// the trace but Bar() and GetCurrentOsStackTraceExceptTop() won't. -std::string GetCurrentOsStackTraceExceptTop(UnitTest* /*unit_test*/, - int skip_count) { - // We pass skip_count + 1 to skip this wrapper function in addition - // to what the user really wants to skip. - return GetUnitTestImpl()->CurrentOsStackTraceExceptTop(skip_count + 1); -} - -// Used by the GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_ macro to -// suppress unreachable code warnings. -namespace { -class ClassUniqueToAlwaysTrue {}; -} - -bool IsTrue(bool condition) { return condition; } - -bool AlwaysTrue() { -#if GTEST_HAS_EXCEPTIONS - // This condition is always false so AlwaysTrue() never actually throws, - // but it makes the compiler think that it may throw. - if (IsTrue(false)) - throw ClassUniqueToAlwaysTrue(); -#endif // GTEST_HAS_EXCEPTIONS - return true; -} - -// If *pstr starts with the given prefix, modifies *pstr to be right -// past the prefix and returns true; otherwise leaves *pstr unchanged -// and returns false. None of pstr, *pstr, and prefix can be NULL. -bool SkipPrefix(const char* prefix, const char** pstr) { - const size_t prefix_len = strlen(prefix); - if (strncmp(*pstr, prefix, prefix_len) == 0) { - *pstr += prefix_len; - return true; - } - return false; -} - -// Parses a string as a command line flag. The string should have -// the format "--flag=value". When def_optional is true, the "=value" -// part can be omitted. -// -// Returns the value of the flag, or NULL if the parsing failed. -static const char* ParseFlagValue(const char* str, const char* flag, - bool def_optional) { - // str and flag must not be NULL. - if (str == nullptr || flag == nullptr) return nullptr; - - // The flag must start with "--" followed by GTEST_FLAG_PREFIX_. - const std::string flag_str = std::string("--") + GTEST_FLAG_PREFIX_ + flag; - const size_t flag_len = flag_str.length(); - if (strncmp(str, flag_str.c_str(), flag_len) != 0) return nullptr; - - // Skips the flag name. - const char* flag_end = str + flag_len; - - // When def_optional is true, it's OK to not have a "=value" part. - if (def_optional && (flag_end[0] == '\0')) { - return flag_end; - } - - // If def_optional is true and there are more characters after the - // flag name, or if def_optional is false, there must be a '=' after - // the flag name. - if (flag_end[0] != '=') return nullptr; - - // Returns the string after "=". - return flag_end + 1; -} - -// Parses a string for a bool flag, in the form of either -// "--flag=value" or "--flag". -// -// In the former case, the value is taken as true as long as it does -// not start with '0', 'f', or 'F'. -// -// In the latter case, the value is taken as true. -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -static bool ParseBoolFlag(const char* str, const char* flag, bool* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseFlagValue(str, flag, true); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Converts the string value to a bool. - *value = !(*value_str == '0' || *value_str == 'f' || *value_str == 'F'); - return true; -} - -// Parses a string for an Int32 flag, in the form of -// "--flag=value". -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -bool ParseInt32Flag(const char* str, const char* flag, Int32* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseFlagValue(str, flag, false); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Sets *value to the value of the flag. - return ParseInt32(Message() << "The value of flag --" << flag, - value_str, value); -} - -// Parses a string for a string flag, in the form of -// "--flag=value". -// -// On success, stores the value of the flag in *value, and returns -// true. On failure, returns false without changing *value. -template <typename String> -static bool ParseStringFlag(const char* str, const char* flag, String* value) { - // Gets the value of the flag as a string. - const char* const value_str = ParseFlagValue(str, flag, false); - - // Aborts if the parsing failed. - if (value_str == nullptr) return false; - - // Sets *value to the value of the flag. - *value = value_str; - return true; -} - -// Determines whether a string has a prefix that Google Test uses for its -// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_. -// If Google Test detects that a command line flag has its prefix but is not -// recognized, it will print its help message. Flags starting with -// GTEST_INTERNAL_PREFIX_ followed by "internal_" are considered Google Test -// internal flags and do not trigger the help message. -static bool HasGoogleTestFlagPrefix(const char* str) { - return (SkipPrefix("--", &str) || - SkipPrefix("-", &str) || - SkipPrefix("/", &str)) && - !SkipPrefix(GTEST_FLAG_PREFIX_ "internal_", &str) && - (SkipPrefix(GTEST_FLAG_PREFIX_, &str) || - SkipPrefix(GTEST_FLAG_PREFIX_DASH_, &str)); -} - -// Prints a string containing code-encoded text. The following escape -// sequences can be used in the string to control the text color: -// -// @@ prints a single '@' character. -// @R changes the color to red. -// @G changes the color to green. -// @Y changes the color to yellow. -// @D changes to the default terminal text color. -// -static void PrintColorEncoded(const char* str) { - GTestColor color = COLOR_DEFAULT; // The current color. - - // Conceptually, we split the string into segments divided by escape - // sequences. Then we print one segment at a time. At the end of - // each iteration, the str pointer advances to the beginning of the - // next segment. - for (;;) { - const char* p = strchr(str, '@'); - if (p == nullptr) { - ColoredPrintf(color, "%s", str); - return; - } - - ColoredPrintf(color, "%s", std::string(str, p).c_str()); - - const char ch = p[1]; - str = p + 2; - if (ch == '@') { - ColoredPrintf(color, "@"); - } else if (ch == 'D') { - color = COLOR_DEFAULT; - } else if (ch == 'R') { - color = COLOR_RED; - } else if (ch == 'G') { - color = COLOR_GREEN; - } else if (ch == 'Y') { - color = COLOR_YELLOW; - } else { - --str; - } - } -} - -static const char kColorEncodedHelpMessage[] = -"This program contains tests written using " GTEST_NAME_ ". You can use the\n" -"following command line flags to control its behavior:\n" -"\n" -"Test Selection:\n" -" @G--" GTEST_FLAG_PREFIX_ "list_tests@D\n" -" List the names of all tests instead of running them. The name of\n" -" TEST(Foo, Bar) is \"Foo.Bar\".\n" -" @G--" GTEST_FLAG_PREFIX_ "filter=@YPOSTIVE_PATTERNS" - "[@G-@YNEGATIVE_PATTERNS]@D\n" -" Run only the tests whose name matches one of the positive patterns but\n" -" none of the negative patterns. '?' matches any single character; '*'\n" -" matches any substring; ':' separates two patterns.\n" -" @G--" GTEST_FLAG_PREFIX_ "also_run_disabled_tests@D\n" -" Run all disabled tests too.\n" -"\n" -"Test Execution:\n" -" @G--" GTEST_FLAG_PREFIX_ "repeat=@Y[COUNT]@D\n" -" Run the tests repeatedly; use a negative count to repeat forever.\n" -" @G--" GTEST_FLAG_PREFIX_ "shuffle@D\n" -" Randomize tests' orders on every iteration.\n" -" @G--" GTEST_FLAG_PREFIX_ "random_seed=@Y[NUMBER]@D\n" -" Random number seed to use for shuffling test orders (between 1 and\n" -" 99999, or 0 to use a seed based on the current time).\n" -"\n" -"Test Output:\n" -" @G--" GTEST_FLAG_PREFIX_ "color=@Y(@Gyes@Y|@Gno@Y|@Gauto@Y)@D\n" -" Enable/disable colored output. The default is @Gauto@D.\n" -" -@G-" GTEST_FLAG_PREFIX_ "print_time=0@D\n" -" Don't print the elapsed time of each test.\n" -" @G--" GTEST_FLAG_PREFIX_ "output=@Y(@Gjson@Y|@Gxml@Y)[@G:@YDIRECTORY_PATH@G" - GTEST_PATH_SEP_ "@Y|@G:@YFILE_PATH]@D\n" -" Generate a JSON or XML report in the given directory or with the given\n" -" file name. @YFILE_PATH@D defaults to @Gtest_detail.xml@D.\n" -# if GTEST_CAN_STREAM_RESULTS_ -" @G--" GTEST_FLAG_PREFIX_ "stream_result_to=@YHOST@G:@YPORT@D\n" -" Stream test results to the given server.\n" -# endif // GTEST_CAN_STREAM_RESULTS_ -"\n" -"Assertion Behavior:\n" -# if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS -" @G--" GTEST_FLAG_PREFIX_ "death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\n" -" Set the default death test style.\n" -# endif // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS -" @G--" GTEST_FLAG_PREFIX_ "break_on_failure@D\n" -" Turn assertion failures into debugger break-points.\n" -" @G--" GTEST_FLAG_PREFIX_ "throw_on_failure@D\n" -" Turn assertion failures into C++ exceptions for use by an external\n" -" test framework.\n" -" @G--" GTEST_FLAG_PREFIX_ "catch_exceptions=0@D\n" -" Do not report exceptions as test failures. Instead, allow them\n" -" to crash the program or throw a pop-up (on Windows).\n" -"\n" -"Except for @G--" GTEST_FLAG_PREFIX_ "list_tests@D, you can alternatively set " - "the corresponding\n" -"environment variable of a flag (all letters in upper-case). For example, to\n" -"disable colored text output, you can either specify @G--" GTEST_FLAG_PREFIX_ - "color=no@D or set\n" -"the @G" GTEST_FLAG_PREFIX_UPPER_ "COLOR@D environment variable to @Gno@D.\n" -"\n" -"For more information, please read the " GTEST_NAME_ " documentation at\n" -"@G" GTEST_PROJECT_URL_ "@D. If you find a bug in " GTEST_NAME_ "\n" -"(not one in your own code or tests), please report it to\n" -"@G<" GTEST_DEV_EMAIL_ ">@D.\n"; - -static bool ParseGoogleTestFlag(const char* const arg) { - return ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag, - >EST_FLAG(also_run_disabled_tests)) || - ParseBoolFlag(arg, kBreakOnFailureFlag, - >EST_FLAG(break_on_failure)) || - ParseBoolFlag(arg, kCatchExceptionsFlag, - >EST_FLAG(catch_exceptions)) || - ParseStringFlag(arg, kColorFlag, >EST_FLAG(color)) || - ParseStringFlag(arg, kDeathTestStyleFlag, - >EST_FLAG(death_test_style)) || - ParseBoolFlag(arg, kDeathTestUseFork, - >EST_FLAG(death_test_use_fork)) || - ParseStringFlag(arg, kFilterFlag, >EST_FLAG(filter)) || - ParseStringFlag(arg, kInternalRunDeathTestFlag, - >EST_FLAG(internal_run_death_test)) || - ParseBoolFlag(arg, kListTestsFlag, >EST_FLAG(list_tests)) || - ParseStringFlag(arg, kOutputFlag, >EST_FLAG(output)) || - ParseBoolFlag(arg, kPrintTimeFlag, >EST_FLAG(print_time)) || - ParseBoolFlag(arg, kPrintUTF8Flag, >EST_FLAG(print_utf8)) || - ParseInt32Flag(arg, kRandomSeedFlag, >EST_FLAG(random_seed)) || - ParseInt32Flag(arg, kRepeatFlag, >EST_FLAG(repeat)) || - ParseBoolFlag(arg, kShuffleFlag, >EST_FLAG(shuffle)) || - ParseInt32Flag(arg, kStackTraceDepthFlag, - >EST_FLAG(stack_trace_depth)) || - ParseStringFlag(arg, kStreamResultToFlag, - >EST_FLAG(stream_result_to)) || - ParseBoolFlag(arg, kThrowOnFailureFlag, - >EST_FLAG(throw_on_failure)); -} - -#if GTEST_USE_OWN_FLAGFILE_FLAG_ -static void LoadFlagsFromFile(const std::string& path) { - FILE* flagfile = posix::FOpen(path.c_str(), "r"); - if (!flagfile) { - GTEST_LOG_(FATAL) << "Unable to open file \"" << GTEST_FLAG(flagfile) - << "\""; - } - std::string contents(ReadEntireFile(flagfile)); - posix::FClose(flagfile); - std::vector<std::string> lines; - SplitString(contents, '\n', &lines); - for (size_t i = 0; i < lines.size(); ++i) { - if (lines[i].empty()) - continue; - if (!ParseGoogleTestFlag(lines[i].c_str())) - g_help_flag = true; - } -} -#endif // GTEST_USE_OWN_FLAGFILE_FLAG_ - -// Parses the command line for Google Test flags, without initializing -// other parts of Google Test. The type parameter CharType can be -// instantiated to either char or wchar_t. -template <typename CharType> -void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) { - for (int i = 1; i < *argc; i++) { - const std::string arg_string = StreamableToString(argv[i]); - const char* const arg = arg_string.c_str(); - - using internal::ParseBoolFlag; - using internal::ParseInt32Flag; - using internal::ParseStringFlag; - - bool remove_flag = false; - if (ParseGoogleTestFlag(arg)) { - remove_flag = true; -#if GTEST_USE_OWN_FLAGFILE_FLAG_ - } else if (ParseStringFlag(arg, kFlagfileFlag, >EST_FLAG(flagfile))) { - LoadFlagsFromFile(GTEST_FLAG(flagfile)); - remove_flag = true; -#endif // GTEST_USE_OWN_FLAGFILE_FLAG_ - } else if (arg_string == "--help" || arg_string == "-h" || - arg_string == "-?" || arg_string == "/?" || - HasGoogleTestFlagPrefix(arg)) { - // Both help flag and unrecognized Google Test flags (excluding - // internal ones) trigger help display. - g_help_flag = true; - } - - if (remove_flag) { - // Shift the remainder of the argv list left by one. Note - // that argv has (*argc + 1) elements, the last one always being - // NULL. The following loop moves the trailing NULL element as - // well. - for (int j = i; j != *argc; j++) { - argv[j] = argv[j + 1]; - } - - // Decrements the argument count. - (*argc)--; - - // We also need to decrement the iterator as we just removed - // an element. - i--; - } - } - - if (g_help_flag) { - // We print the help here instead of in RUN_ALL_TESTS(), as the - // latter may not be called at all if the user is using Google - // Test with another testing framework. - PrintColorEncoded(kColorEncodedHelpMessage); - } -} - -// Parses the command line for Google Test flags, without initializing -// other parts of Google Test. -void ParseGoogleTestFlagsOnly(int* argc, char** argv) { - ParseGoogleTestFlagsOnlyImpl(argc, argv); - - // Fix the value of *_NSGetArgc() on macOS, but if and only if - // *_NSGetArgv() == argv - // Only applicable to char** version of argv -#if GTEST_OS_MAC -#ifndef GTEST_OS_IOS - if (*_NSGetArgv() == argv) { - *_NSGetArgc() = *argc; - } -#endif -#endif -} -void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) { - ParseGoogleTestFlagsOnlyImpl(argc, argv); -} - -// The internal implementation of InitGoogleTest(). -// -// The type parameter CharType can be instantiated to either char or -// wchar_t. -template <typename CharType> -void InitGoogleTestImpl(int* argc, CharType** argv) { - // We don't want to run the initialization code twice. - if (GTestIsInitialized()) return; - - if (*argc <= 0) return; - - g_argvs.clear(); - for (int i = 0; i != *argc; i++) { - g_argvs.push_back(StreamableToString(argv[i])); - } - -#if GTEST_HAS_ABSL - absl::InitializeSymbolizer(g_argvs[0].c_str()); -#endif // GTEST_HAS_ABSL - - ParseGoogleTestFlagsOnly(argc, argv); - GetUnitTestImpl()->PostFlagParsingInit(); -} - -} // namespace internal - -// Initializes Google Test. This must be called before calling -// RUN_ALL_TESTS(). In particular, it parses a command line for the -// flags that Google Test recognizes. Whenever a Google Test flag is -// seen, it is removed from argv, and *argc is decremented. -// -// No value is returned. Instead, the Google Test flag variables are -// updated. -// -// Calling the function for the second time has no user-visible effect. -void InitGoogleTest(int* argc, char** argv) { -#if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(argc, argv); -#else // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - internal::InitGoogleTestImpl(argc, argv); -#endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) -} - -// This overloaded version can be used in Windows programs compiled in -// UNICODE mode. -void InitGoogleTest(int* argc, wchar_t** argv) { -#if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(argc, argv); -#else // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - internal::InitGoogleTestImpl(argc, argv); -#endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) -} - -// This overloaded version can be used on Arduino/embedded platforms where -// there is no argc/argv. -void InitGoogleTest() { - // Since Arduino doesn't have a command line, fake out the argc/argv arguments - int argc = 1; - const auto arg0 = "dummy"; - char* argv0 = const_cast<char*>(arg0); - char** argv = &argv0; - -#if defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_(&argc, argv); -#else // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) - internal::InitGoogleTestImpl(&argc, argv); -#endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) -} - -std::string TempDir() { -#if defined(GTEST_CUSTOM_TEMPDIR_FUNCTION_) - return GTEST_CUSTOM_TEMPDIR_FUNCTION_(); -#endif - -#if GTEST_OS_WINDOWS_MOBILE - return "\\temp\\"; -#elif GTEST_OS_WINDOWS - const char* temp_dir = internal::posix::GetEnv("TEMP"); - if (temp_dir == nullptr || temp_dir[0] == '\0') - return "\\temp\\"; - else if (temp_dir[strlen(temp_dir) - 1] == '\\') - return temp_dir; - else - return std::string(temp_dir) + "\\"; -#elif GTEST_OS_LINUX_ANDROID - return "/sdcard/"; -#else - return "/tmp/"; -#endif // GTEST_OS_WINDOWS_MOBILE -} - -// Class ScopedTrace - -// Pushes the given source file location and message onto a per-thread -// trace stack maintained by Google Test. -void ScopedTrace::PushTrace(const char* file, int line, std::string message) { - internal::TraceInfo trace; - trace.file = file; - trace.line = line; - trace.message.swap(message); - - UnitTest::GetInstance()->PushGTestTrace(trace); -} - -// Pops the info pushed by the c'tor. -ScopedTrace::~ScopedTrace() - GTEST_LOCK_EXCLUDED_(&UnitTest::mutex_) { - UnitTest::GetInstance()->PopGTestTrace(); -} - -} // namespace testing diff --git a/3rdParty/googletest/googletest/src/gtest_main.cc b/3rdParty/googletest/googletest/src/gtest_main.cc deleted file mode 100644 index f6e1dd96fb3b374fa1f22be5f87c208e1bcc9ec4..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/googletest/src/gtest_main.cc +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2006, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include <cstdio> -#include "gtest/gtest.h" - -#ifdef ARDUINO -void setup() { - testing::InitGoogleTest(); -} - -void loop() { RUN_ALL_TESTS(); } - -#else - -GTEST_API_ int main(int argc, char **argv) { - printf("Running main() from %s\n", __FILE__); - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -#endif diff --git a/3rdParty/googletest/version.txt b/3rdParty/googletest/version.txt deleted file mode 100644 index b9fa3d3def665fa11b4146282404e6b4f110ab21..0000000000000000000000000000000000000000 --- a/3rdParty/googletest/version.txt +++ /dev/null @@ -1,3 +0,0 @@ -release v1.10.0, 03.10.2019 - -https://github.com/google/googletest/releases/tag/release-1.10.0 diff --git a/AUTHORS.md b/AUTHORS.md index 00a5410811196462d6f808036be7feb5e74a102d..554a5f1614a41f8bf7528e24b13d0a8569cb210d 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,25 +1,28 @@ # AUTHORS VF has been developed essentially over the last fifteen years by various researchers at IRMB including (in alphabetical order): + +Damilola Adekanye, M.Sc. Dr. Benjamin Ahrenholz -M. Sc. Hussein Alihussein +Dr. Hussein Alihussein Dr. Sebastian Bindick -B. Sc. Aileen Brendel +Aileen Brendel, B.Sc. J.Prof. Dr. Martin Geier Dr. Sebastian Geller Dr. Ehsan Goraki Fard Dr. Jan Hegewald Dr. Christian Janßen -M. Sc. Konstantin Kutscher -M. Sc. Stephan Lenz +Prof. Dr.-Ing. habil. Manfred Krafczyk +Dr. Konstantin Kutscher +Dr. Stephan Lenz Dr. Jan Linxweiler -B. Sc. Lennard Lux -B. Sc. Sven Marcus -M. Sc. Sören Peters +Lennard Lux, B.Sc. +Sören Peters, M.Sc. +Sven Marcus, M.Sc. Dr. Hesameddin Safari Dr. Martin Schönherr Dipl.-Ing. Maik Stiebler Dr. Sören Textor (aka Freudiger) PD Dr. Jonas Tölke Dr. Sonja Uphoff -B. Sc. Anna Wellmann \ No newline at end of file +Anna Wellmann, M.Sc. diff --git a/CMake/3rd/gmock.cmake b/CMake/3rd/gmock.cmake index 205a3b9a17d872d77df114517d8d7dba0de255bf..712b99ca2271f1d3891114ff613a569a00fe03c4 100644 --- a/CMake/3rd/gmock.cmake +++ b/CMake/3rd/gmock.cmake @@ -5,7 +5,7 @@ function (linkGMOCK) vf_get_library_test_name(library_name) - target_link_libraries(${library_name} PRIVATE gtest gmock gmock_main) + target_link_libraries(${library_name} PRIVATE GTest::gmock_main) if(BUILD_SHARED_LIBS) # add compile option according to diff --git a/CMake/VirtualFluidsMacros.cmake b/CMake/VirtualFluidsMacros.cmake index fbe0d9404e6c923bfb866e7d8dea7844b51ae17a..63503f5f14221bb8cec7670dbdda6aa92497d327 100644 --- a/CMake/VirtualFluidsMacros.cmake +++ b/CMake/VirtualFluidsMacros.cmake @@ -315,4 +315,14 @@ endfunction() ################################################################################# function(groupTarget targetName folderName) set_property( TARGET ${targetName} PROPERTY FOLDER ${folderName} ) -endfunction(groupTarget) \ No newline at end of file +endfunction(groupTarget) + + +################################################################################# +## load user apps, which are specified in the machine file +################################################################################# +function(vf_load_user_apps) + foreach(app IN LISTS USER_APPS) + add_subdirectory(${app}) + endforeach() +endfunction() \ No newline at end of file diff --git a/CMake/cmake_config_files/AMATERASU.config.cmake b/CMake/cmake_config_files/AMATERASU.config.cmake deleted file mode 100644 index e65b197cba1a5d70007144c09cd80c85c33a0696..0000000000000000000000000000000000000000 --- a/CMake/cmake_config_files/AMATERASU.config.cmake +++ /dev/null @@ -1,14 +0,0 @@ -################################################################################# -# VirtualFluids MACHINE FILE -# Responsible: Martin Geier -# OS: Windows 10 -################################################################################# - - - -################################################################################# -# METIS -################################################################################# -#SET(METIS_INCLUDEDIR "C:/Users/geier/Documents/metis-5.1.0/include") -#SET(METIS_DEBUG_LIBRARY "C:/Users/geier/Documents/metis-5.1.0/build/libmetis/Debug/metis.lib") -#SET(METIS_RELEASE_LIBRARY "C:/Users/geier/Documents/metis-5.1.0/build/libmetis/Release/metis.lib") diff --git a/CMake/cmake_config_files/ARAGORN.config.cmake b/CMake/cmake_config_files/ARAGORN.config.cmake new file mode 100644 index 0000000000000000000000000000000000000000..d713f02d971024f29d3fb0fd30cfce7585d9dc55 --- /dev/null +++ b/CMake/cmake_config_files/ARAGORN.config.cmake @@ -0,0 +1,19 @@ +################################################################################# +# VirtualFluids MACHINE FILE +# Responsible: Anna Wellmann +# OS: Windows 11 +################################################################################# + +set(CMAKE_CUDA_ARCHITECTURES 86) # Nvidia GeForce RTX 3060 + +# numerical tests location of the grids +# SET(PATH_NUMERICAL_TESTS "E:/temp/numericalTests/") +# list(APPEND VF_COMPILER_DEFINITION "PATH_NUMERICAL_TESTS=${PATH_NUMERICAL_TESTS}") + +# add invidual apps here +set(GPU_APP "apps/gpu/LBM/") +list(APPEND USER_APPS + "${GPU_APP}DrivenCavityMultiGPU" + "${GPU_APP}SphereScaling" + # "${GPU_APP}MusselOyster" + ) diff --git a/CMake/cmake_config_files/ARAGORNUBUNTU.config.cmake b/CMake/cmake_config_files/ARAGORNUBUNTU.config.cmake new file mode 100644 index 0000000000000000000000000000000000000000..90debb1a4c270109d4dfbb455f21253b3a6754b8 --- /dev/null +++ b/CMake/cmake_config_files/ARAGORNUBUNTU.config.cmake @@ -0,0 +1,17 @@ +################################################################################# +# VirtualFluids MACHINE FILE +# Responsible: Anna Wellmann +# OS: Ubuntu 20.04 (Docker container) +################################################################################# + +set(CMAKE_CUDA_ARCHITECTURES 86) # Nvidia GeForce RTX 3060 + +set(PATH_NUMERICAL_TESTS "D:/out/numericalTests/") +list(APPEND VF_COMPILER_DEFINITION "PATH_NUMERICAL_TESTS=${PATH_NUMERICAL_TESTS}") + +set(GPU_APP "apps/gpu/LBM/") +list(APPEND USER_APPS + "${GPU_APP}DrivenCavityMultiGPU" + "${GPU_APP}SphereScaling" + # "${GPU_APP}MusselOyster" + ) \ No newline at end of file diff --git a/CMake/cmake_config_files/BAUMBART.config.cmake b/CMake/cmake_config_files/BAUMBART.config.cmake deleted file mode 100644 index ba0412c88fb9b1982c73c1256ae17eec2901d54c..0000000000000000000000000000000000000000 --- a/CMake/cmake_config_files/BAUMBART.config.cmake +++ /dev/null @@ -1,18 +0,0 @@ -################################################################################# -# VirtualFluids MACHINE FILE -# Responsible: Martin Schoenherr -# OS: Windows 10 -################################################################################# -#Don't change: -SET(METIS_ROOT ${CMAKE_SOURCE_DIR}/3rdParty/metis/metis-5.1.0 CACHE PATH "METIS ROOT") -SET(GMOCK_ROOT ${CMAKE_SOURCE_DIR}/3rdParty/googletest CACHE PATH "GMOCK ROOT") -SET(JSONCPP_ROOT ${CMAKE_SOURCE_DIR}/3rdParty/jsoncpp CACHE PATH "JSONCPP ROOT") -SET(FFTW_ROOT ${CMAKE_SOURCE_DIR}/3rdParty/fftw/fftw-3.3.7 CACHE PATH "JSONCPP ROOT") - - -#SET TO CORRECT PATH: -SET(BOOST_ROOT "C:\\Program Files\\boost\\boost_1_63_0" CACHE PATH "BOOST_ROOT") -SET(BOOST_LIBRARYDIR "C:\\Program Files\\boost\\boost_1_63_0\\stage\\x64\\lib" CACHE PATH "BOOST_LIBRARYDIR") - -SET(VTK_DIR "E:/libraries/VTK-8.2.0/build" CACHE PATH "VTK directory override" FORCE) - diff --git a/CMake/cmake_config_files/BILBO.config.cmake b/CMake/cmake_config_files/BILBO.config.cmake deleted file mode 100644 index 093fe3200837a3916e8a14b16042732c2b6db218..0000000000000000000000000000000000000000 --- a/CMake/cmake_config_files/BILBO.config.cmake +++ /dev/null @@ -1,5 +0,0 @@ -################################################################################# -# VirtualFluids MACHINE FILE -# Responsible: Soeren Peters -# OS: MacOS X -################################################################################# diff --git a/CMake/cmake_config_files/BLOGIN1.config.cmake b/CMake/cmake_config_files/BLOGIN1.config.cmake deleted file mode 100644 index 9400e45f964dd3e0331b178e8b766c4c7fa7c08f..0000000000000000000000000000000000000000 --- a/CMake/cmake_config_files/BLOGIN1.config.cmake +++ /dev/null @@ -1 +0,0 @@ -INCLUDE("CMake/cmake_config_files/LISE.config.cmake") \ No newline at end of file diff --git a/CMake/cmake_config_files/BLOGIN2.config.cmake b/CMake/cmake_config_files/BLOGIN2.config.cmake deleted file mode 100644 index 9400e45f964dd3e0331b178e8b766c4c7fa7c08f..0000000000000000000000000000000000000000 --- a/CMake/cmake_config_files/BLOGIN2.config.cmake +++ /dev/null @@ -1 +0,0 @@ -INCLUDE("CMake/cmake_config_files/LISE.config.cmake") \ No newline at end of file diff --git a/CMake/cmake_config_files/CSE01.config.cmake b/CMake/cmake_config_files/CSE01.config.cmake deleted file mode 100644 index cad3f60ce31edac1069d1edce3fdd43b49a72b6e..0000000000000000000000000000000000000000 --- a/CMake/cmake_config_files/CSE01.config.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# Alena -################################################################################# -# BOOST -################################################################################# -#SET(BOOST_VERSION "1.60.0") -#SET(BOOST_ROOT "d:/boost/boost_1_60_0") -#SET(BOOST_DIR ${BOOST_ROOT}) -#SET(BOOST_LIBRARYDIR ${BOOST_ROOT}"/stageMSVC64/lib") -################################################################################# - -################################################################################# -# METIS -################################################################################# -#IF(${USE_METIS}) -# SET(METIS_INCLUDEDIR "d:/metis-5.1.0/include") -# SET(METIS_DEBUG_LIBRARY "d:/metis-5.1.0/build/libmetis/Debug/metis.lib") -# SET(METIS_RELEASE_LIBRARY "d:/metis-5.1.0/build/libmetis/Release/metis.lib") -#ENDIF() -################################################################################# -# VTK -################################################################################# -#set(VTK_DIR "d:/tools/VTK/build/VTK-8.2.0") -################################################################################# \ No newline at end of file diff --git a/CMake/cmake_config_files/ELDARION.config.cmake b/CMake/cmake_config_files/ELDARION.config.cmake new file mode 100644 index 0000000000000000000000000000000000000000..53dc97e213a7445e153157ec76937ea0fec1f678 --- /dev/null +++ b/CMake/cmake_config_files/ELDARION.config.cmake @@ -0,0 +1,18 @@ +################################################################################# +# VirtualFluids MACHINE FILE +# Responsible: Anna Wellmann +# OS: Ubuntu 22.04 +################################################################################# + +set(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc) +SET(CMAKE_CUDA_ARCHITECTURES 61) # GeForce 1080 Ti + +set(PATH_NUMERICAL_TESTS "~/output/numericalTests/") +list(APPEND VF_COMPILER_DEFINITION "PATH_NUMERICAL_TESTS=${PATH_NUMERICAL_TESTS}") + +set(GPU_APP "apps/gpu/LBM/") +list(APPEND USER_APPS + # "${GPU_APP}DrivenCavityMultiGPU" + # "${GPU_APP}SphereScaling" + # "${GPU_APP}MusselOyster" + ) \ No newline at end of file diff --git a/CMake/cmake_config_files/ELENDUR.config.cmake b/CMake/cmake_config_files/ELENDUR.config.cmake deleted file mode 100644 index 5ef9d62dd8dbd7d352dfa812c05327b652ee83df..0000000000000000000000000000000000000000 --- a/CMake/cmake_config_files/ELENDUR.config.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# Hiwi Rechner Olli -################################################################################# -# BOOST -################################################################################# -SET(BOOST_VERSION "1.65.1") -SET(BOOST_ROOT "c:/Libraries/boost/boost_1_65_1") -SET(BOOST_DIR ${BOOST_ROOT}) -SET(BOOST_LIBRARYDIR ${BOOST_ROOT}"/stage/lib") -################################################################################# - -################################################################################# -################################################################################# -# METIS -################################################################################# -SET(METIS_INCLUDEDIR "c:/Libraries/metis/metis-5.1.0/include") -SET(METIS_DEBUG_LIBRARY "c:/Libraries/metis/metis-5.1.0/MSVC2015/libmetis/Debug/metis.lib") -SET(METIS_RELEASE_LIBRARY "c:/Libraries/metis/metis-5.1.0/MSVC2015/libmetis/Release/metis.lib") - diff --git a/CMake/cmake_config_files/ELLADAN.config.cmake b/CMake/cmake_config_files/GITLAB-RUNNER02.config.cmake similarity index 83% rename from CMake/cmake_config_files/ELLADAN.config.cmake rename to CMake/cmake_config_files/GITLAB-RUNNER02.config.cmake index ff87d1b9d8d8aac05fe72cb1e303ad7de6663e8f..3c2bede02733eb2b1ae25b2cbd9141369fe473f7 100644 --- a/CMake/cmake_config_files/ELLADAN.config.cmake +++ b/CMake/cmake_config_files/GITLAB-RUNNER02.config.cmake @@ -4,6 +4,5 @@ # OS: Ubuntu 20.04 ################################################################################# -set(NVCUDASAMPLES_ROOT "~/cuda-samples/Common") - +set(CMAKE_CUDA_ARCHITECTURES 70) \ No newline at end of file diff --git a/CMake/cmake_config_files/HOST2.config.cmake b/CMake/cmake_config_files/HOST2.config.cmake deleted file mode 100644 index 3bfbaf2ddead8a6cc0eafa5c2c033fc54da6cb7f..0000000000000000000000000000000000000000 --- a/CMake/cmake_config_files/HOST2.config.cmake +++ /dev/null @@ -1,22 +0,0 @@ -################################################################################# -# VirtualFluids MACHINE FILE -# Responsible: Konstantin Kutscher -# OS: ??? -################################################################################# - -################################################################################# -# BOOST -################################################################################# -SET(BOOST_VERSION "1.47") -SET(BOOST_USE_MULTITHREAD ON) -SET(BOOST_USE_STATIC_LIBS ON) - -SET(BOOST_ROOT "/host/tools/boost/boost_1_47_0") -SET(BOOST_LIBRARYDIR "/host/tools/boost/boost_1_47_0/stageLinux/lib") - -################################################################################# -# METIS -################################################################################# -SET(METIS_INCLUDEDIR "c:/Tools/metis-5.0.1/include") -SET(METIS_DEBUG_LIBRARY "c:/Tools/metis-5.0.1/build/libmetis/Debug/metis.lib") -SET(METIS_RELEASE_LIBRARY "c:/Tools/metis-5.0.1/build/libmetis/Release/metis.lib") diff --git a/CMake/cmake_config_files/KI4ALLGPU.config.cmake b/CMake/cmake_config_files/KI4ALLGPU.config.cmake new file mode 100644 index 0000000000000000000000000000000000000000..111a3b3881d7a07eada02fb1e826e88b64b3591e --- /dev/null +++ b/CMake/cmake_config_files/KI4ALLGPU.config.cmake @@ -0,0 +1,16 @@ +################################################################################# +# VirtualFluids MACHINE FILE +# Responsible: Anna Wellmann +# OS: Ubuntu 20.04 (Docker container) +################################################################################# + +set(CMAKE_CUDA_ARCHITECTURES 80) # Nvidia Tesla A100 + +set(GPU_APP "apps/gpu/LBM/") +list(APPEND USER_APPS + "${GPU_APP}ChannelFlow" + "${GPU_APP}SphereScaling" +) + +# run docker container with: +# docker run -it -v `pwd`:`pwd` -w `pwd` --gpus all --hostname ki4allgpu --name virtual-fluids-environment <containerid> \ No newline at end of file diff --git a/CMake/cmake_config_files/LISE.config.cmake b/CMake/cmake_config_files/LISE.config.cmake deleted file mode 100644 index 705f02c62f5beb1eb5544af88d9a248c65e684ba..0000000000000000000000000000000000000000 --- a/CMake/cmake_config_files/LISE.config.cmake +++ /dev/null @@ -1,15 +0,0 @@ -################################################################################# -# METIS -################################################################################# -IF(${USE_METIS}) - SET(METIS_INCLUDEDIR "/home/niikonst/metis-5.1.0/include") - SET(METIS_DEBUG_LIBRARY "/home/niikonst/metis-5.1.0/build/Linux-x86_64/libmetis/libmetis.a") - SET(METIS_RELEASE_LIBRARY "/home/niikonst/metis-5.1.0/build/Linux-x86_64/libmetis/libmetis.a") -ENDIF() -################################################################################# -# BOOST -################################################################################# -SET(BOOST_VERSION "1.72.0") -SET(BOOST_ROOT "/sw/tools/boost/1.72.0/skl/openmpi.3.1.5-gcc.9.2.0") -SET(BOOST_DIR ${BOOST_ROOT}) -SET(BOOST_LIBRARYDIR ${BOOST_ROOT}"/lib") \ No newline at end of file diff --git a/CMake/cmake_config_files/MOLLOK.config.cmake b/CMake/cmake_config_files/MOLLOK.config.cmake index 03f83455175719ff5b0e786994213bbaa0fbd29e..f700f3cd7a4b5669ef6ffee9436a1528e50e9dc9 100644 --- a/CMake/cmake_config_files/MOLLOK.config.cmake +++ b/CMake/cmake_config_files/MOLLOK.config.cmake @@ -4,8 +4,12 @@ # OS: Windows 10 ################################################################################# -#SET TO CORRECT PATH: -SET(CMAKE_CUDA_ARCHITECTURES 86) +# cuda compute capability +set(CMAKE_CUDA_ARCHITECTURES 86) -SET(PATH_NUMERICAL_TESTS "D:/out/numericalTests/") -LIST(APPEND VF_COMPILER_DEFINITION "PATH_NUMERICAL_TESTS=${PATH_NUMERICAL_TESTS}") +# numerical tests location of the grids +set(PATH_NUMERICAL_TESTS "D:/out/numericalTests/") +list(APPEND VF_COMPILER_DEFINITION "PATH_NUMERICAL_TESTS=${PATH_NUMERICAL_TESTS}") + +# add invidual apps here +list(APPEND USER_APPS "apps/gpu/LBM/WTG_RUB") \ No newline at end of file diff --git a/CMake/cmake_config_files/MULE.config.cmake b/CMake/cmake_config_files/MULE.config.cmake new file mode 100644 index 0000000000000000000000000000000000000000..02f61b7988c5b3af9cd58bc52e46b1b2edfe8aae --- /dev/null +++ b/CMake/cmake_config_files/MULE.config.cmake @@ -0,0 +1 @@ +SET(CMAKE_CUDA_ARCHITECTURES "75") \ No newline at end of file diff --git a/CMake/cmake_config_files/PHOENIX.config.cmake b/CMake/cmake_config_files/PHOENIX.config.cmake index 2f576538c106a6a4d83509a49a1408a8d63efbdb..12355ebb32bacd3251e95b434207ac2820c6bf77 100644 --- a/CMake/cmake_config_files/PHOENIX.config.cmake +++ b/CMake/cmake_config_files/PHOENIX.config.cmake @@ -4,44 +4,31 @@ # OS: CentOS 7.3 ################################################################################# -SET(BOOST_VERSION "1.63.0" CACHE STRING "std: 1.63.0") - -################################################################################# -# METIS -################################################################################# -SET(METIS_INCLUDEDIR "/cluster/lib/metis/5.1.0/gcc/include") -SET(METIS_DEBUG_LIBRARY "/cluster/lib/metis/5.1.0/gcc/lib/libmetis.a") -SET(METIS_RELEASE_LIBRARY "/cluster/lib/metis/5.1.0/gcc/lib/libmetis.a") - - ################################################################################# -# PE +# PE (legacy) ################################################################################# IF(${USE_DEM_COUPLING}) SET(PE_BINARY_DIR "/home/irmb/walberla-git/build" CACHE PATH "pe binary dir") SET(PE_ROOT "/home/irmb/walberla-git" CACHE PATH "pe root") - - SET(PE_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/pe/libpe.a) + + SET(PE_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/pe/libpe.a) SET(PE_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/pe/libpe.a) - SET(BLOCKFOREST_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/blockforest/libblockforest.a) + SET(BLOCKFOREST_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/blockforest/libblockforest.a) SET(BLOCKFOREST_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/blockforest/libblockforest.a) - SET(DOMAIN_DECOMPOSITION_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/domain_decomposition/libdomain_decomposition.a) + SET(DOMAIN_DECOMPOSITION_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/domain_decomposition/libdomain_decomposition.a) SET(DOMAIN_DECOMPOSITION_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/domain_decomposition/libdomain_decomposition.a) - SET(GEOMETRY_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/geometry/libgeometry.a) + SET(GEOMETRY_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/geometry/libgeometry.a) SET(GEOMETRY_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/geometry/libgeometry.a) - SET(CORE_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/core/libcore.a) + SET(CORE_DEBUG_LIBRARY ${PE_BINARY_DIR}/src/core/libcore.a) SET(CORE_RELEASE_LIBRARY ${PE_BINARY_DIR}/src/core/libcore.a) - ENDIF() - - -SET(BOOST_ROOT "/cluster/lib/boost/1.63.0/gcc" CACHE PATH "BOOST_ROOT") -SET(BOOST_LIBRARYDIR "/cluster/lib/boost/1.63.0/gcc/lib" CACHE PATH "BOOST_LIBRARYDIR") - -#SET(VTK_DIR "/cluster/lib/vtk/8.1.0/lib/cmake/vtk-8.1" CACHE PATH "VTK directory override" FORCE) -#SET(VTK_DIR "/home/irmb/tools/VTK/build/VTK-8.2.0" CACHE PATH "VTK directory override" FORCE) -#SET(VTK_DIR "/home/stelenz/software/vtk/VTK-8.1.0/build" CACHE PATH "VTK directory override" FORCE) - ## nvidia -set(CMAKE_CUDA_ARCHITECTURES 60) # NVIDIA Tesla P100 \ No newline at end of file +set(CMAKE_CUDA_ARCHITECTURES 60) # NVIDIA Tesla P100 + +set(GPU_APP "apps/gpu/LBM/") +list(APPEND USER_APPS + # "${GPU_APP}DrivenCavityMultiGPU" + "${GPU_APP}SphereScaling" + # "${GPU_APP}MusselOyster" + ) diff --git a/CMake/cmake_config_files/SAMWEIS.config.cmake b/CMake/cmake_config_files/SAMWEIS.config.cmake deleted file mode 100644 index 5b08c08610c37e1a38947d8842ca744622ffa524..0000000000000000000000000000000000000000 --- a/CMake/cmake_config_files/SAMWEIS.config.cmake +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################# -# VirtualFluids MACHINE FILE -# Responsible: Lennard Lux -# OS: Windows 10 -################################################################################# - -################################################################################# -# BOOST -################################################################################# -SET(BOOST_VERSION "1.60.0") -SET(BOOST_ROOT "c:/Tools/boost/boost_1_60_0") -SET(BOOST_DIR ${BOOST_ROOT}) -SET(BOOST_LIBRARYDIR ${BOOST_ROOT}"/stageMSVC64/lib") -################################################################################# -# VTK -################################################################################# -set(VTK_DIR "E:/Tools/VTK-8.1.2-build") - -################################################################################# -# METIS -################################################################################# -SET(METIS_INCLUDEDIR "c:/Tools/metis-5.1.0/include") -SET(METIS_DEBUG_LIBRARY "c:/Tools/metis-5.1.0/build/libmetis/Debug/metis.lib") -SET(METIS_RELEASE_LIBRARY "c:/Tools/metis-5.1.0/build/libmetis/Release/metis.lib") diff --git a/CMake/cmake_config_files/TESLA01.config.cmake b/CMake/cmake_config_files/TESLA01.config.cmake deleted file mode 100644 index ab7f92aea592fb4f8f034ebc548df05c46c58382..0000000000000000000000000000000000000000 --- a/CMake/cmake_config_files/TESLA01.config.cmake +++ /dev/null @@ -1,11 +0,0 @@ -################################################################################# -# VirtualFluids MACHINE FILE -# Responsible: Soeren Peters -# OS: Windows 10 -################################################################################# - -SET(BOOST_ROOT "C:\\Libraries\\boost_1_65_1" CACHE PATH "BOOST_ROOT") -SET(BOOST_LIBRARYDIR "C:\\Libraries\\boost_1_65_1\\lib" CACHE PATH "BOOST_LIBRARYDIR") - -SET(VTK_DIR "C:/Libraries/VTK-8.0.1/build") - diff --git a/CMake/cmake_config_files/TESLA03.config.cmake b/CMake/cmake_config_files/TESLA03.config.cmake index 91672511794eeb452f97a1aca952416c7e1179d5..e29c7306c5448b97eefed9d7a41871a5e4d3b589 100644 --- a/CMake/cmake_config_files/TESLA03.config.cmake +++ b/CMake/cmake_config_files/TESLA03.config.cmake @@ -4,19 +4,12 @@ # OS: Windows 10 ################################################################################# -#Don't change: -SET(METIS_ROOT ${CMAKE_SOURCE_DIR}/3rdParty/metis/metis-5.1.0 CACHE PATH "METIS ROOT") -SET(GMOCK_ROOT ${CMAKE_SOURCE_DIR}/3rdParty/googletest CACHE PATH "GMOCK ROOT") -SET(JSONCPP_ROOT ${CMAKE_SOURCE_DIR}/3rdParty/jsoncpp CACHE PATH "JSONCPP ROOT") -SET(FFTW_ROOT ${CMAKE_SOURCE_DIR}/3rdParty/fftw/fftw-3.3.7 CACHE PATH "JSONCPP ROOT") - - -#SET TO CORRECT PATH: -SET(BOOST_ROOT "F:/boost/boost_1_74_0" CACHE PATH "BOOST_ROOT") -SET(BOOST_LIBRARYDIR "F:/boost/boost_1_74_0/stageMSVC64VS2019/lib" CACHE PATH "BOOST_LIBRARYDIR") - -SET(VTK_DIR "F:/Libraries/vtk/VTK-8.2.0/build" CACHE PATH "VTK directory override" FORCE) +# cuda compute capability +SET(CMAKE_CUDA_ARCHITECTURES 52) +# numerical tests location of the grids SET(PATH_NUMERICAL_TESTS "E:/temp/numericalTests/") -LIST(APPEND VF_COMPILER_DEFINITION "PATH_NUMERICAL_TESTS=${PATH_NUMERICAL_TESTS}") -SET(CMAKE_CUDA_ARCHITECTURES 52) \ No newline at end of file +list(APPEND VF_COMPILER_DEFINITION "PATH_NUMERICAL_TESTS=${PATH_NUMERICAL_TESTS}") + +# add invidual apps here +list(APPEND USER_APPS "apps/gpu/LBM/MusselOyster") diff --git a/CMakeLists.txt b/CMakeLists.txt index ba35020d9d893637d82d968b68116ff6a922e99a..b3af407acd66ec3223f55de7753df879786ce561 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,8 @@ message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER ".cmake") set(libraryFolder "libs") @@ -97,6 +99,7 @@ IF( BUILD_VF_DOUBLE_ACCURACY ) list(APPEND VF_COMPILER_DEFINITION VF_DOUBLE_ACCURACY) ENDIF() +# set gpu features if(BUILD_VF_GPU OR BUILD_VF_GKS) include(CheckLanguage) check_language(CUDA) @@ -142,6 +145,7 @@ endif() ################################################################################# include(FetchContent) +# spdlog set(spdlog_version "v1.9.1") set(spdlog_url "https://github.com/gabime/spdlog") message(STATUS "Fetching spdlog: ${spdlog_version}") @@ -155,8 +159,23 @@ FetchContent_MakeAvailable(spdlog) target_compile_options(spdlog PRIVATE "-fPIC") groupTarget(spdlog ${thirdFolder}) +# googletest if(BUILD_VF_UNIT_TESTS) - add_subdirectory(${VF_THIRD_DIR}/googletest) + FetchContent_Declare( + googletest + DOWNLOAD_EXTRACT_TIMESTAMP FALSE # https://cmake.org/cmake/help/latest/policy/CMP0135.html + URL https://github.com/google/googletest/archive/1f643f71d4151c3b364c0e9302042f7a6debd439.zip # 30.11.2022 + ) + # For Windows: Prevent overriding the parent project's compiler/linker settings + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) + + FetchContent_MakeAvailable(googletest) + + groupTarget(gmock ${thirdFolder}/googletest) + groupTarget(gmock_main ${thirdFolder}/googletest) + groupTarget(gtest ${thirdFolder}/googletest) + groupTarget(gtest_main ${thirdFolder}/googletest) + include(GoogleTest) enable_testing() endif() @@ -199,3 +218,11 @@ if(BUILD_VF_GPU OR BUILD_VF_GKS) add_subdirectory(src/cuda) include (gpu.cmake) endif() + +if (BUILD_VF_PYTHON_BINDINGS) + add_subdirectory(${VF_THIRD_DIR}/pybind11/pybind11-2.6.0) + add_subdirectory(pythonbindings) +endif() + + +vf_load_user_apps() \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a0693d564438ece97e0e9bebc7262bf189a337d4..ebd21c1a26e184136b41d35d1091ba519e885f62 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ To contribute use a merge request as follows: - Run the tests. - Write or adapt tests as needed. - Add or change the documentation as needed. -- Push your branch to your fork on gitea, the remote `origin`. +- Push your branch to your fork on gitlab, the remote `origin`. - From your fork open a merge request in the correct branch. Target the project's `develop` or `open_source` branch - … - If we requests further changes just push them to your branch. The MR will be updated automatically. diff --git a/Containers/dockerfiles/Ubuntu20_04.Dockerfile b/Containers/dockerfiles/Ubuntu20_04.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..21511a97adab3694540c1d13a699f4d10b3d0356 --- /dev/null +++ b/Containers/dockerfiles/Ubuntu20_04.Dockerfile @@ -0,0 +1,51 @@ +# VirtualFluids BuildDependencies: +# Ubuntu 20.04 +# general tools: wget, unzip, git +# CMake 3.24.0 +# ccache +# gcc 9.3 (default) +# gdb +# openmpi 4.0.3 +# openmp +# cuda 11.3.1 as base image +# freeGLUT +# cppcheck +# clang 10.0 (default) +# clangd language server https://clangd.llvm.org/ +# python pip3 with modules: setuptools, wheels, scikit-build, pyvista, numpy, ansible, gcovr + +FROM nvidia/cuda:11.3.1-devel-ubuntu20.04 + +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update && \ + apt-get install -y \ + wget unzip git \ + build-essential gdb \ + ccache \ + ninja-build \ + openmpi-bin=4.0.3-0ubuntu1 \ + libomp-dev \ + clang \ + clang-format \ + clang-tidy \ + clang-tools \ + llvm-dev \ + libclang-dev \ + python3-pip \ + freeglut3-dev \ + cppcheck \ + clangd-12 \ + && update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-12 100 \ + && mkdir -p /usr/local/cmake/ && cd /usr/local/cmake/ \ + && version=3.24 && build=0 \ + && wget https://cmake.org/files/v$version/cmake-$version.$build-linux-x86_64.tar.gz \ + && tar -xzvf cmake-$version.$build-linux-x86_64.tar.gz \ + && ln -s /usr/local/cmake/cmake-$version.$build-linux-x86_64/bin/* /usr/local/bin/ \ + && pip3 install \ + setuptools \ + wheel \ + scikit-build \ + pyvista \ + numpy \ + ansible \ + 'jinja2<3.1' gcovr==5.0 diff --git a/Python/SlurmTests/poiseuille/settings.py b/Python/SlurmTests/poiseuille/settings.py index f75c2b1d7133323880dd5520de0a96cb8fa87860..4b4a1e4e9cc7f6118a60c22a40c70b027e3ac4e2 100644 --- a/Python/SlurmTests/poiseuille/settings.py +++ b/Python/SlurmTests/poiseuille/settings.py @@ -1,7 +1,7 @@ import os from acousticscaling import OneDirectionalAcousticScaling -from pyfluids.kernel import LBMKernel, KernelType -from pyfluids.parameters import RuntimeParameters, GridParameters, PhysicalParameters +from pyfluids.cpu.kernel import LBMKernel, KernelType +from pyfluids.cpu.parameters import RuntimeParameters, GridParameters, PhysicalParameters grid_params = GridParameters() diff --git a/Python/SlurmTests/poiseuille/simulation_runner.py b/Python/SlurmTests/poiseuille/simulation_runner.py index 0b75de40b6a8f11ccd76f97f2ed9d709dc5362dd..03fb24be7ea1a6468ae25ec3aa40ab59962ef91e 100644 --- a/Python/SlurmTests/poiseuille/simulation_runner.py +++ b/Python/SlurmTests/poiseuille/simulation_runner.py @@ -2,7 +2,7 @@ import os from SlurmTests.poiseuille.settings import Scaling from poiseuille.simulation import run_simulation -from pyfluids.writer import Writer, OutputFormat +from pyfluids.cpu.writer import Writer, OutputFormat scale_level = int(os.environ["PYFLUIDS_SCALE_LEVEL"]) diff --git a/Python/acousticscaling.py b/Python/acousticscaling.py index 50b81db064251fa269f29bf72a561567ddedafbc..a664b8e924d648b680562b9aef11bee87b3562b1 100644 --- a/Python/acousticscaling.py +++ b/Python/acousticscaling.py @@ -1,5 +1,5 @@ -from pyfluids.kernel import LBMKernel -from pyfluids.parameters import GridParameters, PhysicalParameters, RuntimeParameters +from pyfluids.cpu.kernel import LBMKernel +from pyfluids.cpu.parameters import GridParameters, PhysicalParameters, RuntimeParameters class OneDirectionalAcousticScaling: @@ -13,10 +13,10 @@ class OneDirectionalAcousticScaling: self._runtime_params = runtime_parameters self._kernel = kernel - def configuration_for_scale_level(self, level: int = 1) -> (GridParameters, + def configuration_for_scale_level(self, level: int = 1) -> tuple[GridParameters, PhysicalParameters, RuntimeParameters, - LBMKernel): + LBMKernel]: if level < 0: raise ValueError("level must be >= 0") diff --git a/Python/actuator_line/__init__.py b/Python/actuator_line/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Python/actuator_line/actuator_line.py b/Python/actuator_line/actuator_line.py new file mode 100644 index 0000000000000000000000000000000000000000..6e3c8608617df1267535984d53307dea9184c6ab --- /dev/null +++ b/Python/actuator_line/actuator_line.py @@ -0,0 +1,111 @@ +#%% +import numpy as np +from pathlib import Path +from mpi4py import MPI +from pyfluids import basics, gpu, logger +#%% +reference_diameter = 126 + +length = np.array([29,6,6])*reference_diameter +viscosity = 1.56e-5 +velocity = 9 +mach = 0.1 +nodes_per_diameter = 32 + +sim_name = "ActuatorLine" +config_file = Path(__file__).parent/Path("config.txt") +output_path = Path(__file__).parent/Path("output") +output_path.mkdir(exist_ok=True) +t_out = 100. +t_end = 500. + +#%% +logger.Logger.initialize_logger() +basics.logger.Logger.add_stdout() +basics.logger.Logger.set_debug_level(basics.logger.Level.INFO_LOW) +basics.logger.Logger.time_stamp(basics.logger.TimeStamp.ENABLE) +basics.logger.Logger.enable_printed_rank_numbers(True) +# %% +comm = gpu.Communicator.get_instance() +#%% +grid_factory = gpu.grid_generator.GridFactory.make() +grid_builder = gpu.grid_generator.MultipleGridBuilder.make_shared(grid_factory) + +#%% +dx = reference_diameter/nodes_per_diameter + +grid_builder.add_coarse_grid(0.0, 0.0, 0.0, *length, dx) +grid_builder.set_periodic_boundary_condition(False, False, False) +grid_builder.build_grids(basics.LbmOrGks.LBM, False) +#%% +config = basics.ConfigurationFile() +config.load(str(config_file)) +#%% +para = gpu.Parameter(config, comm.get_number_of_process(), comm.get_pid()) + +dt = dx * mach / (np.sqrt(3) * velocity) +velocity_lb = velocity * dt / dx # LB units +viscosity_lb = viscosity * dt / (dx * dx) # LB units + +#%% +para.set_devices([0]) +para.set_output_prefix(sim_name) +para.set_output_path(str(output_path)) +para.set_f_name(para.get_output_path() + "/" + para.get_output_prefix()) +para.set_print_files(True) +para.set_max_level(1) +#%% +para.set_velocity(velocity_lb) +para.set_viscosity(viscosity_lb) +para.set_velocity_ratio(dx/dt) +para.set_viscosity_ratio(dx*dx/dt) +para.set_main_kernel("TurbulentViscosityCumulantK17CompChim") +para.set_use_AMD(True) +para.set_SGS_constant(0.083) + +def init_func(coord_x, coord_y, coord_z): + return [0.0, velocity_lb, 0.0, 0.0] + +para.set_initial_condition(init_func) +para.set_t_out(int(t_out/dt)) +para.set_t_end(int(t_end/dt)) +para.set_is_body_force(True) + +#%% +grid_builder.set_velocity_boundary_condition(gpu.SideType.MX, velocity_lb, 0.0, 0.0) + +grid_builder.set_velocity_boundary_condition(gpu.SideType.MY, velocity_lb, 0.0, 0.0) +grid_builder.set_velocity_boundary_condition(gpu.SideType.PY, velocity_lb, 0.0, 0.0) + +grid_builder.set_velocity_boundary_condition(gpu.SideType.MZ, velocity_lb, 0.0, 0.0) +grid_builder.set_velocity_boundary_condition(gpu.SideType.PZ, velocity_lb, 0.0, 0.0) + +grid_builder.set_pressure_boundary_condition(gpu.SideType.PX, 0.0) + +#%% +cuda_memory_manager = gpu.CudaMemoryManager(para) +grid_generator = gpu.GridProvider.make_grid_generator(grid_builder, para, cuda_memory_manager, comm) +#%% +turb_pos = np.array([3,3,3])*reference_diameter +epsilon = 5 +density = 1.225 +level = 0 +n_blades = 3 +n_blade_nodes = 32 +alm = gpu.ActuatorLine(n_blades, density, n_blade_nodes, epsilon, *turb_pos, reference_diameter, level, dt, dx) +para.add_actuator(alm) +#%% +point_probe = gpu.probes.PointProbe("pointProbe", str(output_path), 100, 1, 500, 100) +point_probe.add_probe_points_from_list(np.array([1,2,5])*reference_diameter, np.array([3,3,3])*reference_diameter, np.array([3,3,3])*reference_diameter) +point_probe.add_statistic(gpu.probes.Statistic.Means) + +para.add_probe(point_probe) + +plane_probe = gpu.probes.PlaneProbe("planeProbe", str(output_path), 100, 1, 500, 100) +plane_probe.set_probe_plane(5*reference_diameter, 0, 0, dx, length[1], length[2]) +para.add_probe(plane_probe) +#%% +sim = gpu.Simulation(para, cuda_memory_manager, comm, grid_generator) +#%% +sim.run() +MPI.Finalize() \ No newline at end of file diff --git a/Python/actuator_line/config.txt b/Python/actuator_line/config.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4c778c4cc048f54c0a32310e6bf4a7343a263fa --- /dev/null +++ b/Python/actuator_line/config.txt @@ -0,0 +1,2 @@ +Path = . +GridPath = . diff --git a/Python/boundary_layer/__init__.py b/Python/boundary_layer/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Python/boundary_layer/boundary_layer.py b/Python/boundary_layer/boundary_layer.py new file mode 100644 index 0000000000000000000000000000000000000000..1c01f50946b49bc0ddab7e50065a24aab4ae869f --- /dev/null +++ b/Python/boundary_layer/boundary_layer.py @@ -0,0 +1,133 @@ +#%% +import numpy as np +from pathlib import Path +from mpi4py import MPI +from pyfluids import basics, gpu, logger +#%% +reference_height = 1000 # boundary layer height in m + +length = np.array([6,4,1])*reference_height +viscosity = 1.56e-5 +mach = 0.1 +nodes_per_height = 32 + +z_0 = 0.1 +u_star = 0.4 +kappa = 0.4 + +velocity = 0.5*u_star/kappa*np.log(length[2]/z_0+1) +flow_through_time = length[0]/velocity +use_AMD = True + + +sim_name = "BoundaryLayer" +config_file = Path(__file__).parent/Path("config.txt") +output_path = Path(__file__).parent/Path("output") +output_path.mkdir(exist_ok=True) +t_out = 1000. +t_end = 5000. + +t_start_averaging = 0 +t_start_tmp_averaging = 100_000 +t_averaging = 200 +t_start_out_probe = 0 +t_out_probe = 1000 + +#%% +logger.Logger.initialize_logger() +basics.logger.Logger.add_stdout() +basics.logger.Logger.set_debug_level(basics.logger.Level.INFO_LOW) +basics.logger.Logger.time_stamp(basics.logger.TimeStamp.ENABLE) +basics.logger.Logger.enable_printed_rank_numbers(True) +# %% +comm = gpu.Communicator.get_instance() +#%% +grid_factory = gpu.grid_generator.GridFactory.make() +grid_builder = gpu.grid_generator.MultipleGridBuilder.make_shared(grid_factory) + +#%% +dx = reference_height/nodes_per_height +dt = dx * mach / (np.sqrt(3) * velocity) +velocity_lb = velocity * dt / dx # LB units +viscosity_lb = viscosity * dt / (dx * dx) # LB units + +pressure_gradient = u_star**2 / reference_height +pressure_gradient_lb = pressure_gradient * dt**2 / dx + +logger.vf_log_info(f"velocity = {velocity_lb:1.6} dx/dt") +logger.vf_log_info(f"dt = {dt:1.6}") +logger.vf_log_info(f"dx = {dx:1.6}") +logger.vf_log_info(f"u* = {u_star:1.6}") +logger.vf_log_info(f"dpdx = {pressure_gradient:1.6}") +logger.vf_log_info(f"dpdx = {pressure_gradient_lb:1.6} dx/dt^2") +logger.vf_log_info(f"viscosity = {viscosity_lb:1.6} dx^2/dt") + + +#%% +config = basics.ConfigurationFile() +config.load(str(config_file)) +#%% +para = gpu.Parameter(config, comm.get_number_of_process(), comm.get_pid()) + + + +#%% +para.set_devices([0]) +para.set_output_prefix(sim_name) +para.set_output_path(str(output_path)) +para.set_f_name(para.get_output_path() + "/" + para.get_output_prefix()) +para.set_print_files(True) +para.set_max_level(1) +#%% +para.set_velocity(velocity_lb) +para.set_viscosity(viscosity_lb) +para.set_velocity_ratio(dx/dt) +para.set_viscosity_ratio(dx*dx/dt) +para.set_use_AMD(use_AMD) + +para.set_main_kernel("TurbulentViscosityCumulantK17CompChim" if para.get_use_AMD() else "CummulantK17CompChim") + +para.set_SGS_constant(0.083) + +def init_func(coord_x, coord_y, coord_z): + return [ + 0.0, + (u_star/kappa*np.log(max(coord_z/z_0,0)+1) + 2*np.sin(np.pi*16*coord_x/length[0])*np.sin(np.pi*8*coord_z/length[2]))/((coord_z/reference_height)**2+0.1)*dt/dx, + 2*np.sin(np.pi*16*coord_x/length[0])*np.sin(np.pi*8*coord_z/length[2])/((coord_z/reference_height)**2+0.1)*dt/dx, + 8*u_star/kappa*(np.sin(np.pi*8*coord_y/reference_height)*np.sin(np.pi*8*coord_z/reference_height)+np.sin(np.pi*8*coord_x/length[0]))/((length[2]/2-coord_z)**2+0.1)*dt/dx + ] + +para.set_initial_condition(init_func) +para.set_t_out(int(t_out/dt)) +para.set_t_end(int(t_end/dt)) +para.set_is_body_force(True) +para.set_has_wall_model_monitor(True) + + +grid_builder.add_coarse_grid(0.0, 0.0, 0.0, *length, dx) +grid_builder.set_periodic_boundary_condition(True, True, False) +grid_builder.build_grids(basics.LbmOrGks.LBM, False) +#%% +sampling_offset = 2 +grid_builder.set_stress_boundary_condition(gpu.SideType.MZ, 0.0, 0.0, 1.0, sampling_offset, z_0/dx) +grid_builder.set_slip_boundary_condition(gpu.SideType.PZ, 0.0, 0.0, 0.0) + +#%% +cuda_memory_manager = gpu.CudaMemoryManager(para) +grid_generator = gpu.GridProvider.make_grid_generator(grid_builder, para, cuda_memory_manager, comm) + +#%% +wall_probe = gpu.probes.WallModelProbe("wallModelProbe", str(output_path), int(t_start_averaging/dt), int(t_start_tmp_averaging/dt), int(t_averaging/dt/4), int(t_start_out_probe/dt), int(t_out_probe/dt)) +wall_probe.add_all_available_statistics() +wall_probe.set_file_name_to_n_out() +wall_probe.set_force_output_to_stress(True) +if para.get_is_body_force(): + wall_probe.set_evaluate_pressure_gradient(True) +planar_probe = gpu.probes.PlanarAverageProbe("planarAverageProbe", str(output_path), int(t_start_averaging/dt), int(t_start_tmp_averaging/dt), int(t_averaging/dt), int(t_start_out_probe/dt), int(t_out_probe/dt), "z") +para.add_probe(wall_probe) + +#%% +sim = gpu.Simulation(para, cuda_memory_manager, comm, grid_generator) +#%% +sim.run() +MPI.Finalize() \ No newline at end of file diff --git a/Python/boundary_layer/config.txt b/Python/boundary_layer/config.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4c778c4cc048f54c0a32310e6bf4a7343a263fa --- /dev/null +++ b/Python/boundary_layer/config.txt @@ -0,0 +1,2 @@ +Path = . +GridPath = . diff --git a/Python/cubeflow/simulation.py b/Python/cubeflow/simulation.py index c8c145fdc27b5eab6a6e2df95d94f27999b6e258..9e77e8d747c072188d8d81150afa8e2ccb76a792 100644 --- a/Python/cubeflow/simulation.py +++ b/Python/cubeflow/simulation.py @@ -1,9 +1,9 @@ -from pyfluids import Simulation -from pyfluids.boundaryconditions import NoSlipBoundaryCondition, VelocityBoundaryCondition, DensityBoundaryCondition -from pyfluids.geometry import GbCuboid3D -from pyfluids.kernel import LBMKernel, KernelType -from pyfluids.parameters import PhysicalParameters, RuntimeParameters, GridParameters -from pyfluids.writer import Writer, OutputFormat +from pyfluids.cpu import Simulation +from pyfluids.cpu.boundaryconditions import NoSlipBoundaryCondition, VelocityBoundaryCondition, DensityBoundaryCondition +from pyfluids.cpu.geometry import GbCuboid3D +from pyfluids.cpu.kernel import LBMKernel, KernelType +from pyfluids.cpu.parameters import PhysicalParameters, RuntimeParameters, GridParameters +from pyfluids.cpu.writer import Writer, OutputFormat from pymuparser import Parser import os diff --git a/Python/liddrivencavity/simulation.py b/Python/liddrivencavity/simulation.py index f5e5921a3a163c8f5d2421c833ccc993eb5430c0..155fad2f6f8aade0368c8a7006b88f7985f8822c 100644 --- a/Python/liddrivencavity/simulation.py +++ b/Python/liddrivencavity/simulation.py @@ -1,9 +1,9 @@ -from pyfluids import Simulation -from pyfluids.boundaryconditions import NoSlipBoundaryCondition, VelocityBoundaryCondition -from pyfluids.geometry import GbCuboid3D -from pyfluids.kernel import LBMKernel, KernelType -from pyfluids.parameters import GridParameters, PhysicalParameters, RuntimeParameters -from pyfluids.writer import Writer, OutputFormat +from pyfluids.cpu import Simulation +from pyfluids.cpu.boundaryconditions import NoSlipBoundaryCondition, VelocityBoundaryCondition +from pyfluids.cpu.geometry import GbCuboid3D +from pyfluids.cpu.kernel import LBMKernel, KernelType +from pyfluids.cpu.parameters import GridParameters, PhysicalParameters, RuntimeParameters +from pyfluids.cpu.writer import Writer, OutputFormat from pymuparser import Parser runtime_params = RuntimeParameters() diff --git a/Python/poiseuille/poiseuille_hpc.py b/Python/poiseuille/poiseuille_hpc.py index b9bf67531f3b760bacc1912dc39b57d8b594253c..f5f5a1387c9fe234abae0c6f979cc7d5b283d1a4 100644 --- a/Python/poiseuille/poiseuille_hpc.py +++ b/Python/poiseuille/poiseuille_hpc.py @@ -1,5 +1,5 @@ from poiseuille.simulation import run_simulation -from pyfluids.parameters import * +from pyfluids.cpu.parameters import * grid_parameters = GridParameters() grid_parameters.number_of_nodes_per_direction = [64, 64, 512] diff --git a/Python/poiseuille/simulation.py b/Python/poiseuille/simulation.py index 31ceb1ab9ef90fa4fd606bde4f47c45b8f7d7567..d107801fa84cfe16d1d7e91d31dc3ff4b8671f02 100644 --- a/Python/poiseuille/simulation.py +++ b/Python/poiseuille/simulation.py @@ -1,9 +1,9 @@ -from pyfluids import Simulation -from pyfluids.boundaryconditions import NoSlipBoundaryCondition -from pyfluids.geometry import GbCuboid3D, State -from pyfluids.kernel import LBMKernel, KernelType -from pyfluids.parameters import RuntimeParameters, GridParameters, PhysicalParameters -from pyfluids.writer import Writer, OutputFormat +from pyfluids.cpu import Simulation +from pyfluids.cpu.boundaryconditions import NoSlipBoundaryCondition +from pyfluids.cpu.geometry import GbCuboid3D, State +from pyfluids.cpu.kernel import LBMKernel, KernelType +from pyfluids.cpu.parameters import RuntimeParameters, GridParameters, PhysicalParameters +from pyfluids.cpu.writer import Writer, OutputFormat default_grid_params = GridParameters() default_grid_params.node_distance = 10 / 32 diff --git a/Python/poiseuille/test_poiseuille_l2.py b/Python/poiseuille/test_poiseuille_l2.py index 39c8b6dffe05e3c352e7fd340857e43d8d5a3dc8..93aa2600d5260dea7e72f3aa98db7334fe5285c6 100644 --- a/Python/poiseuille/test_poiseuille_l2.py +++ b/Python/poiseuille/test_poiseuille_l2.py @@ -5,8 +5,8 @@ import unittest import matplotlib.pyplot as plt import numpy as np import pyvista as pv -from pyfluids.kernel import LBMKernel, KernelType -from pyfluids.parameters import GridParameters, PhysicalParameters, RuntimeParameters +from pyfluids.cpu.kernel import LBMKernel, KernelType +from pyfluids.cpu.parameters import GridParameters, PhysicalParameters, RuntimeParameters from scipy import stats from errors import normalized_l2_error diff --git a/Python/tests/test_acousticscaling.py b/Python/tests/test_acousticscaling.py index 2da5314529f9559f9ac316f2d1bb3f1a9d0e1211..6413123a80db8c5882fcf1dbe6f72a1f5438736c 100644 --- a/Python/tests/test_acousticscaling.py +++ b/Python/tests/test_acousticscaling.py @@ -1,8 +1,8 @@ import unittest from typing import List -from pyfluids.kernel import LBMKernel, KernelType -from pyfluids.parameters import GridParameters, PhysicalParameters, RuntimeParameters +from pyfluids.cpu.kernel import LBMKernel, KernelType +from pyfluids.cpu.parameters import GridParameters, PhysicalParameters, RuntimeParameters from acousticscaling import OneDirectionalAcousticScaling diff --git a/Python/tests/test_boundaryconditions.py b/Python/tests/test_boundaryconditions.py index 5a7d61f36337398fc5621540951f15b72262b17b..e004ddfa21c78ea3d63a89f5dbc3bd7438a18ff1 100644 --- a/Python/tests/test_boundaryconditions.py +++ b/Python/tests/test_boundaryconditions.py @@ -1,5 +1,5 @@ import unittest -from pyfluids.boundaryconditions import * +from pyfluids.cpu.boundaryconditions import * class BoundaryConditionsTest(unittest.TestCase): diff --git a/Python/tests/test_geometry.py b/Python/tests/test_geometry.py index 5e953f58b4b24393ae3a8f2994184c9c7f27eca3..5bb89eb245b6055653b78fde381da050d402b0cc 100644 --- a/Python/tests/test_geometry.py +++ b/Python/tests/test_geometry.py @@ -1,6 +1,6 @@ import unittest -from pyfluids.geometry import * +from pyfluids.cpu.geometry import * class TestGeometry(unittest.TestCase): diff --git a/Python/tests/test_kernel.py b/Python/tests/test_kernel.py index b1016f15308a77c9025787e061355819cbca3874..8f58a1c869f9e292856268d43245a75f1dcfe213 100644 --- a/Python/tests/test_kernel.py +++ b/Python/tests/test_kernel.py @@ -1,6 +1,6 @@ import unittest -from pyfluids.kernel import LBMKernel, KernelType +from pyfluids.cpu.kernel import LBMKernel, KernelType class TestLBMKernel(unittest.TestCase): diff --git a/README.md b/README.md index b9d60ed3d1955f2fe0728ca92d8ec7f6b8846a06..9e02f019a98078c19f7c6a61a029e9f4d8f97434 100644 --- a/README.md +++ b/README.md @@ -2,33 +2,33 @@ VirtualFluids (VF) is a research code developed at the Institute for Computational Modeling in Civil Engineering (iRMB). The code is a Computational Fluid Dynamics (CFD) solver based on the Lattice Boltzmann Method (LBM) for turbulent, thermal, multiphase and multicomponent flow problems as well as for multi-field problems such as Fluid-Structure-interaction including distributed pre- and postprocessing capabilities for simulations with more than 100 billion degrees of freedom. -## Getting Start -### Suported Platforms -VirtualFluids has been used on a variety of platforms: +## Getting Started +VirtualFluids is mainly supported on these two platforms: - Linux - - Mac OS X - Windows - - Cygwin + +VirtualFluids can also be build and used in a Docker image. An ubuntu development environment is located in the [container registry](https://git.rz.tu-bs.de/irmb/virtualfluids/container_registry). +An extensive guide about the usage and development in VirtualFluids with docker can be found [here](https://git.rz.tu-bs.de/irmb/virtualfluids/-/wikis/Getting-Started-with-the-Development-of-VirtualFluids). + + +The following is a brief explanation of how to use it without Docker: ### Software Requirements - + - [CMake](https://cmake.org/) (minimum version 3.15) - C++ compiler with C++14 support - - [Paraview](https://www.paraview.org/) (most recent version) + - [Paraview](https://www.paraview.org/) for visualizations (most recent version) -with usage of the GPU: + +with usage of the GPU: - CUDA [developer.nvidia.com/cuda-zone](https://developer.nvidia.com/cuda-zone): * Minimum CUDA Version 9.0 * Minimum Compute Capability 3.0, because of maximal number of Blocks in x direction * Recommended Compute Capability 6.0, because of atomics for double precision floating point data (GKS only) - -### Contributing -To contribute to VirtualFluids please follow these [instructions](CONTRIBUTING.md). ### Build VirtualFluids ```shell -$ mkdir build -$ cd build +$ mkdir build && cd build ``` Pass the relevant [options](#options) to cmake. E.g. for the CPU part: @@ -41,11 +41,11 @@ Alternatively enable the options via the cmake-gui. ### <a id="options"></a> Options - BUILD_VF_CPU - Build VirtualFluids CPU variant -- BUILD_VF_GPU +- BUILD_VF_GPU - Build VirtualFluids GPU variant - BUILD_VF_UNIT_TESTS - Build VirtualFluids unit tests -- VF_DOUBLE_ACCURACY +- BUILD_VF_DOUBLE_ACCURACY - GPU change between Double and Single Precision ### Result Files @@ -55,14 +55,15 @@ The CPU part generates a set of multiple output directories in the prescribed ou A GPU computation generates a the time series of output files directly in the output path. In Paraview these time series can be read directly. - +## Contributing +To contribute to VirtualFluids please follow these [instructions](CONTRIBUTING.md). ## Documentation The doxygen generated documentation can be found [here](https://irmb.gitlab-pages.rz.tu-bs.de/VirtualFluids_dev). ## Known Issues -If you notice any problems on your platform, please report an [issue](https://git.rz.tu-bs.de/irmb/virtualfluids/-/issues/new). +If you notice any problems on your platform, please report an [issue](https://git.rz.tu-bs.de/irmb/virtualfluids/-/issues/new). ## Authors diff --git a/apps/gpu/HULC/main.cpp b/apps/gpu/HULC/main.cpp index 8a0e6f6a8363e579ad0821d8b8f9995e11eabc3e..80f8ba4c62b3b0af08425f839d0f802a568db034 100644 --- a/apps/gpu/HULC/main.cpp +++ b/apps/gpu/HULC/main.cpp @@ -59,7 +59,7 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input para->setDevices(StringUtil::toIntVector(input->getValue("Devices"))); para->setOutputPath(_path); para->setOutputPrefix(_prefix); - para->setFName(_path + "/" + _prefix); + para->setPathAndFilename(_path + "/" + _prefix); para->setPrintFiles(false); para->setPrintFiles(StringUtil::toBool(input->getValue("WriteGrid"))); para->setGeometryValues(StringUtil::toBool(input->getValue("GeometryValues"))); @@ -73,9 +73,9 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input para->setUseWale(StringUtil::toBool(input->getValue("UseWale"))); para->setSimulatePorousMedia(StringUtil::toBool(input->getValue("SimulatePorousMedia"))); para->setD3Qxx(StringUtil::toInt(input->getValue("D3Qxx"))); - para->setTEnd(StringUtil::toInt(input->getValue("TimeEnd"))); - para->setTOut(StringUtil::toInt(input->getValue("TimeOut"))); - para->setTStartOut(StringUtil::toInt(input->getValue("TimeStartOut"))); + para->setTimestepEnd(StringUtil::toInt(input->getValue("TimeEnd"))); + para->setTimestepOut(StringUtil::toInt(input->getValue("TimeOut"))); + para->setTimestepStartOut(StringUtil::toInt(input->getValue("TimeStartOut"))); para->setTimeCalcMedStart(StringUtil::toInt(input->getValue("TimeStartCalcMedian"))); para->setTimeCalcMedEnd(StringUtil::toInt(input->getValue("TimeEndCalcMedian"))); para->setPressInID(StringUtil::toInt(input->getValue("PressInID"))); @@ -90,8 +90,8 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input para->setTemperatureInit(StringUtil::toFloat(input->getValue("Temp"))); para->setTemperatureBC(StringUtil::toFloat(input->getValue("TempBC"))); ////////////////////////////////////////////////////////////////////////// - para->setViscosity(StringUtil::toFloat(input->getValue("Viscosity_LB"))); - para->setVelocity(StringUtil::toFloat(input->getValue("Velocity_LB"))); + para->setViscosityLB(StringUtil::toFloat(input->getValue("Viscosity_LB"))); + para->setVelocityLB(StringUtil::toFloat(input->getValue("Velocity_LB"))); para->setViscosityRatio(StringUtil::toFloat(input->getValue("Viscosity_Ratio_World_to_LB"))); para->setVelocityRatio(StringUtil::toFloat(input->getValue("Velocity_Ratio_World_to_LB"))); para->setDensityRatio(StringUtil::toFloat(input->getValue("Density_Ratio_World_to_LB"))); @@ -335,7 +335,7 @@ void multipleLevel(const std::string& configPath) //gridBuilder->writeGridToVTK("D:/GRIDGENERATION/gridTest_level_2", 2); SPtr<Parameter> para = Parameter::make(); - SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para); + SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, communicator); //SPtr<GridProvider> gridGenerator = GridProvider::makeGridReader(false, para); std::ifstream stream; diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp index be0ec6d5717e094dc9cb5ad478315813b9ee68e6..58e5aede18b9c4197b4d21b129c6347023b9390e 100644 --- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp +++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp @@ -47,9 +47,7 @@ #include "VirtualFluids_GPU/PreCollisionInteractor/ActuatorLine.h" #include "VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h" #include "VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.h" - -#include "VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h" -#include "VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" @@ -83,7 +81,7 @@ std::string path("."); std::string simulationName("ActuatorLine"); -const uint timeStepOut = 500; +const float tOut = 100; const float tEnd = 280; // total time of simulation in s //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -97,7 +95,11 @@ void multipleLevel(const std::string& configPath) logging::Logger::timeStamp(logging::Logger::ENABLE); logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - auto gridBuilder = MultipleGridBuilder::makeShared(); + vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); + + auto gridFactory = GridFactory::make(); + gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); + auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -114,13 +116,11 @@ void multipleLevel(const std::string& configPath) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); - vf::basics::ConfigurationFile config; config.load(configPath); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////^ - SPtr<Parameter> para = std::make_shared<Parameter>(config, communicator.getNummberOfProcess(), communicator.getPID()); - + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNummberOfProcess(), communicator.getPID(), &config); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// const real dt = dx * mach / (sqrt(3) * velocity); @@ -138,17 +138,15 @@ void multipleLevel(const std::string& configPath) para->setOutputPrefix( simulationName ); - para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix()); - para->setPrintFiles(true); para->setMaxLevel(1); - para->setVelocity(velocityLB); - para->setViscosity(viscosityLB); + para->setVelocityLB(velocityLB); + para->setViscosityLB(viscosityLB); para->setVelocityRatio( dx / dt ); - + para->setViscosityRatio( dx*dx/dt ); para->setMainKernel("CumulantK17CompChim"); para->setInitialCondition([&](real coordX, real coordY, real coordZ, real &rho, real &vx, real &vy, real &vz) { @@ -158,25 +156,25 @@ void multipleLevel(const std::string& configPath) vz = (real)0.0; }); - para->setTOut( timeStepOut ); - para->setTEnd( uint(tEnd/dt) ); + para->setTimestepOut( uint(tOut/dt) ); + para->setTimestepEnd( uint(tEnd/dt) ); para->setIsBodyForce( true ); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// gridBuilder->setVelocityBoundaryCondition(SideType::MX, velocityLB, 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::PX, velocityLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, velocityLB, 0.0, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::PY, velocityLB, 0.0, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::MZ, velocityLB, 0.0, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::PZ, velocityLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - SPtr<CudaMemoryManager> cudaMemoryManager = CudaMemoryManager::make(para); + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); - SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real turbPos[3] = {3*reference_diameter, 3*reference_diameter, 3*reference_diameter}; real epsilon = 5.f; // width of gaussian smearing @@ -185,36 +183,32 @@ void multipleLevel(const std::string& configPath) uint nBlades = 3; uint nBladeNodes = 32; - SPtr<ActuatorLine> actuator_line =SPtr<ActuatorLine>( new ActuatorLine(nBlades, density, nBladeNodes, epsilon, turbPos[0], turbPos[1], turbPos[2], reference_diameter, level, dt, dx) ); para->addActuator( actuator_line ); - SPtr<PointProbe> pointProbe = SPtr<PointProbe>( new PointProbe("pointProbe", 100, 500, 100) ); + SPtr<PointProbe> pointProbe = SPtr<PointProbe>( new PointProbe("pointProbe", para->getOutputPath(), 100, 1, 500, 100) ); std::vector<real> probeCoordsX = {reference_diameter,2*reference_diameter,5*reference_diameter}; std::vector<real> probeCoordsY = {3*reference_diameter,3*reference_diameter,3*reference_diameter}; std::vector<real> probeCoordsZ = {3*reference_diameter,3*reference_diameter,3*reference_diameter}; pointProbe->addProbePointsFromList(probeCoordsX, probeCoordsY, probeCoordsZ); // pointProbe->addProbePointsFromXNormalPlane(2*D, 0.0, 0.0, L_y, L_z, (uint)L_y/dx, (uint)L_z/dx); - pointProbe->addPostProcessingVariable(PostProcessingVariable::Means); - pointProbe->addPostProcessingVariable(PostProcessingVariable::Variances); + + pointProbe->addStatistic(Statistic::Means); + pointProbe->addStatistic(Statistic::Variances); para->addProbe( pointProbe ); - SPtr<PlaneProbe> planeProbe = SPtr<PlaneProbe>( new PlaneProbe("planeProbe", 100, 500, 100) ); + SPtr<PlaneProbe> planeProbe = SPtr<PlaneProbe>( new PlaneProbe("planeProbe", para->getOutputPath(), 100, 500, 100, 100) ); planeProbe->setProbePlane(5*reference_diameter, 0, 0, dx, L_y, L_z); - planeProbe->addPostProcessingVariable(PostProcessingVariable::Means); + planeProbe->addStatistic(Statistic::Means); para->addProbe( planeProbe ); + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); + auto gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); - Simulation sim(communicator); - SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter()); - SPtr<KernelFactoryImp> kernelFactory = KernelFactoryImp::getInstance(); - SPtr<PreProcessorFactoryImp> preProcessorFactory = PreProcessorFactoryImp::getInstance(); - sim.setFactories(kernelFactory, preProcessorFactory); - sim.init(para, gridGenerator, fileWriter, cudaMemoryManager); + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory); sim.run(); - sim.free(); } int main( int argc, char* argv[]) @@ -234,11 +228,11 @@ int main( int argc, char* argv[]) } catch (const std::bad_alloc& e) - { + { VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); } catch (const std::exception& e) - { + { VF_LOG_CRITICAL("exception: {}", e.what()); } catch (...) diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt index 3b590b29f71f7e965828f3821608e0013fb281b1..233994f0d32a48190d84f7044500e24b06b926a9 100644 --- a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt +++ b/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt @@ -1,8 +1,8 @@ ################################################## #informations for Writing ################################################## -Path = "." +Path = . ################################################## #informations for reading ################################################## -GridPath="." +GridPath=. diff --git a/apps/gpu/LBM/Basel/main.cpp b/apps/gpu/LBM/Basel/main.cpp index 8d09c8a7a6996eecb5be84be54fd72f8ca1b014a..8dc1e456ab89f88ddb36bf050f81ede37610d0c8 100644 --- a/apps/gpu/LBM/Basel/main.cpp +++ b/apps/gpu/LBM/Basel/main.cpp @@ -29,6 +29,7 @@ #include "VirtualFluids_GPU/Parameter/Parameter.h" #include "VirtualFluids_GPU/Output/FileWriter.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include "global.h" @@ -86,6 +87,7 @@ void multipleLevel(const std::string& configPath) Communicator* comm = Communicator::getInstanz(); SPtr<Parameter> para = Parameter::make(configData, comm); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); SPtr<CudaMemoryManager> cudaMemManager = CudaMemoryManager::make(para); SPtr<GridProvider> gridGenerator; @@ -138,12 +140,14 @@ void multipleLevel(const std::string& configPath) gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); //no forcing - gridBuilder->setPressureBoundaryCondition(SideType::PY, 0.0); - gridBuilder->setPressureBoundaryCondition(SideType::MY, 0.0); + // gridBuilder->setPressureBoundaryCondition(SideType::PY, 0.0); + // gridBuilder->setPressureBoundaryCondition(SideType::MY, 0.0); - gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); - gridBuilder->setPressureBoundaryCondition(SideType::MX, 0.0); + // gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); + // gridBuilder->setPressureBoundaryCondition(SideType::MX, 0.0); + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); ////////////////////////////////////////////////////////////////////////// //Merged for Wind in X Direction //gridBuilder->writeGridsToVtk(gridpath + "/grids/BaselUni/Basel_Grid"); @@ -181,7 +185,7 @@ void multipleLevel(const std::string& configPath) return; - gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemManager); + gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemManager, communicator); //gridGenerator = GridGenerator::make(gridBuilder, para); } diff --git a/apps/gpu/LBM/BaselMultiGPU/main.cpp b/apps/gpu/LBM/BaselMultiGPU/main.cpp index 70bd37403a52ce68cfa23adf23ea3f7fcbe2805e..454f0d261e5a01d049bf5593bcf2a7036856b7ab 100644 --- a/apps/gpu/LBM/BaselMultiGPU/main.cpp +++ b/apps/gpu/LBM/BaselMultiGPU/main.cpp @@ -29,6 +29,7 @@ #include "VirtualFluids_GPU/Parameter/Parameter.h" #include "VirtualFluids_GPU/Output/FileWriter.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include "global.h" @@ -83,6 +84,7 @@ void multipleLevel(const std::string& configPath) Communicator* comm = Communicator::getInstanz(); SPtr<Parameter> para = Parameter::make(configData, comm); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); SPtr<CudaMemoryManager> cudaMemManager = CudaMemoryManager::make(para); SPtr<GridProvider> gridGenerator; @@ -168,6 +170,8 @@ void multipleLevel(const std::string& configPath) gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + if (generatePart == 0 || generatePart == 3) gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); if (generatePart == 1 || generatePart == 2) gridBuilder->setPressureBoundaryCondition(SideType::MX, 0.0); if (generatePart == 2 || generatePart == 3) gridBuilder->setPressureBoundaryCondition(SideType::PY, 0.0); @@ -197,7 +201,7 @@ void multipleLevel(const std::string& configPath) return; - gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemManager); + gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemManager, communicator); //gridGenerator = GridGenerator::make(gridBuilder, para); } diff --git a/apps/gpu/LBM/BaselNU/main.cpp b/apps/gpu/LBM/BaselNU/main.cpp index 0ad52a4bb1398f08fccca8d7b4dfd3736614b8db..f3a3122ed92b410df56dff719878096692625d89 100644 --- a/apps/gpu/LBM/BaselNU/main.cpp +++ b/apps/gpu/LBM/BaselNU/main.cpp @@ -29,6 +29,7 @@ #include "VirtualFluids_GPU/Parameter/Parameter.h" #include "VirtualFluids_GPU/Output/FileWriter.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include "global.h" @@ -82,6 +83,7 @@ void multipleLevel(const std::string& configPath) Communicator* comm = Communicator::getInstanz(); SPtr<Parameter> para = Parameter::make(configData, comm); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); SPtr<CudaMemoryManager> cudaMemManager = CudaMemoryManager::make(para); SPtr<GridProvider> gridGenerator; @@ -141,11 +143,13 @@ void multipleLevel(const std::string& configPath) gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); //no forcing - gridBuilder->setPressureBoundaryCondition(SideType::PY, 0.0); - gridBuilder->setPressureBoundaryCondition(SideType::MY, 0.0); + // gridBuilder->setPressureBoundaryCondition(SideType::PY, 0.0); + // gridBuilder->setPressureBoundaryCondition(SideType::MY, 0.0); - gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); - gridBuilder->setPressureBoundaryCondition(SideType::MX, 0.0); + // gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); + // gridBuilder->setPressureBoundaryCondition(SideType::MX, 0.0); + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); ////////////////////////////////////////////////////////////////////////// //Merged for Wind in X Direction @@ -170,7 +174,7 @@ void multipleLevel(const std::string& configPath) return; - gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemManager); + gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemManager, communicator); //gridGenerator = GridGenerator::make(gridBuilder, para); } diff --git a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..991025b649d69305c030fe2f1dd1763a2137af9b --- /dev/null +++ b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp @@ -0,0 +1,266 @@ + +#define _USE_MATH_DEFINES +#include <math.h> +#include <string> +#include <sstream> +#include <iostream> +#include <stdexcept> +#include <fstream> +#include <exception> +#include <memory> + +////////////////////////////////////////////////////////////////////////// + +#include "Core/DataTypes.h" +#include "PointerDefinitions.h" + +#include "Core/StringUtilities/StringUtil.h" + +#include "Core/VectorTypes.h" + +#include <basics/config/ConfigurationFile.h> + +#include <logger/Logger.h> + + +////////////////////////////////////////////////////////////////////////// + +#include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" +#include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" +#include "GridGenerator/grid/BoundaryConditions/Side.h" +#include "GridGenerator/grid/GridFactory.h" + +#include "GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h" +#include "GridGenerator/io/GridVTKWriter/GridVTKWriter.h" +#include "GridGenerator/io/STLReaderWriter/STLReader.h" +#include "GridGenerator/io/STLReaderWriter/STLWriter.h" + +////////////////////////////////////////////////////////////////////////// + +#include "VirtualFluids_GPU/LBM/Simulation.h" +#include "VirtualFluids_GPU/Communication/Communicator.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" +#include "VirtualFluids_GPU/Output/FileWriter.h" +#include "VirtualFluids_GPU/PreCollisionInteractor/ActuatorLine.h" +#include "VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h" +#include "VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.h" +#include "VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.h" +#include "VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" +#include "VirtualFluids_GPU/TurbulenceModels/TurbulenceModelFactory.h" + +#include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +std::string path("."); + +std::string simulationName("BoundayLayer"); + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + +void multipleLevel(const std::string& configPath) +{ + + logging::Logger::addStream(&std::cout); + logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); + logging::Logger::timeStamp(logging::Logger::ENABLE); + logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); + + auto gridFactory = GridFactory::make(); + auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); + + vf::basics::ConfigurationFile config; + config.load(configPath); + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////^ + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNummberOfProcess(), communicator.getPID(), &config); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // U s e r s e t t i n g s + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + LbmOrGks lbmOrGks = LBM; + + const real H = 1000.0; // boundary layer height in m + + const real L_x = 6*H; + const real L_y = 4*H; + const real L_z = 1*H; + + const real z0 = 0.1; // roughness length in m + const real u_star = 0.4; //friction velocity in m/s + const real kappa = 0.4; // von Karman constant + + const real viscosity = 1.56e-5; + + const real velocity = 0.5*u_star/kappa*log(L_z/z0); //0.5 times max mean velocity at the top in m/s + + const real mach = config.contains("Ma")? config.getValue<real>("Ma"): 0.1; + + const uint nodes_per_H = config.contains("nz")? config.getValue<uint>("nz"): 64; + + // all in s + const float tStartOut = config.getValue<real>("tStartOut"); + const float tOut = config.getValue<real>("tOut"); + const float tEnd = config.getValue<real>("tEnd"); // total time of simulation + + const float tStartAveraging = config.getValue<real>("tStartAveraging"); + const float tStartTmpAveraging = config.getValue<real>("tStartTmpAveraging"); + const float tAveraging = config.getValue<real>("tAveraging"); + const float tStartOutProbe = config.getValue<real>("tStartOutProbe"); + const float tOutProbe = config.getValue<real>("tOutProbe"); + + + const real dx = L_z/real(nodes_per_H); + + const real dt = dx * mach / (sqrt(3) * velocity); + + const real velocityLB = velocity * dt / dx; // LB units + + const real viscosityLB = viscosity * dt / (dx * dx); // LB units + + const real pressureGradient = u_star * u_star / H ; + const real pressureGradientLB = pressureGradient * (dt*dt)/dx; // LB units + + VF_LOG_INFO("velocity [dx/dt] = {}", velocityLB); + VF_LOG_INFO("dt = {}", dt); + VF_LOG_INFO("dx = {}", dx); + VF_LOG_INFO("viscosity [10^8 dx^2/dt] = {}", viscosityLB*1e8); + VF_LOG_INFO("u* /(dx/dt) = {}", u_star*dt/dx); + VF_LOG_INFO("dpdx = {}", pressureGradient); + VF_LOG_INFO("dpdx /(dx/dt^2) = {}", pressureGradientLB); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + para->setOutputPrefix( simulationName ); + + para->setPrintFiles(true); + + para->setForcing(pressureGradientLB, 0, 0); + para->setVelocityLB(velocityLB); + para->setViscosityLB(viscosityLB); + para->setVelocityRatio( dx / dt ); + para->setViscosityRatio( dx*dx/dt ); + para->setDensityRatio( 1.0 ); + + para->setMainKernel("TurbulentViscosityCumulantK17CompChim"); + + para->setIsBodyForce( config.getValue<bool>("bodyForce") ); + + para->setTimestepStartOut(uint(tStartOut/dt) ); + para->setTimestepOut( uint(tOut/dt) ); + para->setTimestepEnd( uint(tEnd/dt) ); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + SPtr<TurbulenceModelFactory> tmFactory = SPtr<TurbulenceModelFactory>( new TurbulenceModelFactory(para) ); + tmFactory->readConfigFile( config ); + + // tmFactory->setTurbulenceModel(TurbulenceModel::AMD); + // tmFactory->setModelConstant(config.getValue<real>("SGSconstant")); + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + gridBuilder->addCoarseGrid(0.0, 0.0, 0.0, + L_x, L_y, L_z, dx); + // gridBuilder->setNumberOfLayers(12, 8); + + // gridBuilder->addGrid( new Cuboid( 0.0, 0.0, 0.0, L_x, L_y, 0.3*L_z) , 1 ); + // para->setMaxLevel(2); + + gridBuilder->setPeriodicBoundaryCondition(true, true, false); + + gridBuilder->buildGrids(lbmOrGks, false); // buildGrids() has to be called before setting the BCs!!!! + + uint samplingOffset = 2; + // gridBuilder->setVelocityBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); + gridBuilder->setStressBoundaryCondition(SideType::MZ, + 0.0, 0.0, 1.0, // wall normals + samplingOffset, z0/dx); // wall model settinng + para->setHasWallModelMonitor(true); + bcFactory.setStressBoundaryCondition(BoundaryConditionFactory::StressBC::StressPressureBounceBack); + + gridBuilder->setSlipBoundaryCondition(SideType::PZ, 0.0, 0.0, 0.0); + bcFactory.setSlipBoundaryCondition(BoundaryConditionFactory::SlipBC::SlipBounceBack); + + + real cPi = 3.1415926535897932384626433832795; + para->setInitialCondition([&](real coordX, real coordY, real coordZ, real &rho, real &vx, real &vy, real &vz) { + rho = (real)0.0; + vx = (u_star/0.4 * log(coordZ/z0) + 2.0*sin(cPi*16.0f*coordX/L_x)*sin(cPi*8.0f*coordZ/H)/(pow(coordZ/H,c2o1)+c1o1)) * dt / dx; + vy = 2.0*sin(cPi*16.0f*coordX/L_x)*sin(cPi*8.0f*coordZ/H)/(pow(coordZ/H,c2o1)+c1o1) * dt / dx; + vz = 8.0*u_star/0.4*(sin(cPi*8.0*coordY/H)*sin(cPi*8.0*coordZ/H)+sin(cPi*8.0*coordX/L_x))/(pow(L_z/2.0-coordZ, c2o1)+c1o1) * dt / dx; + }); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + SPtr<PlanarAverageProbe> planarAverageProbe = SPtr<PlanarAverageProbe>( new PlanarAverageProbe("planeProbe", para->getOutputPath(), tStartAveraging/dt, tStartTmpAveraging/dt, tAveraging/dt , tStartOutProbe/dt, tOutProbe/dt, 'z') ); + planarAverageProbe->addAllAvailableStatistics(); + planarAverageProbe->setFileNameToNOut(); + para->addProbe( planarAverageProbe ); + + para->setHasWallModelMonitor(true); + SPtr<WallModelProbe> wallModelProbe = SPtr<WallModelProbe>( new WallModelProbe("wallModelProbe", para->getOutputPath(), tStartAveraging/dt, tStartTmpAveraging/dt, tAveraging/dt/4.0 , tStartOutProbe/dt, tOutProbe/dt) ); + wallModelProbe->addAllAvailableStatistics(); + wallModelProbe->setFileNameToNOut(); + wallModelProbe->setForceOutputToStress(true); + if(para->getIsBodyForce()) + wallModelProbe->setEvaluatePressureGradient(true); + para->addProbe( wallModelProbe ); + + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); + auto gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); + + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory, tmFactory); + sim.run(); +} + +int main( int argc, char* argv[]) +{ + if ( argv != NULL ) + { + try + { + vf::logging::Logger::initalizeLogger(); + + if( argc > 1){ path = argv[1]; } + + multipleLevel(path + "/configBoundaryLayer.txt"); + } + catch (const spdlog::spdlog_ex &ex) { + std::cout << "Log initialization failed: " << ex.what() << std::endl; + } + + catch (const std::bad_alloc& e) + { + VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); + } + catch (const std::exception& e) + { + VF_LOG_CRITICAL("exception: {}", e.what()); + } + catch (...) + { + VF_LOG_CRITICAL("Unknown exception!"); + } + } + return 0; +} diff --git a/apps/gpu/LBM/BoundaryLayer/CMakeLists.txt b/apps/gpu/LBM/BoundaryLayer/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..801b634803943d48abda690935df0867eb3418d2 --- /dev/null +++ b/apps/gpu/LBM/BoundaryLayer/CMakeLists.txt @@ -0,0 +1,7 @@ +PROJECT(BoundaryLayer LANGUAGES CUDA CXX) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES BoundaryLayer.cpp) + +set_source_files_properties(BoundaryLayer.cpp PROPERTIES LANGUAGE CUDA) + +set_target_properties(BoundaryLayer PROPERTIES CUDA_SEPARABLE_COMPILATION ON) diff --git a/apps/gpu/LBM/BoundaryLayer/configBoundaryLayer.txt b/apps/gpu/LBM/BoundaryLayer/configBoundaryLayer.txt new file mode 100644 index 0000000000000000000000000000000000000000..a489f0ab89738a193b16fee41c212a5943f6525d --- /dev/null +++ b/apps/gpu/LBM/BoundaryLayer/configBoundaryLayer.txt @@ -0,0 +1,30 @@ +################################################## +#informations for Writing +################################################## +Path = . +################################################## +#informations for reading +################################################## +GridPath = . +################################################## +Devices = 1 +################################################## +tStartOut = 0 +tOut = 100000 +tEnd = 300000 +################################################## +tStartAveraging = 0 +tStartTmpAveraging = 100000 +tAveraging = 200 +tStartOutProbe = 0 +tOutProbe = 1000 +################################################## +Ma = 0.1 +nz = 96 + +bodyForce = true +UseAMD = true +SGSconstant = 0.2 +QuadricLimiterP = 100000.0 +QuadricLimiterM = 100000.0 +QuadricLimiterD = 100000.0 diff --git a/apps/gpu/LBM/ChannelFlow/CMakeLists.txt b/apps/gpu/LBM/ChannelFlow/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..f5b1bfd40dc723a7c050091d6d1c82d5f9addbd5 --- /dev/null +++ b/apps/gpu/LBM/ChannelFlow/CMakeLists.txt @@ -0,0 +1,7 @@ +PROJECT(ChannelFlow LANGUAGES CUDA CXX) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES ChannelFlow.cpp) + +set_source_files_properties(ChannelFlow.cpp PROPERTIES LANGUAGE CUDA) + +set_target_properties(ChannelFlow PROPERTIES CUDA_SEPARABLE_COMPILATION ON) diff --git a/apps/gpu/LBM/ChannelFlow/ChannelFlow.cpp b/apps/gpu/LBM/ChannelFlow/ChannelFlow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..98982f6d9da4c95ca12319f56ffcc4a1e83d33af --- /dev/null +++ b/apps/gpu/LBM/ChannelFlow/ChannelFlow.cpp @@ -0,0 +1,272 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ChannelFlow.cpp +//! \ingroup Applications +//! \author Anna Wellmann +//======================================================================================= +#include <numeric> +#define _USE_MATH_DEFINES +#include <exception> +#include <filesystem> +#include <fstream> +#include <iostream> +#include <memory> +#include <sstream> +#include <stdexcept> +#include <string> + +#include "mpi.h" + +////////////////////////////////////////////////////////////////////////// + +#include "Core/DataTypes.h" +#include "Core/LbmOrGks.h" +#include "Core/Logger/Logger.h" +#include "Core/VectorTypes.h" +#include "PointerDefinitions.h" +#include "config/ConfigurationFile.h" +#include "logger/Logger.h" + +////////////////////////////////////////////////////////////////////////// + +#include "GridGenerator/grid/BoundaryConditions/Side.h" +#include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" +#include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" +#include "GridGenerator/grid/GridFactory.h" + +#include "GridGenerator/geometries/Sphere/Sphere.h" +#include "GridGenerator/geometries/TriangularMesh/TriangularMesh.h" +#include "GridGenerator/utilities/communication.h" + +////////////////////////////////////////////////////////////////////////// + +#include "VirtualFluids_GPU/BoundaryConditions/BoundaryConditionFactory.h" +#include "VirtualFluids_GPU/Communication/Communicator.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" +#include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" +#include "VirtualFluids_GPU/LBM/Simulation.h" +#include "VirtualFluids_GPU/Output/FileWriter.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" + +////////////////////////////////////////////////////////////////////////// + +int main(int argc, char *argv[]) +{ + try { + ////////////////////////////////////////////////////////////////////////// + // Simulation parameters + ////////////////////////////////////////////////////////////////////////// + + const real channelWidth = 1.0; + const real Re = 10000.0; + const uint nx = 700; // 700 nodes need ~60 GB on A100 (single precision) + const real velocityLB = 0.05; // LB units + + const uint timeStepOut = 10000; + const uint timeStepEnd = 100000; + + ////////////////////////////////////////////////////////////////////////// + // setup simulation parameters (without config file) + ////////////////////////////////////////////////////////////////////////// + + vf::gpu::Communicator &communicator = vf::gpu::Communicator::getInstance(); + const int numberOfProcesses = communicator.getNummberOfProcess(); + SPtr<Parameter> para = std::make_shared<Parameter>(numberOfProcesses, communicator.getPID()); + std::vector<uint> devices(10); + std::iota(devices.begin(), devices.end(), 0); + para->setDevices(devices); + para->setMaxDev(communicator.getNummberOfProcess()); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); + + ////////////////////////////////////////////////////////////////////////// + // setup logger + ////////////////////////////////////////////////////////////////////////// + + std::ofstream logFile("output/log_process" + std::to_string(vf::gpu::Communicator::getInstance().getPID()) + + ".txt"); + logging::Logger::addStream(&logFile); + logging::Logger::addStream(&std::cout); + logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); + logging::Logger::timeStamp(logging::Logger::ENABLE); + logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); + + vf::logging::Logger::changeLogPath("output/vflog_process" + + std::to_string(vf::gpu::Communicator::getInstance().getPID()) + ".txt"); + vf::logging::Logger::initalizeLogger(); + + ////////////////////////////////////////////////////////////////////////// + // setup gridGenerator + ////////////////////////////////////////////////////////////////////////// + + auto gridFactory = GridFactory::make(); + gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); + auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + + ////////////////////////////////////////////////////////////////////////// + // create grid + ////////////////////////////////////////////////////////////////////////// + + const real yGridMin = 0.0 * channelWidth; + const real yGridMax = 1.0 * channelWidth; + const real zGridMin = 0.0 * channelWidth; + const real zGridMax = 1.0 * channelWidth; + + real dx = channelWidth / real(nx); + + ////////////////////////////////////////////////////////////////////////// + // compute parameters in lattice units + ////////////////////////////////////////////////////////////////////////// + + const real viscosityLB = (channelWidth / dx) * velocityLB / Re; // LB units + + VF_LOG_INFO("LB parameters:"); + VF_LOG_INFO("velocity LB [dx/dt] = {}", velocityLB); + VF_LOG_INFO("viscosity LB [dx/dt] = {}", viscosityLB); + + ////////////////////////////////////////////////////////////////////////// + // set parameters + ////////////////////////////////////////////////////////////////////////// + + para->setPrintFiles(true); + + para->setVelocityLB(velocityLB); + para->setViscosityLB(viscosityLB); + + para->setVelocityRatio((real)1.0); + para->setDensityRatio((real)1.0); + + para->setTimestepOut(timeStepOut); + para->setTimestepEnd(timeStepEnd); + + para->setOutputPrefix("ChannelFlow"); + para->setMainKernel("CumulantK17CompChimStream"); + + const uint generatePart = vf::gpu::Communicator::getInstance().getPID(); + real overlap = (real)8.0 * dx; + + if (numberOfProcesses > 1) { + + ////////////////////////////////////////////////////////////////////////// + // add coarse grids + ////////////////////////////////////////////////////////////////////////// + + real subdomainMinX = channelWidth * generatePart; + real subdomainMinXoverlap = subdomainMinX; + real subdomainMaxX = subdomainMinX + channelWidth; + real subdomainMaxXoverlap = subdomainMaxX; + + if (generatePart != 0) + subdomainMinXoverlap -= overlap; + + if (generatePart != numberOfProcesses - 1) + subdomainMaxXoverlap += overlap; + + gridBuilder->addCoarseGrid(subdomainMinXoverlap, yGridMin, zGridMin, subdomainMaxXoverlap, yGridMax, + zGridMax, dx); + + ////////////////////////////////////////////////////////////////////////// + // set subdomain dimensions + ////////////////////////////////////////////////////////////////////////// + + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(subdomainMinX, subdomainMaxX, yGridMin, yGridMax, zGridMin, zGridMax)); + + ////////////////////////////////////////////////////////////////////////// + // build grids + ////////////////////////////////////////////////////////////////////////// + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + + ////////////////////////////////////////////////////////////////////////// + // configure communication neighbors + ////////////////////////////////////////////////////////////////////////// + + if (generatePart != 0) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, generatePart - 1); + } + + if (generatePart != numberOfProcesses - 1) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, generatePart + 1); + } + + ////////////////////////////////////////////////////////////////////////// + // set boundary conditions + ////////////////////////////////////////////////////////////////////////// + + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + + if (generatePart == 0) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, velocityLB, 0.0, 0.0); + } + if (generatePart == numberOfProcesses - 1) { + gridBuilder->setPressureBoundaryCondition(SideType::PX, + 0.0); // set pressure boundary condition last + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); + } + gridBuilder->setNoSlipBoundaryCondition(SideType::MY); + gridBuilder->setNoSlipBoundaryCondition(SideType::PY); + gridBuilder->setNoSlipBoundaryCondition(SideType::MZ); + gridBuilder->setNoSlipBoundaryCondition(SideType::PZ); + bcFactory.setNoSlipBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + bcFactory.setVelocityBoundaryCondition( + BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); + } else { + VF_LOG_CRITICAL("This app has no setup for a single GPU"); + } + + ////////////////////////////////////////////////////////////////////////// + // setup to copy mesh to simulation + ////////////////////////////////////////////////////////////////////////// + + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); + SPtr<GridProvider> gridGenerator = + GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); + + ////////////////////////////////////////////////////////////////////////// + // run simulation + ////////////////////////////////////////////////////////////////////////// + + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory); + sim.run(); + + } catch (const spdlog::spdlog_ex &ex) { + std::cout << "Log initialization failed: " << ex.what() << std::endl; + } catch (const std::bad_alloc &e) { + VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); + } catch (const std::exception &e) { + VF_LOG_CRITICAL("exception: {}", e.what()); + } catch (...) { + VF_LOG_CRITICAL("Unknown exception!"); + } + + return 0; +} diff --git a/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp b/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp index a660f23a776f3e9103c5190b468b41454d8a4f97..69ecb3d8cbd45a8a7419437e934a57bd20b0bc9f 100644 --- a/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp +++ b/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp @@ -1,362 +1,231 @@ - +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file LidDrivenCavity.cpp +//! \ingroup Applications +//! \author Martin Schoenherr, Stephan Lenz +//======================================================================================= #define _USE_MATH_DEFINES -#include <math.h> -#include <string> -#include <sstream> -#include <iostream> -#include <stdexcept> -#include <fstream> #include <exception> +#include <fstream> +#include <iostream> #include <memory> -#include <filesystem> +#include <sstream> +#include <stdexcept> +#include <string> ////////////////////////////////////////////////////////////////////////// #include "Core/DataTypes.h" -#include "PointerDefinitions.h" - -#include "Core/StringUtilities/StringUtil.h" - +#include "Core/LbmOrGks.h" +#include "Core/Logger/Logger.h" #include "Core/VectorTypes.h" - -#include <basics/config/ConfigurationFile.h> +#include "PointerDefinitions.h" #include <logger/Logger.h> ////////////////////////////////////////////////////////////////////////// +#include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" -#include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/GridFactory.h" - -#include "GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h" -#include "GridGenerator/io/GridVTKWriter/GridVTKWriter.h" -#include "GridGenerator/io/STLReaderWriter/STLReader.h" -#include "GridGenerator/io/STLReaderWriter/STLWriter.h" +#include "GridGenerator/geometries/Cuboid/Cuboid.h" ////////////////////////////////////////////////////////////////////////// -#include "VirtualFluids_GPU/LBM/Simulation.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" +#include "VirtualFluids_GPU/Factories/GridScalingFactory.h" #include "VirtualFluids_GPU/Communication/Communicator.h" -#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" -#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" -#include "VirtualFluids_GPU/Parameter/Parameter.h" -#include "VirtualFluids_GPU/Output/FileWriter.h" - -#include "VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h" -#include "VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h" - +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" +#include "VirtualFluids_GPU/LBM/Simulation.h" +#include "VirtualFluids_GPU/Output/FileWriter.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" +#include "VirtualFluids_GPU/Factories/GridScalingFactory.h" ////////////////////////////////////////////////////////////////////////// -//#include "GksMeshAdapter/GksMeshAdapter.h" - -//#include "GksVtkAdapter/VTKInterface.h" -// -//#include "GksGpu/DataBase/DataBase.h" -//#include "GksGpu/Parameters/Parameters.h" -//#include "GksGpu/Initializer/Initializer.h" -// -//#include "GksGpu/FlowStateData/FlowStateDataConversion.cuh" -// -//#include "GksGpu/BoundaryConditions/BoundaryCondition.h" -//#include "GksGpu/BoundaryConditions/IsothermalWall.h" -// -//#include "GksGpu/TimeStepping/NestedTimeStep.h" -// -//#include "GksGpu/Analyzer/CupsAnalyzer.h" -//#include "GksGpu/Analyzer/ConvergenceAnalyzer.h" -// -//#include "GksGpu/CudaUtility/CudaUtility.h" - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// U s e r s e t t i n g s -// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -//LbmOrGks lbmOrGks = GKS; -LbmOrGks lbmOrGks = LBM; - -const real L = 1.0; - -const real Re = 500.0;// 1000.0; - -const real velocity = 1.0; - -const real dt = (real)1.0e-3; //0.5e-3; - -const uint nx = 64; - -std::string path("."); - -std::string simulationName("DrivenCavityChim"); - -const uint timeStepOut = 10000; -const uint timeStepEnd = 250000; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -void multipleLevel(const std::string& configPath) +int main() { - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); + try { + vf::logging::Logger::initalizeLogger(); + ////////////////////////////////////////////////////////////////////////// + // Simulation parameters + ////////////////////////////////////////////////////////////////////////// + std::string path("./output/DrivenCavity"); + std::string simulationName("LidDrivenCavity"); - auto gridBuilder = MultipleGridBuilder::makeShared(); + const real L = 1.0; + const real Re = 1000.0; + const real velocity = 1.0; + const real dt = (real)0.5e-3; + const uint nx = 64; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + const uint timeStepOut = 1000; + const uint timeStepEnd = 10000; - real dx = L / real(nx); + ////////////////////////////////////////////////////////////////////////// + // setup logger + ////////////////////////////////////////////////////////////////////////// - gridBuilder->addCoarseGrid(-0.5 * L, -0.5 * L, -0.5 * L, - 0.5 * L, 0.5 * L, 0.5 * L, dx); + logging::Logger::addStream(&std::cout); + logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); + logging::Logger::timeStamp(logging::Logger::ENABLE); + logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - gridBuilder->setPeriodicBoundaryCondition(false, false, false); + ////////////////////////////////////////////////////////////////////////// + // setup gridGenerator + ////////////////////////////////////////////////////////////////////////// - gridBuilder->buildGrids(lbmOrGks, false); // buildGrids() has to be called before setting the BCs!!!! + auto gridFactory = GridFactory::make(); + gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); + auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// + // create grid + ////////////////////////////////////////////////////////////////////////// - if( lbmOrGks == LBM ) - { + real dx = L / real(nx); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); + gridBuilder->addCoarseGrid(-0.5 * L, -0.5 * L, -0.5 * L, 0.5 * L, 0.5 * L, 0.5 * L, dx); - vf::basics::ConfigurationFile config; - config.load(configPath); + gridBuilder->addGrid(new Cuboid(-0.25, -0.25, -0.25, 0.25, 0.25, 0.25), 1); // add fine grid + GridScalingFactory scalingFactory = GridScalingFactory(); + scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible); - SPtr<Parameter> para = std::make_shared<Parameter>(config, communicator.getNummberOfProcess(), communicator.getPID()); + gridBuilder->setPeriodicBoundaryCondition(false, false, false); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + gridBuilder->buildGrids(LbmOrGks::LBM, false); + + ////////////////////////////////////////////////////////////////////////// + // compute parameters in lattice units + ////////////////////////////////////////////////////////////////////////// const real velocityLB = velocity * dt / dx; // LB units - const real vx = velocityLB / (real)sqrt(2.0); // LB units - const real vy = velocityLB / (real)sqrt(2.0); // LB units + const real vxLB = velocityLB / sqrt(2.0); // LB units + const real vyLB = velocityLB / sqrt(2.0); // LB units const real viscosityLB = nx * velocityLB / Re; // LB units - VF_LOG_INFO("velocity [dx/dt] = {}", velocityLB); - VF_LOG_INFO("viscosity [dx^2/dt] = {}", viscosityLB); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// + // set parameters + ////////////////////////////////////////////////////////////////////////// + SPtr<Parameter> para = std::make_shared<Parameter>(); - para->setDevices(std::vector<uint>{(uint)0}); - - para->setOutputPrefix( simulationName ); - - para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix()); + para->setOutputPath(path); + para->setOutputPrefix(simulationName); para->setPrintFiles(true); - para->setMaxLevel(1); - - para->setVelocity(velocityLB); - para->setViscosity(viscosityLB); - - para->setVelocityRatio(velocity/ velocityLB); - - //para->setMainKernel("CumulantK17CompChim"); - - para->setInitialCondition([&](real coordX, real coordY, real coordZ, real &rho, real &vx, real &vy, real &vz) { - rho = (real)0.0; - vx = (real)0.0; //(6 * velocityLB * coordZ * (L - coordZ) / (L * L)); - vy = (real)0.0; - vz = (real)0.0; - }); - - para->setTOut( timeStepOut ); - para->setTEnd( timeStepEnd ); - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //gridBuilder->setVelocityBoundaryCondition(SideType::PX, 0.0, 0.0, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::MX, 0.0, 0.0, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::PY, 0.0, 0.0, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx, vx, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - SPtr<CudaMemoryManager> cudaMemoryManager = CudaMemoryManager::make(para); - - SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); - - Simulation sim(communicator); - SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter()); - SPtr<KernelFactoryImp> kernelFactory = KernelFactoryImp::getInstance(); - SPtr<PreProcessorFactoryImp> preProcessorFactory = PreProcessorFactoryImp::getInstance(); - sim.setFactories(kernelFactory, preProcessorFactory); - sim.init(para, gridGenerator, fileWriter, cudaMemoryManager); + para->setVelocityLB(velocityLB); + para->setViscosityLB(viscosityLB); + + para->setVelocityRatio(velocity / velocityLB); + para->setDensityRatio(1.0); + + para->setTimestepOut(timeStepOut); + para->setTimestepEnd(timeStepEnd); + + para->setMainKernel("CumulantK17CompChimRedesigned"); + + ////////////////////////////////////////////////////////////////////////// + // set boundary conditions + ////////////////////////////////////////////////////////////////////////// + + gridBuilder->setNoSlipBoundaryCondition(SideType::PX); + gridBuilder->setNoSlipBoundaryCondition(SideType::MX); + gridBuilder->setNoSlipBoundaryCondition(SideType::PY); + gridBuilder->setNoSlipBoundaryCondition(SideType::MY); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, vyLB, 0.0); + gridBuilder->setNoSlipBoundaryCondition(SideType::MZ); + + BoundaryConditionFactory bcFactory; + + bcFactory.setNoSlipBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipBounceBack); + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocitySimpleBounceBackCompressible); + + ////////////////////////////////////////////////////////////////////////// + // set copy mesh to simulation + ////////////////////////////////////////////////////////////////////////// + + vf::gpu::Communicator &communicator = vf::gpu::Communicator::getInstance(); + + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); + SPtr<GridProvider> gridGenerator = + GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); + + + ////////////////////////////////////////////////////////////////////////// + // run simulation + ////////////////////////////////////////////////////////////////////////// + + VF_LOG_INFO("Start Running DrivenCavity Showcase..."); + printf("\n"); + VF_LOG_INFO("world parameter:"); + VF_LOG_INFO("--------------"); + VF_LOG_INFO("dt [s] = {}", dt); + VF_LOG_INFO("world_length [m] = {}", L); + VF_LOG_INFO("world_velocity [m/s] = {}", velocity); + VF_LOG_INFO("dx [m] = {}", dx); + printf("\n"); + VF_LOG_INFO("LB parameter:"); + VF_LOG_INFO("--------------"); + VF_LOG_INFO("Re = {}", Re); + VF_LOG_INFO("lb_velocity [dx/dt] = {}", velocityLB); + VF_LOG_INFO("lb_viscosity [dx^2/dt] = {}", viscosityLB); + VF_LOG_INFO("lb_vx [dx/dt] (lb_velocity/sqrt(2)) = {}", vxLB); + VF_LOG_INFO("lb_vy [dx/dt] (lb_velocity/sqrt(2)) = {}", vyLB); + printf("\n"); + VF_LOG_INFO("simulation parameter:"); + VF_LOG_INFO("--------------"); + VF_LOG_INFO("nx = {}", nx); + VF_LOG_INFO("ny = {}", nx); + VF_LOG_INFO("nz = {}", nx); + VF_LOG_INFO("number of nodes = {}", nx * nx * nx); + VF_LOG_INFO("n timesteps = {}", timeStepOut); + VF_LOG_INFO("write_nth_timestep = {}", timeStepEnd); + VF_LOG_INFO("output_path = {}", path); + + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory, &scalingFactory); sim.run(); - sim.free(); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - } - else - { - // CudaUtility::setCudaDevice(0); - // - // Parameters parameters; - - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //const real vx = velocity / sqrt(2.0); - //const real vy = velocity / sqrt(2.0); - - // parameters.K = 2.0; - // parameters.Pr = 1.0; - // - // const real Ma = 0.1; - - // real rho = 1.0; - - // real cs = velocity / Ma; - // real lambda = c1o2 * ( ( parameters.K + 5.0 ) / ( parameters.K + 3.0 ) ) / ( cs * cs ); - - // const real mu = velocity * L * rho / Re; - - // *logging::out << logging::Logger::INFO_HIGH << "mu = " << mu << " m^2/s\n"; - - // *logging::out << logging::Logger::INFO_HIGH << "CFL = " << dt * ( velocity + cs ) / dx << "\n"; - - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // parameters.mu = mu; - - // parameters.dt = dt; - // parameters.dx = dx; - - // parameters.lambdaRef = lambda; - - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // GksMeshAdapter meshAdapter( gridBuilder ); - - // meshAdapter.inputGrid(); - - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // auto dataBase = std::make_shared<DataBase>( "GPU" ); - - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // SPtr<BoundaryCondition> bcLid = std::make_shared<IsothermalWall>( dataBase, Vec3( vx, vy, 0.0 ), lambda, false ); - // SPtr<BoundaryCondition> bcWall = std::make_shared<IsothermalWall>( dataBase, Vec3( 0.0, 0.0, 0.0 ), lambda, false ); - // bcLid->findBoundaryCells ( meshAdapter, true, [&](Vec3 center){ return center.z > 0.5; } ); - // bcWall->findBoundaryCells( meshAdapter, false, [&](Vec3 center){ return center.z < 0.5; } ); - - // dataBase->boundaryConditions.push_back( bcLid ); - // dataBase->boundaryConditions.push_back( bcWall ); - - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // dataBase->setMesh( meshAdapter ); - - // Initializer::interpret(dataBase, [&] ( Vec3 cellCenter ) -> ConservedVariables { - - // return toConservedVariables( PrimitiveVariables( rho, 0.0, 0.0, 0.0, lambda ), parameters.K ); - // }); - - // dataBase->copyDataHostToDevice(); - - // Initializer::initializeDataUpdate(dataBase); - - // writeVtkXML( dataBase, parameters, 0, path + simulationName + "_0" ); - - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // CupsAnalyzer cupsAnalyzer( dataBase, false, 60.0, true, 10000 ); - - // ConvergenceAnalyzer convergenceAnalyzer( dataBase, 10000 ); - - // cupsAnalyzer.start(); - - // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - // for( uint iter = 1; iter <= timeStepEnd; iter++ ) - // { - // TimeStepping::nestedTimeStep(dataBase, parameters, 0); - - // if( iter % timeStepOut == 0 ) - // { - // dataBase->copyDataDeviceToHost(); - - // writeVtkXML( dataBase, parameters, 0, path + simulationName + "_" + std::to_string( iter ) ); - // } - // - // int crashCellIndex = dataBase->getCrashCellIndex(); - // if( crashCellIndex >= 0 ) - // { - // *logging::out << logging::Logger::LOGGER_ERROR << "Simulation Crashed at CellIndex = " << crashCellIndex << "\n"; - // dataBase->copyDataDeviceToHost(); - // writeVtkXML( dataBase, parameters, 0, path + simulationName + "_" + std::to_string( iter ) ); - - // break; - // } - - // dataBase->getCrashCellIndex(); - - // cupsAnalyzer.run( iter, parameters.dt ); - - // convergenceAnalyzer.run( iter ); - // } - } -} - -int main( int argc, char* argv[]) -{ - try - { - vf::logging::Logger::initalizeLogger(); - - // assuming that the config files is stored parallel to this file. - std::filesystem::path filePath = __FILE__; - filePath.replace_filename("configDrivenCavity.txt"); - - multipleLevel(filePath.string()); - } - catch (const spdlog::spdlog_ex &ex) { + } catch (const spdlog::spdlog_ex &ex) { std::cout << "Log initialization failed: " << ex.what() << std::endl; - } - catch (const std::bad_alloc& e) - { + } catch (const std::bad_alloc &e) { VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); - } - catch (const std::exception& e) - { + } catch (const std::exception &e) { VF_LOG_CRITICAL("exception: {}", e.what()); - } - catch (...) - { + } catch (...) { VF_LOG_CRITICAL("Unknown exception!"); } - return 0; + return 0; } diff --git a/apps/gpu/LBM/DrivenCavity/configDrivenCavity.txt b/apps/gpu/LBM/DrivenCavity/configDrivenCavity.txt index 246e6f72841c23957e85bb5d69a449af8d178822..458346a67c7f001580494af1dc9262034613be68 100644 --- a/apps/gpu/LBM/DrivenCavity/configDrivenCavity.txt +++ b/apps/gpu/LBM/DrivenCavity/configDrivenCavity.txt @@ -7,16 +7,13 @@ ################################################## #informations for Writing ################################################## -#Path="E:/DrivenCavity/results" -#Path="F:/Work/Computations/out/DrivenCavity/" -Path = C:/out/ +#Path = "output/" #Prefix="DrivenCavity" #WriteGrid=true ################################################## #informations for reading ################################################## -#GridPath="E:/DrivenCavity/dummy" -GridPath="C:" +#GridPath="grid/" ################################################## #number of grid levels diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/CMakeLists.txt b/apps/gpu/LBM/DrivenCavityMultiGPU/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..51b8db1edf126ebe7e2f3d5808496121270433c5 --- /dev/null +++ b/apps/gpu/LBM/DrivenCavityMultiGPU/CMakeLists.txt @@ -0,0 +1,8 @@ +PROJECT(DrivenCavityMultiGPU LANGUAGES CUDA CXX) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES DrivenCavityMultiGPU.cpp) + +set_source_files_properties(DrivenCavityMultiGPU.cpp PROPERTIES LANGUAGE CUDA) + +set_target_properties(DrivenCavityMultiGPU PROPERTIES + CUDA_SEPARABLE_COMPILATION ON) \ No newline at end of file diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp b/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8ca6939924fcfba22c8b96f000b9d8d05a3f7f43 --- /dev/null +++ b/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp @@ -0,0 +1,580 @@ +#define _USE_MATH_DEFINES +#include <exception> +#include <fstream> +#include <iostream> +#include <memory> +#include <sstream> +#include <stdexcept> +#include <string> +#include <filesystem> + +#include "mpi.h" + +////////////////////////////////////////////////////////////////////////// + +#include "basics/Core/DataTypes.h" +#include "basics/Core/VectorTypes.h" +#include "basics/PointerDefinitions.h" + +#include "basics/Core/LbmOrGks.h" +#include "basics/Core/Logger/Logger.h" +#include "basics/Core/StringUtilities/StringUtil.h" +#include "basics/config/ConfigurationFile.h" +#include "logger/Logger.h" + +////////////////////////////////////////////////////////////////////////// + +#include "GridGenerator/grid/BoundaryConditions/Side.h" +#include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" +#include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" +#include "GridGenerator/grid/GridFactory.h" + +#include "geometries/Cuboid/Cuboid.h" +#include "geometries/TriangularMesh/TriangularMesh.h" + +#include "GridGenerator/io/GridVTKWriter/GridVTKWriter.h" +#include "GridGenerator/io/STLReaderWriter/STLReader.h" +#include "GridGenerator/io/STLReaderWriter/STLWriter.h" +#include "GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h" + +////////////////////////////////////////////////////////////////////////// + +#include "VirtualFluids_GPU/Communication/Communicator.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" +#include "VirtualFluids_GPU/LBM/Simulation.h" +#include "VirtualFluids_GPU/Output/FileWriter.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" + +#include "VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h" +#include "VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" + +#include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" + +////////////////////////////////////////////////////////////////////////// + +#include "utilities/communication.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// U s e r s e t t i n g s +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +const std::string outPath("output/DrivenCavity_Results/"); +const std::string gridPath = "output/DrivenCavity_Results/grid/"; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void multipleLevel(std::filesystem::path& configPath) +{ + logging::Logger::addStream(&std::cout); + logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); + logging::Logger::timeStamp(logging::Logger::ENABLE); + logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); + + vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); + + auto gridFactory = GridFactory::make(); + gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); + auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + + vf::basics::ConfigurationFile config; + std::cout << configPath << std::endl; + config.load(configPath.string()); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNummberOfProcess(), communicator.getPID(), &config); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); + + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + bool useGridGenerator = true; + bool useLevels = true; + // para->setUseStreams(useStreams); // set in config + // para->useReducedCommunicationAfterFtoC = true; // set in config + para->setCalcTurbulenceIntensity(false); + + if (para->getNumprocs() == 1) { + para->useReducedCommunicationAfterFtoC = false; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + const real L = 1.0; + const real Re = 1000.0; // 1000 + const real velocity = 1.0; + const real dt = (real)1.0e-3; // 0.5e-3; + const uint nx = 64; + std::string simulationName("DrivenCavityChimMultiGPU"); + + // para->setTimestepOut(10000); // set in config + // para->setTimestepEnd(10000); // set in config + + const real dxGrid = L / real(nx); + const real velocityLB = velocity * dt / dxGrid; // LB units + const real vxLB = velocityLB / (real)sqrt(2.0); // LB units + const real vyLB = velocityLB / (real)sqrt(2.0); // LB units + const real viscosityLB = nx * velocityLB / Re; // LB units + + para->setInitialCondition([&](real coordX, real coordY, real coordZ, real &rho, real &vx, real &vy, real &vz) { + rho = (real)1.0; + vx = (real)(coordX * velocityLB); + vy = (real)(coordY * velocityLB); + vz = (real)(coordZ * velocityLB); + }); + + para->setVelocityLB(velocityLB); + para->setViscosityLB(viscosityLB); + para->setVelocityRatio(velocity / velocityLB); + para->setDensityRatio((real)1.0); // correct value? + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + para->setCalcDragLift(false); + para->setUseWale(false); + + if (para->getOutputPath() == "output/") {para->setOutputPath(outPath);} + para->setOutputPrefix(simulationName); + + para->setPrintFiles(true); + std::cout << "Write result files to " << para->getFName() << std::endl; + + // para->setMainKernel("CumulantK17CompChim"); + para->setMainKernel("CumulantK17CompChimStream"); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + vf::logging::Logger::changeLogPath(para->getOutputPath()); + VF_LOG_INFO("LB parameters:"); + VF_LOG_INFO("velocity LB [dx/dt] = {}", vxLB); + VF_LOG_INFO("viscosity LB [dx/dt] = {}", viscosityLB); + VF_LOG_INFO("dxGrid [-] = {}\n", dxGrid); + + VF_LOG_INFO("simulation parameters:"); + VF_LOG_INFO("mainKernel = {}\n", para->getMainKernel()); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + if (useGridGenerator) { + const real xGridMin = -0.5 * L; + const real xGridMax = 0.5 * L; + const real yGridMin = -0.5 * L; + const real yGridMax = 0.5 * L; + const real zGridMin = -0.5 * L; + const real zGridMax = 0.5 * L; + + Cuboid *level1 = nullptr; + if (useLevels) + level1 = new Cuboid(-0.25 * L, -0.25 * L, -0.25 * L, 0.25 * L, 0.25 * L, 0.25 * L); + + if (para->getNumprocs() > 1) { + + const uint generatePart = vf::gpu::Communicator::getInstance().getPID(); + real overlap = (real)8.0 * dxGrid; + gridBuilder->setNumberOfLayers(10, 8); + + const real xSplit = 0.0; + const real ySplit = 0.0; + const real zSplit = 0.0; + + if (communicator.getNummberOfProcess() == 2) { + + if (generatePart == 0) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xGridMax, yGridMax, zSplit + overlap, + dxGrid); + } + if (generatePart == 1) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zSplit - overlap, xGridMax, yGridMax, zGridMax, + dxGrid); + } + + if (useLevels) { + gridBuilder->addGrid(level1, 1); + } + + if (generatePart == 0) { + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xGridMax, yGridMin, yGridMax, zGridMin, zSplit)); + } + if (generatePart == 1) { + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xGridMax, yGridMin, yGridMax, zSplit, zGridMax)); + } + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + + if (generatePart == 0) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 1); + } + + if (generatePart == 1) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 0); + } + + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + ////////////////////////////////////////////////////////////////////////// + if (generatePart == 0) + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); + if (generatePart == 1) + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, 0.0, 0.0, 0.0); + ////////////////////////////////////////////////////////////////////////// + } else if (communicator.getNummberOfProcess() == 4) { + + if (generatePart == 0) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xSplit + overlap, yGridMax, + zSplit + overlap, dxGrid); + } + if (generatePart == 1) { + gridBuilder->addCoarseGrid(xSplit - overlap, yGridMin, zGridMin, xGridMax, yGridMax, + zSplit + overlap, dxGrid); + } + if (generatePart == 2) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zSplit - overlap, xSplit + overlap, yGridMax, + zGridMax, dxGrid); + } + if (generatePart == 3) { + gridBuilder->addCoarseGrid(xSplit - overlap, yGridMin, zSplit - overlap, xGridMax, yGridMax, + zGridMax, dxGrid); + } + + if (useLevels) { + gridBuilder->addGrid(level1, 1); + } + + if (generatePart == 0) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, yGridMin, yGridMax, zGridMin, zSplit)); + if (generatePart == 1) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, yGridMin, yGridMax, zGridMin, zSplit)); + if (generatePart == 2) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, yGridMin, yGridMax, zSplit, zGridMax)); + if (generatePart == 3) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, yGridMin, yGridMax, zSplit, zGridMax)); + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + + if (generatePart == 0) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 1); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 2); + } + if (generatePart == 1) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 0); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 3); + } + if (generatePart == 2) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 3); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 0); + } + if (generatePart == 3) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 2); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 1); + } + + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + ////////////////////////////////////////////////////////////////////////// + if (generatePart == 0) { + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MX, 0.0, 0.0, 0.0); + } + if (generatePart == 2) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, 0.0, 0.0, 0.0); + if (generatePart == 3) { + gridBuilder->setVelocityBoundaryCondition(SideType::PX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + if (generatePart == 1) { + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PX, 0.0, 0.0, 0.0); + } + ////////////////////////////////////////////////////////////////////////// + } else if (communicator.getNummberOfProcess() == 8) { + + if (generatePart == 0) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xSplit + overlap, ySplit + overlap, + zSplit + overlap, dxGrid); + } + if (generatePart == 1) { + gridBuilder->addCoarseGrid(xGridMin, ySplit - overlap, zGridMin, xSplit + overlap, yGridMax, + zSplit + overlap, dxGrid); + } + if (generatePart == 2) { + gridBuilder->addCoarseGrid(xSplit - overlap, yGridMin, zGridMin, xGridMax, ySplit + overlap, + zSplit + overlap, dxGrid); + } + if (generatePart == 3) { + gridBuilder->addCoarseGrid(xSplit - overlap, ySplit - overlap, zGridMin, xGridMax, yGridMax, + zSplit + overlap, dxGrid); + } + if (generatePart == 4) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zSplit - overlap, xSplit + overlap, ySplit + overlap, + zGridMax, dxGrid); + } + if (generatePart == 5) { + gridBuilder->addCoarseGrid(xGridMin, ySplit - overlap, zSplit - overlap, xSplit + overlap, yGridMax, + zGridMax, dxGrid); + } + if (generatePart == 6) { + gridBuilder->addCoarseGrid(xSplit - overlap, yGridMin, zSplit - overlap, xGridMax, ySplit + overlap, + zGridMax, dxGrid); + } + if (generatePart == 7) { + gridBuilder->addCoarseGrid(xSplit - overlap, ySplit - overlap, zSplit - overlap, xGridMax, yGridMax, + zGridMax, dxGrid); + } + + if (useLevels) { + gridBuilder->addGrid(level1, 1); + } + + if (generatePart == 0) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, yGridMin, ySplit, zGridMin, zSplit)); + if (generatePart == 1) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, ySplit, yGridMax, zGridMin, zSplit)); + if (generatePart == 2) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, yGridMin, ySplit, zGridMin, zSplit)); + if (generatePart == 3) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, ySplit, yGridMax, zGridMin, zSplit)); + if (generatePart == 4) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, yGridMin, ySplit, zSplit, zGridMax)); + if (generatePart == 5) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, ySplit, yGridMax, zSplit, zGridMax)); + if (generatePart == 6) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, yGridMin, ySplit, zSplit, zGridMax)); + if (generatePart == 7) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, ySplit, yGridMax, zSplit, zGridMax)); + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + + if (generatePart == 0) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 1); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 2); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 4); + } + if (generatePart == 1) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 0); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 3); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 5); + } + if (generatePart == 2) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 3); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 0); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 6); + } + if (generatePart == 3) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 2); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 1); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 7); + } + if (generatePart == 4) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 5); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 6); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 0); + } + if (generatePart == 5) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 4); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 7); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 1); + } + if (generatePart == 6) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 7); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 4); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 2); + } + if (generatePart == 7) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 6); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 5); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 3); + } + + ////////////////////////////////////////////////////////////////////////// + if (generatePart == 0) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); + } + if (generatePart == 1) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); + } + if (generatePart == 2) { + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PX, 0.0, 0.0, 0.0); + } + if (generatePart == 3) { + gridBuilder->setVelocityBoundaryCondition(SideType::PY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PX, 0.0, 0.0, 0.0); + } + if (generatePart == 4) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + if (generatePart == 5) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + if (generatePart == 6) { + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + if (generatePart == 7) { + gridBuilder->setVelocityBoundaryCondition(SideType::PY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + ////////////////////////////////////////////////////////////////////////// + } + + // gridBuilder->writeGridsToVtk(outPath + "/grid/part" + std::to_string(generatePart) + "_"); + // gridBuilder->writeArrows(outPath + "/" + std::to_string(generatePart) + " /arrow"); + + SimulationFileWriter::write(gridPath + std::to_string(generatePart) + "/", gridBuilder, FILEFORMAT::BINARY); + } else { + + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xGridMax, yGridMax, zGridMax, dxGrid); + + if (useLevels) { + gridBuilder->setNumberOfLayers(10, 8); + gridBuilder->addGrid(level1, 1); + } + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + ////////////////////////////////////////////////////////////////////////// + gridBuilder->setVelocityBoundaryCondition(SideType::MX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PX, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + + ////////////////////////////////////////////////////////////////////////// + gridBuilder->writeGridsToVtk(outPath + "/grid/"); + // gridBuilder->writeArrows(outPath + "/arrow"); + + SimulationFileWriter::write(gridPath, gridBuilder, FILEFORMAT::BINARY); + } + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); + + SPtr<GridProvider> gridGenerator; + if (useGridGenerator) + gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); + else { + gridGenerator = GridProvider::makeGridReader(FILEFORMAT::BINARY, para, cudaMemoryManager); + } + + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory); + sim.run(); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +} + +int main(int argc, char *argv[]) +{ + MPI_Init(&argc, &argv); + std::string str, str2, configFile; + + if (argv != NULL) { + + try { + ////////////////////////////////////////////////////////////////////////// + // assuming that a config files is stored parallel to this file. + std::filesystem::path configPath = __FILE__; + + // the config file's default name can be replaced by passing a command line argument + std::string configName("configDrivenCavityMultiGPU.txt"); + if (argc == 2) { + configName = argv[1]; + std::cout << "Using configFile command line argument: " << configName << std::endl; + } + + configPath.replace_filename(configName); + + multipleLevel(configPath); + + ////////////////////////////////////////////////////////////////////////// + } catch (const spdlog::spdlog_ex &ex) { + std::cout << "Log initialization failed: " << ex.what() << std::endl; + } catch (const std::bad_alloc &e) { + VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); + } catch (const std::exception &e) { + VF_LOG_CRITICAL("exception: {}", e.what()); + } catch (...) { + VF_LOG_CRITICAL("Unknown exception!"); + } + } + + MPI_Finalize(); + return 0; +} diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt b/apps/gpu/LBM/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt new file mode 100644 index 0000000000000000000000000000000000000000..69b6d099c97bd0bebeec71104ad484513f50c6e7 --- /dev/null +++ b/apps/gpu/LBM/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt @@ -0,0 +1,36 @@ +################################################## +#GPU Mapping +################################################## +Devices="0" +NumberOfDevices=1 + +################################################## +#informations for Writing +################################################## +Path=/workspaces/VirtualFluids_dev/output/DrivenCavity_Results/ # Aragorn +#Prefix="DrivenCavity" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/workspaces/VirtualFluids_dev/output/DrivenCavity_Results/grid/ # Aragorn +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## + +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=10000 +TimeOut=1000 +#TimeStartOut=0 \ No newline at end of file diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix1GPU.txt b/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix1GPU.txt new file mode 100644 index 0000000000000000000000000000000000000000..e63db13b533d24ef44b2e4d472ffba481d79f828 --- /dev/null +++ b/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix1GPU.txt @@ -0,0 +1,35 @@ +################################################## +#GPU Mapping +################################################## +Devices="0" +NumberOfDevices=1 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/DrivenCavityMultiGPUResults/1GPU/ +#Prefix="DrivenCavityMultiGPU" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridDrivenCavityMultiGPU/1GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=1000 +TimeOut=1000 +#TimeStartOut=0 \ No newline at end of file diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix2GPU.txt b/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix2GPU.txt new file mode 100644 index 0000000000000000000000000000000000000000..30b1882df34dcae63674b42ce6d65a47942ff87e --- /dev/null +++ b/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix2GPU.txt @@ -0,0 +1,41 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1" +NumberOfDevices=2 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/DrivenCavityMultiGPUResults/2GPU/ +#Prefix="DrivenCavityMultiGPU" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridDrivenCavityMultiGPU/2GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=1 +TimeOut=1 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix4GPU.txt b/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix4GPU.txt new file mode 100644 index 0000000000000000000000000000000000000000..c710922b9fc82ac7680f5f7daade4faa235bc957 --- /dev/null +++ b/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix4GPU.txt @@ -0,0 +1,41 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/DrivenCavityMultiGPUResults/4GPU/ +#Prefix="DrivenCavityMultiGPU" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridDrivenCavityMultiGPU/4GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=1 +TimeOut=1 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix8GPU.txt b/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix8GPU.txt new file mode 100644 index 0000000000000000000000000000000000000000..85684e7589dad91e53356c16bc2eae44081d7e96 --- /dev/null +++ b/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix8GPU.txt @@ -0,0 +1,41 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/DrivenCavityMultiGPUResults/8GPU/ +#Prefix="DrivenCavityMultiGPU" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridDrivenCavityMultiGPU/8GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=1000 +TimeOut=1000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/MusselOyster/CMakeLists.txt b/apps/gpu/LBM/MusselOyster/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..595d9ff7250d984f80e8d0d54dad0b11ae7e71e2 --- /dev/null +++ b/apps/gpu/LBM/MusselOyster/CMakeLists.txt @@ -0,0 +1,8 @@ +PROJECT(MusselOyster LANGUAGES CUDA CXX) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES MusselOyster.cpp) + +set_source_files_properties(MusselOyster.cpp PROPERTIES LANGUAGE CUDA) + +set_target_properties(MusselOyster PROPERTIES + CUDA_SEPARABLE_COMPILATION ON) \ No newline at end of file diff --git a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp new file mode 100644 index 0000000000000000000000000000000000000000..efac863fc9efd446e5f266648ad4fa74c954634f --- /dev/null +++ b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp @@ -0,0 +1,626 @@ +#define _USE_MATH_DEFINES +#include <exception> +#include <filesystem> +#include <fstream> +#include <iostream> +#include <math.h> +#include <memory> +#include <sstream> +#include <stdexcept> +#include <string> + +#include "mpi.h" + +////////////////////////////////////////////////////////////////////////// + +#include "basics/Core/DataTypes.h" +#include "basics/Core/VectorTypes.h" +#include "basics/PointerDefinitions.h" + +#include "basics/Core/LbmOrGks.h" +#include "basics/Core/Logger/Logger.h" +#include "basics/Core/StringUtilities/StringUtil.h" +#include "basics/config/ConfigurationFile.h" +#include "logger/Logger.h" + +////////////////////////////////////////////////////////////////////////// + +#include "GridGenerator/grid/BoundaryConditions/Side.h" +#include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" +#include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" +#include "GridGenerator/grid/GridFactory.h" + +#include "geometries/Sphere/Sphere.h" +#include "geometries/TriangularMesh/TriangularMesh.h" + +#include "GridGenerator/io/GridVTKWriter/GridVTKWriter.h" +#include "GridGenerator/io/STLReaderWriter/STLReader.h" +#include "GridGenerator/io/STLReaderWriter/STLWriter.h" +#include "GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h" + +////////////////////////////////////////////////////////////////////////// + +#include "VirtualFluids_GPU/BoundaryConditions/BoundaryConditionFactory.h" +#include "VirtualFluids_GPU/Communication/Communicator.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" +#include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" +#include "VirtualFluids_GPU/LBM/Simulation.h" +#include "VirtualFluids_GPU/Output/FileWriter.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" +#include "VirtualFluids_GPU/BoundaryConditions/BoundaryConditionFactory.h" + +////////////////////////////////////////////////////////////////////////// + +#include "utilities/communication.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// U s e r s e t t i n g s +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// Relative Paths +const std::string outPath("./output/MusselOysterResults/"); +const std::string gridPathParent = "./output/MusselOysterResults/grid/"; +const std::string stlPath("./stl/MusselOyster/"); +const std::string simulationName("MusselOyster"); + +// Tesla 03 +// const std::string outPath("E:/temp/MusselOysterResults/"); +// const std::string gridPathParent = "E:/temp/GridMussel/"; +// const std::string stlPath("C:/Users/Master/Documents/MasterAnna/STL/"); +// const std::string simulationName("MusselOyster"); + +// Phoenix +// const std::string outPath("/work/y0078217/Results/MusselOysterResults/"); +// const std::string gridPathParent = "/work/y0078217/Grids/GridMusselOyster/"; +// const std::string stlPath("/home/y0078217/STL/MusselOyster/"); +// const std::string simulationName("MusselOyster"); + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void multipleLevel(std::filesystem::path &configPath) +{ + logging::Logger::addStream(&std::cout); + logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); + logging::Logger::timeStamp(logging::Logger::ENABLE); + logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); + + vf::gpu::Communicator &communicator = vf::gpu::Communicator::getInstance(); + + auto gridFactory = GridFactory::make(); + gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); + auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + + vf::basics::ConfigurationFile config; + config.load(configPath.string()); + SPtr<Parameter> para = + std::make_shared<Parameter>(communicator.getNummberOfProcess(), communicator.getPID(), &config); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + bool useGridGenerator = true; + bool useStreams = true; + bool useLevels = true; + para->useReducedCommunicationAfterFtoC = true; + para->setCalcTurbulenceIntensity(true); + + if (para->getNumprocs() == 1) { + para->useReducedCommunicationAfterFtoC = false; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + std::string bivalveType = "MUSSEL"; // "MUSSEL" "OYSTER" + std::string gridPath( + gridPathParent + + bivalveType); // only for GridGenerator, for GridReader the gridPath needs to be set in the config file + + real dxGrid = (real)2.0; // 2.0 + // real dxGrid = (real)1.0; // 1.0 + if (para->getNumprocs() == 8) + dxGrid = 0.5; + real vxLB = (real)0.051; // LB units + real Re = (real)300.0; + real referenceLength = 1.0 / dxGrid; // heightBivalve / dxGrid + real viscosityLB = (vxLB * referenceLength) / Re; + + para->setVelocityLB(vxLB); + para->setViscosityLB(viscosityLB); + para->setVelocityRatio((real)58.82352941); + para->setViscosityRatio((real)0.058823529); + para->setDensityRatio((real)998.0); + + // para->setTimestepOut(1000); + // para->setTimestepEnd(10000); + + para->setCalcDragLift(false); + para->setUseWale(false); + + para->setOutputPrefix(simulationName); + if (para->getOutputPath() == "output/") {para->setOutputPath(outPath);} + + para->setPrintFiles(true); + std::cout << "Write result files to " << para->getFName() << std::endl; + + para->setUseStreams(useStreams); + // para->setMainKernel("CumulantK17CompChim"); + para->setMainKernel("CumulantK17CompChimStream"); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + VF_LOG_INFO("LB parameters:"); + VF_LOG_INFO("velocity LB [dx/dt] = {}", vxLB); + VF_LOG_INFO("viscosity LB [dx/dt] = {}", viscosityLB); + VF_LOG_INFO("dxGrid [-] = {}\n", dxGrid); + + VF_LOG_INFO("world parameters:"); + VF_LOG_INFO("velocity [m/s] = {}", vxLB * para->getVelocityRatio()); + VF_LOG_INFO("viscosity [m^2/s] = {}\n", viscosityLB * para->getViscosityRatio()); + + VF_LOG_INFO("simulation parameters:"); + VF_LOG_INFO("useGridGenerator = {}", useGridGenerator); + VF_LOG_INFO("useStreams = {}", para->getUseStreams()); + VF_LOG_INFO("number of processes = {}", para->getNumprocs()); + VF_LOG_INFO("useReducedCommunicationAfterFtoC = {}", para->useReducedCommunicationAfterFtoC); + VF_LOG_INFO("bivalveType = {}", bivalveType); + VF_LOG_INFO("mainKernel = {}\n", para->getMainKernel()); + + ////////////////////////////////////////////////////////////////////////// + + if (useGridGenerator) { + const real xGridMin = -100.0; // -100.0; + const real xGridMax = 470.0; // alt 540.0 // neu 440 // mit groesserem Level 1 470 + const real yGridMin = 1.0; // 1.0; + const real yGridMax = 350.0; // alt 440.0; // neu 350 + const real zGridMin = -85; // -85; + const real zGridMax = 85.0; // 85; + + // height MUSSEL = 35.0 + // height Oyster = 72.0 + + TriangularMesh *bivalveSTL = TriangularMesh::make(stlPath + bivalveType + ".stl"); + TriangularMesh *bivalveRef_1_STL = nullptr; + if (useLevels) + bivalveRef_1_STL = TriangularMesh::make(stlPath + bivalveType + "_Level1.stl"); + + if (para->getNumprocs() > 1) { + const uint generatePart = vf::gpu::Communicator::getInstance().getPID(); + + real overlap = (real)8.0 * dxGrid; + gridBuilder->setNumberOfLayers(10, 8); + + if (communicator.getNummberOfProcess() == 2) { + const real zSplit = 0.0; // round(((double)bbzp + bbzm) * 0.5); + + if (generatePart == 0) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xGridMax, yGridMax, zSplit + overlap, + dxGrid); + } + if (generatePart == 1) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zSplit - overlap, xGridMax, yGridMax, zGridMax, + dxGrid); + } + + if (useLevels) { + gridBuilder->addGrid(bivalveRef_1_STL, 1); + } + + gridBuilder->addGeometry(bivalveSTL); + + if (generatePart == 0) { + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xGridMax, yGridMin, yGridMax, zGridMin, zSplit)); + } + if (generatePart == 1) { + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xGridMax, yGridMin, yGridMax, zSplit, zGridMax)); + } + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + + if (generatePart == 0) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 1); + } + + if (generatePart == 1) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 0); + } + + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + ////////////////////////////////////////////////////////////////////////// + if (generatePart == 0) + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + if (generatePart == 1) + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + ////////////////////////////////////////////////////////////////////////// + } else if (communicator.getNummberOfProcess() == 4) { + + const real xSplit = 100.0; + const real zSplit = 0.0; + + if (generatePart == 0) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xSplit + overlap, yGridMax, + zSplit + overlap, dxGrid); + } + if (generatePart == 1) { + gridBuilder->addCoarseGrid(xSplit - overlap, yGridMin, zGridMin, xGridMax, yGridMax, + zSplit + overlap, dxGrid); + } + if (generatePart == 2) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zSplit - overlap, xSplit + overlap, yGridMax, + zGridMax, dxGrid); + } + if (generatePart == 3) { + gridBuilder->addCoarseGrid(xSplit - overlap, yGridMin, zSplit - overlap, xGridMax, yGridMax, + zGridMax, dxGrid); + } + + if (useLevels) { + gridBuilder->addGrid(bivalveRef_1_STL, 1); + } + + gridBuilder->addGeometry(bivalveSTL); + + if (generatePart == 0) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, yGridMin, yGridMax, zGridMin, zSplit)); + if (generatePart == 1) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, yGridMin, yGridMax, zGridMin, zSplit)); + if (generatePart == 2) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, yGridMin, yGridMax, zSplit, zGridMax)); + if (generatePart == 3) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, yGridMin, yGridMax, zSplit, zGridMax)); + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + + if (generatePart == 0) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 1); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 2); + } + if (generatePart == 1) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 0); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 3); + } + if (generatePart == 2) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 3); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 0); + } + if (generatePart == 3) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 2); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 1); + } + + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + ////////////////////////////////////////////////////////////////////////// + if (generatePart == 0) { + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + } + if (generatePart == 2) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + if (generatePart == 3) { + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + } + if (generatePart == 1) { + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + } + ////////////////////////////////////////////////////////////////////////// + } else if (communicator.getNummberOfProcess() == 8) { + real xSplit = 140.0; // 100.0 // mit groesserem Level 1 140.0 + real ySplit = 32.0; // 32.0 + real zSplit = 0.0; + + if (generatePart == 0) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xSplit + overlap, ySplit + overlap, + zSplit + overlap, dxGrid); + } + if (generatePart == 1) { + gridBuilder->addCoarseGrid(xGridMin, ySplit - overlap, zGridMin, xSplit + overlap, yGridMax, + zSplit + overlap, dxGrid); + } + if (generatePart == 2) { + gridBuilder->addCoarseGrid(xSplit - overlap, yGridMin, zGridMin, xGridMax, ySplit + overlap, + zSplit + overlap, dxGrid); + } + if (generatePart == 3) { + gridBuilder->addCoarseGrid(xSplit - overlap, ySplit - overlap, zGridMin, xGridMax, yGridMax, + zSplit + overlap, dxGrid); + } + if (generatePart == 4) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zSplit - overlap, xSplit + overlap, ySplit + overlap, + zGridMax, dxGrid); + } + if (generatePart == 5) { + gridBuilder->addCoarseGrid(xGridMin, ySplit - overlap, zSplit - overlap, xSplit + overlap, yGridMax, + zGridMax, dxGrid); + } + if (generatePart == 6) { + gridBuilder->addCoarseGrid(xSplit - overlap, yGridMin, zSplit - overlap, xGridMax, ySplit + overlap, + zGridMax, dxGrid); + } + if (generatePart == 7) { + gridBuilder->addCoarseGrid(xSplit - overlap, ySplit - overlap, zSplit - overlap, xGridMax, yGridMax, + zGridMax, dxGrid); + } + + if (useLevels) { + gridBuilder->addGrid(bivalveRef_1_STL, 1); + } + + gridBuilder->addGeometry(bivalveSTL); + + if (generatePart == 0) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, yGridMin, ySplit, zGridMin, zSplit)); + if (generatePart == 1) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, ySplit, yGridMax, zGridMin, zSplit)); + if (generatePart == 2) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, yGridMin, ySplit, zGridMin, zSplit)); + if (generatePart == 3) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, ySplit, yGridMax, zGridMin, zSplit)); + if (generatePart == 4) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, yGridMin, ySplit, zSplit, zGridMax)); + if (generatePart == 5) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, ySplit, yGridMax, zSplit, zGridMax)); + if (generatePart == 6) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, yGridMin, ySplit, zSplit, zGridMax)); + if (generatePart == 7) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, ySplit, yGridMax, zSplit, zGridMax)); + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + + if (generatePart == 0) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 1); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 2); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 4); + } + if (generatePart == 1) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 0); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 3); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 5); + } + if (generatePart == 2) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 3); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 0); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 6); + } + if (generatePart == 3) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 2); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 1); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 7); + } + if (generatePart == 4) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 5); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 6); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 0); + } + if (generatePart == 5) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 4); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 7); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 1); + } + if (generatePart == 6) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 7); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 4); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 2); + } + if (generatePart == 7) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 6); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 5); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 3); + } + + ////////////////////////////////////////////////////////////////////////// + if (generatePart == 0) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + } + if (generatePart == 1) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + } + if (generatePart == 2) { + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + } + if (generatePart == 3) { + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + } + if (generatePart == 4) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + if (generatePart == 5) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + if (generatePart == 6) { + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + } + if (generatePart == 7) { + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + } + // gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + ////////////////////////////////////////////////////////////////////////// + } + + // gridBuilder->writeGridsToVtk(outPath + bivalveType + "/grid/part" + std::to_string(generatePart) + "_"); + // gridBuilder->writeArrows(outPath + bivalveType + "/" + std::to_string(generatePart) + " /arrow"); + // SimulationFileWriter::write(gridPath + std::to_string(generatePart) + "/", gridBuilder, + // FILEFORMAT::BINARY); + } else { + + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xGridMax, yGridMax, zGridMax, dxGrid); + + if (useLevels) { + gridBuilder->setNumberOfLayers(10, 8); + gridBuilder->addGrid(bivalveRef_1_STL, 1); + } + + gridBuilder->addGeometry(bivalveSTL); + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + ////////////////////////////////////////////////////////////////////////// + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + + ////////////////////////////////////////////////////////////////////////// + + // gridBuilder->writeGridsToVtk(outPath + bivalveType + "/grid/"); + // gridBuilder->writeArrows ((outPath + bivalveType + "/arrow"); + + SimulationFileWriter::write(gridPath, gridBuilder, FILEFORMAT::BINARY); + } + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); + + SPtr<GridProvider> gridGenerator; + if (useGridGenerator) + gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); + else { + gridGenerator = GridProvider::makeGridReader(FILEFORMAT::BINARY, para, cudaMemoryManager); + } + + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory); + sim.run(); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +} + +int main(int argc, char *argv[]) +{ + MPI_Init(&argc, &argv); + std::string str, str2, configFile; + + if (argv != NULL) { + + try { + ////////////////////////////////////////////////////////////////////////// + // assuming that a config files is stored parallel to this file. + std::filesystem::path configPath = __FILE__; + + // the config file's default name can be replaced by passing a command line argument + std::string configName("configMusselOyster.txt"); + if (argc == 2) { + configName = argv[1]; + std::cout << "Using configFile command line argument: " << configName << std::endl; + } + + configPath.replace_filename(configName); + + multipleLevel(configPath); + + ////////////////////////////////////////////////////////////////////////// + } catch (const spdlog::spdlog_ex &ex) { + std::cout << "Log initialization failed: " << ex.what() << std::endl; + } catch (const std::bad_alloc &e) { + VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); + } catch (const std::exception &e) { + VF_LOG_CRITICAL("exception: {}", e.what()); + } catch (...) { + VF_LOG_CRITICAL("Unknown exception!"); + } + } + + MPI_Finalize(); + return 0; +} diff --git a/apps/gpu/LBM/MusselOyster/configMusselOyster.txt b/apps/gpu/LBM/MusselOyster/configMusselOyster.txt new file mode 100644 index 0000000000000000000000000000000000000000..3d64ef74215db49adfdee6ba569fccb462b98d73 --- /dev/null +++ b/apps/gpu/LBM/MusselOyster/configMusselOyster.txt @@ -0,0 +1,50 @@ +# Tesla 03 +# mpiexec -n 2 "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/build/bin/Release/MusselOyster.exe" "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/apps/gpu/LBM/MusselOyster/configMusselOyster.txt" +# Phoenix +# mpirun -np 2 "./VirtualFluids_dev/build/bin/MusselOyster" "./VirtualFluids_dev/apps/gpu/LBM/MusselOyster/configMusselOyster.txt" + +# Phoenix mpich +# mpirun -np 4 nvprof -f -o MusselOyster.%q{PMI_RANK}.nvprof "./VirtualFluids_dev/build/bin/MusselOyster" "./VirtualFluids_dev/apps/gpu/LBM/SphereScaling/configPhoenix4GPU.txt" +# Phoenix openmpi +# mpirun -np 4 nvprof -f -o MusselOyster.%q{OMPI_COMM_WORLD_RANK}.nvprof "./VirtualFluids_dev/build/bin/MusselOyster" "./VirtualFluids_dev/apps/gpu/LBM/SphereScaling/configPhoenix4GPU.txt" + +# Aragorn + ./bin/MusselOyster "../apps/gpu/LBM/MusselOyster/configMusselOyster.txt" + +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=2 + +################################################## +#informations for Writing +################################################## +#Path=/work/y0078217/Results/MusselOysterResults/ +Path=./output/MusselOysterResults/ +#Prefix="MusselOyster" +#WriteGrid=true +################################################## +#informations for reading +################################################## +#GridPath=E:/work/y0078217/Grids/GridMusselOyster/ +GridPath=./output/MusselOysterResults/grid/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=200000 +TimeOut=10000 +#TimeStartOut=0 \ No newline at end of file diff --git a/apps/gpu/LBM/MusselOyster/configPhoenix1GPU.txt b/apps/gpu/LBM/MusselOyster/configPhoenix1GPU.txt new file mode 100644 index 0000000000000000000000000000000000000000..369d68be327f72ef3762a2ddaf31ff89b84e06c7 --- /dev/null +++ b/apps/gpu/LBM/MusselOyster/configPhoenix1GPU.txt @@ -0,0 +1,36 @@ +################################################## +#GPU Mapping +################################################## +Devices="0" +NumberOfDevices=1 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/MusselOysterResults/1GPUMussel1/ +#Path="F:/Work/Computations/out/MusselOyster/" +#Prefix="MusselOyster" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridMusselOyster/Mussel1GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=10000 #400000 / 200000 +TimeOut=5000 #200000 / 100000 +#TimeStartOut=0 \ No newline at end of file diff --git a/apps/gpu/LBM/MusselOyster/configPhoenix8GPU.txt b/apps/gpu/LBM/MusselOyster/configPhoenix8GPU.txt new file mode 100644 index 0000000000000000000000000000000000000000..4e2b0c91482b6a650ff28a210673cac097cb8c2d --- /dev/null +++ b/apps/gpu/LBM/MusselOyster/configPhoenix8GPU.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/MusselOysterResults/8GPUOyster05/ +#Path="F:/Work/Computations/out/MusselOyster/" +#Prefix="MusselOyster" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridMusselOyster/Oyster8GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=400000 # 800000 +TimeOut=100000 # 400000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/SphereGPU/CMakeLists.txt b/apps/gpu/LBM/SphereGPU/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a8f3cb1b86b149852abf4365e15fd4df9e8c0cf --- /dev/null +++ b/apps/gpu/LBM/SphereGPU/CMakeLists.txt @@ -0,0 +1,7 @@ +PROJECT(SphereGPU LANGUAGES CUDA CXX) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES Sphere.cpp) + +set_source_files_properties(Sphere.cpp PROPERTIES LANGUAGE CUDA) + +set_target_properties(SphereGPU PROPERTIES CUDA_SEPARABLE_COMPILATION ON) diff --git a/apps/gpu/LBM/SphereGPU/Sphere.cpp b/apps/gpu/LBM/SphereGPU/Sphere.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6b749b564368bc6223c1283351521221d4950411 --- /dev/null +++ b/apps/gpu/LBM/SphereGPU/Sphere.cpp @@ -0,0 +1,278 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file LidDrivenCavity.cpp +//! \ingroup Applications +//! \author Martin Schoenherr, Stephan Lenz, Anna Wellmann +//======================================================================================= +#define _USE_MATH_DEFINES +#include <exception> +#include <filesystem> +#include <fstream> +#include <iostream> +#include <memory> +#include <sstream> +#include <stdexcept> +#include <string> + +////////////////////////////////////////////////////////////////////////// + +#include "Core/DataTypes.h" +#include "Core/LbmOrGks.h" +#include "Core/Logger/Logger.h" +#include "Core/VectorTypes.h" +#include "PointerDefinitions.h" +#include "config/ConfigurationFile.h" +#include "logger/Logger.h" + +////////////////////////////////////////////////////////////////////////// + +#include "GridGenerator/grid/BoundaryConditions/Side.h" +#include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" +#include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" +#include "GridGenerator/grid/GridFactory.h" + +#include "GridGenerator/geometries/Sphere/Sphere.h" +#include "GridGenerator/geometries/TriangularMesh/TriangularMesh.h" + +////////////////////////////////////////////////////////////////////////// + +#include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" +#include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" +#include "VirtualFluids_GPU/Communication/Communicator.h" +#include "VirtualFluids_GPU/LBM/Simulation.h" +#include "VirtualFluids_GPU/Output/FileWriter.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" +#include "VirtualFluids_GPU/Factories/GridScalingFactory.h" +#include "VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h" +#include "VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.h" + +////////////////////////////////////////////////////////////////////////// + +int main(int argc, char *argv[]) +{ + try { + ////////////////////////////////////////////////////////////////////////// + // Simulation parameters + ////////////////////////////////////////////////////////////////////////// + + const bool useConfigFile = true; + + const real L = 1.0; + const real dSphere = 0.2; + const real Re = 1000.0; // related to the sphere's diameter + const real velocity = 1.0; + const real dt = (real)0.5e-3; + const uint nx = 64; + + const uint timeStepOut = 1000; + const uint timeStepEnd = 10000; + + ////////////////////////////////////////////////////////////////////////// + // setup logger + ////////////////////////////////////////////////////////////////////////// + + logging::Logger::addStream(&std::cout); + logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); + logging::Logger::timeStamp(logging::Logger::ENABLE); + logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); + + ////////////////////////////////////////////////////////////////////////// + // setup simulation parameters (with or without config file) + ////////////////////////////////////////////////////////////////////////// + + vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance();; + SPtr<Parameter> para; + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); + GridScalingFactory scalingFactory = GridScalingFactory(); + vf::basics::ConfigurationFile config; + if (useConfigFile) { + ////////////////////////////////////////////////////////////////////////// + // read simulation parameters from config file + ////////////////////////////////////////////////////////////////////////// + + // assuming that a config files is stored parallel to this file. + std::filesystem::path configPath = __FILE__; + + // the config file's default name can be replaced by passing a command line argument + std::string configName("config.txt"); + if (argc == 2) { + configName = argv[1]; + std::cout << "Using configFile command line argument: " << configName << std::endl; + } + + configPath.replace_filename(configName); + config.load(configPath.string()); + + para = std::make_shared<Parameter>(&config); + } else { + para = std::make_shared<Parameter>(); + } + + ////////////////////////////////////////////////////////////////////////// + // setup gridGenerator + ////////////////////////////////////////////////////////////////////////// + + auto gridFactory = GridFactory::make(); + gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); + auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + + ////////////////////////////////////////////////////////////////////////// + // create grid + ////////////////////////////////////////////////////////////////////////// + + real dx = L / real(nx); + gridBuilder->addCoarseGrid(-1.0 * L, -0.6 * L, -0.6 * L, + 8.0 * L, 0.6 * L, 0.6 * L, dx); + + // use primitive + // Object *sphere = new Sphere(0.0, 0.0, 0.0, dSphere / 2.0); + + // use stl + std::string stlPath = "./apps/gpu/LBM/SphereGPU/sphere02.stl"; + if (useConfigFile && config.contains("STLPath")) { + stlPath = config.getValue<std::string>("STLPath"); + } + std::cout << "Reading stl from " << stlPath << "." << std::endl; + Object *sphere = TriangularMesh::make(stlPath); + + gridBuilder->addGeometry(sphere); + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + + ////////////////////////////////////////////////////////////////////////// + // add grid refinement + ////////////////////////////////////////////////////////////////////////// + + // gridBuilder->setNumberOfLayers(10, 8); + // gridBuilder->addGrid(new Sphere(0.0, 0.0, 0.0, 2.0 * dSphere), 1); + // para->setMaxLevel(2); + // scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleK17); + + ////////////////////////////////////////////////////////////////////////// + // build grid + ////////////////////////////////////////////////////////////////////////// + + gridBuilder->buildGrids(LBM, false); // buildGrids() has to be called before setting the BCs!!!! + + ////////////////////////////////////////////////////////////////////////// + // compute parameters in lattice units + ////////////////////////////////////////////////////////////////////////// + + const real velocityLB = velocity * dt / dx; // LB units + const real viscosityLB = (dSphere / dx) * velocityLB / Re; // LB units + + VF_LOG_INFO("LB parameters:"); + VF_LOG_INFO("velocity LB [dx/dt] = {}", velocityLB); + VF_LOG_INFO("viscosity LB [dx/dt] = {}", viscosityLB); + + ////////////////////////////////////////////////////////////////////////// + // set parameters + ////////////////////////////////////////////////////////////////////////// + + para->setPrintFiles(true); + + para->setVelocityLB(velocityLB); + para->setViscosityLB(viscosityLB); + + para->setVelocityRatio(velocity / velocityLB); + para->setDensityRatio((real)1.0); + + para->setTimestepOut(timeStepOut); + para->setTimestepEnd(timeStepEnd); + + ////////////////////////////////////////////////////////////////////////// + // set boundary conditions + ////////////////////////////////////////////////////////////////////////// + + gridBuilder->setVelocityBoundaryCondition(SideType::MX, velocityLB, 0.0, 0.0); + + gridBuilder->setSlipBoundaryCondition(SideType::PY, 0.0, 0.0, 0.0); + gridBuilder->setSlipBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setSlipBoundaryCondition(SideType::PZ, 0.0, 0.0, 0.0); + gridBuilder->setSlipBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); + + gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure boundary condition last + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setSlipBoundaryCondition(BoundaryConditionFactory::SlipBC::SlipCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + + ////////////////////////////////////////////////////////////////////////// + // setup probe(s) + ////////////////////////////////////////////////////////////////////////// + + const uint tStartAveraging = 0; + const uint tAveraging = 100; + const uint tStartOutProbe = 0; + const uint tOutProbe = para->getTimestepOut(); + SPtr<PointProbe> pointProbe = std::make_shared<PointProbe>( "pointProbe", para->getOutputPath(), tStartAveraging, tAveraging, tStartOutProbe, tOutProbe); + std::vector<real> probeCoordsX = {0.3, 0.5}; + std::vector<real> probeCoordsY = {0.0, 0.0}; + std::vector<real> probeCoordsZ = {0.0, 0.0}; + pointProbe->addProbePointsFromList(probeCoordsX, probeCoordsY, probeCoordsZ); + + pointProbe->addStatistic(Statistic::Instantaneous); + pointProbe->addStatistic(Statistic::Means); + pointProbe->addStatistic(Statistic::Variances); + para->addProbe( pointProbe ); + + SPtr<PlaneProbe> planeProbe = std::make_shared<PlaneProbe>("planeProbe", para->getOutputPath(), tStartAveraging, tAveraging, tStartOutProbe, tOutProbe); + planeProbe->setProbePlane(dSphere, 0, 0, 0.5, 0.1, 0.1); + planeProbe->addStatistic(Statistic::Means); + para->addProbe( planeProbe ); + + ////////////////////////////////////////////////////////////////////////// + // setup to copy mesh to simulation + ////////////////////////////////////////////////////////////////////////// + + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); + SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); + + ////////////////////////////////////////////////////////////////////////// + // run simulation + ////////////////////////////////////////////////////////////////////////// + + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory, &scalingFactory); + sim.run(); + + } catch (const spdlog::spdlog_ex &ex) { + std::cout << "Log initialization failed: " << ex.what() << std::endl; + } catch (const std::bad_alloc &e) { + VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); + } catch (const std::exception &e) { + VF_LOG_CRITICAL("exception: {}", e.what()); + } catch (...) { + VF_LOG_CRITICAL("Unknown exception!"); + } + + return 0; +} diff --git a/apps/gpu/LBM/SphereGPU/config.txt b/apps/gpu/LBM/SphereGPU/config.txt new file mode 100644 index 0000000000000000000000000000000000000000..5688820be22d3400349cbe610bf1399d3fea8761 --- /dev/null +++ b/apps/gpu/LBM/SphereGPU/config.txt @@ -0,0 +1,35 @@ +################################################## +#GPU Mapping +################################################## +#Devices="0 1 2 3" +#NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=output/Sphere/ +Prefix=Sphere01 +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath="grid/" +#STLPath=./stl/Sphere/sphere02.stl + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantAA2016CompSP27 + +################################################## +#simulation parameter +################################################## +#TimeEnd=100000 +#TimeOut=1000 +#TimeStartOut=0 \ No newline at end of file diff --git a/apps/gpu/LBM/SphereGPU/sphere02.stl b/apps/gpu/LBM/SphereGPU/sphere02.stl new file mode 100644 index 0000000000000000000000000000000000000000..3ff142d1a343b2e1016b75e65dde821d7a1f8e5a --- /dev/null +++ b/apps/gpu/LBM/SphereGPU/sphere02.stl @@ -0,0 +1,3138 @@ +solid Visualization Toolkit generated SLA File + facet normal 0.10450589731384756 0.020787518098262223 0.9943069930951618 + outer loop + vertex 0.020791169255971909 0 0.097814761102199554 + vertex 0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.088595824750780858 0.059197831240794162 0.99430699314302085 + outer loop + vertex 0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex 0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.059197831240794162 0.088595824750780858 0.99430699314302085 + outer loop + vertex 0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex 0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.020787518098262226 0.10450589731384755 0.9943069930951618 + outer loop + vertex 0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex 1.2730919672892854e-18 0.020791169255971909 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.020787518098262219 0.10450589731384756 0.9943069930951618 + outer loop + vertex 1.2730919672892854e-18 0.020791169255971909 0.097814761102199554 + vertex -0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.059197831240794162 0.088595824750780858 0.99430699314302085 + outer loop + vertex -0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex -0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.088595824750780858 0.059197831240794162 0.99430699314302085 + outer loop + vertex -0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex -0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.10450589731384755 0.020787518098262226 0.9943069930951618 + outer loop + vertex -0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex -0.020791169255971909 2.5461839345785708e-18 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.10450589731384756 -0.020787518098262219 0.9943069930951618 + outer loop + vertex -0.020791169255971909 2.5461839345785708e-18 0.097814761102199554 + vertex -0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.088595824750780858 -0.059197831240794162 0.99430699314302085 + outer loop + vertex -0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex -0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.059197831240794162 -0.088595824750780858 0.99430699314302085 + outer loop + vertex -0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex -0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.020787518098262233 -0.10450589731384756 0.9943069930951618 + outer loop + vertex -0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex -3.819275695072703e-18 -0.020791169255971909 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.020787518098262216 -0.10450589731384756 0.9943069930951618 + outer loop + vertex -3.819275695072703e-18 -0.020791169255971909 0.097814761102199554 + vertex 0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.059197831240794162 -0.088595824750780858 0.99430699314302085 + outer loop + vertex 0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex 0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.088595824750780858 -0.059197831240794162 0.99430699314302085 + outer loop + vertex 0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex 0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.10450589731384756 -0.020787518098262223 0.9943069930951618 + outer loop + vertex 0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex 0.020791169255971909 0 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.10450589731384756 0.020787518098262223 -0.9943069930951618 + outer loop + vertex 0.020791169255971909 0 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal 0.088595824750780858 0.059197831240794162 -0.99430699314302085 + outer loop + vertex 0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.01470157690346241 0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal 0.059197831240794162 0.088595824750780858 -0.99430699314302085 + outer loop + vertex 0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal 0.020787518098262226 0.10450589731384755 -0.9943069930951618 + outer loop + vertex 0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 1.2730919672892854e-18 0.020791169255971909 -0.097814761102199554 + endloop + endfacet + facet normal -0.020787518098262219 0.10450589731384756 -0.9943069930951618 + outer loop + vertex 1.2730919672892854e-18 0.020791169255971909 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal -0.059197831240794162 0.088595824750780858 -0.99430699314302085 + outer loop + vertex -0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.01470157690346241 0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal -0.088595824750780858 0.059197831240794162 -0.99430699314302085 + outer loop + vertex -0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal -0.10450589731384755 0.02078751809826223 -0.9943069930951618 + outer loop + vertex -0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.020791169255971909 2.5461839345785708e-18 -0.097814761102199554 + endloop + endfacet + facet normal -0.10450589731384756 -0.020787518098262216 -0.9943069930951618 + outer loop + vertex -0.020791169255971909 2.5461839345785708e-18 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal -0.088595824750780858 -0.059197831240794162 -0.99430699314302085 + outer loop + vertex -0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal -0.059197831240794162 -0.088595824750780858 -0.99430699314302085 + outer loop + vertex -0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal -0.020787518098262233 -0.10450589731384756 -0.9943069930951618 + outer loop + vertex -0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -3.819275695072703e-18 -0.020791169255971909 -0.097814761102199554 + endloop + endfacet + facet normal 0.020787518098262212 -0.10450589731384755 -0.9943069930951618 + outer loop + vertex -3.819275695072703e-18 -0.020791169255971909 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal 0.059197831240794162 -0.088595824750780858 -0.99430699314302085 + outer loop + vertex 0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal 0.088595824750780858 -0.059197831240794162 -0.99430699314302085 + outer loop + vertex 0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal 0.10450589731384756 -0.020787518098262223 -0.9943069930951618 + outer loop + vertex 0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.020791169255971909 0 -0.097814761102199554 + endloop + endfacet + facet normal 0.30843476522401231 0.061351521400747594 0.94926497166124379 + outer loop + vertex 0.020791169255971909 0 0.097814761102199554 + vertex 0.040673665702342987 0 0.091354548931121826 + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal 0.30843478276930947 0.061351500668862545 0.94926496730034626 + outer loop + vertex 0.020791169255971909 0 0.097814761102199554 + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex 0.019208535552024841 0.0079564359039068222 0.097814761102199554 + endloop + endfacet + facet normal 0.49754554609711599 0.098967962699230083 0.86177361987826373 + outer loop + vertex 0.040673665702342987 0 0.091354548931121826 + vertex 0.058778524398803711 0 0.080901697278022766 + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal 0.49754549605911413 0.098968004229828863 0.86177364399826861 + outer loop + vertex 0.040673665702342987 0 0.091354548931121826 + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal 0.6632812473204962 0.13193484346784404 0.7366486163918875 + outer loop + vertex 0.058778524398803711 0 0.080901697278022766 + vertex 0.074314482510089874 0 0.06691306084394455 + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal 0.66328124731730775 0.13193484347015969 0.73664861639434354 + outer loop + vertex 0.058778524398803711 0 0.080901697278022766 + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal 0.79874089113149127 0.15887934482690994 0.58031917306068981 + outer loop + vertex 0.074314482510089874 0 0.06691306084394455 + vertex 0.086602538824081421 0 0.05000000074505806 + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal 0.79874079057134661 0.15887942196636892 0.58031929035065921 + outer loop + vertex 0.074314482510089874 0 0.06691306084394455 + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal 0.89882617438269374 0.17878756470117699 0.40018310178316374 + outer loop + vertex 0.086602538824081421 0 0.05000000074505806 + vertex 0.095105648040771484 0 0.030901700258255005 + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal 0.89882620092364052 0.17878753861432078 0.40018305382588132 + outer loop + vertex 0.086602538824081421 0 0.05000000074505806 + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal 0.96014288401665793 0.19098433051579031 0.20408485433664575 + outer loop + vertex 0.095105648040771484 0 0.030901700258255005 + vertex 0.099452190101146698 0 0.010452846065163612 + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal 0.96014294936226929 0.19098422428494741 0.20408464632156809 + outer loop + vertex 0.095105648040771484 0 0.030901700258255005 + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal 0.98078527328214282 0.19509035781625048 -0 + outer loop + vertex 0.099452190101146698 0 0.010452846065163612 + vertex 0.099452190101146698 0 -0.010452846065163612 + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal 0.98078527328214282 0.19509035781625048 -0 + outer loop + vertex 0.099452190101146698 0 0.010452846065163612 + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal 0.96014290587992079 0.19098421563577428 -0.20408485898382991 + outer loop + vertex 0.099452190101146698 0 -0.010452846065163612 + vertex 0.095105648040771484 0 -0.030901700258255005 + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal 0.96014292559861558 0.1909843387869575 -0.2040846509687585 + outer loop + vertex 0.099452190101146698 0 -0.010452846065163612 + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal 0.89882617942320453 0.17878753433762079 -0.40018310402734325 + outer loop + vertex 0.095105648040771484 0 -0.030901700258255005 + vertex 0.086602538824081421 0 -0.05000000074505806 + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal 0.89882619396083974 0.17878756859551068 -0.40018305607006494 + outer loop + vertex 0.095105648040771484 0 -0.030901700258255005 + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal 0.79874087880382028 0.15887943951689917 -0.58031916410411333 + outer loop + vertex 0.086602538824081421 0 -0.05000000074505806 + vertex 0.074314482510089874 0 -0.06691306084394455 + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal 0.7987408154183383 0.1588793297666366 -0.58031928139408939 + outer loop + vertex 0.086602538824081421 0 -0.05000000074505806 + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal 0.66328124732023808 0.13193484347074255 -0.73664861639160084 + outer loop + vertex 0.074314482510089874 0 -0.06691306084394455 + vertex 0.058778524398803711 0 -0.080901697278022766 + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal 0.66328124731817861 0.13193484346738305 -0.73664861639405699 + outer loop + vertex 0.074314482510089874 0 -0.06691306084394455 + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal 0.49754554356199898 0.098968013678745081 -0.86177361548731513 + outer loop + vertex 0.058778524398803711 0 -0.080901697278022766 + vertex 0.040673665702342987 0 -0.091354548931121826 + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal 0.49754551322598684 0.098967956160755946 -0.86177363960732289 + outer loop + vertex 0.058778524398803711 0 -0.080901697278022766 + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal 0.30843476568236111 0.061351497270056753 -0.94926497307189694 + outer loop + vertex 0.040673665702342987 0 -0.091354548931121826 + vertex 0.020791169255971909 0 -0.097814761102199554 + vertex 0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal 0.3084347739583525 0.061351523138116801 -0.94926496871099864 + outer loop + vertex 0.040673665702342987 0 -0.091354548931121826 + vertex 0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal 0.26147837970812587 0.17471428421919066 0.9492649660842799 + outer loop + vertex 0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal 0.26147840938106925 0.17471426893077599 0.9492649607246284 + outer loop + vertex 0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex 0.01470157690346241 0.01470157690346241 0.097814761102199554 + endloop + endfacet + facet normal 0.42179874557711361 0.28183684066621417 0.86177364398829248 + outer loop + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal 0.42179864590164712 0.28183687150574754 0.86177368268901633 + outer loop + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal 0.56230267786378618 0.37571865044532143 0.73664862327622749 + outer loop + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal 0.56230279592432497 0.37571862212216495 0.73664854760347465 + outer loop + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal 0.67713972638750908 0.45245040321610314 0.5803192428116053 + outer loop + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal 0.67713981980897864 0.4524503781983546 0.58031915330896144 + outer loop + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal 0.76198801003014671 0.50914415869095786 0.40018308090319588 + outer loop + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal 0.76198794657394719 0.50914418433618069 0.40018316910218049 + outer loop + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal 0.81396988974665174 0.54387724854201425 0.20408468120903095 + outer loop + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal 0.81396982149820041 0.54387729795136042 0.20408482173673517 + outer loop + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal 0.83146963292153175 0.55557020216110709 -0 + outer loop + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal 0.83146963292153175 0.55557020216110709 -0 + outer loop + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal 0.81396984640124925 0.54387731459104727 -0.20408467806956454 + outer loop + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal 0.81396986593198373 0.54387723262956311 -0.20408481859726049 + outer loop + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal 0.76198798009585644 0.50914420673480953 -0.40018307677589038 + outer loop + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal 0.76198797950532793 0.509144138294924 -0.40018316497487411 + outer loop + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal 0.67713976273003673 0.45245034005942358 -0.58031924964628023 + outer loop + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal 0.67713977536749692 0.45245043594349216 -0.58031916014362273 + outer loop + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal 0.56230271938745569 0.37571857098187661 -0.7366486321095076 + outer loop + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal 0.56230273840009004 0.37571869089438792 -0.73664855643676341 + outer loop + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal 0.42179871051676798 0.28183691468019506 -0.86177363694298537 + outer loop + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal 0.42179870086462851 0.28183681079029427 -0.86177367564370844 + outer loop + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal 0.26147839157789088 0.17471425703507376 -0.94926496781800662 + outer loop + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex 0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex 0.01470157690346241 0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal 0.26147838880858149 0.17471429029992128 -0.94926496245835557 + outer loop + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex 0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal 0.17471429029992128 0.26147838880858149 0.94926496245835557 + outer loop + vertex 0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal 0.17471425703507376 0.26147839157789088 0.94926496781800662 + outer loop + vertex 0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex 0.0079564359039068222 0.019208535552024841 0.097814761102199554 + endloop + endfacet + facet normal 0.28183681079029427 0.42179870086462851 0.86177367564370844 + outer loop + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal 0.28183691468019506 0.42179871051676798 0.86177363694298537 + outer loop + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal 0.37571869089438792 0.56230273840009004 0.73664855643676341 + outer loop + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal 0.37571857098187661 0.56230271938745569 0.7366486321095076 + outer loop + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal 0.45245043594349216 0.67713977536749692 0.58031916014362273 + outer loop + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal 0.45245034005942358 0.67713976273003673 0.58031924964628023 + outer loop + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal 0.509144138294924 0.76198797950532793 0.40018316497487411 + outer loop + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal 0.50914420673480953 0.76198798009585644 0.40018307677589038 + outer loop + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal 0.54387723262956311 0.81396986593198373 0.20408481859726049 + outer loop + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal 0.54387731459104727 0.81396984640124925 0.20408467806956454 + outer loop + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal 0.55557020216110709 0.83146963292153175 -0 + outer loop + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal 0.55557020216110709 0.83146963292153175 -0 + outer loop + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal 0.54387729795136042 0.81396982149820041 -0.20408482173673517 + outer loop + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal 0.54387724854201425 0.81396988974665174 -0.20408468120903095 + outer loop + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal 0.50914418433618069 0.76198794657394719 -0.40018316910218049 + outer loop + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal 0.50914415869095786 0.76198801003014671 -0.40018308090319588 + outer loop + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal 0.4524503781983546 0.67713981980897864 -0.58031915330896144 + outer loop + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal 0.45245040321610314 0.67713972638750908 -0.5803192428116053 + outer loop + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal 0.37571862212216495 0.56230279592432497 -0.73664854760347465 + outer loop + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal 0.37571865044532143 0.56230267786378618 -0.73664862327622749 + outer loop + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal 0.28183687150574754 0.42179864590164712 -0.86177368268901633 + outer loop + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal 0.28183684066621417 0.42179874557711361 -0.86177364398829248 + outer loop + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal 0.17471426893077599 0.26147840938106925 -0.9492649607246284 + outer loop + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex 0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex 0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal 0.17471428421919066 0.26147837970812587 -0.9492649660842799 + outer loop + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex 0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal 0.061351523138116808 0.3084347739583525 0.94926496871099864 + outer loop + vertex 0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + endloop + endfacet + facet normal 0.061351497270056753 0.30843476568236106 0.94926497307189694 + outer loop + vertex 0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + vertex 1.2730919672892854e-18 0.020791169255971909 0.097814761102199554 + endloop + endfacet + facet normal 0.09896795616075596 0.49754551322598684 0.86177363960732289 + outer loop + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + endloop + endfacet + facet normal 0.098968013678745095 0.49754554356199898 0.86177361548731501 + outer loop + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + endloop + endfacet + facet normal 0.13193484346738305 0.6632812473181785 0.73664861639405688 + outer loop + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + endloop + endfacet + facet normal 0.13193484347074255 0.66328124732023797 0.73664861639160084 + outer loop + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + endloop + endfacet + facet normal 0.15887932976663663 0.79874081541833841 0.5803192813940895 + outer loop + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + endloop + endfacet + facet normal 0.15887943951689923 0.79874087880382039 0.58031916410411333 + outer loop + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + endloop + endfacet + facet normal 0.17878756859551068 0.89882619396083951 0.40018305607006488 + outer loop + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + endloop + endfacet + facet normal 0.17878753433762079 0.89882617942320442 0.40018310402734319 + outer loop + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + endloop + endfacet + facet normal 0.19098433878695753 0.96014292559861558 0.2040846509687585 + outer loop + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + endloop + endfacet + facet normal 0.19098421563577431 0.96014290587992079 0.20408485898382991 + outer loop + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + endloop + endfacet + facet normal 0.19509035781625048 0.98078527328214271 -0 + outer loop + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + endloop + endfacet + facet normal 0.19509035781625048 0.98078527328214271 -0 + outer loop + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + endloop + endfacet + facet normal 0.19098422428494746 0.9601429493622694 -0.20408464632156811 + outer loop + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + endloop + endfacet + facet normal 0.19098433051579031 0.96014288401665793 -0.20408485433664572 + outer loop + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + endloop + endfacet + facet normal 0.17878753861432081 0.89882620092364052 -0.40018305382588126 + outer loop + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + endloop + endfacet + facet normal 0.17878756470117702 0.89882617438269363 -0.40018310178316374 + outer loop + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + endloop + endfacet + facet normal 0.15887942196636895 0.79874079057134661 -0.58031929035065921 + outer loop + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + endloop + endfacet + facet normal 0.15887934482690999 0.79874089113149138 -0.58031917306068981 + outer loop + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + endloop + endfacet + facet normal 0.13193484347015971 0.66328124731730786 -0.73664861639434365 + outer loop + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + endloop + endfacet + facet normal 0.13193484346784407 0.6632812473204962 -0.73664861639188761 + outer loop + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + endloop + endfacet + facet normal 0.098968004229828876 0.49754549605911413 -0.86177364399826861 + outer loop + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + endloop + endfacet + facet normal 0.098967962699230097 0.49754554609711604 -0.86177361987826384 + outer loop + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + endloop + endfacet + facet normal 0.061351500668862552 0.30843478276930947 -0.94926496730034626 + outer loop + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex 0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex 1.2730919672892854e-18 0.020791169255971909 -0.097814761102199554 + endloop + endfacet + facet normal 0.061351521400747608 0.30843476522401225 -0.94926497166124379 + outer loop + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex 1.2730919672892854e-18 0.020791169255971909 -0.097814761102199554 + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + endloop + endfacet + facet normal -0.061351521400747587 0.30843476522401225 0.94926497166124379 + outer loop + vertex 1.2730919672892854e-18 0.020791169255971909 0.097814761102199554 + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal -0.061351500668862524 0.30843478276930947 0.94926496730034626 + outer loop + vertex 1.2730919672892854e-18 0.020791169255971909 0.097814761102199554 + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex -0.0079564359039068222 0.019208535552024841 0.097814761102199554 + endloop + endfacet + facet normal -0.098967962699230083 0.49754554609711604 0.86177361987826384 + outer loop + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal -0.098968004229828835 0.49754549605911413 0.86177364399826861 + outer loop + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal -0.13193484346784401 0.66328124732049609 0.7366486163918875 + outer loop + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal -0.13193484347015969 0.66328124731730786 0.73664861639434365 + outer loop + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal -0.15887934482690991 0.79874089113149138 0.58031917306068992 + outer loop + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal -0.15887942196636889 0.79874079057134661 0.58031929035065921 + outer loop + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal -0.17878756470117696 0.89882617438269374 0.4001831017831638 + outer loop + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal -0.17878753861432076 0.89882620092364052 0.40018305382588132 + outer loop + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal -0.19098433051579028 0.96014288401665793 0.20408485433664575 + outer loop + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal -0.19098422428494741 0.9601429493622694 0.20408464632156811 + outer loop + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal -0.19509035781625042 0.98078527328214271 0 + outer loop + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal -0.19509035781625042 0.98078527328214271 0 + outer loop + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal -0.19098421563577425 0.96014290587992079 -0.20408485898382991 + outer loop + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal -0.19098433878695747 0.96014292559861558 -0.20408465096875852 + outer loop + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal -0.17878753433762073 0.89882617942320442 -0.40018310402734325 + outer loop + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal -0.17878756859551062 0.89882619396083963 -0.40018305607006494 + outer loop + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal -0.15887943951689915 0.79874087880382016 -0.58031916410411333 + outer loop + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal -0.15887932976663657 0.7987408154183383 -0.58031928139408939 + outer loop + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal -0.13193484347074252 0.66328124732023797 -0.73664861639160084 + outer loop + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal -0.13193484346738302 0.66328124731817861 -0.73664861639405699 + outer loop + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal -0.098968013678745068 0.49754554356199898 -0.86177361548731513 + outer loop + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal -0.098967956160755932 0.49754551322598684 -0.86177363960732289 + outer loop + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal -0.061351497270056739 0.30843476568236111 -0.94926497307189694 + outer loop + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + vertex 1.2730919672892854e-18 0.020791169255971909 -0.097814761102199554 + vertex -0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal -0.061351523138116801 0.30843477395835256 -0.94926496871099864 + outer loop + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + vertex -0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal -0.17471428421919066 0.26147837970812587 0.9492649660842799 + outer loop + vertex -0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal -0.17471426893077599 0.26147840938106925 0.9492649607246284 + outer loop + vertex -0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex -0.01470157690346241 0.01470157690346241 0.097814761102199554 + endloop + endfacet + facet normal -0.28183684066621417 0.42179874557711361 0.86177364398829248 + outer loop + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal -0.28183687150574754 0.42179864590164712 0.86177368268901633 + outer loop + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal -0.37571865044532143 0.56230267786378618 0.73664862327622749 + outer loop + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal -0.37571862212216495 0.56230279592432497 0.73664854760347465 + outer loop + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal -0.45245040321610314 0.67713972638750908 0.5803192428116053 + outer loop + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal -0.4524503781983546 0.67713981980897864 0.58031915330896144 + outer loop + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal -0.50914415869095786 0.76198801003014671 0.40018308090319588 + outer loop + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal -0.50914418433618069 0.76198794657394719 0.40018316910218049 + outer loop + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal -0.54387724854201425 0.81396988974665174 0.20408468120903095 + outer loop + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal -0.54387729795136042 0.81396982149820041 0.20408482173673517 + outer loop + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal -0.55557020216110709 0.83146963292153175 0 + outer loop + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal -0.55557020216110709 0.83146963292153175 0 + outer loop + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal -0.54387731459104727 0.81396984640124925 -0.20408467806956454 + outer loop + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal -0.54387723262956311 0.81396986593198373 -0.20408481859726049 + outer loop + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal -0.50914420673480953 0.76198798009585644 -0.40018307677589038 + outer loop + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal -0.509144138294924 0.76198797950532793 -0.40018316497487411 + outer loop + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal -0.45245034005942358 0.67713976273003673 -0.58031924964628023 + outer loop + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal -0.45245043594349216 0.67713977536749692 -0.58031916014362273 + outer loop + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal -0.37571857098187661 0.56230271938745569 -0.7366486321095076 + outer loop + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal -0.37571869089438792 0.56230273840009004 -0.73664855643676341 + outer loop + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal -0.28183691468019506 0.42179871051676798 -0.86177363694298537 + outer loop + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal -0.28183681079029427 0.42179870086462851 -0.86177367564370844 + outer loop + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal -0.17471425703507376 0.26147839157789088 -0.94926496781800662 + outer loop + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex -0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex -0.01470157690346241 0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal -0.17471429029992128 0.26147838880858149 -0.94926496245835557 + outer loop + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex -0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal -0.26147838880858149 0.17471429029992128 0.94926496245835557 + outer loop + vertex -0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal -0.26147839157789088 0.17471425703507376 0.94926496781800662 + outer loop + vertex -0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex -0.019208535552024841 0.0079564359039068222 0.097814761102199554 + endloop + endfacet + facet normal -0.42179870086462851 0.28183681079029427 0.86177367564370844 + outer loop + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal -0.42179871051676798 0.28183691468019506 0.86177363694298537 + outer loop + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal -0.56230273840009004 0.37571869089438792 0.73664855643676341 + outer loop + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal -0.56230271938745569 0.37571857098187661 0.7366486321095076 + outer loop + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal -0.67713977536749692 0.45245043594349216 0.58031916014362273 + outer loop + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal -0.67713976273003673 0.45245034005942358 0.58031924964628023 + outer loop + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal -0.76198797950532793 0.509144138294924 0.40018316497487411 + outer loop + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal -0.76198798009585644 0.50914420673480953 0.40018307677589038 + outer loop + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal -0.81396986593198373 0.54387723262956311 0.20408481859726049 + outer loop + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal -0.81396984640124925 0.54387731459104727 0.20408467806956454 + outer loop + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal -0.83146963292153175 0.55557020216110709 0 + outer loop + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal -0.83146963292153175 0.55557020216110709 0 + outer loop + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal -0.81396982149820041 0.54387729795136042 -0.20408482173673517 + outer loop + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal -0.81396988974665174 0.54387724854201425 -0.20408468120903095 + outer loop + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal -0.76198794657394719 0.50914418433618069 -0.40018316910218049 + outer loop + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal -0.76198801003014671 0.50914415869095786 -0.40018308090319588 + outer loop + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal -0.67713981980897864 0.4524503781983546 -0.58031915330896144 + outer loop + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal -0.67713972638750908 0.45245040321610314 -0.5803192428116053 + outer loop + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal -0.56230279592432497 0.37571862212216495 -0.73664854760347465 + outer loop + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal -0.56230267786378618 0.37571865044532143 -0.73664862327622749 + outer loop + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal -0.42179864590164712 0.28183687150574754 -0.86177368268901633 + outer loop + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal -0.42179874557711361 0.28183684066621417 -0.86177364398829248 + outer loop + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal -0.26147840938106925 0.17471426893077599 -0.9492649607246284 + outer loop + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex -0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex -0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal -0.26147837970812587 0.17471428421919066 -0.9492649660842799 + outer loop + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex -0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal -0.30843477395835256 0.061351523138116815 0.94926496871099864 + outer loop + vertex -0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + endloop + endfacet + facet normal -0.30843476568236106 0.061351497270056773 0.94926497307189694 + outer loop + vertex -0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + vertex -0.020791169255971909 2.5461839345785708e-18 0.097814761102199554 + endloop + endfacet + facet normal -0.49754551322598684 0.098967956160755974 0.86177363960732301 + outer loop + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + endloop + endfacet + facet normal -0.49754554356199887 0.098968013678745095 0.86177361548731501 + outer loop + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + endloop + endfacet + facet normal -0.6632812473181785 0.13193484346738307 0.73664861639405688 + outer loop + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + endloop + endfacet + facet normal -0.66328124732023797 0.13193484347074261 0.73664861639160095 + outer loop + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + endloop + endfacet + facet normal -0.79874081541833841 0.15887932976663666 0.58031928139408939 + outer loop + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + endloop + endfacet + facet normal -0.79874087880382028 0.15887943951689923 0.58031916410411333 + outer loop + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + endloop + endfacet + facet normal -0.89882619396083963 0.1787875685955107 0.40018305607006494 + outer loop + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + endloop + endfacet + facet normal -0.89882617942320453 0.17878753433762085 0.40018310402734325 + outer loop + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + endloop + endfacet + facet normal -0.96014292559861558 0.19098433878695759 0.20408465096875852 + outer loop + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + endloop + endfacet + facet normal -0.96014290587992079 0.19098421563577436 0.20408485898382991 + outer loop + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + endloop + endfacet + facet normal -0.98078527328214271 0.19509035781625053 0 + outer loop + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + endloop + endfacet + facet normal -0.98078527328214271 0.19509035781625053 0 + outer loop + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + endloop + endfacet + facet normal -0.9601429493622694 0.19098422428494752 -0.20408464632156814 + outer loop + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + endloop + endfacet + facet normal -0.96014288401665793 0.19098433051579036 -0.20408485433664575 + outer loop + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + endloop + endfacet + facet normal -0.89882620092364052 0.17878753861432084 -0.40018305382588126 + outer loop + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + endloop + endfacet + facet normal -0.89882617438269374 0.17878756470117704 -0.4001831017831638 + outer loop + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + endloop + endfacet + facet normal -0.79874079057134661 0.15887942196636898 -0.58031929035065921 + outer loop + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + endloop + endfacet + facet normal -0.79874089113149138 0.15887934482690999 -0.58031917306068981 + outer loop + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + endloop + endfacet + facet normal -0.66328124731730775 0.13193484347015974 -0.73664861639434365 + outer loop + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + endloop + endfacet + facet normal -0.66328124732049609 0.13193484346784407 -0.7366486163918875 + outer loop + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + endloop + endfacet + facet normal -0.49754549605911413 0.09896800422982889 -0.86177364399826861 + outer loop + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + endloop + endfacet + facet normal -0.49754554609711604 0.098967962699230111 -0.86177361987826384 + outer loop + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + endloop + endfacet + facet normal -0.30843478276930947 0.061351500668862552 -0.94926496730034626 + outer loop + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex -0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex -0.020791169255971909 2.5461839345785708e-18 -0.097814761102199554 + endloop + endfacet + facet normal -0.30843476522401231 0.061351521400747615 -0.94926497166124379 + outer loop + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex -0.020791169255971909 2.5461839345785708e-18 -0.097814761102199554 + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + endloop + endfacet + facet normal -0.30843476522401225 -0.061351521400747573 0.94926497166124379 + outer loop + vertex -0.020791169255971909 2.5461839345785708e-18 0.097814761102199554 + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal -0.30843478276930947 -0.061351500668862524 0.94926496730034626 + outer loop + vertex -0.020791169255971909 2.5461839345785708e-18 0.097814761102199554 + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex -0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + endloop + endfacet + facet normal -0.49754554609711604 -0.098967962699230055 0.86177361987826384 + outer loop + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal -0.49754549605911413 -0.098968004229828835 0.86177364399826861 + outer loop + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal -0.6632812473204962 -0.13193484346784398 0.7366486163918875 + outer loop + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal -0.66328124731730786 -0.13193484347015966 0.73664861639434365 + outer loop + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal -0.79874089113149138 -0.15887934482690988 0.58031917306068992 + outer loop + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal -0.79874079057134661 -0.15887942196636889 0.58031929035065921 + outer loop + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal -0.89882617438269374 -0.17878756470117693 0.4001831017831638 + outer loop + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal -0.89882620092364052 -0.17878753861432073 0.40018305382588132 + outer loop + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal -0.96014288401665793 -0.19098433051579022 0.20408485433664572 + outer loop + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal -0.9601429493622694 -0.19098422428494735 0.20408464632156811 + outer loop + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal -0.98078527328214282 -0.19509035781625039 0 + outer loop + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal -0.98078527328214282 -0.19509035781625039 0 + outer loop + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal -0.96014290587992079 -0.1909842156357742 -0.20408485898382989 + outer loop + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal -0.96014292559861558 -0.19098433878695742 -0.2040846509687585 + outer loop + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal -0.89882617942320464 -0.17878753433762073 -0.40018310402734331 + outer loop + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal -0.89882619396083963 -0.17878756859551059 -0.40018305607006494 + outer loop + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal -0.79874087880382028 -0.15887943951689912 -0.58031916410411333 + outer loop + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal -0.79874081541833841 -0.15887932976663655 -0.58031928139408928 + outer loop + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal -0.66328124732023808 -0.1319348434707425 -0.73664861639160084 + outer loop + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal -0.6632812473181785 -0.13193484346738299 -0.73664861639405688 + outer loop + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal -0.49754554356199887 -0.098968013678745026 -0.86177361548731501 + outer loop + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal -0.49754551322598689 -0.098967956160755918 -0.86177363960732289 + outer loop + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal -0.30843476568236111 -0.061351497270056739 -0.94926497307189694 + outer loop + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + vertex -0.020791169255971909 2.5461839345785708e-18 -0.097814761102199554 + vertex -0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal -0.3084347739583525 -0.06135152313811678 -0.94926496871099864 + outer loop + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + vertex -0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal -0.26147837970812587 -0.17471428421919066 0.9492649660842799 + outer loop + vertex -0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal -0.26147840938106925 -0.17471426893077599 0.9492649607246284 + outer loop + vertex -0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex -0.01470157690346241 -0.01470157690346241 0.097814761102199554 + endloop + endfacet + facet normal -0.42179874557711361 -0.28183684066621417 0.86177364398829248 + outer loop + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal -0.42179864590164712 -0.28183687150574754 0.86177368268901633 + outer loop + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal -0.56230267786378618 -0.37571865044532143 0.73664862327622749 + outer loop + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal -0.56230279592432497 -0.37571862212216495 0.73664854760347465 + outer loop + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal -0.67713972638750908 -0.45245040321610314 0.5803192428116053 + outer loop + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal -0.67713981980897864 -0.4524503781983546 0.58031915330896144 + outer loop + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal -0.76198801003014671 -0.50914415869095786 0.40018308090319588 + outer loop + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal -0.76198794657394719 -0.50914418433618069 0.40018316910218049 + outer loop + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal -0.81396988974665174 -0.54387724854201425 0.20408468120903095 + outer loop + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal -0.81396982149820041 -0.54387729795136042 0.20408482173673517 + outer loop + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal -0.83146963292153175 -0.55557020216110709 0 + outer loop + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal -0.83146963292153175 -0.55557020216110709 0 + outer loop + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal -0.81396984640124925 -0.54387731459104727 -0.20408467806956454 + outer loop + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal -0.81396986593198373 -0.54387723262956311 -0.20408481859726049 + outer loop + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal -0.76198798009585644 -0.50914420673480953 -0.40018307677589038 + outer loop + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal -0.76198797950532793 -0.509144138294924 -0.40018316497487411 + outer loop + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal -0.67713976273003673 -0.45245034005942358 -0.58031924964628023 + outer loop + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal -0.67713977536749692 -0.45245043594349216 -0.58031916014362273 + outer loop + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal -0.56230271938745569 -0.37571857098187661 -0.7366486321095076 + outer loop + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal -0.56230273840009004 -0.37571869089438792 -0.73664855643676341 + outer loop + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal -0.42179871051676798 -0.28183691468019506 -0.86177363694298537 + outer loop + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal -0.42179870086462851 -0.28183681079029427 -0.86177367564370844 + outer loop + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal -0.26147839157789088 -0.17471425703507376 -0.94926496781800662 + outer loop + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex -0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex -0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal -0.26147838880858149 -0.17471429029992128 -0.94926496245835557 + outer loop + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex -0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal -0.17471429029992128 -0.26147838880858149 0.94926496245835557 + outer loop + vertex -0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal -0.17471425703507376 -0.26147839157789088 0.94926496781800662 + outer loop + vertex -0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex -0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + endloop + endfacet + facet normal -0.28183681079029427 -0.42179870086462851 0.86177367564370844 + outer loop + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal -0.28183691468019506 -0.42179871051676798 0.86177363694298537 + outer loop + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal -0.37571869089438792 -0.56230273840009004 0.73664855643676341 + outer loop + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal -0.37571857098187661 -0.56230271938745569 0.7366486321095076 + outer loop + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal -0.45245043594349216 -0.67713977536749692 0.58031916014362273 + outer loop + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal -0.45245034005942358 -0.67713976273003673 0.58031924964628023 + outer loop + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal -0.509144138294924 -0.76198797950532793 0.40018316497487411 + outer loop + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal -0.50914420673480953 -0.76198798009585644 0.40018307677589038 + outer loop + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal -0.54387723262956311 -0.81396986593198373 0.20408481859726049 + outer loop + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal -0.54387731459104727 -0.81396984640124925 0.20408467806956454 + outer loop + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal -0.55557020216110709 -0.83146963292153175 0 + outer loop + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal -0.55557020216110709 -0.83146963292153175 0 + outer loop + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal -0.54387729795136042 -0.81396982149820041 -0.20408482173673517 + outer loop + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal -0.54387724854201425 -0.81396988974665174 -0.20408468120903095 + outer loop + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal -0.50914418433618069 -0.76198794657394719 -0.40018316910218049 + outer loop + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal -0.50914415869095786 -0.76198801003014671 -0.40018308090319588 + outer loop + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal -0.4524503781983546 -0.67713981980897864 -0.58031915330896144 + outer loop + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal -0.45245040321610314 -0.67713972638750908 -0.5803192428116053 + outer loop + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal -0.37571862212216495 -0.56230279592432497 -0.73664854760347465 + outer loop + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal -0.37571865044532143 -0.56230267786378618 -0.73664862327622749 + outer loop + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal -0.28183687150574754 -0.42179864590164712 -0.86177368268901633 + outer loop + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal -0.28183684066621417 -0.42179874557711361 -0.86177364398829248 + outer loop + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal -0.17471426893077599 -0.26147840938106925 -0.9492649607246284 + outer loop + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex -0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex -0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal -0.17471428421919066 -0.26147837970812587 -0.9492649660842799 + outer loop + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex -0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal -0.061351523138116815 -0.3084347739583525 0.94926496871099864 + outer loop + vertex -0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + endloop + endfacet + facet normal -0.061351497270056773 -0.308434765682361 0.94926497307189694 + outer loop + vertex -0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + vertex -3.819275695072703e-18 -0.020791169255971909 0.097814761102199554 + endloop + endfacet + facet normal -0.098967956160755974 -0.49754551322598678 0.86177363960732289 + outer loop + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + endloop + endfacet + facet normal -0.098968013678745109 -0.49754554356199887 0.86177361548731501 + outer loop + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + endloop + endfacet + facet normal -0.1319348434673831 -0.6632812473181785 0.73664861639405688 + outer loop + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + endloop + endfacet + facet normal -0.13193484347074261 -0.66328124732023797 0.73664861639160084 + outer loop + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + endloop + endfacet + facet normal -0.15887932976663666 -0.79874081541833841 0.58031928139408939 + outer loop + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + endloop + endfacet + facet normal -0.15887943951689926 -0.79874087880382028 0.58031916410411333 + outer loop + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + endloop + endfacet + facet normal -0.17878756859551073 -0.89882619396083951 0.40018305607006494 + outer loop + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + endloop + endfacet + facet normal -0.1787875343376209 -0.89882617942320453 0.40018310402734331 + outer loop + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + endloop + endfacet + facet normal -0.19098433878695761 -0.96014292559861558 0.20408465096875852 + outer loop + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + endloop + endfacet + facet normal -0.19098421563577436 -0.96014290587992068 0.20408485898382989 + outer loop + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + endloop + endfacet + facet normal -0.19509035781625056 -0.98078527328214271 0 + outer loop + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + endloop + endfacet + facet normal -0.19509035781625056 -0.98078527328214271 0 + outer loop + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + endloop + endfacet + facet normal -0.19098422428494752 -0.9601429493622694 -0.20408464632156814 + outer loop + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + endloop + endfacet + facet normal -0.19098433051579039 -0.96014288401665793 -0.20408485433664575 + outer loop + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + endloop + endfacet + facet normal -0.17878753861432084 -0.89882620092364052 -0.40018305382588126 + outer loop + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + endloop + endfacet + facet normal -0.17878756470117704 -0.89882617438269374 -0.4001831017831638 + outer loop + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + endloop + endfacet + facet normal -0.15887942196636901 -0.79874079057134661 -0.58031929035065921 + outer loop + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + endloop + endfacet + facet normal -0.15887934482690999 -0.79874089113149138 -0.58031917306068981 + outer loop + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + endloop + endfacet + facet normal -0.13193484347015974 -0.66328124731730775 -0.73664861639434354 + outer loop + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + endloop + endfacet + facet normal -0.13193484346784412 -0.66328124732049609 -0.73664861639188761 + outer loop + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + endloop + endfacet + facet normal -0.098968004229828904 -0.49754549605911413 -0.86177364399826872 + outer loop + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + endloop + endfacet + facet normal -0.098967962699230125 -0.49754554609711599 -0.86177361987826384 + outer loop + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + endloop + endfacet + facet normal -0.061351500668862566 -0.30843478276930947 -0.94926496730034626 + outer loop + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex -0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex -3.819275695072703e-18 -0.020791169255971909 -0.097814761102199554 + endloop + endfacet + facet normal -0.061351521400747615 -0.3084347652240122 -0.94926497166124379 + outer loop + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex -3.819275695072703e-18 -0.020791169255971909 -0.097814761102199554 + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + endloop + endfacet + facet normal 0.061351521400747566 -0.30843476522401225 0.94926497166124391 + outer loop + vertex -3.819275695072703e-18 -0.020791169255971909 0.097814761102199554 + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal 0.06135150066886251 -0.30843478276930952 0.94926496730034615 + outer loop + vertex -3.819275695072703e-18 -0.020791169255971909 0.097814761102199554 + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex 0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + endloop + endfacet + facet normal 0.098967962699230042 -0.49754554609711604 0.86177361987826384 + outer loop + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal 0.098968004229828821 -0.49754549605911419 0.86177364399826872 + outer loop + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal 0.13193484346784395 -0.6632812473204962 0.7366486163918875 + outer loop + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal 0.13193484347015963 -0.66328124731730786 0.73664861639434354 + outer loop + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal 0.15887934482690988 -0.79874089113149138 0.58031917306068992 + outer loop + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal 0.15887942196636887 -0.79874079057134661 0.58031929035065932 + outer loop + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal 0.17878756470117688 -0.89882617438269374 0.40018310178316374 + outer loop + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal 0.17878753861432073 -0.89882620092364052 0.40018305382588132 + outer loop + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal 0.1909843305157902 -0.96014288401665793 0.20408485433664572 + outer loop + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal 0.19098422428494732 -0.9601429493622694 0.20408464632156811 + outer loop + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal 0.19509035781625034 -0.98078527328214271 0 + outer loop + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal 0.19509035781625034 -0.98078527328214271 0 + outer loop + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal 0.19098421563577417 -0.96014290587992079 -0.20408485898382989 + outer loop + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal 0.19098433878695739 -0.96014292559861558 -0.2040846509687585 + outer loop + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal 0.17878753433762073 -0.89882617942320464 -0.40018310402734331 + outer loop + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal 0.17878756859551054 -0.89882619396083963 -0.40018305607006488 + outer loop + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal 0.15887943951689912 -0.79874087880382028 -0.58031916410411344 + outer loop + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal 0.15887932976663652 -0.7987408154183383 -0.58031928139408939 + outer loop + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal 0.13193484347074247 -0.66328124732023797 -0.73664861639160084 + outer loop + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal 0.13193484346738296 -0.6632812473181785 -0.73664861639405688 + outer loop + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal 0.098968013678745026 -0.49754554356199898 -0.86177361548731501 + outer loop + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal 0.098967956160755904 -0.49754551322598684 -0.86177363960732289 + outer loop + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal 0.061351497270056718 -0.30843476568236106 -0.94926497307189694 + outer loop + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + vertex -3.819275695072703e-18 -0.020791169255971909 -0.097814761102199554 + vertex 0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal 0.06135152313811678 -0.30843477395835256 -0.94926496871099864 + outer loop + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + vertex 0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal 0.17471428421919066 -0.26147837970812587 0.9492649660842799 + outer loop + vertex 0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal 0.17471426893077599 -0.26147840938106925 0.9492649607246284 + outer loop + vertex 0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex 0.01470157690346241 -0.01470157690346241 0.097814761102199554 + endloop + endfacet + facet normal 0.28183684066621417 -0.42179874557711361 0.86177364398829248 + outer loop + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal 0.28183687150574754 -0.42179864590164712 0.86177368268901633 + outer loop + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal 0.37571865044532143 -0.56230267786378618 0.73664862327622749 + outer loop + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal 0.37571862212216495 -0.56230279592432497 0.73664854760347465 + outer loop + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal 0.45245040321610314 -0.67713972638750908 0.5803192428116053 + outer loop + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal 0.4524503781983546 -0.67713981980897864 0.58031915330896144 + outer loop + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal 0.50914415869095786 -0.76198801003014671 0.40018308090319588 + outer loop + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal 0.50914418433618069 -0.76198794657394719 0.40018316910218049 + outer loop + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal 0.54387724854201425 -0.81396988974665174 0.20408468120903095 + outer loop + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal 0.54387729795136042 -0.81396982149820041 0.20408482173673517 + outer loop + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal 0.55557020216110709 -0.83146963292153175 0 + outer loop + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal 0.55557020216110709 -0.83146963292153175 0 + outer loop + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal 0.54387731459104727 -0.81396984640124925 -0.20408467806956454 + outer loop + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal 0.54387723262956311 -0.81396986593198373 -0.20408481859726049 + outer loop + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal 0.50914420673480953 -0.76198798009585644 -0.40018307677589038 + outer loop + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal 0.509144138294924 -0.76198797950532793 -0.40018316497487411 + outer loop + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal 0.45245034005942358 -0.67713976273003673 -0.58031924964628023 + outer loop + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal 0.45245043594349216 -0.67713977536749692 -0.58031916014362273 + outer loop + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal 0.37571857098187661 -0.56230271938745569 -0.7366486321095076 + outer loop + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal 0.37571869089438792 -0.56230273840009004 -0.73664855643676341 + outer loop + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal 0.28183691468019506 -0.42179871051676798 -0.86177363694298537 + outer loop + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal 0.28183681079029427 -0.42179870086462851 -0.86177367564370844 + outer loop + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal 0.17471425703507376 -0.26147839157789088 -0.94926496781800662 + outer loop + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex 0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex 0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal 0.17471429029992128 -0.26147838880858149 -0.94926496245835557 + outer loop + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex 0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal 0.26147838880858149 -0.17471429029992128 0.94926496245835557 + outer loop + vertex 0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal 0.26147839157789088 -0.17471425703507376 0.94926496781800662 + outer loop + vertex 0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex 0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + endloop + endfacet + facet normal 0.42179870086462851 -0.28183681079029427 0.86177367564370844 + outer loop + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal 0.42179871051676798 -0.28183691468019506 0.86177363694298537 + outer loop + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal 0.56230273840009004 -0.37571869089438792 0.73664855643676341 + outer loop + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal 0.56230271938745569 -0.37571857098187661 0.7366486321095076 + outer loop + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal 0.67713977536749692 -0.45245043594349216 0.58031916014362273 + outer loop + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal 0.67713976273003673 -0.45245034005942358 0.58031924964628023 + outer loop + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal 0.76198797950532793 -0.509144138294924 0.40018316497487411 + outer loop + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal 0.76198798009585644 -0.50914420673480953 0.40018307677589038 + outer loop + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal 0.81396986593198373 -0.54387723262956311 0.20408481859726049 + outer loop + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal 0.81396984640124925 -0.54387731459104727 0.20408467806956454 + outer loop + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal 0.83146963292153175 -0.55557020216110709 0 + outer loop + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal 0.83146963292153175 -0.55557020216110709 0 + outer loop + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal 0.81396982149820041 -0.54387729795136042 -0.20408482173673517 + outer loop + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal 0.81396988974665174 -0.54387724854201425 -0.20408468120903095 + outer loop + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal 0.76198794657394719 -0.50914418433618069 -0.40018316910218049 + outer loop + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal 0.76198801003014671 -0.50914415869095786 -0.40018308090319588 + outer loop + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal 0.67713981980897864 -0.4524503781983546 -0.58031915330896144 + outer loop + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal 0.67713972638750908 -0.45245040321610314 -0.5803192428116053 + outer loop + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal 0.56230279592432497 -0.37571862212216495 -0.73664854760347465 + outer loop + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal 0.56230267786378618 -0.37571865044532143 -0.73664862327622749 + outer loop + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal 0.42179864590164712 -0.28183687150574754 -0.86177368268901633 + outer loop + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal 0.42179874557711361 -0.28183684066621417 -0.86177364398829248 + outer loop + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal 0.26147840938106925 -0.17471426893077599 -0.9492649607246284 + outer loop + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex 0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex 0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal 0.26147837970812587 -0.17471428421919066 -0.9492649660842799 + outer loop + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex 0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal 0.3084347739583525 -0.061351523138116801 0.94926496871099864 + outer loop + vertex 0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex 0.040673665702342987 0 0.091354548931121826 + endloop + endfacet + facet normal 0.30843476568236111 -0.061351497270056753 0.94926497307189694 + outer loop + vertex 0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex 0.040673665702342987 0 0.091354548931121826 + vertex 0.020791169255971909 0 0.097814761102199554 + endloop + endfacet + facet normal 0.49754551322598684 -0.098967956160755946 0.86177363960732289 + outer loop + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex 0.058778524398803711 0 0.080901697278022766 + endloop + endfacet + facet normal 0.49754554356199898 -0.098968013678745081 0.86177361548731513 + outer loop + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex 0.058778524398803711 0 0.080901697278022766 + vertex 0.040673665702342987 0 0.091354548931121826 + endloop + endfacet + facet normal 0.66328124731817861 -0.13193484346738305 0.73664861639405699 + outer loop + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex 0.074314482510089874 0 0.06691306084394455 + endloop + endfacet + facet normal 0.66328124732023808 -0.13193484347074255 0.73664861639160084 + outer loop + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex 0.074314482510089874 0 0.06691306084394455 + vertex 0.058778524398803711 0 0.080901697278022766 + endloop + endfacet + facet normal 0.7987408154183383 -0.1588793297666366 0.58031928139408939 + outer loop + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex 0.086602538824081421 0 0.05000000074505806 + endloop + endfacet + facet normal 0.79874087880382028 -0.15887943951689917 0.58031916410411333 + outer loop + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex 0.086602538824081421 0 0.05000000074505806 + vertex 0.074314482510089874 0 0.06691306084394455 + endloop + endfacet + facet normal 0.89882619396083974 -0.17878756859551068 0.40018305607006494 + outer loop + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex 0.095105648040771484 0 0.030901700258255005 + endloop + endfacet + facet normal 0.89882617942320453 -0.17878753433762079 0.40018310402734325 + outer loop + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex 0.095105648040771484 0 0.030901700258255005 + vertex 0.086602538824081421 0 0.05000000074505806 + endloop + endfacet + facet normal 0.96014292559861558 -0.1909843387869575 0.2040846509687585 + outer loop + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex 0.099452190101146698 0 0.010452846065163612 + endloop + endfacet + facet normal 0.96014290587992079 -0.19098421563577428 0.20408485898382991 + outer loop + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex 0.099452190101146698 0 0.010452846065163612 + vertex 0.095105648040771484 0 0.030901700258255005 + endloop + endfacet + facet normal 0.98078527328214282 -0.19509035781625048 0 + outer loop + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex 0.099452190101146698 0 -0.010452846065163612 + endloop + endfacet + facet normal 0.98078527328214282 -0.19509035781625048 0 + outer loop + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex 0.099452190101146698 0 -0.010452846065163612 + vertex 0.099452190101146698 0 0.010452846065163612 + endloop + endfacet + facet normal 0.96014294936226929 -0.19098422428494741 -0.20408464632156809 + outer loop + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex 0.095105648040771484 0 -0.030901700258255005 + endloop + endfacet + facet normal 0.96014288401665793 -0.19098433051579031 -0.20408485433664575 + outer loop + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex 0.095105648040771484 0 -0.030901700258255005 + vertex 0.099452190101146698 0 -0.010452846065163612 + endloop + endfacet + facet normal 0.89882620092364052 -0.17878753861432078 -0.40018305382588132 + outer loop + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex 0.086602538824081421 0 -0.05000000074505806 + endloop + endfacet + facet normal 0.89882617438269374 -0.17878756470117699 -0.40018310178316374 + outer loop + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex 0.086602538824081421 0 -0.05000000074505806 + vertex 0.095105648040771484 0 -0.030901700258255005 + endloop + endfacet + facet normal 0.79874079057134661 -0.15887942196636892 -0.58031929035065921 + outer loop + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex 0.074314482510089874 0 -0.06691306084394455 + endloop + endfacet + facet normal 0.79874089113149127 -0.15887934482690994 -0.58031917306068981 + outer loop + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex 0.074314482510089874 0 -0.06691306084394455 + vertex 0.086602538824081421 0 -0.05000000074505806 + endloop + endfacet + facet normal 0.66328124731730775 -0.13193484347015969 -0.73664861639434354 + outer loop + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex 0.058778524398803711 0 -0.080901697278022766 + endloop + endfacet + facet normal 0.6632812473204962 -0.13193484346784404 -0.7366486163918875 + outer loop + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex 0.058778524398803711 0 -0.080901697278022766 + vertex 0.074314482510089874 0 -0.06691306084394455 + endloop + endfacet + facet normal 0.49754549605911413 -0.098968004229828863 -0.86177364399826861 + outer loop + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex 0.040673665702342987 0 -0.091354548931121826 + endloop + endfacet + facet normal 0.49754554609711599 -0.098967962699230083 -0.86177361987826373 + outer loop + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex 0.040673665702342987 0 -0.091354548931121826 + vertex 0.058778524398803711 0 -0.080901697278022766 + endloop + endfacet + facet normal 0.30843478276930947 -0.061351500668862545 -0.94926496730034626 + outer loop + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex 0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex 0.020791169255971909 0 -0.097814761102199554 + endloop + endfacet + facet normal 0.30843476522401231 -0.061351521400747594 -0.94926497166124379 + outer loop + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex 0.020791169255971909 0 -0.097814761102199554 + vertex 0.040673665702342987 0 -0.091354548931121826 + endloop + endfacet +endsolid diff --git a/apps/gpu/LBM/SphereScaling/CMakeLists.txt b/apps/gpu/LBM/SphereScaling/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..db3747f2b620cab1efc5cf50f02aee1a8fee4a54 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/CMakeLists.txt @@ -0,0 +1,8 @@ +PROJECT(SphereScaling LANGUAGES CUDA CXX) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES SphereScaling.cpp) + +set_source_files_properties(SphereScaling.cpp PROPERTIES LANGUAGE CUDA) + +set_target_properties(SphereScaling PROPERTIES + CUDA_SEPARABLE_COMPILATION ON) \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/SphereScaling.cpp b/apps/gpu/LBM/SphereScaling/SphereScaling.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1d31ae10a8ae0678505141ebdede43df977dbf5e --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/SphereScaling.cpp @@ -0,0 +1,728 @@ + +#define _USE_MATH_DEFINES +#include <exception> +#include <fstream> +#include <iostream> +#include <math.h> +#include <memory> +#include <sstream> +#include <stdexcept> +#include <string> +#include <filesystem> + +#include "mpi.h" + +////////////////////////////////////////////////////////////////////////// + +#include "basics/Core/DataTypes.h" +#include "basics/Core/VectorTypes.h" +#include "basics/PointerDefinitions.h" + +#include "basics/Core/LbmOrGks.h" +#include "basics/Core/Logger/Logger.h" +#include "basics/Core/StringUtilities/StringUtil.h" +#include "basics/config/ConfigurationFile.h" +#include "logger/Logger.h" + +////////////////////////////////////////////////////////////////////////// + +#include "GridGenerator/grid/BoundaryConditions/Side.h" +#include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" +#include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" +#include "GridGenerator/grid/GridFactory.h" + +#include "geometries/Conglomerate/Conglomerate.h" +#include "geometries/Cuboid/Cuboid.h" +#include "geometries/Sphere/Sphere.h" +#include "geometries/TriangularMesh/TriangularMesh.h" + +#include "GridGenerator/io/GridVTKWriter/GridVTKWriter.h" +#include "GridGenerator/io/STLReaderWriter/STLReader.h" +#include "GridGenerator/io/STLReaderWriter/STLWriter.h" +#include "GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h" + +////////////////////////////////////////////////////////////////////////// + +#include "VirtualFluids_GPU/Communication/Communicator.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" +#include "VirtualFluids_GPU/LBM/Simulation.h" +#include "VirtualFluids_GPU/Output/FileWriter.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" + +#include "VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h" +#include "VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" +#include "VirtualFluids_GPU/Factories/GridScalingFactory.h" + +#include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" + +////////////////////////////////////////////////////////////////////////// + +#include "utilities/communication.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// U s e r s e t t i n g s +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// Phoenix +// const std::string outPath("/work/y0078217/Results/SphereScalingResults/"); +// const std::string gridPathParent = "/work/y0078217/Grids/GridSphereScaling/"; +// const std::string simulationName("SphereScaling"); +// const std::string stlPath("/home/y0078217/STL/Sphere/"); + +// Relative Paths +const std::string outPath("./output/SphereScalingResults/"); +const std::string gridPathParent = "./output/grids/SphereScalingResults/"; +const std::string simulationName("SphereScaling"); +const std::string stlPath("./stl/SphereScaling/"); + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void multipleLevel(std::filesystem::path& configPath) +{ + logging::Logger::addStream(&std::cout); + logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); + logging::Logger::timeStamp(logging::Logger::ENABLE); + logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); + + vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); + + auto gridFactory = GridFactory::make(); + gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); + auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + + vf::basics::ConfigurationFile config; + config.load(configPath.string()); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNummberOfProcess(), communicator.getPID(), &config); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); + GridScalingFactory scalingFactory = GridScalingFactory(); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + bool useGridGenerator = true; + bool useLevels = true; + std::string scalingType = "strong"; // "strong" // "weak" + // para->setUseStreams(true); // set in config + // para->useReducedCommunicationAfterFtoC = true; // set in config + + if (para->getNumprocs() == 1) { + para->useReducedCommunicationAfterFtoC = false; + } + if (scalingType != "weak" && scalingType != "strong") + std::cerr << "unknown scaling type" << std::endl; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + std::string gridPath(gridPathParent); // only for GridGenerator, for GridReader the gridPath needs to be set in the config file + + real dxGrid = (real)1.0; + real vxLB = (real)0.0005; // LB units + real viscosityLB = 0.001; //(vxLB * dxGrid) / Re; + + para->setVelocityLB(vxLB); + para->setViscosityLB(viscosityLB); + para->setVelocityRatio((real)58.82352941); + para->setViscosityRatio((real)0.058823529); + para->setDensityRatio((real)998.0); + + + // para->setTimestepOut(10); + // para->setTimestepEnd(10); + + para->setCalcDragLift(false); + para->setUseWale(false); + + + para->setOutputPrefix(simulationName); + if (para->getOutputPath() == "output/") {para->setOutputPath(outPath);} + para->setPrintFiles(true); + + if (useLevels) + para->setMaxLevel(2); + else + para->setMaxLevel(1); + + // para->setMainKernel("CumulantK17CompChim"); + para->setMainKernel("CumulantK17CompChimStream"); + //para->setMainKernel("CumulantK17CompChimRedesigned"); + scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleRhoSq); + + + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + VF_LOG_INFO("Number of processes: {}", para->getNumprocs()); + + VF_LOG_INFO("LB parameters:"); + VF_LOG_INFO("velocity LB [dx/dt] = {}", vxLB); + VF_LOG_INFO("viscosity LB [dx/dt] = {}", viscosityLB); + VF_LOG_INFO("dxGrid [-] = {}\n", dxGrid); + + VF_LOG_INFO("world parameters:"); + VF_LOG_INFO("velocity [m/s] = {}", vxLB * para->getVelocityRatio()); + VF_LOG_INFO("viscosity [m^2/s] = {}\n", viscosityLB * para->getViscosityRatio()); + + VF_LOG_INFO("simulation parameters:"); + VF_LOG_INFO("useGridGenerator = {}", useGridGenerator); + VF_LOG_INFO("useStreams = {}", para->getUseStreams()); + VF_LOG_INFO("number of processes = {}", para->getNumprocs()); + VF_LOG_INFO("useReducedCommunicationAfterFtoC = {}", para->useReducedCommunicationAfterFtoC); + VF_LOG_INFO("scalingType = {}", scalingType); + VF_LOG_INFO("mainKernel = {}\n", para->getMainKernel()); + + ////////////////////////////////////////////////////////////////////////// + + if (useGridGenerator) { + real sideLengthCube; + if (useLevels) { + if (scalingType == "strong") + sideLengthCube = 76.0; // Phoenix: strong scaling with two levels = 76.0 + else if (scalingType == "weak") + sideLengthCube = 70.0; // Phoenix: weak scaling with two levels = 70.0 + } else + sideLengthCube = 92.0; // Phoenix: 86.0 + real xGridMin = 0.0; + real xGridMax = sideLengthCube; + real yGridMin = 0.0; + real yGridMax = sideLengthCube; + real zGridMin = 0.0; + real zGridMax = sideLengthCube; + const real dSphere = 10.0; + const real dSphereLev1 = 22.0; // Phoenix: 22.0 + const real dCubeLev1 = 72.0; // Phoenix: 72.0 + + if (para->getNumprocs() > 1) { + const uint generatePart = vf::gpu::Communicator::getInstance().getPID(); + + real overlap = (real)8.0 * dxGrid; + gridBuilder->setNumberOfLayers(10, 8); + + if (communicator.getNummberOfProcess() == 2) { + real zSplit = 0.5 * sideLengthCube; + + if (scalingType == "weak") { + zSplit = zGridMax; + zGridMax = zGridMax + sideLengthCube; + } + + if (generatePart == 0) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xGridMax, yGridMax, zSplit + overlap, + dxGrid); + } + if (generatePart == 1) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zSplit - overlap, xGridMax, yGridMax, zGridMax, + dxGrid); + } + + if (useLevels) { + if (scalingType == "strong") { + gridBuilder->addGrid( + new Sphere(0.5 * sideLengthCube, 0.5 * sideLengthCube, 0.5 * sideLengthCube, dSphereLev1), + 1); + } else if (scalingType == "weak") { + gridBuilder->addGrid(new Cuboid(-0.5 * dCubeLev1, -0.5 * dCubeLev1, + sideLengthCube - 0.5 * dCubeLev1, 0.5 * dCubeLev1, + 0.5 * dCubeLev1, sideLengthCube + 0.5 * dCubeLev1), + 1); + } + } + + if (scalingType == "weak") { + if (useLevels) { + gridBuilder->addGeometry(new Sphere(0.0, 0.0, sideLengthCube, dSphere)); + } else { + TriangularMesh *sphereSTL = TriangularMesh::make(stlPath + "Spheres_2GPU.stl"); + gridBuilder->addGeometry(sphereSTL); + } + } else if (scalingType == "strong") { + gridBuilder->addGeometry( + new Sphere(0.5 * sideLengthCube, 0.5 * sideLengthCube, 0.5 * sideLengthCube, dSphere)); + } + + if (generatePart == 0) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xGridMax, yGridMin, yGridMax, zGridMin, zSplit)); + if (generatePart == 1) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xGridMax, yGridMin, yGridMax, zSplit, zGridMax)); + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + + if (generatePart == 0) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 1); + } + + if (generatePart == 1) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 0); + } + + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + ////////////////////////////////////////////////////////////////////////// + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + if (generatePart == 0) + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + if (generatePart == 1) + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + // gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + ////////////////////////////////////////////////////////////////////////// + + } else if (communicator.getNummberOfProcess() == 4) { + real ySplit = 0.5 * sideLengthCube; + real zSplit = 0.5 * sideLengthCube; + + if (scalingType == "weak") { + ySplit = yGridMax; + yGridMax = yGridMax + (yGridMax - yGridMin); + zSplit = zGridMax; + zGridMax = zGridMax + (zGridMax - zGridMin); + } + + if (generatePart == 0) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xGridMax, ySplit + overlap, + zSplit + overlap, dxGrid); + } + if (generatePart == 1) { + gridBuilder->addCoarseGrid(xGridMin, ySplit - overlap, zGridMin, xGridMax, yGridMax, + zSplit + overlap, dxGrid); + } + if (generatePart == 2) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zSplit - overlap, xGridMax, ySplit + overlap, + zGridMax, dxGrid); + } + if (generatePart == 3) { + gridBuilder->addCoarseGrid(xGridMin, ySplit - overlap, zSplit - overlap, xGridMax, yGridMax, + zGridMax, dxGrid); + } + + if (useLevels) { + if (scalingType == "strong") { + gridBuilder->addGrid( + new Sphere(0.5 * sideLengthCube, 0.5 * sideLengthCube, 0.5 * sideLengthCube, dSphereLev1), + 1); + } else if (scalingType == "weak") { + gridBuilder->addGrid(new Cuboid(-0.5 * dCubeLev1, sideLengthCube - 0.5 * dCubeLev1, + sideLengthCube - 0.5 * dCubeLev1, 0.5 * dCubeLev1, + sideLengthCube + 0.5 * dCubeLev1, + sideLengthCube + 0.5 * dCubeLev1), + 1); + } + } + + if (scalingType == "weak") { + if (useLevels) { + gridBuilder->addGeometry(new Sphere(0.0, sideLengthCube, sideLengthCube, dSphere)); + } else { + TriangularMesh *sphereSTL = TriangularMesh::make(stlPath + "Spheres_4GPU.stl"); + gridBuilder->addGeometry(sphereSTL); + } + } else if (scalingType == "strong") { + gridBuilder->addGeometry( + new Sphere(0.5 * sideLengthCube, 0.5 * sideLengthCube, 0.5 * sideLengthCube, dSphere)); + } + + if (generatePart == 0) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xGridMax, yGridMin, ySplit, zGridMin, zSplit)); + if (generatePart == 1) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xGridMax, ySplit, yGridMax, zGridMin, zSplit)); + if (generatePart == 2) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xGridMax, yGridMin, ySplit, zSplit, zGridMax)); + if (generatePart == 3) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xGridMax, ySplit, yGridMax, zSplit, zGridMax)); + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + + if (generatePart == 0) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 1); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 2); + } + if (generatePart == 1) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 0); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 3); + } + if (generatePart == 2) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 3); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 0); + } + if (generatePart == 3) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 2); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 1); + } + + ////////////////////////////////////////////////////////////////////////// + if (generatePart == 0) { + gridBuilder->setVelocityBoundaryCondition(SideType::MY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + } + if (generatePart == 1) { + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + } + if (generatePart == 2) { + gridBuilder->setVelocityBoundaryCondition(SideType::MY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + if (generatePart == 3) { + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + // gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + ////////////////////////////////////////////////////////////////////////// + } else if (communicator.getNummberOfProcess() == 8) { + real xSplit = 0.5 * sideLengthCube; + real ySplit = 0.5 * sideLengthCube; + real zSplit = 0.5 * sideLengthCube; + + if (scalingType == "weak") { + xSplit = xGridMax; + xGridMax = xGridMax + (xGridMax - xGridMin); + ySplit = yGridMax; + yGridMax = yGridMax + (yGridMax - yGridMin); + zSplit = zGridMax; + zGridMax = zGridMax + (zGridMax - zGridMin); + } + + if (generatePart == 0) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xSplit + overlap, ySplit + overlap, + zSplit + overlap, dxGrid); + } + if (generatePart == 1) { + gridBuilder->addCoarseGrid(xGridMin, ySplit - overlap, zGridMin, xSplit + overlap, yGridMax, + zSplit + overlap, dxGrid); + } + if (generatePart == 2) { + gridBuilder->addCoarseGrid(xSplit - overlap, yGridMin, zGridMin, xGridMax, ySplit + overlap, + zSplit + overlap, dxGrid); + } + if (generatePart == 3) { + gridBuilder->addCoarseGrid(xSplit - overlap, ySplit - overlap, zGridMin, xGridMax, yGridMax, + zSplit + overlap, dxGrid); + } + if (generatePart == 4) { + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zSplit - overlap, xSplit + overlap, ySplit + overlap, + zGridMax, dxGrid); + } + if (generatePart == 5) { + gridBuilder->addCoarseGrid(xGridMin, ySplit - overlap, zSplit - overlap, xSplit + overlap, yGridMax, + zGridMax, dxGrid); + } + if (generatePart == 6) { + gridBuilder->addCoarseGrid(xSplit - overlap, yGridMin, zSplit - overlap, xGridMax, ySplit + overlap, + zGridMax, dxGrid); + } + if (generatePart == 7) { + gridBuilder->addCoarseGrid(xSplit - overlap, ySplit - overlap, zSplit - overlap, xGridMax, yGridMax, + zGridMax, dxGrid); + } + + if (useLevels) { + if (scalingType == "strong") { + gridBuilder->addGrid( + new Sphere(0.5 * sideLengthCube, 0.5 * sideLengthCube, 0.5 * sideLengthCube, dSphereLev1), + 1); + } else if (scalingType == "weak") { + gridBuilder->addGrid( + new Cuboid(sideLengthCube - 0.5 * dCubeLev1, sideLengthCube - 0.5 * dCubeLev1, + sideLengthCube - 0.5 * dCubeLev1, sideLengthCube + 0.5 * dCubeLev1, + sideLengthCube + 0.5 * dCubeLev1, sideLengthCube + 0.5 * dCubeLev1), + 1); + } + } + + if (scalingType == "weak") { + if (useLevels) { + gridBuilder->addGeometry(new Sphere(sideLengthCube, sideLengthCube, sideLengthCube, dSphere)); + } else { + TriangularMesh *sphereSTL = TriangularMesh::make(stlPath + "Spheres_8GPU.stl"); + gridBuilder->addGeometry(sphereSTL); + } + } else if (scalingType == "strong") { + gridBuilder->addGeometry( + new Sphere(0.5 * sideLengthCube, 0.5 * sideLengthCube, 0.5 * sideLengthCube, dSphere)); + } + + if (generatePart == 0) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, yGridMin, ySplit, zGridMin, zSplit)); + if (generatePart == 1) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, ySplit, yGridMax, zGridMin, zSplit)); + if (generatePart == 2) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, yGridMin, ySplit, zGridMin, zSplit)); + if (generatePart == 3) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, ySplit, yGridMax, zGridMin, zSplit)); + if (generatePart == 4) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, yGridMin, ySplit, zSplit, zGridMax)); + if (generatePart == 5) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xGridMin, xSplit, ySplit, yGridMax, zSplit, zGridMax)); + if (generatePart == 6) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, yGridMin, ySplit, zSplit, zGridMax)); + if (generatePart == 7) + gridBuilder->setSubDomainBox( + std::make_shared<BoundingBox>(xSplit, xGridMax, ySplit, yGridMax, zSplit, zGridMax)); + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + + if (generatePart == 0) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 1); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 2); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 4); + } + if (generatePart == 1) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 0); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 3); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 5); + } + if (generatePart == 2) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 3); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 0); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 6); + } + if (generatePart == 3) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 2); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 1); + gridBuilder->findCommunicationIndices(CommunicationDirections::PZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PZ, 7); + } + if (generatePart == 4) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 5); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 6); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 0); + } + if (generatePart == 5) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 4); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 7); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 1); + } + if (generatePart == 6) { + gridBuilder->findCommunicationIndices(CommunicationDirections::PY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::PY, 7); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 4); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 2); + } + if (generatePart == 7) { + gridBuilder->findCommunicationIndices(CommunicationDirections::MY, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MY, 6); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 5); + gridBuilder->findCommunicationIndices(CommunicationDirections::MZ, LBM); + gridBuilder->setCommunicationProcess(CommunicationDirections::MZ, 3); + } + + ////////////////////////////////////////////////////////////////////////// + if (generatePart == 0) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + } + if (generatePart == 1) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + } + if (generatePart == 2) { + gridBuilder->setVelocityBoundaryCondition(SideType::MY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); + } + if (generatePart == 3) { + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); + } + if (generatePart == 4) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + if (generatePart == 5) { + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + } + if (generatePart == 6) { + gridBuilder->setVelocityBoundaryCondition(SideType::MY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + } + if (generatePart == 7) { + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + } + // gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + ////////////////////////////////////////////////////////////////////////// + } + + // gridBuilder->writeGridsToVtk(outPath + "grid/part" + std::to_string(generatePart) + "_"); + // gridBuilder->writeGridsToVtk(outPath +std::to_string(generatePart) + "/grid/"); + // gridBuilder->writeArrows(outPath + std::to_string(generatePart) + " /arrow"); + + SimulationFileWriter::write(gridPath + std::to_string(generatePart) + "/", gridBuilder, FILEFORMAT::BINARY); + } else { + + gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xGridMax, yGridMax, zGridMax, dxGrid); + + if (useLevels) { + gridBuilder->setNumberOfLayers(10, 8); + if (scalingType == "strong") { + gridBuilder->addGrid( + new Sphere(0.5 * sideLengthCube, 0.5 * sideLengthCube, 0.5 * sideLengthCube, dSphereLev1), 1); + } else if (scalingType == "weak") + gridBuilder->addGrid(new Cuboid(sideLengthCube - 0.5 * dCubeLev1, sideLengthCube - 0.5 * dCubeLev1, + sideLengthCube - 0.5 * dCubeLev1, sideLengthCube + 0.5 * dCubeLev1, + sideLengthCube + 0.5 * dCubeLev1, sideLengthCube + 0.5 * dCubeLev1), + 1); + } + + if (scalingType == "weak") { + if (useLevels) { + gridBuilder->addGeometry(new Sphere(sideLengthCube, sideLengthCube, sideLengthCube, dSphere)); + } else { + TriangularMesh *sphereSTL = TriangularMesh::make(stlPath + "Spheres_1GPU.stl"); + gridBuilder->addGeometry(sphereSTL); + } + } else { + gridBuilder->addGeometry( + new Sphere(0.5 * sideLengthCube, 0.5 * sideLengthCube, 0.5 * sideLengthCube, dSphere)); + } + + gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! + + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + ////////////////////////////////////////////////////////////////////////// + gridBuilder->setVelocityBoundaryCondition(SideType::MX, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vxLB, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vxLB, 0.0, 0.0); + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs + + // gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + ////////////////////////////////////////////////////////////////////////// + + // gridBuilder->writeGridsToVtk("E:/temp/MusselOyster/" + "/grid/"); + // gridBuilder->writeArrows ("E:/temp/MusselOyster/" + "/arrow"); + + SimulationFileWriter::write(gridPath, gridBuilder, FILEFORMAT::BINARY); + } + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); + + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); + + SPtr<GridProvider> gridGenerator; + if (useGridGenerator) + gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); + else { + gridGenerator = GridProvider::makeGridReader(FILEFORMAT::BINARY, para, cudaMemoryManager); + } + + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory, &scalingFactory); + sim.run(); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +} + +int main(int argc, char *argv[]) +{ + MPI_Init(&argc, &argv); + std::string str, str2, configFile; + + if (argv != NULL) { + + try { + ////////////////////////////////////////////////////////////////////////// + // assuming that a config files is stored parallel to this file. + std::filesystem::path configPath = __FILE__; + + // the config file's default name can be replaced by passing a command line argument + std::string configName("config.txt"); + if (argc == 2) { + configName = argv[1]; + std::cout << "Using configFile command line argument: " << configName << std::endl; + } + + configPath.replace_filename(configName); + + multipleLevel(configPath); + + ////////////////////////////////////////////////////////////////////////// + } catch (const spdlog::spdlog_ex &ex) { + std::cout << "Log initialization failed: " << ex.what() << std::endl; + } catch (const std::bad_alloc &e) { + VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); + } catch (const std::exception &e) { + VF_LOG_CRITICAL("exception: {}", e.what()); + } catch (...) { + VF_LOG_CRITICAL("Unknown exception!"); + } + } + + MPI_Finalize(); + return 0; +} diff --git a/apps/gpu/LBM/SphereScaling/config.txt b/apps/gpu/LBM/SphereScaling/config.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cfaeb492f97d348140ca3161b0738b4dd3ceaa7 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/config.txt @@ -0,0 +1,50 @@ +# Tesla 03 +# mpiexec -n 2 "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/build/bin/Release/SphereScaling.exe" "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/apps/gpu/LBM/SphereScaling/config.txt" +# Phoenix +# mpirun -np 2 "./VirtualFluids_dev/build/bin/SphereScaling" "./VirtualFluids_dev/apps/gpu/LBM/SphereScaling/config.txt" + +# Phoenix mpich +# mpirun -np 2 nvprof -f -o SphereScaling.%q{PMI_RANK}.nvprof "./VirtualFluids_dev/build/bin/SphereScaling" "./VirtualFluids_dev/apps/gpu/LBM/SphereScaling/configPhoenix4GPU.txt" +# Phoenix openmpi +# mpirun -np 2 nvprof -f -o SphereScaling.%q{OMPI_COMM_WORLD_RANK}.nvprof "./VirtualFluids_dev/build/bin/SphereScaling" "./VirtualFluids_dev/apps/gpu/LBM/SphereScaling/configPhoenix4GPU.txt" + +################################################## +#GPU Mapping +################################################## +#Devices="0 1 2 3" +#NumberOfDevices=2 + +################################################## +#informations for Writing +################################################## +Path=./output/SphereScalingResults/ +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/output/grids/SphereScalingResults/ + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=10000 +TimeOut=1000 +TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = false +useReducedCommunicationInInterpolation = false \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongOS.txt b/apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongOS.txt new file mode 100644 index 0000000000000000000000000000000000000000..5488797815bd797916434e8b6a0a82ce623a8db4 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongOS.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=2 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/1GPU/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling1GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=100000 +TimeOut=100000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = false +useReducedCommunicationInInterpolation = false \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongStream.txt b/apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongStream.txt new file mode 100644 index 0000000000000000000000000000000000000000..e93f161aa16977ecd65aab230f40db0bbef60130 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongStream.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=2 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/1GPU/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling1GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=100000 +TimeOut=100000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongOS.txt b/apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongOS.txt new file mode 100644 index 0000000000000000000000000000000000000000..795e6bcb7d0dc3314f26b171c2f61d88e005a797 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongOS.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=2 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/4GPU/1LevStrongStream/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=100000 +TimeOut=100000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = false +useReducedCommunicationInInterpolation = false \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongStream.txt b/apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongStream.txt new file mode 100644 index 0000000000000000000000000000000000000000..ef75fb88e563869b67f8aa33d839ec85c1d749b6 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongStream.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=2 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/4GPU/1LevStrongStream/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=100000 +TimeOut=100000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongOS.txt b/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongOS.txt new file mode 100644 index 0000000000000000000000000000000000000000..99a057d31c7f15659d32776967853e076b5939ee --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongOS.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/4GPU/1LevStrongStream/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=100000 +TimeOut=100000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = false +useReducedCommunicationInInterpolation = false \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongStream.txt b/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongStream.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea6338672305177b5119a2f557675bc491fddadc --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongStream.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/4GPU/1LevStrongStream/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=100000 +TimeOut=100000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevWeakStream.txt b/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevWeakStream.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad05efa37ec5fadc9bc5fe9711485ec6f03e1960 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevWeakStream.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/4GPU/1LevWeakStream/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=100000 +TimeOut=100000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_2LevStrongStream.txt b/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_2LevStrongStream.txt new file mode 100644 index 0000000000000000000000000000000000000000..45dc8c8b632f184e493dfedcc5963d8f60057022 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_2LevStrongStream.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/4GPU/2LevStrongStream/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=10000 +TimeOut=1000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongOS.txt b/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongOS.txt new file mode 100644 index 0000000000000000000000000000000000000000..892f11013d6742af416ba3b93a993b059a6fa3a0 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongOS.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/8GPU/1LevStrongOS/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling8GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=100000 +TimeOut=100000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = false +useReducedCommunicationInInterpolation = false \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongStream.txt b/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongStream.txt new file mode 100644 index 0000000000000000000000000000000000000000..b026d6b7304f9f13effec6c899512beb804787f5 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongStream.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/8GPU/1LevStrongStream/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling8GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=1000 +TimeOut=1000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakOS.txt b/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakOS.txt new file mode 100644 index 0000000000000000000000000000000000000000..ae848a2889d1301de78c6fff42e045965fa9baf7 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakOS.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/8GPU/1LevWeakOS/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling8GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=100000 +TimeOut=100000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = false +useReducedCommunicationInInterpolation = false \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakStream.txt b/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakStream.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc8403eca0bcf96645c85b81c3109ec7619f34d2 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakStream.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/8GPU/1LevWeakStream/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling8GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=100 +TimeOut=100 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_2LevStrongStream.txt b/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_2LevStrongStream.txt new file mode 100644 index 0000000000000000000000000000000000000000..a6d54810d8d4f0ded262a61c5535764c2f6f91b3 --- /dev/null +++ b/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_2LevStrongStream.txt @@ -0,0 +1,42 @@ +################################################## +#GPU Mapping +################################################## +Devices="0 1 2 3" +NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +Path=/work/y0078217/Results/SphereScalingResults/8GPU/2LevStrongStream/ +#Path="F:/Work/Computations/out/SphereScaling/" +#Prefix="SphereScaling" +#WriteGrid=true +################################################## +#informations for reading +################################################## +GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling8GPU/ +#GridPath="C:" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantK17CompChim + +################################################## +#simulation parameter +################################################## +TimeEnd=10000 +TimeOut=10000 +#TimeStartOut=0 + +################################################## +# CUDA Streams and optimized communication (only used for multiple GPUs) +################################################## +useStreams = true +useReducedCommunicationInInterpolation = true \ No newline at end of file diff --git a/apps/gpu/LBM/TGV_3D/CMakeLists.txt b/apps/gpu/LBM/TGV_3D/CMakeLists.txt index 82e62a2e35dc7be39b52d164baa6c1fc0f081daa..6a06a92891ac8b7c9714f0a6c98dd918dc08f682 100644 --- a/apps/gpu/LBM/TGV_3D/CMakeLists.txt +++ b/apps/gpu/LBM/TGV_3D/CMakeLists.txt @@ -1,7 +1,7 @@ -PROJECT(TGV_3D) +PROJECT(TGV_3D LANGUAGES CUDA CXX) vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES TGV_3D.cpp) set_source_files_properties(TGV_3D.cpp PROPERTIES LANGUAGE CUDA) -linkCUDA() +set_target_properties(TGV_3D PROPERTIES CUDA_SEPARABLE_COMPILATION ON) \ No newline at end of file diff --git a/apps/gpu/LBM/TGV_3D/TGV_3D.cpp b/apps/gpu/LBM/TGV_3D/TGV_3D.cpp index 7c23a683d7966a7e5c3d10b6025a8fa5ed802dac..d8642c7b267bcad6c58ab2a9c178c2d9394ecf2a 100644 --- a/apps/gpu/LBM/TGV_3D/TGV_3D.cpp +++ b/apps/gpu/LBM/TGV_3D/TGV_3D.cpp @@ -17,10 +17,9 @@ //#include "metis.h" -#include "Core/LbmOrGks.h" -#include "Core/Input/Input.h" -#include "Core/StringUtilities/StringUtil.h" -#include "Core/Input/ConfigFileReader/ConfigFileReader.h" +#include "basics/Core/LbmOrGks.h" +#include "basics/Core/StringUtilities/StringUtil.h" +#include <basics/config/ConfigurationFile.h> #include "VirtualFluids_GPU/LBM/Simulation.h" #include "VirtualFluids_GPU/Communication/Communicator.h" @@ -32,9 +31,9 @@ #include "VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h" #include "VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" -#include "VirtualFluids_GPU/Kernel/Utilities/Mapper/KernelMapper/KernelMapper.h" #include "global.h" @@ -112,22 +111,21 @@ void multipleLevel(const std::string& configPath) logging::Logger::timeStamp(logging::Logger::ENABLE); logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); + vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); + //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); auto gridFactory = GridFactory::make(); - gridFactory->setGridStrategy(Device::CPU); //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_UNDER_TRIANGLE); auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - - SPtr<ConfigFileReader> configReader = ConfigFileReader::getNewInstance(); - SPtr<ConfigData> configData = configReader->readConfigFile(configPath); - Communicator* comm = Communicator::getInstanz(); - SPtr<Parameter> para = Parameter::make(configData, comm); - std::shared_ptr<KernelMapper> kernelMapper = KernelMapper::getInstance(); + vf::basics::ConfigurationFile config; + config.load(configPath); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNummberOfProcess(), communicator.getPID(), &config); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -159,7 +157,7 @@ void multipleLevel(const std::string& configPath) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - + //std::stringstream _path; // std::stringstream _prefix; @@ -175,7 +173,7 @@ void multipleLevel(const std::string& configPath) // para->setOutputPath(_path.str()); // para->setOutputPrefix(_prefix.str()); - // para->setFName(_path.str() + "/" + _prefix.str()); + // para->setPathAndFilename(_path.str() + "/" + _prefix.str()); ////////////////////////////////////////////////////////////////////////// @@ -208,20 +206,18 @@ void multipleLevel(const std::string& configPath) para->setDevices(std::vector<uint>{gpuIndex}); ////////////////////////////////////////////////////////////////////////// - + para->setOutputPath( path ); para->setOutputPrefix( simulationName ); - para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix()); - para->setPrintFiles(true); - para->setTEnd( 40 * lround(L/velocity) ); - para->setTOut( 5 * lround(L/velocity) ); + para->setTimestepEnd( 40 * lround(L/velocity) ); + para->setTimestepOut( 5 * lround(L/velocity) ); - para->setVelocity( velocity ); + para->setVelocityLB( velocity ); - para->setViscosity( viscosity ); + para->setViscosityLB( viscosity ); para->setVelocityRatio( 1.0 / velocity ); @@ -238,7 +234,7 @@ void multipleLevel(const std::string& configPath) } ); - para->setMainKernel(kernelMapper->getEnum( kernel )); + para->setMainKernel( kernel ); if( !useLimiter ) para->setQuadricLimiters( 1000000.0, 1000000.0, 1000000.0 ); @@ -251,34 +247,30 @@ void multipleLevel(const std::string& configPath) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - SPtr<CudaMemoryManager> cudaMemoryManager = CudaMemoryManager::make(para); - SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); + + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); + SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); //SPtr<GridProvider> gridGenerator = GridProvider::makeGridReader(FILEFORMAT::BINARY, para, cudaMemoryManager); - Simulation sim; SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter()); - SPtr<KernelFactoryImp> kernelFactory = KernelFactoryImp::getInstance(); - SPtr<PreProcessorFactoryImp> preProcessorFactory = PreProcessorFactoryImp::getInstance(); - sim.setFactories(kernelFactory, preProcessorFactory); - sim.init(para, gridGenerator, fileWriter, cudaMemoryManager); - + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory); + sim.run(); + sim.addKineticEnergyAnalyzer( 10 ); sim.addEnstrophyAnalyzer( 10 ); sim.run(); - sim.free(); } int main( int argc, char* argv[]) { MPI_Init(&argc, &argv); - std::string str, str2; + std::string str, str2; if ( argv != NULL ) { //str = static_cast<std::string>(argv[0]); - + try { ////////////////////////////////////////////////////////////////////////// @@ -317,17 +309,17 @@ int main( int argc, char* argv[]) ////////////////////////////////////////////////////////////////////////// } - catch (const std::exception& e) + catch (const std::bad_alloc& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; + + *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; //std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } - catch (const std::bad_alloc e) + catch (const std::exception& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; + + *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; //std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } diff --git a/apps/gpu/LBM/TGV_3D_MultiGPU/CMakeLists.txt b/apps/gpu/LBM/TGV_3D_MultiGPU/CMakeLists.txt index ef91ada689729ae3b74d7e0ef9536ac7aed2bb9a..cc25432a3151ce0805242f720d58794e8bc7feed 100644 --- a/apps/gpu/LBM/TGV_3D_MultiGPU/CMakeLists.txt +++ b/apps/gpu/LBM/TGV_3D_MultiGPU/CMakeLists.txt @@ -1,7 +1,7 @@ -PROJECT(TGV_3D_MultiGPU) +PROJECT(TGV_3D_MultiGPU LANGUAGES CUDA CXX) vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES TGV_3D_MultiGPU.cpp) set_source_files_properties(TGV_3D_MultiGPU.cpp PROPERTIES LANGUAGE CUDA) -linkCUDA() +set_target_properties(TGV_3D_MultiGPU PROPERTIES CUDA_SEPARABLE_COMPILATION ON) diff --git a/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp b/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp index 3e761d1b8a5164af90f2010a941d85834fd6361f..8c303dc07c911c363e892ce53f7bfe7f48e284d6 100644 --- a/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp +++ b/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp @@ -20,9 +20,8 @@ //#include "metis.h" #include "Core/LbmOrGks.h" -#include "Core/Input/Input.h" #include "Core/StringUtilities/StringUtil.h" -#include "Core/Input/ConfigFileReader/ConfigFileReader.h" +#include "basics/config/ConfigurationFile.h" #include "VirtualFluids_GPU/LBM/Simulation.h" #include "VirtualFluids_GPU/Communication/Communicator.h" @@ -34,9 +33,9 @@ #include "VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h" #include "VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" -#include "VirtualFluids_GPU/Kernel/Utilities/Mapper/KernelMapper/KernelMapper.h" #include "global.h" @@ -110,12 +109,12 @@ std::string simulationName("TGV_3D"); void multipleLevel(const std::string& configPath) { - + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int sideLengthX, sideLengthY, sideLengthZ, rankX, rankY, rankZ; - + if (mpiWorldSize == 1 ) { sideLengthX = 1; sideLengthY = 1; sideLengthZ = 1; } else if (mpiWorldSize == 2 ) { sideLengthX = 2; sideLengthY = 1; sideLengthZ = 1; } else if (mpiWorldSize == 4 ) { sideLengthX = 2; sideLengthY = 2; sideLengthZ = 1; } @@ -130,7 +129,7 @@ void multipleLevel(const std::string& configPath) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// logging::Logger::addStream(&std::cout); - + std::ofstream logFile( path + simulationName + "_rank_" + std::to_string(mpirank) + ".log" ); logging::Logger::addStream(&logFile); @@ -138,22 +137,21 @@ void multipleLevel(const std::string& configPath) logging::Logger::timeStamp(logging::Logger::ENABLE); logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); + vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); + //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); auto gridFactory = GridFactory::make(); - gridFactory->setGridStrategy(Device::CPU); //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_UNDER_TRIANGLE); auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - - SPtr<ConfigFileReader> configReader = ConfigFileReader::getNewInstance(); - SPtr<ConfigData> configData = configReader->readConfigFile(configPath); - Communicator* comm = Communicator::getInstanz(); - SPtr<Parameter> para = Parameter::make(configData, comm); - std::shared_ptr<KernelMapper> kernelMapper = KernelMapper::getInstance(); + vf::basics::ConfigurationFile config; + config.load(configPath); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNummberOfProcess(), communicator.getPID(), &config); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); *logging::out << logging::Logger::INFO_HIGH << "SideLength = " << sideLengthX << " " << sideLengthY << " " << sideLengthZ << "\n"; *logging::out << logging::Logger::INFO_HIGH << "rank = " << rankX << " " << rankY << " " << rankZ << "\n"; @@ -196,7 +194,7 @@ void multipleLevel(const std::string& configPath) gridBuilder->addCoarseGrid( rankX *LX - PI - xOverlap, rankY *LY - PI - yOverlap, rankZ *LZ - PI - zOverlap, (rankX+1)*LX - PI + xOverlap, (rankY+1)*LY - PI + yOverlap, (rankZ+1)*LZ - PI + zOverlap, dx); - gridBuilder->setSubDomainBox( std::make_shared<BoundingBox>( rankX*LX - PI, (rankX+1)*LX - PI, + gridBuilder->setSubDomainBox( std::make_shared<BoundingBox>( rankX*LX - PI, (rankX+1)*LX - PI, rankY*LY - PI, (rankY+1)*LY - PI, rankZ*LZ - PI, (rankZ+1)*LZ - PI ) ); @@ -228,9 +226,9 @@ void multipleLevel(const std::string& configPath) if( sideLengthY > 1 && rankMY != rankPY ) gridBuilder->setCommunicationProcess ( CommunicationDirections::PY, rankPY); if( sideLengthZ > 1 && rankMZ != rankPZ ) gridBuilder->setCommunicationProcess ( CommunicationDirections::PZ, rankPZ); - if( rankMX == rankPX ) gridBuilder->getGrid(0)->repairCommunicationInices(CommunicationDirections::MX); - if( rankMY == rankPY ) gridBuilder->getGrid(0)->repairCommunicationInices(CommunicationDirections::MY); - if( rankMZ == rankPZ ) gridBuilder->getGrid(0)->repairCommunicationInices(CommunicationDirections::MZ); + if( rankMX == rankPX ) gridBuilder->getGrid(0)->repairCommunicationIndices(CommunicationDirections::MX); + if( rankMY == rankPY ) gridBuilder->getGrid(0)->repairCommunicationIndices(CommunicationDirections::MY); + if( rankMZ == rankPZ ) gridBuilder->getGrid(0)->repairCommunicationIndices(CommunicationDirections::MZ); *logging::out << logging::Logger::INFO_HIGH << "neighborRanks = " << rankPX << " " << rankMX << " " << rankPY << " " << rankMY << " " << rankPZ << " " << rankMZ << "\n"; } @@ -251,28 +249,26 @@ void multipleLevel(const std::string& configPath) //para->setDevices(std::vector<uint>{0,1}); para->setDevices(devices); - + para->setMaxDev(mpiWorldSize); ////////////////////////////////////////////////////////////////////////// - + para->setOutputPath( path ); para->setOutputPrefix( simulationName ); - para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix()); - para->setPrintFiles(true); - // para->setTEnd( 40 * lround(L/velocity) ); - //para->setTOut( 5 * lround(L/velocity) ); - para->setTOut( 100 ); + // para->setTimestepEnd( 40 * lround(L/velocity) ); + //para->setTimestepOut( 5 * lround(L/velocity) ); + para->setTimestepOut( 100 ); - para->setTEnd( 1000 ); - //para->setTOut( 1 ); + para->setTimestepEnd( 1000 ); + //para->setTimestepOut( 1 ); - para->setVelocity( velocity ); + para->setVelocityLB( velocity ); - para->setViscosity( viscosity ); + para->setViscosityLB( viscosity ); para->setVelocityRatio( 1.0 / velocity ); @@ -294,7 +290,7 @@ void multipleLevel(const std::string& configPath) } ); - para->setMainKernel(kernelMapper->getEnum( kernel )); + para->setMainKernel(kernel); if( !useLimiter ) para->setQuadricLimiters( 1000000.0, 1000000.0, 1000000.0 ); @@ -312,23 +308,19 @@ void multipleLevel(const std::string& configPath) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - SPtr<CudaMemoryManager> cudaMemoryManager = CudaMemoryManager::make(para); - SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); + + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); + SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); //SPtr<GridProvider> gridGenerator = GridProvider::makeGridReader(FILEFORMAT::BINARY, para, cudaMemoryManager); - Simulation sim; SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter()); - SPtr<KernelFactoryImp> kernelFactory = KernelFactoryImp::getInstance(); - SPtr<PreProcessorFactoryImp> preProcessorFactory = PreProcessorFactoryImp::getInstance(); - sim.setFactories(kernelFactory, preProcessorFactory); - sim.init(para, gridGenerator, fileWriter, cudaMemoryManager); - + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory); + sim.run(); + sim.addKineticEnergyAnalyzer( 10 ); sim.addEnstrophyAnalyzer( 10 ); sim.run(); - sim.free(); logFile.close(); } @@ -337,11 +329,11 @@ void multipleLevel(const std::string& configPath) int main( int argc, char* argv[]) { MPI_Init(&argc, &argv); - std::string str, str2; + std::string str, str2; if ( argv != NULL ) { //str = static_cast<std::string>(argv[0]); - + try { MPI_Comm_rank(MPI_COMM_WORLD, &mpirank); @@ -411,17 +403,17 @@ int main( int argc, char* argv[]) ////////////////////////////////////////////////////////////////////////// } - catch (const std::exception& e) + catch (const std::bad_alloc& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; + + *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; //std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } - catch (const std::bad_alloc e) + catch (const std::exception& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; + + *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; //std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } diff --git a/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp b/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp index 88ec364ea0e7d6a9010d67dac26f4a442db45e8f..06b3678d7c8ddd236c26a69686356fbe87c31db2 100644 --- a/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp +++ b/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp @@ -48,11 +48,8 @@ #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" #include "VirtualFluids_GPU/Parameter/Parameter.h" #include "VirtualFluids_GPU/Output/FileWriter.h" - -#include "VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h" -#include "VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h" - #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include <logger/Logger.h> @@ -68,7 +65,7 @@ LbmOrGks lbmOrGks = LBM; -const real L = 1.0; +// const real L = 1.0; const real velocity = 1.0; @@ -83,12 +80,16 @@ std::string simulationName(""); // 1: original setup of Lennard Lux (6 level, 4.0 cm -> 1.25 mm) // 2: setup 1 of MSch (4 level, 1.0 cm -> 1.25 mm) // 3: setup 2 of MSch (5 level, 1.6 cm -> 1.0 mm) -int setupDomain = 3; +// 4: setup 3 of MSch (small/test) (3 level, 4.0 cm -> 1.0 cm) +int setupDomain = 4; + +// std::string path("D:/out/WTG_RUB"); // Mollok +// std::string inputPath("D:/out/WTG_RUB/input/"); -std::string path("D:/out/WTG_RUB"); //Mollok -std::string inputPath("D:/out/WTG_RUB/input/"); +std::string path("/workspaces/VirtualFluids_dev/output/WTG_RUB_Results/"); // Aragorn +std::string inputPath("/workspaces/VirtualFluids_dev/stl/WTG_RUB/"); -const uint timeStepStartOut = 0; +// const uint timeStepStartOut = 0; const uint timeStepOut = 10000; const uint timeStepEnd = 100000; @@ -110,7 +111,11 @@ void multipleLevel(const std::string& configPath) logging::Logger::timeStamp(logging::Logger::ENABLE); logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - auto gridBuilder = MultipleGridBuilder::makeShared(); + vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); + + auto gridFactory = GridFactory::make(); + gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); + auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -124,15 +129,19 @@ void multipleLevel(const std::string& configPath) maxLevel = 5; viscosityLB = (real)3.75e-06; // LB units } else if (setupDomain == 2) { - dx = (real)1; + dx = (real)1; maxLevel = 3; viscosityLB = (real)1.5e-05; // LB units } else if (setupDomain == 3) { dx = (real)1.6; maxLevel = 4; viscosityLB = (real)9.375e-06; // LB units + } else if (setupDomain == 4) { + dx = (real)4.0; + maxLevel = 2; + viscosityLB = (real)3.75e-06; // LB units } - + real x_min = 0.0; real x_max = 1250.0; real y_min = 0.0; @@ -154,18 +163,18 @@ void multipleLevel(const std::string& configPath) // MeasurePoints [MP01-15: lvl maxLevel],[MP16-41: lvl 1]; disable when reducing numberOfLevels --> dx might be too // large if MP01-15 are used with low resolution dx, MPs might be placed in solid City-geometry - bool useMP = true; + bool useMP = false;//true; bool measureVeloProfilesOnly = false; // Two Components: true->DiffOn, false->DiffOff - bool diffOnOff = false; + // bool diffOnOff = false; // Resetting diff or flow field, e.g. after restart, do not reset diff/flow at start of measureRun ;-) - bool reset_diff = true; - bool reset_flow = true; + // bool reset_diff = false; + bool reset_flow = false; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - gridBuilder->addCoarseGrid(x_min, y_min, z_min, + gridBuilder->addCoarseGrid(x_min, y_min, z_min, x_max, y_max, z_max, dx); gridBuilder->setNumberOfLayers(0, 0); @@ -188,12 +197,11 @@ void multipleLevel(const std::string& configPath) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); - vf::basics::ConfigurationFile config; config.load(configPath); - SPtr<Parameter> para = std::make_shared<Parameter>(config, communicator.getNummberOfProcess(), communicator.getPID()); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNummberOfProcess(), communicator.getPID(), &config); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// const real velocityLB = (real)0.0844; // LB units @@ -211,14 +219,12 @@ void multipleLevel(const std::string& configPath) para->setOutputPath( path ); para->setOutputPrefix( "Unified_" + simulationName ); - para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix()); - para->setPrintFiles(true); para->setMaxLevel(maxLevel); - para->setVelocity(velocityLB); - para->setViscosity(viscosityLB); + para->setVelocityLB(velocityLB); + para->setViscosityLB(viscosityLB); para->setVelocityRatio(velocity/ velocityLB); @@ -231,8 +237,8 @@ void multipleLevel(const std::string& configPath) vz = (real)0.0; }); - para->setTOut( timeStepOut ); - para->setTEnd( timeStepEnd ); + para->setTimestepOut( timeStepOut ); + para->setTimestepEnd( timeStepEnd ); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -245,6 +251,10 @@ void multipleLevel(const std::string& configPath) gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// readVelocityProfile(); @@ -320,19 +330,12 @@ void multipleLevel(const std::string& configPath) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - SPtr<CudaMemoryManager> cudaMemoryManager = CudaMemoryManager::make(para); + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); - SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); + auto gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); - Simulation sim (communicator); - SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter()); - SPtr<KernelFactoryImp> kernelFactory = KernelFactoryImp::getInstance(); - SPtr<PreProcessorFactoryImp> preProcessorFactory = PreProcessorFactoryImp::getInstance(); - sim.setFactories(kernelFactory, preProcessorFactory); - sim.init(para, gridGenerator, fileWriter, cudaMemoryManager); + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory); sim.run(); - sim.free(); - } void readVelocityProfile() @@ -470,7 +473,7 @@ void addFineGrids(SPtr<MultipleGridBuilder> gridBuilder, uint &maxLevel, real &r } } } - } + } else if (setupDomain == 3) { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ // creates Cuboids (FG1 to FG2, lvl 1 to lvl 2) and add STLs (FG3 to FG4, lvl 3 to lvl 4) depending on maxLevel @@ -484,19 +487,19 @@ void addFineGrids(SPtr<MultipleGridBuilder> gridBuilder, uint &maxLevel, real &r // FG4 -> dx = 1.0 mm; lvl 4 // //// FineGrid Level 1 ->dx = 8.0 mm; lvl 1 - //auto FG1 = new Cuboid(-20, -20, -5 + z_offset, 800, 200, 75 + z_offset); + // auto FG1 = new Cuboid(-20, -20, -5 + z_offset, 800, 200, 75 + z_offset); // FineGrid Level 1 -> dx = 8.0 mm; lvl 1 auto FG1_1 = new Cuboid(-20, -20, -5 + z_offset, 780, 200, 30 + z_offset); - auto FG1_2 = new Cuboid(500, -20, 5 + z_offset, 720, 210, 75 + z_offset); - auto FG1 = new Conglomerate(); + auto FG1_2 = new Cuboid(500, -20, 5 + z_offset, 720, 210, 75 + z_offset); + auto FG1 = new Conglomerate(); FG1->add(FG1_1); FG1->add(FG1_2); // FineGrid Level 2 -> dx = 4.0 mm; lvl 2 auto FG2_1 = new Cuboid(-20, -20, -5 + z_offset, 760, 200, 10 + z_offset); - auto FG2_2 = new Cuboid(520, -20, 5 + z_offset, 700, 210, 50 + z_offset); - auto FG2 = new Conglomerate(); + auto FG2_2 = new Cuboid(520, -20, 5 + z_offset, 700, 210, 50 + z_offset); + auto FG2 = new Conglomerate(); FG2->add(FG2_1); FG2->add(FG2_2); @@ -528,6 +531,34 @@ void addFineGrids(SPtr<MultipleGridBuilder> gridBuilder, uint &maxLevel, real &r } } } + else if (setupDomain == 4) { + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ + // creates Cuboids (FG1 to FG2, lvl 1 to lvl 2) depending on + // maxLevel and rotationOfCity; also adds FineGrids(FGs) to gridbuilder + + // GridList(CG = coarse grid, fg = fine grid) + // CG -> dx = 4 cm; lvl 0 + // FG1 -> dx = 2 cm; lvl 1 + // FG2 -> dx = 1 cm; lvl 2 + // + // FineGrid Level 1 ->dx = 2 cm; lvl 1 + auto FG1 = new Cuboid(-20, -20, -5 + z_offset, 800, 200, 75 + z_offset); + + // FineGrid Level 2 -> dx = 1 cm; lvl 2 + auto FG2_1 = new Cuboid(-20, -20, -5 + z_offset, 760, 200, 10 + z_offset); + auto FG2_2 = new Cuboid(500, -20, 5 + z_offset, 680, 210, 50 + z_offset); + auto FG2 = new Conglomerate(); + FG2->add(FG2_1); + FG2->add(FG2_2); + + // Adding FineGrids 1 to 2 depending on maxLevel + if (maxLevel >= 1) { + gridBuilder->addGrid(FG1, 1); + if (maxLevel >= 2) { + gridBuilder->addGrid(FG2, 2); + } + } + } @@ -732,11 +763,11 @@ int main( int argc, char* argv[]) std::cout << "Log initialization failed: " << ex.what() << std::endl; } catch (const std::bad_alloc& e) - { + { VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); } catch (const std::exception& e) - { + { VF_LOG_CRITICAL("exception: {}", e.what()); } catch (...) diff --git a/apps/gpu/LBM/gridGeneratorTest/CMakeLists.txt b/apps/gpu/LBM/gridGeneratorTest/CMakeLists.txt index b05d36ee5a0d47a21ee5b96fb4fbb2cb0485ae38..6493b72cfd996a6866fe0fb07291dd2e3438dd03 100644 --- a/apps/gpu/LBM/gridGeneratorTest/CMakeLists.txt +++ b/apps/gpu/LBM/gridGeneratorTest/CMakeLists.txt @@ -1,7 +1,5 @@ -PROJECT(GridGeneratorTest) +PROJECT(GridGeneratorTest LANGUAGES CUDA CXX) -vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES gridGenerator.cpp) +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES gridGenerator.cpp) -set_source_files_properties(gridGenerator.cpp PROPERTIES LANGUAGE CUDA) - -linkCUDA() +set_source_files_properties(DrivenCavity.cpp PROPERTIES LANGUAGE CUDA) diff --git a/apps/gpu/LBM/gridGeneratorTest/gridGenerator.cpp b/apps/gpu/LBM/gridGeneratorTest/gridGenerator.cpp index 401ffc1efe60aded6341ee18de056b96d4b986da..40a9aeb6212baf4e6b4354b0bd9c13dea95e0e37 100644 --- a/apps/gpu/LBM/gridGeneratorTest/gridGenerator.cpp +++ b/apps/gpu/LBM/gridGeneratorTest/gridGenerator.cpp @@ -15,9 +15,8 @@ #include <math.h> #include "Core/LbmOrGks.h" -#include "Core/Input/Input.h" #include "Core/StringUtilities/StringUtil.h" -#include "Core/Input/ConfigFileReader/ConfigFileReader.h" +#include "basics/config/ConfigurationFile.h" #include "VirtualFluids_GPU/LBM/Simulation.h" #include "VirtualFluids_GPU/Communication/Communicator.h" @@ -29,9 +28,9 @@ #include "VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h" #include "VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" -#include "VirtualFluids_GPU/Kernel/Utilities/Mapper/KernelMapper/KernelMapper.h" #include "global.h" @@ -72,20 +71,17 @@ void multipleLevel(const std::string& configPath) //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); auto gridFactory = GridFactory::make(); - gridFactory->setGridStrategy(Device::CPU); //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_UNDER_TRIANGLE); auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - - Communicator* comm = Communicator::getInstanz(); - SPtr<ConfigFileReader> configReader = ConfigFileReader::getNewInstance(); - SPtr<ConfigData> configData = configReader->readConfigFile(configPath); - std::shared_ptr<KernelMapper> kernelMapper = KernelMapper::getInstance(); - - SPtr<Parameter> para = Parameter::make(configData, comm); + vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); + vf::basics::ConfigurationFile config; + config.load(configPath); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNummberOfProcess(), communicator.getPID(), &config); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -108,13 +104,13 @@ void multipleLevel(const std::string& configPath) }; int testcase = SphereTest; - + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (testcase == TGV) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// { real dx = 1.0; - real vx = 0.049; + // real vx = 0.049; ////////////////////////////////////////////////////////////////////////// //32 gridBuilder->addCoarseGrid(-24, -2, -16, @@ -122,7 +118,7 @@ void multipleLevel(const std::string& configPath) ////////////////////////////////////////////////////////////////////////// gridBuilder->setPeriodicBoundaryCondition(true, true, true); ////////////////////////////////////////////////////////////////////////// - gridBuilder->buildGrids(LBM, true); + gridBuilder->buildGrids(LBM, true); ////////////////////////////////////////////////////////////////////////// SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); ////////////////////////////////////////////////////////////////////////// @@ -144,7 +140,7 @@ void multipleLevel(const std::string& configPath) //real dx = 2.0 * PI / 64.0; // 64^3 nodes //real dx = 2.0 * PI / 128.0; // 128^3 nodes //real dx = 2.0 * PI / 256.0; // 128^3 nodes - real vx = 0.049; + // real vx = 0.049; gridBuilder->addCoarseGrid(-PI, -PI, -PI, PI, PI, PI, dx); @@ -152,16 +148,6 @@ void multipleLevel(const std::string& configPath) gridBuilder->setPeriodicBoundaryCondition(true, true, true); gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! - //////////////////////////////////////////////////////////////////////////// - //gridBuilder->setVelocityBoundaryCondition(SideType::PY, vx, 0.0, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::MY, vx, 0.0, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx, 0.0, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vx, 0.0, 0.0); - - //gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); - - //gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); ////////////////////////////////////////////////////////////////////////// SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); @@ -192,31 +178,29 @@ void multipleLevel(const std::string& configPath) para->setOutputPath( "F:/Work/Computations/out/Sphere/" ); para->setOutputPrefix( "Sphere" ); - para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix()); - para->setPrintFiles(true); - - para->setVelocity( vx ); - para->setViscosity( ( vx * D / dx ) / Re ); + + para->setVelocityLB( vx ); + para->setViscosityLB( ( vx * D / dx ) / Re ); para->setVelocityRatio(1.0); - para->setTOut( 1000 ); - para->setTEnd( 100000 ); + para->setTimestepOut( 1000 ); + para->setTimestepEnd( 100000 ); para->setCalcDragLift(true); para->setUseWale(false); - para->setMainKernel(kernelMapper->getEnum("CumulantK15Comp")); + para->setMainKernel("CumulantK15Comp"); ////////////////////////////////////////////////////////////////////////// - TriangularMesh* sphereSTL = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/Sphere/SphereNotOptimal.stl"); + // TriangularMesh* sphereSTL = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/Sphere/SphereNotOptimal.stl"); TriangularMesh* sphereRef_1_STL = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/Sphere/SphereRef_1.stl"); - TriangularMesh* sphereRef_2_STL = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/Sphere/SphereRef_2.stl"); + // TriangularMesh* sphereRef_2_STL = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/Sphere/SphereRef_2.stl"); Object* sphere = new Sphere( 0, 0, 0, 0.5*D ); @@ -225,7 +209,7 @@ void multipleLevel(const std::string& configPath) //gridBuilder->setNumberOfLayers(10,8); //gridBuilder->addGrid(SphereSTL, 2); - + gridBuilder->setNumberOfLayers(4,8); gridBuilder->addGrid(sphereRef_1_STL, 1); //gridBuilder->addGrid(sphereRef_2_STL, 4); @@ -234,7 +218,7 @@ void multipleLevel(const std::string& configPath) //gridBuilder->addGrid(sphere, 5); - + //gridBuilder->addGeometry(SphereSTL); gridBuilder->addGeometry(sphere); @@ -251,7 +235,11 @@ void multipleLevel(const std::string& configPath) gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); + ////////////////////////////////////////////////////////////////////////// SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); ////////////////////////////////////////////////////////////////////////// @@ -276,22 +264,20 @@ void multipleLevel(const std::string& configPath) para->setOutputPath( "F:/Work/Computations/out/DrivAerNew/" ); para->setOutputPrefix( "DrivAer" ); - para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix()); - para->setPrintFiles(true); - - para->setVelocity( vx ); - para->setViscosity( ( vx * L / dx ) / Re ); + + para->setVelocityLB( vx ); + para->setViscosityLB( ( vx * L / dx ) / Re ); //para->setVelocityRatio(1.0 / velocityLB); para->setVelocityRatio(1.0); - para->setTOut( 10000 ); - para->setTEnd( 100000 ); + para->setTimestepOut( 10000 ); + para->setTimestepEnd( 100000 ); para->setUseWale(false); - para->setMainKernel(kernelMapper->getEnum("CumulantK20Comp")); + para->setMainKernel("CumulantK20Comp"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -319,7 +305,7 @@ void multipleLevel(const std::string& configPath) gridBuilder->setNumberOfLayers(10,8); gridBuilder->addGrid(DrivAerRefBoxSTL, 4); - + gridBuilder->setNumberOfLayers(10,8); gridBuilder->addGrid(DrivAerSTL, 5); @@ -340,7 +326,11 @@ void multipleLevel(const std::string& configPath) gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); + ////////////////////////////////////////////////////////////////////////// SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); @@ -361,7 +351,7 @@ void multipleLevel(const std::string& configPath) //SimulationFileWriter::write("grid/", gridBuilder, FILEFORMAT::ASCII); //return; - //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); + //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -378,27 +368,25 @@ void multipleLevel(const std::string& configPath) para->setOutputPath( "F:/Work/Computations/out/PaperPlane/" ); para->setOutputPrefix( "PaperPlaneK17winglet" ); - para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix()); - para->setPrintFiles(true); - - para->setVelocity( vx ); - para->setViscosity( ( vx * L / dx ) / Re ); + + para->setVelocityLB( vx ); + para->setViscosityLB( ( vx * L / dx ) / Re ); para->setVelocityRatio(1.0); - para->setTOut( 1000 ); - para->setTEnd( 100000 ); + para->setTimestepOut( 1000 ); + para->setTimestepEnd( 100000 ); para->setUseWale(false); - para->setMainKernel(kernelMapper->getEnum("CumulantAA2016CompSP27")); + para->setMainKernel("CumulantAA2016CompSP27"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TriangularMesh* STL = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/PaperPlane_1.stl"); //TriangularMesh* STL = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/PaperPlane_1_winglet.stl"); - + TriangularMesh* RefBoxSTL = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/PaperPlane_1_ref.stl"); //TriangularMesh* RefBoxSTL = TriangularMesh::make("F:/Work/Computations/gridGenerator/stl/PaperPlane_1_winglet_ref.stl"); @@ -426,6 +414,10 @@ void multipleLevel(const std::string& configPath) gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); + ////////////////////////////////////////////////////////////////////////// gridBuilder->writeGridsToVtk("F:/Work/Computations/out/PaperPlane/PaperPlane_Grid_"); @@ -437,7 +429,7 @@ void multipleLevel(const std::string& configPath) //SimulationFileWriter::write("grid/", gridBuilder, FILEFORMAT::ASCII); //return; - //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); + //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -454,21 +446,19 @@ void multipleLevel(const std::string& configPath) para->setOutputPath( "F:/Work/Computations/out/StlGroupTest/" ); para->setOutputPrefix( "StlGroupTest" ); - para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix()); - para->setPrintFiles(true); - - para->setVelocity( vx ); - para->setViscosity( ( vx * L / dx ) / Re ); + + para->setVelocityLB( vx ); + para->setViscosityLB( ( vx * L / dx ) / Re ); para->setVelocityRatio(1.0); - para->setTOut( 1000 ); - para->setTEnd( 100000 ); + para->setTimestepOut( 1000 ); + para->setTimestepEnd( 100000 ); para->setUseWale(false); - para->setMainKernel(kernelMapper->getEnum("CumulantAA2016CompSP27")); + para->setMainKernel("CumulantAA2016CompSP27"); //para->setMainKernel(kernelMapper->getEnum("CumulantOneCompSP27")); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -496,6 +486,10 @@ void multipleLevel(const std::string& configPath) gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); + ////////////////////////////////////////////////////////////////////////// SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); @@ -549,7 +543,7 @@ void multipleLevel(const std::string& configPath) gridBuilder->addCoarseGrid(-30.0, -20.0, 0.0 - z0, 50.0, 20.0, 25.0 - z0, dx); - + gridBuilder->setNumberOfLayers(10,8); gridBuilder->addGrid( new Cuboid( - 6.6, -6, -0.7, 20.6 , 6, 5.3 ), 1 ); gridBuilder->addGrid( new Cuboid( -3.75, -3, -0.7, 11.75, 3, 2.65 ), 2 ); @@ -557,7 +551,7 @@ void multipleLevel(const std::string& configPath) gridBuilder->setNumberOfLayers(10,8); gridBuilder->addGrid(DLC_RefBox_Level_3, 3); gridBuilder->addGrid(DLC_RefBox_Level_4, 4); - + Conglomerate* refinement = new Conglomerate(); refinement->add(DLC_RefBox_Level_5); refinement->add(VW370_SERIE_STL); @@ -582,7 +576,11 @@ void multipleLevel(const std::string& configPath) gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); + ////////////////////////////////////////////////////////////////////////// SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); @@ -604,13 +602,13 @@ void multipleLevel(const std::string& configPath) for( uint patch : frontWheelPatches ){ gridBuilder->getGeometryBoundaryCondition(gridBuilder->getNumberOfLevels() - 1)->setTangentialVelocityForPatch( grid, patch, wheelsFrontX, -2.0, wheelsFrontZ, - wheelsFrontX, 2.0, wheelsFrontZ, + wheelsFrontX, 2.0, wheelsFrontZ, wheelTangentialVelocity, wheelsRadius); } for( uint patch : rearWheelPatches ){ gridBuilder->getGeometryBoundaryCondition(gridBuilder->getNumberOfLevels() - 1)->setTangentialVelocityForPatch( grid, patch, wheelsRearX , -2.0, wheelsRearZ , - wheelsRearX , 2.0, wheelsRearZ , + wheelsRearX , 2.0, wheelsRearZ , wheelTangentialVelocity, wheelsRadius); } @@ -625,8 +623,8 @@ void multipleLevel(const std::string& configPath) //SimulationFileWriter::write("D:/GRIDGENERATION/files/", gridBuilder, FILEFORMAT::ASCII); //SimulationFileWriter::write("C:/Users/lenz/Desktop/Work/gridGenerator/grid/", gridBuilder, FILEFORMAT::ASCII); SimulationFileWriter::write("grid/", gridBuilder, FILEFORMAT::ASCII); - - //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); + + //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -643,36 +641,34 @@ void multipleLevel(const std::string& configPath) para->setOutputPath( "F:/Work/Computations/out/Sphere/" ); para->setOutputPrefix( "Sphere" ); - para->setFName(para->getOutputPath() + "/" + para->getOutputPrefix()); - para->setPrintFiles(true); - - para->setVelocity( vx ); - para->setViscosity( ( vx * D / dx ) / Re ); + + para->setVelocityLB( vx ); + para->setViscosityLB( ( vx * D / dx ) / Re ); para->setVelocityRatio(1.0); - para->setTOut( 1000 ); - para->setTEnd( 100000 ); + para->setTimestepOut( 1000 ); + para->setTimestepEnd( 100000 ); para->setCalcDragLift(true); para->setUseWale(false); - para->setMainKernel(kernelMapper->getEnum("CumulantK15Comp")); + para->setMainKernel("CumulantK15Comp"); para->setDevices( { 0, 1 } ); para->setMaxDev(2); //const uint generatePart = 1; - const uint generatePart = Communicator::getInstanz()->getPID(); - + const uint generatePart = communicator.getPID(); + std::ofstream logFile2; - + if( generatePart == 0 ) logFile2.open( "F:/Work/Computations/gridGenerator/grid/0/gridGeneratorLog.txt" ); //logFile2.open( "grid/0/gridGeneratorLog.txt" ); - + if( generatePart == 1 ) logFile2.open( "F:/Work/Computations/gridGenerator/grid/1/gridGeneratorLog.txt" ); //logFile2.open( "grid/1/gridGeneratorLog.txt" ); @@ -683,17 +679,17 @@ void multipleLevel(const std::string& configPath) //TriangularMesh* triangularMesh = TriangularMesh::make("stl/ShpereNotOptimal.lnx.stl"); // all - //gridBuilder->addCoarseGrid(-2, -2, -2, + //gridBuilder->addCoarseGrid(-2, -2, -2, // 4, 2, 2, dx); real overlap = 10.0 * dx; if( generatePart == 0 ) - gridBuilder->addCoarseGrid(-2.0 , -2.0, -2.0, + gridBuilder->addCoarseGrid(-2.0 , -2.0, -2.0, 0.5 + overlap, 2.0, 2.0, dx); if( generatePart == 1 ) - gridBuilder->addCoarseGrid( 0.5 - overlap, -2.0, -2.0, + gridBuilder->addCoarseGrid( 0.5 - overlap, -2.0, -2.0, 4.0 , 2.0, 2.0, dx); @@ -701,26 +697,26 @@ void multipleLevel(const std::string& configPath) gridBuilder->addGrid(triangularMesh, 1); gridBuilder->addGeometry(triangularMesh); - + if( generatePart == 0 ) - gridBuilder->setSubDomainBox( std::make_shared<BoundingBox>( -2.0, 0.5, - -2.0, 2.0, + gridBuilder->setSubDomainBox( std::make_shared<BoundingBox>( -2.0, 0.5, + -2.0, 2.0, -2.0, 2.0 ) ); - + if( generatePart == 1 ) - gridBuilder->setSubDomainBox( std::make_shared<BoundingBox>( 0.5, 4.0, - -2.0, 2.0, + gridBuilder->setSubDomainBox( std::make_shared<BoundingBox>( 0.5, 4.0, + -2.0, 2.0, -2.0, 2.0 ) ); gridBuilder->setPeriodicBoundaryCondition(false, false, false); gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! - + if( generatePart == 0 ){ gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 1); } - + if( generatePart == 1 ){ gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 0); @@ -741,7 +737,11 @@ void multipleLevel(const std::string& configPath) } gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); + ////////////////////////////////////////////////////////////////////////// if (generatePart == 0) { @@ -761,14 +761,14 @@ void multipleLevel(const std::string& configPath) //SimulationFileWriter::write("grid/1/", gridBuilder, FILEFORMAT::ASCII); //return; - - //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); + + //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); } } else { - //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); + //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); //gridGenerator = GridProvider::makeGridReader(FILEFORMAT::BINARY, para, cudaMemoryManager); } @@ -780,37 +780,25 @@ void multipleLevel(const std::string& configPath) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - SPtr<CudaMemoryManager> cudaMemoryManager = CudaMemoryManager::make(para); + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); SPtr<GridProvider> gridGenerator; - if( useGridGenerator ) gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); + if( useGridGenerator ) gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); else gridGenerator = GridProvider::makeGridReader(FILEFORMAT::BINARY, para, cudaMemoryManager); - Simulation sim; - SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter()); - - SPtr<KernelFactoryImp> kernelFactory = KernelFactoryImp::getInstance(); - - SPtr<PreProcessorFactoryImp> preProcessorFactory = PreProcessorFactoryImp::getInstance(); - - sim.setFactories(kernelFactory, preProcessorFactory); - - sim.init(para, gridGenerator, fileWriter, cudaMemoryManager); - - + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory); sim.run(); - sim.free(); } int main( int argc, char* argv[]) { MPI_Init(&argc, &argv); - std::string str, str2; + std::string str, str2; if ( argv != NULL ) { //str = static_cast<std::string>(argv[0]); - + try { ////////////////////////////////////////////////////////////////////////// @@ -831,15 +819,15 @@ int main( int argc, char* argv[]) ////////////////////////////////////////////////////////////////////////// } - catch (const std::exception& e) + catch (const std::bad_alloc& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; + + *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; } - catch (const std::bad_alloc e) + catch (const std::exception& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; + + *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; } catch (...) { diff --git a/apps/gpu/LBM/lbmTest/main.cpp b/apps/gpu/LBM/lbmTest/main.cpp index a2590255465d4db0724ce0c6e04e466ad14c2463..79d767cca40d710a41c7d2d6d1c512f74270023c 100644 --- a/apps/gpu/LBM/lbmTest/main.cpp +++ b/apps/gpu/LBM/lbmTest/main.cpp @@ -27,6 +27,7 @@ #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" #include "VirtualFluids_GPU/Parameter/Parameter.h" #include "VirtualFluids_GPU/Output/FileWriter.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include "global.h" @@ -75,7 +76,7 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input std::string gridPath = getGridPath(para, _gridpath); para->setOutputPath(_path); para->setOutputPrefix(_prefix); - para->setFName(_path + "/" + _prefix); + para->setPathAndFilename(_path + "/" + _prefix); para->setPrintFiles(false); para->setPrintFiles(StringUtil::toBool(input->getValue("WriteGrid"))); para->setGeometryValues(StringUtil::toBool(input->getValue("GeometryValues"))); @@ -89,9 +90,9 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input para->setUseWale(StringUtil::toBool(input->getValue("UseWale"))); para->setSimulatePorousMedia(StringUtil::toBool(input->getValue("SimulatePorousMedia"))); para->setD3Qxx(StringUtil::toInt(input->getValue("D3Qxx"))); - para->setTEnd(StringUtil::toInt(input->getValue("TimeEnd"))); - para->setTOut(StringUtil::toInt(input->getValue("TimeOut"))); - para->setTStartOut(StringUtil::toInt(input->getValue("TimeStartOut"))); + para->setTimestepEnd(StringUtil::toInt(input->getValue("TimeEnd"))); + para->setTimestepOut(StringUtil::toInt(input->getValue("TimeOut"))); + para->setTimestepStartOut(StringUtil::toInt(input->getValue("TimeStartOut"))); para->setTimeCalcMedStart(StringUtil::toInt(input->getValue("TimeStartCalcMedian"))); para->setTimeCalcMedEnd(StringUtil::toInt(input->getValue("TimeEndCalcMedian"))); para->setPressInID(StringUtil::toInt(input->getValue("PressInID"))); @@ -105,8 +106,8 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input para->setTemperatureInit(StringUtil::toFloat(input->getValue("Temp"))); para->setTemperatureBC(StringUtil::toFloat(input->getValue("TempBC"))); ////////////////////////////////////////////////////////////////////////// - para->setViscosity(StringUtil::toFloat(input->getValue("Viscosity_LB"))); - para->setVelocity(StringUtil::toFloat(input->getValue("Velocity_LB"))); + para->setViscosityLB(StringUtil::toFloat(input->getValue("Viscosity_LB"))); + para->setVelocityLB(StringUtil::toFloat(input->getValue("Velocity_LB"))); para->setViscosityRatio(StringUtil::toFloat(input->getValue("Viscosity_Ratio_World_to_LB"))); para->setVelocityRatio(StringUtil::toFloat(input->getValue("Velocity_Ratio_World_to_LB"))); para->setDensityRatio(StringUtil::toFloat(input->getValue("Density_Ratio_World_to_LB"))); @@ -282,6 +283,7 @@ void multipleLevel(const std::string& configPath) auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); SPtr<Parameter> para = Parameter::make(); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); SPtr<GridProvider> gridGenerator; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -347,17 +349,6 @@ void multipleLevel(const std::string& configPath) gridBuilder->setPeriodicBoundaryCondition(true, true, true); gridBuilder->buildGrids(LBM, true); // buildGrids() has to be called before setting the BCs!!!! - //////////////////////////////////////////////////////////////////////////// - //gridBuilder->setVelocityBoundaryCondition(SideType::PY, vx, 0.0, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::MY, vx, 0.0, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx, 0.0, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vx, 0.0, 0.0); - - //gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); - //gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); - - //gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - ////////////////////////////////////////////////////////////////////////// SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); ////////////////////////////////////////////////////////////////////////// @@ -405,7 +396,10 @@ void multipleLevel(const std::string& configPath) gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); ////////////////////////////////////////////////////////////////////////// SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); ////////////////////////////////////////////////////////////////////////// @@ -472,7 +466,11 @@ void multipleLevel(const std::string& configPath) gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); + ////////////////////////////////////////////////////////////////////////// SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); @@ -567,7 +565,11 @@ void multipleLevel(const std::string& configPath) gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); + ////////////////////////////////////////////////////////////////////////// SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); @@ -698,7 +700,10 @@ void multipleLevel(const std::string& configPath) } gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); ////////////////////////////////////////////////////////////////////////// if (generatePart == 0) { diff --git a/apps/gpu/LBM/metisTest/main.cpp b/apps/gpu/LBM/metisTest/main.cpp index b5e2aa40a315004130bd5eed24b438e318d16ab7..6a62ff72c7b71211610ba4e40f81e9a1f527eb7f 100644 --- a/apps/gpu/LBM/metisTest/main.cpp +++ b/apps/gpu/LBM/metisTest/main.cpp @@ -76,7 +76,7 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input std::string gridPath = getGridPath(para, _gridpath); para->setOutputPath(_path); para->setOutputPrefix(_prefix); - para->setFName(_path + "/" + _prefix); + para->setPathAndFilename(_path + "/" + _prefix); para->setPrintFiles(false); para->setPrintFiles(StringUtil::toBool(input->getValue("WriteGrid"))); para->setGeometryValues(StringUtil::toBool(input->getValue("GeometryValues"))); @@ -90,9 +90,9 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input para->setUseWale(StringUtil::toBool(input->getValue("UseWale"))); para->setSimulatePorousMedia(StringUtil::toBool(input->getValue("SimulatePorousMedia"))); para->setD3Qxx(StringUtil::toInt(input->getValue("D3Qxx"))); - para->setTEnd(StringUtil::toInt(input->getValue("TimeEnd"))); - para->setTOut(StringUtil::toInt(input->getValue("TimeOut"))); - para->setTStartOut(StringUtil::toInt(input->getValue("TimeStartOut"))); + para->setTimestepEnd(StringUtil::toInt(input->getValue("TimeEnd"))); + para->setTimestepOut(StringUtil::toInt(input->getValue("TimeOut"))); + para->setTimestepStartOut(StringUtil::toInt(input->getValue("TimeStartOut"))); para->setTimeCalcMedStart(StringUtil::toInt(input->getValue("TimeStartCalcMedian"))); para->setTimeCalcMedEnd(StringUtil::toInt(input->getValue("TimeEndCalcMedian"))); para->setPressInID(StringUtil::toInt(input->getValue("PressInID"))); @@ -106,8 +106,8 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input para->setTemperatureInit(StringUtil::toFloat(input->getValue("Temp"))); para->setTemperatureBC(StringUtil::toFloat(input->getValue("TempBC"))); ////////////////////////////////////////////////////////////////////////// - para->setViscosity(StringUtil::toFloat(input->getValue("Viscosity_LB"))); - para->setVelocity(StringUtil::toFloat(input->getValue("Velocity_LB"))); + para->setViscosityLB(StringUtil::toFloat(input->getValue("Viscosity_LB"))); + para->setVelocityLB(StringUtil::toFloat(input->getValue("Velocity_LB"))); para->setViscosityRatio(StringUtil::toFloat(input->getValue("Viscosity_Ratio_World_to_LB"))); para->setVelocityRatio(StringUtil::toFloat(input->getValue("Velocity_Ratio_World_to_LB"))); para->setDensityRatio(StringUtil::toFloat(input->getValue("Density_Ratio_World_to_LB"))); @@ -332,9 +332,12 @@ void multipleLevel(const std::string& configPath) gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - - ////////////////////////////////////////////////////////////////////////// + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); + + ////////////////////////////////////////////////////////////////////////// gridBuilder->writeGridsToVtk("F:/Work/Computations/gridGenerator/grid/Test_"); //gridBuilder->writeArrows ("F:/Work/Computations/gridGenerator/grid/Test_Arrow"); diff --git a/apps/gpu/LidDrivenCavity/LidDrivenCavity.cpp b/apps/gpu/LidDrivenCavity/LidDrivenCavity.cpp index 8f11d8a197be080e59ab1e445596341b579ea66d..7c1f51f3415e381692f82fcd4822a7b8ca4517f7 100644 --- a/apps/gpu/LidDrivenCavity/LidDrivenCavity.cpp +++ b/apps/gpu/LidDrivenCavity/LidDrivenCavity.cpp @@ -1,28 +1,28 @@ //======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ // \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ // -// This file is part of VirtualFluids. VirtualFluids is free software: you can +// This file is part of VirtualFluids. VirtualFluids is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of +// License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. -// +// // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // @@ -63,6 +63,7 @@ #include "VirtualFluids_GPU/Parameter/Parameter.h" #include "VirtualFluids_GPU/Output/FileWriter.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" ////////////////////////////////////////////////////////////////////////// @@ -127,42 +128,43 @@ int main( int argc, char* argv[]) auto gridFactory = GridFactory::make(); gridFactory->setGridStrategy(Device::CPU); auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - + ////////////////////////////////////////////////////////////////////////// // create grid ////////////////////////////////////////////////////////////////////////// - real dx = L / real(nx); + real dx = L / real(nx); + + gridBuilder->addCoarseGrid(-0.5 * L, -0.5 * L, -0.5 * L, + 0.5 * L, 0.5 * L, 0.5 * L, dx); - gridBuilder->addCoarseGrid(-0.5 * L, -0.5 * L, -0.5 * L, - 0.5 * L, 0.5 * L, 0.5 * L, dx); + gridBuilder->setPeriodicBoundaryCondition(false, false, false); - gridBuilder->setPeriodicBoundaryCondition(false, false, false); + gridBuilder->buildGrids(lbmOrGks, false); - gridBuilder->buildGrids(lbmOrGks, false); - ////////////////////////////////////////////////////////////////////////// // branch between LBM and GKS ////////////////////////////////////////////////////////////////////////// if( lbmOrGks == LBM ) { - SPtr<Parameter> para = Parameter::make(); - + SPtr<Parameter> para = Parameter::make(); + BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); + ////////////////////////////////////////////////////////////////////////// // compute parameters in lattice units ////////////////////////////////////////////////////////////////////////// const real velocityLB = velocity * dt / dx; // LB units - const real vx = velocityLB / sqrt(2.0); // LB units - const real vy = velocityLB / sqrt(2.0); // LB units + const real vx = velocityLB / sqrt(2.0); // LB units + const real vy = velocityLB / sqrt(2.0); // LB units const real viscosityLB = nx * velocityLB / Re; // LB units *logging::out << logging::Logger::INFO_HIGH << "velocity [dx/dt] = " << velocityLB << " \n"; *logging::out << logging::Logger::INFO_HIGH << "viscosity [dx^2/dt] = " << viscosityLB << "\n"; - + ////////////////////////////////////////////////////////////////////////// // set parameters ////////////////////////////////////////////////////////////////////////// @@ -170,8 +172,6 @@ int main( int argc, char* argv[]) para->setOutputPath( path ); para->setOutputPrefix( simulationName ); - para->setPathAndFilename(para->getOutputPath() + "/" + para->getOutputPrefix()); - para->setPrintFiles(true); para->setVelocityLB(velocityLB); @@ -181,26 +181,29 @@ int main( int argc, char* argv[]) para->setTimestepOut( timeStepOut ); para->setTimestepEnd( timeStepEnd ); - + ////////////////////////////////////////////////////////////////////////// // set boundary conditions ////////////////////////////////////////////////////////////////////////// - gridBuilder->setNoSlipBoundaryCondition (SideType::PX); - gridBuilder->setNoSlipBoundaryCondition (SideType::MX); - gridBuilder->setNoSlipBoundaryCondition (SideType::PY); - gridBuilder->setNoSlipBoundaryCondition (SideType::MY); - gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx, vy, 0.0); - gridBuilder->setNoSlipBoundaryCondition (SideType::MZ); - + gridBuilder->setNoSlipBoundaryCondition (SideType::PX); + gridBuilder->setNoSlipBoundaryCondition (SideType::MX); + gridBuilder->setNoSlipBoundaryCondition (SideType::PY); + gridBuilder->setNoSlipBoundaryCondition (SideType::MY); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx, vy, 0.0); + gridBuilder->setNoSlipBoundaryCondition (SideType::MZ); + + bcFactory.setNoSlipBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipBounceBack); + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocitySimpleBounceBackCompressible); + ////////////////////////////////////////////////////////////////////////// // set copy mesh to simulation ////////////////////////////////////////////////////////////////////////// - SPtr<CudaMemoryManager> cudaMemoryManager = CudaMemoryManager::make(para); + SPtr<CudaMemoryManager> cudaMemoryManager = CudaMemoryManager::make(para); + + SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); - SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager); - ////////////////////////////////////////////////////////////////////////// // run simulation ////////////////////////////////////////////////////////////////////////// @@ -214,19 +217,19 @@ int main( int argc, char* argv[]) else { CudaUtility::setCudaDevice(0); - + Parameters parameters; - + ////////////////////////////////////////////////////////////////////////// // compute remaining parameters ////////////////////////////////////////////////////////////////////////// - const real vx = velocity / sqrt(2.0); - const real vy = velocity / sqrt(2.0); - + const real vx = velocity / sqrt(2.0); + const real vy = velocity / sqrt(2.0); + parameters.K = 2.0; parameters.Pr = 1.0; - + const real Ma = 0.1; real rho = 1.0; @@ -239,7 +242,7 @@ int main( int argc, char* argv[]) *logging::out << logging::Logger::INFO_HIGH << "mu = " << mu << " m^2/s\n"; *logging::out << logging::Logger::INFO_HIGH << "CFL = " << dt * ( velocity + cs ) / dx << "\n"; - + ////////////////////////////////////////////////////////////////////////// // set parameters ////////////////////////////////////////////////////////////////////////// @@ -250,7 +253,7 @@ int main( int argc, char* argv[]) parameters.dx = dx; parameters.lambdaRef = lambda; - + ////////////////////////////////////////////////////////////////////////// // set copy mesh to simulation ////////////////////////////////////////////////////////////////////////// @@ -260,7 +263,7 @@ int main( int argc, char* argv[]) meshAdapter.inputGrid(); auto dataBase = std::make_shared<DataBase>( "GPU" ); - + ////////////////////////////////////////////////////////////////////////// // set boundary conditions ////////////////////////////////////////////////////////////////////////// @@ -268,21 +271,21 @@ int main( int argc, char* argv[]) SPtr<BoundaryCondition> bcLid = std::make_shared<IsothermalWall>( dataBase, Vec3( vx, vy, 0.0 ), lambda, false ); SPtr<BoundaryCondition> bcWall = std::make_shared<IsothermalWall>( dataBase, Vec3( 0.0, 0.0, 0.0 ), lambda, false ); - bcLid->findBoundaryCells ( meshAdapter, false, [&](Vec3 center){ return center.z > 0.5 && - center.x > -0.5 && - center.x < 0.5 && - center.y > -0.5 && + bcLid->findBoundaryCells ( meshAdapter, false, [&](Vec3 center){ return center.z > 0.5 && + center.x > -0.5 && + center.x < 0.5 && + center.y > -0.5 && center.y < 0.5; } ); - bcWall->findBoundaryCells( meshAdapter, true, [&](Vec3 center){ return center.x < -0.5 || - center.x > 0.5 || - center.y < -0.5 || + bcWall->findBoundaryCells( meshAdapter, true, [&](Vec3 center){ return center.x < -0.5 || + center.x > 0.5 || + center.y < -0.5 || center.y > 0.5 || center.z < -0.5; } ); dataBase->boundaryConditions.push_back( bcLid ); dataBase->boundaryConditions.push_back( bcWall ); - + ////////////////////////////////////////////////////////////////////////// // set initial condition and upload mesh and initial condition to GPGPU ////////////////////////////////////////////////////////////////////////// @@ -299,7 +302,7 @@ int main( int argc, char* argv[]) Initializer::initializeDataUpdate(dataBase); VtkWriter::write( dataBase, parameters, path + "/" + simulationName + "_0" ); - + ////////////////////////////////////////////////////////////////////////// // set analyzers ////////////////////////////////////////////////////////////////////////// @@ -309,7 +312,7 @@ int main( int argc, char* argv[]) ConvergenceAnalyzer convergenceAnalyzer( dataBase, 10000 ); cupsAnalyzer.start(); - + ////////////////////////////////////////////////////////////////////////// // run simulation ////////////////////////////////////////////////////////////////////////// @@ -324,7 +327,7 @@ int main( int argc, char* argv[]) VtkWriter::write( dataBase, parameters, path + "/" + simulationName + "_" + std::to_string( iter ) ); } - + int crashCellIndex = dataBase->getCrashCellIndex(); if( crashCellIndex >= 0 ) { @@ -342,20 +345,20 @@ int main( int argc, char* argv[]) convergenceAnalyzer.run( iter ); } } - } + } catch (const std::bad_alloc e) { - + *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; } catch (const std::exception& e) { - + *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; } catch (std::string& s) { - + *logging::out << logging::Logger::LOGGER_ERROR << s << "\n"; } catch (...) diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileReader/LogFileReader.cpp b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileReader/LogFileReader.cpp index 0f254c99746a98f0e8f2323ba0f89e73e9317052..5a469b44ab21c9a0fc3850baf9f1a82c1f3a0314 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileReader/LogFileReader.cpp +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileReader/LogFileReader.cpp @@ -11,7 +11,7 @@ #include "Utilities/LogFileData/LogFileDataImp.h" -#include "Core/Input/Input.h" +#include <basics/config/ConfigurationFile.h> #include "Core/StringUtilities/StringUtil.h" #include "Utilities/AlmostEquals.h" @@ -33,33 +33,27 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string { std::shared_ptr<LogFileDataImp> logFileData = LogFileDataImp::getNewInstance(); - std::ifstream stream; - stream.open(filePath.c_str(), std::ios::in); - if (stream.fail()) { - std::cout << "can not open log file!\n"; - exit(1); - } - - std::unique_ptr<input::Input> input = input::Input::makeInput(stream, "config"); + auto input = std::make_shared<vf::basics::ConfigurationFile>(); + input->load(filePath); logFileData->setFilePath(filePath); - logFileData->setDate(input->getValue("Date")); - logFileData->setTime(input->getValue("Time")); - logFileData->setGpuDevices(StringUtil::toStringVector(input->getValue("GPU_Devices"))); + logFileData->setDate(input->getValue<std::string>("Date")); + logFileData->setTime(input->getValue<std::string>("Time")); + logFileData->setGpuDevices(StringUtil::toStringVector(input->getValue<std::string>("GPU_Devices"))); - logFileData->setKernel(input->getValue("Kernel")); - logFileData->setNumberOfTimeSteps(StringUtil::toInt(input->getValue("NumberOfTimeSteps"))); - logFileData->setViscosity(StringUtil::toDouble(input->getValue("Viscosity"))); - logFileData->setBasisTimeStepLength(StringUtil::toInt(input->getValue("BasisTimeStepLength"))); + logFileData->setKernel(input->getValue<std::string>("Kernel")); + logFileData->setNumberOfTimeSteps(StringUtil::toInt(input->getValue<std::string>("NumberOfTimeSteps"))); + logFileData->setViscosity(StringUtil::toDouble(input->getValue<std::string>("Viscosity"))); + logFileData->setBasisTimeStepLength(StringUtil::toInt(input->getValue<std::string>("BasisTimeStepLength"))); - logFileData->setSimName(input->getValue("SimulationName")); + logFileData->setSimName(input->getValue<std::string>("SimulationName")); std::ostringstream simSigniture; if (logFileData->getSimName() == "ShearWave") { - std::vector<double> shearWaveLx = StringUtil::toDoubleVector(input->getValue("Lx")); + std::vector<double> shearWaveLx = StringUtil::toDoubleVector(input->getValue<std::string>("Lx")); logFileData->setBasicGridLengths(shearWaveLx); std::vector<int> shearWaveL0; std::vector<double> shearWaveUx; @@ -69,9 +63,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string l0 << "l0_" << shearWaveLx.at(i); ux << "ux_" << shearWaveLx.at(i); uz << "uz_" << shearWaveLx.at(i); - shearWaveL0.push_back(StringUtil::toInt(input->getValue(l0.str()))); - shearWaveUx.push_back(StringUtil::toDouble(input->getValue(ux.str()))); - shearWaveUz.push_back(StringUtil::toDouble(input->getValue(uz.str()))); + shearWaveL0.push_back(StringUtil::toInt(input->getValue<std::string>(l0.str()))); + shearWaveUx.push_back(StringUtil::toDouble(input->getValue<std::string>(ux.str()))); + shearWaveUz.push_back(StringUtil::toDouble(input->getValue<std::string>(uz.str()))); } std::shared_ptr<ShearWaveLogFileDataImp> swLogFileData = ShearWaveLogFileDataImp::getNewInstance(); swLogFileData->setL0(shearWaveL0); @@ -82,7 +76,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string logFileData->setBasicSimulation(ShearWave); } if (logFileData->getSimName() == "TaylorGreenVortexUx") { - std::vector<double> tgvUxLx = StringUtil::toDoubleVector(input->getValue("Lx")); + std::vector<double> tgvUxLx = StringUtil::toDoubleVector(input->getValue<std::string>("Lx")); logFileData->setBasicGridLengths(tgvUxLx); std::vector<int> tgvUxL0; std::vector<double> tgvUxUx; @@ -92,9 +86,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string l0 << "l0_" << tgvUxLx.at(i); ux << "ux_" << tgvUxLx.at(i); amplitude << "Amplitude_" << tgvUxLx.at(i); - tgvUxL0.push_back(StringUtil::toInt(input->getValue(l0.str()))); - tgvUxUx.push_back(StringUtil::toDouble(input->getValue(ux.str()))); - tgvUxAmp.push_back(StringUtil::toDouble(input->getValue(amplitude.str()))); + tgvUxL0.push_back(StringUtil::toInt(input->getValue<std::string>(l0.str()))); + tgvUxUx.push_back(StringUtil::toDouble(input->getValue<std::string>(ux.str()))); + tgvUxAmp.push_back(StringUtil::toDouble(input->getValue<std::string>(amplitude.str()))); } std::shared_ptr<TaylorGreenVortexUxLogFileDataImp> tgvUxLogFileData = TaylorGreenVortexUxLogFileDataImp::getNewInstance(); tgvUxLogFileData->setL0(tgvUxL0); @@ -105,7 +99,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string logFileData->setBasicSimulation(TaylorGreenVortexUx); } if (logFileData->getSimName() == "TaylorGreenVortexUz") { - std::vector<double> tgvUzLz = StringUtil::toDoubleVector(input->getValue("Lx")); + std::vector<double> tgvUzLz = StringUtil::toDoubleVector(input->getValue<std::string>("Lx")); logFileData->setBasicGridLengths(tgvUzLz); std::vector<int> tgvUzL0; std::vector<double> tgvUzUz; @@ -115,9 +109,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string l0 << "l0_" << tgvUzLz.at(i); uz << "uz_" << tgvUzLz.at(i); amplitude << "Amplitude_" << tgvUzLz.at(i); - tgvUzL0.push_back(StringUtil::toInt(input->getValue(l0.str()))); - tgvUzUz.push_back(StringUtil::toDouble(input->getValue(uz.str()))); - tgvUzAmp.push_back(StringUtil::toDouble(input->getValue(amplitude.str()))); + tgvUzL0.push_back(StringUtil::toInt(input->getValue<std::string>(l0.str()))); + tgvUzUz.push_back(StringUtil::toDouble(input->getValue<std::string>(uz.str()))); + tgvUzAmp.push_back(StringUtil::toDouble(input->getValue<std::string>(amplitude.str()))); } std::shared_ptr<TaylorGreenVortexUzLogFileDataImp> tgvUzLogFileData = TaylorGreenVortexUzLogFileDataImp::getNewInstance(); tgvUzLogFileData->setL0(tgvUzL0); @@ -140,10 +134,10 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string resultsCheckTimeOStringStream << "ResultsCheckTime_" << logFileData->getBasicGridLengths().at(i); testTimeOStringStream << "TestTime_" << logFileData->getBasicGridLengths().at(i); analyticalVTKWritingTimeOStringStream << "AnalyticalVTKFileWritingTime_" << logFileData->getBasicGridLengths().at(i); - std::string simTimeString = input->getValue(simTimeOStringStream.str()); - std::string resultCheckTimeString = input->getValue(resultsCheckTimeOStringStream.str()); - std::string testTimeString = input->getValue(testTimeOStringStream.str()); - std::string analyticalVTKWritingTimeString = input->getValue(analyticalVTKWritingTimeOStringStream.str()); + std::string simTimeString = input->getValue<std::string>(simTimeOStringStream.str()); + std::string resultCheckTimeString = input->getValue<std::string>(resultsCheckTimeOStringStream.str()); + std::string testTimeString = input->getValue<std::string>(testTimeOStringStream.str()); + std::string analyticalVTKWritingTimeString = input->getValue<std::string>(analyticalVTKWritingTimeOStringStream.str()); simTimeString.erase(simTimeString.end() - 3, simTimeString.end()); resultCheckTimeString.erase(resultCheckTimeString.end() - 3, resultCheckTimeString.end()); testTimeString.erase(testTimeString.end() - 3, testTimeString.end()); @@ -154,29 +148,29 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string analyticalVTKWritingTime.push_back(StringUtil::toInt(analyticalVTKWritingTimeString)); } - logFileData->setVTKFileWriting(StringUtil::toBool(input->getValue("VTKFileWriting"))); + logFileData->setVTKFileWriting(StringUtil::toBool(input->getValue<std::string>("VTKFileWriting"))); logFileData->setSimTime(simTime); logFileData->setResultCheckTime(resultsCheckTime); logFileData->setTestTime(testTime); logFileData->setAnalyticalVTKWritingTime(analyticalVTKWritingTime); - logFileData->setPhiTestRun(StringUtil::toBool(input->getValue("PhiTest"))); - logFileData->setNyTestRun(StringUtil::toBool(input->getValue("NyTest"))); - logFileData->setL2NormTestRun(StringUtil::toBool(input->getValue("L2NormTest"))); - logFileData->setL2NormTestBetweenKernelRun(StringUtil::toBool(input->getValue("L2NormTestBetweenKernel"))); + logFileData->setPhiTestRun(StringUtil::toBool(input->getValue<std::string>("PhiTest"))); + logFileData->setNyTestRun(StringUtil::toBool(input->getValue<std::string>("NyTest"))); + logFileData->setL2NormTestRun(StringUtil::toBool(input->getValue<std::string>("L2NormTest"))); + logFileData->setL2NormTestBetweenKernelRun(StringUtil::toBool(input->getValue<std::string>("L2NormTestBetweenKernel"))); if (logFileData->getPhiTestRun()) { - std::vector<std::string> failPhi = StringUtil::toStringVector(input->getValue("FailTests_Phi_PhiTest")); - std::vector<std::string> failOOA = StringUtil::toStringVector(input->getValue("FailTests_OOA_PhiTest")); + std::vector<std::string> failPhi = StringUtil::toStringVector(input->getValue<std::string>("FailTests_Phi_PhiTest")); + std::vector<std::string> failOOA = StringUtil::toStringVector(input->getValue<std::string>("FailTests_OOA_PhiTest")); - std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue("DataToCalc_PhiTest")); + std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue<std::string>("DataToCalc_PhiTest")); std::vector<std::shared_ptr<PhiLogFileData> > aPhiLogGroup; for (int i = 0; i < dataToCalc.size(); i++) { std::shared_ptr<PhiLogFileDataImp> phiLog = PhiLogFileDataImp::getNewInstance(); phiLog->setBasicGridLengths(logFileData->getBasicGridLengths()); phiLog->setDataToCalc(dataToCalc.at(i)); - phiLog->setStartTimeStepCalculation(StringUtil::toInt(input->getValue("StartTimeStepCalculation_PhiTest"))); - phiLog->setEndTimeStepCalculation(StringUtil::toInt(input->getValue("EndTimeStepCalculation_PhiTest"))); + phiLog->setStartTimeStepCalculation(StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_PhiTest"))); + phiLog->setEndTimeStepCalculation(StringUtil::toInt(input->getValue<std::string>("EndTimeStepCalculation_PhiTest"))); std::vector<double> phiDiff; std::vector<std::vector<double> > orderOfAccuracy; @@ -190,7 +184,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string } if (!failData) { phiDiffString << "PhiDiff_" << logFileData->getBasicGridLengths().at(j) << "_" << dataToCalc.at(i); - phiDiff.push_back(StringUtil::toDouble(input->getValue(phiDiffString.str()))); + phiDiff.push_back(StringUtil::toDouble(input->getValue<std::string>(phiDiffString.str()))); } for (int k = j + 1; k < logFileData->getBasicGridLengths().size(); k++) { @@ -206,7 +200,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string phiDiffOOA << "OrderOfAccuracy_PhiDiff_" << phiDiffBasicOOA.str(); aOrderOfAccuracyGroup.push_back(logFileData->getBasicGridLengths().at(j)); aOrderOfAccuracyGroup.push_back(logFileData->getBasicGridLengths().at(k)); - aOrderOfAccuracyGroup.push_back(StringUtil::toDouble(input->getValue(phiDiffOOA.str()))); + aOrderOfAccuracyGroup.push_back(StringUtil::toDouble(input->getValue<std::string>(phiDiffOOA.str()))); } if (aOrderOfAccuracyGroup.size() > 0) orderOfAccuracy.push_back(aOrderOfAccuracyGroup); @@ -231,17 +225,17 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string if (logFileData->getNyTestRun()) { - std::vector<std::string> failNy = StringUtil::toStringVector(input->getValue("FailTests_Ny_NyTest")); - std::vector<std::string> failOOA = StringUtil::toStringVector(input->getValue("FailTests_OOA_NyTest")); + std::vector<std::string> failNy = StringUtil::toStringVector(input->getValue<std::string>("FailTests_Ny_NyTest")); + std::vector<std::string> failOOA = StringUtil::toStringVector(input->getValue<std::string>("FailTests_OOA_NyTest")); - std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue("DataToCalc_NyTest")); + std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue<std::string>("DataToCalc_NyTest")); std::vector<std::shared_ptr<NyLogFileData> > aNyLogGroup; for (int i = 0; i < dataToCalc.size(); i++) { std::shared_ptr<NyLogFileDataImp> nyLog = NyLogFileDataImp::getNewInstance(); nyLog->setBasicGridLengths(logFileData->getBasicGridLengths()); nyLog->setDataToCalc(dataToCalc.at(i)); - nyLog->setStartTimeStepCalculation(StringUtil::toInt(input->getValue("StartTimeStepCalculation_NyTest"))); - nyLog->setEndTimeStepCalculation(StringUtil::toInt(input->getValue("EndTimeStepCalculation_NyTest"))); + nyLog->setStartTimeStepCalculation(StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_NyTest"))); + nyLog->setEndTimeStepCalculation(StringUtil::toInt(input->getValue<std::string>("EndTimeStepCalculation_NyTest"))); std::vector<double> ny, nyDiff; std::vector<std::vector<double> > orderOfAccuracy; @@ -255,9 +249,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string } if (!failData) { nyString << "Ny_" << nyBasicString.str(); - ny.push_back(StringUtil::toDouble(input->getValue(nyString.str()))); + ny.push_back(StringUtil::toDouble(input->getValue<std::string>(nyString.str()))); nyDiffString << "NyDiff_" << logFileData->getBasicGridLengths().at(j) << "_" << dataToCalc.at(i); - nyDiff.push_back(StringUtil::toDouble(input->getValue(nyDiffString.str()))); + nyDiff.push_back(StringUtil::toDouble(input->getValue<std::string>(nyDiffString.str()))); } @@ -274,7 +268,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string nyDiffOOA << "OrderOfAccuracy_NyDiff_" << nyDiffBasicOOA.str(); aOrderOfAccuracyGroup.push_back(logFileData->getBasicGridLengths().at(j)); aOrderOfAccuracyGroup.push_back(logFileData->getBasicGridLengths().at(k)); - aOrderOfAccuracyGroup.push_back(StringUtil::toDouble(input->getValue(nyDiffOOA.str()))); + aOrderOfAccuracyGroup.push_back(StringUtil::toDouble(input->getValue<std::string>(nyDiffOOA.str()))); } if (aOrderOfAccuracyGroup.size() > 0) orderOfAccuracy.push_back(aOrderOfAccuracyGroup); @@ -300,17 +294,17 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string if (logFileData->getL2NormTestRun()) { std::vector<std::shared_ptr<L2NormLogFileData> > l2NormGroup; - std::vector<std::string> dataToCalcL2Norm = StringUtil::toStringVector(input->getValue("DataToCalc_L2Norm")); - std::vector<std::string> normData = StringUtil::toStringVector(input->getValue("NormalizeData_L2Norm")); - std::vector<std::string> failL2Norm = StringUtil::toStringVector(input->getValue("FailTests_L2Norm")); + std::vector<std::string> dataToCalcL2Norm = StringUtil::toStringVector(input->getValue<std::string>("DataToCalc_L2Norm")); + std::vector<std::string> normData = StringUtil::toStringVector(input->getValue<std::string>("NormalizeData_L2Norm")); + std::vector<std::string> failL2Norm = StringUtil::toStringVector(input->getValue<std::string>("FailTests_L2Norm")); for (int i = 0; i < dataToCalcL2Norm.size(); i++) { for (int k = 0; k < normData.size(); k++) { std::shared_ptr<L2NormLogFileDataImp> aL2Norm = L2NormLogFileDataImp::getNewInstance(); aL2Norm->setDataToCalc(dataToCalcL2Norm.at(i)); aL2Norm->setNormalizeData(normData.at(k)); aL2Norm->setBasicGridLengths(logFileData->getBasicGridLengths()); - aL2Norm->setBasicTimeStep(StringUtil::toInt(input->getValue("BasicTimeStep_L2Norm"))); - aL2Norm->setDivergentTimeStep(StringUtil::toInt(input->getValue("DivergentTimeStep_L2Norm"))); + aL2Norm->setBasicTimeStep(StringUtil::toInt(input->getValue<std::string>("BasicTimeStep_L2Norm"))); + aL2Norm->setDivergentTimeStep(StringUtil::toInt(input->getValue<std::string>("DivergentTimeStep_L2Norm"))); std::vector<double> l2NormBasicTimeStep; std::vector<double> l2NormDivergentTimeStep; @@ -327,9 +321,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string basicTimeStep << "L2Norm_BasicTimeStep_" << basicString.str(); divergentTimeStep << "L2Norm_DivergentTimeStep_" << basicString.str(); diff << "L2Norm_Diff_" << basicString.str(); - l2NormBasicTimeStep.push_back(StringUtil::toDouble(input->getValue(basicTimeStep.str()))); - l2NormDivergentTimeStep.push_back(StringUtil::toDouble(input->getValue(divergentTimeStep.str()))); - l2NormDiff.push_back(StringUtil::toDouble(input->getValue(diff.str()))); + l2NormBasicTimeStep.push_back(StringUtil::toDouble(input->getValue<std::string>(basicTimeStep.str()))); + l2NormDivergentTimeStep.push_back(StringUtil::toDouble(input->getValue<std::string>(divergentTimeStep.str()))); + l2NormDiff.push_back(StringUtil::toDouble(input->getValue<std::string>(diff.str()))); } } if (l2NormBasicTimeStep.size() > 0) { @@ -380,10 +374,10 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string if (logFileData->getL2NormTestBetweenKernelRun()) { std::vector<std::shared_ptr<L2NormBetweenKernelsLogFileData> > l2NormBetweenKernelsData; - std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue("DataToCalculate_L2Norm_BK")); - std::vector<int> timeSteps = StringUtil::toIntVector(input->getValue("TimeSteps_L2Norm_BK")); - std::vector<std::string> normalizeData = StringUtil::toStringVector(input->getValue("NormalizeWith_L2Norm_BK")); - std::vector<std::string> failL2Norm = StringUtil::toStringVector(input->getValue("FailTests_L2Norm_BK")); + std::vector<std::string> dataToCalc = StringUtil::toStringVector(input->getValue<std::string>("DataToCalculate_L2Norm_BK")); + std::vector<int> timeSteps = StringUtil::toIntVector(input->getValue<std::string>("TimeSteps_L2Norm_BK")); + std::vector<std::string> normalizeData = StringUtil::toStringVector(input->getValue<std::string>("NormalizeWith_L2Norm_BK")); + std::vector<std::string> failL2Norm = StringUtil::toStringVector(input->getValue<std::string>("FailTests_L2Norm_BK")); for (int i = 0; i < dataToCalc.size(); i++) { @@ -393,7 +387,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string std::vector<double> l2NormDivergentKernel; std::vector<double> l2NormBetweenKernels; std::shared_ptr<L2NormBetweenKernelsLogFileDataImp> aL2NormLogFileData = L2NormBetweenKernelsLogFileDataImp::getNewInstance(); - aL2NormLogFileData->setBasicKernel(input->getValue("BasicKernel_L2Norm_BK")); + aL2NormLogFileData->setBasicKernel(input->getValue<std::string>("BasicKernel_L2Norm_BK")); aL2NormLogFileData->setDivergentKernel(logFileData->getKernel()); aL2NormLogFileData->setDataToCalculate(dataToCalc.at(i)); aL2NormLogFileData->setTimeStep(timeSteps.at(j)); @@ -415,9 +409,9 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string basicKernel << "L2Norm_BasicKernel_" << basicString.str(); divergentKernel << "L2Norm_DivergentKernel_" << basicString.str(); diff << "L2Norm_Between_Kernels_" << basicString.str(); - l2NormBasicKernel.push_back(StringUtil::toDouble(input->getValue(basicKernel.str()))); - l2NormDivergentKernel.push_back(StringUtil::toDouble(input->getValue(divergentKernel.str()))); - l2NormBetweenKernels.push_back(StringUtil::toDouble(input->getValue(diff.str()))); + l2NormBasicKernel.push_back(StringUtil::toDouble(input->getValue<std::string>(basicKernel.str()))); + l2NormDivergentKernel.push_back(StringUtil::toDouble(input->getValue<std::string>(divergentKernel.str()))); + l2NormBetweenKernels.push_back(StringUtil::toDouble(input->getValue<std::string>(diff.str()))); } } if (l2NormBasicKernel.size() > 0) { diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.cpp b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.cpp index 6aa5cfe7780267adfa5729c390c3ee0c0daeac18..7bff82d2118e449ea19a1cfd56ff261b730ff0d4 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.cpp +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.cpp @@ -1,6 +1,6 @@ #include "PostProcessingConfigFileReaderImp.h" -#include "Core/Input/Input.h" +#include <basics/config/ConfigurationFile.h> #include "Core/StringUtilities/StringUtil.h" #include "Utilities/PostProcessingConfigData/PostProcessingConfigDataImp.h" @@ -15,48 +15,42 @@ std::shared_ptr<PostProcessingConfigFileReader> PostProcessingConfigFileReaderIm std::shared_ptr<PostProcessingConfigData> PostProcessingConfigFileReaderImp::readConfigFile(std::string filePath) { - std::ifstream stream; - stream.open(filePath.c_str(), std::ios::in); - if (stream.fail()) { - throw "can not open config file!\n"; - exit(1); - } - std::shared_ptr<input::Input> input = input::Input::makeInput(stream, "config"); - + auto input = std::make_shared<vf::basics::ConfigurationFile>(); + input->load(filePath); std::vector<BasicSimulation> simulation; std::vector<Assistant> assistants; std::vector<DataCombination> combination; - if(StringUtil::toBool(input->getValue("ShearWave"))) + if(StringUtil::toBool(input->getValue<std::string>("ShearWave"))) simulation.push_back(ShearWave); - if (StringUtil::toBool(input->getValue("TaylorGreenVortexUx"))) + if (StringUtil::toBool(input->getValue<std::string>("TaylorGreenVortexUx"))) simulation.push_back(TaylorGreenVortexUx); - if (StringUtil::toBool(input->getValue("TaylorGreenVortexUz"))) + if (StringUtil::toBool(input->getValue<std::string>("TaylorGreenVortexUz"))) simulation.push_back(TaylorGreenVortexUz); - if (StringUtil::toBool(input->getValue("Phi"))) + if (StringUtil::toBool(input->getValue<std::string>("Phi"))) assistants.push_back(Phi); - if (StringUtil::toBool(input->getValue("Ny"))) + if (StringUtil::toBool(input->getValue<std::string>("Ny"))) assistants.push_back(Ny); - if (StringUtil::toBool(input->getValue("L2Norm"))) + if (StringUtil::toBool(input->getValue<std::string>("L2Norm"))) assistants.push_back(L2Norm); - if (StringUtil::toBool(input->getValue("L2Norm_BetweenKernels"))) + if (StringUtil::toBool(input->getValue<std::string>("L2Norm_BetweenKernels"))) assistants.push_back(L2NormBetweenKernels); - if (StringUtil::toBool(input->getValue("TimeOutput"))) + if (StringUtil::toBool(input->getValue<std::string>("TimeOutput"))) assistants.push_back(Time); - if (StringUtil::toBool(input->getValue("EqualSimulationsForDifferentKernels"))) + if (StringUtil::toBool(input->getValue<std::string>("EqualSimulationsForDifferentKernels"))) combination.push_back(EqualSimulationsForDifferentKernels); - if (StringUtil::toBool(input->getValue("EqualKernelSimulationsForDifferentViscosities"))) + if (StringUtil::toBool(input->getValue<std::string>("EqualKernelSimulationsForDifferentViscosities"))) combination.push_back(EqualKernelSimulationsForDifferentViscosities); std::shared_ptr<PostProcessingConfigDataImp> data = PostProcessingConfigDataImp::getNewInstance(); @@ -65,8 +59,8 @@ std::shared_ptr<PostProcessingConfigData> PostProcessingConfigFileReaderImp::rea data->setSimulations(simulation); data->setDataCombinations(combination); - data->setLogFilesPath(input->getValue("LogFilesPath")); - data->setMathematicaFilePath(input->getValue("MathematicaFilePath")); + data->setLogFilesPath(input->getValue<std::string>("LogFilesPath")); + data->setMathematicaFilePath(input->getValue<std::string>("MathematicaFilePath")); return data; } diff --git a/apps/gpu/tests/NumericalTests/CMakeLists.txt b/apps/gpu/tests/NumericalTests/CMakeLists.txt index 51804baa22497aea0d48816bd7a9ddcd472de8a3..80c6318756ce115f18a4fa4b6324dd0d087935e4 100644 --- a/apps/gpu/tests/NumericalTests/CMakeLists.txt +++ b/apps/gpu/tests/NumericalTests/CMakeLists.txt @@ -1,6 +1,6 @@ project(NumericalTestsGPU) set(collectTestFiles ON) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluids_GPU GridGenerator basics fftw3 gtest gmock gmock_main cudart_static) +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluids_GPU GridGenerator basics logger fftw3 gtest gmock gmock_main cudart_static) vf_get_library_name(library_name) groupTarget(${library_name} ${testFolder}) diff --git a/apps/gpu/tests/NumericalTests/Tests/NyTest/PostProcessingStrategy/NyTestPostProcessingStrategy.cpp b/apps/gpu/tests/NumericalTests/Tests/NyTest/PostProcessingStrategy/NyTestPostProcessingStrategy.cpp index ec87f5ed96a289dc06e02e94239f936518bf18c8..4147d91533ec010f0ca0c0b8960abab420c77ad9 100644 --- a/apps/gpu/tests/NumericalTests/Tests/NyTest/PostProcessingStrategy/NyTestPostProcessingStrategy.cpp +++ b/apps/gpu/tests/NumericalTests/Tests/NyTest/PostProcessingStrategy/NyTestPostProcessingStrategy.cpp @@ -6,6 +6,7 @@ #include "Tests/NyTest/NyTestParameterStruct.h" + std::shared_ptr<NyTestPostProcessingStrategy> NyTestPostProcessingStrategy::getNewInstance(std::shared_ptr<SimulationResults> simResult, std::shared_ptr<AnalyticalResults> analyticalResult, std::shared_ptr<NyTestParameterStruct> testPara, std::vector<std::string> dataToCalcTests) { return std::shared_ptr<NyTestPostProcessingStrategy>(new NyTestPostProcessingStrategy(simResult, analyticalResult, testPara, dataToCalcTests)); diff --git a/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp b/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp index e3d749293793250893c78958eaa777fd1f3b87d7..bf93a95f450ff1a21062644d9be098eb2c2c235f 100644 --- a/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp +++ b/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp @@ -19,6 +19,7 @@ void PhiTest::evaluate() { for (int i = 0; i < postProStrategies.size(); i++) phiDiff.push_back(postProStrategies.at(i)->getPhiDiff(dataToCalculate)); + orderOfAccuracy = calcOrderOfAccuracy(phiDiff); testStatus = checkTestPassed(orderOfAccuracy); diff --git a/apps/gpu/tests/NumericalTests/Utilities/Calculator/FFTCalculator/FFTCalculator.cpp b/apps/gpu/tests/NumericalTests/Utilities/Calculator/FFTCalculator/FFTCalculator.cpp index 6942099bcf441e0f06b580a15a813f6eb34f5eec..7b145d049f42573c0ce59aa6245808bd93e35267 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Calculator/FFTCalculator/FFTCalculator.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/Calculator/FFTCalculator/FFTCalculator.cpp @@ -3,265 +3,264 @@ #include "Utilities/Results/SimulationResults/SimulationResults.h" #define _USE_MATH_DEFINES -#include <math.h> -#include <stdlib.h> #include <fstream> +#include <math.h> std::shared_ptr<FFTCalculator> FFTCalculator::getInstance() { - static std::shared_ptr<FFTCalculator> uniqueInstance; - if (!uniqueInstance) - uniqueInstance = std::shared_ptr<FFTCalculator>(new FFTCalculator()); - return uniqueInstance; + static std::shared_ptr<FFTCalculator> uniqueInstance; + if (!uniqueInstance) + uniqueInstance = std::shared_ptr<FFTCalculator>(new FFTCalculator()); + return uniqueInstance; } -double FFTCalculator::calcNy(std::vector<std::vector<double>> data, bool transposeData, int lx, int lz, int timeStepLength) +double FFTCalculator::calcNy(std::vector<std::vector<double>> data, bool transposeData, int lx, int lz, + int timeStepLength) { - this->lx = (double)lx; - this->lz = (double)lz; - this->timeStepLength = (double)timeStepLength; - this->transposeData = transposeData; - if (!transposeData) - this->data = data; - else - this->data = transpose(data); - - init(); - - double ny = calcNy(); - return ny; + this->lx = (double)lx; + this->lz = (double)lz; + this->timeStepLength = (double)timeStepLength; + this->transposeData = transposeData; + if (!transposeData) + this->data = data; + else + this->data = transpose(data); + + init(); + + double ny = calcNy(); + return ny; } -double FFTCalculator::calcPhiDiff(std::vector<std::vector<double>> data, bool transposeData, int lx, int lz, int timeStepLength) +double FFTCalculator::calcPhiDiff(std::vector<std::vector<double>> data, bool transposeData, int lx, int lz, + int timeStepLength) { - this->lx = (double)lx; - this->lz = (double)lz; - this->timeStepLength = (double)timeStepLength; - this->transposeData = transposeData; - if (!transposeData) - this->data = data; - else - this->data = transpose(data); - - init(); - - double phidiff = calcPhiDiff(); - return abs(phidiff); + this->lx = (double)lx; + this->lz = (double)lz; + this->timeStepLength = (double)timeStepLength; + this->transposeData = transposeData; + if (!transposeData) + this->data = data; + else + this->data = transpose(data); + + init(); + + double phidiff = calcPhiDiff(); + + return abs(phidiff); } FFTCalculator::FFTCalculator() { - } double FFTCalculator::calcAmplitudeForTimeStep(std::vector<double> data, bool transposeData, int lx, int lz) { - this->lx = (double)lx; - this->lz = (double)lz; - init(); - this->transposeData = transposeData; - this->data.resize(0); - this->data.push_back(data); - std::vector<double> amplitude = calcAmplitudeForAllSteps(); - return amplitude.at(0); + this->lx = (double)lx; + this->lz = (double)lz; + init(); + this->transposeData = transposeData; + this->data.resize(0); + this->data.push_back(data); + std::vector<double> amplitude = calcAmplitudeForAllSteps(); + return amplitude.at(0); } void FFTCalculator::init() { - fftResultsIm.clear(); - fftResultsRe.clear(); - fftCalculated = false; + fftResultsIm.clear(); + fftResultsRe.clear(); + fftCalculated = false; } double FFTCalculator::calcNy() { - std::vector<double> logAmplitude = calcLogAmplitudeForAllSteps(); - std::vector<double> linReg = calcLinReg(logAmplitude); - double nu = -(1.0 / (((2.0 * M_PI / lz) * (2.0 * M_PI / lz) + (2.0 * M_PI / lx)*(2.0 * M_PI / lx)) * timeStepLength)) * linReg.at(0); - - return nu; + std::vector<double> logAmplitude = calcLogAmplitudeForAllSteps(); + std::vector<double> linReg = calcLinReg(logAmplitude); + double nu = + -(1.0 / (((2.0 * M_PI / lz) * (2.0 * M_PI / lz) + (2.0 * M_PI / lx) * (2.0 * M_PI / lx)) * timeStepLength)) * + linReg.at(0); + return nu; } double FFTCalculator::calcPhiDiff() { - std::vector<double> phi = calcPhiForAllSteps(); - std::vector<double> linReg = calcLinReg(phi); + std::vector<double> phi = calcPhiForAllSteps(); + std::vector<double> linReg = calcLinReg(phi); - return linReg.at(0); + return linReg.at(0); } std::vector<double> FFTCalculator::calcLinReg(std::vector<double> y) { - std::vector<double> result; - std::vector<double> x(y.size()); - double sumX = 0.0; - double sumY = 0.0; - - for (int i = 0; i < y.size(); i++) - { - sumY += y.at(i); - x.at(i) = i; - sumX += i; - } - double avgX = sumX / y.size(); - double avgY = sumY / y.size(); - double zaehler = 0.0; - double nenner = 0.0; - for (int i = 0; i < y.size(); i++) - { - zaehler += (x.at(i) - avgX) * (y.at(i) - avgY); - nenner += (x.at(i) - avgX) * (x.at(i) - avgX); - } - double a1 = zaehler / nenner; - result.push_back(a1); - double a0 = avgY - a1*avgX; - result.push_back(a0); - - double ess = 0; - double tss = 0; - for (int i = 0; i < y.size(); i++) - { - ess += ((a0+a1*x.at(i))-avgY) * ((a0 + a1*x.at(i)) - avgY); - tss += (y.at(i)-avgY) * (y.at(i) - avgY); - } - double r2 = ess / tss; - result.push_back(r2); - return result; + std::vector<double> result; + std::vector<double> x(y.size()); + double sumX = 0.0; + double sumY = 0.0; + + for (int i = 0; i < y.size(); i++) { + sumY += y.at(i); + x.at(i) = i; + sumX += i; + } + double avgX = sumX / y.size(); + double avgY = sumY / y.size(); + double zaehler = 0.0; + double nenner = 0.0; + for (int i = 0; i < y.size(); i++) { + zaehler += (x.at(i) - avgX) * (y.at(i) - avgY); + nenner += (x.at(i) - avgX) * (x.at(i) - avgX); + } + double a1 = zaehler / nenner; + result.push_back(a1); + double a0 = avgY - a1 * avgX; + result.push_back(a0); + + double ess = 0; + double tss = 0; + for (int i = 0; i < y.size(); i++) { + ess += ((a0 + a1 * x.at(i)) - avgY) * ((a0 + a1 * x.at(i)) - avgY); + tss += (y.at(i) - avgY) * (y.at(i) - avgY); + } + double r2 = ess / tss; + result.push_back(r2); + return result; } std::vector<double> FFTCalculator::calcLogAmplitudeForAllSteps() { - std::vector<double> amplitude = calcAmplitudeForAllSteps(); - std::vector<double> logAmplitude; - for (int i = 0; i < amplitude.size(); i++) - logAmplitude.push_back(log(amplitude.at(i))); + std::vector<double> amplitude = calcAmplitudeForAllSteps(); + std::vector<double> logAmplitude; + for (int i = 0; i < amplitude.size(); i++) + logAmplitude.push_back(log(amplitude.at(i))); - return logAmplitude; + return logAmplitude; } std::vector<double> FFTCalculator::calcAmplitudeForAllSteps() { - std::vector<double> amplitude; - if (fftCalculated == false) { - for (int step = 0; step < data.size(); step++) - calcFFT2D(step); - fftCalculated = true; - } - int pos; - if (!transposeData) - pos = 2 + (lx - 1); - else - pos = 2 + (lz - 1); - - for (int step = 0; step < data.size(); step++) - amplitude.push_back(4.0 / (lx * lz) * sqrt(fftResultsRe.at(step).at(pos) * fftResultsRe.at(step).at(pos) + fftResultsIm.at(step).at(pos) * fftResultsIm.at(step).at(pos))); - - return amplitude; + std::vector<double> amplitude; + if (fftCalculated == false) { + for (int step = 0; step < data.size(); step++) + calcFFT2D(step); + fftCalculated = true; + } + int pos; + if (!transposeData) + pos = 2 + (lx - 1); + else + pos = 2 + (lz - 1); + + for (int step = 0; step < data.size(); step++) + amplitude.push_back(4.0 / (lx * lz) * + sqrt(fftResultsRe.at(step).at(pos) * fftResultsRe.at(step).at(pos) + + fftResultsIm.at(step).at(pos) * fftResultsIm.at(step).at(pos))); + + return amplitude; } std::vector<double> FFTCalculator::calcPhiForAllSteps() { - std::vector<double> phi; - if (fftCalculated == false) { - for (int step = 0; step < data.size(); step++) - calcFFT2D(step); - fftCalculated = true; - } - int pos; - if (!transposeData) - pos = 2 + (lx - 1); - else - pos = 2 + (lz - 1); - - for (int step = 0; step < data.size(); step++) { - phi.push_back(atan(fftResultsIm.at(step).at(pos) / fftResultsRe.at(step).at(pos))); - } - - return phi; + std::vector<double> phi; + if (fftCalculated == false) { + for (int step = 0; step < data.size(); step++) + calcFFT2D(step); + fftCalculated = true; + } + int pos; + if (!transposeData) + pos = 2 + (lx - 1); + else + pos = 2 + (lz - 1); + + for (int step = 0; step < data.size(); step++) { + phi.push_back(atan(fftResultsIm.at(step).at(pos) / fftResultsRe.at(step).at(pos))); + } + + return phi; } void FFTCalculator::calcFFT2D(unsigned int timeStep) { - fftw_complex *in = (fftw_complex*)fftw_malloc(sizeof(fftw_complex) * lx * lz); - fftw_complex *out = (fftw_complex*)fftw_malloc(sizeof(fftw_complex) * lx * lz); + fftw_complex *in = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * lx * lz); + fftw_complex *out = (fftw_complex *)fftw_malloc(sizeof(fftw_complex) * lx * lz); - initDataForFFT(in, timeStep); + initDataForFFT(in, timeStep); - fftw_plan p; - if (!transposeData) - p = fftw_plan_dft_2d(lz, lx, in, out, FFTW_FORWARD, FFTW_ESTIMATE); - else - p = fftw_plan_dft_2d(lx, lz, in, out, FFTW_FORWARD, FFTW_ESTIMATE); - fftw_execute(p); + fftw_plan p; + if (!transposeData) + p = fftw_plan_dft_2d(lz, lx, in, out, FFTW_FORWARD, FFTW_ESTIMATE); + else + p = fftw_plan_dft_2d(lx, lz, in, out, FFTW_FORWARD, FFTW_ESTIMATE); + fftw_execute(p); - setFFTResults(out, timeStep); + setFFTResults(out, timeStep); - fftw_destroy_plan(p); - fftw_free(in); - fftw_free(out); + fftw_destroy_plan(p); + fftw_free(in); + fftw_free(out); } -std::vector<std::vector<double> > FFTCalculator::transpose(std::vector<std::vector<double> > dataToTranspose) +std::vector<std::vector<double>> FFTCalculator::transpose(std::vector<std::vector<double>> dataToTranspose) { - std::vector<std::vector<std::vector<double> >> dataInLx; - dataInLx.resize(dataToTranspose.size()); - for (int i = 0; i < dataInLx.size(); i++) { - dataInLx.at(i).resize(lz); - for(int j = 0; j < dataInLx.at(i).size(); j++) - dataInLx.at(i).at(j).resize(lx); - } - for (int timeStep = 0; timeStep < dataInLx.size(); timeStep++) { - for (int posInLZ = 0; posInLZ < lz; posInLZ++) - for (int posInLX = 0; posInLX < lx; posInLX++) - dataInLx.at(timeStep).at(posInLZ).at(posInLX) = dataToTranspose.at(timeStep).at(posInLX + posInLZ*lx); - } - - std::vector<std::vector<std::vector<double> >> dataInLz; - dataInLz.resize(dataToTranspose.size()); - for (int i = 0; i < dataInLx.size(); i++) { - dataInLz.at(i).resize(lx); - for (int j = 0; j < dataInLz.at(i).size(); j++) - dataInLz.at(i).at(j).resize(lz); - } - - for (int timeStep = 0; timeStep < dataInLz.size(); timeStep++) { - for (int posInLX = 0; posInLX < lx; posInLX++) - for (int posInLZ = 0; posInLZ < lz; posInLZ++) - dataInLz.at(timeStep).at(posInLX).at(posInLZ) = dataInLx.at(timeStep).at(posInLZ).at(posInLX); - } - - std::vector<std::vector<double> > result; - result.resize(dataToTranspose.size()); - - for (int timeStep = 0; timeStep < dataInLz.size(); timeStep++) { - result.at(timeStep).resize(0); - for (int posInLX = 0; posInLX < lx; posInLX++) - for (int posInLZ = 0; posInLZ < lz; posInLZ++) - result.at(timeStep).push_back(dataInLz.at(timeStep).at(posInLX).at(posInLZ)); - } - return result; + std::vector<std::vector<std::vector<double>>> dataInLx; + dataInLx.resize(dataToTranspose.size()); + for (int i = 0; i < dataInLx.size(); i++) { + dataInLx.at(i).resize(lz); + for (int j = 0; j < dataInLx.at(i).size(); j++) + dataInLx.at(i).at(j).resize(lx); + } + for (int timeStep = 0; timeStep < dataInLx.size(); timeStep++) { + for (int posInLZ = 0; posInLZ < lz; posInLZ++) + for (int posInLX = 0; posInLX < lx; posInLX++) + dataInLx.at(timeStep).at(posInLZ).at(posInLX) = dataToTranspose.at(timeStep).at(posInLX + posInLZ * lx); + } + + std::vector<std::vector<std::vector<double>>> dataInLz; + dataInLz.resize(dataToTranspose.size()); + for (int i = 0; i < dataInLx.size(); i++) { + dataInLz.at(i).resize(lx); + for (int j = 0; j < dataInLz.at(i).size(); j++) + dataInLz.at(i).at(j).resize(lz); + } + + for (int timeStep = 0; timeStep < dataInLz.size(); timeStep++) { + for (int posInLX = 0; posInLX < lx; posInLX++) + for (int posInLZ = 0; posInLZ < lz; posInLZ++) + dataInLz.at(timeStep).at(posInLX).at(posInLZ) = dataInLx.at(timeStep).at(posInLZ).at(posInLX); + } + + std::vector<std::vector<double>> result; + result.resize(dataToTranspose.size()); + + for (int timeStep = 0; timeStep < dataInLz.size(); timeStep++) { + result.at(timeStep).resize(0); + for (int posInLX = 0; posInLX < lx; posInLX++) + for (int posInLZ = 0; posInLZ < lz; posInLZ++) + result.at(timeStep).push_back(dataInLz.at(timeStep).at(posInLX).at(posInLZ)); + } + return result; } -void FFTCalculator::initDataForFFT(fftw_complex * input, unsigned int step) +void FFTCalculator::initDataForFFT(fftw_complex *input, unsigned int step) { - for (int i = 0; i < data.at(step).size(); i++) - { - input[i][0] = data.at(step).at(i); - input[i][1] = 0; - } + for (int i = 0; i < data.at(step).size(); i++) { + input[i][0] = data.at(step).at(i); + input[i][1] = 0; + } } -void FFTCalculator::setFFTResults(fftw_complex * result, unsigned int step) +void FFTCalculator::setFFTResults(fftw_complex *result, unsigned int step) { - std::vector<double> fftRe, fftIm; - fftRe.resize(data.at(step).size()); - fftIm.resize(data.at(step).size()); - - for (int i = 0; i < data.at(step).size(); i++) - { - fftRe.at(i) = result[i][0]; - fftIm.at(i) = result[i][1]; - } - fftResultsIm.push_back(fftIm); - fftResultsRe.push_back(fftRe); + std::vector<double> fftRe, fftIm; + fftRe.resize(data.at(step).size()); + fftIm.resize(data.at(step).size()); + + for (int i = 0; i < data.at(step).size(); i++) { + fftRe.at(i) = result[i][0]; + fftIm.at(i) = result[i][1]; + } + fftResultsIm.push_back(fftIm); + fftResultsRe.push_back(fftRe); } \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.cpp index bd58d6cdb26bf3cd0f4b6720fd7f06d8d434e271..577b392c593e94813aea64c16a2217ce8ee53141 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.cpp @@ -4,8 +4,13 @@ #include <iomanip> #include <ctime> +#include <logger/Logger.h> +void log(const char* fmt) { + VF_LOG_INFO("{}", fmt); +} + std::shared_ptr<ColorConsoleOutput> ColorConsoleOutputImp::getInstance() { static std::shared_ptr<ColorConsoleOutput> uniqueInstance; @@ -18,7 +23,7 @@ void ColorConsoleOutputImp::makeSimulationHeadOutput(std::shared_ptr<SimulationI { std::ostringstream ossLine0; ossLine0 << "# Simulation Number " << simInfo->getSimulationID() << " of " << simInfo->getNumberOfSimulations(); - int length = 49 - ossLine0.str().size(); + int length = 49 - ossLine0.str().size(); ossLine0 << std::setfill(' ') << std::right << std::setw(length) << "#"; std::ostringstream ossLine1; @@ -29,7 +34,7 @@ void ColorConsoleOutputImp::makeSimulationHeadOutput(std::shared_ptr<SimulationI std::ostringstream ossLine3; ossLine3 << "# SIMULATION: " << std::setfill(' ') << std::left << std::setw(34) << simInfo->getSimulationName() << "#"; - + std::ostringstream ossLine4; ossLine4 << std::setfill(' ') << std::left << std::setw(14) << "#" << std::setw(34) << simInfo->getSimulationParameterString() << "#"; @@ -63,7 +68,7 @@ void ColorConsoleOutputImp::makeTestOutput(std::vector<std::string> testOutput, printColor(testOutput.at(0)); printColor(""); - for (int i = 1; i < testOutput.size(); i++) + for (uint i = 1; i < testOutput.size(); i++) print(testOutput.at(i)); printColor(""); @@ -85,79 +90,70 @@ void ColorConsoleOutputImp::makeFinalTestOutputFoot(int numberOfTests, int numbe setColor(numberOfTests == numberOfPassedTest); printLine(); printTestPassed(numberOfTests, numberOfExecutedTest, numberOfPassedTest, numberOfFailedTest, numberOfErrorTest, numberOfNotExecutedTest); - std::cout << std::endl; } void ColorConsoleOutputImp::printTestStart() { - testing::internal::ColoredPrintf(color, "[-----------]"); - std::cout << std::endl; - testing::internal::ColoredPrintf(color, "[Run Test ]"); - std::cout << std::endl; - testing::internal::ColoredPrintf(color, "[TestInfo ]"); - std::cout << std::endl; + log( "[-----------]"); + log( "[Run Test ]"); + log( "[TestInfo ]"); } void ColorConsoleOutputImp::printTestEnd(TestStatus status) { - testing::internal::ColoredPrintf(color, "[ TestInfo]"); - std::cout << std::endl; + log( "[ TestInfo]"); switch (status) { - case passed: testing::internal::ColoredPrintf(color , "[ PASSED]"); + case passed: log( "[ PASSED]"); break; - case failed: testing::internal::ColoredPrintf(color, "[ FAILED]"); + case failed: log( "[ FAILED]"); break; - case test_error: testing::internal::ColoredPrintf(color, "[ ERROR]"); + case test_error: log( "[ ERROR]"); break; - case simulationCrashed: testing::internal::ColoredPrintf(color, "[Sim crashed]"); + case simulationCrashed: log( "[Sim crashed]"); break; default: break; } - std::cout << std::endl; - testing::internal::ColoredPrintf(color, "[-----------]"); - std::cout << std::endl << std::endl; + log( "[-----------]"); } void ColorConsoleOutputImp::print(std::string output) { - testing::internal::ColoredPrintf(color, "[ ] "); - testing::internal::ColoredPrintf(testing::internal::COLOR_DEFAULT, output.c_str()); - std::cout << std::endl; + log("[ ] "); + log(output.c_str()); } void ColorConsoleOutputImp::printColor(std::string output) { - testing::internal::ColoredPrintf(color, "[-----------] "); - testing::internal::ColoredPrintf(color, output.c_str()); - std::cout << std::endl; + log("[-----------] "); + log(output.c_str()); } void ColorConsoleOutputImp::setColor(TestStatus status) { switch (status) { - case passed: color = testing::internal::COLOR_GREEN; + case passed: color = "green"; break; - case failed: color = testing::internal::COLOR_RED; + case failed: color = "red"; break; - case test_error: color = testing::internal::COLOR_YELLOW; + case test_error: color = "yellow"; break; - case simulationCrashed: color = testing::internal::COLOR_YELLOW; + case simulationCrashed: color = "yellow"; break; default: break; - } + } } void ColorConsoleOutputImp::setColor(bool passed) { if (passed) - color = testing::internal::COLOR_GREEN; + color = "green"; else - color = testing::internal::COLOR_RED; + color = "red"; } void ColorConsoleOutputImp::printTestPassed(int numberOfTests, int numberOfExecutedTest, int numberOfPassedTest, int numberOfFailedTest, int numberOfErrorTest, int numberOfNotExecutedTest) @@ -174,21 +170,20 @@ void ColorConsoleOutputImp::printTestPassed(int numberOfTests, int numberOfExecu test << "[-----------] " << numberOfPassedTest << " out of " << numberOfExecutedTest << " executed Tests passed" << std::endl; test << "[-----------] " << numberOfFailedTest << " out of " << numberOfExecutedTest << " executed Tests failed" << std::endl; test << "[-----------]" << std::endl; - testing::internal::ColoredPrintf(color, test.str().c_str()); + log(test.str().c_str()); } void ColorConsoleOutputImp::printLine() { - testing::internal::ColoredPrintf(color, "----------------------------------------------------------------------\n"); + log("----------------------------------------------------------------------"); } void ColorConsoleOutputImp::printGreen(std::string output) { - testing::internal::ColoredPrintf(testing::internal::COLOR_GREEN, output.c_str()); - std::cout << std::endl; + log(output.c_str()); } void ColorConsoleOutputImp::printGreenHashLine() { - testing::internal::ColoredPrintf(testing::internal::COLOR_GREEN, "#################################################\n"); + log("#################################################"); } diff --git a/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.h b/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.h index 2a00f4286d59442046233ff19a7e95a105698928..96b33663195a6982e140a78cf3dd64730a0019ec 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.h @@ -4,17 +4,8 @@ #include "ColorConsoleOutput.h" #include <iostream> +#include <string> -#include <gtest/gtest.h> - -// https://stackoverflow.com/questions/16491675/how-to-send-custom-message-in-google-c-testing-framework/29155677#29155677 -namespace testing -{ - namespace internal - { - extern void ColoredPrintf(GTestColor color, const char* fmt, ...); - } -} class ColorConsoleOutputImp : public ColorConsoleOutput { @@ -40,6 +31,7 @@ private: void printGreen(std::string output); void printGreenHashLine(); - testing::internal::GTestColor color; + // not used at the moment + std::string color; }; -#endif \ No newline at end of file +#endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.cpp b/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.cpp index 37734bc4dfbdd00df73a79947db2c07edb04ad18..26d4045fe4b14cf9ffc5dea16815d70c716de000 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.cpp @@ -1,76 +1,20 @@ #include "ConfigFileReaderNT.h" -#include "Core/Input/Input.h" +#include <basics/config/ConfigurationFile.h> #include "Core/StringUtilities/StringUtil.h" +#include <memory> #include <fstream> #include <string> #define VAL(str) #str #define TOSTRING(str) VAL(str) -std::shared_ptr<ConfigFileReader> ConfigFileReader::getNewInstance(const std::string aFilePath) -{ - return std::shared_ptr<ConfigFileReader>(new ConfigFileReader(aFilePath)); -} - -ConfigFileReader::ConfigFileReader(const std::string aFilePath) : myFilePath(aFilePath) -{ - // If PATH_NUMERICAL_TESTS is not defined, the grid definitions for the tests needs to be placed in the project root - // directories. -#ifdef PATH_NUMERICAL_TESTS - pathNumericalTests = TOSTRING(PATH_NUMERICAL_TESTS) + std::string("/"); -#else - pathNumericalTests = TOSTRING(SOURCE_ROOT) + std::string("/"); -#endif - std::cout << pathNumericalTests << "\n"; -} - -void ConfigFileReader::readConfigFile() -{ - configData = std::shared_ptr<ConfigDataStruct>(new ConfigDataStruct); - std::ifstream stream = openConfigFile(myFilePath); - - std::shared_ptr<input::Input> input = input::Input::makeInput(stream, "config"); - - if (!checkConfigFile(input)) - exit(1); - - configData->viscosity = StringUtil::toDoubleVector(input->getValue("Viscosity")); - configData->kernelsToTest = readKernelList(input); - configData->writeAnalyticalToVTK = StringUtil::toBool(input->getValue("WriteAnalyResultsToVTK")); - configData->ySliceForCalculation = StringUtil::toInt(input->getValue("ySliceForCalculation")); - ; - configData->logFilePath = pathNumericalTests + input->getValue("FolderLogFile"); - configData->numberOfSimulations = calcNumberOfSimulations(input); - - std::shared_ptr<BasicSimulationParameterStruct> basicSimPara = makeBasicSimulationParameter(input); - - configData->taylorGreenVortexUxParameter = makeTaylorGreenVortexUxParameter(input, basicSimPara); - configData->taylorGreenVortexUxGridInformation = makeGridInformation(input, "TaylorGreenVortexUx"); - ; - - configData->taylorGreenVortexUzParameter = makeTaylorGreenVortexUzParameter(input, basicSimPara); - configData->taylorGreenVortexUzGridInformation = makeGridInformation(input, "TaylorGreenVortexUz"); - ; +using ConfigFilePtr = std::shared_ptr<vf::basics::ConfigurationFile>; +using ConfigDataPtr = std::shared_ptr<ConfigDataStruct>; - configData->shearWaveParameter = makeShearWaveParameter(input, basicSimPara); - configData->shearWaveGridInformation = makeGridInformation(input, "ShearWave"); - ; - configData->phiTestParameter = makePhiTestParameter(input); - configData->nyTestParameter = makeNyTestParameter(input); - configData->l2NormTestParameter = makeL2NormTestParameter(input); - configData->l2NormTestBetweenKernelsParameter = makeL2NormTestBetweenKernelsParameter(input); - - configData->vectorWriterInfo = makeVectorWriterInformationStruct(input); - - configData->logFilePara = makeLogFilePara(input); - - stream.close(); -} - -std::ifstream ConfigFileReader::openConfigFile(const std::string aFilePath) +std::ifstream openConfigFile(const std::string aFilePath) { std::ifstream stream; stream.open(aFilePath.c_str(), std::ios::in); @@ -80,21 +24,19 @@ std::ifstream ConfigFileReader::openConfigFile(const std::string aFilePath) return stream; } -std::shared_ptr<ConfigDataStruct> ConfigFileReader::getConfigData() { return configData; } - -bool ConfigFileReader::checkConfigFile(std::shared_ptr<input::Input> input) +bool checkConfigFile(ConfigFilePtr input) { - std::vector<double> u0TGVux = StringUtil::toDoubleVector(input->getValue("ux_TGV_Ux")); - std::vector<double> amplitudeTGVux = StringUtil::toDoubleVector(input->getValue("Amplitude_TGV_Ux")); - std::vector<int> basisTimeStepLengthTGVux = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_TGV_Ux")); + std::vector<double> u0TGVux = StringUtil::toDoubleVector(input->getValue<std::string>("ux_TGV_Ux")); + std::vector<double> amplitudeTGVux = StringUtil::toDoubleVector(input->getValue<std::string>("Amplitude_TGV_Ux")); + std::vector<int> basisTimeStepLengthTGVux = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_TGV_Ux")); - std::vector<double> v0TGVuz = StringUtil::toDoubleVector(input->getValue("uz_TGV_Uz")); - std::vector<double> amplitudeTGVuz = StringUtil::toDoubleVector(input->getValue("Amplitude_TGV_Uz")); - std::vector<int> basisTimeStepLengthTGVuz = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_TGV_Uz")); + std::vector<double> v0TGVuz = StringUtil::toDoubleVector(input->getValue<std::string>("uz_TGV_Uz")); + std::vector<double> amplitudeTGVuz = StringUtil::toDoubleVector(input->getValue<std::string>("Amplitude_TGV_Uz")); + std::vector<int> basisTimeStepLengthTGVuz = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_TGV_Uz")); - std::vector<double> v0SW = StringUtil::toDoubleVector(input->getValue("v0_SW")); - std::vector<double> u0SW = StringUtil::toDoubleVector(input->getValue("u0_SW")); - std::vector<int> basisTimeStepLengthSW = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_SW")); + std::vector<double> v0SW = StringUtil::toDoubleVector(input->getValue<std::string>("v0_SW")); + std::vector<double> u0SW = StringUtil::toDoubleVector(input->getValue<std::string>("u0_SW")); + std::vector<int> basisTimeStepLengthSW = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_SW")); if (u0TGVux.size() != amplitudeTGVux.size() || u0TGVux.size() != basisTimeStepLengthTGVux.size()) { std::cout << "Length u0_TGV_U0 is unequal to Lenght Amplitude_TGV_U0 or BasisTimeStepLength_TGV_U0!" @@ -115,24 +57,25 @@ bool ConfigFileReader::checkConfigFile(std::shared_ptr<input::Input> input) } std::shared_ptr<BasicSimulationParameterStruct> -ConfigFileReader::makeBasicSimulationParameter(std::shared_ptr<input::Input> input) +makeBasicSimulationParameter(ConfigFilePtr input) { std::shared_ptr<BasicSimulationParameterStruct> basicSimPara = std::shared_ptr<BasicSimulationParameterStruct>(new BasicSimulationParameterStruct); - basicSimPara->numberOfTimeSteps = StringUtil::toInt(input->getValue("NumberOfTimeSteps")); - basicSimPara->devices = StringUtil::toUintVector(input->getValue("Devices")); + basicSimPara->numberOfTimeSteps = StringUtil::toInt(input->getValue<std::string>("NumberOfTimeSteps")); + basicSimPara->devices = StringUtil::toUintVector(input->getValue<std::string>("Devices")); return basicSimPara; } std::vector<std::shared_ptr<TaylorGreenVortexUxParameterStruct>> -ConfigFileReader::makeTaylorGreenVortexUxParameter(std::shared_ptr<input::Input> input, - std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter) +makeTaylorGreenVortexUxParameter(const std::string pathNumericalTests, + ConfigFilePtr input, + std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter) { - std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_TGV_Ux")); - std::vector<double> amplitude = StringUtil::toDoubleVector(input->getValue("Amplitude_TGV_Ux")); - std::vector<double> u0 = StringUtil::toDoubleVector(input->getValue("ux_TGV_Ux")); - int l0 = StringUtil::toInt(input->getValue("l0_TGV_Ux")); + std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_TGV_Ux")); + std::vector<double> amplitude = StringUtil::toDoubleVector(input->getValue<std::string>("Amplitude_TGV_Ux")); + std::vector<double> u0 = StringUtil::toDoubleVector(input->getValue<std::string>("ux_TGV_Ux")); + int l0 = StringUtil::toInt(input->getValue<std::string>("l0_TGV_Ux")); basicSimParameter->l0 = l0; std::vector<std::shared_ptr<TaylorGreenVortexUxParameterStruct>> parameter; @@ -145,22 +88,23 @@ ConfigFileReader::makeTaylorGreenVortexUxParameter(std::shared_ptr<input::Input> aParameter->amplitude = amplitude.at(i); aParameter->basicTimeStepLength = basisTimeStepLength.at(i); aParameter->l0 = l0; - aParameter->rho0 = StringUtil::toDouble(input->getValue("Rho0")); - aParameter->vtkFilePath = pathNumericalTests + input->getValue("FolderForVTKFileWriting"); - aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue("DataToCalcTests_TGV_Ux")); + aParameter->rho0 = StringUtil::toDouble(input->getValue<std::string>("Rho0")); + aParameter->vtkFilePath = pathNumericalTests + input->getValue<std::string>("FolderForVTKFileWriting"); + aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue<std::string>("DataToCalcTests_TGV_Ux")); parameter.push_back(aParameter); } return parameter; } std::vector<std::shared_ptr<TaylorGreenVortexUzParameterStruct>> -ConfigFileReader::makeTaylorGreenVortexUzParameter(std::shared_ptr<input::Input> input, - std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter) +makeTaylorGreenVortexUzParameter(const std::string pathNumericalTests, + ConfigFilePtr input, + std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter) { - std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_TGV_Uz")); - std::vector<double> amplitude = StringUtil::toDoubleVector(input->getValue("Amplitude_TGV_Uz")); - std::vector<double> uz = StringUtil::toDoubleVector(input->getValue("uz_TGV_Uz")); - int l0 = StringUtil::toInt(input->getValue("l0_TGV_Uz")); + std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_TGV_Uz")); + std::vector<double> amplitude = StringUtil::toDoubleVector(input->getValue<std::string>("Amplitude_TGV_Uz")); + std::vector<double> uz = StringUtil::toDoubleVector(input->getValue<std::string>("uz_TGV_Uz")); + int l0 = StringUtil::toInt(input->getValue<std::string>("l0_TGV_Uz")); basicSimParameter->l0 = l0; std::vector<std::shared_ptr<TaylorGreenVortexUzParameterStruct>> parameter; @@ -172,21 +116,22 @@ ConfigFileReader::makeTaylorGreenVortexUzParameter(std::shared_ptr<input::Input> aParameter->amplitude = amplitude.at(i); aParameter->basicTimeStepLength = basisTimeStepLength.at(i); aParameter->l0 = l0; - aParameter->rho0 = StringUtil::toDouble(input->getValue("Rho0")); - aParameter->vtkFilePath = pathNumericalTests + input->getValue("FolderForVTKFileWriting"); - aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue("DataToCalcTests_TGV_Uz")); + aParameter->rho0 = StringUtil::toDouble(input->getValue<std::string>("Rho0")); + aParameter->vtkFilePath = pathNumericalTests + input->getValue<std::string>("FolderForVTKFileWriting"); + aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue<std::string>("DataToCalcTests_TGV_Uz")); parameter.push_back(aParameter); } return parameter; } std::vector<std::shared_ptr<ShearWaveParameterStruct>> -ConfigFileReader::makeShearWaveParameter(std::shared_ptr<input::Input> input, - std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter) +makeShearWaveParameter(const std::string pathNumericalTests, + ConfigFilePtr input, + std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter) { - std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue("BasisTimeStepLength_SW")); - std::vector<double> uz = StringUtil::toDoubleVector(input->getValue("v0_SW")); - std::vector<double> ux = StringUtil::toDoubleVector(input->getValue("u0_SW")); - int l0 = StringUtil::toInt(input->getValue("l0_SW")); + std::vector<int> basisTimeStepLength = StringUtil::toIntVector(input->getValue<std::string>("BasisTimeStepLength_SW")); + std::vector<double> uz = StringUtil::toDoubleVector(input->getValue<std::string>("v0_SW")); + std::vector<double> ux = StringUtil::toDoubleVector(input->getValue<std::string>("u0_SW")); + int l0 = StringUtil::toInt(input->getValue<std::string>("l0_SW")); basicSimParameter->l0 = l0; std::vector<std::shared_ptr<ShearWaveParameterStruct>> parameter; @@ -198,82 +143,116 @@ ConfigFileReader::makeShearWaveParameter(std::shared_ptr<input::Input> input, aParameter->ux = ux.at(i); aParameter->basicTimeStepLength = basisTimeStepLength.at(i); aParameter->l0 = l0; - aParameter->rho0 = StringUtil::toDouble(input->getValue("Rho0")); - aParameter->vtkFilePath = pathNumericalTests + input->getValue("FolderForVTKFileWriting"); - aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue("DataToCalcTests_SW")); + aParameter->rho0 = StringUtil::toDouble(input->getValue<std::string>("Rho0")); + aParameter->vtkFilePath = pathNumericalTests + input->getValue<std::string>("FolderForVTKFileWriting"); + aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue<std::string>("DataToCalcTests_SW")); parameter.push_back(aParameter); } return parameter; } -std::shared_ptr<NyTestParameterStruct> ConfigFileReader::makeNyTestParameter(std::shared_ptr<input::Input> input) +std::shared_ptr<NyTestParameterStruct> makeNyTestParameter(ConfigFilePtr input) { std::shared_ptr<BasicTestParameterStruct> basicTestParameter = std::shared_ptr<BasicTestParameterStruct>(new BasicTestParameterStruct); - basicTestParameter->runTest = StringUtil::toBool(input->getValue("NyTest")); - basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue("ySliceForCalculation")); + basicTestParameter->runTest = StringUtil::toBool(input->getValue<std::string>("NyTest")); + basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue<std::string>("ySliceForCalculation")); std::shared_ptr<NyTestParameterStruct> testParameter = std::shared_ptr<NyTestParameterStruct>(new NyTestParameterStruct); testParameter->basicTestParameter = basicTestParameter; - testParameter->endTimeStepCalculation = StringUtil::toInt(input->getValue("EndTimeStepCalculation_Ny")); - testParameter->minOrderOfAccuracy = StringUtil::toDouble(input->getValue("MinOrderOfAccuracy_Ny")); - testParameter->startTimeStepCalculation = StringUtil::toInt(input->getValue("StartTimeStepCalculation_Ny")); + testParameter->endTimeStepCalculation = StringUtil::toInt(input->getValue<std::string>("EndTimeStepCalculation_Ny")); + testParameter->minOrderOfAccuracy = StringUtil::toDouble(input->getValue<std::string>("MinOrderOfAccuracy_Ny")); + testParameter->startTimeStepCalculation = StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_Ny")); return testParameter; } -std::shared_ptr<PhiTestParameterStruct> ConfigFileReader::makePhiTestParameter(std::shared_ptr<input::Input> input) +std::shared_ptr<PhiTestParameterStruct> makePhiTestParameter(ConfigFilePtr input) { std::shared_ptr<BasicTestParameterStruct> basicTestParameter = std::shared_ptr<BasicTestParameterStruct>(new BasicTestParameterStruct); - basicTestParameter->runTest = StringUtil::toBool(input->getValue("PhiTest")); - basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue("ySliceForCalculation")); + basicTestParameter->runTest = StringUtil::toBool(input->getValue<std::string>("PhiTest")); + basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue<std::string>("ySliceForCalculation")); std::shared_ptr<PhiTestParameterStruct> testParameter = std::shared_ptr<PhiTestParameterStruct>(new PhiTestParameterStruct); testParameter->basicTestParameter = basicTestParameter; - testParameter->endTimeStepCalculation = StringUtil::toInt(input->getValue("EndTimeStepCalculation_Phi")); - testParameter->minOrderOfAccuracy = StringUtil::toDouble(input->getValue("MinOrderOfAccuracy_Phi")); - testParameter->startTimeStepCalculation = StringUtil::toInt(input->getValue("StartTimeStepCalculation_Phi")); + testParameter->endTimeStepCalculation = StringUtil::toInt(input->getValue<std::string>("EndTimeStepCalculation_Phi")); + testParameter->minOrderOfAccuracy = StringUtil::toDouble(input->getValue<std::string>("MinOrderOfAccuracy_Phi")); + testParameter->startTimeStepCalculation = StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_Phi")); return testParameter; } std::shared_ptr<L2NormTestParameterStruct> -ConfigFileReader::makeL2NormTestParameter(std::shared_ptr<input::Input> input) +makeL2NormTestParameter(ConfigFilePtr input) { std::shared_ptr<BasicTestParameterStruct> basicTestParameter = std::shared_ptr<BasicTestParameterStruct>(new BasicTestParameterStruct); - basicTestParameter->runTest = StringUtil::toBool(input->getValue("L2NormTest")); - basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue("ySliceForCalculation")); + basicTestParameter->runTest = StringUtil::toBool(input->getValue<std::string>("L2NormTest")); + basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue<std::string>("ySliceForCalculation")); std::shared_ptr<L2NormTestParameterStruct> testParameter = std::shared_ptr<L2NormTestParameterStruct>(new L2NormTestParameterStruct); testParameter->basicTestParameter = basicTestParameter; - testParameter->basicTimeStep = StringUtil::toInt(input->getValue("BasicTimeStep_L2")); - testParameter->divergentTimeStep = StringUtil::toInt(input->getValue("DivergentTimeStep_L2")); - testParameter->normalizeData = StringUtil::toStringVector(input->getValue("NormalizeData_L2Norm")); - testParameter->maxDiff = StringUtil::toDoubleVector(input->getValue("MaxL2NormDiff")); + testParameter->basicTimeStep = StringUtil::toInt(input->getValue<std::string>("BasicTimeStep_L2")); + testParameter->divergentTimeStep = StringUtil::toInt(input->getValue<std::string>("DivergentTimeStep_L2")); + testParameter->normalizeData = StringUtil::toStringVector(input->getValue<std::string>("NormalizeData_L2Norm")); + testParameter->maxDiff = StringUtil::toDoubleVector(input->getValue<std::string>("MaxL2NormDiff")); return testParameter; } +std::vector<std::string> readKernelList(ConfigFilePtr input) +{ + if (StringUtil::toBool(input->getValue<std::string>("L2NormBetweenKernelsTest"))) { + std::vector<std::string> kernelList = StringUtil::toStringVector(input->getValue<std::string>("KernelsToTest")); + std::string beginKernel = input->getValue<std::string>("BasicKernel_L2NormBetweenKernels"); + bool basicKernelInKernelList = false; + for (int i = 0; i < kernelList.size(); i++) { + if (kernelList.at(i) == beginKernel) + basicKernelInKernelList = true; + } + if (!basicKernelInKernelList) + kernelList.push_back(beginKernel); + + std::vector<std::string> kernelNames = kernelList; + + while (kernelNames.at(0) != beginKernel) { + kernelNames.push_back(kernelNames.at(0)); + std::vector<std::string>::iterator it = kernelNames.begin(); + kernelNames.erase(it); + } + std::vector<std::string> kernels; + for (int i = 0; i < kernelNames.size(); i++) + kernels.push_back(kernelNames.at(i)); + return kernels; + } else { + std::vector<std::string> kernelList = StringUtil::toStringVector(input->getValue<std::string>("KernelsToTest")); + std::vector<std::string> kernels; + for (int i = 0; i < kernelList.size(); i++) + kernels.push_back(kernelList.at(i)); + + return kernels; + } +} + std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> -ConfigFileReader::makeL2NormTestBetweenKernelsParameter(std::shared_ptr<input::Input> input) +makeL2NormTestBetweenKernelsParameter(ConfigFilePtr input) { std::shared_ptr<BasicTestParameterStruct> basicTestParameter = std::shared_ptr<BasicTestParameterStruct>(new BasicTestParameterStruct); - basicTestParameter->runTest = StringUtil::toBool(input->getValue("L2NormBetweenKernelsTest")); - basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue("ySliceForCalculation")); + basicTestParameter->runTest = StringUtil::toBool(input->getValue<std::string>("L2NormBetweenKernelsTest")); + basicTestParameter->ySliceForCalculation = StringUtil::toInt(input->getValue<std::string>("ySliceForCalculation")); std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> testParameter = std::shared_ptr<L2NormTestBetweenKernelsParameterStruct>(new L2NormTestBetweenKernelsParameterStruct); testParameter->basicTestParameter = basicTestParameter; - testParameter->basicKernel = input->getValue("BasicKernel_L2NormBetweenKernels"); + testParameter->basicKernel = input->getValue<std::string>("BasicKernel_L2NormBetweenKernels"); testParameter->kernelsToTest = readKernelList(input); - testParameter->timeSteps = StringUtil::toIntVector(input->getValue("Timesteps_L2NormBetweenKernels")); - testParameter->normalizeData = StringUtil::toStringVector(input->getValue("NormalizeData_L2Norm")); + testParameter->timeSteps = StringUtil::toIntVector(input->getValue<std::string>("Timesteps_L2NormBetweenKernels")); + testParameter->normalizeData = StringUtil::toStringVector(input->getValue<std::string>("NormalizeData_L2Norm")); bool correct = false; for (int i = 0; i < testParameter->normalizeData.size(); i++) @@ -292,7 +271,7 @@ ConfigFileReader::makeL2NormTestBetweenKernelsParameter(std::shared_ptr<input::I } std::vector<std::shared_ptr<GridInformationStruct>> -ConfigFileReader::makeGridInformation(std::shared_ptr<input::Input> input, std::string simName) +makeGridInformation(const std::string pathNumericalTests, ConfigFilePtr input, std::string simName) { int number = 32; std::vector<std::string> valueNames; @@ -314,10 +293,10 @@ ConfigFileReader::makeGridInformation(std::shared_ptr<input::Input> input, std:: double nextNumber = 32.0; for (int i = 0; i < valueNames.size(); i++) { - if (StringUtil::toBool(input->getValue(valueNames.at(i)))) { + if (StringUtil::toBool(input->getValue<std::string>(valueNames.at(i)))) { lx.push_back(nextNumber); lz.push_back(nextNumber * 3.0 / 2.0); - gridPath.push_back(pathNumericalTests + input->getValue(gridPaths.at(i))); + gridPath.push_back(pathNumericalTests + input->getValue<std::string>(gridPaths.at(i))); nextNumber *= 2; } } @@ -326,7 +305,7 @@ ConfigFileReader::makeGridInformation(std::shared_ptr<input::Input> input, std:: for (int i = 0; i < lx.size(); i++) { std::shared_ptr<GridInformationStruct> aGridInformation = std::shared_ptr<GridInformationStruct>(new GridInformationStruct); - aGridInformation->numberOfGridLevels = StringUtil::toInt(input->getValue("NumberOfGridLevels")); + aGridInformation->numberOfGridLevels = StringUtil::toInt(input->getValue<std::string>("NumberOfGridLevels")); aGridInformation->maxLevel = aGridInformation->numberOfGridLevels - 1; aGridInformation->gridPath = gridPath.at(i); aGridInformation->lx = lx.at(i); @@ -336,112 +315,127 @@ ConfigFileReader::makeGridInformation(std::shared_ptr<input::Input> input, std:: return gridInformation; } +unsigned int calcStartStepForToVectorWriter(ConfigFilePtr input) +{ + std::vector<unsigned int> startStepsTests; + startStepsTests.push_back(StringUtil::toInt(input->getValue<std::string>("BasicTimeStep_L2"))); + startStepsTests.push_back(StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_Ny"))); + startStepsTests.push_back(StringUtil::toInt(input->getValue<std::string>("StartTimeStepCalculation_Phi"))); + std::sort(startStepsTests.begin(), startStepsTests.end()); + + return startStepsTests.at(0); +} + std::shared_ptr<VectorWriterInformationStruct> -ConfigFileReader::makeVectorWriterInformationStruct(std::shared_ptr<input::Input> input) +makeVectorWriterInformationStruct(ConfigFilePtr input) { std::shared_ptr<VectorWriterInformationStruct> vectorWriter = std::shared_ptr<VectorWriterInformationStruct>(new VectorWriterInformationStruct); vectorWriter->startTimeVectorWriter = calcStartStepForToVectorWriter(input); - vectorWriter->startTimeVTKDataWriter = StringUtil::toInt(input->getValue("StartStepFileWriter")); - vectorWriter->writeVTKFiles = StringUtil::toBool(input->getValue("WriteVTKFiles")); + vectorWriter->startTimeVTKDataWriter = StringUtil::toInt(input->getValue<std::string>("StartStepFileWriter")); + vectorWriter->writeVTKFiles = StringUtil::toBool(input->getValue<std::string>("WriteVTKFiles")); return vectorWriter; } -std::shared_ptr<LogFileParameterStruct> ConfigFileReader::makeLogFilePara(std::shared_ptr<input::Input> input) +std::shared_ptr<LogFileParameterStruct> makeLogFilePara(ConfigFilePtr input) { std::shared_ptr<LogFileParameterStruct> logFilePara = std::shared_ptr<LogFileParameterStruct>(new LogFileParameterStruct); - logFilePara->devices = StringUtil::toIntVector(input->getValue("Devices")); - logFilePara->numberOfTimeSteps = StringUtil::toInt(input->getValue("NumberOfTimeSteps")); - logFilePara->writeAnalyticalToVTK = StringUtil::toBool(input->getValue("WriteAnalyResultsToVTK")); + logFilePara->devices = StringUtil::toIntVector(input->getValue<std::string>("Devices")); + logFilePara->numberOfTimeSteps = StringUtil::toInt(input->getValue<std::string>("NumberOfTimeSteps")); + logFilePara->writeAnalyticalToVTK = StringUtil::toBool(input->getValue<std::string>("WriteAnalyResultsToVTK")); return logFilePara; } -std::vector<std::string> ConfigFileReader::readKernelList(std::shared_ptr<input::Input> input) +int calcNumberOfSimulationGroup(ConfigFilePtr input, std::string simName) { - if (StringUtil::toBool(input->getValue("L2NormBetweenKernelsTest"))) { - std::vector<std::string> kernelList = StringUtil::toStringVector(input->getValue("KernelsToTest")); - std::string beginnKernel = input->getValue("BasicKernel_L2NormBetweenKernels"); - bool basicKernelInKernelList = false; - for (int i = 0; i < kernelList.size(); i++) { - if (kernelList.at(i) == beginnKernel) - basicKernelInKernelList = true; - } - if (!basicKernelInKernelList) - kernelList.push_back(beginnKernel); - - std::vector<std::string> kernelNames = kernelList; - - while (kernelNames.at(0) != beginnKernel) { - kernelNames.push_back(kernelNames.at(0)); - std::vector<std::string>::iterator it = kernelNames.begin(); - kernelNames.erase(it); - } - std::vector<std::string> kernels; - for (int i = 0; i < kernelNames.size(); i++) - kernels.push_back(kernelNames.at(i)); - return kernels; - } else { - std::vector<std::string> kernelList = StringUtil::toStringVector(input->getValue("KernelsToTest")); - std::vector<std::string> kernels; - for (int i = 0; i < kernelList.size(); i++) - kernels.push_back(kernelList.at(i)); - - return kernels; + int counter = 0; + int number = 32; + std::vector<std::string> valueNames; + for (int i = 1; i <= 5; i++) { + std::string aValueName = simName; + aValueName += std::to_string(number); + valueNames.push_back(aValueName); + number *= 2; } + for (int i = 0; i < valueNames.size(); i++) { + if (StringUtil::toBool(input->getValue<std::string>(valueNames.at(i)))) + counter++; + } + return counter; } -unsigned int ConfigFileReader::calcStartStepForToVectorWriter(std::shared_ptr<input::Input> input) -{ - std::vector<unsigned int> startStepsTests; - startStepsTests.push_back(StringUtil::toInt(input->getValue("BasicTimeStep_L2"))); - startStepsTests.push_back(StringUtil::toInt(input->getValue("StartTimeStepCalculation_Ny"))); - startStepsTests.push_back(StringUtil::toInt(input->getValue("StartTimeStepCalculation_Phi"))); - std::sort(startStepsTests.begin(), startStepsTests.end()); - - return startStepsTests.at(0); -} - -int ConfigFileReader::calcNumberOfSimulations(std::shared_ptr<input::Input> input) +int calcNumberOfSimulations(ConfigFilePtr input, ConfigDataPtr configData) { int counter = 0; int tgvCounterU0 = calcNumberOfSimulationGroup(input, "TaylorGreenVortexUx"); - tgvCounterU0 *= int(StringUtil::toDoubleVector(input->getValue("ux_TGV_Ux")).size()); + tgvCounterU0 *= int(StringUtil::toDoubleVector(input->getValue<std::string>("ux_TGV_Ux")).size()); counter += tgvCounterU0; int tgvCounterV0 = calcNumberOfSimulationGroup(input, "TaylorGreenVortexUz"); ; - tgvCounterV0 *= int(StringUtil::toDoubleVector(input->getValue("uz_TGV_Uz")).size()); + tgvCounterV0 *= int(StringUtil::toDoubleVector(input->getValue<std::string>("uz_TGV_Uz")).size()); counter += tgvCounterV0; int swCounter = calcNumberOfSimulationGroup(input, "ShearWave"); ; - swCounter *= int(StringUtil::toDoubleVector(input->getValue("u0_SW")).size()); + swCounter *= int(StringUtil::toDoubleVector(input->getValue<std::string>("u0_SW")).size()); counter += swCounter; - counter *= int(StringUtil::toDoubleVector(input->getValue("Viscosity")).size()); + counter *= int(StringUtil::toDoubleVector(input->getValue<std::string>("Viscosity")).size()); counter *= int(configData->kernelsToTest.size()); return counter; } -int ConfigFileReader::calcNumberOfSimulationGroup(std::shared_ptr<input::Input> input, std::string simName) +ConfigDataPtr vf::gpu::tests::readConfigFile(const std::string aFilePath) { - int counter = 0; - int number = 32; - std::vector<std::string> valueNames; - for (int i = 1; i <= 5; i++) { - std::string aValueName = simName; - aValueName += std::to_string(number); - valueNames.push_back(aValueName); - number *= 2; - } - for (int i = 0; i < valueNames.size(); i++) { - if (StringUtil::toBool(input->getValue(valueNames.at(i)))) - counter++; - } - return counter; + // If PATH_NUMERICAL_TESTS is not defined, the grid definitions for the tests needs to be placed in the project root + // directories. +#ifdef PATH_NUMERICAL_TESTS + auto pathNumericalTests = TOSTRING(PATH_NUMERICAL_TESTS) + std::string("/"); +#else + auto pathNumericalTests = TOSTRING(SOURCE_ROOT) + std::string("/"); +#endif + std::cout << pathNumericalTests << "\n"; + + auto configData = std::make_shared<ConfigDataStruct>(); + auto input = std::make_shared<vf::basics::ConfigurationFile>(); + input->load(aFilePath); + + if (!checkConfigFile(input)) + exit(1); + + configData->viscosity = StringUtil::toDoubleVector(input->getValue<std::string>("Viscosity")); + configData->kernelsToTest = readKernelList(input); + configData->writeAnalyticalToVTK = StringUtil::toBool(input->getValue<std::string>("WriteAnalyResultsToVTK")); + configData->ySliceForCalculation = StringUtil::toInt(input->getValue<std::string>("ySliceForCalculation")); + + configData->logFilePath = pathNumericalTests + input->getValue<std::string>("FolderLogFile"); + configData->numberOfSimulations = calcNumberOfSimulations(input, configData); + + auto basicSimPara = makeBasicSimulationParameter(input); + + configData->taylorGreenVortexUxParameter = makeTaylorGreenVortexUxParameter(pathNumericalTests, input, basicSimPara); + configData->taylorGreenVortexUxGridInformation = makeGridInformation(pathNumericalTests, input, "TaylorGreenVortexUx"); + + configData->taylorGreenVortexUzParameter = makeTaylorGreenVortexUzParameter(pathNumericalTests, input, basicSimPara); + configData->taylorGreenVortexUzGridInformation = makeGridInformation(pathNumericalTests, input, "TaylorGreenVortexUz"); + + configData->shearWaveParameter = makeShearWaveParameter(pathNumericalTests, input, basicSimPara); + configData->shearWaveGridInformation = makeGridInformation(pathNumericalTests, input, "ShearWave"); + + configData->phiTestParameter = makePhiTestParameter(input); + configData->nyTestParameter = makeNyTestParameter(input); + configData->l2NormTestParameter = makeL2NormTestParameter(input); + configData->l2NormTestBetweenKernelsParameter = makeL2NormTestBetweenKernelsParameter(input); + + configData->vectorWriterInfo = makeVectorWriterInformationStruct(input); + + configData->logFilePara = makeLogFilePara(input); + + return configData; } \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.h b/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.h index 92f58890bcd61fd47ff27160c62a708d3967f74f..cd4ad56b4c23a8a973385839aa1b0736e1d2fda1 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.h +++ b/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.h @@ -1,60 +1,19 @@ #ifndef CONFIG_FILE_READER_H #define CONFIG_FILE_READER_H -#include "Core/Input/Input.h" #include "Utilities/Structs/ConfigDataStruct.h" #include <memory> #include <string> #include <vector> -class ConfigFileReader +namespace vf::basics { -public: - static std::shared_ptr<ConfigFileReader> getNewInstance(const std::string aFilePath); - std::shared_ptr<ConfigDataStruct> getConfigData(); - void readConfigFile(); +class ConfigurationFile; +} -private: - ConfigFileReader(){}; - ConfigFileReader(const std::string aFilePath); - - std::ifstream openConfigFile(const std::string aFilePath); - bool checkConfigFile(std::shared_ptr<input::Input> input); - std::vector<std::string> readKernelList(std::shared_ptr<input::Input> input); - - int calcNumberOfSimulations(std::shared_ptr<input::Input> input); - int calcNumberOfSimulationGroup(std::shared_ptr<input::Input> input, std::string simName); - unsigned int calcStartStepForToVectorWriter(std::shared_ptr<input::Input> input); - - std::vector<std::shared_ptr<TaylorGreenVortexUxParameterStruct>> - makeTaylorGreenVortexUxParameter(std::shared_ptr<input::Input> input, - std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter); - std::vector<std::shared_ptr<TaylorGreenVortexUzParameterStruct>> - makeTaylorGreenVortexUzParameter(std::shared_ptr<input::Input> input, - std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter); - std::vector<std::shared_ptr<ShearWaveParameterStruct>> - makeShearWaveParameter(std::shared_ptr<input::Input> input, - std::shared_ptr<BasicSimulationParameterStruct> basicSimParameter); - - std::shared_ptr<NyTestParameterStruct> makeNyTestParameter(std::shared_ptr<input::Input> input); - std::shared_ptr<PhiTestParameterStruct> makePhiTestParameter(std::shared_ptr<input::Input> input); - std::shared_ptr<L2NormTestParameterStruct> makeL2NormTestParameter(std::shared_ptr<input::Input> input); - std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> - makeL2NormTestBetweenKernelsParameter(std::shared_ptr<input::Input> input); - - std::shared_ptr<BasicSimulationParameterStruct> makeBasicSimulationParameter(std::shared_ptr<input::Input> input); - std::vector<std::shared_ptr<GridInformationStruct>> makeGridInformation(std::shared_ptr<input::Input> input, - std::string simName); - - std::shared_ptr<VectorWriterInformationStruct> - makeVectorWriterInformationStruct(std::shared_ptr<input::Input> input); - std::shared_ptr<LogFileParameterStruct> makeLogFilePara(std::shared_ptr<input::Input> input); - - std::string pathNumericalTests; - - const std::string myFilePath; - std::shared_ptr<ConfigDataStruct> configData; - //std::shared_ptr<KernelMapper> myKernelMapper; -}; +namespace vf::gpu::tests +{ + std::shared_ptr<ConfigDataStruct> readConfigFile(const std::string aFilePath); +} #endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp index bfcb8aca231c14f601a3a0148c02b02f24026c4c..b9b4dd3a8d13ddcce87c555312c0d0a422de5a05 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp @@ -1,66 +1,73 @@ #include "AnalyticalResults2DToVTKWriterImp.h" -#include <stdio.h> +#include <cmath> #include <fstream> #include <sstream> -#include <cmath> +#include <stdio.h> #include <Core/StringUtilities/StringUtil.h> #include "Parameter/Parameter.h" #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <basics/writer/WbWriterVtkXmlBinary.h> #include "Utilities/Results/AnalyticalResults/AnalyticalResult.h" #include <mpi.h> - -std::shared_ptr<AnalyticalResults2DToVTKWriterImp> AnalyticalResults2DToVTKWriterImp::getInstance(bool writeAnalyticalResults) +std::shared_ptr<AnalyticalResults2DToVTKWriterImp> +AnalyticalResults2DToVTKWriterImp::getInstance(bool writeAnalyticalResults) { - static std::shared_ptr<AnalyticalResults2DToVTKWriterImp> uniqueInstance; - if (!uniqueInstance) - uniqueInstance = std::shared_ptr<AnalyticalResults2DToVTKWriterImp>(new AnalyticalResults2DToVTKWriterImp(writeAnalyticalResults)); - return uniqueInstance; + static std::shared_ptr<AnalyticalResults2DToVTKWriterImp> uniqueInstance; + if (!uniqueInstance) + uniqueInstance = std::shared_ptr<AnalyticalResults2DToVTKWriterImp>( + new AnalyticalResults2DToVTKWriterImp(writeAnalyticalResults)); + return uniqueInstance; } -AnalyticalResults2DToVTKWriterImp::AnalyticalResults2DToVTKWriterImp(bool writeAnalyticalResults) : writeAnalyticalResults(writeAnalyticalResults) +AnalyticalResults2DToVTKWriterImp::AnalyticalResults2DToVTKWriterImp(bool writeAnalyticalResults) + : writeAnalyticalResults(writeAnalyticalResults) { - } -void AnalyticalResults2DToVTKWriterImp::writeAnalyticalResult(std::shared_ptr<Parameter> para, std::shared_ptr<AnalyticalResults> analyticalResult) +void AnalyticalResults2DToVTKWriterImp::writeAnalyticalResult(std::shared_ptr<Parameter> para, + std::shared_ptr<AnalyticalResults> analyticalResult) { - if (writeAnalyticalResults) { - std::cout << "Write Analytical Result To VTK-Files" << std::endl; - for (int level = para->getCoarse(); level <= para->getFine(); level++) { + if (writeAnalyticalResults) { + std::cout << "Write Analytical Result To VTK-Files" << std::endl; + for (int level = para->getCoarse(); level <= para->getFine(); level++) { #pragma omp parallel for - for (int timeStep = 0; timeStep < analyticalResult->getNumberOfTimeSteps(); timeStep++) { - const unsigned int numberOfParts = para->getParH(level)->size_Mat_SP / para->getlimitOfNodesForVTK() + 1; - std::vector<std::string> fname; - unsigned int time = analyticalResult->getTimeSteps().at(timeStep)*analyticalResult->getTimeStepLength(); - for (int j = 1; j <= numberOfParts; j++) { - std::string filePath = para->getFName(); - filePath.resize(filePath.size() - 5); - fname.push_back(filePath + "AnalyticalResult/Analytical_cells_bin_lev_" + StringUtil::toString<int>(level) + "_ID_" + StringUtil::toString<int>(para->getMyID()) + "_Part_" + StringUtil::toString<int>(j) + "_t_" + StringUtil::toString<int>(time) + ".vtk"); - } - std::cout << "\t Write TimeStep=" << timeStep << " t=" << time << "..."; - writeTimeStep(para, analyticalResult, level, fname, timeStep); - std::cout << "done." << std::endl; - } - } - std::cout << std::endl; - } + for (int timeStep = 0; timeStep < analyticalResult->getNumberOfTimeSteps(); timeStep++) { + const unsigned int numberOfParts = para->getParH(level)->size_Mat / para->getlimitOfNodesForVTK() + 1; + std::vector<std::string> fname; + unsigned int time = + analyticalResult->getTimeSteps().at(timeStep) * analyticalResult->getTimeStepLength(); + for (int j = 1; j <= numberOfParts; j++) { + std::string filePath = para->getFName(); + filePath.resize(filePath.size() - 5); + fname.push_back(filePath + "AnalyticalResult/Analytical_cells_bin_lev_" + + StringUtil::toString<int>(level) + "_ID_" + + StringUtil::toString<int>(para->getMyProcessID()) + "_Part_" + + StringUtil::toString<int>(j) + "_t_" + StringUtil::toString<int>(time) + ".vtk"); + } + std::cout << "\t Write TimeStep=" << timeStep << " t=" << time << "..."; + writeTimeStep(para, analyticalResult, level, fname, timeStep); + std::cout << "done." << std::endl; + } + } + std::cout << std::endl; + } } - -void AnalyticalResults2DToVTKWriterImp::writeTimeStep(std::shared_ptr<Parameter> para, std::shared_ptr<AnalyticalResults> analyticalResult, int level, std::vector<std::string> & fname, int timeStep) +void AnalyticalResults2DToVTKWriterImp::writeTimeStep(std::shared_ptr<Parameter> para, + std::shared_ptr<AnalyticalResults> analyticalResult, int level, + std::vector<std::string> &fname, int timeStep) { - std::vector<UbTupleFloat3 > nodes; - std::vector<UbTupleUInt8 > cells; - std::vector<std::string > nodedatanames; + std::vector<UbTupleFloat3> nodes; + std::vector<UbTupleUInt8> cells; + std::vector<std::string> nodedatanames; nodedatanames.push_back("press"); nodedatanames.push_back("rho"); nodedatanames.push_back("vx1"); @@ -73,21 +80,21 @@ void AnalyticalResults2DToVTKWriterImp::writeTimeStep(std::shared_ptr<Parameter> unsigned int startpos = 0; unsigned int endpos = 0; unsigned int sizeOfNodes = 0; - std::vector<std::vector<double > > nodedata(nodedatanames.size()); + std::vector<std::vector<double>> nodedata(nodedatanames.size()); - maxX = para->getGridX().at(level); - maxY = para->getGridY().at(level); - maxZ = para->getGridZ().at(level); + maxX = para->getGridX().at(level); + maxY = para->getGridY().at(level); + maxZ = para->getGridZ().at(level); - std::vector<double> press = analyticalResult->getPress()[timeStep]; - std::vector<double> rho = analyticalResult->getRho()[timeStep]; - std::vector<double> vx = analyticalResult->getVx()[timeStep]; - std::vector<double> vy = analyticalResult->getVy()[timeStep]; - std::vector<double> vz = analyticalResult->getVz()[timeStep]; + std::vector<double> press = analyticalResult->getPress()[timeStep]; + std::vector<double> rho = analyticalResult->getRho()[timeStep]; + std::vector<double> vx = analyticalResult->getVx()[timeStep]; + std::vector<double> vy = analyticalResult->getVy()[timeStep]; + std::vector<double> vz = analyticalResult->getVz()[timeStep]; - for (unsigned int part = 0; part < fname.size(); part++){ - if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + for (unsigned int part = 0; part < fname.size(); part++) { + if (((part + 1) * para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat) + sizeOfNodes = para->getParH(level)->size_Mat - (part * para->getlimitOfNodesForVTK()); else sizeOfNodes = para->getlimitOfNodesForVTK(); @@ -104,14 +111,13 @@ void AnalyticalResults2DToVTKWriterImp::writeTimeStep(std::shared_ptr<Parameter> nodedata[4].resize(sizeOfNodes); nodedata[5].resize(sizeOfNodes); ////////////////////////////////////////////////////////////////////////// - for (unsigned int pos = startpos; pos < endpos; pos++) - { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) - { + for (unsigned int pos = startpos; pos < endpos; pos++) { + std::cout << "BEGIN POS: " << pos << std::endl; + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; dn1 = pos - startpos; @@ -119,37 +125,57 @@ void AnalyticalResults2DToVTKWriterImp::writeTimeStep(std::shared_ptr<Parameter> ////////////////////////////////////////////////////////////////////////// nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - int numberInResults = CoordResults2DTo1D(x1 - 1.0, x3 - 1.0); + int numberInResults = CoordResults2DTo1D(x1 - 1.0, x3 - 1.0); nodedata[0][dn1] = press[numberInResults]; - nodedata[1][dn1] = rho[numberInResults]; + nodedata[1][dn1] = rho[numberInResults]; nodedata[2][dn1] = vx[numberInResults]; nodedata[3][dn1] = vy[numberInResults]; nodedata[4][dn1] = vz[numberInResults]; - nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos]; + nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + std::cout << "NeighborIndex1 " << number1 << std::endl << + "NeighborIndex2 " << number2 << std::endl << + "NeighborIndex3 " << number3 << std::endl << + "NeighborIndex4 " << number4 << std::endl << + "NeighborIndex5 " << number5 << std::endl << + "NeighborIndex6 " << number6 << std::endl << + "NeighborIndex7 " << number7 << std::endl << + "NeighborIndex8 " << number8 << std::endl; ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID) neighborsAreFluid = false; + auto neighbor1 = para->getParH(level)->typeOfGridNode[number2]; + auto neighbor2 = para->getParH(level)->typeOfGridNode[number3]; + auto neighbor3 = para->getParH(level)->typeOfGridNode[number4]; + auto neighbor4 = para->getParH(level)->typeOfGridNode[number5]; //breaks! + auto neighbor5 = para->getParH(level)->typeOfGridNode[number6]; + auto neighbor6 = para->getParH(level)->typeOfGridNode[number7]; + auto neighbor7 = para->getParH(level)->typeOfGridNode[number8]; + std::cout << "Neighbor1 " << neighbor1 << std::endl << + "Neighbor2 " << neighbor2 << std::endl << + "Neighbor3 " << neighbor3 << std::endl << + "Neighbor4 " << neighbor4 << std::endl << + "Neighbor5 " << neighbor5 << std::endl << + "Neighbor6 " << neighbor6 << std::endl << + "Neighbor7 " << neighbor7 << std::endl; + + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) + neighborsAreFluid = false; ////////////////////////////////////////////////////////////////////////// - if (number2 > endpos || - number3 > endpos || - number4 > endpos || - number5 > endpos || - number6 > endpos || - number7 > endpos || - number8 > endpos) neighborsAreFluid = false; + if (number2 > endpos || number3 > endpos || number4 > endpos || number5 > endpos || number6 > endpos || + number7 > endpos || number8 > endpos) + neighborsAreFluid = false; ////////////////////////////////////////////////////////////////////////// dn2 = number2 - startpos; dn3 = number3 - startpos; @@ -161,6 +187,7 @@ void AnalyticalResults2DToVTKWriterImp::writeTimeStep(std::shared_ptr<Parameter> ////////////////////////////////////////////////////////////////////////// if (neighborsAreFluid) cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8)); + std::cout << "END POS: " << pos << std::endl; } } WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata); @@ -169,5 +196,5 @@ void AnalyticalResults2DToVTKWriterImp::writeTimeStep(std::shared_ptr<Parameter> int AnalyticalResults2DToVTKWriterImp::CoordResults2DTo1D(int x, int z) { - return z * (maxX - 1) + x; + return z * (maxX - 1) + x; } diff --git a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp index d507d92b6a790c06981852251db087039062759e..c13f6f748463287fc4e7401d56d7c7ab40cc1a77 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/Y2dSliceToResults/Y2dSliceToResults.cpp @@ -1,66 +1,76 @@ #include "Y2dSliceToResults.h" -#include "VirtualFluids_GPU/Parameter/Parameter.h" #include "Utilities/Results/SimulationResults/SimulationResults.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" +#include <cmath> +#include <sstream> -std::shared_ptr<Y2dSliceToResults> Y2dSliceToResults::getNewInstance(std::shared_ptr<VectorWriterInformationStruct> vectorWriterInfo, unsigned int timeStepLength, std::shared_ptr<SimulationResults> simResults, unsigned int ySliceForCalculation) +std::shared_ptr<Y2dSliceToResults> +Y2dSliceToResults::getNewInstance(std::shared_ptr<VectorWriterInformationStruct> vectorWriterInfo, + unsigned int timeStepLength, std::shared_ptr<SimulationResults> simResults, + unsigned int ySliceForCalculation) { - return std::shared_ptr<Y2dSliceToResults>(new Y2dSliceToResults(vectorWriterInfo, timeStepLength, simResults, ySliceForCalculation)); + return std::shared_ptr<Y2dSliceToResults>( + new Y2dSliceToResults(vectorWriterInfo, timeStepLength, simResults, ySliceForCalculation)); } Y2dSliceToResults::Y2dSliceToResults() { - } -Y2dSliceToResults::Y2dSliceToResults(std::shared_ptr<VectorWriterInformationStruct> vectorWriterInfo, unsigned int timeStepLength, std::shared_ptr<SimulationResults> simResults, unsigned int ySliceForCalculation) - : ToVectorWriter(vectorWriterInfo, timeStepLength) +Y2dSliceToResults::Y2dSliceToResults(std::shared_ptr<VectorWriterInformationStruct> vectorWriterInfo, + unsigned int timeStepLength, std::shared_ptr<SimulationResults> simResults, + unsigned int ySliceForCalculation) + : ToVectorWriter(vectorWriterInfo, timeStepLength) { - this->simResults = simResults; - this->ySliceForCalculation = ySliceForCalculation; + this->simResults = simResults; + this->ySliceForCalculation = ySliceForCalculation; } void Y2dSliceToResults::writeTimestep(std::shared_ptr<Parameter> para, unsigned int t, int level) { - int timestep = t / timeStepLength; - maxX = para->getGridX().at(level); - maxY = para->getGridY().at(level); - maxZ = para->getGridZ().at(level); + int timestep = t / timeStepLength; + maxX = para->getGridX().at(level); + maxY = para->getGridY().at(level); + maxZ = para->getGridZ().at(level); - int numberNodes = (maxX - 1) * (maxZ - 1); - std::vector<double> x(numberNodes), y(numberNodes), z(numberNodes); - std::vector<double> vx(numberNodes), vy(numberNodes), vz(numberNodes); - std::vector<double> press(numberNodes), rho(numberNodes); - std::vector<unsigned int> levels(numberNodes); + int numberNodes = (maxX - 1) * (maxZ - 1); + std::vector<double> x(numberNodes), y(numberNodes), z(numberNodes); + std::vector<double> vx(numberNodes), vy(numberNodes), vz(numberNodes); + std::vector<double> press(numberNodes), rho(numberNodes); + std::vector<unsigned int> levels(numberNodes); - for (int posZ = 0; posZ < maxZ - 1; posZ++) - { - for (int posX = 0; posX < maxX - 1; posX++) - { - int posResults = CoordResults2DTo1D(posX, posZ); - int posPara = CoordPara3DTo1D(posX, ySliceForCalculation, posZ); + ySliceForCalculation = maxY / 2; + for (int posZ = 0; posZ < maxZ - 1; posZ++) { + for (int posX = 0; posX < maxX - 1; posX++) { + int posResults = CoordResults2DTo1D(posX, posZ); + int posPara = CoordPara3DTo1D(posX, ySliceForCalculation, posZ); - x.at(posResults) = (double)para->getParH(level)->coordX_SP[posPara] - (double)1.0; - y.at(posResults) = (double)para->getParH(level)->coordY_SP[posPara] - (double)1.0; - z.at(posResults) = (double)para->getParH(level)->coordZ_SP[posPara] - (double)1.0; - vx.at(posResults) = (double)para->getParH(level)->vx_SP[posPara] * (double)para->getVelocityRatio(); - vy.at(posResults) = (double)para->getParH(level)->vy_SP[posPara] * (double)para->getVelocityRatio(); - vz.at(posResults) = (double)para->getParH(level)->vz_SP[posPara] * (double)para->getVelocityRatio(); - press.at(posResults) = (double)para->getParH(level)->press_SP[posPara] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - rho.at(posResults) = (double)para->getParH(level)->rho_SP[posPara] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - levels.at(posResults) = level; - } - } - simResults->addTimeStep(timestep, t, levels, x, y, z, vx, vy, vz, press, rho); + x.at(posResults) = (double)para->getParH(level)->coordinateX[posPara] - (double)1.0; + y.at(posResults) = (double)para->getParH(level)->coordinateY[posPara] - (double)1.0; + z.at(posResults) = (double)para->getParH(level)->coordinateZ[posPara] - (double)1.0; + vx.at(posResults) = (double)para->getParH(level)->velocityX[posPara] * (double)para->getVelocityRatio(); + vy.at(posResults) = (double)para->getParH(level)->velocityY[posPara] * (double)para->getVelocityRatio(); + vz.at(posResults) = (double)para->getParH(level)->velocityZ[posPara] * (double)para->getVelocityRatio(); + press.at(posResults) = (double)para->getParH(level)->pressure[posPara] / (double)3.0 * + (double)para->getDensityRatio() * (double)para->getVelocityRatio() * + (double)para->getVelocityRatio(); + rho.at(posResults) = (double)para->getParH(level)->rho[posPara] / (double)3.0 * + (double)para->getDensityRatio() * (double)para->getVelocityRatio() * + (double)para->getVelocityRatio(); + levels.at(posResults) = level; + } + } + simResults->addTimeStep(timestep, t, levels, x, y, z, vx, vy, vz, press, rho); } int Y2dSliceToResults::CoordPara3DTo1D(int x, int y, int z) { - return z*maxY*maxX + y*maxX + x + 1; + return z * maxY * maxX + y * maxX + x + 1; } int Y2dSliceToResults::CoordResults2DTo1D(int x, int z) { - return z * (maxX - 1) + x; + return z * (maxX - 1) + x; } diff --git a/apps/gpu/tests/NumericalTests/Utilities/InitialCondition/InitialConditionImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/InitialCondition/InitialConditionImp.cpp index c31f8cbea82441eb41d2e39e96e502504d5fa5dd..72045afbe7a68ba9c8595ee5c736dd5b2da89ec7 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/InitialCondition/InitialConditionImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/InitialCondition/InitialConditionImp.cpp @@ -16,15 +16,15 @@ void InitialConditionImp::init(const int level) real InitialConditionImp::getXCoord(int i, int level) { - return (real)(para->getParH(level)->coordX_SP[i] - 1.0); + return para->getParH(level)->coordinateX[i] - 1.0; } real InitialConditionImp::getYCoord(int i, int level) { - return (real)(para->getParH(level)->coordY_SP[i] - 1.0); + return para->getParH(level)->coordinateY[i] - 1.0; } real InitialConditionImp::getZCoord(int i, int level) { - return (real)(para->getParH(level)->coordZ_SP[i] - 1.0); + return para->getParH(level)->coordinateZ[i] - 1.0; } \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp index ce939318899d34995db77a1cd818e07539a2c318..95e8331882282d86f25848e87df1327b77748085 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp @@ -6,6 +6,7 @@ #include "Utilities/Structs/SimulationDataStruct.h" #include "Utilities/Structs/TestStruct.h" #include "Utilities/Structs/TestSimulationDataStruct.h" +#include "Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.h" #include "Simulations/TaylorGreenVortexUx/AnalyticalResults/AnalyticalResultsTaylorGreenVortexUx.h" #include "Simulations/TaylorGreenVortexUx/InitialConditions/InitialConditionTaylorGreenVortexUx.h" @@ -58,6 +59,7 @@ #include <algorithm> + std::shared_ptr<NumericalTestFactoryImp> NumericalTestFactoryImp::getNewInstance(std::shared_ptr<ConfigDataStruct> configFileData) { return std::shared_ptr<NumericalTestFactoryImp>(new NumericalTestFactoryImp(configFileData)); @@ -94,9 +96,9 @@ void NumericalTestFactoryImp::init(std::shared_ptr<ConfigDataStruct> configFileD simID = 1; numberOfSimulations = configFileData->numberOfSimulations; - for (int i = 0; i < configFileData->kernelsToTest.size(); i++) { - for (int j = 0; j < configFileData->viscosity.size(); j++) { - for (int k = 0; k < configFileData->taylorGreenVortexUxParameter.size(); k++) { + for (size_t i = 0; i < configFileData->kernelsToTest.size(); i++) { + for (size_t j = 0; j < configFileData->viscosity.size(); j++) { + for (size_t k = 0; k < configFileData->taylorGreenVortexUxParameter.size(); k++) { std::shared_ptr<SimulationDataStruct> simDataStruct = makeTaylorGreenUxSimulationData(configFileData->kernelsToTest.at(i), configFileData->viscosity.at(j), configFileData->taylorGreenVortexUxParameter.at(k), configFileData->taylorGreenVortexUxGridInformation); if (simDataStruct->simGroupRun) { std::shared_ptr<NumericalTestStruct> numericalTestStruct = makeNumericalTestStruct(configFileData, simDataStruct, configFileData->kernelsToTest.at(i), configFileData->viscosity.at(j), configFileData->taylorGreenVortexUxParameter.at(k)->basicTimeStepLength); @@ -104,7 +106,7 @@ void NumericalTestFactoryImp::init(std::shared_ptr<ConfigDataStruct> configFileD } } - for (int k = 0; k < configFileData->taylorGreenVortexUzParameter.size(); k++) { + for (size_t k = 0; k < configFileData->taylorGreenVortexUzParameter.size(); k++) { std::shared_ptr<SimulationDataStruct> simDataStruct = makeTaylorGreenUzSimulationData(configFileData->kernelsToTest.at(i), configFileData->viscosity.at(j), configFileData->taylorGreenVortexUzParameter.at(k), configFileData->taylorGreenVortexUzGridInformation); if (simDataStruct->simGroupRun) { std::shared_ptr<NumericalTestStruct> numericalTestStruct = makeNumericalTestStruct(configFileData, simDataStruct, configFileData->kernelsToTest.at(i), configFileData->viscosity.at(j), configFileData->taylorGreenVortexUzParameter.at(k)->basicTimeStepLength); @@ -112,7 +114,7 @@ void NumericalTestFactoryImp::init(std::shared_ptr<ConfigDataStruct> configFileD } } - for (int k = 0; k < configFileData->shearWaveParameter.size(); k++) { + for (size_t k = 0; k < configFileData->shearWaveParameter.size(); k++) { std::shared_ptr<SimulationDataStruct> simDataStruct = makeShearWaveSimulationData(configFileData->kernelsToTest.at(i), configFileData->viscosity.at(j), configFileData->shearWaveParameter.at(k), configFileData->shearWaveGridInformation); if (simDataStruct->simGroupRun) { std::shared_ptr<NumericalTestStruct> numericalTestStruct = makeNumericalTestStruct(configFileData, simDataStruct, configFileData->kernelsToTest.at(i), configFileData->viscosity.at(j), configFileData->shearWaveParameter.at(k)->basicTimeStepLength); @@ -147,7 +149,7 @@ std::shared_ptr<NumericalTestStruct> NumericalTestFactoryImp::makeNumericalTestS initTestStruct(l2NormTestBetweenKernelStruct, numTestStruct, testLogFileInfo, basicTestLogFileInfo); std::vector<std::shared_ptr<SimulationInfo> > simInfo; - for (int i = 0; i < simDataStruct->testSimData.size(); i++) + for (size_t i = 0; i < simDataStruct->testSimData.size(); i++) simInfo.push_back(simDataStruct->testSimData.at(i)->simInformation); std::shared_ptr<LogFileWriter> logFileWriter = makeLogFileWriter(testLogFileInfo, simDataStruct->logFileInformation, simInfo, kernel, viscosity, basicTimeStepLength, configFileData->logFilePara, basicTestLogFileInfo); @@ -158,10 +160,10 @@ std::shared_ptr<NumericalTestStruct> NumericalTestFactoryImp::makeNumericalTestS void NumericalTestFactoryImp::addNumericalTestStruct(std::shared_ptr<NumericalTestStruct> numericalTestStruct) { - for (int i = 0; i < numericalTestStruct->testSimulations.size(); i++) + for (size_t i = 0; i < numericalTestStruct->testSimulations.size(); i++) myTestSimulations.push_back(numericalTestStruct->testSimulations.at(i)); - for (int i = 0; i < numericalTestStruct->tests.size(); i++) + for (size_t i = 0; i < numericalTestStruct->tests.size(); i++) myTestQueue->addTest(numericalTestStruct->tests.at(i)); myLogFileWriterQueue->addLogFileWriter(numericalTestStruct->logFileWriter); @@ -172,7 +174,7 @@ std::shared_ptr<SimulationDataStruct> NumericalTestFactoryImp::makeTaylorGreenUx std::shared_ptr<SimulationDataStruct> simDataStruct = std::shared_ptr<SimulationDataStruct>(new SimulationDataStruct); if (gridInfoStruct.size() > 0) { - for (int i = 0; i < gridInfoStruct.size(); i++) { + for (size_t i = 0; i < gridInfoStruct.size(); i++) { std::shared_ptr<TestSimulationDataStruct> aTestSimData = std::shared_ptr<TestSimulationDataStruct>(new TestSimulationDataStruct); aTestSimData->simParameter = SimulationParameterTaylorGreenUx::getNewInstance(kernel, viscosity, simParaStruct, gridInfoStruct.at(i)); aTestSimData->initialCondition = InitialConditionTaylorGreenUx::getNewInstance(simParaStruct, gridInfoStruct.at(i)); @@ -194,7 +196,7 @@ std::shared_ptr<SimulationDataStruct> NumericalTestFactoryImp::makeTaylorGreenUz { std::shared_ptr<SimulationDataStruct> simDataStruct = std::shared_ptr<SimulationDataStruct>(new SimulationDataStruct); if (gridInfoStruct.size() > 0) { - for (int i = 0; i < gridInfoStruct.size(); i++) { + for (size_t i = 0; i < gridInfoStruct.size(); i++) { std::shared_ptr<TestSimulationDataStruct> aTestSimData = std::shared_ptr<TestSimulationDataStruct>(new TestSimulationDataStruct); aTestSimData->simParameter = SimulationParameterTaylorGreenUz::getNewInstance(kernel, viscosity, simParaStruct, gridInfoStruct.at(i)); aTestSimData->initialCondition = InitialConditionTaylorGreenUz::getNewInstance(simParaStruct, gridInfoStruct.at(i)); @@ -216,7 +218,7 @@ std::shared_ptr<SimulationDataStruct> NumericalTestFactoryImp::makeShearWaveSimu { std::shared_ptr<SimulationDataStruct> simDataStruct = std::shared_ptr<SimulationDataStruct>(new SimulationDataStruct); if (gridInfoStruct.size() > 0) { - for (int i = 0; i < gridInfoStruct.size(); i++) { + for (size_t i = 0; i < gridInfoStruct.size(); i++) { std::shared_ptr<TestSimulationDataStruct> aTestSimData = std::shared_ptr<TestSimulationDataStruct>(new TestSimulationDataStruct); aTestSimData->simParameter = ShearWaveSimulationParameter::getNewInstance(kernel, viscosity, simParaStruct, gridInfoStruct.at(i)); aTestSimData->initialCondition = InitialConditionShearWave::getNewInstance(simParaStruct, gridInfoStruct.at(i)); @@ -236,17 +238,26 @@ std::shared_ptr<SimulationDataStruct> NumericalTestFactoryImp::makeShearWaveSimu std::vector<std::shared_ptr<TestSimulationImp> > NumericalTestFactoryImp::makeTestSimulations(std::vector<std::shared_ptr<TestSimulationDataStruct> > testSimDataStruct, std::shared_ptr<VectorWriterInformationStruct> vectorWriterInfo, unsigned int ySliceForCalculation) { - std::vector<std::shared_ptr<TestSimulationImp> > testSimumlations; - for (int i = 0; i < testSimDataStruct.size(); i++) { + std::vector<std::shared_ptr<TestSimulationImp> > testSimulations; + for (size_t i = 0; i < testSimDataStruct.size(); i++) { std::shared_ptr<TimeImp> time = TimeImp::getNewInstance(); testSimDataStruct.at(i)->simInformation->setTimeInfo(time); std::shared_ptr<SimulationResults> simResult = SimulationResults::getNewInstance(testSimDataStruct.at(i)->simParameter); std::shared_ptr<ToVectorWriter> toVectorWriter = Y2dSliceToResults::getNewInstance(vectorWriterInfo, testSimDataStruct.at(i)->simParameter->getTimeStepLength(), simResult, ySliceForCalculation); - testSimumlations.push_back(TestSimulationImp::getNewInsance(testSimDataStruct.at(i), simResult, time, toVectorWriter, anaResultWriter, colorOutput)); + + auto currentTestSimData = testSimDataStruct.at(i); + auto para = vf::gpu::tests::makeParameter(currentTestSimData->simParameter); + currentTestSimData->initialCondition->setParameter(para); + auto vfsim = vf::gpu::tests::makeVirtualFluidSimulation(para, currentTestSimData->initialCondition, toVectorWriter); + + auto testSim = std::make_shared<TestSimulationImp>(vfsim, currentTestSimData, simResult, time, toVectorWriter, anaResultWriter, colorOutput); + testSim->setParameter(para); + + testSimulations.push_back(testSim); } - return testSimumlations; + return testSimulations; } std::shared_ptr<TestStruct> NumericalTestFactoryImp::makePhiTestsStructs(std::shared_ptr<PhiTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp>> testSimumlations, double viscosity) @@ -257,13 +268,13 @@ std::shared_ptr<TestStruct> NumericalTestFactoryImp::makePhiTestsStructs(std::sh std::shared_ptr<PhiTestLogFileInformation> testLogFileInfo = PhiTestLogFileInformation::getNewInstance(testParameter); std::vector<std::shared_ptr<PhiTestPostProcessingStrategy> > postProcessingStrategies; - for (int i = 0; i < testSimumlations.size(); i++) + for (size_t i = 0; i < testSimumlations.size(); i++) postProcessingStrategies.push_back(PhiTestPostProcessingStrategy::getNewInstance(testSimumlations.at(i)->getSimulationResults(), testSimumlations.at(i)->getAnalyticalResults(), testParameter, testSimumlations.at(i)->getDataToCalcTests())); - for (int i = 0; i < testSimumlations.at(0)->getDataToCalcTests().size(); i++) { + for (size_t i = 0; i < testSimumlations.at(0)->getDataToCalcTests().size(); i++) { std::vector<std::shared_ptr<PhiTest> > phiTests = makePhiTests(testParameter, testSimumlations, postProcessingStrategies, viscosity, testSimumlations.at(0)->getDataToCalcTests().at(i)); testLogFileInfo->addTestGroup(phiTests); - for (int j = 0; j < phiTests.size(); j++) + for (size_t j = 0; j < phiTests.size(); j++) testStruct->tests.push_back(phiTests.at(j)); } testStruct->logFileInfo = testLogFileInfo; @@ -276,8 +287,8 @@ std::shared_ptr<TestStruct> NumericalTestFactoryImp::makePhiTestsStructs(std::sh std::vector<std::shared_ptr<PhiTest>> NumericalTestFactoryImp::makePhiTests(std::shared_ptr<PhiTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp>> testSim, std::vector<std::shared_ptr<PhiTestPostProcessingStrategy>> phiPostProStrategy, double viscosity, std::string dataToCalculate) { std::vector<std::shared_ptr<PhiTest> > phiTests; - for (int i = 1; i < testSim.size(); i++) { - for (int j = 0; j < i; j++) { + for (size_t i = 1; i < testSim.size(); i++) { + for (size_t j = 0; j < i; j++) { std::shared_ptr<PhiTest> test = PhiTest::getNewInstance(colorOutput, viscosity, testParameter, dataToCalculate); test->addSimulation(testSim.at(j), testSim.at(j)->getSimulationInfo(), phiPostProStrategy.at(j)); test->addSimulation(testSim.at(i), testSim.at(i)->getSimulationInfo(), phiPostProStrategy.at(i)); @@ -299,13 +310,13 @@ std::shared_ptr<TestStruct> NumericalTestFactoryImp::makeNyTestsStructs(std::sha std::shared_ptr<NyTestLogFileInformation> testLogFileInfo = NyTestLogFileInformation::getNewInstance(testParameter); std::vector<std::shared_ptr<NyTestPostProcessingStrategy> > postProcessingStrategies; - for (int i = 0; i < testSimumlations.size(); i++) + for (size_t i = 0; i < testSimumlations.size(); i++) postProcessingStrategies.push_back(NyTestPostProcessingStrategy::getNewInstance(testSimumlations.at(i)->getSimulationResults(), testSimumlations.at(i)->getAnalyticalResults(), testParameter, testSimumlations.at(i)->getDataToCalcTests())); - for (int i = 0; i < testSimumlations.at(0)->getDataToCalcTests().size(); i++) { + for (size_t i = 0; i < testSimumlations.at(0)->getDataToCalcTests().size(); i++) { std::vector<std::shared_ptr<NyTest> > nyTests = makeNyTests(testParameter, testSimumlations, postProcessingStrategies, viscosity, testSimumlations.at(0)->getDataToCalcTests().at(i)); testLogFileInfo->addTestGroup(nyTests); - for (int j = 0; j < nyTests.size(); j++) + for (size_t j = 0; j < nyTests.size(); j++) testStruct->tests.push_back(nyTests.at(j)); } testStruct->logFileInfo = testLogFileInfo; @@ -318,8 +329,8 @@ std::shared_ptr<TestStruct> NumericalTestFactoryImp::makeNyTestsStructs(std::sha std::vector<std::shared_ptr<NyTest>> NumericalTestFactoryImp::makeNyTests(std::shared_ptr<NyTestParameterStruct> testParameter, std::vector<std::shared_ptr<TestSimulationImp>> testSim, std::vector<std::shared_ptr<NyTestPostProcessingStrategy>> nuPostProStrategy, double viscosity, std::string dataToCalculate) { std::vector<std::shared_ptr<NyTest> > nyTests; - for (int i = 1; i < testSim.size(); i++) { - for (int j = 0; j < i; j++) { + for (size_t i = 1; i < testSim.size(); i++) { + for (size_t j = 0; j < i; j++) { std::shared_ptr<NyTest> test = NyTest::getNewInstance(colorOutput, viscosity, testParameter, dataToCalculate); test->addSimulation(testSim.at(j), testSim.at(j)->getSimulationInfo(), nuPostProStrategy.at(j)); test->addSimulation(testSim.at(i), testSim.at(i)->getSimulationInfo(), nuPostProStrategy.at(i)); @@ -339,13 +350,13 @@ std::shared_ptr<TestStruct> NumericalTestFactoryImp::makeL2NormTestsStructs(std: if (testParameter->basicTestParameter->runTest) { std::vector<std::shared_ptr<L2NormPostProcessingStrategy> > postProcessingStrategies; - for (int i = 0; i < testSimumlations.size(); i++) + for (size_t i = 0; i < testSimumlations.size(); i++) postProcessingStrategies.push_back(L2NormPostProcessingStrategy::getNewInstance(testSimumlations.at(i)->getSimulationResults(), testSimumlations.at(i)->getAnalyticalResults(), testParameter, l2NormCalculatorFactory, testSimumlations.at(i)->getDataToCalcTests())); std::vector<std::shared_ptr<L2NormTest> > tests = makeL2NormTests(testSimumlations, postProcessingStrategies, testParameter); std::shared_ptr<L2NormInformation> testLogFileInfo = L2NormInformation::getNewInstance(tests, testParameter, testSimumlations.at(0)->getDataToCalcTests()); - for(int i = 0; i < tests.size(); i++) + for(size_t i = 0; i < tests.size(); i++) testStruct->tests.push_back(tests.at(i)); testStruct->logFileInfo = testLogFileInfo; testStruct->testName = "L2NormTest"; @@ -356,9 +367,9 @@ std::shared_ptr<TestStruct> NumericalTestFactoryImp::makeL2NormTestsStructs(std: std::vector<std::shared_ptr<L2NormTest> > NumericalTestFactoryImp::makeL2NormTests(std::vector<std::shared_ptr<TestSimulationImp> > testSim, std::vector<std::shared_ptr<L2NormPostProcessingStrategy> > postProStrategy, std::shared_ptr<L2NormTestParameterStruct> testParameter) { std::vector<std::shared_ptr<L2NormTest> > l2Tests; - for (int k = 0; k < testParameter->normalizeData.size(); k++) { - for (int i = 0; i < testSim.size(); i++) { - for (int j = 0; j < testSim.at(i)->getDataToCalcTests().size(); j++) { + for (size_t k = 0; k < testParameter->normalizeData.size(); k++) { + for (size_t i = 0; i < testSim.size(); i++) { + for (size_t j = 0; j < testSim.at(i)->getDataToCalcTests().size(); j++) { std::shared_ptr<L2NormTest> test = L2NormTest::getNewInstance(colorOutput, testParameter, testSim.at(i)->getDataToCalcTests().at(j), testParameter->maxDiff.at(k), testParameter->normalizeData.at(k)); test->addSimulation(testSim.at(i), testSim.at(i)->getSimulationInfo(), postProStrategy.at(i)); testSim.at(i)->registerSimulationObserver(test); @@ -377,7 +388,7 @@ std::shared_ptr<TestStruct> NumericalTestFactoryImp::makeL2NormTestsBetweenKerne if (testPara->basicTestParameter->runTest) { std::vector<std::shared_ptr<L2NormBetweenKernelPostProcessingStrategy> > postProcessingStrategies; - for (int i = 0; i < testSim.size(); i++) + for (size_t i = 0; i < testSim.size(); i++) postProcessingStrategies.push_back(L2NormBetweenKernelPostProcessingStrategy::getNewInstance(testSim.at(i)->getSimulationResults(), testSim.at(i)->getAnalyticalResults(), testPara, l2NormCalculatorFactory, testSim.at(i)->getDataToCalcTests())); if (kernelName == testPara->basicKernel) { @@ -387,14 +398,14 @@ std::shared_ptr<TestStruct> NumericalTestFactoryImp::makeL2NormTestsBetweenKerne l2NormTestsBetweenKernels = tests; } else { - for (int i = 0; i < tests.size(); i++) - for (int j = 0; j < tests.at(i).size(); j++) + for (size_t i = 0; i < tests.size(); i++) + for (size_t j = 0; j < tests.at(i).size(); j++) l2NormTestsBetweenKernels.at(i).push_back(tests.at(i).at(j)); } }else{ std::vector<std::shared_ptr<L2NormTestBetweenKernels> > tests = linkL2NormTestsBetweenKernels(testPara, testSim, postProcessingStrategies); - for (int i = 0; i < tests.size(); i++) + for (size_t i = 0; i < tests.size(); i++) testStruct->tests.push_back(tests.at(i)); testStruct->logFileInfo = L2NormBetweenKernelsInformation::getNewInstance(tests, testPara, testSim.at(0)->getDataToCalcTests()); } @@ -408,11 +419,11 @@ std::vector<std::vector<std::shared_ptr<L2NormTestBetweenKernels> > > Numerical std::vector<std::shared_ptr<L2NormTestBetweenKernels> > testForOneKernel; - for (int l = 0; l < testPara->kernelsToTest.size() - 1; l++) { - for (int k = 0; k < testSim.size(); k++) { - for(int j = 0; j < testSim.at(k)->getDataToCalcTests().size(); j++){ - for (int m = 0; m < testPara->normalizeData.size(); m++) { - for (int i = 0; i < testPara->timeSteps.size(); i++) { + for (size_t l = 0; l < testPara->kernelsToTest.size() - 1; l++) { + for (size_t k = 0; k < testSim.size(); k++) { + for(size_t j = 0; j < testSim.at(k)->getDataToCalcTests().size(); j++){ + for (size_t m = 0; m < testPara->normalizeData.size(); m++) { + for (size_t i = 0; i < testPara->timeSteps.size(); i++) { std::shared_ptr<L2NormTestBetweenKernels> aTest = L2NormTestBetweenKernels::getNewInstance(colorOutput, testSim.at(k)->getDataToCalcTests().at(j), testPara->timeSteps.at(i), testPara->normalizeData.at(m), l2NormCalculatorFactory); aTest->setBasicSimulation(testSim.at(k), testSim.at(k)->getSimulationInfo(), postProcessingStrategies.at(k)); testSim.at(k)->registerSimulationObserver(aTest); @@ -436,10 +447,10 @@ std::vector<std::shared_ptr<L2NormTestBetweenKernels> > NumericalTestFactoryImp: if (l2NormTestsBetweenKernels.at(0).size() == 0) l2NormTestsBetweenKernels.erase(l2NormTestsBetweenKernels.begin()); - for (int k = 0; k < testSim.size(); k++) { - for (int j = 0; j < testSim.at(k)->getDataToCalcTests().size(); j++) { - for (int m = 0; m < testPara->normalizeData.size(); m++) { - for (int i = 0; i < testPara->timeSteps.size(); i++) { + for (size_t k = 0; k < testSim.size(); k++) { + for (size_t j = 0; j < testSim.at(k)->getDataToCalcTests().size(); j++) { + for (size_t m = 0; m < testPara->normalizeData.size(); m++) { + for (size_t i = 0; i < testPara->timeSteps.size(); i++) { std::shared_ptr<L2NormTestBetweenKernels> aTest = l2NormTestsBetweenKernels.at(0).at(0); l2NormTestsBetweenKernels.at(0).erase(l2NormTestsBetweenKernels.at(0).begin()); aTest->setDivergentKernelSimulation(testSim.at(k), testSim.at(k)->getSimulationInfo(), postProcessingStrategies.at(k)); @@ -454,7 +465,7 @@ std::vector<std::shared_ptr<L2NormTestBetweenKernels> > NumericalTestFactoryImp: void NumericalTestFactoryImp::initTestStruct(std::shared_ptr<TestStruct> testStruct, std::shared_ptr<NumericalTestStruct> numericalTestStruct, std::vector<std::shared_ptr<TestLogFileInformation> > &testLogFileInfo, std::shared_ptr<BasicTestLogFileInformation> basicTestLogFileInfo) { - for (int i = 0; i < testStruct->tests.size(); i++) + for (size_t i = 0; i < testStruct->tests.size(); i++) numericalTestStruct->tests.push_back(testStruct->tests.at(i)); if (testStruct->tests.size() > 0) { testLogFileInfo.push_back(testStruct->logFileInfo); diff --git a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.cpp b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.cpp index c7d9fa5b84ab077d60eab3213097c2da1d5b4dad..97ccf92dc72e253d5f38f88353ba564320e8fd65 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.cpp @@ -17,11 +17,11 @@ void NumericalTestGridReader::setInitalNodeValues(const int numberOfNodes, const { initialCondition->init(level); for (int j = 0; j <= numberOfNodes; j++){ - para->getParH(level)->vx_SP[j] = initialCondition->getInitVX(j, level); - para->getParH(level)->vy_SP[j] = initialCondition->getInitVY(j, level); - para->getParH(level)->vz_SP[j] = initialCondition->getInitVZ(j, level); - para->getParH(level)->rho_SP[j] = initialCondition->getInitROH(j, level); - para->getParH(level)->press_SP[j] = initialCondition->getInitPRESS(j, level); + para->getParH(level)->velocityX[j] = initialCondition->getInitVX(j, level); + para->getParH(level)->velocityY[j] = initialCondition->getInitVY(j, level); + para->getParH(level)->velocityZ[j] = initialCondition->getInitVZ(j, level); + para->getParH(level)->rho[j] = initialCondition->getInitROH(j, level); + para->getParH(level)->pressure[j] = initialCondition->getInitPRESS(j, level); } } diff --git a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h index c2bd79ef8f6a1a23e10ec4e3c58c9b31329ec89a..b3835c11bf101c3a0e10beddba0095d0f1f0bef3 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h +++ b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h @@ -10,6 +10,7 @@ enum SimulationStatus { initialized , executed, crashed}; class NumericalTestSimulation { public: + virtual void run() = 0; virtual SimulationStatus getSimulationStatus() = 0; virtual void registerSimulationObserver(std::shared_ptr<SimulationObserver> simObserver) = 0; }; diff --git a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestSuite/NumericalTestSuite.h b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestSuite/NumericalTestSuite.h deleted file mode 100644 index 86e576a6f8f5d460d70869f46b71ec02e49972e5..0000000000000000000000000000000000000000 --- a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestSuite/NumericalTestSuite.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef NUMERICAL_TEST_SUITE_H -#define NUMERICAL_TEST_SUITE_H - -class NumericalTestSuite -{ -public: - virtual void makeSimulationHeadOutput() = 0; - virtual void startPostProcessing() = 0; -}; -#endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.cpp index b454f1db95913562963561ef60d834ec0a9c1535..ef7f37dd9b6c5bee8878d4b7c4df076a5ff6b04d 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.cpp @@ -1,140 +1,129 @@ #include "ResultsImp.h" +#include <cmath> #include <iostream> +void logInvalidSimulationData(const std::string &quantity) +{ + std::cout << "done." << std::endl; + std::cout << "Invalid quantity: " << quantity << std::endl; + std::cout << "Simulation Result Data contains failure data." << std::endl; + std::cout << "Testing not possible." << std::endl; +} + +bool isValid(const double quantity, const std::string &quantityName) +{ + if (std::isnan(quantity)) { + logInvalidSimulationData(quantityName); + return false; + } + return true; +} + int ResultsImp::getNumberOfTimeSteps() { - return numberOfTimeSteps; + return numberOfTimeSteps; } -std::vector<std::vector<double> > ResultsImp::getVx() +std::vector<std::vector<double>> ResultsImp::getVx() { - return vx; + return vx; } -std::vector<std::vector<double> > ResultsImp::getVy() +std::vector<std::vector<double>> ResultsImp::getVy() { - return vy; + return vy; } -std::vector<std::vector<double> > ResultsImp::getVz() +std::vector<std::vector<double>> ResultsImp::getVz() { - return vz; + return vz; } int ResultsImp::getNumberOfXNodes() { - return xNodes; + return xNodes; } int ResultsImp::getNumberOfYNodes() { - return yNodes; + return yNodes; } int ResultsImp::getNumberOfZNodes() { - return zNodes; + return zNodes; } -std::vector<std::vector<double> > ResultsImp::getXNodes() +std::vector<std::vector<double>> ResultsImp::getXNodes() { - return x; + return x; } -std::vector<std::vector<double> > ResultsImp::getYNodes() +std::vector<std::vector<double>> ResultsImp::getYNodes() { - return y; + return y; } -std::vector<std::vector<double> > ResultsImp::getZNodes() +std::vector<std::vector<double>> ResultsImp::getZNodes() { - return z; + return z; } int ResultsImp::getTimeStepLength() { - return timeStepLength; + return timeStepLength; } std::vector<unsigned int> ResultsImp::getTimeSteps() { - return timeStep; + return timeStep; } std::vector<int> ResultsImp::getTime() { - return time; + return time; } -std::vector<std::vector<unsigned int> > ResultsImp::getLevels() +std::vector<std::vector<unsigned int>> ResultsImp::getLevels() { - return level; + return level; } -std::vector<std::vector<double> > ResultsImp::getPress() +std::vector<std::vector<double>> ResultsImp::getPress() { - return press; + return press; } -std::vector<std::vector<double> > ResultsImp::getRho() +std::vector<std::vector<double>> ResultsImp::getRho() { - return rho; + return rho; } int ResultsImp::getL0() { - return l0; + return l0; } bool ResultsImp::checkYourData() { - std::cout << "checking Simulation Results Data..."; - for (int i = 0; i < vx.size(); i++) { - for (int j = 0; j < vx.at(i).size(); j++) { - if (vx.at(i).at(j) != vx.at(i).at(j)) { - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains failure data." << std::endl; - std::cout << "Testing not possible." << std::endl; - return false; - } - if (vy.at(i).at(j) != vy.at(i).at(j)) { - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains failure data." << std::endl; - std::cout << "Testing not possible." << std::endl; - return false; - } - if (vz.at(i).at(j) != vz.at(i).at(j)) { - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains failure data." << std::endl; - std::cout << "Testing not possible." << std::endl; - return false; - } - if (rho.at(i).at(j) != rho.at(i).at(j)) { - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains failure data." << std::endl; - std::cout << "Testing not possible." << std::endl; - return false; - } - if (press.at(i).at(j) != press.at(i).at(j)) { - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains failure data." << std::endl; - std::cout << "Testing not possible." << std::endl; - return false; - } - } - } - std::cout << "done." << std::endl; - std::cout << "Simulation Result Data contains no failure data." << std::endl; - return true; -} + std::cout << "checking Simulation Results Data..."; + for (int i = 0; i < vx.size(); i++) { + for (int j = 0; j < vx.at(i).size(); j++) { + bool valid = isValid(vx.at(i).at(j), "Vx") && isValid(vy.at(i).at(j), "Vy") && + isValid(vz.at(i).at(j), "Vz") && isValid(rho.at(i).at(j), "Rho") && + isValid(press.at(i).at(j), "Pressure"); -ResultsImp::ResultsImp(int l0) -{ - this->l0 = l0; + if (!valid) + return false; + } + } + std::cout << "done." << std::endl; + std::cout << "Simulation Result Data contains no failure data." << std::endl; + return true; } -ResultsImp::ResultsImp() +ResultsImp::ResultsImp(int l0) { - + this->l0 = l0; } diff --git a/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.h b/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.h index a9129dc88e461c29d330cadad0f43a5017c1c110..4e4cc80c9e3fefc86b174859bdc813b6dba22c99 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Results/ResultsImp.h @@ -28,7 +28,7 @@ public: protected: ResultsImp(int l0); - ResultsImp(); + ResultsImp() = default; unsigned int numberOfTimeSteps; unsigned int timeStepLength; @@ -46,6 +46,5 @@ protected: int l0; private: - }; #endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h b/apps/gpu/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h index 80bcadd3e2655233309a7e4001409dd9e83c60d7..86d5c89b1747639bdc983627509d456601e836f3 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Results/SimulationResults/SimulationResults.h @@ -9,11 +9,12 @@ class SimulationParameter; class SimulationResults : public ResultsImp { public: - static std::shared_ptr<SimulationResults> getNewInstance(std::shared_ptr<SimulationParameter> simPara); - void addTimeStep(unsigned int timeStep, unsigned int time, std::vector<unsigned int> level, std::vector<double> x, std::vector<double> y, std::vector<double> z, std::vector<double> vx, std::vector<double> vy, std::vector<double> vz, std::vector<double> press, std::vector<double> rho); + static std::shared_ptr<SimulationResults> getNewInstance(std::shared_ptr<SimulationParameter> simPara); + void addTimeStep(unsigned int timeStep, unsigned int time, std::vector<unsigned int> level, std::vector<double> x, + std::vector<double> y, std::vector<double> z, std::vector<double> vx, std::vector<double> vy, + std::vector<double> vz, std::vector<double> press, std::vector<double> rho); private: - SimulationResults(std::shared_ptr<SimulationParameter> simPara); - + SimulationResults(std::shared_ptr<SimulationParameter> simPara); }; #endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h b/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h index af180adb96e8d8f31ea746bb8ea55d16d170622c..c5809671330d2ac5a32f13f3db0d6d3690f06b6f 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h @@ -10,6 +10,7 @@ class Test : public SimulationObserver { public: + virtual void run() = 0; virtual void update() = 0; virtual TestStatus getTestStatus() = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.cpp index 1da57e18bf418901163ee3c636b4274bbf74f4cc..f893d1f174b949d371e193d23e7c137e79460008 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.cpp @@ -1,94 +1,108 @@ #include "TestImp.h" +#include <algorithm> #include "Utilities/ColorConsoleOutput/ColorConsoleOutput.h" -#include "Utilities/PostProcessingStrategy/PostProcessingStrategy.h" #include "Utilities/NumericalTestSimulation/NumericalTestSimulation.h" +#include "Utilities/PostProcessingStrategy/PostProcessingStrategy.h" +#include "Utilities/SimulationInfo/SimulationInfo.h" + +void TestImp::run() +{ + for (size_t i = 0; i < simulations.size(); i++) { + auto sim = simulations.at(i); + auto simInfo = simInfos.at(i); + + // NOTE: Simulations can be in this vector multiple times + // Therefore, we skip the simulation if it has been run already + if (simulationRun.at(i)) + continue; + sim->run(); + } +} void TestImp::update() { - for (int i = 0; i < simulations.size(); i++){ - if (simulationRun.at(i) == false){ - switch (simulations.at(i)->getSimulationStatus()) - { - case executed: - simulationRun.at(i) = true; - postProStrategies.at(i)->evaluate(); - break; - case crashed: - simulationRun.at(i) = true; - testStatus = simulationCrashed; - break; - case initialized: - simulationRun.at(i) = false; - break; - default: - break; - } - } - } - if (CheckAllSimulationRun()) { - if (testStatus != simulationCrashed) - evaluate(); - else - makeConsoleOutput(); - } - + for (size_t i = 0; i < simulations.size(); i++) { + if (simulationRun.at(i) == false) { + switch (simulations.at(i)->getSimulationStatus()) { + case executed: + simulationRun.at(i) = true; + postProStrategies.at(i)->evaluate(); + break; + case crashed: + simulationRun.at(i) = true; + testStatus = simulationCrashed; + break; + case initialized: + simulationRun.at(i) = false; + break; + default: + break; + } + } + } + if (CheckAllSimulationRun()) { + if (testStatus != simulationCrashed) + evaluate(); + else + makeConsoleOutput(); + } } -void TestImp::addSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr<PostProcessingStrategy> postProStrategy) +void TestImp::addSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, + std::shared_ptr<PostProcessingStrategy> postProStrategy) { - simulations.push_back(sim); - simInfos.push_back(simInfo); - postProStrategies.push_back(postProStrategy); - simulationRun.push_back(false); + simulations.push_back(sim); + simInfos.push_back(simInfo); + postProStrategies.push_back(postProStrategy); + simulationRun.push_back(false); } TestStatus TestImp::getTestStatus() { - return testStatus; + return testStatus; } void TestImp::makeConsoleOutput() { - switch (testStatus) - { - case passed: colorOutput->makeTestOutput(buildTestOutput(), testStatus); - break; - case failed: colorOutput->makeTestOutput(buildTestOutput(), testStatus); - break; - case test_error: colorOutput->makeTestOutput(buildErrorTestOutput(), testStatus); - break; - case simulationCrashed: colorOutput->makeTestOutput(buildSimulationFailedTestOutput(), testStatus); - break; - default: - break; - } + switch (testStatus) { + case passed: + colorOutput->makeTestOutput(buildTestOutput(), testStatus); + break; + case failed: + colorOutput->makeTestOutput(buildTestOutput(), testStatus); + break; + case test_error: + colorOutput->makeTestOutput(buildErrorTestOutput(), testStatus); + break; + case simulationCrashed: + colorOutput->makeTestOutput(buildSimulationFailedTestOutput(), testStatus); + break; + default: + break; + } } TestImp::TestImp(std::shared_ptr<ColorConsoleOutput> colorOutput) : colorOutput(colorOutput) { - simulationRun.resize(0); - simulations.resize(0); - simInfos.resize(0); + simulationRun.resize(0); + simulations.resize(0); + simInfos.resize(0); } bool TestImp::CheckAllSimulationRun() { - for(int i=0; i< simulationRun.size(); i++) - if(simulationRun.at(i)==false) - return false; - - return true; + return std::all_of(simulationRun.begin(), simulationRun.end(), [](bool run) { return run; }); } std::vector<std::string> TestImp::buildSimulationFailedTestOutput() { - std::vector<std::string> output = buildBasicTestOutput(); - std::ostringstream oss; + std::vector<std::string> output = buildBasicTestOutput(); + std::ostringstream oss; - oss << "Simulation crashed!"; - output.push_back(oss.str()); - oss.str(std::string()); + oss << "Simulation crashed!"; + output.push_back(oss.str()); + oss.str(std::string()); - return output; + return output; } diff --git a/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.h b/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.h index 9e18ef3116d155520b1c02d6d7616c926c32c315..f4fc758ec75f3c0e12b79faf2efb74a2e749e00e 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.h @@ -15,6 +15,7 @@ class PostProcessingStrategy; class TestImp : public Test { public: + void run() override; void update(); TestStatus getTestStatus(); virtual void makeConsoleOutput(); diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueue.h b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueue.h index bb1bf9579504b888f6f8d5297d9096b742c70a1c..dcc0ece599e45539fd1416b3cd06bb67576a915a 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueue.h +++ b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueue.h @@ -1,10 +1,13 @@ #ifndef TEST_QUEUE_H #define TEST_QUEUE_H +enum TestSuiteResult { PASSED, FAILED }; + class TestQueue { public: - virtual void makeFinalOutput() = 0; + virtual TestSuiteResult run() = 0; + virtual void makeFinalOutput() = 0; virtual int getNumberOfFailedTests() const noexcept = 0; }; #endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.cpp index 5434c335c14ab6ed4f5a647089912417618db199..c7ceef408bcc7d098810aa0f8fd82498902ee211 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.cpp @@ -1,63 +1,77 @@ #include "TestQueueImp.h" +#include <algorithm> #include "Utilities/ColorConsoleOutput/ColorConsoleOutput.h" #include "Utilities/Test/Test.h" +TestSuiteResult TestQueueImp::run() +{ + for (const auto test : tests) + test->run(); + + makeFinalOutput(); + + return TestSuiteResult(std::clamp(numberOfFailedTest, 0, 1)); +} + void TestQueueImp::makeFinalOutput() { - calcTestNumbers(); - colorOutput->makeFinalTestOutputHead(numberOfTests, numberOfExecutedTest, numberOfPassedTest, numberOfFailedTest, numberOfErrorTest, numberOfNotExecutedTest); - for (int i = 0; i < tests.size(); i++) - tests.at(i)->makeConsoleOutput(); - colorOutput->makeFinalTestOutputFoot(numberOfTests, numberOfExecutedTest, numberOfPassedTest, numberOfFailedTest, numberOfErrorTest, numberOfNotExecutedTest); + calcTestNumbers(); + colorOutput->makeFinalTestOutputHead(numberOfTests, numberOfExecutedTest, numberOfPassedTest, numberOfFailedTest, + numberOfErrorTest, numberOfNotExecutedTest); + for (int i = 0; i < tests.size(); i++) + tests.at(i)->makeConsoleOutput(); + colorOutput->makeFinalTestOutputFoot(numberOfTests, numberOfExecutedTest, numberOfPassedTest, numberOfFailedTest, + numberOfErrorTest, numberOfNotExecutedTest); } -int TestQueueImp::getNumberOfFailedTests() const noexcept { return numberOfFailedTest; } +int TestQueueImp::getNumberOfFailedTests() const noexcept +{ + return numberOfFailedTest; +} std::shared_ptr<TestQueueImp> TestQueueImp::getNewInstance(std::shared_ptr<ColorConsoleOutput> colorOutput) { - return std::shared_ptr<TestQueueImp>(new TestQueueImp(colorOutput)); + return std::shared_ptr<TestQueueImp>(new TestQueueImp(colorOutput)); } void TestQueueImp::addTest(std::shared_ptr<Test> test) { - tests.push_back(test); + tests.push_back(test); } TestQueueImp::TestQueueImp(std::shared_ptr<ColorConsoleOutput> colorOutput) : colorOutput(colorOutput) { - tests.resize(0); + tests.resize(0); } void TestQueueImp::calcTestNumbers() { - numberOfTests = tests.size(); - numberOfExecutedTest = 0; - numberOfPassedTest = 0; - numberOfFailedTest = 0; - numberOfErrorTest = 0; - numberOfNotExecutedTest = 0; - - for (int i = 0; i < tests.size(); i++) { - switch (tests.at(i)->getTestStatus()) - { - case passed: - numberOfPassedTest++; - numberOfExecutedTest++; - break; - case failed: - numberOfFailedTest++; - numberOfExecutedTest++; - break; - case test_error: - numberOfErrorTest++; - break; - case simulationCrashed: - numberOfNotExecutedTest++; - break; - default: - break; - } - } - + numberOfTests = tests.size(); + numberOfExecutedTest = 0; + numberOfPassedTest = 0; + numberOfFailedTest = 0; + numberOfErrorTest = 0; + numberOfNotExecutedTest = 0; + + for (int i = 0; i < tests.size(); i++) { + switch (tests.at(i)->getTestStatus()) { + case passed: + numberOfPassedTest++; + numberOfExecutedTest++; + break; + case failed: + numberOfFailedTest++; + numberOfExecutedTest++; + break; + case test_error: + numberOfErrorTest++; + break; + case simulationCrashed: + numberOfNotExecutedTest++; + break; + default: + break; + } + } } diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.h b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.h index 27505efc7b3a58bb155f40813d87a7aab78157bc..89952773f810a983d34f9e35e9508e9d0d7e3ce3 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.h @@ -12,6 +12,7 @@ class ColorConsoleOutput; class TestQueueImp : public TestQueue { public: + TestSuiteResult run() override; void makeFinalOutput(); int getNumberOfFailedTests() const noexcept override; diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h index 80f72ec3dfa82fdc9871e9db32532f204ddd12db..729ca06a3a57bfc1202d4f93728a68b18a57f8db 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h +++ b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h @@ -1,8 +1,6 @@ #ifndef TEST_SIMULATION_H #define TEST_SIMULATION_H -#include "Utilities/NumericalTestSuite/NumericalTestSuite.h" - #include <memory> #include <string> @@ -14,13 +12,15 @@ class SimulationObserver; class TimeTracking; class Parameter; -class TestSimulation : public NumericalTestSuite +class TestSimulation { public: - virtual std::shared_ptr<SimulationParameter> getSimulationParameter() = 0; - virtual std::shared_ptr<DataWriter> getDataWriter() = 0; - virtual std::shared_ptr<InitialCondition> getInitialCondition() = 0; - virtual std::shared_ptr<TimeTracking> getTimeTracking() = 0; - virtual void setParameter(std::shared_ptr<Parameter> para) = 0; + virtual void run() = 0; + virtual void makeSimulationHeadOutput() = 0; + virtual void startPostProcessing() = 0; + + virtual std::shared_ptr<SimulationParameter> getSimulationParameter() = 0; + virtual std::shared_ptr<TimeTracking> getTimeTracking() = 0; + virtual void setParameter(std::shared_ptr<Parameter> para) = 0; }; #endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp index d07a40efa19511437392359546f4c51b692d2cd5..dc4aca9b35b0bea92b3d8e3e5b07cb8ed3e054d5 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp @@ -1,136 +1,139 @@ +#include <functional> + #include "TestSimulationImp.h" -#include "Utilities/DataWriter/ToVectorWriter.h" -#include "Utilities/SimulationInfo/SimulationInfo.h" -#include "Utilities/Results/AnalyticalResults/AnalyticalResult.h" -#include "Utilities/Test/SimulationObserver.h" #include "Utilities/ColorConsoleOutput/ColorConsoleOutput.h" -#include "Utilities/KernelConfiguration/KernelConfiguration.h" #include "Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriter.h" +#include "Utilities/DataWriter/ToVectorWriter.h" +#include "Utilities/InitialCondition/InitialCondition.h" +#include "Utilities/KernelConfiguration/KernelConfiguration.h" +#include "Utilities/Results/AnalyticalResults/AnalyticalResult.h" +#include "Utilities/Results/SimulationResults/SimulationResults.h" +#include "Utilities/SimulationInfo/SimulationInfo.h" #include "Utilities/Structs/TestSimulationDataStruct.h" +#include "Utilities/Test/SimulationObserver.h" #include "Utilities/Time/TimeTracking.h" -#include "Utilities/Results/SimulationResults/SimulationResults.h" - -std::shared_ptr<TestSimulationImp> TestSimulationImp::getNewInsance(std::shared_ptr<TestSimulationDataStruct> testSimData, std::shared_ptr<SimulationResults> simResult, std::shared_ptr<TimeTracking> timeTracking, std::shared_ptr<ToVectorWriter> toVectorWriter, std::shared_ptr<AnalyticalResults2DToVTKWriter> anaResultWriter, std::shared_ptr<ColorConsoleOutput> colorOutput) +TestSimulationImp::TestSimulationImp(std::function<void()> runSimulation, + std::shared_ptr<TestSimulationDataStruct> testSimData, + std::shared_ptr<SimulationResults> simResult, + std::shared_ptr<TimeTracking> timeTracking, + std::shared_ptr<ToVectorWriter> toVectorWriter, + std::shared_ptr<AnalyticalResults2DToVTKWriter> anaResultWriter, + std::shared_ptr<ColorConsoleOutput> colorOutput) { - return std::shared_ptr<TestSimulationImp>(new TestSimulationImp(testSimData, simResult, timeTracking, toVectorWriter, anaResultWriter, colorOutput)); -} + this->simPara = testSimData->simParameter; + this->simInfo = testSimData->simInformation; + this->analyticalResult = testSimData->analyticalResult; + this->initialCondition = testSimData->initialCondition; -TestSimulationImp::TestSimulationImp(std::shared_ptr<TestSimulationDataStruct> testSimData, std::shared_ptr<SimulationResults> simResult, std::shared_ptr<TimeTracking> timeTracking, std::shared_ptr<ToVectorWriter> toVectorWriter, std::shared_ptr<AnalyticalResults2DToVTKWriter> anaResultWriter, std::shared_ptr<ColorConsoleOutput> colorOutput) -{ - this->simPara = testSimData->simParameter; - this->simInfo = testSimData->simInformation; - this->analyticalResult = testSimData->analyticalResult; - this->initialCondition = testSimData->initialCondition; + this->timeTracking = timeTracking; - this->timeTracking = timeTracking; + this->simResult = simResult; + this->toVectorWriter = toVectorWriter; - this->simResult = simResult; - this->toVectorWriter = toVectorWriter; + this->anaResultWriter = anaResultWriter; + this->colorOutput = colorOutput; - this->anaResultWriter = anaResultWriter; - this->colorOutput = colorOutput; - - this->simObserver.resize(0); - this->dataToCalcTests = simInfo->getDataToCalcTests(); - this->status = initialized; + this->simObserver.resize(0); + this->dataToCalcTests = simInfo->getDataToCalcTests(); + this->status = initialized; + this->runSimulation = runSimulation; } -std::shared_ptr<SimulationParameter> TestSimulationImp::getSimulationParameter() +void TestSimulationImp::run() { - return simPara; + makeSimulationHeadOutput(); + timeTracking->setSimulationStartTime(); + runSimulation(); + timeTracking->setSimulationEndTime(); + startPostProcessing(); } -std::shared_ptr<AnalyticalResults> TestSimulationImp::getAnalyticalResults() -{ - return analyticalResult; -} - -std::shared_ptr<DataWriter> TestSimulationImp::getDataWriter() +std::shared_ptr<SimulationParameter> TestSimulationImp::getSimulationParameter() { - return toVectorWriter; + return simPara; } -std::shared_ptr<InitialCondition> TestSimulationImp::getInitialCondition() +std::shared_ptr<AnalyticalResults> TestSimulationImp::getAnalyticalResults() { - return initialCondition; + return analyticalResult; } std::shared_ptr<SimulationInfo> TestSimulationImp::getSimulationInfo() { - return simInfo; + return simInfo; } std::shared_ptr<TimeTracking> TestSimulationImp::getTimeTracking() { - return timeTracking; + return timeTracking; } SimulationStatus TestSimulationImp::getSimulationStatus() { - return status; + return status; } void TestSimulationImp::registerSimulationObserver(std::shared_ptr<SimulationObserver> simObserver) { - this->simObserver.push_back(simObserver); + this->simObserver.push_back(simObserver); } std::vector<std::string> TestSimulationImp::getDataToCalcTests() { - return dataToCalcTests; + return dataToCalcTests; } void TestSimulationImp::notifyObserver() { - for (int i = 0; i < simObserver.size(); i++) - simObserver.at(i)->update(); + for (int i = 0; i < simObserver.size(); i++) + simObserver.at(i)->update(); } void TestSimulationImp::writeAnalyticalResultsToVTK() { - if (!analyticalResult->isCalculated()) - analyticalResult->calc(simResult); + if (!analyticalResult->isCalculated()) + analyticalResult->calc(simResult); - anaResultWriter->writeAnalyticalResult(para, analyticalResult); + anaResultWriter->writeAnalyticalResult(para, analyticalResult); } void TestSimulationImp::checkSimulationResults() { - bool dataOkay = simResult->checkYourData(); - if (!dataOkay) - status = crashed; + bool dataOkay = simResult->checkYourData(); + if (!dataOkay) + status = crashed; } void TestSimulationImp::makeSimulationHeadOutput() { - colorOutput->makeSimulationHeadOutput(simInfo); + colorOutput->makeSimulationHeadOutput(simInfo); } void TestSimulationImp::startPostProcessing() { - status = executed; + status = executed; - timeTracking->setResultCheckStartTime(); - checkSimulationResults(); - timeTracking->setResultCheckEndTime(); + timeTracking->setResultCheckStartTime(); + checkSimulationResults(); + timeTracking->setResultCheckEndTime(); - timeTracking->setTestStartTime(); - notifyObserver(); - timeTracking->setTestEndTime(); + timeTracking->setTestStartTime(); + notifyObserver(); + timeTracking->setTestEndTime(); - timeTracking->setAnalyticalResultWriteStartTime(); - writeAnalyticalResultsToVTK(); - timeTracking->setAnalyticalResultWriteEndTime(); + timeTracking->setAnalyticalResultWriteStartTime(); + writeAnalyticalResultsToVTK(); + timeTracking->setAnalyticalResultWriteEndTime(); } void TestSimulationImp::setParameter(std::shared_ptr<Parameter> para) { - this->para = para; + this->para = para; } std::shared_ptr<SimulationResults> TestSimulationImp::getSimulationResults() { - return simResult; + return simResult; } \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h index 3117d6c61e619b8d51f625920837dc31656829d8..b876cb079f241226bbb3455f7b4bc97b80039131 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h @@ -4,8 +4,9 @@ #include "TestSimulation.h" #include "Utilities/NumericalTestSimulation/NumericalTestSimulation.h" -#include <vector> +#include <functional> #include <time.h> +#include <vector> class ToVectorWriter; class ColorConsoleOutput; @@ -20,48 +21,52 @@ struct TestSimulationDataStruct; class TestSimulationImp : public TestSimulation, public NumericalTestSimulation { public: - static std::shared_ptr<TestSimulationImp> getNewInsance(std::shared_ptr<TestSimulationDataStruct> testSimData, std::shared_ptr<SimulationResults> simResult, std::shared_ptr<TimeTracking> timeTracking, std::shared_ptr<ToVectorWriter> toVectorWriter, std::shared_ptr<AnalyticalResults2DToVTKWriter> anaResultWriter, std::shared_ptr<ColorConsoleOutput> colorOutput); + TestSimulationImp(std::function<void()> runSimulation, std::shared_ptr<TestSimulationDataStruct> testSimData, + std::shared_ptr<SimulationResults> simResult, std::shared_ptr<TimeTracking> timeTracking, + std::shared_ptr<ToVectorWriter> toVectorWriter, + std::shared_ptr<AnalyticalResults2DToVTKWriter> anaResultWriter, + std::shared_ptr<ColorConsoleOutput> colorOutput); + void run() override; + + std::shared_ptr<SimulationParameter> getSimulationParameter(); + std::shared_ptr<SimulationInfo> getSimulationInfo(); + std::shared_ptr<TimeTracking> getTimeTracking(); - std::shared_ptr<SimulationParameter> getSimulationParameter(); - std::shared_ptr<DataWriter> getDataWriter(); - std::shared_ptr<InitialCondition> getInitialCondition(); - std::shared_ptr<SimulationInfo> getSimulationInfo(); - std::shared_ptr<TimeTracking> getTimeTracking(); + SimulationStatus getSimulationStatus(); - SimulationStatus getSimulationStatus(); - - void makeSimulationHeadOutput(); - void startPostProcessing(); + void makeSimulationHeadOutput(); + void startPostProcessing(); - void setParameter(std::shared_ptr<Parameter> para); + void setParameter(std::shared_ptr<Parameter> para); - std::shared_ptr<SimulationResults> getSimulationResults(); - std::shared_ptr<AnalyticalResults> getAnalyticalResults(); - void registerSimulationObserver(std::shared_ptr<SimulationObserver> simObserver); - std::vector<std::string> getDataToCalcTests(); + std::shared_ptr<SimulationResults> getSimulationResults(); + std::shared_ptr<AnalyticalResults> getAnalyticalResults(); + void registerSimulationObserver(std::shared_ptr<SimulationObserver> simObserver); + std::vector<std::string> getDataToCalcTests(); private: - TestSimulationImp(std::shared_ptr<TestSimulationDataStruct> testSimData, std::shared_ptr<SimulationResults> simResult, std::shared_ptr<TimeTracking> timeTracking, std::shared_ptr<ToVectorWriter> toVectorWriter, std::shared_ptr<AnalyticalResults2DToVTKWriter> anaResultWriter, std::shared_ptr<ColorConsoleOutput> colorOutput); - void notifyObserver(); - - void writeAnalyticalResultsToVTK(); - void checkSimulationResults(); - - std::shared_ptr<SimulationParameter> simPara; - std::shared_ptr<ToVectorWriter> toVectorWriter; - std::shared_ptr<InitialCondition> initialCondition; - std::shared_ptr<SimulationInfo> simInfo; - std::shared_ptr<SimulationResults> simResult; - std::shared_ptr<TimeTracking> timeTracking; - - std::shared_ptr<AnalyticalResults> analyticalResult; - - std::shared_ptr<ColorConsoleOutput> colorOutput; - std::shared_ptr<AnalyticalResults2DToVTKWriter> anaResultWriter; - std::shared_ptr<Parameter> para; - std::vector<std::shared_ptr<SimulationObserver> > simObserver; - - std::vector<std::string> dataToCalcTests; - SimulationStatus status; + void notifyObserver(); + + void writeAnalyticalResultsToVTK(); + void checkSimulationResults(); + + std::shared_ptr<SimulationParameter> simPara; + std::shared_ptr<ToVectorWriter> toVectorWriter; + std::shared_ptr<InitialCondition> initialCondition; + std::shared_ptr<SimulationInfo> simInfo; + std::shared_ptr<SimulationResults> simResult; + std::shared_ptr<TimeTracking> timeTracking; + + std::shared_ptr<AnalyticalResults> analyticalResult; + + std::shared_ptr<ColorConsoleOutput> colorOutput; + std::shared_ptr<AnalyticalResults2DToVTKWriter> anaResultWriter; + std::shared_ptr<Parameter> para; + std::vector<std::shared_ptr<SimulationObserver>> simObserver; + + std::vector<std::string> dataToCalcTests; + SimulationStatus status; + + std::function<void()> runSimulation; }; #endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulation.h b/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulation.h deleted file mode 100644 index 36e1eabd9af51a0e415da876faca8d38c691cbad..0000000000000000000000000000000000000000 --- a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulation.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef VIRTUAL_FLUID_SIMULATION_H -#define VIRTUAL_FLUID_SIMULATION_H - -#include "VirtualFluids_GPU/LBM/LB.h" - -class VirtualFluidSimulation -{ -public: - virtual void run() = 0; -private: - -}; -#endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulationImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulationImp.cpp deleted file mode 100644 index 35b0369f966fe11dce8581f609a10078180a20bb..0000000000000000000000000000000000000000 --- a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulationImp.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "VirtualFluidSimulationImp.h" - -#include "Utilities/NumericalTestSuite/NumericalTestSuite.h" -#include "Utilities/Time/TimeTracking.h" - -#include "VirtualFluids_GPU/LBM/Simulation.h" - -#include <sstream> - -void VirtualFluidSimulationImp::run() -{ - numericalTestSuite->makeSimulationHeadOutput(); - Simulation sim; - sim.setFactories(kernelFactory, preProcessorFactory); - sim.init(para, grid, dataWriter, cudaManager); - - timeTracking->setSimulationStartTime(); - sim.run(); - timeTracking->setSimulationEndTime(); - - numericalTestSuite->startPostProcessing(); - - sim.free(); -} - -void VirtualFluidSimulationImp::setParameter(std::shared_ptr<Parameter> para) -{ - this->para = para; -} - -void VirtualFluidSimulationImp::setCudaMemoryManager(std::shared_ptr<CudaMemoryManager> cudaManager) -{ - this->cudaManager = cudaManager; -} - -void VirtualFluidSimulationImp::setGridProvider(std::shared_ptr<GridProvider> grid) -{ - this->grid = grid; -} - -std::shared_ptr<VirtualFluidSimulationImp> VirtualFluidSimulationImp::getNewInstance() -{ - return std::shared_ptr<VirtualFluidSimulationImp>(new VirtualFluidSimulationImp()); -} - -void VirtualFluidSimulationImp::setDataWriter(std::shared_ptr<DataWriter> dataWriter) -{ - this->dataWriter = dataWriter; -} - -void VirtualFluidSimulationImp::setNumericalTestSuite(std::shared_ptr<NumericalTestSuite> numericalTestSuite) -{ - this->numericalTestSuite = numericalTestSuite; -} - -void VirtualFluidSimulationImp::setTimeTracking(std::shared_ptr<TimeTracking> timeTracking) -{ - this->timeTracking = timeTracking; -} - -void VirtualFluidSimulationImp::setKernelFactory(std::shared_ptr<KernelFactory> kernelFactory) -{ - this->kernelFactory = kernelFactory; -} - -void VirtualFluidSimulationImp::setPreProcessorFactory(std::shared_ptr<PreProcessorFactory> preProcessorFactory) -{ - this->preProcessorFactory = preProcessorFactory; -} diff --git a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulationImp.h b/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulationImp.h deleted file mode 100644 index 492459052e56c36345e5650415b2691b4c1b1ed8..0000000000000000000000000000000000000000 --- a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulation/VirtualFluidSimulationImp.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef VIRTUAL_FLUID_SIMULATION_IMP_H -#define VIRTUAL_FLUID_SIMULATION_IMP_H - -#include "VirtualFluidSimulation.h" - -#include <string> -#include <memory> - -class CudaMemoryManager; -class InitialCondition; -class DataWriter; -class Parameter; -class GridProvider; -class KernelConfiguration; -class TestSimulation; -class TimeTracking; -class NumericalTestSuite; -class KernelFactory; -class PreProcessorFactory; - -class VirtualFluidSimulationImp : public VirtualFluidSimulation -{ -public: - void run(); - - static std::shared_ptr<VirtualFluidSimulationImp> getNewInstance(); - - void setParameter(std::shared_ptr<Parameter> para); - void setCudaMemoryManager(std::shared_ptr<CudaMemoryManager> cudaManager); - void setGridProvider(std::shared_ptr<GridProvider> grid); - void setDataWriter(std::shared_ptr<DataWriter> dataWriter); - void setNumericalTestSuite(std::shared_ptr<NumericalTestSuite> numericalTestSuite); - void setTimeTracking(std::shared_ptr<TimeTracking> timeTracking); - - void setKernelFactory(std::shared_ptr<KernelFactory> kernelFactory); - void setPreProcessorFactory(std::shared_ptr<PreProcessorFactory> preProcessorFactory); - -protected: - VirtualFluidSimulationImp() {}; - -private: - std::shared_ptr<Parameter> para; - std::shared_ptr<CudaMemoryManager> cudaManager; - std::shared_ptr<InitialCondition> initialCondition; - std::shared_ptr<GridProvider> grid; - std::shared_ptr<DataWriter> dataWriter; - std::shared_ptr<NumericalTestSuite> numericalTestSuite; - std::shared_ptr<TimeTracking> timeTracking; - - std::shared_ptr<KernelFactory> kernelFactory; - std::shared_ptr<PreProcessorFactory> preProcessorFactory; -}; -#endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.cpp b/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..23bcb582dd863acd813519eed4ec1402105c3618 --- /dev/null +++ b/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.cpp @@ -0,0 +1,127 @@ +#include "VirtualFluidSimulationFactory.h" + +#include "Utilities/InitialCondition/InitialCondition.h" +#include "Utilities/KernelConfiguration/KernelConfiguration.h" +#include "Utilities/NumericalTestGridReader/NumericalTestGridReader.h" +#include "Utilities/SimulationParameter/SimulationParameter.h" + +#include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" + +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" +#include "VirtualFluids_GPU/Communication/Communicator.h" +#include "VirtualFluids_GPU/LBM/Simulation.h" + +std::shared_ptr<Parameter> vf::gpu::tests::makeParameter(std::shared_ptr<SimulationParameter> simPara) +{ + auto para = std::make_shared<Parameter>(1, 0); + + para->setQuadricLimiters(0.01, 0.01, 0.01); + + para->setMaxDev(simPara->getDevices().size()); + para->setDevices(simPara->getDevices()); + + std::string _prefix = "cells"; + std::string gridPath = simPara->getGridPath() + "/"; + para->setOutputPath(simPara->getFilePath()); + para->setOutputPrefix(_prefix); + para->setPrintFiles(true); + + para->setD3Qxx(27); + para->setMaxLevel(simPara->getNumberOfGridLevels()); + + para->setTimestepEnd(simPara->getEndTime()); + para->setTimestepOut(simPara->getTimeStepLength()); + para->setTimestepStartOut(1); + + para->setViscosityLB(simPara->getViscosity()); + para->setVelocityLB(simPara->getMaxVelocity()); + para->setViscosityRatio(1.0); + para->setVelocityRatio(1.0); + para->setDensityRatio(1.0); + para->setFactorPressBC(100000.0); + + para->setgeoVec(gridPath + "geoVec.dat"); + para->setcoordX(gridPath + "coordX.dat"); + para->setcoordY(gridPath + "coordY.dat"); + para->setcoordZ(gridPath + "coordZ.dat"); + para->setneighborX(gridPath + "neighborX.dat"); + para->setneighborY(gridPath + "neighborY.dat"); + para->setneighborZ(gridPath + "neighborZ.dat"); + para->setneighborWSB(gridPath + "neighborWSB.dat"); + para->setgeomBoundaryBcQs(gridPath + "geomBoundaryQs.dat"); + para->setgeomBoundaryBcValues(gridPath + "geomBoundaryValues.dat"); + para->setinletBcQs(gridPath + "inletBoundaryQs.dat"); + para->setinletBcValues(gridPath + "inletBoundaryValues.dat"); + para->setoutletBcQs(gridPath + "outletBoundaryQs.dat"); + para->setoutletBcValues(gridPath + "outletBoundaryValues.dat"); + para->settopBcQs(gridPath + "topBoundaryQs.dat"); + para->settopBcValues(gridPath + "topBoundaryValues.dat"); + para->setbottomBcQs(gridPath + "bottomBoundaryQs.dat"); + para->setbottomBcValues(gridPath + "bottomBoundaryValues.dat"); + para->setfrontBcQs(gridPath + "frontBoundaryQs.dat"); + para->setfrontBcValues(gridPath + "frontBoundaryValues.dat"); + para->setbackBcQs(gridPath + "backBoundaryQs.dat"); + para->setbackBcValues(gridPath + "backBoundaryValues.dat"); + para->setnumberNodes(gridPath + "numberNodes.dat"); + para->setLBMvsSI(gridPath + "LBMvsSI.dat"); + para->setscaleCFC(gridPath + "scaleCFC.dat"); + para->setscaleCFF(gridPath + "scaleCFF.dat"); + para->setscaleFCC(gridPath + "scaleFCC.dat"); + para->setscaleFCF(gridPath + "scaleFCF.dat"); + para->setscaleOffsetCF(gridPath + "offsetVecCF.dat"); + para->setscaleOffsetFC(gridPath + "offsetVecFC.dat"); + para->setCalcParticles(false); + para->setDiffOn(false); + para->setDoCheckPoint(false); + para->setDoRestart(false); + para->setUseGeometryValues(false); + para->setCalc2ndOrderMoments(false); + para->setCalc3rdOrderMoments(false); + para->setCalcHighOrderMoments(false); + para->setReadGeo(false); + para->setCalcMedian(false); + para->setConcFile(false); + para->setUseMeasurePoints(false); + para->setUseWale(false); + para->setSimulatePorousMedia(false); + para->setForcing(0.0, 0.0, 0.0); + + std::vector<int> dist; + dist.resize(1); + dist[0] = 0; + para->setDistX(dist); + para->setDistY(dist); + para->setDistZ(dist); + + // TODO: Find out if we still need this + // para->setNeedInterface(std::vector<bool>{true, true, true, true, true, true}); + + para->setMainKernel(simPara->getKernelConfiguration()->getMainKernel()); + para->setMultiKernelOn(simPara->getKernelConfiguration()->getMultiKernelOn()); + para->setMultiKernelLevel(simPara->getKernelConfiguration()->getMultiKernelLevel()); + para->setMultiKernel(simPara->getKernelConfiguration()->getMultiKernel()); + + return para; +} + +std::shared_ptr<NumericalTestGridReader> makeGridReader(std::shared_ptr<InitialCondition> initialCondition, + std::shared_ptr<Parameter> para, + std::shared_ptr<CudaMemoryManager> cudaManager) +{ + return NumericalTestGridReader::getNewInstance(para, initialCondition, cudaManager); +} + +const std::function<void()> vf::gpu::tests::makeVirtualFluidSimulation(std::shared_ptr<Parameter> para, + std::shared_ptr<InitialCondition> condition, + std::shared_ptr<DataWriter> dataWriter) +{ + auto cudaManager = std::make_shared<CudaMemoryManager>(para); + auto grid = makeGridReader(condition, para, cudaManager); + BoundaryConditionFactory bc_factory; + auto simulation = + std::make_shared<Simulation>(para, cudaManager, vf::gpu::Communicator::getInstance(), *grid.get(), &bc_factory); + simulation->setDataWriter(dataWriter); + + return [simulation]() { simulation->run(); }; +} diff --git a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.h b/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.h index 1abda69dc2770d060d3551781df4f0b677fa61b4..0f77d8848e2152b5e9460967cd9de9f67ddd0e08 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.h +++ b/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.h @@ -1,15 +1,17 @@ -#ifndef VIRTUAL_FLUID_SIMULATION_FACTORY_H -#define VIRTUAL_FLUID_SIMULATION_FACTORY_H +#ifndef VIRTUAL_FLUID_SIMULATION_FACTORY_IMP_H +#define VIRTUAL_FLUID_SIMULATION_FACTORY_IMP_H +#include "Utilities/TestSimulation/TestSimulation.h" +#include <functional> #include <memory> #include <vector> -class VirtualFluidSimulation; -class TestSimulation; - -class VirtualFluidSimulationFactory +namespace vf::gpu::tests { -public: - virtual std::vector<std::shared_ptr<VirtualFluidSimulation> > makeVirtualFluidSimulations(std::vector<std::shared_ptr<TestSimulation> > testSim) = 0; -}; -#endif +std::shared_ptr<Parameter> makeParameter(std::shared_ptr<SimulationParameter> simPara); +const std::function<void()> makeVirtualFluidSimulation(std::shared_ptr<Parameter> para, + std::shared_ptr<InitialCondition> condition, + std::shared_ptr<DataWriter> dataWriter); +} // namespace vf::gpu::tests + +#endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactoryImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactoryImp.cpp deleted file mode 100644 index 243521cf6a05899dfda957fd247e9cb6598d36a9..0000000000000000000000000000000000000000 --- a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactoryImp.cpp +++ /dev/null @@ -1,164 +0,0 @@ -#include "VirtualFluidSimulationFactoryImp.h" - -#include "Utilities/NumericalTestGridReader/NumericalTestGridReader.h" -#include "Utilities/InitialCondition/InitialCondition.h" -#include "Utilities/KernelConfiguration/KernelConfiguration.h" -#include "Utilities/TestSimulation/TestSimulation.h" -#include "Utilities/SimulationParameter/SimulationParameter.h" -#include "Utilities/VirtualFluidSimulation/VirtualFluidSimulationImp.h" - -#include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" -#include "VirtualFluids_GPU/Parameter/Parameter.h" -#include "VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h" -#include "VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h" - -std::shared_ptr<VirtualFluidSimulationFactory> VirtualFluidSimulationFactoryImp::getNewInstance() -{ - return std::shared_ptr<VirtualFluidSimulationFactory>(new VirtualFluidSimulationFactoryImp()); -} - -VirtualFluidSimulationFactoryImp::VirtualFluidSimulationFactoryImp() -{ - -} - -std::shared_ptr<Parameter> VirtualFluidSimulationFactoryImp::makeParameter(std::shared_ptr<SimulationParameter> simPara) -{ - std::shared_ptr<Parameter> para = Parameter::make(); - - para->setMaxDev(simPara->getDevices().size()); - para->setDevices(simPara->getDevices()); - para->setNumprocs(1); - - std::string _prefix = "cells"; - std::string gridPath = simPara->getGridPath() + "/"; - para->setFName(simPara->getFilePath() + "/" + _prefix); - para->setPrintFiles(true); - - para->setD3Qxx(27); - para->setMaxLevel(simPara->getNumberOfGridLevels()); - - para->setTEnd(simPara->getEndTime()); - para->setTOut(simPara->getTimeStepLength()); - para->setTStartOut(1); - - para->setViscosity(simPara->getViscosity()); - para->setVelocity(simPara->getMaxVelocity()); - para->setViscosityRatio(1.0); - para->setVelocityRatio(1.0); - para->setDensityRatio(1.0); - para->setFactorPressBC(100000.0); - - para->setgeoVec(gridPath + "geoVec.dat"); - para->setcoordX(gridPath + "coordX.dat"); - para->setcoordY(gridPath + "coordY.dat"); - para->setcoordZ(gridPath + "coordZ.dat"); - para->setneighborX(gridPath + "neighborX.dat"); - para->setneighborY(gridPath + "neighborY.dat"); - para->setneighborZ(gridPath + "neighborZ.dat"); - para->setneighborWSB(gridPath + "neighborWSB.dat"); - para->setgeomBoundaryBcQs(gridPath + "geomBoundaryQs.dat"); - para->setgeomBoundaryBcValues(gridPath + "geomBoundaryValues.dat"); - para->setinletBcQs(gridPath + "inletBoundaryQs.dat"); - para->setinletBcValues(gridPath + "inletBoundaryValues.dat"); - para->setoutletBcQs(gridPath + "outletBoundaryQs.dat"); - para->setoutletBcValues(gridPath + "outletBoundaryValues.dat"); - para->settopBcQs(gridPath + "topBoundaryQs.dat"); - para->settopBcValues(gridPath + "topBoundaryValues.dat"); - para->setbottomBcQs(gridPath + "bottomBoundaryQs.dat"); - para->setbottomBcValues(gridPath + "bottomBoundaryValues.dat"); - para->setfrontBcQs(gridPath + "frontBoundaryQs.dat"); - para->setfrontBcValues(gridPath + "frontBoundaryValues.dat"); - para->setbackBcQs(gridPath + "backBoundaryQs.dat"); - para->setbackBcValues(gridPath + "backBoundaryValues.dat"); - para->setnumberNodes(gridPath + "numberNodes.dat"); - para->setLBMvsSI(gridPath + "LBMvsSI.dat"); - para->setscaleCFC(gridPath + "scaleCFC.dat"); - para->setscaleCFF(gridPath + "scaleCFF.dat"); - para->setscaleFCC(gridPath + "scaleFCC.dat"); - para->setscaleFCF(gridPath + "scaleFCF.dat"); - para->setscaleOffsetCF(gridPath + "offsetVecCF.dat"); - para->setscaleOffsetFC(gridPath + "offsetVecFC.dat"); - para->setCalcParticles(false); - para->setDiffOn(false); - para->setDoCheckPoint(false); - para->setDoRestart(false); - para->setGeometryValues(false); - para->setCalc2ndOrderMoments(false); - para->setCalc3rdOrderMoments(false); - para->setCalcHighOrderMoments(false); - para->setReadGeo(false); - para->setCalcMedian(false); - para->setConcFile(false); - para->setUseMeasurePoints(false); - para->setUseWale(false); - para->setSimulatePorousMedia(false); - para->setForcing(0.0, 0.0, 0.0); - - std::vector<int> dist; - dist.resize(1); - dist[0] = 0; - para->setDistX(dist); - para->setDistY(dist); - para->setDistZ(dist); - - para->setNeedInterface(std::vector<bool>{true, true, true, true, true, true}); - - para->setMainKernel(simPara->getKernelConfiguration()->getMainKernel()); - para->setMultiKernelOn(simPara->getKernelConfiguration()->getMultiKernelOn()); - para->setMultiKernelLevel(simPara->getKernelConfiguration()->getMultiKernelLevel()); - para->setMultiKernel(simPara->getKernelConfiguration()->getMultiKernel()); - - return para; -} - -std::shared_ptr<NumericalTestGridReader> VirtualFluidSimulationFactoryImp::makeGridReader(std::shared_ptr<InitialCondition> initialCondition, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager) -{ - std::shared_ptr<NumericalTestGridReader> grid = NumericalTestGridReader::getNewInstance(para, initialCondition, cudaManager); - return grid; -} - -std::shared_ptr<CudaMemoryManager> VirtualFluidSimulationFactoryImp::makeCudaMemoryManager(std::shared_ptr<Parameter> para) -{ - std::shared_ptr<CudaMemoryManager> cudaManager = CudaMemoryManager::make(para); - return cudaManager; -} - -void VirtualFluidSimulationFactoryImp::initInitialConditions(std::shared_ptr<InitialCondition> initialCondition, std::shared_ptr<Parameter> para) -{ - initialCondition->setParameter(para); -} - -std::vector<std::shared_ptr<VirtualFluidSimulation> > VirtualFluidSimulationFactoryImp::makeVirtualFluidSimulations(std::vector<std::shared_ptr<TestSimulation> > testSim) -{ - std::vector<std::shared_ptr<VirtualFluidSimulation> > vfSimulations; - - std::shared_ptr<KernelFactoryImp> kernelFactory = KernelFactoryImp::getInstance(); - std::shared_ptr<PreProcessorFactoryImp> preProcessorFactory = PreProcessorFactoryImp::getInstance(); - - for (int i = 0; i < testSim.size(); i++) { - std::shared_ptr<VirtualFluidSimulationImp> vfSim = VirtualFluidSimulationImp::getNewInstance(); - - std::shared_ptr<Parameter> para = makeParameter(testSim.at(i)->getSimulationParameter()); - vfSim->setParameter(para); - testSim.at(i)->setParameter(para); - - std::shared_ptr<CudaMemoryManager> cudaManager = makeCudaMemoryManager(para); - vfSim->setCudaMemoryManager(cudaManager); - - initInitialConditions(testSim.at(i)->getInitialCondition(), para); - std::shared_ptr<NumericalTestGridReader> grid = makeGridReader(testSim.at(i)->getInitialCondition(), para, cudaManager); - - vfSim->setGridProvider(grid); - vfSim->setDataWriter(testSim.at(i)->getDataWriter()); - vfSim->setNumericalTestSuite(testSim.at(i)); - vfSim->setTimeTracking(testSim.at(i)->getTimeTracking()); - - vfSim->setKernelFactory(kernelFactory); - vfSim->setPreProcessorFactory(preProcessorFactory); - - vfSimulations.push_back(vfSim); - } - - return vfSimulations; -} diff --git a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactoryImp.h b/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactoryImp.h deleted file mode 100644 index 07e6b6ebb924a6b4ff940befd7ba8e266e9b160a..0000000000000000000000000000000000000000 --- a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactoryImp.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef VIRTUAL_FLUID_SIMULATION_FACTORY_IMP_H -#define VIRTUAL_FLUID_SIMULATION_FACTORY_IMP_H - -#include "VirtualFluidSimulationFactory.h" - -class CudaMemoryManager; -class NumericalTestGridReader; -class InitialCondition; -class Parameter; -class SimulationParameter; - -class VirtualFluidSimulationFactoryImp: public VirtualFluidSimulationFactory -{ -public: - static std::shared_ptr<VirtualFluidSimulationFactory> getNewInstance(); - std::vector<std::shared_ptr<VirtualFluidSimulation> > makeVirtualFluidSimulations(std::vector<std::shared_ptr<TestSimulation> > testSim); - -protected: - VirtualFluidSimulationFactoryImp(); - - std::shared_ptr<Parameter> makeParameter(std::shared_ptr<SimulationParameter> simPara); - std::shared_ptr<NumericalTestGridReader> makeGridReader(std::shared_ptr<InitialCondition> initialCondition, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager); - std::shared_ptr<CudaMemoryManager> makeCudaMemoryManager(std::shared_ptr<Parameter> para); - void initInitialConditions(std::shared_ptr<InitialCondition> initialCondition, std::shared_ptr<Parameter> para); - -private: - -}; -#endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/config.txt b/apps/gpu/tests/NumericalTests/config.txt index 783e6ebbb6d0550f08e39b363a1550c1fe814567..fb88cd424f710c92d9e9f15a9de5deb98a2d85f7 100644 --- a/apps/gpu/tests/NumericalTests/config.txt +++ b/apps/gpu/tests/NumericalTests/config.txt @@ -1,39 +1,39 @@ ################################################## # GPU Mapping # ################################################## -Devices="0" +Devices=0 ################################################## # Basic Simulation Parameter # ################################################## -KernelsToTest="CumulantK15Comp" +KernelsToTest=CumulantK15Comp #CumulantK17Comp #BGKCompSP27 BGKPlusCompSP27 CumulantAA2016CompSP27 CumulantOneCompSP27 CumulantF3CompSP27 CumulantF32018CompSP27 CumulantAll4CompSP27 NumberOfTimeSteps=20 -Viscosity="0.001" +Viscosity=0.001 Rho0=1.0 ################################################## # TaylorGreenVortex Parameter # ################################################## -BasisTimeStepLength_TGV_Ux="1000" -ux_TGV_Ux="0.096" -Amplitude_TGV_Ux="0.001" +BasisTimeStepLength_TGV_Ux=1000 +ux_TGV_Ux=0.096 +Amplitude_TGV_Ux=0.001 l0_TGV_Ux=32 -DataToCalcTests_TGV_Ux="Vx Vz" +DataToCalcTests_TGV_Ux=Vx Vz -BasisTimeStepLength_TGV_Uz="1000" -uz_TGV_Uz="0.048" -Amplitude_TGV_Uz="0.001" +BasisTimeStepLength_TGV_Uz=1000 +uz_TGV_Uz=0.048 +Amplitude_TGV_Uz=0.001 l0_TGV_Uz=48 -DataToCalcTests_TGV_Uz="Vx Vz" +DataToCalcTests_TGV_Uz=Vx Vz ################################################## # Shear Wave Parameter # ################################################## -BasisTimeStepLength_SW="1000" -u0_SW="0.096" -v0_SW="0.1" +BasisTimeStepLength_SW=1000 +u0_SW=0.096 +v0_SW=0.1 l0_SW=32 DataToCalcTests_SW="Vy" @@ -65,8 +65,8 @@ EndTimeStepCalculation_Ny=20 ################################################## L2NormTest=false -NormalizeData_L2Norm="Amplitude BasicData" -MaxL2NormDiff="4.5 0.5" +NormalizeData_L2Norm=Amplitude BasicData +MaxL2NormDiff=4.5 0.5 BasicTimeStep_L2=0 DivergentTimeStep_L2=20 @@ -77,7 +77,7 @@ DivergentTimeStep_L2=20 L2NormBetweenKernelsTest=false BasicKernel_L2NormBetweenKernels=BGKCompSP27 -Timesteps_L2NormBetweenKernels="0 10 20" +Timesteps_L2NormBetweenKernels=0 10 20 NormalizeWith=amplitude ################################################## @@ -115,7 +115,7 @@ GridPath512="E:\temp\numericalTests\grids\gridUni512x4x768" ################################################## # File Writing Information # ################################################## -WriteVTKFiles=false +WriteVTKFiles=true PathForVTKFileWriting="E:\temp\numericalTests\Output" StartStepFileWriter=0 diff --git a/apps/gpu/tests/NumericalTests/configK15_nu10tm2.txt b/apps/gpu/tests/NumericalTests/configK15_nu10tm2.txt index 085fde0c134fc6005ca82dacf2296479953756d7..435931bf0fac794dc203bf9c0242b2510d80d739 100644 --- a/apps/gpu/tests/NumericalTests/configK15_nu10tm2.txt +++ b/apps/gpu/tests/NumericalTests/configK15_nu10tm2.txt @@ -1,41 +1,41 @@ ################################################## # GPU Mapping # ################################################## -Devices="0" +Devices=0 ################################################## # Basic Simulation Parameter # ################################################## -KernelsToTest="CumulantK15Comp" +KernelsToTest=CumulantK15Comp #CumulantK17Comp #BGKCompSP27 BGKPlusCompSP27 CumulantAA2016CompSP27 CumulantOneCompSP27 CumulantF3CompSP27 CumulantF32018CompSP27 CumulantAll4CompSP27 NumberOfTimeSteps=20 -Viscosity="0.01" +Viscosity=0.01 Rho0=1.0 ################################################## # TaylorGreenVortex Parameter # ################################################## -BasisTimeStepLength_TGV_Ux="1000" -ux_TGV_Ux="0.096" -Amplitude_TGV_Ux="0.001" +BasisTimeStepLength_TGV_Ux=1000 +ux_TGV_Ux=0.096 +Amplitude_TGV_Ux=0.001 l0_TGV_Ux=32 -DataToCalcTests_TGV_Ux="Vx Vz" +DataToCalcTests_TGV_Ux=Vx Vz -BasisTimeStepLength_TGV_Uz="1000" -uz_TGV_Uz="0.048" -Amplitude_TGV_Uz="0.001" +BasisTimeStepLength_TGV_Uz=1000 +uz_TGV_Uz=0.048 +Amplitude_TGV_Uz=0.001 l0_TGV_Uz=48 -DataToCalcTests_TGV_Uz="Vx Vz" +DataToCalcTests_TGV_Uz=Vx Vz ################################################## # Shear Wave Parameter # ################################################## -BasisTimeStepLength_SW="1000" -u0_SW="0.096" -v0_SW="0.1" +BasisTimeStepLength_SW=1000 +u0_SW=0.096 +v0_SW=0.1 l0_SW=32 -DataToCalcTests_SW="Vy" +DataToCalcTests_SW=Vy ################################################## # Basic Test Parameter # @@ -65,8 +65,8 @@ EndTimeStepCalculation_Ny=20 ################################################## L2NormTest=false -NormalizeData_L2Norm="Amplitude BasicData" -MaxL2NormDiff="4.5 0.5" +NormalizeData_L2Norm=Amplitude BasicData +MaxL2NormDiff=4.5 0.5 BasicTimeStep_L2=0 DivergentTimeStep_L2=20 @@ -77,7 +77,7 @@ DivergentTimeStep_L2=20 L2NormBetweenKernelsTest=false BasicKernel_L2NormBetweenKernels=BGKCompSP27 -Timesteps_L2NormBetweenKernels="0 10 20" +Timesteps_L2NormBetweenKernels=0 10 20 NormalizeWith=amplitude ################################################## @@ -86,7 +86,7 @@ NormalizeWith=amplitude TaylorGreenVortexUx32=true TaylorGreenVortexUx64=true TaylorGreenVortexUx128=true -TaylorGreenVortexUx256=false +TaylorGreenVortexUx256=true TaylorGreenVortexUx512=false TaylorGreenVortexUz32=false @@ -95,9 +95,9 @@ TaylorGreenVortexUz128=false TaylorGreenVortexUz256=false TaylorGreenVortexUz512=false -ShearWave32=false -ShearWave64=false -ShearWave128=false +ShearWave32=true +ShearWave64=true +ShearWave128=true ShearWave256=false ShearWave512=false @@ -106,19 +106,19 @@ ShearWave512=false ################################################## NumberOfGridLevels=1 -GridPath32="grids/gridUni32x4x48" -GridPath64="grids/gridUni64x4x96" -GridPath128="grids/gridUni128x4x192" -GridPath256="grids/gridUni256x4x384" -GridPath512="grids/gridUni512x4x768" +GridPath32=grids/gridUni32x4x48 +GridPath64=grids/gridUni64x4x96 +GridPath128=grids/gridUni128x4x192 +GridPath256=grids/gridUni256x4x384 +GridPath512=grids/gridUni512x4x768 ################################################## # File Writing Information # ################################################## WriteVTKFiles=false -FolderForVTKFileWriting="Output" +FolderForVTKFileWriting=Output StartStepFileWriter=0 -WriteAnalyResultsToVTK=true +WriteAnalyResultsToVTK=false -FolderLogFile="logFiles" \ No newline at end of file +FolderLogFile=logFiles \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/configK15_nu10tm3.txt b/apps/gpu/tests/NumericalTests/configK15_nu10tm3.txt index eb27bc5f4a1f937721d2886b0fb599a5b1c7d03c..401f390ebbe3b2c7044699831bf802296123b6ca 100644 --- a/apps/gpu/tests/NumericalTests/configK15_nu10tm3.txt +++ b/apps/gpu/tests/NumericalTests/configK15_nu10tm3.txt @@ -1,41 +1,41 @@ ################################################## # GPU Mapping # ################################################## -Devices="1" +Devices=1 ################################################## # Basic Simulation Parameter # ################################################## -KernelsToTest="CumulantK15Comp" +KernelsToTest=CumulantK15Comp #CumulantK17Comp #BGKCompSP27 BGKPlusCompSP27 CumulantAA2016CompSP27 CumulantOneCompSP27 CumulantF3CompSP27 CumulantF32018CompSP27 CumulantAll4CompSP27 NumberOfTimeSteps=20 -Viscosity="0.001" +Viscosity=0.001 Rho0=1.0 ################################################## # TaylorGreenVortex Parameter # ################################################## -BasisTimeStepLength_TGV_Ux="1000" -ux_TGV_Ux="0.096" -Amplitude_TGV_Ux="0.001" +BasisTimeStepLength_TGV_Ux=1000 +ux_TGV_Ux=0.096 +Amplitude_TGV_Ux=0.001 l0_TGV_Ux=32 -DataToCalcTests_TGV_Ux="Vx Vz" +DataToCalcTests_TGV_Ux=Vx Vz -BasisTimeStepLength_TGV_Uz="1000" -uz_TGV_Uz="0.048" -Amplitude_TGV_Uz="0.001" +BasisTimeStepLength_TGV_Uz=1000 +uz_TGV_Uz=0.048 +Amplitude_TGV_Uz=0.001 l0_TGV_Uz=48 -DataToCalcTests_TGV_Uz="Vx Vz" +DataToCalcTests_TGV_Uz=Vx Vz ################################################## # Shear Wave Parameter # ################################################## -BasisTimeStepLength_SW="1000" -u0_SW="0.096" -v0_SW="0.1" +BasisTimeStepLength_SW=1000 +u0_SW=0.096 +v0_SW=0.1 l0_SW=32 -DataToCalcTests_SW="Vy" +DataToCalcTests_SW=Vy ################################################## # Basic Test Parameter # @@ -65,8 +65,8 @@ EndTimeStepCalculation_Ny=20 ################################################## L2NormTest=false -NormalizeData_L2Norm="Amplitude BasicData" -MaxL2NormDiff="4.5 0.5" +NormalizeData_L2Norm=Amplitude BasicData +MaxL2NormDiff=4.5 0.5 BasicTimeStep_L2=0 DivergentTimeStep_L2=20 @@ -77,7 +77,7 @@ DivergentTimeStep_L2=20 L2NormBetweenKernelsTest=false BasicKernel_L2NormBetweenKernels=BGKCompSP27 -Timesteps_L2NormBetweenKernels="0 10 20" +Timesteps_L2NormBetweenKernels=0 10 20 NormalizeWith=amplitude ################################################## @@ -106,19 +106,19 @@ ShearWave512=true ################################################## NumberOfGridLevels=1 -GridPath32="grids/gridUni32x4x48" -GridPath64="grids/gridUni64x4x96" -GridPath128="grids/gridUni128x4x192" -GridPath256="grids/gridUni256x4x384" -GridPath512="grids/gridUni512x4x768" +GridPath32=grids/gridUni32x4x48 +GridPath64=grids/gridUni64x4x96 +GridPath128=grids/gridUni128x4x192 +GridPath256=grids/gridUni256x4x384 +GridPath512=grids/gridUni512x4x768 ################################################## # File Writing Information # ################################################## -WriteVTKFiles=false -FolderForVTKFileWriting="Output" +WriteVTKFiles=true +FolderForVTKFileWriting=Output StartStepFileWriter=0 WriteAnalyResultsToVTK=true -FolderLogFile="logFiles" \ No newline at end of file +FolderLogFile=logFiles \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/configK15_nu10tm4.txt b/apps/gpu/tests/NumericalTests/configK15_nu10tm4.txt index d0ceb823b33fcc143f27d2ef9abcaee437daea2b..985040a272642ca6c426cd8e6a00f91c263449e6 100644 --- a/apps/gpu/tests/NumericalTests/configK15_nu10tm4.txt +++ b/apps/gpu/tests/NumericalTests/configK15_nu10tm4.txt @@ -1,41 +1,41 @@ ################################################## # GPU Mapping # ################################################## -Devices="1" +Devices=1 ################################################## # Basic Simulation Parameter # ################################################## -KernelsToTest="CumulantK15Comp" +KernelsToTest=CumulantK15Comp #CumulantK17Comp #BGKCompSP27 BGKPlusCompSP27 CumulantAA2016CompSP27 CumulantOneCompSP27 CumulantF3CompSP27 CumulantF32018CompSP27 CumulantAll4CompSP27 NumberOfTimeSteps=20 -Viscosity="0.0001" +Viscosity=0.0001 Rho0=1.0 ################################################## # TaylorGreenVortex Parameter # ################################################## -BasisTimeStepLength_TGV_Ux="1000" -ux_TGV_Ux="0.096" -Amplitude_TGV_Ux="0.001" +BasisTimeStepLength_TGV_Ux=1000 +ux_TGV_Ux=0.096 +Amplitude_TGV_Ux=0.001 l0_TGV_Ux=32 -DataToCalcTests_TGV_Ux="Vx Vz" +DataToCalcTests_TGV_Ux=Vx Vz -BasisTimeStepLength_TGV_Uz="1000" -uz_TGV_Uz="0.048" -Amplitude_TGV_Uz="0.001" +BasisTimeStepLength_TGV_Uz=1000 +uz_TGV_Uz=0.048 +Amplitude_TGV_Uz=0.001 l0_TGV_Uz=48 -DataToCalcTests_TGV_Uz="Vx Vz" +DataToCalcTests_TGV_Uz=Vx Vz ################################################## # Shear Wave Parameter # ################################################## -BasisTimeStepLength_SW="1000" -u0_SW="0.096" -v0_SW="0.1" +BasisTimeStepLength_SW=1000 +u0_SW=0.096 +v0_SW=0.1 l0_SW=32 -DataToCalcTests_SW="Vy" +DataToCalcTests_SW=Vy ################################################## # Basic Test Parameter # @@ -65,8 +65,8 @@ EndTimeStepCalculation_Ny=20 ################################################## L2NormTest=false -NormalizeData_L2Norm="Amplitude BasicData" -MaxL2NormDiff="4.5 0.5" +NormalizeData_L2Norm=Amplitude BasicData +MaxL2NormDiff=4.5 0.5 BasicTimeStep_L2=0 DivergentTimeStep_L2=20 @@ -77,7 +77,7 @@ DivergentTimeStep_L2=20 L2NormBetweenKernelsTest=false BasicKernel_L2NormBetweenKernels=BGKCompSP27 -Timesteps_L2NormBetweenKernels="0 10 20" +Timesteps_L2NormBetweenKernels=0 10 20 NormalizeWith=amplitude ################################################## @@ -106,19 +106,19 @@ ShearWave512=true ################################################## NumberOfGridLevels=1 -GridPath32="grids/gridUni32x4x48" -GridPath64="grids/gridUni64x4x96" -GridPath128="grids/gridUni128x4x192" -GridPath256="grids/gridUni256x4x384" -GridPath512="grids/gridUni512x4x768" +GridPath32=grids/gridUni32x4x48 +GridPath64=grids/gridUni64x4x96 +GridPath128=grids/gridUni128x4x192 +GridPath256=grids/gridUni256x4x384 +GridPath512=grids/gridUni512x4x768 ################################################## # File Writing Information # ################################################## -WriteVTKFiles=false -FolderForVTKFileWriting="Output" +WriteVTKFiles=true +FolderForVTKFileWriting=Output StartStepFileWriter=0 WriteAnalyResultsToVTK=true -FolderLogFile="logFiles" \ No newline at end of file +FolderLogFile=logFiles \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/configK15_nu10tm5.txt b/apps/gpu/tests/NumericalTests/configK15_nu10tm5.txt index 1b0b7d786efb2f0bec1718359c5b5cb603578bc0..9767e00e53d22c36405bace31479349b3fff5bcc 100644 --- a/apps/gpu/tests/NumericalTests/configK15_nu10tm5.txt +++ b/apps/gpu/tests/NumericalTests/configK15_nu10tm5.txt @@ -1,41 +1,41 @@ ################################################## # GPU Mapping # ################################################## -Devices="1" +Devices=1 ################################################## # Basic Simulation Parameter # ################################################## -KernelsToTest="CumulantK15Comp" +KernelsToTest=CumulantK15Comp #CumulantK17Comp #BGKCompSP27 BGKPlusCompSP27 CumulantAA2016CompSP27 CumulantOneCompSP27 CumulantF3CompSP27 CumulantF32018CompSP27 CumulantAll4CompSP27 NumberOfTimeSteps=20 -Viscosity="0.00001" +Viscosity=0.00001 Rho0=1.0 ################################################## # TaylorGreenVortex Parameter # ################################################## -BasisTimeStepLength_TGV_Ux="1000" -ux_TGV_Ux="0.096" -Amplitude_TGV_Ux="0.001" +BasisTimeStepLength_TGV_Ux=1000 +ux_TGV_Ux=0.096 +Amplitude_TGV_Ux=0.001 l0_TGV_Ux=32 -DataToCalcTests_TGV_Ux="Vx Vz" +DataToCalcTests_TGV_Ux=Vx Vz -BasisTimeStepLength_TGV_Uz="1000" -uz_TGV_Uz="0.048" -Amplitude_TGV_Uz="0.001" +BasisTimeStepLength_TGV_Uz=1000 +uz_TGV_Uz=0.048 +Amplitude_TGV_Uz=0.001 l0_TGV_Uz=48 -DataToCalcTests_TGV_Uz="Vx Vz" +DataToCalcTests_TGV_Uz=Vx Vz ################################################## # Shear Wave Parameter # ################################################## -BasisTimeStepLength_SW="1000" -u0_SW="0.096" -v0_SW="0.1" +BasisTimeStepLength_SW=1000 +u0_SW=0.096 +v0_SW=0.1 l0_SW=32 -DataToCalcTests_SW="Vy" +DataToCalcTests_SW=Vy ################################################## # Basic Test Parameter # @@ -65,8 +65,8 @@ EndTimeStepCalculation_Ny=20 ################################################## L2NormTest=false -NormalizeData_L2Norm="Amplitude BasicData" -MaxL2NormDiff="4.5 0.5" +NormalizeData_L2Norm=Amplitude BasicData +MaxL2NormDiff=4.5 0.5 BasicTimeStep_L2=0 DivergentTimeStep_L2=20 @@ -77,7 +77,7 @@ DivergentTimeStep_L2=20 L2NormBetweenKernelsTest=false BasicKernel_L2NormBetweenKernels=BGKCompSP27 -Timesteps_L2NormBetweenKernels="0 10 20" +Timesteps_L2NormBetweenKernels=0 10 20 NormalizeWith=amplitude ################################################## @@ -106,19 +106,19 @@ ShearWave512=true ################################################## NumberOfGridLevels=1 -GridPath32="grids/gridUni32x4x48" -GridPath64="grids/gridUni64x4x96" -GridPath128="grids/gridUni128x4x192" -GridPath256="grids/gridUni256x4x384" -GridPath512="grids/gridUni512x4x768" +GridPath32=grids/gridUni32x4x48 +GridPath64=grids/gridUni64x4x96 +GridPath128=grids/gridUni128x4x192 +GridPath256=grids/gridUni256x4x384 +GridPath512=grids/gridUni512x4x768 ################################################## # File Writing Information # ################################################## -WriteVTKFiles=false -FolderForVTKFileWriting="Output" +WriteVTKFiles=true +FolderForVTKFileWriting=Output StartStepFileWriter=0 WriteAnalyResultsToVTK=true -FolderLogFile="logFiles" \ No newline at end of file +FolderLogFile=logFiles \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt b/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt index 0cceea9a7f6f6c30e3df6f6802f182c893774522..6ca01d34f0d8fb224f67cdf786160c30dd2bbd97 100644 --- a/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt +++ b/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt @@ -1,39 +1,39 @@ ################################################## # GPU Mapping # ################################################## -Devices="1" +Devices=0 ################################################## # Basic Simulation Parameter # ################################################## -KernelsToTest="CumulantK17CompChim" +KernelsToTest=CumulantK17CompChim NumberOfTimeSteps=20 -Viscosity="0.001" +Viscosity=0.001 Rho0=1.0 ################################################## # TaylorGreenVortex Parameter # ################################################## -BasisTimeStepLength_TGV_Ux="1000" -ux_TGV_Ux="0.096" -Amplitude_TGV_Ux="0.001" +BasisTimeStepLength_TGV_Ux=1000 +ux_TGV_Ux=0.096 +Amplitude_TGV_Ux=0.001 l0_TGV_Ux=32 -DataToCalcTests_TGV_Ux="Vx Vz" +DataToCalcTests_TGV_Ux=Vx Vz -BasisTimeStepLength_TGV_Uz="1000" -uz_TGV_Uz="0.048" -Amplitude_TGV_Uz="0.001" +BasisTimeStepLength_TGV_Uz=1000 +uz_TGV_Uz=0.048 +Amplitude_TGV_Uz=0.001 l0_TGV_Uz=48 -DataToCalcTests_TGV_Uz="Vx Vz" +DataToCalcTests_TGV_Uz=Vx Vz ################################################## # Shear Wave Parameter # ################################################## -BasisTimeStepLength_SW="1000" -u0_SW="0.096" -v0_SW="0.1" +BasisTimeStepLength_SW=1000 +u0_SW=0.096 +v0_SW=0.1 l0_SW=32 -DataToCalcTests_SW="Vy" +DataToCalcTests_SW=Vy ################################################## # Basic Test Parameter # @@ -63,8 +63,8 @@ EndTimeStepCalculation_Ny=20 ################################################## L2NormTest=false -NormalizeData_L2Norm="Amplitude BasicData" -MaxL2NormDiff="4.5 0.5" +NormalizeData_L2Norm=Amplitude BasicData +MaxL2NormDiff=4.5 0.5 BasicTimeStep_L2=0 DivergentTimeStep_L2=20 @@ -75,7 +75,7 @@ DivergentTimeStep_L2=20 L2NormBetweenKernelsTest=false BasicKernel_L2NormBetweenKernels=BGKCompSP27 -Timesteps_L2NormBetweenKernels="0 10 20" +Timesteps_L2NormBetweenKernels=0 10 20 NormalizeWith=amplitude ################################################## @@ -84,8 +84,8 @@ NormalizeWith=amplitude TaylorGreenVortexUx32=true TaylorGreenVortexUx64=true TaylorGreenVortexUx128=true -TaylorGreenVortexUx256=true -TaylorGreenVortexUx512=true +TaylorGreenVortexUx256=false +TaylorGreenVortexUx512=false TaylorGreenVortexUz32=false TaylorGreenVortexUz64=false @@ -93,30 +93,30 @@ TaylorGreenVortexUz128=false TaylorGreenVortexUz256=false TaylorGreenVortexUz512=false -ShearWave32=true -ShearWave64=true -ShearWave128=true -ShearWave256=true -ShearWave512=true +ShearWave32=false +ShearWave64=false +ShearWave128=false +ShearWave256=false +ShearWave512=false ################################################## # Grid Information # ################################################## NumberOfGridLevels=1 -GridPath32="grids/gridUni32x4x48" -GridPath64="grids/gridUni64x4x96" -GridPath128="grids/gridUni128x4x192" -GridPath256="grids/gridUni256x4x384" -GridPath512="grids/gridUni512x4x768" +GridPath32=grids/gridUni32x4x48 +GridPath64=grids/gridUni64x4x96 +GridPath128=grids/gridUni128x4x192 +GridPath256=grids/gridUni256x4x384 +GridPath512=grids/gridUni512x4x768 ################################################## # File Writing Information # ################################################## -WriteVTKFiles=false -FolderForVTKFileWriting="Output" +WriteVTKFiles=true +FolderForVTKFileWriting=Output StartStepFileWriter=0 -WriteAnalyResultsToVTK=true +WriteAnalyResultsToVTK=false -FolderLogFile="logFiles" \ No newline at end of file +FolderLogFile=logFiles \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/main.cpp b/apps/gpu/tests/NumericalTests/main.cpp index 703e8961497f3f1c93cb460fb9937f391e4ea0e9..fda9d14a7b752eab2585b300ee6aef606437913e 100644 --- a/apps/gpu/tests/NumericalTests/main.cpp +++ b/apps/gpu/tests/NumericalTests/main.cpp @@ -1,143 +1,44 @@ -#include <mpi.h> #include <gmock/gmock.h> +#include <mpi.h> #include "Utilities/ConfigFileReaderNT/ConfigFileReaderNT.h" #include "Utilities/LogFileQueue/LogFileQueue.h" #include "Utilities/NumericalTestFactory/NumericalTestFactoryImp.h" #include "Utilities/TestQueue/TestQueue.h" -#include "Utilities/VirtualFluidSimulation/VirtualFluidSimulation.h" -#include "Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactoryImp.h" +#include "Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.h" -//validation +// validation +#include "Utilities/Calculator/FFTCalculator/FFTCalculator.h" #include <fstream> #include <iostream> -#include "Utilities/Calculator/FFTCalculator/FFTCalculator.h" -static void validateTestSuite() +static TestSuiteResult startNumericalTests(const std::string &configFile) { - const int timeSteps = 10; - const int begin = 11; - const int end = 20; - const int l0 = 32; - const double viscosity = 0.001; - std::string kernelName = "Cum"; - - std::vector<int> xLength{32,64,128,256,512}; - std::vector<int> zLength(xLength.size()); - std::vector<int> timeStepLength(xLength.size()); - for (int i = 0; i < xLength.size(); i++) { - zLength.at(i) = xLength.at(i) * 3 / 2; - timeStepLength.at(i) = (int)1000 * xLength.at(i)*xLength.at(i) / l0 / l0; - } - - std::vector<std::vector<std::ostringstream>> filePaths; - filePaths.resize(xLength.size()); - - for (int j = 0; j < xLength.size(); j++) { - filePaths.at(j).resize(timeSteps); - for (int i = begin; i <= end; i++) - filePaths.at(j).at(i - begin) << "C:/Users/Timon/Desktop/Auswertung_TGV_10hm3_X_CumD3Q27F3/Auswertung_TGV_10hm3_X_CumD3Q27F3/" << kernelName << "_" << xLength.at(j) << "_3_" << zLength.at(j) << "_AD_X_" << i*timeStepLength.at(j) << ".dat"; - - } - std::vector<std::vector<std::vector<double>>> dataForOneSimulationGroup; - - for (int j = 0; j < filePaths.size(); j++) { - std::vector<std::vector<double>> dataForOneSimulation; - dataForOneSimulation.resize(timeSteps); - for (int i = 0; i < filePaths.at(j).size(); i++) { - std::ifstream file; - file.open(filePaths.at(j).at(i).str()); - - if (file.is_open()) { - double data = 0.0; - while (file >> data) - dataForOneSimulation.at(i).push_back(data); - - file.close(); - } - else - int stop = 1; - } - dataForOneSimulationGroup.push_back(dataForOneSimulation); - } - - std::shared_ptr<FFTCalculator> calulator = FFTCalculator::getInstance(); - - std::vector<double> phiDifForOneSimGroup; - std::vector<double> nyDifForOneSimGroup; - for (int i = 0; i < dataForOneSimulationGroup.size(); i++) { - int timeStepLength = 1000 * xLength.at(i)*xLength.at(i) / l0 / l0; - - double phiDiff = calulator->calcPhiDiff(dataForOneSimulationGroup.at(i), false, xLength.at(i), zLength.at(i), timeStepLength); - double ny = calulator->calcNy(dataForOneSimulationGroup.at(i), false, xLength.at(i), zLength.at(i), timeStepLength); - double nyDiff = abs(ny - viscosity) / viscosity; - phiDifForOneSimGroup.push_back(phiDiff); - nyDifForOneSimGroup.push_back(nyDiff); - } - - + auto configData = vf::gpu::tests::readConfigFile(configFile); - std::fstream dataOutPhi; - std::string dataOutFilePathPhi = "C:/Users/Timon/Desktop/Auswertung_TGV_10hm3_X_CumD3Q27F3/NumericalTestAuswertung/" + kernelName + "_PhiDiff.dat"; - dataOutPhi.open(dataOutFilePathPhi, std::ios::out); + std::shared_ptr<NumericalTestFactoryImp> numericalTestFactory = NumericalTestFactoryImp::getNewInstance(configData); - std::fstream dataOutNy; - std::string dataOutFilePathNy = "C:/Users/Timon/Desktop/Auswertung_TGV_10hm3_X_CumD3Q27F3/NumericalTestAuswertung/" + kernelName + "_NyDiff.dat"; - dataOutNy.open(dataOutFilePathNy, std::ios::out); + std::shared_ptr<TestQueue> testQueue = numericalTestFactory->getTestQueue(); + std::shared_ptr<LogFileQueue> logFileQueue = numericalTestFactory->getLogFileQueue(); - for (int i = 0; i < phiDifForOneSimGroup.size(); i++) { - dataOutPhi << std::fixed << std::setprecision(std::numeric_limits<double>::digits10 + 1); - dataOutPhi << phiDifForOneSimGroup.at(i); - dataOutNy << std::fixed << std::setprecision(std::numeric_limits<double>::digits10 + 1); - dataOutNy << nyDifForOneSimGroup.at(i); + auto result = testQueue->run(); + logFileQueue->writeLogFiles(); - if (i < phiDifForOneSimGroup.size() - 1) { - dataOutPhi << std::endl; - dataOutNy << std::endl; - } - } - - dataOutPhi.close(); -} - - -static bool startNumericalTests(const std::string &configFile) -{ - std::shared_ptr<ConfigFileReader> configReader = ConfigFileReader::getNewInstance(configFile); - configReader->readConfigFile(); - - std::shared_ptr<NumericalTestFactoryImp> numericalTestFactory = NumericalTestFactoryImp::getNewInstance(configReader->getConfigData()); - - std::vector<std::shared_ptr<TestSimulation> > testSim = numericalTestFactory->getTestSimulations(); - std::shared_ptr<TestQueue> testQueue = numericalTestFactory->getTestQueue(); - std::shared_ptr<LogFileQueue> logFileQueue = numericalTestFactory->getLogFileQueue(); - - std::shared_ptr<VirtualFluidSimulationFactory> factory = VirtualFluidSimulationFactoryImp::getNewInstance(); - std::vector<std::shared_ptr<VirtualFluidSimulation> > vfSimulations = factory->makeVirtualFluidSimulations(testSim); - - for (int i = 0; i < vfSimulations.size(); i++) - vfSimulations.at(i)->run(); - - testQueue->makeFinalOutput(); - logFileQueue->writeLogFiles(); - - return testQueue->getNumberOfFailedTests() > 0; + return result; } int main(int argc, char **argv) { - MPI_Init(&argc, &argv); - - //validateTestSuite(); + MPI_Init(&argc, &argv); - bool tests_passed{false}; + auto tests_passed = TestSuiteResult::FAILED; - if (argc > 1) + if (argc > 1) tests_passed = startNumericalTests(argv[1]); - else - std::cout << "Configuration file must be set!: lbmgm <config file>" << std::endl << std::flush; + else + std::cout << "Configuration file must be set!: lbmgm <config file>" << std::endl << std::flush; MPI_Finalize(); - return tests_passed; + return tests_passed; } diff --git a/cpu.cmake b/cpu.cmake index e5b77c8a43c40c4987f3d2d00d34833c7cb27c61..1e2b159d4e6fd47bce05dce3eb6b8d955723087c 100644 --- a/cpu.cmake +++ b/cpu.cmake @@ -82,9 +82,7 @@ add_subdirectory(${VF_THIRD_DIR}/MuParser) add_subdirectory(src/cpu/VirtualFluidsCore) if(BUILD_VF_PYTHON_BINDINGS) - add_subdirectory(${VF_THIRD_DIR}/pybind11/pybind11-2.6.0) add_subdirectory(src/cpu/simulationconfig) - add_subdirectory(src/cpu/pythonbindings) endif() if(USE_LIGGGHTS) diff --git a/gpu.cmake b/gpu.cmake index ead5e26bca299819513e4f7639d5431d8973c927..5b175ca2a5fe7d289bd948e905ada612413333d2 100644 --- a/gpu.cmake +++ b/gpu.cmake @@ -1,9 +1,3 @@ -if(BUILD_NUMERIC_TESTS) - set(CMAKE_CXX_STANDARD 17) -endif() - -############################################################# - IF( BUILD_VF_GKS ) # only use this with device of CC larger than 6.0 set(CMAKE_CUDA_FLAGS "-Xptxas=\"-v\"" CACHE STRING "" FORCE) @@ -31,18 +25,9 @@ add_subdirectory(src/gpu/GridGenerator) IF (BUILD_VF_GPU) add_subdirectory(src/gpu/VirtualFluids_GPU) - #add_subdirectory(targets/apps/LBM/lbmTest) - #add_subdirectory(targets/apps/LBM/metisTest) - #add_subdirectory(targets/apps/LBM/Basel) - #add_subdirectory(targets/apps/LBM/BaselNU) - #add_subdirectory(targets/apps/LBM/BaselMultiGPU) - add_subdirectory(apps/gpu/LBM/DrivenCavity) - add_subdirectory(apps/gpu/LBM/WTG_RUB) - #add_subdirectory(apps/gpu/LBM/gridGeneratorTest) - #add_subdirectory(apps/gpu/LBM/TGV_3D) - #add_subdirectory(apps/gpu/LBM/TGV_3D_MultiGPU) - add_subdirectory(apps/gpu/LBM/ActuatorLine) + add_subdirectory(apps/gpu/LBM/SphereGPU) + add_subdirectory(apps/gpu/LBM/BoundaryLayer) ELSE() MESSAGE( STATUS "exclude Virtual Fluids GPU." ) ENDIF() @@ -51,50 +36,13 @@ ENDIF() ### Virtual Fluids GKS ### ############################################################# - IF (BUILD_VF_GKS) add_subdirectory(src/gpu/GksMeshAdapter) add_subdirectory(src/gpu/GksVtkAdapter) add_subdirectory(src/gpu/GksGpu) - #add_subdirectory(targets/apps/GKS/gksTest) - #add_subdirectory(targets/apps/GKS/ChannelFlow) - - #add_subdirectory(targets/apps/GKS/ChannelFlowObstacle) - #add_subdirectory(targets/apps/GKS/ShearWave) - - #add_subdirectory(targets/apps/GKS/LiFuXu) - - #add_subdirectory(targets/apps/GKS/TaylorGreen3D) - #add_subdirectory(targets/apps/GKS/DrivenCavity3D) - #add_subdirectory(targets/apps/GKS/ThermalCavity) - - #add_subdirectory(targets/apps/GKS/ThermalCavityMultiGPU) - #add_subdirectory(targets/apps/GKS/DrivenCavityMultiGPU) - #add_subdirectory(targets/apps/GKS/RayleighBenardMultiGPU) - - #add_subdirectory(targets/apps/GKS/SalinasVazquez) - #add_subdirectory(targets/apps/GKS/BoundaryJet) - - #add_subdirectory(targets/apps/GKS/PropaneFlame) - #add_subdirectory(targets/apps/GKS/ConfinedCombustion) - #add_subdirectory(targets/apps/GKS/MethaneFlame) - - #add_subdirectory(targets/apps/GKS/Room) - #add_subdirectory(targets/apps/GKS/RoomMultiGPU) - #add_subdirectory(targets/apps/GKS/RoomFire) - #add_subdirectory(targets/apps/GKS/RoomFireExtended) - #add_subdirectory(targets/apps/GKS/ConcreteHeatFluxBCTest) - - #add_subdirectory(targets/apps/GKS/PoolFire) add_subdirectory(apps/gpu/GKS/Flame7cm) - #add_subdirectory(targets/apps/GKS/SandiaFlame_1m) - #add_subdirectory(targets/apps/GKS/Candle) - - #add_subdirectory(targets/apps/GKS/MultiGPU) - #add_subdirectory(targets/apps/GKS/MultiGPU_nD) - #add_subdirectory(targets/apps/GKS/SingleGPU) ELSE() MESSAGE( STATUS "exclude Virtual Fluids GKS." ) ENDIF() @@ -130,7 +78,7 @@ if(BUILD_NUMERIC_TESTS) endif() ############################################################# -### Annas Traffic Sim ### +### Annas Traffic Sim ### ############################################################# if(BUILD_VF_TRAFFIC) diff --git a/pythonbindings/CMakeLists.txt b/pythonbindings/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a84adef027fdfa2953e016693bb64570e48c1ef --- /dev/null +++ b/pythonbindings/CMakeLists.txt @@ -0,0 +1,24 @@ +project(VirtualFluidsPython LANGUAGES CUDA CXX) +IF(BUILD_VF_GPU) + pybind11_add_module(pyfluids src/VirtualFluidsModulesGPU.cpp) + set_source_files_properties(src/VirtualFluidsModulesGPU.cpp PROPERTIES LANGUAGE CUDA) + + target_link_libraries(pyfluids PRIVATE GridGenerator VirtualFluids_GPU basics lbmCuda logger) + target_include_directories(pyfluids PRIVATE ${VF_THIRD_DIR}/cuda_samples/) + +ENDIF() +IF(BUILD_VF_CPU) + pybind11_add_module(pyfluids src/VirtualFluidsModulesCPU.cpp) + pybind11_add_module(pymuparser src/muParser.cpp) + + # TODO: Move this to MuParser CMakeLists.txt + set_target_properties(muparser PROPERTIES POSITION_INDEPENDENT_CODE ON) + + target_compile_definitions(pyfluids PRIVATE VF_METIS VF_MPI) + target_compile_definitions(pymuparser PRIVATE VF_METIS VF_MPI) + + target_link_libraries(pyfluids PRIVATE simulationconfig VirtualFluidsCore muparser basics) + target_link_libraries(pymuparser PRIVATE muparser) +ENDIF() +target_include_directories(pyfluids PRIVATE ${CMAKE_SOURCE_DIR}/src/) +target_include_directories(pyfluids PRIVATE ${CMAKE_BINARY_DIR}) \ No newline at end of file diff --git a/pythonbindings/src/VirtualFluidsModulesCPU.cpp b/pythonbindings/src/VirtualFluidsModulesCPU.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2fba3da494f568f7d0d0a117a579a45c9c1b9245 --- /dev/null +++ b/pythonbindings/src/VirtualFluidsModulesCPU.cpp @@ -0,0 +1,12 @@ +#include <pybind11/pybind11.h> +#include "cpu/cpu.cpp" + +namespace py_bindings +{ + namespace py = pybind11; + + PYBIND11_MODULE(pyfluids, m) + { + cpu::makeModule(m); + } +} \ No newline at end of file diff --git a/pythonbindings/src/VirtualFluidsModulesGPU.cpp b/pythonbindings/src/VirtualFluidsModulesGPU.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b96971caf381faada76ee676cf60469492d055c2 --- /dev/null +++ b/pythonbindings/src/VirtualFluidsModulesGPU.cpp @@ -0,0 +1,19 @@ +#include <pybind11/pybind11.h> +#include "basics/basics.cpp" +#include "lbm/lbm.cpp" +#include "gpu/gpu.cpp" +#include "logger/logger.cpp" + +namespace py_bindings +{ + namespace py = pybind11; + + PYBIND11_MODULE(pyfluids, m) + { + basics::makeModule(m); + gpu::makeModule(m); + lbm::makeModule(m); + logging::makeModule(m); + py::add_ostream_redirect(m, "ostream_redirect"); + } +} \ No newline at end of file diff --git a/pythonbindings/src/basics/basics.cpp b/pythonbindings/src/basics/basics.cpp new file mode 100644 index 0000000000000000000000000000000000000000..381e345d78226b25ec3a77a14340d2ef1171c8c9 --- /dev/null +++ b/pythonbindings/src/basics/basics.cpp @@ -0,0 +1,20 @@ +#include <pybind11/pybind11.h> +#include "submodules/logger.cpp" +#include "submodules/configuration_file.cpp" +#include "submodules/lbm_or_gks.cpp" + +namespace basics +{ + namespace py = pybind11; + + py::module makeModule(py::module_ &parentModule) + { + py::module basicsModule = parentModule.def_submodule("basics"); + + logger::makeModule(basicsModule); + configuration::makeModule(basicsModule); + lbmOrGks::makeModule(basicsModule); + + return basicsModule; + } +} \ No newline at end of file diff --git a/pythonbindings/src/basics/submodules/configuration_file.cpp b/pythonbindings/src/basics/submodules/configuration_file.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f5a2f87135a17f5eda34a7467d95f9db6b1c21d1 --- /dev/null +++ b/pythonbindings/src/basics/submodules/configuration_file.cpp @@ -0,0 +1,14 @@ +#include <pybind11/pybind11.h> +#include <basics/config/ConfigurationFile.h> + +namespace configuration +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::class_<vf::basics::ConfigurationFile>(parentModule, "ConfigurationFile") + .def(py::init<>()) + .def("load", &vf::basics::ConfigurationFile::load); + } +} \ No newline at end of file diff --git a/pythonbindings/src/basics/submodules/lbm_or_gks.cpp b/pythonbindings/src/basics/submodules/lbm_or_gks.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ed1deeca62fc57b7f44499b306e9f99b7f990604 --- /dev/null +++ b/pythonbindings/src/basics/submodules/lbm_or_gks.cpp @@ -0,0 +1,14 @@ +#include <pybind11/pybind11.h> +#include "basics/Core/LbmOrGks.h" + +namespace lbmOrGks +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::enum_<LbmOrGks>(parentModule, "LbmOrGks") + .value("LBM", LbmOrGks::LBM) + .value("GKS", LbmOrGks::GKS); + } +} \ No newline at end of file diff --git a/pythonbindings/src/basics/submodules/logger.cpp b/pythonbindings/src/basics/submodules/logger.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d46648e349b44243581e083f3561e8a13648f3b2 --- /dev/null +++ b/pythonbindings/src/basics/submodules/logger.cpp @@ -0,0 +1,36 @@ +#include <pybind11/pybind11.h> +#include <pybind11/iostream.h> +#include <basics/Core/Logger/Logger.h> +#include <basics/Core/Logger/implementations/LoggerImp.h> + +namespace logger +{ + namespace py = pybind11; + + py::module makeModule(py::module_ &parentModule) + { + py::module loggerModule = parentModule.def_submodule("logger"); + + py::class_<logging::Logger>(loggerModule, "Logger") + .def("add_stdout", [](){ + logging::Logger::addStream(&std::cout); + }) + .def("set_debug_level", &logging::Logger::setDebugLevel) + .def("time_stamp", &logging::Logger::timeStamp) + .def("enable_printed_rank_numbers", &logging::Logger::enablePrintedRankNumbers); + + loggerModule.attr("log") = logging::out; + py::enum_<logging::Logger::Level>(loggerModule, "Level") + .value("INFO_LOW", logging::Logger::Level::INFO_LOW) + .value("INFO_INTERMEDIATE", logging::Logger::Level::INFO_INTERMEDIATE) + .value("INFO_HIGH", logging::Logger::Level::INFO_HIGH) + .value("WARNING", logging::Logger::Level::WARNING) + .value("LOGGER_ERROR", logging::Logger::Level::LOGGER_ERROR); + + py::enum_<logging::Logger::TimeStamp>(loggerModule, "TimeStamp") + .value("ENABLE", logging::Logger::TimeStamp::ENABLE) + .value("DISABLE", logging::Logger::TimeStamp::DISABLE); + + return loggerModule; + } +} \ No newline at end of file diff --git a/pythonbindings/src/cpu/cpu.cpp b/pythonbindings/src/cpu/cpu.cpp new file mode 100644 index 0000000000000000000000000000000000000000..554de53b47446366693aed31d534f6145ebea8ba --- /dev/null +++ b/pythonbindings/src/cpu/cpu.cpp @@ -0,0 +1,23 @@ +#include <pybind11/pybind11.h> +#include "submodules/boundaryconditions.cpp" +#include "submodules/simulationconfig.cpp" +#include "submodules/geometry.cpp" +#include "submodules/kernel.cpp" +#include "submodules/simulationparameters.cpp" +#include "submodules/writer.cpp" + +namespace cpu +{ + namespace py = pybind11; + py::module makeModule(py::module_ &parentModule) + { + py::module cpuModule = parentModule.def_submodule("cpu"); + boundaryconditions::makeModule(cpuModule); + simulation::makeModule(cpuModule); + geometry::makeModule(cpuModule); + kernel::makeModule(cpuModule); + parameters::makeModule(cpuModule); + writer::makeModule(cpuModule); + return cpuModule; + } +} \ No newline at end of file diff --git a/pythonbindings/src/cpu/submodules/boundaryconditions.cpp b/pythonbindings/src/cpu/submodules/boundaryconditions.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3bff7bc069ca20fe1c0cf3d1847b9714e0381505 --- /dev/null +++ b/pythonbindings/src/cpu/submodules/boundaryconditions.cpp @@ -0,0 +1,64 @@ +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> +#include <BoundaryConditions/DensityBCAdapter.h> +#include <BoundaryConditions/NonReflectingOutflowBCAlgorithm.h> +#include <BoundaryConditions/BCAdapter.h> +#include <BoundaryConditions/NoSlipBCAdapter.h> +#include <BoundaryConditions/VelocityBCAdapter.h> +#include <BoundaryConditions/NoSlipBCAlgorithm.h> +#include <BoundaryConditions/VelocityBCAlgorithm.h> +#include <BoundaryConditions/HighViscosityNoSlipBCAlgorithm.h> + +namespace boundaryconditions +{ + namespace py = pybind11; + using namespace py::literals; + + template<class adapter, class algorithm, + class = std::enable_if_t<std::is_base_of<BCAdapter, adapter>::value>, + class = std::enable_if_t<std::is_base_of<BCAlgorithm, algorithm>::value>> + class PyBoundaryCondition : public adapter + { + public: + template<typename ...Args> + PyBoundaryCondition(Args &&... args) : adapter(std::forward<Args>(args)...) + { + this->setBcAlgorithm(std::make_shared<algorithm>()); + } + }; + + template<class adapter, class algorithm> + using bc_class = py::class_<PyBoundaryCondition<adapter, algorithm>, BCAdapter, + std::shared_ptr<PyBoundaryCondition<adapter, algorithm>>>; + + void makeModule(py::module_ &parentModule) + { + py::module_ bcModule = parentModule.def_submodule("boundaryconditions"); + + auto _ = py::class_<BCAdapter, std::shared_ptr<BCAdapter>>(bcModule, "BCAdapter"); + + bc_class<NoSlipBCAdapter, NoSlipBCAlgorithm>(bcModule, "NoSlipBoundaryCondition") + .def(py::init()); + + bc_class<NoSlipBCAdapter, HighViscosityNoSlipBCAlgorithm>(bcModule, "HighViscosityNoSlipBoundaryCondition") + .def(py::init()); + + bc_class<VelocityBCAdapter, VelocityBCAlgorithm>(bcModule, "VelocityBoundaryCondition") + .def(py::init()) + .def(py::init<bool &, bool &, bool &, mu::Parser &, double &, double &>(), + "vx1"_a, "vx2"_a, "vx3"_a, + "function"_a, "start_time"_a, "end_time"_a) + .def(py::init<bool &, bool &, bool &, mu::Parser &, mu::Parser &, mu::Parser &, double &, double &>(), + "vx1"_a, "vx2"_a, "vx3"_a, + "function_vx1"_a, "function_vx2"_a, "function_vx2"_a, + "start_time"_a, "end_time"_a) + .def(py::init<double &, double &, double &, double &, double &, double &, double &, double &, double &>(), + "vx1"_a, "vx1_start_time"_a, "vx1_end_time"_a, + "vx2"_a, "vx2_start_time"_a, "vx2_end_time"_a, + "vx3"_a, "vx3_start_time"_a, "vx3_end_time"_a); + + bc_class<DensityBCAdapter, NonReflectingOutflowBCAlgorithm>(bcModule, "NonReflectingOutflow") + .def(py::init()); + } + +} \ No newline at end of file diff --git a/pythonbindings/src/cpu/submodules/geometry.cpp b/pythonbindings/src/cpu/submodules/geometry.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b7ff4dd761258d41687589d2dd89c3479093753e --- /dev/null +++ b/pythonbindings/src/cpu/submodules/geometry.cpp @@ -0,0 +1,84 @@ +#include <pybind11/pybind11.h> +#include <geometry3d/GbPoint3D.h> +#include <geometry3d/GbObject3D.h> +#include <geometry3d/GbCuboid3D.h> +#include <geometry3d/GbLine3D.h> +#include <Interactors/Interactor3D.h> + + +namespace geometry +{ + namespace py = pybind11; + + template<class GeoObject> + using py_geometry = py::class_<GeoObject, GbObject3D, std::shared_ptr<GeoObject>>; + + std::string GbPoint3D_repr_(const GbPoint3D &instance) + { + std::ostringstream stream; + stream << "<GbPoint3D" + << " x1: " << instance.getX1Coordinate() + << " x2: " << instance.getX2Coordinate() + << " x3: " << instance.getX3Coordinate() << ">"; + + return stream.str(); + } + + void makeModule(py::module_ &parentModule) + { + py::module geometry = parentModule.def_submodule("geometry"); + + py::class_<GbObject3D, std::shared_ptr<GbObject3D>>(geometry, "GbObject3D"); + + py_geometry<GbPoint3D>(geometry, "GbPoint3D") + .def(py::init()) + .def(py::init<double &, double &, double &>()) + .def(py::init<GbPoint3D *>()) + .def_property("x1", &GbPoint3D::getX1Coordinate, &GbPoint3D::setX1) + .def_property("x2", &GbPoint3D::getX2Coordinate, &GbPoint3D::setX2) + .def_property("x3", &GbPoint3D::getX3Coordinate, &GbPoint3D::setX3) + .def("get_distance", &GbPoint3D::getDistance) + .def("__repr__", &GbPoint3D_repr_); + + py_geometry<GbCuboid3D>(geometry, "GbCuboid3D") + .def(py::init()) + .def(py::init<double &, double &, double &, double &, double &, double &>()) + .def(py::init<GbPoint3D *, GbPoint3D *>()) + .def(py::init<GbCuboid3D *>()) + .def_property("point1", &GbCuboid3D::getPoint1, &GbCuboid3D::setPoint1) + .def_property("point2", &GbCuboid3D::getPoint2, &GbCuboid3D::setPoint2) + .def("__repr__", [&](GbCuboid3D &instance) + { + std::ostringstream stream; + stream << "<GbCuboid3D" << std::endl + << "point1: " << GbPoint3D_repr_(instance.getPoint1()) << std::endl + << "point2: " << GbPoint3D_repr_(instance.getPoint2()) << ">"; + return stream.str(); + }); + + py_geometry<GbLine3D>(geometry, "GbLine3D") + .def(py::init()) + .def(py::init<GbPoint3D *, GbPoint3D *>()) + .def(py::init<GbLine3D>()) + .def_property("point1", &GbLine3D::getPoint1, &GbLine3D::setPoint1) + .def_property("point2", &GbLine3D::getPoint2, &GbLine3D::setPoint2) + .def("__repr__", [&](GbLine3D &instance) + { + std::ostringstream stream; + stream << "<GbLine3D" << std::endl + << "point1: " << GbPoint3D_repr_(instance.getPoint1()) << std::endl + << "point2: " << GbPoint3D_repr_(instance.getPoint2()) << ">"; + return stream.str(); + }); + + + py::class_<Interactor3D, std::shared_ptr<Interactor3D>>(geometry, "State") + .def_readonly_static("SOLID", &Interactor3D::SOLID) + .def_readonly_static("INVERSESOLID", &Interactor3D::INVERSESOLID) + .def_readonly_static("TIMEDEPENDENT", &Interactor3D::TIMEDEPENDENT) + .def_readonly_static("FLUID", &Interactor3D::FLUID) + .def_readonly_static("MOVEABLE", &Interactor3D::MOVEABLE) + .def_readonly_static("CHANGENOTNECESSARY", &Interactor3D::CHANGENOTNECESSARY); + } + +} \ No newline at end of file diff --git a/pythonbindings/src/cpu/submodules/kernel.cpp b/pythonbindings/src/cpu/submodules/kernel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fb291790632cc2041410f60a14fca8d966283343 --- /dev/null +++ b/pythonbindings/src/cpu/submodules/kernel.cpp @@ -0,0 +1,45 @@ +#include <memory> +#include <pybind11/pybind11.h> +#include <simulationconfig/KernelFactory.h> +#include <simulationconfig/KernelConfigStructs.h> + +namespace kernel +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::module kernelModule = parentModule.def_submodule("kernel"); + + py::enum_<KernelFactory::KernelType>(kernelModule, "KernelType") + .value("BGK", KernelFactory::BGK) + .value("CompressibleCumulantFourthOrderViscosity", + KernelFactory::COMPRESSIBLE_CUMULANT_4TH_ORDER_VISCOSITY); + + py::class_<LBMKernelConfiguration, std::shared_ptr<LBMKernelConfiguration>>(kernelModule, "LBMKernel") + .def(py::init<KernelFactory::KernelType>()) + .def_readwrite("type", &LBMKernelConfiguration::kernelType) + .def_readwrite("use_forcing", &LBMKernelConfiguration::useForcing) + .def_readwrite("forcing_in_x1", &LBMKernelConfiguration::forcingX1) + .def_readwrite("forcing_in_x2", &LBMKernelConfiguration::forcingX2) + .def_readwrite("forcing_in_x3", &LBMKernelConfiguration::forcingX3) + .def("set_forcing", [](LBMKernelConfiguration &kernelConfig, double x1, double x2, double x3) + { + kernelConfig.forcingX1 = x1; + kernelConfig.forcingX2 = x2; + kernelConfig.forcingX3 = x3; + }) + .def("__repr__", [](LBMKernelConfiguration &kernelConfig) + { + std::ostringstream stream; + stream << "<" << kernelConfig.kernelType << std::endl + << "Use forcing: " << kernelConfig.useForcing << std::endl + << "Forcing in x1: " << kernelConfig.forcingX1 << std::endl + << "Forcing in x2: " << kernelConfig.forcingX2 << std::endl + << "Forcing in x3: " << kernelConfig.forcingX3 << ">" << std::endl; + + return stream.str(); + }); + } + +} \ No newline at end of file diff --git a/pythonbindings/src/cpu/submodules/simulationconfig.cpp b/pythonbindings/src/cpu/submodules/simulationconfig.cpp new file mode 100644 index 0000000000000000000000000000000000000000..60af4e36af4dca67e9262dd9f5ee1f46d5b7bb58 --- /dev/null +++ b/pythonbindings/src/cpu/submodules/simulationconfig.cpp @@ -0,0 +1,22 @@ +#include <pybind11/pybind11.h> +#include <simulationconfig/Simulation.h> + +namespace simulation +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::class_<Simulation, std::shared_ptr<Simulation>>(parentModule, "Simulation") + .def(py::init()) + .def("set_writer", &Simulation::setWriterConfiguration) + .def("set_grid_parameters", &Simulation::setGridParameters) + .def("set_physical_parameters", &Simulation::setPhysicalParameters) + .def("set_runtime_parameters", &Simulation::setRuntimeParameters) + .def("set_kernel_config", &Simulation::setKernelConfiguration) + .def("add_object", &Simulation::addObject) + .def("add_bc_adapter", &Simulation::addBCAdapter) + .def("run_simulation", &Simulation::run); + } + +} \ No newline at end of file diff --git a/pythonbindings/src/cpu/submodules/simulationparameters.cpp b/pythonbindings/src/cpu/submodules/simulationparameters.cpp new file mode 100644 index 0000000000000000000000000000000000000000..acc272f2ee412cfbafd9007b4b18610cfd0a1e9b --- /dev/null +++ b/pythonbindings/src/cpu/submodules/simulationparameters.cpp @@ -0,0 +1,59 @@ +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> +#include <complex> +#include <simulationconfig/SimulationParameters.h> + +namespace parameters +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::module parametersModule = parentModule.def_submodule("parameters"); + + py::class_<PhysicalParameters, std::shared_ptr<PhysicalParameters>>(parametersModule, "PhysicalParameters") + .def(py::init()) + .def_readwrite("bulk_viscosity_factor", &PhysicalParameters::bulkViscosityFactor, + "The viscosity of the fluid will be multiplied with this factor to calculate its bulk viscosity. Default is 1.0") + .def_readwrite("lattice_viscosity", &PhysicalParameters::latticeViscosity, "Lattice viscosity"); + + py::class_<GridParameters, std::shared_ptr<GridParameters>>(parametersModule, "GridParameters") + .def(py::init()) + .def_readwrite("node_distance", &GridParameters::nodeDistance) + .def_readwrite("reference_direction_index", &GridParameters::referenceDirectionIndex) + .def_readwrite("number_of_nodes_per_direction", &GridParameters::numberOfNodesPerDirection) + .def_readwrite("blocks_per_direction", &GridParameters::blocksPerDirection) + .def_readwrite("periodic_boundary_in_x1", &GridParameters::periodicBoundaryInX1) + .def_readwrite("periodic_boundary_in_x2", &GridParameters::periodicBoundaryInX2) + .def_readwrite("periodic_boundary_in_x3", &GridParameters::periodicBoundaryInX3) + .def_property_readonly("bounding_box", &GridParameters::boundingBox); + + py::class_<BoundingBox, std::shared_ptr<BoundingBox>>(parametersModule, "BoundingBox") + .def_readonly("min_x1", &BoundingBox::minX1) + .def_readonly("min_x2", &BoundingBox::minX2) + .def_readonly("min_x3", &BoundingBox::minX3) + .def_readonly("max_x1", &BoundingBox::maxX1) + .def_readonly("max_x2", &BoundingBox::maxX2) + .def_readonly("max_x3", &BoundingBox::maxX3) + .def("__repr__", [](BoundingBox &self) + { + std::ostringstream stream; + stream << "<BoundingBox" << std::endl + << "min x1: " << self.minX1 << std::endl + << "min x2: " << self.minX2 << std::endl + << "min x3: " << self.minX3 << std::endl + << "max x1: " << self.maxX1 << std::endl + << "max x2: " << self.maxX2 << std::endl + << "max x3: " << self.maxX3 << std::endl << ">"; + + return stream.str(); + }); + + py::class_<RuntimeParameters, std::shared_ptr<RuntimeParameters>>(parametersModule, "RuntimeParameters") + .def(py::init()) + .def_readwrite("number_of_timesteps", &RuntimeParameters::numberOfTimeSteps) + .def_readwrite("timestep_log_interval", &RuntimeParameters::timeStepLogInterval) + .def_readwrite("number_of_threads", &RuntimeParameters::numberOfThreads); + + } +} \ No newline at end of file diff --git a/pythonbindings/src/cpu/submodules/writer.cpp b/pythonbindings/src/cpu/submodules/writer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d5ec527a27caf63d9a3066c51e1f675b307fe0b2 --- /dev/null +++ b/pythonbindings/src/cpu/submodules/writer.cpp @@ -0,0 +1,21 @@ +#include <pybind11/pybind11.h> +#include <simulationconfig/WriterConfiguration.h> + +namespace writer +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::module writerModule = parentModule.def_submodule("writer"); + + py::enum_<OutputFormat>(writerModule, "OutputFormat") + .value("ASCII", OutputFormat::ASCII) + .value("BINARY", OutputFormat::BINARY); + + py::class_<WriterConfiguration>(writerModule, "Writer") + .def(py::init()) + .def_readwrite("output_path", &WriterConfiguration::outputPath) + .def_readwrite("output_format", &WriterConfiguration::outputFormat); + } +} \ No newline at end of file diff --git a/pythonbindings/src/gpu/gpu.cpp b/pythonbindings/src/gpu/gpu.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dc110cd5e19a9aad4937f9c2133ddf74c0ddf9bf --- /dev/null +++ b/pythonbindings/src/gpu/gpu.cpp @@ -0,0 +1,32 @@ +#include <pybind11/pybind11.h> +#include "submodules/actuator_line.cpp" +#include "submodules/pre_collision_interactor.cpp" +#include "submodules/simulation.cpp" +#include "submodules/parameter.cpp" +#include "submodules/boundary_conditions.cpp" +#include "submodules/communicator.cpp" +#include "submodules/cuda_memory_manager.cpp" +#include "submodules/grid_provider.cpp" +#include "submodules/grid_generator.cpp" +#include "submodules/probes.cpp" + +namespace gpu +{ + namespace py = pybind11; + + py::module makeModule(py::module_ &parentModule) + { + py::module gpuModule = parentModule.def_submodule("gpu"); + simulation::makeModule(gpuModule); + parameter::makeModule(gpuModule); + pre_collision_interactor::makeModule(gpuModule); + actuator_line::makeModule(gpuModule); + boundary_conditions::makeModule(gpuModule); + communicator::makeModule(gpuModule); + cuda_memory_manager::makeModule(gpuModule); + grid_provider::makeModule(gpuModule); + probes::makeModule(gpuModule); + grid_generator::makeModule(gpuModule); + return gpuModule; + } +} \ No newline at end of file diff --git a/pythonbindings/src/gpu/submodules/actuator_line.cpp b/pythonbindings/src/gpu/submodules/actuator_line.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3207fadbc37df38e53e00adcb9a86f0b8e82ba98 --- /dev/null +++ b/pythonbindings/src/gpu/submodules/actuator_line.cpp @@ -0,0 +1,72 @@ +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> +#include <pybind11/numpy.h> +#include <gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorLine.h> +#include <gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h> +class PyActuatorLine : public ActuatorLine +{ +public: + using ActuatorLine::ActuatorLine; // Inherit constructors + void calcBladeForces() override + { + PYBIND11_OVERRIDE_NAME(void, ActuatorLine, "calc_blade_forces", calcBladeForces,); + } +}; +namespace actuator_line +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + using arr = py::array_t<float, py::array::c_style>; + + py::class_<ActuatorLine, PreCollisionInteractor, PyActuatorLine, std::shared_ptr<ActuatorLine>>(parentModule, "ActuatorLine", py::dynamic_attr()) + .def(py::init< const uint, + const real, + const uint, + const real, + real, real, real, + const real, + int, + const real, + const real>(), + "n_blades", + "density", + "n_blade_nodes", + "epsilon", + "turbine_pos_x", "turbine_pos_y", "turbine_pos_z", + "diameter", + "level", + "delta_t", + "delta_x") + .def_property("omega", &ActuatorLine::getOmega, &ActuatorLine::setOmega) + .def_property("azimuth", &ActuatorLine::getAzimuth, &ActuatorLine::setAzimuth) + .def_property("yaw", &ActuatorLine::getYaw, &ActuatorLine::setYaw) + .def_property_readonly("n_blades", &ActuatorLine::getNBlades) + .def_property_readonly("n_blade_nodes", &ActuatorLine::getNBladeNodes) + .def_property_readonly("n_nodes", &ActuatorLine::getNNodes) + .def_property_readonly("n_indices", &ActuatorLine::getNIndices) + .def_property_readonly("density", &ActuatorLine::getDensity) + .def_property_readonly("position_x", &ActuatorLine::getPositionX) + .def_property_readonly("position_y", &ActuatorLine::getPositionY) + .def_property_readonly("position_z", &ActuatorLine::getPositionZ) + .def_property_readonly("position", [](ActuatorLine& al){ real position[3] = {al.getPositionX(), al.getPositionY(), al.getPositionZ()}; return arr(3, position); } ) + .def("get_radii", [](ActuatorLine& al){ return arr(al.getNBladeNodes(), al.getBladeRadii()); } ) + .def("get_blade_coords_x", [](ActuatorLine& al){ return arr({al.getNBlades(), al.getNBladeNodes()}, al.getBladeCoordsX()); } ) + .def("get_blade_coords_y", [](ActuatorLine& al){ return arr({al.getNBlades(), al.getNBladeNodes()}, al.getBladeCoordsY()); } ) + .def("get_blade_coords_z", [](ActuatorLine& al){ return arr({al.getNBlades(), al.getNBladeNodes()}, al.getBladeCoordsZ()); } ) + .def("get_blade_velocities_x", [](ActuatorLine& al){ return arr({al.getNBlades(), al.getNBladeNodes()}, al.getBladeVelocitiesX()); } ) + .def("get_blade_velocities_y", [](ActuatorLine& al){ return arr({al.getNBlades(), al.getNBladeNodes()}, al.getBladeVelocitiesY()); } ) + .def("get_blade_velocities_z", [](ActuatorLine& al){ return arr({al.getNBlades(), al.getNBladeNodes()}, al.getBladeVelocitiesZ()); } ) + .def("get_blade_forces_x", [](ActuatorLine& al){ return arr({al.getNBlades(), al.getNBladeNodes()}, al.getBladeForcesX()); } ) + .def("get_blade_forces_y", [](ActuatorLine& al){ return arr({al.getNBlades(), al.getNBladeNodes()}, al.getBladeForcesY()); } ) + .def("get_blade_forces_z", [](ActuatorLine& al){ return arr({al.getNBlades(), al.getNBladeNodes()}, al.getBladeForcesZ()); } ) + .def("set_blade_coords", [](ActuatorLine& al, arr coordsX, arr coordsY, arr coordsZ){ + al.setBladeCoords(static_cast<float *>(coordsX.request().ptr), static_cast<float *>(coordsY.request().ptr), static_cast<float *>(coordsZ.request().ptr)); } ) + .def("set_blade_velocities", [](ActuatorLine& al, arr velocitiesX, arr velocitiesY, arr velocitiesZ){ + al.setBladeVelocities(static_cast<float *>(velocitiesX.request().ptr), static_cast<float *>(velocitiesY.request().ptr), static_cast<float *>(velocitiesZ.request().ptr)); } ) + .def("set_blade_forces", [](ActuatorLine& al, arr forcesX, arr forcesY, arr forcesZ){ + al.setBladeForces(static_cast<float *>(forcesX.request().ptr), static_cast<float *>(forcesY.request().ptr), static_cast<float *>(forcesZ.request().ptr)); } ) + .def("calc_blade_forces", &ActuatorLine::calcBladeForces); + } +} \ No newline at end of file diff --git a/pythonbindings/src/gpu/submodules/boundary_conditions.cpp b/pythonbindings/src/gpu/submodules/boundary_conditions.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8f941a8705c225275d25291205ebdaeef8de5c9e --- /dev/null +++ b/pythonbindings/src/gpu/submodules/boundary_conditions.cpp @@ -0,0 +1,20 @@ +#include <pybind11/pybind11.h> +#include <gpu/GridGenerator/grid/BoundaryConditions/Side.h> + +namespace boundary_conditions +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::enum_<SideType>(parentModule, "SideType") + .value("MX", SideType::MX) + .value("PX", SideType::PX) + .value("MY", SideType::MY) + .value("PY", SideType::PY) + .value("MZ", SideType::MZ) + .value("PZ", SideType::PZ) + .value("GEOMETRY", SideType::GEOMETRY) + .export_values(); + } +} \ No newline at end of file diff --git a/pythonbindings/src/gpu/submodules/communicator.cpp b/pythonbindings/src/gpu/submodules/communicator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..edb36e2c2f774903590a16a0b406c721662827b1 --- /dev/null +++ b/pythonbindings/src/gpu/submodules/communicator.cpp @@ -0,0 +1,15 @@ +#include <pybind11/pybind11.h> +#include <gpu/VirtualFluids_GPU/Communication/Communicator.h> + +namespace communicator +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::class_<vf::gpu::Communicator, std::unique_ptr<vf::gpu::Communicator, py::nodelete>>(parentModule, "Communicator") + .def("get_instance", &vf::gpu::Communicator::getInstance, py::return_value_policy::reference) + .def("get_number_of_process", &vf::gpu::Communicator::getNummberOfProcess) + .def("get_pid", &vf::gpu::Communicator::getPID); + } +} \ No newline at end of file diff --git a/pythonbindings/src/gpu/submodules/cuda_memory_manager.cpp b/pythonbindings/src/gpu/submodules/cuda_memory_manager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bf27080cb3cd050343ba42b0571827ed58870cfd --- /dev/null +++ b/pythonbindings/src/gpu/submodules/cuda_memory_manager.cpp @@ -0,0 +1,15 @@ +#include <pybind11/pybind11.h> +#include <gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h> +#include <gpu/VirtualFluids_GPU/Parameter/Parameter.h> + + +namespace cuda_memory_manager +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::class_<CudaMemoryManager, std::shared_ptr<CudaMemoryManager>>(parentModule, "CudaMemoryManager") + .def(py::init<std::shared_ptr<Parameter>>(), "parameter"); + } +} \ No newline at end of file diff --git a/pythonbindings/src/gpu/submodules/grid_generator.cpp b/pythonbindings/src/gpu/submodules/grid_generator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..579c06c4e00cae9646ced8b554d71631eeb7e793 --- /dev/null +++ b/pythonbindings/src/gpu/submodules/grid_generator.cpp @@ -0,0 +1,68 @@ +#include <pybind11/pybind11.h> +#include "gpu/GridGenerator/geometries/Object.h" +#include "gpu/GridGenerator/geometries/BoundingBox/BoundingBox.h" +#include "gpu/GridGenerator/geometries/Conglomerate/Conglomerate.h" +#include "gpu/GridGenerator/geometries/Cuboid/Cuboid.h" +#include "gpu/GridGenerator/geometries/Sphere/Sphere.h" +#include "gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h" +#include "gpu/GridGenerator/grid/GridFactory.h" +#include "gpu/GridGenerator/grid/GridBuilder/GridBuilder.h" +#include "gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h" +#include "gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" + +namespace grid_generator +{ + namespace py = pybind11; + py::module makeModule(py::module_ &parentModule) + { + py::module gridGeneratorModule = parentModule.def_submodule("grid_generator"); + + py::class_<GridFactory, std::shared_ptr<GridFactory>>(gridGeneratorModule, "GridFactory") + .def("make", &GridFactory::make, py::return_value_policy::reference); + + py::class_<BoundingBox>(gridGeneratorModule, "BoundingBox") + .def(py::init<real, real, real, real, real, real>(),"min_x","max_x","min_y","max_y","min_z","max_z"); + + py::class_<Object, std::shared_ptr<Object>>(gridGeneratorModule, "Object"); + + py::class_<Conglomerate, Object, std::shared_ptr<Conglomerate>>(gridGeneratorModule, "Conglomerate") + .def("make_shared", &Conglomerate::makeShared, py::return_value_policy::reference) + .def("add", &Conglomerate::add) + .def("subtract", &Conglomerate::subtract); + + py::class_<Cuboid, Object, std::shared_ptr<Cuboid>>(gridGeneratorModule, "Cuboid") + .def(py::init<const double&, const double&, const double&, const double&, const double&, const double&>(), + "min_x1", "min_x2", "min_x3", "max_x1", "max_x2", "max_x3"); + + py::class_<Sphere, Object, std::shared_ptr<Sphere>>(gridGeneratorModule, "Sphere") + .def("make_shared", &Sphere::makeShared, py::return_value_policy::reference); + + py::class_<TriangularMesh, Object, std::shared_ptr<TriangularMesh>>(gridGeneratorModule, "TriangularMesh") + .def("make", &TriangularMesh::make, py::return_value_policy::reference); + + py::class_<GridBuilder, std::shared_ptr<GridBuilder>>(gridGeneratorModule, "GridBuilder") + .def("get_number_of_grid_levels", &GridBuilder::getNumberOfGridLevels) + .def("get_grid", &GridBuilder::getGrid); + + py::class_<LevelGridBuilder, GridBuilder, std::shared_ptr<LevelGridBuilder>>(gridGeneratorModule, "LevelGridBuilder") + .def("get_grid", py::overload_cast<int, int>(&LevelGridBuilder::getGrid)) + .def("set_slip_boundary_condition", &LevelGridBuilder::setSlipBoundaryCondition) + .def("set_velocity_boundary_condition", &LevelGridBuilder::setVelocityBoundaryCondition) + .def("set_pressure_boundary_condition", &LevelGridBuilder::setPressureBoundaryCondition) + .def("set_periodic_boundary_condition", &LevelGridBuilder::setPeriodicBoundaryCondition) + .def("set_no_slip_boundary_condition", &LevelGridBuilder::setNoSlipBoundaryCondition) + .def("set_stress_boundary_condition", &LevelGridBuilder::setStressBoundaryCondition); + + py::class_<MultipleGridBuilder, LevelGridBuilder, std::shared_ptr<MultipleGridBuilder>>(gridGeneratorModule, "MultipleGridBuilder") + .def("make_shared", &MultipleGridBuilder::makeShared, py::return_value_policy::reference) + .def("add_coarse_grid", &MultipleGridBuilder::addCoarseGrid) + .def("add_grid", py::overload_cast<Object*>(&MultipleGridBuilder::addGrid)) + .def("add_grid", py::overload_cast<Object*, uint>(&MultipleGridBuilder::addGrid)) + .def("add_geometry", py::overload_cast<Object*>(&MultipleGridBuilder::addGeometry)) + .def("add_geometry", py::overload_cast<Object*, uint>(&MultipleGridBuilder::addGeometry)) + .def("get_number_of_levels", &MultipleGridBuilder::getNumberOfLevels) + .def("build_grids", &MultipleGridBuilder::buildGrids); + + return gridGeneratorModule; + } +} diff --git a/pythonbindings/src/gpu/submodules/grid_provider.cpp b/pythonbindings/src/gpu/submodules/grid_provider.cpp new file mode 100644 index 0000000000000000000000000000000000000000..02ff273e2cd1a2022943e19c9a48a447d9dfe54b --- /dev/null +++ b/pythonbindings/src/gpu/submodules/grid_provider.cpp @@ -0,0 +1,16 @@ +#include <pybind11/pybind11.h> +#include "gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" +// #include <gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h> +// #include <gpu/VirtualFluids_GPU/Parameter/Parameter.h> +// #include "gpu/GridGenerator/grid/GridBuilder/GridBuilder.h" + +namespace grid_provider +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::class_<GridProvider, std::shared_ptr<GridProvider>>(parentModule, "GridProvider") + .def("make_grid_generator", &GridProvider::makeGridGenerator, py::return_value_policy::reference); + } +} \ No newline at end of file diff --git a/pythonbindings/src/gpu/submodules/parameter.cpp b/pythonbindings/src/gpu/submodules/parameter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7b4e67f101e3928abbd4262557864ea1d0f45b02 --- /dev/null +++ b/pythonbindings/src/gpu/submodules/parameter.cpp @@ -0,0 +1,80 @@ +#include <pybind11/pybind11.h> +#include <pybind11/functional.h> +#include <pybind11/stl.h> +#include <gpu/VirtualFluids_GPU/Parameter/Parameter.h> +#include <basics/config/ConfigurationFile.h> +#include <gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h> + +namespace parameter +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::class_<Parameter, std::shared_ptr<Parameter>>(parentModule, "Parameter") + .def(py::init< + const vf::basics::ConfigurationFile&, + int, + int + >(), + "config_data", + "number_of_processes", + "my_ID") + .def("set_forcing", &Parameter::setForcing) + .def("set_diff_on", &Parameter::setDiffOn) + .def("set_comp_on", &Parameter::setCompOn) + .def("set_max_level", &Parameter::setMaxLevel) + .def("set_t_end", &Parameter::setTEnd) + .def("set_t_out", &Parameter::setTOut) + .def("set_t_start_out", &Parameter::setTStartOut) + .def("set_timestep_of_coarse_level", &Parameter::setTimestepOfCoarseLevel) + .def("set_output_path", &Parameter::setOutputPath) + .def("set_output_prefix", &Parameter::setOutputPrefix) + .def("set_f_name", &Parameter::setFName) + .def("set_print_files", &Parameter::setPrintFiles) + .def("set_temperature_init", &Parameter::setTemperatureInit) + .def("set_temperature_BC", &Parameter::setTemperatureBC) + .def("set_viscosity", &Parameter::setViscosity) + .def("set_velocity", &Parameter::setVelocity) + .def("set_viscosity_ratio", &Parameter::setViscosityRatio) + .def("set_velocity_ratio", &Parameter::setVelocityRatio) + .def("set_density_ratio", &Parameter::setDensityRatio) + .def("set_devices", &Parameter::setDevices) + .def("set_is_body_force", &Parameter::setIsBodyForce) + .def("set_use_AMD", &Parameter::setUseAMD) + .def("set_use_Wale", &Parameter::setUseWale) + .def("set_SGS_constant", &Parameter::setSGSConstant) + .def("set_main_kernel", &Parameter::setMainKernel) + .def("set_AD_kernel", &Parameter::setADKernel) + .def("set_use_AMD", &Parameter::setUseAMD) + .def("set_use_Wale", &Parameter::setUseWale) + .def("set_SGS_constant", &Parameter::setSGSConstant) + .def("set_initial_condition", [](Parameter ¶, std::function<std::vector<float>(real, real, real)> &init_func) + { + para.setInitialCondition([init_func](real coordX, real coordY, real coordZ, real& rho, real& vx, real& vy, real& vz) + { + std::vector<float> values = init_func(coordX, coordY, coordZ); + rho = values[0]; + vx = values[1]; + vy = values[2]; + vz = values[3]; + }); + }) + .def("add_actuator", &Parameter::addActuator) + .def("add_probe", &Parameter::addProbe) + .def("get_output_path", &Parameter::getOutputPath) + .def("get_output_prefix", &Parameter::getOutputPrefix) + .def("get_velocity", &Parameter::getVelocity) + .def("get_viscosity", &Parameter::getViscosity) + .def("get_velocity_ratio", &Parameter::getVelocityRatio) + .def("get_viscosity_ratio", &Parameter::getViscosityRatio) + .def("get_density_ratio", &Parameter::getDensityRatio) + .def("get_force_ratio", &Parameter::getForceRatio) + .def("get_use_AMD", &Parameter::getUseAMD) + .def("get_use_Wale", &Parameter::getUseWale) + .def("get_SGS_constant", &Parameter::getSGSConstant) + .def("get_is_body_force", &Parameter::getIsBodyForce) + .def("set_has_wall_model_monitor", &Parameter::setHasWallModelMonitor) + ; + } +} \ No newline at end of file diff --git a/pythonbindings/src/gpu/submodules/pre_collision_interactor.cpp b/pythonbindings/src/gpu/submodules/pre_collision_interactor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..362ee1a8ce6112cfa9543f1b254e10f3e35822a1 --- /dev/null +++ b/pythonbindings/src/gpu/submodules/pre_collision_interactor.cpp @@ -0,0 +1,12 @@ +#include <pybind11/pybind11.h> +#include <gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h> + +namespace pre_collision_interactor +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + py::class_<PreCollisionInteractor, std::shared_ptr<PreCollisionInteractor>>(parentModule, "PreCollisionInteractor"); + } +} \ No newline at end of file diff --git a/pythonbindings/src/gpu/submodules/probes.cpp b/pythonbindings/src/gpu/submodules/probes.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6993d9617d870922d7ed90ed9ecbebb8a797be25 --- /dev/null +++ b/pythonbindings/src/gpu/submodules/probes.cpp @@ -0,0 +1,110 @@ +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> +#include <gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h> +#include <gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h> +#include <gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.h> +#include <gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.h> +#include <gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.h> +#include <gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h> + +namespace probes +{ + namespace py = pybind11; + + py::module makeModule(py::module_ &parentModule) + { + py::module probeModule = parentModule.def_submodule("probes"); + + py::enum_<Statistic>(probeModule, "Statistic") + .value("Instantaneous", Statistic::Instantaneous) + .value("Means", Statistic::Means) + .value("Variances", Statistic::Variances) + .value("SpatialMeans", Statistic::SpatialMeans) + .value("SpatioTemporalMeans", Statistic::SpatioTemporalMeans) + .value("SpatialCovariances", Statistic::SpatialCovariances) + .value("SpatioTemporalCovariances", Statistic::SpatioTemporalCovariances) + .value("SpatialSkewness", Statistic::SpatialSkewness) + .value("SpatioTemporalSkewness", Statistic::SpatioTemporalSkewness) + .value("SpatialFlatness", Statistic::SpatialFlatness) + .value("SpatioTemporalFlatness", Statistic::SpatioTemporalFlatness); + + py::class_<Probe, PreCollisionInteractor, std::shared_ptr<Probe>>(probeModule, "Probe") + .def("add_statistic", &Probe::addStatistic) + .def("set_file_name_to_n_out", &Probe::setFileNameToNOut) + .def("add_all_available_statistics", &Probe::addAllAvailableStatistics); + + py::class_<PointProbe, Probe, std::shared_ptr<PointProbe>>(probeModule, "PointProbe") + .def(py::init< + const std::string, + const std::string, + uint, + uint, + uint, + uint>(), + "probe_name", + "output_path" + "t_start_avg", + "t_avg", + "t_start_out", + "t_out") + .def("add_probe_points_from_list", &PointProbe::addProbePointsFromList) + .def("add_probe_points_from_x_normal_plane", &PointProbe::addProbePointsFromXNormalPlane); + + py::class_<PlaneProbe, Probe, std::shared_ptr<PlaneProbe>>(probeModule, "PlaneProbe") + .def(py::init< + const std::string, + const std::string, + uint, + uint, + uint, + uint>(), + "probe_name", + "output_path" + "t_start_avg", + "t_avg", + "t_start_out", + "t_out") + .def("set_probe_plane", &PlaneProbe::setProbePlane); + + py::class_<PlanarAverageProbe, Probe, std::shared_ptr<PlanarAverageProbe>>(probeModule, "PlanarAverageProbe") + .def(py::init< + const std::string, + const std::string, + uint, + uint, + uint, + uint, + uint, + char>(), + "probe_name", + "output_path", + "t_start_avg", + "t_start_tmp_avg", + "t_avg", + "t_start_out", + "t_out", + "plane_normal"); + + + py::class_<WallModelProbe, Probe, std::shared_ptr<WallModelProbe>>(probeModule, "WallModelProbe") + .def(py::init< + const std::string, + const std::string, + uint, + uint, + uint, + uint, + uint>(), + "probe_name", + "output_path" + "t_start_avg", + "t_start_tmp_avg", + "t_avg", + "t_start_out", + "t_out") + .def("set_force_output_to_stress", &WallModelProbe::setForceOutputToStress) + .def("set_evaluate_pressure_gradient", &WallModelProbe::setEvaluatePressureGradient); + + return probeModule; + } +} \ No newline at end of file diff --git a/pythonbindings/src/gpu/submodules/simulation.cpp b/pythonbindings/src/gpu/submodules/simulation.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b775d604ba41530223f22738c72785b2c15348b3 --- /dev/null +++ b/pythonbindings/src/gpu/submodules/simulation.cpp @@ -0,0 +1,32 @@ +#include <pybind11/pybind11.h> +#include <gpu/VirtualFluids_GPU/LBM/Simulation.h> +#include <gpu/VirtualFluids_GPU/Communication/Communicator.h> +#include <gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactory.h> +#include <gpu/VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactory.h> +#include <gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h> +#include <gpu/VirtualFluids_GPU/Parameter/Parameter.h> +#include <gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h> +#include <gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h> +#include <gpu/VirtualFluids_GPU/Output/DataWriter.h> + +namespace simulation +{ + namespace py = pybind11; + + void makeModule(py::module_ &parentModule) + { + // missing setFactories and setDataWriter, not possible to wrap these functions as long as they take unique ptr arguments + py::class_<Simulation>(parentModule, "Simulation") + .def(py::init< std::shared_ptr<Parameter>, + std::shared_ptr<CudaMemoryManager>, + vf::gpu::Communicator &, + GridProvider &>(), + "parameter", + "memoryManager", + "communicator", + "gridProvider") + .def("run", &Simulation::run) + .def("addKineticEnergyAnalyzer", &Simulation::addKineticEnergyAnalyzer) + .def("addEnstrophyAnalyzer", &Simulation::addEnstrophyAnalyzer); + } +} \ No newline at end of file diff --git a/pythonbindings/src/lbm/lbm.cpp b/pythonbindings/src/lbm/lbm.cpp new file mode 100644 index 0000000000000000000000000000000000000000..441b9ff372f4e4513fee58c4a8a1cd78d38582dd --- /dev/null +++ b/pythonbindings/src/lbm/lbm.cpp @@ -0,0 +1,13 @@ +#include <pybind11/pybind11.h> + +namespace lbm +{ + namespace py = pybind11; + + py::module makeModule(py::module_ &parentModule) + { + py::module lbmModule = parentModule.def_submodule("lbm"); + + return lbmModule; + } +} \ No newline at end of file diff --git a/pythonbindings/src/logger/logger.cpp b/pythonbindings/src/logger/logger.cpp new file mode 100644 index 0000000000000000000000000000000000000000..82ad3d92760ae38c0eb62b16be726e4eeaca08ac --- /dev/null +++ b/pythonbindings/src/logger/logger.cpp @@ -0,0 +1,25 @@ +#include <pybind11/pybind11.h> +#include <logger/Logger.h> + +namespace logging +{ + namespace py = pybind11; + + py::module makeModule(py::module_ &parentModule) + { + py::module loggerModule = parentModule.def_submodule("logger"); + + py::class_<vf::logging::Logger>(loggerModule, "Logger") + .def("initialize_logger", &vf::logging::Logger::initalizeLogger) + .def("change_log_path", &vf::logging::Logger::changeLogPath); + + // use f-strings (f"text {float}") in python for compounded messages + loggerModule.def("vf_log_trace", [](std::string arg){ VF_LOG_TRACE(arg); }); + loggerModule.def("vf_log_debug", [](std::string arg){ VF_LOG_DEBUG(arg); }); + loggerModule.def("vf_log_info", [](std::string arg){ VF_LOG_INFO(arg); }); + loggerModule.def("vf_log_warning", [](std::string arg){ VF_LOG_WARNING(arg); }); + loggerModule.def("vf_log_critical", [](std::string arg){ VF_LOG_CRITICAL(arg); }); + + return loggerModule; + } +} // namespace logging diff --git a/src/cpu/pythonbindings/src/muParser.cpp b/pythonbindings/src/muParser.cpp similarity index 100% rename from src/cpu/pythonbindings/src/muParser.cpp rename to pythonbindings/src/muParser.cpp diff --git a/regression-tests/driven_cavity_test.sh b/regression-tests/driven_cavity_test.sh new file mode 100755 index 0000000000000000000000000000000000000000..e10a829d2680ab647ba0f66e0f2e85a70186007e --- /dev/null +++ b/regression-tests/driven_cavity_test.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +################################# +# Driven Cavity Regression Test +################################# + +# build VirtualFluids accordingly to our specific test scenario. +# in this case adding -DUSER_APPS="apps/gpu/LBM/DrivenCavity to the cmake command is not necessary, because the DrivenCavity is added to VirtualFluids by default. +mkdir -p build +cmake -B build --preset=gpu_make -DCMAKE_CUDA_ARCHITECTURES=75 #-DUSER_APPS="apps/gpu/LBM/DrivenCavity" +cd build && make -j 8 && cd .. + +# execute VirtualFluids +./build/bin/DrivenCavity + +# set the path to the produced data +PATH_TO_DIR=output/DrivenCavity + +# set the path to the reference data. +# `regression-tests/reference_data` is fix `regression_tests/gpu/DrivenCavity_2Levels` must match the structure in https://github.com/irmb/test_data: +PATH_TO_REFERENCE_DIR=regression-tests/reference_data/regression_tests/gpu/DrivenCavity_2Levels + +# execute fieldcompare (A more comprehensive manual can be found here https://gitlab.com/dglaeser/fieldcompare) +fieldcompare dir $PATH_TO_DIR --reference $PATH_TO_REFERENCE_DIR --include-files "*.vtu" \ No newline at end of file diff --git a/regression-tests/reference_data b/regression-tests/reference_data new file mode 160000 index 0000000000000000000000000000000000000000..a5787a2312095d7374a8cfe6225d4d1409024081 --- /dev/null +++ b/regression-tests/reference_data @@ -0,0 +1 @@ +Subproject commit a5787a2312095d7374a8cfe6225d4d1409024081 diff --git a/regression-tests/regression-tests.sh b/regression-tests/regression-tests.sh new file mode 100755 index 0000000000000000000000000000000000000000..5b7d227907594b727103be91d2382c05a07b9c6f --- /dev/null +++ b/regression-tests/regression-tests.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +################################# +# VirtualFludis regression tests +################################# + + +# 1. Cloning the reference data from github +mkdir -p regression-tests/reference_data +git clone https://github.com/irmb/test_data regression-tests/reference_data + +# 2. set up the python environnement +# by cloning our meshio patch and fieldcompare into a venv +python3 -m venv .venv +source .venv/bin/activate +pip install rich +pip install git+https://github.com/soerenPeters/meshio@update-pyproject-version +pip install git+https://gitlab.com/dglaeser/fieldcompare + +# 3. Running the specific tests +./regression-tests/driven_cavity_test.sh + + + +# How to add a new regression test? +# 1. setup the specfic simulation and run it to create reference data. +# 2. fork https://github.com/irmb/test_data and create a pull request containing the reference data. +# 3. copy ./regression-tests/driven_cavity_test.sh and adjust the file accordingly to the new test scenario. +# 4. execute this file from here accordingly to #3. \ No newline at end of file diff --git a/setup.py b/setup.py index ffe6663be9561a209945b91bb396254b703ae892..b26e1c13d09447d17f8e9fd6e2cd0d0671595bf3 100644 --- a/setup.py +++ b/setup.py @@ -6,23 +6,66 @@ import subprocess from setuptools import setup, Extension from setuptools.command.build_ext import build_ext +from setuptools.command.install import install +from setuptools.command.develop import develop from distutils.version import LooseVersion +""" +Install python wrapper of virtual fluids +Install GPU backend with option --GPU +(pass to pip via --install-option="--GPU") +""" + vf_cmake_args = [ "-DBUILD_VF_PYTHON_BINDINGS=ON", - "-DBUILD_VF_DOUBLE_ACCURACY=ON", "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache", "-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache", "-DCMAKE_C_COMPILER_LAUNCHER=ccache", - "-DBUILD_VF_CPU:BOOL=ON", - "-DBUILD_VF_GPU:BOOL=OFF", - "-DUSE_METIS=ON", - "-DUSE_MPI=ON", "-DBUILD_SHARED_LIBS=OFF", - "-DBUILD_VF_UNIT_TESTS:BOOL=ON", "-DBUILD_WARNINGS_AS_ERRORS=OFF" ] +vf_cpu_cmake_args = [ + "-DBUILD_VF_DOUBLE_ACCURACY=ON", + "-DBUILD_VF_CPU:BOOL=ON", + "-DBUILD_VF_UNIT_TESTS:BOOL=ON", + "-DUSE_METIS=ON", + "-DUSE_MPI=ON" +] + +vf_gpu_cmake_args = [ + "-DBUILD_VF_DOUBLE_ACCURACY=OFF", + "-DBUILD_VF_GPU:BOOL=ON", + "-DBUILD_VF_UNIT_TESTS:BOOL=OFF", +] + +GPU = False + +class CommandMixin: + user_options = [ + ('GPU', None, 'compile pyfluids with GPU backend'), + ] + + def initialize_options(self): + super().initialize_options() + self.GPU = False + + def finalize_options(self): + super().finalize_options() + + def run(self): + global GPU + GPU = GPU or self.GPU + super().run() + + +class InstallCommand(CommandMixin, install): + user_options = getattr(install, 'user_options', []) + CommandMixin.user_options + + +class DevelopCommand(CommandMixin, develop): + user_options = getattr(develop, 'user_options', []) + CommandMixin.user_options + class CMakeExtension(Extension): def __init__(self, name, sourcedir=''): @@ -30,8 +73,11 @@ class CMakeExtension(Extension): self.sourcedir = os.path.abspath(sourcedir) -class CMakeBuild(build_ext): +class CMakeBuild(CommandMixin, build_ext): + user_options = getattr(build_ext, 'user_options', []) + CommandMixin.user_options + def run(self): + super().run() try: out = subprocess.check_output(['cmake', '--version']) except OSError: @@ -68,12 +114,16 @@ class CMakeBuild(build_ext): build_args += ['--', '-j2'] cmake_args.extend(vf_cmake_args) + cmake_args.extend(vf_gpu_cmake_args if GPU else vf_cpu_cmake_args) env = os.environ.copy() env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''), self.distribution.get_version()) if not os.path.exists(self.build_temp): os.makedirs(self.build_temp) + cmake_cache_file = self.build_temp+"/CMakeCache.txt" + if os.path.exists(cmake_cache_file): + os.remove(cmake_cache_file) subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env) subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp) @@ -82,6 +132,6 @@ setup( name='pyfluids', version='0.0.1', ext_modules=[CMakeExtension('pyfluids')], - cmdclass=dict(build_ext=CMakeBuild), + cmdclass={"install": InstallCommand, "develop": DevelopCommand, "build_ext": CMakeBuild}, zip_safe=False, ) diff --git a/src/basics/tests/testUtilities.h b/src/basics/tests/testUtilities.h new file mode 100644 index 0000000000000000000000000000000000000000..c70d9cc5c11633ded6b696d92692e3d4edf8d2ca --- /dev/null +++ b/src/basics/tests/testUtilities.h @@ -0,0 +1,12 @@ +#ifndef TESTUTILITIES_H +#define TESTUTILITIES_H + +inline auto RealEq = [](auto value) { +#ifdef VF_DOUBLE_ACCURACY + return testing::DoubleEq(value); +#else + return testing::FloatEq(value); +#endif +}; + +#endif diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h index ade31e5fd0fa3736548867980410a37827055c4d..8aed1556b058c8420d79eab32646ae10112ec288 100644 --- a/src/cpu/VirtualFluids.h +++ b/src/cpu/VirtualFluids.h @@ -140,8 +140,8 @@ #include <BoundaryConditions/SimpleSlipBCAlgorithm.h> #include <BoundaryConditions/RheologyPowellEyringModelNoSlipBCAlgorithm.h> #include <BoundaryConditions/RheologyBinghamModelVelocityBCAlgorithm.h> -#include <BoundaryConditions/MultiphaseNoSlipBCAlgorithm.h> -#include <BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h> +#include <BoundaryConditions/MultiphaseNoSlipBCAlgorithm.h> +#include <BoundaryConditions/MultiphaseNonReflectingOutflowBCAlgorithm.h> #include <BoundaryConditions/MultiphaseVelocityBCAdapter.h> #include <BoundaryConditions/MultiphaseVelocityBCAlgorithm.h> #include <BoundaryConditions/MultiphaseSlipBCAlgorithm.h> diff --git a/src/cpu/VirtualFluidsCore/CMakeLists.txt b/src/cpu/VirtualFluidsCore/CMakeLists.txt index f9f97ed58dc67d3b6f0614d1af83953340438d87..b691fd34be1cff4f2bfed0fa4e0cf8860014ed90 100644 --- a/src/cpu/VirtualFluidsCore/CMakeLists.txt +++ b/src/cpu/VirtualFluidsCore/CMakeLists.txt @@ -21,7 +21,7 @@ IF(${USE_DEM_COUPLING}) ENDIF() if(BUILD_USE_OPENMP) - list(APPEND VF_LIBRARIES OpenMP::OpenMP_CXX) + list(APPEND VF_LIBRARIES OpenMP::OpenMP_CXX) endif() IF(${USE_LIGGGHTS}) diff --git a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp b/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp index d2a7baee86607f7c99a30cf59910fa831ae4a7a9..85a01cd1f85cf3efc556dd176cb748fc947e972b 100644 --- a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp +++ b/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp @@ -324,7 +324,7 @@ void BasicCalculator::interpolation(int startLevel, int maxInitLevel) ////////////////////////////////////////////////////////////////////////// void BasicCalculator::applyPreCollisionBC(int startLevel, int maxInitLevel) { - // startLevel bis maxInitLevel + // from startLevel to maxInitLevel for (int level = startLevel; level <= maxInitLevel; level++) { int size = (int)blocks[level].size(); #ifdef _OPENMP @@ -349,7 +349,7 @@ void BasicCalculator::applyPreCollisionBC(int startLevel, int maxInitLevel) ////////////////////////////////////////////////////////////////////////// void BasicCalculator::applyPostCollisionBC(int startLevel, int maxInitLevel) { - // startLevel bis maxInitLevel + // from startLevel to maxInitLevel for (int level = startLevel; level <= maxInitLevel; level++) { int size = (int)blocks[level].size(); #ifdef _OPENMP diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp index 5dced5e4738b3b56d5152a676994f49a25d663f2..8c9ccab62fa18f96abeca389ab437e62cdc80d7b 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp +++ b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp @@ -1258,7 +1258,7 @@ void Grid3D::getSubBlocksZero(int ix1, int ix2, int ix3, int level, vector<SPtr< this->getSubBlocksEast(x1W, x2N, x3T, l, blockVector, levelDepth); } ////////////////////////////////////////////////////////////////////////// -void Grid3D::getNeighborBlocksForDirectionWithDirZero(int dir, int ix1, int ix2, int ix3, int level, int levelDepth, +void Grid3D::getNeighborBlocksForDirectionWithREST(int dir, int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<SPtr<Block3D>> &blocks) { switch (dir) { diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.h b/src/cpu/VirtualFluidsCore/Grid/Grid3D.h index 0d6794c9e855430242a0a4a14a21ea9b90b118fb..fabaaa655e2b63201256802473ec037279f0ea3b 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.h +++ b/src/cpu/VirtualFluidsCore/Grid/Grid3D.h @@ -107,7 +107,7 @@ public: void getAllNeighbors(SPtr<Block3D> block, int level, int levelDepth, std::vector<SPtr<Block3D>> &blocks); void getNeighborBlocksForDirection(int dir, int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<SPtr<Block3D>> &blocks); - void getNeighborBlocksForDirectionWithDirZero(int dir, int ix1, int ix2, int ix3, int level, int levelDepth, + void getNeighborBlocksForDirectionWithREST(int dir, int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<SPtr<Block3D>> &blocks); void getNeighborsZero(int ix1, int ix2, int ix3, int level, int levelDepth, std::vector<SPtr<Block3D>> &blocks); diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp index 9c52f5e0469ce5b6c6e08136f25d3c027d36bdbd..2a895950a79cf011c25b0d352689216f53e96d41 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp @@ -39,7 +39,6 @@ #include "Block3D.h" #include "BCArray3D.h" - #define PROOF_CORRECTNESS using namespace UbMath; @@ -85,7 +84,7 @@ void CumulantK17LBMKernel::calculate(int step) //! The cumulant kernel is executed in the following steps //! //////////////////////////////////////////////////////////////////////////////// - //! - Get node index coordinates from thredIdx, blockIdx, blockDim and gridDim. + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. //! using namespace std; @@ -322,7 +321,7 @@ void CumulantK17LBMKernel::calculate(int step) LBMReal O6 = c1; //////////////////////////////////////////////////////////////////////////////////// - //! - A and B: parameters for fourth order convergence of the diffusion term according to Eq. (114) and (115) + //! - A and B: parameters for fourth order convergence of the diffusion term according to Eq. (115) and (116) //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> //! with simplifications assuming \f$\omega_2 = 1.0\f$ (modify for different bulk viscosity). //! diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h index 3052f50e3e48925ed21a3c3af68cc2d247c88a02..aab4d669655efe5bd489feb3829da28e67aa9ecb 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h @@ -79,7 +79,7 @@ protected: }; //////////////////////////////////////////////////////////////////////////////// -//! \brief forward chimera transformation \ref forwardInverseChimeraWithK +//! \brief forward chimera transformation \ref forwardInverseChimeraWithK //! Transformation from distributions to central moments according to Eq. (6)-(14) in //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> //! Modified for lower round-off errors. @@ -112,7 +112,7 @@ inline void CumulantK17LBMKernel::backwardInverseChimeraWithK(LBMReal& mfa, LBMR mfb = m1; } //////////////////////////////////////////////////////////////////////////////// -//! \brief forward chimera transformation \ref forwardChimera +//! \brief forward chimera transformation \ref forwardChimera //! Transformation from distributions to central moments according to Eq. (6)-(14) in //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> //! for \f$ K_{abc}=0 \f$. This is to avoid unnessary floating point operations. @@ -128,7 +128,7 @@ inline void CumulantK17LBMKernel::forwardChimera(LBMReal& mfa, LBMReal& mfb, LBM mfa = m1; } //////////////////////////////////////////////////////////////////////////////// -//! \brief backward chimera transformation \ref backwardChimera +//! \brief backward chimera transformation \ref backwardChimera //! Transformation from central moments to distributions according to Eq. (57)-(65) in //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> //! for \f$ K_{abc}=0 \f$. This is to avoid unnessary floating point operations. diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.cpp b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.cpp index 2bdc7ce97be90a45b2bebb3dca53f3eb609bec3b..e001cbf970d59f6f847589810eeaacb86a3e22a2 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernelUnified.cpp @@ -89,7 +89,7 @@ void CumulantK17LBMKernelUnified::calculate(int step) //! The cumulant kernel is executed in the following steps //! //////////////////////////////////////////////////////////////////////////////// - //! - Get node index coordinates from thredIdx, blockIdx, blockDim and gridDim. + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. //! using namespace std; diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h index 9d743195c7992551127d359204e31bb5466221c6..d8822219484599e8f31fa86564ecdaf844679d52 100644 --- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h +++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h @@ -35,14 +35,13 @@ #define D3Q27SYSTEM_H #include <cmath> -#include <iostream> #include <string> +#include <iostream> #include "LBMSystem.h" #include "UbException.h" #include "UbMath.h" - //! \brief namespace for global system-functions namespace D3Q27System { diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h index 1bdf610fd6b02c0fd7d4283ce3fd7084b08453f1..d5eb02d4c0ef310cdfd63d283abc9719996e5f84 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h @@ -53,7 +53,6 @@ public: public: LBMKernel(); - virtual ~LBMKernel() = default; virtual SPtr<LBMKernel> clone() = 0; diff --git a/src/cuda/CMakeLists.txt b/src/cuda/CMakeLists.txt index b3b37b213cab4bf0e562438264d5fea6eb4dc7b3..4d49cfedc903f3578b64916966405ea48bf28901 100644 --- a/src/cuda/CMakeLists.txt +++ b/src/cuda/CMakeLists.txt @@ -1,3 +1,3 @@ project(cuda LANGUAGES CUDA CXX) -vf_add_library(NAME cuda PUBLIC_LINK logger) +vf_add_library(NAME vf_cuda PUBLIC_LINK logger) diff --git a/src/cuda/CudaGrid.cpp b/src/cuda/CudaGrid.cpp index c7267972859f04931d9a69cfca073c7ac3267b9f..48ac86942d938b223e95759942676f862b614fa1 100644 --- a/src/cuda/CudaGrid.cpp +++ b/src/cuda/CudaGrid.cpp @@ -5,20 +5,9 @@ namespace vf::cuda { -CudaGrid::CudaGrid(unsigned int numberOfThreads, unsigned int numberOfEntities) +CudaGrid::CudaGrid(unsigned int numberOfThreads, unsigned int numberOfEntities): grid {getCudaGrid( numberOfThreads, numberOfEntities)}, + threads{dim3(numberOfThreads, 1, 1)} { - unsigned int Grid = (numberOfEntities / numberOfThreads) + 1; - unsigned int Grid1, Grid2; - if (Grid > 512) { - Grid1 = 512; - Grid2 = (Grid / Grid1) + 1; - } else { - Grid1 = 1; - Grid2 = Grid; - } - - grid = dim3(Grid1, Grid2); - threads = dim3(numberOfThreads, 1, 1); } void CudaGrid::print() const @@ -27,4 +16,22 @@ void CudaGrid::print() const } +dim3 getCudaGrid(const unsigned int numberOfThreads, const unsigned int numberOfEntities){ + int Grid = (numberOfEntities / numberOfThreads) + 1; + int Grid1, Grid2; + if (Grid > 512) + { + Grid1 = 512; + Grid2 = (Grid/Grid1)+1; + } + else + { + Grid1 = 1; + Grid2 = Grid; + } + dim3 cudaGrid(Grid1, Grid2); + return cudaGrid; +} + + } diff --git a/src/cuda/CudaGrid.h b/src/cuda/CudaGrid.h index a9926c3861749f648da529f2b45554d13599a302..bf82077fdf6c9a5494a35950a917d9aaf1047b56 100644 --- a/src/cuda/CudaGrid.h +++ b/src/cuda/CudaGrid.h @@ -18,6 +18,7 @@ struct CudaGrid void print() const; }; +dim3 getCudaGrid(const unsigned int numberOfThreads, const unsigned int numberOfEntities); } diff --git a/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp b/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp index 8d032dfeead2f582c5af2426c45b09ead33883cc..ca6b223c90859656231360142b08d543b019b7ad 100644 --- a/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp +++ b/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp @@ -186,7 +186,7 @@ void GksMeshAdapter::findCellToCellConnectivity() for( uint idx = 0; idx < 27; idx++ ) { - if( idx == DIR_27_ZERO ) continue; + if( idx == DIR_27_REST ) continue; int xSign = dirs.directions[idx][0]; int ySign = dirs.directions[idx][1]; diff --git a/src/gpu/GridGenerator/CMakeLists.txt b/src/gpu/GridGenerator/CMakeLists.txt index 07b6125d6ecd83dca59e20e7c286ebc2b8d14715..8102ad3a10b53dded2ba6fe489753f20d1d2ed4f 100644 --- a/src/gpu/GridGenerator/CMakeLists.txt +++ b/src/gpu/GridGenerator/CMakeLists.txt @@ -1,7 +1,13 @@ project(GridGenerator LANGUAGES CXX) vf_add_library(PRIVATE_LINK basics OpenMP::OpenMP_CXX) +vf_add_tests() if(NOT MSVC) target_compile_options(GridGenerator PRIVATE "-Wno-strict-aliasing") +endif() + + +if(BUILD_VF_UNIT_TESTS) + target_include_directories(GridGeneratorTests PRIVATE "${VF_ROOT_DIR}/src/basics/") endif() \ No newline at end of file diff --git a/src/gpu/GridGenerator/geometries/Arrow/ArrowImp.h b/src/gpu/GridGenerator/geometries/Arrow/ArrowImp.h index ef145b7def48803b7e2d043f7a5862ee21f954c4..1fb509e0c6092dd3f00d4abf1849014191425db2 100644 --- a/src/gpu/GridGenerator/geometries/Arrow/ArrowImp.h +++ b/src/gpu/GridGenerator/geometries/Arrow/ArrowImp.h @@ -36,7 +36,6 @@ #include <memory> #include "global.h" -#include "GridGenerator_export.h" #include "Arrow.h" diff --git a/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBoxTest.cpp b/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBoxTest.cpp index f982b2fa5d5c614ded87ba2a03f6e71d72bf130c..35f4332ccec3cf541993b1e22c88eeeb365afadb 100644 --- a/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBoxTest.cpp +++ b/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBoxTest.cpp @@ -1,13 +1,12 @@ #include "gmock/gmock.h" +#include "basics/tests/testUtilities.h" -#include <GridGenerator/geometries/Triangle/Triangle.h> -#include <GridGenerator/geometries/BoundingBox/BoundingBox.h> -#include <GridGenerator/geometries/Vertex/Vertex.h> - +#include "geometries/Triangle/Triangle.h" +#include "geometries/BoundingBox/BoundingBox.h" +#include "geometries/Vertex/Vertex.h" using namespace testing; - TEST(BoundingBoxExactTest, findMinMaxFromTriangle) { BoundingBox box = BoundingBox::makeInvalidMinMaxBox(); @@ -19,17 +18,21 @@ TEST(BoundingBoxExactTest, findMinMaxFromTriangle) real maxX = 110.0f; real maxY = 50.0f; real maxZ = 12122.23f; - Triangle t = Triangle(Vertex(maxX, maxY - 10, minZ + 2), Vertex(minX, maxY, maxZ), Vertex(minX + 3, minY, minZ), Vertex(0.0f, 0.0f, 0.0f)); - - box.setMinMax(t); - - EXPECT_THAT(box.minX, RealEq(minX)); - EXPECT_THAT(box.minY, RealEq(minY)); - EXPECT_THAT(box.minZ, RealEq(minZ)); - - EXPECT_THAT(box.maxX, RealEq(maxX)); - EXPECT_THAT(box.maxY, RealEq(maxY)); - EXPECT_THAT(box.maxZ, RealEq(maxZ)); + Vertex v1 = Vertex(maxX, maxY - 10, minZ + 2); + Vertex v2 = Vertex(minX, maxY, maxZ); + Vertex v3 = Vertex(minX + 3, minY, minZ); + Vertex normal = Vertex(0.0f, 0.0f, 0.0f); + Triangle t = Triangle(v1, v2, v3, normal); + + box.setMinMax(t); + + EXPECT_THAT(box.minX, RealEq(minX)); + EXPECT_THAT(box.minY, RealEq(minY)); + EXPECT_THAT(box.minZ, RealEq(minZ)); + + EXPECT_THAT(box.maxX, RealEq(maxX)); + EXPECT_THAT(box.maxY, RealEq(maxY)); + EXPECT_THAT(box.maxZ, RealEq(maxZ)); } TEST(BoundingBoxTest, isInside_true) @@ -44,7 +47,11 @@ TEST(BoundingBoxTest, isInside_true) box.maxY = 10.0f; box.maxZ = 10.0f; - Triangle t = Triangle(Vertex(1,1,1), Vertex(2,2,2), Vertex(3,3,3), Vertex(0.0f, 0.0f, 0.0f)); + Vertex v1 = Vertex(1,1,1); + Vertex v2 = Vertex(2,2,2); + Vertex v3 = Vertex(3,3,3); + Vertex normal = Vertex(0.0f, 0.0f, 0.0f); + Triangle t = Triangle(v1, v2, v3, normal); EXPECT_TRUE(box.isInside(t)); } @@ -61,7 +68,11 @@ TEST(BoundingBoxTest, isInside_false) box.maxY = 10.0f; box.maxZ = 10.0f; - Triangle t = Triangle(Vertex(1, 1, 1), Vertex(2, 2, 2), Vertex(3, 3, 11), Vertex(0.0f, 0.0f, 0.0f)); + Vertex v1 = Vertex(1,1,1); + Vertex v2 = Vertex(2,2,2); + Vertex v3 = Vertex(3,3,11); + Vertex normal = Vertex(0.0f, 0.0f, 0.0f); + Triangle t = Triangle(v1, v2, v3, normal); EXPECT_FALSE(box.isInside(t)); } diff --git a/src/gpu/GridGenerator/geometries/Cuboid/Cuboid.cpp b/src/gpu/GridGenerator/geometries/Cuboid/Cuboid.cpp index e64a202ca9bcd5a33fcc9ba85e7bd35fa67a1d4e..7b0dbcdbdcbd679f1eb47ed5db7d828da8c31767 100644 --- a/src/gpu/GridGenerator/geometries/Cuboid/Cuboid.cpp +++ b/src/gpu/GridGenerator/geometries/Cuboid/Cuboid.cpp @@ -113,18 +113,12 @@ double Cuboid::getMaximum(double x1, double x2) bool Cuboid::isPointInObject(const double& x1, const double& x2, const double& x3, const double& minOffset, const double& maxOffset) { //false, if 'not in Object' or 'on Boundary'! - if (vf::Math::lessEqual((real)x1, (real)this->getX1Minimum() + (real)minOffset)) - return false; - if (vf::Math::lessEqual((real)x2, (real)this->getX2Minimum() + (real)minOffset)) - return false; - if (vf::Math::lessEqual((real)x3, (real)this->getX3Minimum() + (real)minOffset)) - return false; - if (vf::Math::greaterEqual((real)x1, (real)this->getX1Maximum() - (real)maxOffset)) - return false; - if (vf::Math::greaterEqual((real)x2, (real)this->getX2Maximum() - (real)maxOffset)) - return false; - if (vf::Math::greaterEqual((real)x3, (real)this->getX3Maximum() - (real)maxOffset)) - return false; + if (vf::Math::lessEqual( (real)x1, (real)this->getX1Minimum() + (real)minOffset)) return false; + if (vf::Math::lessEqual( (real)x2, (real)this->getX2Minimum() + (real)minOffset)) return false; + if (vf::Math::lessEqual( (real)x3, (real)this->getX3Minimum() + (real)minOffset)) return false; + if (vf::Math::greaterEqual((real)x1, (real)this->getX1Maximum() - (real)maxOffset)) return false; + if (vf::Math::greaterEqual((real)x2, (real)this->getX2Maximum() - (real)maxOffset)) return false; + if (vf::Math::greaterEqual((real)x3, (real)this->getX3Maximum() - (real)maxOffset)) return false; return true; } diff --git a/src/gpu/GridGenerator/geometries/Sphere/Sphere.h b/src/gpu/GridGenerator/geometries/Sphere/Sphere.h index ba5821f5bfed5b4d25c1ee3c5abecb168db462e7..03b9ef9fd101f19dbaff7d4e4109000cce6e3c49 100644 --- a/src/gpu/GridGenerator/geometries/Sphere/Sphere.h +++ b/src/gpu/GridGenerator/geometries/Sphere/Sphere.h @@ -34,7 +34,6 @@ #define SPHERE_H #include "global.h" -#include "GridGenerator_export.h" #include "geometries/Object.h" class GRIDGENERATOR_EXPORT Sphere : public Object diff --git a/src/gpu/GridGenerator/geometries/Triangle/Triangle.h b/src/gpu/GridGenerator/geometries/Triangle/Triangle.h index 0017d2f71145f2608976a95018816bf81cef44b7..0c62f2c0db5ced3c749c2ffd6196087192aab3df 100644 --- a/src/gpu/GridGenerator/geometries/Triangle/Triangle.h +++ b/src/gpu/GridGenerator/geometries/Triangle/Triangle.h @@ -36,7 +36,6 @@ #include <memory> #include "global.h" -#include "GridGenerator_export.h" #include "geometries/Vertex/Vertex.h" class TriangleMemento; diff --git a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp index a11384887074aa6b42bff77dd8b7ee1ade8fc9e0..883ca0deaf34f45e4608c4e59908b4562932db77 100644 --- a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp +++ b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp @@ -58,9 +58,9 @@ TriangularMesh* TriangularMesh::make(const std::string& fileName, const std::vec TriangularMesh::TriangularMesh(const std::string& input, const BoundingBox& box) { - this->triangleVec = STLReader::readSTL(box, input); - initalizeDataFromTriangles(); - this->findNeighbors(); + this->triangleVec = STLReader::readSTL(box, input); + initalizeDataFromTriangles(); + this->findNeighbors(); } TriangularMesh::TriangularMesh(const std::string& inputPath, const std::vector<uint> ignorePatches) @@ -76,12 +76,7 @@ TriangularMesh::TriangularMesh(const std::string& inputPath, const std::vector<u TriangularMesh::TriangularMesh() { - this->minmax = BoundingBox::makeInvalidMinMaxBox(); // blame Lenz -} - -TriangularMesh::~TriangularMesh() -{ - + this->minmax = BoundingBox::makeInvalidMinMaxBox(); // blame Lenz } Object* TriangularMesh::clone() const @@ -100,12 +95,12 @@ uint TriangularMesh::getNumberOfTriangles() const void TriangularMesh::findNeighbors() { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "start finding neighbors ...\n"; + *logging::out << logging::Logger::INFO_INTERMEDIATE << "start finding neighbors ...\n"; auto t = Timer::makeStart(); - TriangleNeighborFinder finder(triangles, size); - finder.fillWithNeighborAngles(this); + TriangleNeighborFinder finder(triangles, size); + finder.fillWithNeighborAngles(this); t->end(); @@ -114,19 +109,19 @@ void TriangularMesh::findNeighbors() void TriangularMesh::setTriangles(std::vector<Triangle> triangles) { - this->triangleVec = triangles; - initalizeDataFromTriangles(); + this->triangleVec = triangles; + initalizeDataFromTriangles(); } void TriangularMesh::setMinMax(BoundingBox minmax) { - this->minmax = minmax; + this->minmax = minmax; } void TriangularMesh::initalizeDataFromTriangles() { - this->triangles = triangleVec.data(); - this->size = long(triangleVec.size()); + this->triangles = triangleVec.data(); + this->size = long(triangleVec.size()); for (std::size_t i = 0; i < (size_t)this->size; i++) { this->minmax.setMinMax(this->triangleVec[i]); @@ -201,7 +196,7 @@ void TriangularMesh::scale(double offset) auto averrageNormals = getAverrageNormalsPerVertex(trianglesPerVertex); - for (std::size_t vertexID = 0; vertexID < this->getNumberOfTriangles() * 3; vertexID++) + for (uint vertexID = 0; vertexID < this->getNumberOfTriangles() * 3; vertexID++) { int coordinatedID = finder.sortedToTriangles[vertexID][IDS::coordinateID]; Vertex averrageNormal = averrageNormals[coordinatedID]; diff --git a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h index 2d31de98bf1f5530ada555e548ac6bb40e5e51b7..2e876e1d3c50b377ef6df9a8489fe8a189849594 100644 --- a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h +++ b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h @@ -33,11 +33,9 @@ #ifndef TriangularMesh_h #define TriangularMesh_h -#include <stdio.h> #include <vector> #include <string> #include <memory> -#include "GridGenerator_export.h" #include "global.h" #include "geometries/Triangle/Triangle.h" @@ -56,20 +54,20 @@ class TriangularMesh : public Object public: GRIDGENERATOR_EXPORT static TriangularMesh* make(const std::string& fileName, const std::vector<uint> ignorePatches = std::vector<uint>()); - GRIDGENERATOR_EXPORT TriangularMesh(); + GRIDGENERATOR_EXPORT TriangularMesh(); GRIDGENERATOR_EXPORT TriangularMesh(const std::string& inputPath, const std::vector<uint> ignorePatches = std::vector<uint>()); - GRIDGENERATOR_EXPORT TriangularMesh(const std::string& inputPath, const BoundingBox &box); - GRIDGENERATOR_EXPORT ~TriangularMesh(); + GRIDGENERATOR_EXPORT TriangularMesh(const std::string& inputPath, const BoundingBox &box); + GRIDGENERATOR_EXPORT ~TriangularMesh() override = default; GRIDGENERATOR_EXPORT uint getNumberOfTriangles() const; - GRIDGENERATOR_EXPORT void setTriangles(std::vector<Triangle> triangles); - GRIDGENERATOR_EXPORT void setMinMax(BoundingBox minmax); + GRIDGENERATOR_EXPORT void setTriangles(std::vector<Triangle> triangles); + GRIDGENERATOR_EXPORT void setMinMax(BoundingBox minmax); - std::vector<Triangle> triangleVec; - Triangle *triangles; - long size; - BoundingBox minmax; + std::vector<Triangle> triangleVec; + Triangle *triangles = nullptr; + long size = 0; + BoundingBox minmax; SPtr<GbTriFaceMesh3D> VF_GbTriFaceMesh3D; @@ -82,8 +80,8 @@ public: GRIDGENERATOR_EXPORT void generateGbTriFaceMesh3D(); private: - - void initalizeDataFromTriangles(); + + void initalizeDataFromTriangles(); static std::vector<Vertex> getAverrageNormalsPerVertex(std::vector<std::vector<Triangle> > trianglesPerVertex); static void eliminateTriangleswithIdenticialNormal(std::vector<Triangle> &triangles); @@ -111,4 +109,3 @@ public: #endif - diff --git a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.h b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.h index 573a464844ac769ebd1127c666481b87f363099f..b98d531599ff897da0ad596a7d46e1393a456aac 100644 --- a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.h +++ b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.h @@ -34,7 +34,6 @@ #define TriangularMeshStrategy_H #include "global.h" -#include "GridGenerator_export.h" class GridImp; class TriangularMesh; diff --git a/src/gpu/GridGenerator/geometries/TriangularMesh/triangleNeighborFinder/TriangleNeighborFinder.h b/src/gpu/GridGenerator/geometries/TriangularMesh/triangleNeighborFinder/TriangleNeighborFinder.h index b0dda279c5f95a621b5875e78b5cdb7479b98a54..2b42ff3ad2dacaade3bbc8da4f6d4b3c61b14442 100644 --- a/src/gpu/GridGenerator/geometries/TriangularMesh/triangleNeighborFinder/TriangleNeighborFinder.h +++ b/src/gpu/GridGenerator/geometries/TriangularMesh/triangleNeighborFinder/TriangleNeighborFinder.h @@ -33,8 +33,7 @@ #ifndef TriangleNeighborFinder_h #define TriangleNeighborFinder_h -#include "GridGenerator/global.h" -#include "GridGenerator_export.h" +#include "global.h" #include <vector> struct IDS { diff --git a/src/gpu/GridGenerator/geometries/Vertex/Vertex.h b/src/gpu/GridGenerator/geometries/Vertex/Vertex.h index 7b27d853f652459143699204c59a5843de6eaf39..ec5fc0f1ced64f7757de26deaf3053504e29d7c6 100644 --- a/src/gpu/GridGenerator/geometries/Vertex/Vertex.h +++ b/src/gpu/GridGenerator/geometries/Vertex/Vertex.h @@ -37,7 +37,7 @@ #include <memory> #include <ostream> -#include "global.h" +#include "gpu/GridGenerator/global.h" struct GRIDGENERATOR_EXPORT Vertex { diff --git a/src/gpu/GridGenerator/geometries/VerticalCylinder/VerticalCylinder.h b/src/gpu/GridGenerator/geometries/VerticalCylinder/VerticalCylinder.h index 24d9383bf5628e46b1d634874f79ceb73eaa6cae..e995d2ba16eba17930401c99c260f81b9c6077b4 100644 --- a/src/gpu/GridGenerator/geometries/VerticalCylinder/VerticalCylinder.h +++ b/src/gpu/GridGenerator/geometries/VerticalCylinder/VerticalCylinder.h @@ -34,7 +34,6 @@ #define VERTICAL_CYLINDER_H #include "global.h" -#include "GridGenerator_export.h" #include "geometries/Object.h" class GRIDGENERATOR_EXPORT VerticalCylinder : public Object diff --git a/src/gpu/GridGenerator/global.h b/src/gpu/GridGenerator/global.h index 19bedc95b9a767f30761279500c6b8c036509eba..79f62bb354bed18075f6a8327a18f24d1d0fd1e2 100644 --- a/src/gpu/GridGenerator/global.h +++ b/src/gpu/GridGenerator/global.h @@ -1,28 +1,28 @@ //======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ // \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ // -// This file is part of VirtualFluids. VirtualFluids is free software: you can +// This file is part of VirtualFluids. VirtualFluids is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of +// License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. -// +// // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // @@ -40,12 +40,11 @@ #define MASTERRANK 0 - #include "GridGenerator_export.h" -#include "PointerDefinitions.h" -#include "Core/DataTypes.h" +#include "basics/PointerDefinitions.h" +#include "basics/Core/DataTypes.h" -#include "Core/Logger/Logger.h" +#include "basics/Core/Logger/Logger.h" -#endif +#endif diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.cpp b/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.cpp index 8930bdf3b165b4e0dbb497773fd0b6cf6ec6f8f7..5102f60fc295aadf4323a4b332bf3dd8f7f21dbf 100644 --- a/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.cpp +++ b/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.cpp @@ -42,6 +42,8 @@ bool gg::BoundaryCondition::isSide( SideType side ) const return this->side->whoAmI() == side; } +////////////////////////////////////////////////////////////////////////// + void VelocityBoundaryCondition::setVelocityProfile( SPtr<Grid> grid, std::function<void(real, real, real, real &, real &, real &)> velocityProfile) { @@ -55,6 +57,8 @@ void VelocityBoundaryCondition::setVelocityProfile( } } +////////////////////////////////////////////////////////////////////////// + void GeometryBoundaryCondition::setTangentialVelocityForPatch(SPtr<Grid> grid, uint patch, real p1x, real p1y, real p1z, real p2x, real p2y, real p2z, @@ -102,3 +106,23 @@ void GeometryBoundaryCondition::setTangentialVelocityForPatch(SPtr<Grid> grid, u } } } + +////////////////////////////////////////////////////////////////////////// + +void StressBoundaryCondition::fillSamplingIndices(std::vector<SPtr<Grid> > grid, uint level, uint samplingOffset) +{ + + for( uint i = 0; i < this->indices.size(); i++ ) + { + real x, y, z; + grid[level]->transIndexToCoords(this->indices[i], x, y, z); + + real x_sampling = x + this->getNormalx(i)*samplingOffset*grid[level]->getDelta(); + real y_sampling = y + this->getNormaly(i)*samplingOffset*grid[level]->getDelta(); + real z_sampling = z + this->getNormalz(i)*samplingOffset*grid[level]->getDelta(); + + this->velocitySamplingIndices.push_back( grid[level]->transCoordToIndex(x_sampling, y_sampling, z_sampling) ); + } + +} + diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h b/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h index 9ae5f09e208e92213ca90ff75f095eddd5dbeaf1..4a3990d9f815042297be76ae83a61268c8ad6815 100644 --- a/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h +++ b/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h @@ -36,9 +36,9 @@ #include <vector> #include <functional> -#include "global.h" +#include "gpu/GridGenerator/global.h" -#include "grid/NodeValues.h" +#include "gpu/GridGenerator/grid/NodeValues.h" class Grid; @@ -118,6 +118,52 @@ public: } void fillSlipNormalLists() + { + for (uint index : this->indices) { + (void)index; + this->normalXList.push_back(normalX); + this->normalYList.push_back(normalY); + this->normalZList.push_back(normalZ); + } + } + + real getNormalx() { return this->normalX; } + real getNormaly() { return this->normalY; } + real getNormalz() { return this->normalZ; } + + real getNormalx(uint index) { return this->normalXList[index]; } + real getNormaly(uint index) { return this->normalYList[index]; } + real getNormalz(uint index) { return this->normalZList[index]; } +}; + +////////////////////////////////////////////////////////////////////////// + +class StressBoundaryCondition : public gg::BoundaryCondition +{ +public: + static SPtr<StressBoundaryCondition> make(real normalX, real normalY, real normalZ, uint samplingOffset, real z0) + { + return SPtr<StressBoundaryCondition>(new StressBoundaryCondition(normalX, normalY, normalZ, samplingOffset, z0)); + } + + real normalX, normalY, normalZ; + uint samplingOffset; + real z0; + std::vector<real> normalXList, normalYList, normalZList; + std::vector<uint> samplingOffsetList; + std::vector<real> z0List; + std::vector<uint> velocitySamplingIndices; + +protected: + StressBoundaryCondition(real normalX, real normalY, real normalZ, uint samplingOffset, real z0) : normalX(normalX), normalY(normalY), normalZ(normalZ), samplingOffset(samplingOffset), z0(z0){ } + +public: + virtual char getType() const override + { + return vf::gpu::BC_STRESS; + } + + void fillStressNormalLists() { for (uint index : this->indices) { (void)index; @@ -127,6 +173,22 @@ public: } } + void fillZ0Lists() + { + for (uint index : this->indices) { + (void)index; + this->z0List.push_back(z0); + } + } + + void fillSamplingOffsetLists() + { + for (uint index : this->indices) { + (void)index; + this->samplingOffsetList.push_back(samplingOffset); + } + } + real getNormalx() { return this->normalX; } real getNormaly() { return this->normalY; } real getNormalz() { return this->normalZ; } @@ -134,6 +196,15 @@ public: real getNormalx(uint index) { return this->normalXList[index]; } real getNormaly(uint index) { return this->normalYList[index]; } real getNormalz(uint index) { return this->normalZList[index]; } + + uint getSamplingOffset() { return this->samplingOffset; } + uint getSamplingOffset(uint index) { return this->samplingOffsetList[index]; } + + real getZ0() { return this->z0; } + real getZ0(uint index) { return this->z0List[index]; } + + void fillSamplingIndices(std::vector<SPtr<Grid> > grid, uint level, uint samplingOffset); + }; ////////////////////////////////////////////////////////////////////////// @@ -181,7 +252,7 @@ public: ////////////////////////////////////////////////////////////////////////// -class GeometryBoundaryCondition : public VelocityBoundaryCondition +class GeometryBoundaryCondition : public gg::BoundaryCondition { public: static SPtr<GeometryBoundaryCondition> make() @@ -189,8 +260,15 @@ public: return SPtr<GeometryBoundaryCondition>(new GeometryBoundaryCondition()); } + real normalX, normalY, normalZ; + std::vector<real> normalXList, normalYList, normalZList; + + real vx, vy, vz; + std::vector<real> vxList, vyList, vzList; + private: - GeometryBoundaryCondition() : VelocityBoundaryCondition(0.0, 0.0, 0.0) { } + GeometryBoundaryCondition(real vx = 0.0, real vy = 0.0, real vz = 0.0, real normalX = 0.0, real normalY = 0.0, real normalZ = 0.0) : + vx(vx), vy(vy), vz(vz), normalX(normalX), normalY(normalY), normalZ(normalZ) { } public: char getType() const override @@ -212,6 +290,43 @@ public: real p1x, real p1y, real p1z, real p2x, real p2y, real p2z, real v, real r ); + + void fillVelocityLists() + { + for( uint index : this->indices ) { + (void) index; + this->vxList.push_back(vx); + this->vyList.push_back(vy); + this->vzList.push_back(vz); + } + } + + real getVx() { return this->vx; } + real getVy() { return this->vy; } + real getVz() { return this->vz; } + + real getVx(uint index) { return this->vxList[index]; } + real getVy(uint index) { return this->vyList[index]; } + real getVz(uint index) { return this->vzList[index]; } + + + void fillSlipNormalLists() + { + for (uint index : this->indices) { + (void)index; + this->normalXList.push_back(normalX); + this->normalYList.push_back(normalY); + this->normalZList.push_back(normalZ); + } + } + + real getNormalx() { return this->normalX; } + real getNormaly() { return this->normalY; } + real getNormalz() { return this->normalZ; } + + real getNormalx(uint index) { return this->normalXList[index]; } + real getNormaly(uint index) { return this->normalYList[index]; } + real getNormalz(uint index) { return this->normalZList[index]; } }; diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp index 02d61a83456090a3b96b207de5761b70d9b30fca..6c7bf8ca1853826d83fb6a713ffe03716bd2cf9a 100644 --- a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp +++ b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.cpp @@ -53,16 +53,18 @@ void Side::addIndices(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition || grid->getFieldEntry(index) == vf::gpu::FLUID_CFC || grid->getFieldEntry(index) == vf::gpu::FLUID_CFF || grid->getFieldEntry(index) == vf::gpu::FLUID_FCC - || grid->getFieldEntry(index) == vf::gpu::FLUID_FCF ) ) + || grid->getFieldEntry(index) == vf::gpu::FLUID_FCF )) { grid->setFieldEntry(index, boundaryCondition->getType()); boundaryCondition->indices.push_back(index); setPressureNeighborIndices(boundaryCondition, grid, index); + setStressSamplingIndices(boundaryCondition, grid, index); setQs(grid, boundaryCondition, index); boundaryCondition->patches.push_back(0); } + } } } @@ -91,6 +93,30 @@ void Side::setPressureNeighborIndices(SPtr<BoundaryCondition> boundaryCondition, } } +void Side::setStressSamplingIndices(SPtr<BoundaryCondition> boundaryCondition, SPtr<Grid> grid, const uint index) +{ + auto stressBoundaryCondition = std::dynamic_pointer_cast<StressBoundaryCondition>(boundaryCondition); + if (stressBoundaryCondition) + { + real x, y, z; + grid->transIndexToCoords(index, x, y, z); + + real nx = x; + real ny = y; + real nz = z; + + if (boundaryCondition->side->getCoordinate() == X_INDEX) + nx = -boundaryCondition->side->getDirection() * stressBoundaryCondition->samplingOffset * grid->getDelta() + x; + if (boundaryCondition->side->getCoordinate() == Y_INDEX) + ny = -boundaryCondition->side->getDirection() * stressBoundaryCondition->samplingOffset * grid->getDelta() + y; + if (boundaryCondition->side->getCoordinate() == Z_INDEX) + nz = -boundaryCondition->side->getDirection() * stressBoundaryCondition->samplingOffset * grid->getDelta() + z; + + uint samplingIndex = grid->transCoordToIndex(nx, ny, nz); + stressBoundaryCondition->velocitySamplingIndices.push_back(samplingIndex); + } +} + void Side::setQs(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition, uint index) { @@ -101,18 +127,39 @@ void Side::setQs(SPtr<Grid> grid, SPtr<BoundaryCondition> boundaryCondition, uin real x,y,z; grid->transIndexToCoords( index, x, y, z ); - x += grid->getDirection()[dir * DIMENSION + 0] * grid->getDelta(); - y += grid->getDirection()[dir * DIMENSION + 1] * grid->getDelta(); - z += grid->getDirection()[dir * DIMENSION + 2] * grid->getDelta(); + real coords[3] = {x,y,z}; + + real neighborX = x + grid->getDirection()[dir * DIMENSION + 0] * grid->getDelta(); + real neighborY = y + grid->getDirection()[dir * DIMENSION + 1] * grid->getDelta(); + real neighborZ = z + grid->getDirection()[dir * DIMENSION + 2] * grid->getDelta(); + + // correct neighbor coordinates in case of periodic boundaries + if( grid->getPeriodicityX() && grid->getFieldEntry( grid->transCoordToIndex( neighborX, y, z ) ) == vf::gpu::STOPPER_OUT_OF_GRID_BOUNDARY ) + { + if( neighborX > x ) neighborX = grid->getFirstFluidNode( coords, 0, grid->getStartX() ); + else neighborX = grid->getLastFluidNode ( coords, 0, grid->getEndX() ); + } + + if( grid->getPeriodicityY() && grid->getFieldEntry( grid->transCoordToIndex( x, neighborY, z ) ) == vf::gpu::STOPPER_OUT_OF_GRID_BOUNDARY ) + { + if( neighborY > y ) neighborY = grid->getFirstFluidNode( coords, 1, grid->getStartY() ); + else neighborY = grid->getLastFluidNode ( coords, 1, grid->getEndY() ); + } - uint neighborIndex = grid->transCoordToIndex( x, y, z ); + if( grid->getPeriodicityZ() && grid->getFieldEntry( grid->transCoordToIndex( x, y, neighborZ ) ) == vf::gpu::STOPPER_OUT_OF_GRID_BOUNDARY ) + { + if( neighborZ > z ) neighborZ = grid->getFirstFluidNode( coords, 2, grid->getStartZ() ); + else neighborZ = grid->getLastFluidNode ( coords, 2, grid->getEndZ() ); + } + uint neighborIndex = grid->transCoordToIndex( neighborX, neighborY, neighborZ ); if( grid->getFieldEntry(neighborIndex) == vf::gpu::STOPPER_OUT_OF_GRID_BOUNDARY || grid->getFieldEntry(neighborIndex) == vf::gpu::STOPPER_OUT_OF_GRID || grid->getFieldEntry(neighborIndex) == vf::gpu::STOPPER_SOLID ) qNode[dir] = 0.5; else qNode[dir] = -1.0; + } boundaryCondition->qs.push_back(qNode); @@ -130,6 +177,47 @@ uint Side::getIndex(SPtr<Grid> grid, std::string coord, real constant, real v1, } +void Geometry::addIndices(std::vector<SPtr<Grid> > grids, uint level, SPtr<BoundaryCondition> boundaryCondition) +{ + auto geometryBoundaryCondition = std::dynamic_pointer_cast<GeometryBoundaryCondition>(boundaryCondition); + + std::vector<real> qNode(grids[level]->getEndDirection() + 1); + + for (uint index = 0; index < grids[level]->getSize(); index++) + { + if (grids[level]->getFieldEntry(index) != vf::gpu::BC_SOLID) + continue; + + for (int dir = 0; dir <= grids[level]->getEndDirection(); dir++) + { + const real q = grids[level]->getQValue(index, dir); + + qNode[dir] = q; + + // also the neighbor if any Qs are required + real x,y,z; + grids[level]->transIndexToCoords( index, x, y, z ); + + x += grids[level]->getDirection()[dir * DIMENSION + 0] * grids[level]->getDelta(); + y += grids[level]->getDirection()[dir * DIMENSION + 1] * grids[level]->getDelta(); + z += grids[level]->getDirection()[dir * DIMENSION + 2] * grids[level]->getDelta(); + + uint neighborIndex = grids[level]->transCoordToIndex( x, y, z ); + + if( qNode[dir] < -0.5 && ( grids[level]->getFieldEntry(neighborIndex) == vf::gpu::STOPPER_OUT_OF_GRID_BOUNDARY || + grids[level]->getFieldEntry(neighborIndex) == vf::gpu::STOPPER_OUT_OF_GRID || + grids[level]->getFieldEntry(neighborIndex) == vf::gpu::STOPPER_SOLID ) ) + qNode[dir] = 0.5; + } + + geometryBoundaryCondition->indices.push_back(index); + geometryBoundaryCondition->qs.push_back(qNode); + geometryBoundaryCondition->patches.push_back(grids[level]->getQPatch(index)); + } +} + + + void MX::addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCondition> boundaryCondition) { real startInner = grid[level]->getStartY(); @@ -219,6 +307,6 @@ void PZ::addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<BoundaryCond real coordinateNormal = grid[level]->getEndZ() - grid[level]->getDelta(); if( coordinateNormal < grid[0]->getEndZ() - grid[0]->getDelta() ) return; - + Side::addIndices(grid[level], boundaryCondition, "z", coordinateNormal, startInner, endInner, startOuter, endOuter); } diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h index 260bc18967296e63cc21fc0454c86cdcb65e8719..6df6bfccc9a39b80de3ac43d057a03945d035b34 100644 --- a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h +++ b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h @@ -36,7 +36,7 @@ #include <string> #include <vector> -#include "global.h" +#include "gpu/GridGenerator/global.h" #define X_INDEX 0 #define Y_INDEX 1 @@ -78,12 +78,35 @@ protected: static void setPressureNeighborIndices(SPtr<gg::BoundaryCondition> boundaryCondition, SPtr<Grid> grid, const uint index); + static void setStressSamplingIndices(SPtr<gg::BoundaryCondition> boundaryCondition, SPtr<Grid> grid, const uint index); + static void setQs(SPtr<Grid> grid, SPtr<gg::BoundaryCondition> boundaryCondition, uint index); private: static uint getIndex(SPtr<Grid> grid, std::string coord, real constant, real v1, real v2); }; +class Geometry : public Side +{ +public: + void addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<gg::BoundaryCondition> boundaryCondition) override; + + int getCoordinate() const override + { + return X_INDEX; + } + + int getDirection() const override + { + return NEGATIVE_DIR; + } + + SideType whoAmI() const override + { + return SideType::GEOMETRY; + } +}; + class MX : public Side { public: @@ -233,7 +256,7 @@ public: case SideType::PZ: return SPtr<Side>(new PZ()); case SideType::GEOMETRY: - throw std::runtime_error("SideFactory::make() - SideType::GEOMETRY not supported."); + return SPtr<Side>(new Geometry()); default: throw std::runtime_error("SideFactory::make() - SideType not valid."); } diff --git a/src/gpu/GridGenerator/grid/Cell.h b/src/gpu/GridGenerator/grid/Cell.h index a7a64917025742217be88e7ebe1ccc9e669fc7c0..f39bd4a7bb13be0d768e092276194e6bad16dcff 100644 --- a/src/gpu/GridGenerator/grid/Cell.h +++ b/src/gpu/GridGenerator/grid/Cell.h @@ -33,7 +33,7 @@ #ifndef CELL_H #define CELL_H -#include "global.h" +#include "gpu/GridGenerator/global.h" struct Point { diff --git a/src/gpu/GridGenerator/grid/Field.cpp b/src/gpu/GridGenerator/grid/Field.cpp index d8ac2a80ea6fc5da879c5378aac2eab70016ff72..8e68bfdf7e324a13a4c9d31d493580e56a48b6cd 100644 --- a/src/gpu/GridGenerator/grid/Field.cpp +++ b/src/gpu/GridGenerator/grid/Field.cpp @@ -38,7 +38,6 @@ using namespace vf::gpu; Field::Field(uint size) : size(size) { - } void Field::allocateMemory() @@ -115,7 +114,7 @@ bool Field::isStopperCoarseUnderFine(uint index) const bool Field::isStopperSolid(uint index) const { - return field[index] == STOPPER_SOLID; + return field[index] == STOPPER_SOLID; } bool Field::isStopper(uint index) const @@ -130,7 +129,7 @@ bool Field::isQ(uint index) const bool Field::isBoundaryConditionNode(uint index) const { - return field[index] == BC_SOLID || field[index] == BC_OUTFLOW || field[index] == BC_VELOCITY || field[index] == BC_PRESSURE || field[index] == BC_SLIP; + return field[index] == BC_SOLID || field[index] == BC_OUTFLOW || field[index] == BC_VELOCITY || field[index] == BC_PRESSURE || field[index] == BC_SLIP || field[index] == BC_STRESS; } // --------------------------------------------------------- // diff --git a/src/gpu/GridGenerator/grid/Field.h b/src/gpu/GridGenerator/grid/Field.h index 002c8c108bd405f4077cd2779f5e59232135ace9..bb25b0fc03537b05eaadfa5c3d161f83c1267fae 100644 --- a/src/gpu/GridGenerator/grid/Field.h +++ b/src/gpu/GridGenerator/grid/Field.h @@ -33,7 +33,7 @@ #ifndef FIELD_H #define FIELD_H -#include "global.h" +#include "gpu/GridGenerator/global.h" struct Vertex; @@ -51,28 +51,28 @@ public: bool is(uint index, char type) const; bool isCoarseToFineNode(uint index) const; bool isFineToCoarseNode(uint index) const; - bool isFluid(uint index) const; - bool isInvalidSolid(uint index) const; + bool isFluid(uint index) const; + bool isInvalidSolid(uint index) const; bool isQ(uint index) const; bool isBoundaryConditionNode(uint index) const; bool isInvalidCoarseUnderFine(uint index) const; bool isStopperOutOfGrid(uint index) const; bool isStopperCoarseUnderFine(uint index) const; - bool isStopperSolid(uint index) const; - bool isStopper(uint index) const; + bool isStopperSolid(uint index) const; + bool isStopper(uint index) const; bool isInvalidOutOfGrid(uint index) const; void setFieldEntry(uint index, char val); - void setFieldEntryToFluid(uint index); - void setFieldEntryToInvalidSolid(uint index); + void setFieldEntryToFluid(uint index); + void setFieldEntryToInvalidSolid(uint index); void setFieldEntryToStopperOutOfGrid(uint index); void setFieldEntryToStopperOutOfGridBoundary(uint index); void setFieldEntryToStopperCoarseUnderFine(uint index); void setFieldEntryToInvalidCoarseUnderFine(uint index); void setFieldEntryToInvalidOutOfGrid(uint index); -private: - char *field; +protected: + char *field = nullptr; uint size; }; diff --git a/src/gpu/GridGenerator/grid/Grid.h b/src/gpu/GridGenerator/grid/Grid.h index 3407b23c1efbb4143d06ded7880c26d7c0eb6599..3f28120a5d969fcc5d7b2a3402a2169ff97c0cc3 100644 --- a/src/gpu/GridGenerator/grid/Grid.h +++ b/src/gpu/GridGenerator/grid/Grid.h @@ -28,18 +28,18 @@ // //! \file Grid.h //! \ingroup grid -//! \author Soeren Peters, Stephan Lenz, Martin Schönherr +//! \author Soeren Peters, Stephan Lenz, Martin Sch�nherr //======================================================================================= #ifndef GRID_H #define GRID_H #include "Core/LbmOrGks.h" -#include "global.h" +#include "gpu/GridGenerator/global.h" -#include "geometries/Vertex/Vertex.h" +#include "gpu/GridGenerator/geometries/Vertex/Vertex.h" -#include "grid/Cell.h" +#include "gpu/GridGenerator/grid/Cell.h" class TriangularMesh; struct Vertex; @@ -82,6 +82,7 @@ public: virtual void setFieldEntry(uint matrixIndex, char type) = 0; virtual void getGridInterfaceIndices(uint* iCellCfc, uint* iCellCff, uint* iCellFcc, uint* iCellFcf) const = 0; + virtual bool isSparseIndexInFluidNodeIndicesBorder(uint &sparseIndex) const = 0; virtual int *getNeighborsX() const = 0; virtual int *getNeighborsY() const = 0; @@ -162,11 +163,21 @@ public: virtual uint getNumberOfSendNodes(int direction) = 0; virtual uint getNumberOfReceiveNodes(int direction) = 0; + virtual bool isSendNode(int index) const = 0; + virtual bool isReceiveNode(int index) const = 0; virtual uint getSendIndex(int direction, uint index) = 0; virtual uint getReceiveIndex(int direction, uint index) = 0; - virtual void repairCommunicationInices(int direction) = 0; + virtual void repairCommunicationIndices(int direction) = 0; + // needed for CUDA Streams + virtual void findFluidNodeIndices(bool onlyBulk) = 0; + virtual uint getNumberOfFluidNodes() const = 0; + virtual void getFluidNodeIndices(uint *fluidNodeIndices) const = 0; + + virtual void findFluidNodeIndicesBorder() = 0; + virtual uint getNumberOfFluidNodesBorder() const = 0; + virtual void getFluidNodeIndicesBorder(uint *fluidNodeIndicesBorder) const = 0; }; #endif diff --git a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h index 57290025c3f6e48554e1dafe9bd101ae237b3288..739aef59f76a33fa67d472a77ef258469f5e411c 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h +++ b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h @@ -28,7 +28,7 @@ // //! \file GridBuilder.h //! \ingroup grid -//! \author Soeren Peters, Stephan Lenz, Martin Schönherr +//! \author Soeren Peters, Stephan Lenz, Martin Sch�nherr //======================================================================================= #ifndef GridBuilder_H #define GridBuilder_H @@ -37,7 +37,7 @@ #include <string> #include <memory> -#include "GridGenerator/global.h" +#include "gpu/GridGenerator/global.h" #define GEOMQS 6 #define INLETQS 0 @@ -98,6 +98,13 @@ public: virtual void getSlipValues(real *normalX, real *normalY, real *normalZ, int *indices, int level) const = 0; virtual void getSlipQs(real* qs[27], int level) const = 0; + virtual uint getStressSize(int level) const = 0; + virtual void getStressValues(real *normalX, real *normalY, real *normalZ, + real* vx1, real* vy1, real* vz1, + real* vx, real* vy, real* vz, + int *indices, int* samplingIndices, int* samplingOffsets, real* z0, int level) const = 0; + virtual void getStressQs(real* qs[27], int level) const = 0; + virtual uint getVelocitySize(int level) const = 0; virtual void getVelocityValues(real* vx, real* vy, real* vz, int* indices, int level) const = 0; virtual void getVelocityQs(real* qs[27], int level) const = 0; @@ -118,11 +125,17 @@ public: virtual uint getCommunicationProcess(int direction) = 0; + virtual uint getNumberOfFluidNodes(unsigned int level) const = 0; + virtual void getFluidNodeIndices(uint *fluidNodeIndices, const int level) const = 0; + virtual uint getNumberOfFluidNodesBorder(unsigned int level) const = 0; + virtual void getFluidNodeIndicesBorder(uint *fluidNodeIndices, const int level) const = 0; + virtual uint getNumberOfSendIndices(int direction, uint level) = 0; virtual uint getNumberOfReceiveIndices(int direction, uint level) = 0; virtual void getSendIndices(int *sendIndices, int direction, int level) = 0; virtual void getReceiveIndices(int *sendIndices, int direction, int level) = 0; -}; -#endif + virtual void findFluidNodes(bool splitDomain) = 0; +}; +#endif \ No newline at end of file diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp index 20c285c13aa2c7644fc1ac6ea6a87b5d8dc7f72c..083b9a51e0b151f49922df456e968c4b204e4af7 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp +++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp @@ -28,12 +28,13 @@ // //! \file LevelGridBuilder.cpp //! \ingroup grid -//! \author Soeren Peters, Stephan Lenz, Martin Schönherr +//! \author Soeren Peters, Stephan Lenz, Martin Sch�nherr //======================================================================================= #include "LevelGridBuilder.h" #include <stdio.h> #include <iostream> +#include <algorithm> #include "geometries/Arrow/ArrowImp.h" #include "geometries/BoundingBox/BoundingBox.h" @@ -74,36 +75,94 @@ std::shared_ptr<LevelGridBuilder> LevelGridBuilder::makeShared() return SPtr<LevelGridBuilder>(new LevelGridBuilder()); } -void LevelGridBuilder::setSlipBoundaryCondition(SideType sideType, real nomalX, real normalY, real normalZ) +void LevelGridBuilder::setSlipBoundaryCondition(SideType sideType, real normalX, real normalY, real normalZ) { - SPtr<SlipBoundaryCondition> slipBoundaryCondition = SlipBoundaryCondition::make(nomalX, normalY, normalZ); + for (uint level = 0; level < getNumberOfGridLevels(); level++) + { + if(sideType == SideType::GEOMETRY){ + setSlipGeometryBoundaryCondition(normalX, normalY, normalZ); + }else{ + SPtr<SlipBoundaryCondition> slipBoundaryCondition = SlipBoundaryCondition::make(normalX, normalY, normalZ); + + auto side = SideFactory::make(sideType); + + slipBoundaryCondition->side = side; + slipBoundaryCondition->side->addIndices(grids, level, slipBoundaryCondition); + + slipBoundaryCondition->fillSlipNormalLists(); + boundaryConditions[level]->slipBoundaryConditions.push_back(slipBoundaryCondition); + + *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Slip BC on level " << level << " with " << (int)slipBoundaryCondition->indices.size() << "\n"; + } + } +} + +void LevelGridBuilder::setSlipGeometryBoundaryCondition(real normalX, real normalY, real normalZ) +{ + geometryHasValues = true; + + for (uint level = 0; level < getNumberOfGridLevels(); level++) + { + if (boundaryConditions[level]->geometryBoundaryCondition != nullptr) + { + boundaryConditions[level]->geometryBoundaryCondition->normalX = normalX; + boundaryConditions[level]->geometryBoundaryCondition->normalY = normalY; + boundaryConditions[level]->geometryBoundaryCondition->normalZ = normalZ; + boundaryConditions[level]->geometryBoundaryCondition->side->addIndices(grids, level, boundaryConditions[level]->geometryBoundaryCondition); + + boundaryConditions[level]->geometryBoundaryCondition->fillSlipNormalLists(); + + *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Geometry Slip BC on level " << level << " with " << (int)boundaryConditions[level]->geometryBoundaryCondition->indices.size() <<"\n"; + } + } +} + +void LevelGridBuilder::setStressBoundaryCondition( SideType sideType, + real nomalX, real normalY, real normalZ, + uint samplingOffset, real z0) +{ + for (uint level = 0; level < getNumberOfGridLevels(); level++) + { + SPtr<StressBoundaryCondition> stressBoundaryCondition = StressBoundaryCondition::make(nomalX, normalY, normalZ, samplingOffset, z0); - auto side = SideFactory::make(sideType); + auto side = SideFactory::make(sideType); - slipBoundaryCondition->side = side; - slipBoundaryCondition->side->addIndices(grids, 0, slipBoundaryCondition); + stressBoundaryCondition->side = side; + stressBoundaryCondition->side->addIndices(grids, level, stressBoundaryCondition); - slipBoundaryCondition->fillSlipNormalLists(); + stressBoundaryCondition->fillStressNormalLists(); + stressBoundaryCondition->fillSamplingOffsetLists(); + stressBoundaryCondition->fillZ0Lists(); + // stressBoundaryCondition->fillSamplingIndices(grids, 0, samplingOffset); //redundant with Side::setStressSamplingIndices but potentially a better approach for cases with complex geometries - boundaryConditions[0]->slipBoundaryConditions.push_back(slipBoundaryCondition); + boundaryConditions[level]->stressBoundaryConditions.push_back(stressBoundaryCondition); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Slip BC on level " << 0 << " with " << (int)slipBoundaryCondition->indices.size() << "\n"; + *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Stress BC on level " << level << " with " << (int)stressBoundaryCondition->indices.size() << "\n"; + } } void LevelGridBuilder::setVelocityBoundaryCondition(SideType sideType, real vx, real vy, real vz) { - SPtr<VelocityBoundaryCondition> velocityBoundaryCondition = VelocityBoundaryCondition::make(vx, vy, vz); + if (sideType == SideType::GEOMETRY) + setVelocityGeometryBoundaryCondition(vx, vy, vz); + else + { + for (uint level = 0; level < getNumberOfGridLevels(); level++) + { + SPtr<VelocityBoundaryCondition> velocityBoundaryCondition = VelocityBoundaryCondition::make(vx, vy, vz); - auto side = SideFactory::make(sideType); + auto side = SideFactory::make(sideType); - velocityBoundaryCondition->side = side; - velocityBoundaryCondition->side->addIndices(grids, 0, velocityBoundaryCondition); + velocityBoundaryCondition->side = side; + velocityBoundaryCondition->side->addIndices(grids, level, velocityBoundaryCondition); - velocityBoundaryCondition->fillVelocityLists(); + velocityBoundaryCondition->fillVelocityLists(); - boundaryConditions[0]->velocityBoundaryConditions.push_back(velocityBoundaryCondition); + boundaryConditions[level]->velocityBoundaryConditions.push_back(velocityBoundaryCondition); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Velocity BC on level " << 0 << " with " << (int)velocityBoundaryCondition->indices.size() <<"\n"; + *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Velocity BC on level " << level << " with " << (int)velocityBoundaryCondition->indices.size() <<"\n"; + } + } } void LevelGridBuilder::setVelocityGeometryBoundaryCondition(real vx, real vy, real vz) @@ -150,16 +209,37 @@ void LevelGridBuilder::setPeriodicBoundaryCondition(bool periodic_X, bool period void LevelGridBuilder::setNoSlipBoundaryCondition(SideType sideType) { - for (uint level = 0; level < getNumberOfGridLevels(); level++) - { - SPtr<VelocityBoundaryCondition> noSlipBoundaryCondition = VelocityBoundaryCondition::make(0.0, 0.0, 0.0); + if (sideType == SideType::GEOMETRY) + setNoSlipGeometryBoundaryCondition(); + else { + for (uint level = 0; level < getNumberOfGridLevels(); level++) { + SPtr<VelocityBoundaryCondition> noSlipBoundaryCondition = VelocityBoundaryCondition::make(0.0, 0.0, 0.0); - auto side = SideFactory::make(sideType); + auto side = SideFactory::make(sideType); + + noSlipBoundaryCondition->side = side; + noSlipBoundaryCondition->side->addIndices(grids, level, noSlipBoundaryCondition); + + noSlipBoundaryCondition->fillVelocityLists(); + + // now effectively just a wrapper for velocityBC with zero velocity. No distinction in Gridgenerator. + boundaryConditions[level]->velocityBoundaryConditions.push_back(noSlipBoundaryCondition); + } + } +} - noSlipBoundaryCondition->side = side; - noSlipBoundaryCondition->side->addIndices(grids, level, noSlipBoundaryCondition); +void LevelGridBuilder::setNoSlipGeometryBoundaryCondition() +{ + geometryHasValues = true; - boundaryConditions[level]->noSlipBoundaryConditions.push_back(noSlipBoundaryCondition); + for (uint level = 0; level < getNumberOfGridLevels(); level++) + { + if (boundaryConditions[level]->geometryBoundaryCondition != nullptr) + { + boundaryConditions[level]->geometryBoundaryCondition->side->addIndices(grids, level, boundaryConditions[level]->geometryBoundaryCondition); + + *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Geometry No-Slip BC on level " << level << " with " << (int)boundaryConditions[level]->geometryBoundaryCondition->indices.size() <<"\n"; + } } } @@ -285,7 +365,6 @@ uint LevelGridBuilder::getNumberOfNodes(unsigned int level) const return grids[level]->getSparseSize(); } - std::shared_ptr<Grid> LevelGridBuilder::getGrid(int level, int box) { return this->grids[level]; @@ -315,6 +394,26 @@ void LevelGridBuilder::getNodeValues(real *xCoords, real *yCoords, real *zCoords } +GRIDGENERATOR_EXPORT void LevelGridBuilder::getFluidNodeIndices(uint *fluidNodeIndices, const int level) const +{ + grids[level]->getFluidNodeIndices(fluidNodeIndices); +} + +GRIDGENERATOR_EXPORT void LevelGridBuilder::getFluidNodeIndicesBorder(uint *fluidNodeIndices, const int level) const +{ + grids[level]->getFluidNodeIndicesBorder(fluidNodeIndices); +} + +uint LevelGridBuilder::getNumberOfFluidNodes(unsigned int level) const +{ + return grids[level]->getNumberOfFluidNodes(); +} + +GRIDGENERATOR_EXPORT uint LevelGridBuilder::getNumberOfFluidNodesBorder(unsigned int level) const +{ + return grids[level]->getNumberOfFluidNodesBorder(); +} + uint LevelGridBuilder::getSlipSize(int level) const { uint size = 0; @@ -333,7 +432,7 @@ void LevelGridBuilder::getSlipValues(real* normalX, real* normalY, real* normalZ for (uint index = 0; index < boundaryCondition->indices.size(); index++) { indices[allIndicesCounter] = grids[level]->getSparseIndex(boundaryCondition->indices[index]) + 1; - + normalX[allIndicesCounter] = boundaryCondition->getNormalx(index); normalY[allIndicesCounter] = boundaryCondition->getNormaly(index); normalZ[allIndicesCounter] = boundaryCondition->getNormalz(index); @@ -358,6 +457,57 @@ void LevelGridBuilder::getSlipQs(real* qs[27], int level) const } } +uint LevelGridBuilder::getStressSize(int level) const +{ + uint size = 0; + for (auto boundaryCondition : boundaryConditions[level]->stressBoundaryConditions) + { + size += uint(boundaryCondition->indices.size()); + } + return size; +} + +void LevelGridBuilder::getStressValues( real* normalX, real* normalY, real* normalZ, + real* vx, real* vy, real* vz, + real* vx1, real* vy1, real* vz1, + int* indices, int* samplingIndices, int* samplingOffset, real* z0, int level) const +{ + + int allIndicesCounter = 0; + for (auto boundaryCondition : boundaryConditions[level]->stressBoundaryConditions) + { + for (uint index = 0; index < boundaryCondition->indices.size(); index++) + { + indices[allIndicesCounter] = grids[level]->getSparseIndex(boundaryCondition->indices[index]) + 1; + samplingIndices[allIndicesCounter] = grids[level]->getSparseIndex(boundaryCondition->velocitySamplingIndices[index]) + 1; + + normalX[allIndicesCounter] = boundaryCondition->getNormalx(index); + normalY[allIndicesCounter] = boundaryCondition->getNormaly(index); + normalZ[allIndicesCounter] = boundaryCondition->getNormalz(index); + + samplingOffset[allIndicesCounter] = boundaryCondition->getSamplingOffset(index); + z0[allIndicesCounter] = boundaryCondition->getZ0(index); + allIndicesCounter++; + } + } +} + +void LevelGridBuilder::getStressQs(real* qs[27], int level) const +{ + int allIndicesCounter = 0; + for (auto boundaryCondition : boundaryConditions[level]->stressBoundaryConditions) + { + for (uint index = 0; index < boundaryCondition->indices.size(); index++) + { + for (int dir = 0; dir <= grids[level]->getEndDirection(); dir++) + { + qs[dir][allIndicesCounter] = boundaryCondition->qs[index][dir]; + } + allIndicesCounter++; + } + } +} + uint LevelGridBuilder::getVelocitySize(int level) const { uint size = 0; @@ -373,13 +523,13 @@ void LevelGridBuilder::getVelocityValues(real* vx, real* vy, real* vz, int* indi int allIndicesCounter = 0; for (auto boundaryCondition : boundaryConditions[level]->velocityBoundaryConditions) { - for(std::size_t i = 0; i < boundaryCondition->indices.size(); i++) + for (uint i = 0; i < (uint)boundaryCondition->indices.size(); i++) { indices[allIndicesCounter] = grids[level]->getSparseIndex(boundaryCondition->indices[i]) +1; - vx[allIndicesCounter] = boundaryCondition->getVx((uint)i); - vy[allIndicesCounter] = boundaryCondition->getVy((uint)i); - vz[allIndicesCounter] = boundaryCondition->getVz((uint)i); + vx[allIndicesCounter] = boundaryCondition->getVx(i); + vy[allIndicesCounter] = boundaryCondition->getVy(i); + vz[allIndicesCounter] = boundaryCondition->getVz(i); allIndicesCounter++; } } @@ -517,3 +667,11 @@ GRIDGENERATOR_EXPORT SPtr<GeometryBoundaryCondition> LevelGridBuilder::getGeomet { return this->boundaryConditions[level]->geometryBoundaryCondition; } + +void LevelGridBuilder::findFluidNodes(bool splitDomain) +{ + *logging::out << logging::Logger::INFO_HIGH << "Start findFluidNodes()\n"; + for (uint i = 0; i < grids.size(); i++) + grids[i]->findFluidNodeIndices(splitDomain); + *logging::out << logging::Logger::INFO_HIGH << "Done with findFluidNodes()\n"; +} \ No newline at end of file diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h index f2325435d99140f33eee9844c13908de87788558..afb027fc1665ab874523bf39ec2a05518d28f7a1 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h +++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h @@ -28,7 +28,7 @@ // //! \file LevelGridBuilder.h //! \ingroup grid -//! \author Soeren Peters, Stephan Lenz, Martin Schönherr +//! \author Soeren Peters, Stephan Lenz, Martin Sch�nherr //======================================================================================= #ifndef LEVEL_GRID_BUILDER_H #define LEVEL_GRID_BUILDER_H @@ -38,11 +38,12 @@ #include <memory> #include <array> -#include "global.h" +#include "gpu/GridGenerator/global.h" -#include "grid/GridBuilder/GridBuilder.h" -#include "grid/Grid.h" -#include "grid/NodeValues.h" +#include "gpu/GridGenerator/grid/GridBuilder/GridBuilder.h" +#include "gpu/GridGenerator/grid/Grid.h" +#include "gpu/GridGenerator/grid/GridInterface.h" +#include "gpu/GridGenerator/grid/NodeValues.h" struct Vertex; class Grid; @@ -54,6 +55,7 @@ class BoundingBox; class Side; class VelocityBoundaryCondition; class SlipBoundaryCondition; +class StressBoundaryCondition; class PressureBoundaryCondition; class GeometryBoundaryCondition; enum class SideType; @@ -70,9 +72,10 @@ public: GRIDGENERATOR_EXPORT SPtr<Grid> getGrid(uint level) override; - GRIDGENERATOR_EXPORT virtual ~LevelGridBuilder(); + GRIDGENERATOR_EXPORT ~LevelGridBuilder() override; GRIDGENERATOR_EXPORT void setSlipBoundaryCondition(SideType sideType, real nomalX, real normalY, real normalZ); + GRIDGENERATOR_EXPORT void setStressBoundaryCondition(SideType sideType, real nomalX, real normalY, real normalZ, uint samplingOffset, real z0); GRIDGENERATOR_EXPORT void setVelocityBoundaryCondition(SideType sideType, real vx, real vy, real vz); GRIDGENERATOR_EXPORT void setPressureBoundaryCondition(SideType sideType, real rho); GRIDGENERATOR_EXPORT void setPeriodicBoundaryCondition(bool periodic_X, bool periodic_Y, bool periodic_Z); @@ -82,12 +85,16 @@ public: GRIDGENERATOR_EXPORT void setCommunicationProcess(int direction, uint process); - GRIDGENERATOR_EXPORT uint getCommunicationProcess(int direction) override; + GRIDGENERATOR_EXPORT virtual uint getCommunicationProcess(int direction) override; - GRIDGENERATOR_EXPORT virtual std::shared_ptr<Grid> getGrid(int level, int box); + GRIDGENERATOR_EXPORT std::shared_ptr<Grid> getGrid(int level, int box); GRIDGENERATOR_EXPORT virtual unsigned int getNumberOfNodes(unsigned int level) const override; + GRIDGENERATOR_EXPORT virtual uint getNumberOfFluidNodes(unsigned int level) const override; + GRIDGENERATOR_EXPORT virtual void getFluidNodeIndices(uint* fluidNodeIndices, const int level) const override; + GRIDGENERATOR_EXPORT virtual uint getNumberOfFluidNodesBorder(unsigned int level) const override; + GRIDGENERATOR_EXPORT virtual void getFluidNodeIndicesBorder(uint *fluidNodeIndices, const int level) const override; GRIDGENERATOR_EXPORT virtual void getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, @@ -99,6 +106,13 @@ public: GRIDGENERATOR_EXPORT virtual void getSlipValues(real* normalX, real* normalY, real* normalZ, int* indices, int level) const override; GRIDGENERATOR_EXPORT virtual void getSlipQs(real* qs[27], int level) const override; + GRIDGENERATOR_EXPORT uint getStressSize(int level) const override; + GRIDGENERATOR_EXPORT virtual void getStressValues( real* normalX, real* normalY, real* normalZ, + real* vx, real* vy, real* vz, + real* vx1, real* vy1, real* vz1, + int* indices, int* samplingIndices, int* samplingOffsets, real* z0, int level) const override; + GRIDGENERATOR_EXPORT virtual void getStressQs(real* qs[27], int level) const override; + GRIDGENERATOR_EXPORT uint getVelocitySize(int level) const override; GRIDGENERATOR_EXPORT virtual void getVelocityValues(real* vx, real* vy, real* vz, int* indices, int level) const override; GRIDGENERATOR_EXPORT virtual void getVelocityQs(real* qs[27], int level) const override; @@ -123,15 +137,17 @@ protected: struct BoundaryConditions { - BoundaryConditions() {} + BoundaryConditions() = default; std::vector<SPtr<SlipBoundaryCondition>> slipBoundaryConditions; + std::vector<SPtr<StressBoundaryCondition>> stressBoundaryConditions; + std::vector<SPtr<VelocityBoundaryCondition>> velocityBoundaryConditions; std::vector<SPtr<PressureBoundaryCondition>> pressureBoundaryConditions; - std::vector<SPtr<VelocityBoundaryCondition> > noSlipBoundaryConditions; + std::vector<SPtr<VelocityBoundaryCondition>> noSlipBoundaryConditions; SPtr<GeometryBoundaryCondition> geometryBoundaryCondition; }; @@ -146,6 +162,8 @@ protected: protected: void setVelocityGeometryBoundaryCondition(real vx, real vy, real vz); + void setNoSlipGeometryBoundaryCondition(); + void setSlipGeometryBoundaryCondition(real normalX, real normalY, real normalZ); void createBCVectors(); void addShortQsToVector(int index); @@ -158,7 +176,7 @@ public: GRIDGENERATOR_EXPORT void getGridInformations(std::vector<int>& gridX, std::vector<int>& gridY, std::vector<int>& gridZ, std::vector<int>& distX, std::vector<int>& distY, std::vector<int>& distZ) override; - GRIDGENERATOR_EXPORT uint getNumberOfGridLevels() const override; + GRIDGENERATOR_EXPORT virtual uint getNumberOfGridLevels() const override; GRIDGENERATOR_EXPORT uint getNumberOfNodesCF(int level) override; GRIDGENERATOR_EXPORT uint getNumberOfNodesFC(int level) override; @@ -168,10 +186,14 @@ public: GRIDGENERATOR_EXPORT void getOffsetFC(real* xOffCf, real* yOffCf, real* zOffCf, int level) override; GRIDGENERATOR_EXPORT void getOffsetCF(real* xOffFc, real* yOffFc, real* zOffFc, int level) override; - GRIDGENERATOR_EXPORT uint getNumberOfSendIndices(int direction, uint level) override; - GRIDGENERATOR_EXPORT uint getNumberOfReceiveIndices(int direction, uint level) override; - GRIDGENERATOR_EXPORT void getSendIndices(int *sendIndices, int direction, int level) override; - GRIDGENERATOR_EXPORT void getReceiveIndices(int *sendIndices, int direction, int level) override; + GRIDGENERATOR_EXPORT virtual uint getNumberOfSendIndices(int direction, uint level) override; + GRIDGENERATOR_EXPORT virtual uint getNumberOfReceiveIndices(int direction, uint level) override; + GRIDGENERATOR_EXPORT virtual void getSendIndices(int *sendIndices, int direction, int level) override; + GRIDGENERATOR_EXPORT virtual void getReceiveIndices(int *sendIndices, int direction, int level) override; + + + // needed for CUDA Streams MultiGPU (Communication Hiding) + void findFluidNodes(bool splitDomain) override; }; #endif diff --git a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp index 565a02a2807ef15679bf08fa001ea9a03f78ca4e..da18a883181069f089e7232c9cd1b4f19cc9dc35 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp +++ b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp @@ -28,7 +28,7 @@ // //! \file MultipleGridBuilder.cpp //! \ingroup grid -//! \author Soeren Peters, Stephan Lenz, Martin Schönherr +//! \author Soeren Peters, Stephan Lenz, Martin Sch�nherr //======================================================================================= #include "MultipleGridBuilder.h" @@ -49,14 +49,14 @@ #include "io/GridVTKWriter/GridVTKWriter.h" #include "io/STLReaderWriter/STLWriter.h" -MultipleGridBuilder::MultipleGridBuilder() : LevelGridBuilder(), numberOfLayersFine(12), numberOfLayersBetweenLevels(8), subDomainBox(nullptr) +MultipleGridBuilder::MultipleGridBuilder(SPtr<GridFactory> gridFactory) : LevelGridBuilder(), gridFactory(gridFactory), numberOfLayersFine(12), numberOfLayersBetweenLevels(8), subDomainBox(nullptr) { } -SPtr<MultipleGridBuilder> MultipleGridBuilder::makeShared() +SPtr<MultipleGridBuilder> MultipleGridBuilder::makeShared(SPtr<GridFactory> gridFactory) { - return SPtr<MultipleGridBuilder>(new MultipleGridBuilder()); + return SPtr<MultipleGridBuilder>(new MultipleGridBuilder(gridFactory)); } void MultipleGridBuilder::addCoarseGrid(real startX, real startY, real startZ, real endX, real endY, real endZ, real delta) @@ -195,7 +195,7 @@ void MultipleGridBuilder::addGridToListIfValid(SPtr<Grid> grid) SPtr<Grid> MultipleGridBuilder::makeGrid(Object* gridShape, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, uint level) const { - return GridImp::makeShared(gridShape, startX, startY, startZ, endX, endY, endZ, delta, "D3Q27", level); + return gridFactory->makeGrid(gridShape, startX, startY, startZ, endX, endY, endZ, delta, level); } bool MultipleGridBuilder::coarseGridExists() const diff --git a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h index 839e0036bbc6b0f5d28bec5da3a0abe637b7adca..2d2dc8bf0345288912132551c5d94b5caec44965 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h +++ b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h @@ -35,12 +35,12 @@ #include <vector> #include <array> -#include "GridGenerator_export.h" #include "Core/LbmOrGks.h" #include "global.h" #include "grid/GridBuilder/LevelGridBuilder.h" +#include "grid/GridFactory.h" #include "grid/distributions/Distribution.h" class Object; @@ -49,10 +49,10 @@ class BoundingBox; class MultipleGridBuilder : public LevelGridBuilder { private: - GRIDGENERATOR_EXPORT MultipleGridBuilder(); + GRIDGENERATOR_EXPORT MultipleGridBuilder(SPtr<GridFactory> gridFactory); public: - GRIDGENERATOR_EXPORT static SPtr<MultipleGridBuilder> makeShared(); + GRIDGENERATOR_EXPORT static SPtr<MultipleGridBuilder> makeShared(SPtr<GridFactory> gridFactory); GRIDGENERATOR_EXPORT void addCoarseGrid(real startX, real startY, real startZ, real endX, real endY, real endZ, real delta); GRIDGENERATOR_EXPORT void addGrid(Object *gridShape); @@ -103,6 +103,7 @@ private: static void emitNoCoarseGridExistsWarning(); static void emitGridIsNotInCoarseGridWarning(); + SPtr<GridFactory> gridFactory; Object *solidObject = nullptr; uint numberOfLayersFine; diff --git a/src/gpu/GridGenerator/grid/GridFactory.h b/src/gpu/GridGenerator/grid/GridFactory.h index b525596fa670a026d60b1297c75ef69c46b23498..53d358d5325390394f1d38694de605e5cc0d2f56 100644 --- a/src/gpu/GridGenerator/grid/GridFactory.h +++ b/src/gpu/GridGenerator/grid/GridFactory.h @@ -36,6 +36,7 @@ #include "global.h" #include "geometries/Cuboid/Cuboid.h" +#include "geometries/TriangularMesh/TriangularMeshStrategy.h" #include "grid/GridImp.h" @@ -54,8 +55,33 @@ public: SPtr<Grid> makeGrid(Object* gridShape, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, uint level, const std::string& d3Qxx = "D3Q27") { - return GridImp::makeShared(gridShape, startX, startY, startZ, endX, endY, endZ, delta, d3Qxx, level); + SPtr<GridImp> grid; + + grid = GridImp::makeShared(gridShape, startX, startY, startZ, endX, endY, endZ, delta, d3Qxx, level); + + grid->setTriangularMeshDiscretizationStrategy(new PointInObjectDiscretizationStrategy()); + + return grid; + } + + void setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod triangularMeshDiscretizationMethod) + { + switch (triangularMeshDiscretizationMethod) + { + case TriangularMeshDiscretizationMethod::POINT_UNDER_TRIANGLE: + triangularMeshDiscretizationStrategy = new PointUnderTriangleStrategy(); + break; + case TriangularMeshDiscretizationMethod::RAYCASTING: + triangularMeshDiscretizationStrategy = new RayCastingDiscretizationStrategy(); + break; + case TriangularMeshDiscretizationMethod::POINT_IN_OBJECT: + triangularMeshDiscretizationStrategy = new PointInObjectDiscretizationStrategy(); + break; + } } + +private: + TriangularMeshDiscretizationStrategy* triangularMeshDiscretizationStrategy; }; diff --git a/src/gpu/GridGenerator/grid/GridImp.cpp b/src/gpu/GridGenerator/grid/GridImp.cpp index efe62002ac6ea00e90e63a7253324b44a77d5b9c..31bbf3ddc87184846fcb01a3e6631358b6a6f864 100644 --- a/src/gpu/GridGenerator/grid/GridImp.cpp +++ b/src/gpu/GridGenerator/grid/GridImp.cpp @@ -32,11 +32,10 @@ //======================================================================================= #include "GridImp.h" -#include <stdio.h> -#include <time.h> #include <iostream> #include <omp.h> #include <sstream> +# include <algorithm> #include <cmath> #include "global.h" @@ -160,24 +159,24 @@ void GridImp::inital(const SPtr<Grid> fineGrid, uint numberOfLayers) #pragma omp parallel for for (int xIdx = 0; xIdx < (int)this->nx; xIdx++) { for (uint yIdx = 0; yIdx < this->ny; yIdx++) { - this->fixRefinementIntoWall(xIdx, yIdx, 0, 3); - this->fixRefinementIntoWall(xIdx, yIdx, this->nz - 1, -3); + this->fixRefinementIntoWall( xIdx, yIdx, 0 , 3 ); + this->fixRefinementIntoWall( xIdx, yIdx, this->nz - 1, -3 ); } } #pragma omp parallel for for (int xIdx = 0; xIdx < (int)this->nx; xIdx++) { for (uint zIdx = 0; zIdx < this->nz; zIdx++) { - this->fixRefinementIntoWall(xIdx, 0, zIdx, 2); - this->fixRefinementIntoWall(xIdx, this->ny - 1, zIdx, -2); + this->fixRefinementIntoWall( xIdx, 0 , zIdx, 2 ); + this->fixRefinementIntoWall( xIdx, this->ny - 1, zIdx, -2 ); } } #pragma omp parallel for for (int yIdx = 0; yIdx < (int)this->ny; yIdx++) { for (uint zIdx = 0; zIdx < this->nz; zIdx++) { - this->fixRefinementIntoWall(0, yIdx, zIdx, 1); - this->fixRefinementIntoWall(this->nx - 1, yIdx, zIdx, -1); + this->fixRefinementIntoWall( 0 , yIdx, zIdx, 1 ); + this->fixRefinementIntoWall( this->nx - 1, yIdx, zIdx, -1 ); } } } @@ -186,7 +185,7 @@ void GridImp::inital(const SPtr<Grid> fineGrid, uint numberOfLayers) #pragma omp parallel for for (int index = 0; index < (int)this->size; index++) this->findEndOfGridStopperNode(index); - + *logging::out << logging::Logger::INFO_INTERMEDIATE << "Grid created: " << "from (" << this->startX << ", " << this->startY << ", " << this->startZ << ") to (" << this->endX << ", " << this->endY << ", " << this->endZ << ")\n" << "nodes: " << this->nx << " x " << this->ny << " x " << this->nz << " = " << this->size << "\n"; @@ -440,7 +439,7 @@ void GridImp::findEndOfGridStopperNode(uint index) else this->field.setFieldEntryToStopperOutOfGridBoundary(index); } - + if (isValidEndOfGridBoundaryStopper(index)) this->field.setFieldEntryToStopperOutOfGridBoundary(index); } @@ -868,6 +867,7 @@ void GridImp::findSparseIndices(SPtr<Grid> finerGrid) if (fineGrid) { fineGrid->updateSparseIndices(); + this->findForGridInterfaceNewIndices(fineGrid); } const uint newGridSize = this->getSparseSize(); @@ -875,6 +875,16 @@ void GridImp::findSparseIndices(SPtr<Grid> finerGrid) << ", delete nodes:" << this->getSize() - newGridSize << "\n"; } +void GridImp::findForGridInterfaceNewIndices(SPtr<GridImp> fineGrid) +{ +#pragma omp parallel for + for (int index = 0; index < (int)this->getNumberOfNodesCF(); index++) + this->gridInterface->findForGridInterfaceSparseIndexCF(this, fineGrid.get(), index); + +#pragma omp parallel for + for (int index = 0; index < (int)this->getNumberOfNodesFC(); index++) + this->gridInterface->findForGridInterfaceSparseIndexFC(this, fineGrid.get(), index); +} void GridImp::updateSparseIndices() { @@ -896,6 +906,53 @@ void GridImp::updateSparseIndices() sparseSize = size - removedNodes; } +void GridImp::findFluidNodeIndices(bool splitDomain) +{ + // find sparse index of all fluid nodes + this->fluidNodeIndices.clear(); + for (uint index = 0; index < this->size; index++) { + int sparseIndex = this->getSparseIndex(index); + if (sparseIndex == -1) + continue; + if (this->field.isFluid(index)) + this->fluidNodeIndices.push_back((uint)sparseIndex+1); // + 1 for numbering shift between GridGenerator and VF_GPU + } + + // If splitDomain: find fluidNodeIndicesBorder and remove all indices in fluidNodeIndicesBorder from fluidNodeIndices + if (splitDomain) { + findFluidNodeIndicesBorder(); + std::sort(this->fluidNodeIndices.begin(), this->fluidNodeIndices.end()); + auto iterator = std::set_difference(this->fluidNodeIndices.begin(), this->fluidNodeIndices.end(), + this->fluidNodeIndicesBorder.begin(), this->fluidNodeIndicesBorder.end(), + this->fluidNodeIndices.begin()); + this->fluidNodeIndices.resize(iterator - this->fluidNodeIndices.begin()); + } +} + +void GridImp::findFluidNodeIndicesBorder() { + this->fluidNodeIndicesBorder.clear(); + + // resize fluidNodeIndicesBorder (for better performance in copy operation) + size_t newSize = 0; + for (CommunicationIndices& ci : this->communicationIndices) + newSize += ci.sendIndices.size(); + this->fluidNodeIndicesBorder.reserve(newSize); + + // copy all send indices to fluidNodeIndicesBorder + for (CommunicationIndices& ci : this->communicationIndices) + std::copy(ci.sendIndices.begin(), ci.sendIndices.end(), std::back_inserter(this->fluidNodeIndicesBorder)); + + // remove duplicate elements + std::sort(this->fluidNodeIndicesBorder.begin(), this->fluidNodeIndicesBorder.end()); + this->fluidNodeIndicesBorder.erase( + std::unique(this->fluidNodeIndicesBorder.begin(), this->fluidNodeIndicesBorder.end()), + this->fluidNodeIndicesBorder.end()); + + // + 1 for numbering shift between GridGenerator and VF_GPU + for (size_t i = 0; i < this->fluidNodeIndicesBorder.size(); i++) + this->fluidNodeIndicesBorder[i] = this->getSparseIndex(this->fluidNodeIndicesBorder[i])+1; +} + void GridImp::setNeighborIndices(uint index) { real x, y, z; @@ -936,13 +993,13 @@ void GridImp::setStopperNeighborCoords(uint index) real x, y, z; this->transIndexToCoords(index, x, y, z); - if (vf::Math::lessEqual(x + delta, endX) && !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x + delta, y, z))) + if (vf::Math::lessEqual(x + delta, endX + (0.5 * delta)) && !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x + delta, y, z))) neighborIndexX[index] = getSparseIndex(x + delta, y, z); - if (vf::Math::lessEqual(y + delta, endY) && !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x, y + delta, z))) + if (vf::Math::lessEqual(y + delta, endY + (0.5 * delta)) && !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x, y + delta, z))) neighborIndexY[index] = getSparseIndex(x, y + delta, z); - if (vf::Math::lessEqual(z + delta, endZ) && !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x, y, z + delta))) + if (vf::Math::lessEqual(z + delta, endZ + (0.5 * delta)) && !this->field.isInvalidOutOfGrid(this->transCoordToIndex(x, y, z + delta))) neighborIndexZ[index] = getSparseIndex(x, y, z + delta); if (vf::Math::greaterEqual(x - delta, endX) && @@ -1156,7 +1213,7 @@ void GridImp::findInvalidBoundaryNodes(uint index) // --------------------------------------------------------- // void GridImp::mesh(Object* object) { - TriangularMesh* triangularMesh = dynamic_cast<TriangularMesh*>(object); + TriangularMesh *triangularMesh = dynamic_cast<TriangularMesh *>(object); if (triangularMesh) triangularMeshDiscretizationStrategy->discretize(triangularMesh, this, INVALID_SOLID, FLUID); else @@ -1206,7 +1263,7 @@ void GridImp::mesh(Triangle &triangle) continue; const Vertex point(x, y, z); - const int value = triangle.isUnderFace(point); + const char value = triangle.isUnderFace(point); //setDebugPoint(index, value); if (value == Q_DEPRECATED) @@ -1223,6 +1280,7 @@ void GridImp::closeNeedleCells() uint numberOfClosedNeedleCells = 0; do{ + numberOfClosedNeedleCells = 0; #pragma omp parallel for reduction(+ : numberOfClosedNeedleCells) for (int index = 0; index < (int)this->size; index++) { if (this->closeCellIfNeedle(index)) @@ -1263,6 +1321,7 @@ void GridImp::closeNeedleCellsThinWall() uint numberOfClosedNeedleCells = 0; do{ + numberOfClosedNeedleCells = 0; #pragma omp parallel for reduction(+ : numberOfClosedNeedleCells) for (int index = 0; index < (int)this->size; index++) { if (this->closeCellIfNeedleThinWall(index)) @@ -1446,7 +1505,6 @@ void GridImp::calculateQs(const uint index, const Vertex &point, Object* object) this->qPatches[ this->qIndices[index] ] = 0; - //printf("%d %f \n", this->qIndices[index], subdistance); } } } @@ -1626,6 +1684,27 @@ void GridImp::findCommunicationIndex( uint index, real coordinate, real limit, i } } +bool GridImp::isSendNode(int index) const +{ + bool isSendNode = false; + for (size_t direction = 0; direction < this->communicationIndices.size(); direction++) + if (std::find(this->communicationIndices[direction].sendIndices.begin(), + this->communicationIndices[direction].sendIndices.end(), index) != this->communicationIndices[direction].sendIndices.end()) + isSendNode = true; + return isSendNode; +} + +bool GridImp::isReceiveNode(int index) const +{ + bool isReceiveNode = false; + for (size_t direction = 0; direction < this->communicationIndices.size(); direction++) + if (std::find(this->communicationIndices[direction].receiveIndices.begin(), + this->communicationIndices[direction].receiveIndices.end(), + index) != this->communicationIndices[direction].receiveIndices.end()) + isReceiveNode = true; + return isReceiveNode; +} + uint GridImp::getNumberOfSendNodes(int direction) { return (uint)this->communicationIndices[direction].sendIndices.size(); @@ -1646,7 +1725,7 @@ uint GridImp::getReceiveIndex(int direction, uint index) return this->communicationIndices[direction].receiveIndices[ index ]; } -void GridImp::repairCommunicationInices(int direction ) +void GridImp::repairCommunicationIndices(int direction) { this->communicationIndices[direction].sendIndices.insert( this->communicationIndices[direction].sendIndices.end(), this->communicationIndices[direction+1].sendIndices.begin(), @@ -1787,7 +1866,11 @@ uint GridImp::getSize() const uint GridImp::getSparseSize() const { - return this->sparseSize; + return this->sparseSize; +} + +uint GridImp::getNumberOfFluidNodes() const { + return (uint)this->fluidNodeIndices.size(); } Field GridImp::getField() const @@ -1930,6 +2013,12 @@ void GridImp::getGridInterface(uint* gridInterfaceList, const uint* oldGridInter gridInterfaceList[i] = oldGridInterfaceList[i] + 1; // + 1 for numbering shift between GridGenerator and VF_GPU } +bool GridImp::isSparseIndexInFluidNodeIndicesBorder(uint &sparseIndex) const +{ + return std::find(this->fluidNodeIndicesBorder.begin(), this->fluidNodeIndicesBorder.end(), sparseIndex) != + this->fluidNodeIndicesBorder.end(); +} + #define GEOFLUID 19 #define GEOSOLID 16 @@ -1944,7 +2033,7 @@ void GridImp::getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *n geo[0] = GEOSOLID; int nodeNumber = 0; - for (uint i = 0; i < this->getSize(); i++) + for (uint i = 0; i < this->size; i++) { if (this->sparseIndices[i] == -1) continue; @@ -1974,10 +2063,27 @@ void GridImp::getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *n } } +void GridImp::getFluidNodeIndices(uint *fluidNodeIndices) const +{ + for (uint nodeNumber = 0; nodeNumber < (uint)this->fluidNodeIndices.size(); nodeNumber++) + fluidNodeIndices[nodeNumber] = this->fluidNodeIndices[nodeNumber]; +} + +uint GridImp::getNumberOfFluidNodesBorder() const +{ + return (uint)this->fluidNodeIndicesBorder.size(); +} + +void GridImp::getFluidNodeIndicesBorder(uint *fluidNodeIndicesBorder) const +{ + for (uint nodeNumber = 0; nodeNumber < (uint)this->fluidNodeIndicesBorder.size(); nodeNumber++) + fluidNodeIndicesBorder[nodeNumber] = this->fluidNodeIndicesBorder[nodeNumber]; +} + void GridImp::print() const { printf("min: (%2.4f, %2.4f, %2.4f), max: (%2.4f, %2.4f, %2.4f), size: %d, delta: %2.4f\n", startX, startY, startZ, endX, endY, endZ, size, delta); if(this->gridInterface) this->gridInterface->print(); -} \ No newline at end of file +} diff --git a/src/gpu/GridGenerator/grid/GridImp.h b/src/gpu/GridGenerator/grid/GridImp.h index 7d44b0bb58168a6bf4da87ad94cf5a8f533002ed..edb5ca916bf68dcf992ea214dcddb2dc43810352 100644 --- a/src/gpu/GridGenerator/grid/GridImp.h +++ b/src/gpu/GridGenerator/grid/GridImp.h @@ -28,7 +28,7 @@ // //! \file GridImp.h //! \ingroup grid -//! \author Soeren Peters, Stephan Lenz, Martin Schönherr +//! \author Soeren Peters, Stephan Lenz, Martin Schoenherr //======================================================================================= #ifndef GRID_IMP_H #define GRID_IMP_H @@ -37,12 +37,12 @@ #include "Core/LbmOrGks.h" -#include "global.h" +#include "gpu/GridGenerator/global.h" -#include "grid/distributions/Distribution.h" -#include "grid/Grid.h" -#include "grid/Cell.h" -#include "grid/Field.h" +#include "gpu/GridGenerator/grid/distributions/Distribution.h" +#include "gpu/GridGenerator/grid/Grid.h" +#include "gpu/GridGenerator/grid/Cell.h" +#include "gpu/GridGenerator/grid/Field.h" class TriangularMesh; struct Vertex; @@ -53,29 +53,30 @@ class BoundingBox; class TriangularMeshDiscretizationStrategy; #ifdef __GNUC__ -#ifndef __clang__ -#pragma push -#pragma diag_suppress = 3156 -#endif + #ifndef __clang__ + #pragma push + #pragma nv_diag_suppress = 3156 + #endif #endif // GCC: warning #3156-D: extern declaration of the entity DIRECTIONS is treated as a static definition extern int DIRECTIONS[DIR_END_MAX][DIMENSION]; #ifdef __GNUC__ -#ifndef __clang__ -#pragma pop -#endif + #ifndef __clang__ + #pragma pop + #endif #endif class GRIDGENERATOR_EXPORT GridImp : public enableSharedFromThis<GridImp>, public Grid { -private: +protected: GridImp() = default; GridImp(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, Distribution d, uint level); public: static SPtr<GridImp> makeShared(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, std::string d3Qxx, uint level); + virtual ~GridImp() = default; private: void initalNumberOfNodesAndSize(); @@ -109,13 +110,14 @@ private: uint sparseSize; bool periodicityX = false, periodicityY = false, periodicityZ = false; - Field field; Object* object; GridInterface *gridInterface; - int *neighborIndexX, *neighborIndexY, *neighborIndexZ, *neighborIndexNegative; int *sparseIndices; + std::vector<uint> fluidNodeIndices; + std::vector<uint> fluidNodeIndicesBorder; + uint *qIndices; //maps from matrix index to qIndex real *qValues; uint *qPatches; @@ -126,10 +128,14 @@ private: TriangularMeshDiscretizationStrategy *triangularMeshDiscretizationStrategy; - uint numberOfSolidBoundaryNodes; + uint numberOfSolidBoundaryNodes = 0; bool enableFixRefinementIntoTheWall; +protected: + Field field; + int *neighborIndexX, *neighborIndexY, *neighborIndexZ, *neighborIndexNegative; + public: void inital(const SPtr<Grid> fineGrid, uint numberOfLayers) override; void setOddStart(bool xOddStart, bool yOddStart, bool zOddStart) override; @@ -152,11 +158,11 @@ public: uint transCoordToIndex(const real &x, const real &y, const real &z) const override; void transIndexToCoords(uint index, real &x, real &y, real &z) const override; - virtual void findGridInterface(SPtr<Grid> grid, LbmOrGks lbmOrGks) override; + void findGridInterface(SPtr<Grid> grid, LbmOrGks lbmOrGks) override; void repairGridInterfaceOnMultiGPU(SPtr<Grid> fineGrid) override; - virtual void limitToSubDomain(SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks) override; + void limitToSubDomain(SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks) override; void freeMemory() override; @@ -209,7 +215,7 @@ public: bool isNode(uint index, char type) const; bool nodeInNextCellIs(int index, char type) const; bool hasAllNeighbors(uint index) const; - bool hasNeighborOfType(uint index, char type)const; + bool hasNeighborOfType(uint index, char type) const; bool cellContainsOnly(Cell &cell, char type) const; bool cellContainsOnly(Cell &cell, char typeA, char typeB) const; @@ -246,8 +252,11 @@ public: uint getNumberOfNodesCF() const override; uint getNumberOfNodesFC() const override; void getGridInterfaceIndices(uint *iCellCfc, uint *iCellCff, uint *iCellFcc, uint *iCellFcf) const override; + static void getGridInterface(uint *gridInterfaceList, const uint *oldGridInterfaceList, uint size); + bool isSparseIndexInFluidNodeIndicesBorder(uint &sparseIndex) const override; + int *getNeighborsX() const override; int* getNeighborsY() const override; int* getNeighborsZ() const override; @@ -266,19 +275,21 @@ public: public: virtual void findSparseIndices(SPtr<Grid> fineGrid) override; + void findForGridInterfaceNewIndices(SPtr<GridImp> fineGrid); void updateSparseIndices(); void setNeighborIndices(uint index); real getFirstFluidNode(real coords[3], int direction, real startCoord) const override; real getLastFluidNode(real coords[3], int direction, real startCoord) const override; +protected: + virtual void setStopperNeighborCoords(uint index); private: - void setStopperNeighborCoords(uint index); void getNeighborCoords(real &neighborX, real &neighborY, real &neighborZ, real x, real y, real z) const; real getNeighborCoord(bool periodicity, real endCoord, real coords[3], int direction) const; void getNegativeNeighborCoords(real &neighborX, real &neighborY, real &neighborZ, real x, real y, real z) const; real getNegativeNeighborCoord(bool periodicity, real endCoord, real coords[3], int direction) const; - int getSparseIndex(const real &expectedX, const real &expectedY, const real &expectedZ) const; + virtual int getSparseIndex(const real &expectedX, const real &expectedY, const real &expectedZ) const; static real getMinimumOnNodes(const real &minExact, const real &decimalStart, const real &delta); static real getMaximumOnNodes(const real &maxExact, const real &decimalStart, const real &delta); @@ -304,7 +315,11 @@ public: void findQsPrimitive(Object *object); private: - enum class qComputationStageType { FindSolidBoundaryNodes, ComputeQs } qComputationStage; + + enum class qComputationStageType{ + FindSolidBoundaryNodes, + ComputeQs + } qComputationStage; public: void enableFindSolidBoundaryNodes() override @@ -335,7 +350,20 @@ public: uint getSendIndex(int direction, uint index) override; uint getReceiveIndex(int direction, uint index) override; - void repairCommunicationInices(int direction) override; + bool isSendNode(int index) const override; + bool isReceiveNode(int index) const override; + + void repairCommunicationIndices(int direction) override; + + void findFluidNodeIndices(bool splitDomain) override; + void findFluidNodeIndicesBorder() override; + + uint getNumberOfFluidNodes() const override; + void getFluidNodeIndices(uint *fluidNodeIndices) const override; + + uint getNumberOfFluidNodesBorder() const override; + void getFluidNodeIndicesBorder(uint *fluidNodeIndicesBorder) const override; + public: struct CommunicationIndices { diff --git a/src/gpu/GridGenerator/grid/GridImpTest.cpp b/src/gpu/GridGenerator/grid/GridImpTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8f5ddb1b01dd88cca7d750017ec328efe02cd92f --- /dev/null +++ b/src/gpu/GridGenerator/grid/GridImpTest.cpp @@ -0,0 +1,258 @@ +#include <array> +#include <gmock/gmock-matchers.h> +#include <gmock/gmock.h> +#include <gtest/gtest.h> +#include <memory> +#include <ostream> + +#include "GridImp.h" +#include "PointerDefinitions.h" +#include "grid/Field.h" +#include "grid/GridBuilder/MultipleGridBuilder.h" +#include "grid/distributions/Distribution.h" + +// This test is commented out because it causes a compiler error in Clang 10 --> The bug is fixed in Clang 14 (https://github.com/google/googletest/issues/2271) + +// class FieldDouble : public Field +// { +// public: +// FieldDouble() : Field(1) +// { +// this->allocateMemory(); +// }; + +// void setToStopper(uint index) +// { +// this->field[index] = vf::gpu::STOPPER_SOLID; +// } +// }; + +// class GridImpDouble : public GridImp +// { +// public: +// std::array<real, 3> coordsOfTestedNode; +// GridImpDouble(Object *object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, +// Distribution d, uint level) +// : GridImp(object, startX, startY, startZ, endX, endY, endZ, delta, d, level) +// { +// this->neighborIndexX = new int[5]; +// this->neighborIndexY = new int[5]; +// this->neighborIndexZ = new int[5]; +// } + +// static SPtr<GridImpDouble> makeShared(Object *object, real startX, real startY, real startZ, real endX, real endY, +// real endZ, real delta, Distribution d, uint level) +// { +// SPtr<GridImpDouble> grid(new GridImpDouble(object, startX, startY, startZ, endX, endY, endZ, delta, d, level)); +// return grid; +// } + +// void transIndexToCoords(uint, real &x, real &y, real &z) const override +// { +// x = coordsOfTestedNode[0]; +// y = coordsOfTestedNode[1]; +// z = coordsOfTestedNode[2]; +// } + +// uint transCoordToIndex(const real &, const real &, const real &) const override +// { +// return 0; +// } + +// void setStopperNeighborCoords(uint index) override +// { +// GridImp::setStopperNeighborCoords(index); +// } + +// void setField(Field &field) +// { +// this->field = field; +// } + +// MOCK_METHOD(int, getSparseIndex, (const real &x, const real &y, const real &z), (const, override)); +// }; + +// // This is test is highly dependent on the implementation. Maybe it should be removed :( +// TEST(GridImp, setStopperNeighborCoords) +// { +// real end = 1.0; +// real delta = 0.1; + +// SPtr<GridImpDouble> gridImp = +// GridImpDouble::makeShared(nullptr, 0.0, 0.0, 0.0, end, end, end, delta, Distribution(), 0); +// FieldDouble field; +// field.setToStopper(0); +// gridImp->setField(field); + +// gridImp->coordsOfTestedNode = { end - ((real)0.5 * delta), end - ((real)0.5 * delta), end - ((real)0.5 * delta) }; +// EXPECT_CALL(*gridImp, getSparseIndex).Times(3); +// gridImp->setStopperNeighborCoords(0); + +// gridImp->coordsOfTestedNode = { end - ((real)0.51 * delta), end - ((real)0.51 * delta), +// end - ((real)0.51 * delta) }; +// EXPECT_CALL(*gridImp, getSparseIndex).Times(3); +// gridImp->setStopperNeighborCoords(0); +// gridImp->coordsOfTestedNode = { end - ((real)0.99 * delta), end - ((real)0.99 * delta), +// end - ((real)0.99 * delta) }; +// EXPECT_CALL(*gridImp, getSparseIndex).Times(3); +// gridImp->setStopperNeighborCoords(0); + +// gridImp->coordsOfTestedNode = { end - delta, end - delta, end - delta }; +// EXPECT_CALL(*gridImp, getSparseIndex).Times(3); +// gridImp->setStopperNeighborCoords(0); + +// gridImp->coordsOfTestedNode = { end - ((real)1.01 * delta), end - ((real)1.01 * delta), +// end - ((real)1.01 * delta) }; +// EXPECT_CALL(*gridImp, getSparseIndex).Times(3); +// gridImp->setStopperNeighborCoords(0); + +// // The grid should not be like this, so this should be fine... +// gridImp->coordsOfTestedNode = { end, end, end }; +// EXPECT_CALL(*gridImp, getSparseIndex).Times(0); +// gridImp->setStopperNeighborCoords(0); + +// gridImp->coordsOfTestedNode = { end - ((real)0.25 * delta), end - ((real)0.25 * delta), +// end - ((real)0.25 * delta) }; +// EXPECT_CALL(*gridImp, getSparseIndex).Times(0); +// gridImp->setStopperNeighborCoords(0); +// } + +std::array<int, 3> countInvalidNeighbors(SPtr<Grid> grid) +{ + auto countInvalidX = 0; + auto countInvalidY = 0; + auto countInvalidZ = 0; + for (uint index = 0; index < grid->getSize(); index++) { + if (grid->getNeighborsX()[index] == -1) + countInvalidX++; + if (grid->getNeighborsY()[index] == -1) + countInvalidY++; + if (grid->getNeighborsZ()[index] == -1) + countInvalidZ++; + } + return { countInvalidX, countInvalidY, countInvalidZ }; +} + +std::array<int, 3> testFluidNodeNeighbors(SPtr<Grid> grid) +{ + auto countInvalidX = 0; + auto countInvalidXY = 0; + auto countInvalidXYZ = 0; + for (uint index = 0; index < grid->getSize(); index++) { + if (grid->getFieldEntry(index) != vf::gpu::FLUID) { + continue; + } + + auto neighX = grid->getNeighborsX()[index]; + if (neighX == -1) { + countInvalidX++; + continue; + } + + auto neighXY = grid->getNeighborsY()[neighX]; + if (neighXY == -1) { + countInvalidXY++; + continue; + } + + auto neighXYZ = grid->getNeighborsZ()[neighXY]; + if (neighXYZ == -1) { + countInvalidXYZ++; + continue; + } + } + + return { countInvalidX, countInvalidXY, countInvalidXYZ }; +} + +class findNeighborsIntegrationTest : public ::testing::Test +{ +protected: + SPtr<MultipleGridBuilder> gridBuilder; + void SetUp() override + { + auto gridFactory = GridFactory::make(); + gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); + gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + + // init logger to avoid segmentation fault in buildGrids + logging::Logger::addStream(&std::cout); + logging::Logger::setDebugLevel(logging::Logger::Level::WARNING); + logging::Logger::timeStamp(logging::Logger::ENABLE); + logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); + } +}; + +TEST_F(findNeighborsIntegrationTest, grid1) +{ + const real dx = 0.15; + gridBuilder->addCoarseGrid(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, dx); + + gridBuilder->buildGrids(LBM, false); + auto grid = gridBuilder->getGrid(0); + + // Only the last layer of nodes should have invalid neighbors. The grid is a cube with a side length of 9 nodes + // -> 9 * 9 = 81 invalid nodes are expected + auto numberOfInvalidNeighbors = countInvalidNeighbors(grid); + auto expected = 9 * 9; + EXPECT_THAT(numberOfInvalidNeighbors[0], testing::Eq(expected)); + EXPECT_THAT(numberOfInvalidNeighbors[1], testing::Eq(expected)); + EXPECT_THAT(numberOfInvalidNeighbors[2], testing::Eq(expected)); + + // additional test: all fluid nodes should have valid neighbors + auto numberInvalidFluidNeighbors = testFluidNodeNeighbors(grid); + EXPECT_THAT(numberInvalidFluidNeighbors[0], testing::Eq(0)); + EXPECT_THAT(numberInvalidFluidNeighbors[1], testing::Eq(0)); + EXPECT_THAT(numberInvalidFluidNeighbors[2], testing::Eq(0)); +} + +TEST_F(findNeighborsIntegrationTest, grid2) +{ + const real dx = 1.0 / 64; + gridBuilder->addCoarseGrid(-0.6, -0.6, -0.6, 0.6, 0.6, 0.6, dx); + + gridBuilder->buildGrids(LBM, false); + auto grid = gridBuilder->getGrid(0); + + // Only the last layer of nodes should have invalid neighbors. The grid is a cube with a side length of 79 nodes + // -> 79 * 79 invalid nodes are expected + auto numberOfInvalidNeighbors = countInvalidNeighbors(grid); + auto expected = 79 * 79; + EXPECT_THAT(numberOfInvalidNeighbors[0], testing::Eq(expected)); + EXPECT_THAT(numberOfInvalidNeighbors[1], testing::Eq(expected)); + EXPECT_THAT(numberOfInvalidNeighbors[2], testing::Eq(expected)); + + // additional test: all fluid nodes should have valid neighbors + auto numberInvalidFluidNeighbors = testFluidNodeNeighbors(grid); + EXPECT_THAT(numberInvalidFluidNeighbors[0], testing::Eq(0)); + EXPECT_THAT(numberInvalidFluidNeighbors[1], testing::Eq(0)); + EXPECT_THAT(numberInvalidFluidNeighbors[2], testing::Eq(0)); +} + +TEST_F(findNeighborsIntegrationTest, validFluidNeighbors1) +{ + real dx = 0.17; + gridBuilder->addCoarseGrid(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, dx); + + gridBuilder->buildGrids(LBM, false); + auto grid = gridBuilder->getGrid(0); + + auto numberInvalidFluidNeighbors = testFluidNodeNeighbors(grid); + EXPECT_THAT(numberInvalidFluidNeighbors[0], testing::Eq(0)); + EXPECT_THAT(numberInvalidFluidNeighbors[1], testing::Eq(0)); + EXPECT_THAT(numberInvalidFluidNeighbors[2], testing::Eq(0)); +} + +TEST_F(findNeighborsIntegrationTest, validFluidNeighbors2) +{ + real dx = 0.18; + gridBuilder->addCoarseGrid(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, dx); + + gridBuilder->buildGrids(LBM, false); + auto grid = gridBuilder->getGrid(0); + + auto numberInvalidFluidNeighbors = testFluidNodeNeighbors(grid); + EXPECT_THAT(numberInvalidFluidNeighbors[0], testing::Eq(0)); + EXPECT_THAT(numberInvalidFluidNeighbors[1], testing::Eq(0)); + EXPECT_THAT(numberInvalidFluidNeighbors[2], testing::Eq(0)); +} diff --git a/src/gpu/GridGenerator/grid/GridInterface.cpp b/src/gpu/GridGenerator/grid/GridInterface.cpp index 47cb8ef9dd7c4704e420ca68888ce0d56c48a59e..a373b0eafbdb6a33338f54bf3efdc47a0edca315 100644 --- a/src/gpu/GridGenerator/grid/GridInterface.cpp +++ b/src/gpu/GridGenerator/grid/GridInterface.cpp @@ -40,6 +40,9 @@ #include "grid/Field.h" #include "grid/NodeValues.h" +#include "lbm/constants/D3Q27.h" + +using namespace vf::lbm; using namespace vf::gpu; GridInterface::GridInterface() @@ -373,7 +376,7 @@ uint GridInterface::findOffsetCF(const uint& indexOnCoarseGrid, GridImp* coarseG Cell cell(x, y, z, coarseGrid->getDelta()); if( coarseGrid->cellContainsOnly( cell, FLUID, FLUID_CFC ) ){ - this->cf.offset[ interfaceIndex ] = DIR_27_ZERO; + this->cf.offset[ interfaceIndex ] = dir::DIR_000; return indexOnCoarseGrid; } @@ -408,7 +411,7 @@ uint GridInterface::findOffsetFC(const uint& indexOnFineGrid, GridImp* fineGrid, Cell cell(x, y, z, fineGrid->getDelta()); if( fineGrid->cellContainsOnly( cell, FLUID, FLUID_FCF ) ){ - this->fc.offset[ interfaceIndex ] = DIR_27_ZERO; + this->fc.offset[ interfaceIndex ] = dir::DIR_000; return indexOnFineGrid; } diff --git a/src/gpu/GridGenerator/grid/GridInterface.h b/src/gpu/GridGenerator/grid/GridInterface.h index 303d79d4995ea04fe30b2a004c5738bf9c926cf2..713d495d4386e0fe743357a803b84be02c061561 100644 --- a/src/gpu/GridGenerator/grid/GridInterface.h +++ b/src/gpu/GridGenerator/grid/GridInterface.h @@ -33,7 +33,7 @@ #ifndef GRID_INTERFACE_H #define GRID_INTERFACE_H -#include "global.h" +#include "gpu/GridGenerator/global.h" class GridImp; @@ -47,9 +47,9 @@ public: void GRIDGENERATOR_EXPORT findBoundaryGridInterfaceCF(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid); - void GRIDGENERATOR_EXPORT findInterfaceCF_GKS(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid); + void GRIDGENERATOR_EXPORT findInterfaceCF_GKS(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid); - void GRIDGENERATOR_EXPORT findInterfaceFC(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid); + void GRIDGENERATOR_EXPORT findInterfaceFC(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid); void GRIDGENERATOR_EXPORT findOverlapStopper(const uint& indexOnCoarseGrid, GridImp* coarseGrid, GridImp* fineGrid); void GRIDGENERATOR_EXPORT findInvalidBoundaryNodes(const uint& indexOnCoarseGrid, GridImp* coarseGrid); @@ -66,7 +66,7 @@ public: uint *fine, *coarse; uint numberOfEntries = 0; uint *offset; - } fc, cf; + } fc{}, cf{}; private: diff --git a/src/gpu/GridGenerator/grid/NodeValues.h b/src/gpu/GridGenerator/grid/NodeValues.h index c726fdf85c8199633e118d8f8a5365ee658d4e6a..f1a948cd9a84d1d2454c37c9a23a25639f598e75 100644 --- a/src/gpu/GridGenerator/grid/NodeValues.h +++ b/src/gpu/GridGenerator/grid/NodeValues.h @@ -33,9 +33,7 @@ #ifndef NodeValues_H #define NodeValues_H -namespace vf -{ -namespace gpu +namespace vf::gpu { static constexpr char FLUID = 0; @@ -56,6 +54,7 @@ static constexpr char BC_SOLID = 22; static constexpr char BC_SLIP = 23; static constexpr char BC_NOSLIP = 24; static constexpr char BC_OUTFLOW = 25; +static constexpr char BC_STRESS = 26; static constexpr char STOPPER_OUT_OF_GRID = 30; static constexpr char STOPPER_COARSE_UNDER_FINE = 31; @@ -72,7 +71,6 @@ static constexpr char Q_DEPRECATED = 52; static constexpr char OVERLAP_TMP = 60; -} // namespace gpu -} // namespace vf +} #endif diff --git a/src/gpu/GridGenerator/grid/distributions/D3Q27.h b/src/gpu/GridGenerator/grid/distributions/D3Q27.h index 680fa88305b793934747d09113f284bfe96b4988..4ef041a13678516f116c13c9b9996d6f378ef854 100644 --- a/src/gpu/GridGenerator/grid/distributions/D3Q27.h +++ b/src/gpu/GridGenerator/grid/distributions/D3Q27.h @@ -33,41 +33,6 @@ #ifndef D3Q27_H_ #define D3Q27_H_ -#define DIR_27_E 0 -#define DIR_27_W 1 -#define DIR_27_N 2 -#define DIR_27_S 3 -#define DIR_27_T 4 -#define DIR_27_B 5 - -#define DIR_27_NE 6 -#define DIR_27_SW 7 -#define DIR_27_SE 8 -#define DIR_27_NW 9 -#define DIR_27_TE 10 -#define DIR_27_BW 11 -#define DIR_27_BE 12 -#define DIR_27_TW 13 -#define DIR_27_TN 14 -#define DIR_27_BS 15 -#define DIR_27_BN 16 -#define DIR_27_TS 17 -#define DIR_27_ZERO 18 - -#define DIR_27_TNE 19 -#define DIR_27_BNE 20 -#define DIR_27_TSE 21 -#define DIR_27_BSE 22 - -#define DIR_27_TNW 23 -#define DIR_27_BNW 24 -#define DIR_27_TSW 25 -#define DIR_27_BSW 26 - -#define DIR_27_START 0 -#define DIR_27_END 26 - - #define DIR_27_E_X 1 #define DIR_27_E_Y 0 #define DIR_27_E_Z 0 @@ -159,7 +124,6 @@ #define DIR_27_BSE_Y -1 #define DIR_27_BSE_Z -1 - #define DIR_27_TNW_X -1 #define DIR_27_TNW_Y 1 #define DIR_27_TNW_Z 1 @@ -176,4 +140,8 @@ #define DIR_27_BSW_Y -1 #define DIR_27_BSW_Z -1 +#define DIR_27_REST_X 0 +#define DIR_27_REST_Y 0 +#define DIR_27_REST_Z 0 + #endif diff --git a/src/gpu/GridGenerator/grid/distributions/Distribution.cpp b/src/gpu/GridGenerator/grid/distributions/Distribution.cpp index b0200812631aeff1947a56f78cae4232bd4d3ee7..a6e11ac909186618d765596f15263035b3b6401a 100644 --- a/src/gpu/GridGenerator/grid/distributions/Distribution.cpp +++ b/src/gpu/GridGenerator/grid/distributions/Distribution.cpp @@ -35,168 +35,162 @@ #include <stdio.h> #include "grid/distributions/D3Q27.h" - #include "grid/Grid.h" +#include "lbm/constants/D3Q27.h" +using namespace vf::lbm::dir; Distribution DistributionHelper::getDistribution27() { Distribution d27; d27.name = "D3Q27"; - d27.dir_start = DIR_27_START; - d27.dir_end = DIR_27_END; - - d27.dirs = new int[(DIR_27_END + 1) * DIMENSION]; - - d27.directions = new Direction[DIR_27_END + 1]; - d27.directions[0] = Direction(DIR_27_E_X, DIR_27_E_Y, DIR_27_E_Z); - d27.directions[1] = Direction(DIR_27_W_X, DIR_27_W_Y, DIR_27_W_Z); - d27.directions[2] = Direction(DIR_27_N_X, DIR_27_N_Y, DIR_27_N_Z); - d27.directions[3] = Direction(DIR_27_S_X, DIR_27_S_Y, DIR_27_S_Z); - - d27.directions[4] = Direction(DIR_27_T_X, DIR_27_T_Y, DIR_27_T_Z); - d27.directions[5] = Direction(DIR_27_B_X, DIR_27_B_Y, DIR_27_B_Z); - - d27.directions[6] = Direction(DIR_27_NE_X, DIR_27_NE_Y, DIR_27_NE_Z); - d27.directions[7] = Direction(DIR_27_SW_X, DIR_27_SW_Y, DIR_27_SW_Z); - d27.directions[8] = Direction(DIR_27_SE_X, DIR_27_SE_Y, DIR_27_SE_Z); - d27.directions[9] = Direction(DIR_27_NW_X, DIR_27_NW_Y, DIR_27_NW_Z); - - d27.directions[10] = Direction(DIR_27_TE_X, DIR_27_TE_Y, DIR_27_TE_Z); - d27.directions[11] = Direction(DIR_27_BW_X, DIR_27_BW_Y, DIR_27_BW_Z); - d27.directions[12] = Direction(DIR_27_BE_X, DIR_27_BE_Y, DIR_27_BE_Z); - d27.directions[13] = Direction(DIR_27_TW_X, DIR_27_TW_Y, DIR_27_TW_Z); - - d27.directions[14] = Direction(DIR_27_TN_X, DIR_27_TN_Y, DIR_27_TN_Z); - d27.directions[15] = Direction(DIR_27_BS_X, DIR_27_BS_Y, DIR_27_BS_Z); - d27.directions[16] = Direction(DIR_27_BN_X, DIR_27_BN_Y, DIR_27_BN_Z); - d27.directions[17] = Direction(DIR_27_TS_X, DIR_27_TS_Y, DIR_27_TS_Z); - - d27.directions[18] = Direction(0, 0, 0); - - d27.directions[19] = Direction(DIR_27_TNE_X, DIR_27_TNE_Y, DIR_27_TNE_Z); - d27.directions[20] = Direction(DIR_27_BNE_X, DIR_27_BNE_Y, DIR_27_BNE_Z); - - d27.directions[21] = Direction(DIR_27_TSE_X, DIR_27_TSE_Y, DIR_27_TSE_Z); - d27.directions[22] = Direction(DIR_27_BSE_X, DIR_27_BSE_Y, DIR_27_BSE_Z); + d27.dir_start = STARTDIR; + d27.dir_end = ENDDIR; + + d27.dirs = new int[(ENDDIR + 1) * DIMENSION]; + + d27.directions = new Direction[ENDDIR + 1]; + d27.directions[DIR_P00] = Direction(DIR_27_E_X, DIR_27_E_Y, DIR_27_E_Z); + d27.directions[DIR_M00] = Direction(DIR_27_W_X, DIR_27_W_Y, DIR_27_W_Z); + d27.directions[DIR_0P0] = Direction(DIR_27_N_X, DIR_27_N_Y, DIR_27_N_Z); + d27.directions[DIR_0M0] = Direction(DIR_27_S_X, DIR_27_S_Y, DIR_27_S_Z); + d27.directions[DIR_00P] = Direction(DIR_27_T_X, DIR_27_T_Y, DIR_27_T_Z); + d27.directions[DIR_00M] = Direction(DIR_27_B_X, DIR_27_B_Y, DIR_27_B_Z); + + d27.directions[DIR_PP0] = Direction(DIR_27_NE_X, DIR_27_NE_Y, DIR_27_NE_Z); + d27.directions[DIR_MM0] = Direction(DIR_27_SW_X, DIR_27_SW_Y, DIR_27_SW_Z); + d27.directions[DIR_PM0] = Direction(DIR_27_SE_X, DIR_27_SE_Y, DIR_27_SE_Z); + d27.directions[DIR_MP0] = Direction(DIR_27_NW_X, DIR_27_NW_Y, DIR_27_NW_Z); + + d27.directions[DIR_P0P] = Direction(DIR_27_TE_X, DIR_27_TE_Y, DIR_27_TE_Z); + d27.directions[DIR_M0M] = Direction(DIR_27_BW_X, DIR_27_BW_Y, DIR_27_BW_Z); + d27.directions[DIR_P0M] = Direction(DIR_27_BE_X, DIR_27_BE_Y, DIR_27_BE_Z); + d27.directions[DIR_M0P] = Direction(DIR_27_TW_X, DIR_27_TW_Y, DIR_27_TW_Z); + + d27.directions[DIR_0PP] = Direction(DIR_27_TN_X, DIR_27_TN_Y, DIR_27_TN_Z); + d27.directions[DIR_0MM] = Direction(DIR_27_BS_X, DIR_27_BS_Y, DIR_27_BS_Z); + d27.directions[DIR_0PM] = Direction(DIR_27_BN_X, DIR_27_BN_Y, DIR_27_BN_Z); + d27.directions[DIR_0MP] = Direction(DIR_27_TS_X, DIR_27_TS_Y, DIR_27_TS_Z); + + d27.directions[DIR_000] = Direction(DIR_27_REST_X, DIR_27_REST_Y, DIR_27_REST_Z); + + d27.directions[DIR_PPP] = Direction(DIR_27_TNE_X, DIR_27_TNE_Y, DIR_27_TNE_Z); + d27.directions[DIR_MPP] = Direction(DIR_27_TNW_X, DIR_27_TNW_Y, DIR_27_TNW_Z); + d27.directions[DIR_PMP] = Direction(DIR_27_TSE_X, DIR_27_TSE_Y, DIR_27_TSE_Z); + d27.directions[DIR_MMP] = Direction(DIR_27_TSW_X, DIR_27_TSW_Y, DIR_27_TSW_Z); + + d27.directions[DIR_PPM] = Direction(DIR_27_BNE_X, DIR_27_BNE_Y, DIR_27_BNE_Z); + d27.directions[DIR_MPM]= Direction(DIR_27_BNW_X, DIR_27_BNW_Y, DIR_27_BNW_Z); + d27.directions[DIR_PMM]= Direction(DIR_27_BSE_X, DIR_27_BSE_Y, DIR_27_BSE_Z); + d27.directions[DIR_MMM] = Direction(DIR_27_BSW_X, DIR_27_BSW_Y, DIR_27_BSW_Z); + + + d27.dirs[DIR_P00 * 3 ] = DIR_27_E_X; + d27.dirs[DIR_P00 * 3 + 1] = DIR_27_E_Y; + d27.dirs[DIR_P00 * 3 + 2] = DIR_27_E_Z; + + d27.dirs[DIR_M00 * 3 ] = DIR_27_W_X; + d27.dirs[DIR_M00 * 3 + 1] = DIR_27_W_Y; + d27.dirs[DIR_M00 * 3 + 2] = DIR_27_W_Z; + + d27.dirs[DIR_0P0 * 3 ] = DIR_27_N_X; + d27.dirs[DIR_0P0 * 3 + 1] = DIR_27_N_Y; + d27.dirs[DIR_0P0 * 3 + 2] = DIR_27_N_Z; - d27.directions[23] = Direction(DIR_27_TNW_X, DIR_27_TNW_Y, DIR_27_TNW_Z); - d27.directions[24] = Direction(DIR_27_BNW_X, DIR_27_BNW_Y, DIR_27_BNW_Z); + d27.dirs[DIR_0M0 * 3 ] = DIR_27_S_X; + d27.dirs[DIR_0M0 * 3 + 1] = DIR_27_S_Y; + d27.dirs[DIR_0M0 * 3 + 2] = DIR_27_S_Z; + + d27.dirs[DIR_00P * 3 ] = DIR_27_T_X; + d27.dirs[DIR_00P * 3 + 1] = DIR_27_T_Y; + d27.dirs[DIR_00P * 3 + 2] = DIR_27_T_Z; + + d27.dirs[DIR_00M * 3 ] = DIR_27_B_X; + d27.dirs[DIR_00M * 3 + 1] = DIR_27_B_Y; + d27.dirs[DIR_00M * 3 + 2] = DIR_27_B_Z; - d27.directions[25] = Direction(DIR_27_TSW_X, DIR_27_TSW_Y, DIR_27_TSW_Z); - d27.directions[26] = Direction(DIR_27_BSW_X, DIR_27_BSW_Y, DIR_27_BSW_Z); + d27.dirs[DIR_PP0 * 3 ] = DIR_27_NE_X; + d27.dirs[DIR_PP0 * 3 + 1] = DIR_27_NE_Y; + d27.dirs[DIR_PP0 * 3 + 2] = DIR_27_NE_Z; + + d27.dirs[DIR_MM0 * 3 ] = DIR_27_SW_X; + d27.dirs[DIR_MM0 * 3 + 1] = DIR_27_SW_Y; + d27.dirs[DIR_MM0 * 3 + 2] = DIR_27_SW_Z; + d27.dirs[DIR_PM0 * 3 ] = DIR_27_SE_X; + d27.dirs[DIR_PM0 * 3 + 1] = DIR_27_SE_Y; + d27.dirs[DIR_PM0 * 3 + 2] = DIR_27_SE_Z; - int dir_num = 0; - d27.dirs[dir_num++] = DIR_27_E_X; - d27.dirs[dir_num++] = DIR_27_E_Y; - d27.dirs[dir_num++] = DIR_27_E_Z; + d27.dirs[DIR_MP0 * 3 ] = DIR_27_NW_X; + d27.dirs[DIR_MP0 * 3 + 1] = DIR_27_NW_Y; + d27.dirs[DIR_MP0 * 3 + 2] = DIR_27_NW_Z; - d27.dirs[dir_num++] = DIR_27_W_X; - d27.dirs[dir_num++] = DIR_27_W_Y; - d27.dirs[dir_num++] = DIR_27_W_Z; - - d27.dirs[dir_num++] = DIR_27_N_X; - d27.dirs[dir_num++] = DIR_27_N_Y; - d27.dirs[dir_num++] = DIR_27_N_Z; - - d27.dirs[dir_num++] = DIR_27_S_X; - d27.dirs[dir_num++] = DIR_27_S_Y; - d27.dirs[dir_num++] = DIR_27_S_Z; - - d27.dirs[dir_num++] = DIR_27_T_X; - d27.dirs[dir_num++] = DIR_27_T_Y; - d27.dirs[dir_num++] = DIR_27_T_Z; - - d27.dirs[dir_num++] = DIR_27_B_X; - d27.dirs[dir_num++] = DIR_27_B_Y; - d27.dirs[dir_num++] = DIR_27_B_Z; - - d27.dirs[dir_num++] = DIR_27_NE_X; - d27.dirs[dir_num++] = DIR_27_NE_Y; - d27.dirs[dir_num++] = DIR_27_NE_Z; - - d27.dirs[dir_num++] = DIR_27_SW_X; - d27.dirs[dir_num++] = DIR_27_SW_Y; - d27.dirs[dir_num++] = DIR_27_SW_Z; + d27.dirs[DIR_P0P * 3 ] = DIR_27_TE_X; + d27.dirs[DIR_P0P * 3 + 1] = DIR_27_TE_Y; + d27.dirs[DIR_P0P * 3 + 2] = DIR_27_TE_Z; - d27.dirs[dir_num++] = DIR_27_SE_X; - d27.dirs[dir_num++] = DIR_27_SE_Y; - d27.dirs[dir_num++] = DIR_27_SE_Z; + d27.dirs[DIR_M0M * 3 ] = DIR_27_BW_X; + d27.dirs[DIR_M0M * 3 + 1] = DIR_27_BW_Y; + d27.dirs[DIR_M0M * 3 + 2] = DIR_27_BW_Z; - d27.dirs[dir_num++] = DIR_27_NW_X; - d27.dirs[dir_num++] = DIR_27_NW_Y; - d27.dirs[dir_num++] = DIR_27_NW_Z; + d27.dirs[DIR_P0M * 3 ] = DIR_27_BE_X; + d27.dirs[DIR_P0M * 3 + 1] = DIR_27_BE_Y; + d27.dirs[DIR_P0M * 3 + 2] = DIR_27_BE_Z; - d27.dirs[dir_num++] = DIR_27_TE_X; - d27.dirs[dir_num++] = DIR_27_TE_Y; - d27.dirs[dir_num++] = DIR_27_TE_Z; + d27.dirs[DIR_M0P * 3 ] = DIR_27_TW_X; + d27.dirs[DIR_M0P * 3 + 1] = DIR_27_TW_Y; + d27.dirs[DIR_M0P * 3 + 2] = DIR_27_TW_Z; - d27.dirs[dir_num++] = DIR_27_BW_X; - d27.dirs[dir_num++] = DIR_27_BW_Y; - d27.dirs[dir_num++] = DIR_27_BW_Z; + d27.dirs[DIR_0PP * 3 ] = DIR_27_TN_X; + d27.dirs[DIR_0PP * 3 + 1] = DIR_27_TN_Y; + d27.dirs[DIR_0PP * 3 + 2] = DIR_27_TN_Z; - d27.dirs[dir_num++] = DIR_27_BE_X; - d27.dirs[dir_num++] = DIR_27_BE_Y; - d27.dirs[dir_num++] = DIR_27_BE_Z; + d27.dirs[DIR_0MM * 3 ] = DIR_27_BS_X; + d27.dirs[DIR_0MM * 3 + 1] = DIR_27_BS_Y; + d27.dirs[DIR_0MM * 3 + 2] = DIR_27_BS_Z; - d27.dirs[dir_num++] = DIR_27_TW_X; - d27.dirs[dir_num++] = DIR_27_TW_Y; - d27.dirs[dir_num++] = DIR_27_TW_Z; - - d27.dirs[dir_num++] = DIR_27_TN_X; - d27.dirs[dir_num++] = DIR_27_TN_Y; - d27.dirs[dir_num++] = DIR_27_TN_Z; - - d27.dirs[dir_num++] = DIR_27_BS_X; - d27.dirs[dir_num++] = DIR_27_BS_Y; - d27.dirs[dir_num++] = DIR_27_BS_Z; - - d27.dirs[dir_num++] = DIR_27_BN_X; - d27.dirs[dir_num++] = DIR_27_BN_Y; - d27.dirs[dir_num++] = DIR_27_BN_Z; - - d27.dirs[dir_num++] = DIR_27_TS_X; - d27.dirs[dir_num++] = DIR_27_TS_Y; - d27.dirs[dir_num++] = DIR_27_TS_Z; - - - d27.dirs[dir_num++] = 0; // - d27.dirs[dir_num++] = 0; // ZERO ELEMENT - d27.dirs[dir_num++] = 0; // + d27.dirs[DIR_0PM * 3 ] = DIR_27_BN_X; + d27.dirs[DIR_0PM * 3 + 1] = DIR_27_BN_Y; + d27.dirs[DIR_0PM * 3 + 2] = DIR_27_BN_Z; + d27.dirs[DIR_0MP * 3 ] = DIR_27_TS_X; + d27.dirs[DIR_0MP * 3 + 1] = DIR_27_TS_Y; + d27.dirs[DIR_0MP * 3 + 2] = DIR_27_TS_Z; - d27.dirs[dir_num++] = DIR_27_TNE_X; - d27.dirs[dir_num++] = DIR_27_TNE_Y; - d27.dirs[dir_num++] = DIR_27_TNE_Z; + d27.dirs[DIR_000 * 3 ] = DIR_27_REST_X; // + d27.dirs[DIR_000 * 3 + 1] = DIR_27_REST_Y; // ZERO ELEMENT + d27.dirs[DIR_000 * 3 + 2] = DIR_27_REST_Z; // - d27.dirs[dir_num++] = DIR_27_BNE_X; - d27.dirs[dir_num++] = DIR_27_BNE_Y; - d27.dirs[dir_num++] = DIR_27_BNE_Z; + d27.dirs[DIR_PPP * 3 ] = DIR_27_TNE_X; + d27.dirs[DIR_PPP * 3 + 1] = DIR_27_TNE_Y; + d27.dirs[DIR_PPP * 3 + 2] = DIR_27_TNE_Z; - d27.dirs[dir_num++] = DIR_27_TSE_X; - d27.dirs[dir_num++] = DIR_27_TSE_Y; - d27.dirs[dir_num++] = DIR_27_TSE_Z; + d27.dirs[DIR_PPM * 3 ] = DIR_27_BNE_X; + d27.dirs[DIR_PPM * 3 + 1] = DIR_27_BNE_Y; + d27.dirs[DIR_PPM * 3 + 2] = DIR_27_BNE_Z; - d27.dirs[dir_num++] = DIR_27_BSE_X; - d27.dirs[dir_num++] = DIR_27_BSE_Y; - d27.dirs[dir_num++] = DIR_27_BSE_Z; + d27.dirs[DIR_PMP * 3 ] = DIR_27_TSE_X; + d27.dirs[DIR_PMP * 3 + 1] = DIR_27_TSE_Y; + d27.dirs[DIR_PMP * 3 + 2] = DIR_27_TSE_Z; + d27.dirs[DIR_PMM * 3 ] = DIR_27_BSE_X; + d27.dirs[DIR_PMM * 3 + 1] = DIR_27_BSE_Y; + d27.dirs[DIR_PMM * 3 + 2] = DIR_27_BSE_Z; - d27.dirs[dir_num++] = DIR_27_TNW_X; - d27.dirs[dir_num++] = DIR_27_TNW_Y; - d27.dirs[dir_num++] = DIR_27_TNW_Z; + d27.dirs[DIR_MPP * 3 ] = DIR_27_TNW_X; + d27.dirs[DIR_MPP * 3 + 1] = DIR_27_TNW_Y; + d27.dirs[DIR_MPP * 3 + 2] = DIR_27_TNW_Z; - d27.dirs[dir_num++] = DIR_27_BNW_X; - d27.dirs[dir_num++] = DIR_27_BNW_Y; - d27.dirs[dir_num++] = DIR_27_BNW_Z; + d27.dirs[DIR_MPM * 3 ] = DIR_27_BNW_X; + d27.dirs[DIR_MPM * 3 + 1] = DIR_27_BNW_Y; + d27.dirs[DIR_MPM * 3 + 2] = DIR_27_BNW_Z; - d27.dirs[dir_num++] = DIR_27_TSW_X; - d27.dirs[dir_num++] = DIR_27_TSW_Y; - d27.dirs[dir_num++] = DIR_27_TSW_Z; + d27.dirs[DIR_MMP * 3 ] = DIR_27_TSW_X; + d27.dirs[DIR_MMP * 3 + 1] = DIR_27_TSW_Y; + d27.dirs[DIR_MMP * 3 + 2] = DIR_27_TSW_Z; - d27.dirs[dir_num++] = DIR_27_BSW_X; - d27.dirs[dir_num++] = DIR_27_BSW_Y; - d27.dirs[dir_num++] = DIR_27_BSW_Z; + d27.dirs[DIR_MMM * 3 ] = DIR_27_BSW_X; + d27.dirs[DIR_MMM * 3 + 1] = DIR_27_BSW_Y; + d27.dirs[DIR_MMM * 3 + 2] = DIR_27_BSW_Z; return d27; } diff --git a/src/gpu/GridGenerator/grid/distributions/Distribution.h b/src/gpu/GridGenerator/grid/distributions/Distribution.h index abc6d8105c9daeb83f4e31478a55942f48bf5e65..7982abc235b020003526b10c885f4936bf661936 100644 --- a/src/gpu/GridGenerator/grid/distributions/Distribution.h +++ b/src/gpu/GridGenerator/grid/distributions/Distribution.h @@ -36,7 +36,7 @@ #include <vector> #include <string> -#include "global.h" +#include "gpu/GridGenerator/global.h" #define DIR_END_MAX 27 diff --git a/src/gpu/GridGenerator/grid/distributions/DistributionTest.cpp b/src/gpu/GridGenerator/grid/distributions/DistributionTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3a9dd1d33ec4e1567b7b85e99970a5245ebbb06d --- /dev/null +++ b/src/gpu/GridGenerator/grid/distributions/DistributionTest.cpp @@ -0,0 +1,61 @@ +# include <gmock/gmock.h> +#include <string> +# include "Distribution.h" + +#include "grid/distributions/D3Q27.h" +#include "lbm/constants/D3Q27.h" +using namespace vf::lbm::dir; + +TEST(DistributionTest, DistributionReturnsCorrectDirections) +{ + Distribution dist = DistributionHelper::getDistribution27(); + + EXPECT_THAT(dist.directions[DIR_P00][0], testing::Eq(DIR_27_E_X)); + EXPECT_THAT(dist.directions[DIR_P00][1], testing::Eq(DIR_27_E_Y)); + EXPECT_THAT(dist.directions[DIR_P00][2], testing::Eq(DIR_27_E_Z)); + EXPECT_THAT(dist.dirs[DIR_P00 * 3 ], testing::Eq(DIR_27_E_X)); + EXPECT_THAT(dist.dirs[DIR_P00 * 3 + 1], testing::Eq(DIR_27_E_Y)); + EXPECT_THAT(dist.dirs[DIR_P00 * 3 + 2], testing::Eq(DIR_27_E_Z)); + + EXPECT_THAT(dist.directions[DIR_00M][0], testing::Eq(DIR_27_B_X)); + EXPECT_THAT(dist.directions[DIR_00M][1], testing::Eq(DIR_27_B_Y)); + EXPECT_THAT(dist.directions[DIR_00M][2], testing::Eq(DIR_27_B_Z)); + EXPECT_THAT(dist.dirs[DIR_00M * 3 ], testing::Eq(DIR_27_B_X)); + EXPECT_THAT(dist.dirs[DIR_00M * 3 + 1], testing::Eq(DIR_27_B_Y)); + EXPECT_THAT(dist.dirs[DIR_00M * 3 + 2], testing::Eq(DIR_27_B_Z)); + + EXPECT_THAT(dist.directions[DIR_000][0], testing::Eq(0)); + EXPECT_THAT(dist.directions[DIR_000][1], testing::Eq(0)); + EXPECT_THAT(dist.directions[DIR_000][2], testing::Eq(0)); + EXPECT_THAT(dist.dirs[DIR_000 * 3 ], testing::Eq(0)); + EXPECT_THAT(dist.dirs[DIR_000 * 3 + 1], testing::Eq(0)); + EXPECT_THAT(dist.dirs[DIR_000 * 3 + 2], testing::Eq(0)); + + EXPECT_THAT(dist.directions[DIR_PP0][0], testing::Eq(DIR_27_NE_X)); + EXPECT_THAT(dist.directions[DIR_PP0][1], testing::Eq(DIR_27_NE_Y)); + EXPECT_THAT(dist.directions[DIR_PP0][2], testing::Eq(DIR_27_NE_Z)); + EXPECT_THAT(dist.dirs[DIR_PP0 * 3 ], testing::Eq(DIR_27_NE_X)); + EXPECT_THAT(dist.dirs[DIR_PP0 * 3 + 1], testing::Eq(DIR_27_NE_Y)); + EXPECT_THAT(dist.dirs[DIR_PP0 * 3 + 2], testing::Eq(DIR_27_NE_Z)); + + EXPECT_THAT(dist.directions[DIR_0MP][0], testing::Eq(DIR_27_TS_X)); + EXPECT_THAT(dist.directions[DIR_0MP][1], testing::Eq(DIR_27_TS_Y)); + EXPECT_THAT(dist.directions[DIR_0MP][2], testing::Eq(DIR_27_TS_Z)); + EXPECT_THAT(dist.dirs[DIR_0MP * 3 ], testing::Eq(DIR_27_TS_X)); + EXPECT_THAT(dist.dirs[DIR_0MP * 3 + 1], testing::Eq(DIR_27_TS_Y)); + EXPECT_THAT(dist.dirs[DIR_0MP * 3 + 2], testing::Eq(DIR_27_TS_Z)); + + EXPECT_THAT(dist.directions[DIR_PPP][0], testing::Eq(DIR_27_TNE_X)); + EXPECT_THAT(dist.directions[DIR_PPP][1], testing::Eq(DIR_27_TNE_Y)); + EXPECT_THAT(dist.directions[DIR_PPP][2], testing::Eq(DIR_27_TNE_Z)); + EXPECT_THAT(dist.dirs[DIR_PPP * 3 ], testing::Eq(DIR_27_TNE_X)); + EXPECT_THAT(dist.dirs[DIR_PPP * 3 + 1], testing::Eq(DIR_27_TNE_Y)); + EXPECT_THAT(dist.dirs[DIR_PPP * 3 + 2], testing::Eq(DIR_27_TNE_Z)); + + EXPECT_THAT(dist.directions[DIR_MMM][0], testing::Eq(DIR_27_BSW_X)); + EXPECT_THAT(dist.directions[DIR_MMM][1], testing::Eq(DIR_27_BSW_Y)); + EXPECT_THAT(dist.directions[DIR_MMM][2], testing::Eq(DIR_27_BSW_Z)); + EXPECT_THAT(dist.dirs[DIR_MMM * 3 ], testing::Eq(DIR_27_BSW_X)); + EXPECT_THAT(dist.dirs[DIR_MMM * 3 + 1], testing::Eq(DIR_27_BSW_Y)); + EXPECT_THAT(dist.dirs[DIR_MMM * 3 + 2], testing::Eq(DIR_27_BSW_Z)); +} \ No newline at end of file diff --git a/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp b/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp index 2c8624732d70e52ac24d843888548bdaf5585686..7f818f3217e682f21c2b41c62070924243fcb3b0 100644 --- a/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp +++ b/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp @@ -59,7 +59,7 @@ void GridVTKWriter::writeSparseGridToVTK(SPtr<Grid> grid, const std::string& nam writeVtkFile(grid); } -void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name, WRITING_FORMAT format) +void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name) { const uint chunkSize = 20000000; @@ -87,9 +87,9 @@ void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name, *logging::out << logging::Logger::INFO_INTERMEDIATE << "Write Grid to XML VTK (*.vtu) output file : " + name + "_Part_" + std::to_string(part) + "\n"; - nodedatanames.push_back("types"); - nodedatanames.push_back("sparse_id"); - nodedatanames.push_back("matrix_id"); + nodedatanames.emplace_back("types"); + nodedatanames.emplace_back("sparse_id"); + nodedatanames.emplace_back("matrix_id"); nodedata.resize(nodedatanames.size()); @@ -111,7 +111,7 @@ void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name, grid->transIndexToCoords(index, x, y, z); nodeNumbers(xIndex, yIndex, zIndex) = nr++; - nodes.push_back(UbTupleFloat3(float(x), float(y), float(z))); + nodes.emplace_back(UbTupleFloat3(float(x), float(y), float(z))); const char type = grid->getFieldEntry(grid->transCoordToIndex(x, y, z)); nodedata[0].push_back(type); @@ -146,7 +146,7 @@ void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name, { Cell cell(x, y, z, grid->getDelta()); //if (grid->nodeInCellIs(cell, INVALID_OUT_OF_GRID) || grid->nodeInCellIs(cell, INVALID_COARSE_UNDER_FINE)) - // continue; + // continue; cells.push_back(makeUbTuple(uint(SWB), uint(SEB), uint(NEB), uint(NWB), uint(SWT), uint(SET), uint(NET), uint(NWT))); } @@ -159,7 +159,7 @@ void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name, } -void GridVTKWriter::writeInterpolationCellsToVTKXML(SPtr<Grid> grid, SPtr<Grid> gridCoarse, const std::string& name, WRITING_FORMAT format) +void GridVTKWriter::writeInterpolationCellsToVTKXML(SPtr<Grid> grid, SPtr<Grid> gridCoarse, const std::string& name) { std::vector<char> nodeInterpolationCellType( grid->getSize() ); for( auto& type : nodeInterpolationCellType ) type = -1; @@ -198,79 +198,79 @@ void GridVTKWriter::writeInterpolationCellsToVTKXML(SPtr<Grid> grid, SPtr<Grid> } } - std::vector<UbTupleFloat3> nodes; - std::vector<UbTupleInt8> cells; - std::vector<std::string> celldatanames; - std::vector< std::vector<double> > celldata; - - celldatanames.push_back("InterpolationCells"); - celldatanames.push_back("Offset"); - - celldata.resize(celldatanames.size()); - - CbArray3D<int> nodeNumbers(grid->getNumberOfNodesX(), grid->getNumberOfNodesY(), grid->getNumberOfNodesZ(), -1); - int nr = 0; - - for (uint xIndex = 0; xIndex < grid->getNumberOfNodesX(); xIndex++) - { - for (uint yIndex = 0; yIndex < grid->getNumberOfNodesY(); yIndex++) - { - for (uint zIndex = 0; zIndex < grid->getNumberOfNodesZ(); zIndex++) - { - real x, y, z; - uint index = - grid->getNumberOfNodesX() * grid->getNumberOfNodesY() * zIndex - + grid->getNumberOfNodesX() * yIndex - + xIndex; - - grid->transIndexToCoords(index, x, y, z); - - nodeNumbers(xIndex, yIndex, zIndex) = nr++; - nodes.push_back(UbTupleFloat3(float(x), float(y), float(z))); - } - } - } - - int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT; - for (uint xIndex = 0; xIndex < grid->getNumberOfNodesX() - 1; xIndex++) - { - for (uint yIndex = 0; yIndex < grid->getNumberOfNodesY() - 1; yIndex++) - { - for (uint zIndex = 0; zIndex < grid->getNumberOfNodesZ() - 1; zIndex++) - { - real x, y, z; - uint index = grid->getNumberOfNodesX() * grid->getNumberOfNodesY() * zIndex - + grid->getNumberOfNodesX() * yIndex - + xIndex; - - grid->transIndexToCoords(index, x, y, z); - - if ((SWB = nodeNumbers(xIndex, yIndex, zIndex)) >= 0 - && (SEB = nodeNumbers(xIndex + 1, yIndex, zIndex)) >= 0 - && (NEB = nodeNumbers(xIndex + 1, yIndex + 1, zIndex)) >= 0 - && (NWB = nodeNumbers(xIndex, yIndex + 1, zIndex)) >= 0 - && (SWT = nodeNumbers(xIndex, yIndex, zIndex + 1)) >= 0 - && (SET = nodeNumbers(xIndex + 1, yIndex, zIndex + 1)) >= 0 - && (NET = nodeNumbers(xIndex + 1, yIndex + 1, zIndex + 1)) >= 0 - && (NWT = nodeNumbers(xIndex, yIndex + 1, zIndex + 1)) >= 0) - { - Cell cell(x, y, z, grid->getDelta()); - //if (grid->nodeInCellIs(cell, INVALID_OUT_OF_GRID) || grid->nodeInCellIs(cell, INVALID_COARSE_UNDER_FINE)) - // continue; - - cells.push_back(makeUbTuple(SWB, SEB, NEB, NWB, SWT, SET, NET, NWT)); - - //const char type = grid->getFieldEntry(grid->transCoordToIndex(nodes[SWB].v1, nodes[SWB].v2.v1, nodes[SWB].v2.v2)); - //const char type = grid->getFieldEntry(grid->transCoordToIndex(val<1>(nodes[SWB]), val<2>(nodes[SWB]), val<3>(nodes[SWB]))); - const char type = nodeInterpolationCellType[ grid->transCoordToIndex(val<1>(nodes[SWB]), val<2>(nodes[SWB]), val<3>(nodes[SWB])) ]; + std::vector<UbTupleFloat3> nodes; + std::vector<UbTupleInt8> cells; + std::vector<std::string> celldatanames; + std::vector< std::vector<double> > celldata; + + celldatanames.emplace_back("InterpolationCells"); + celldatanames.emplace_back("Offset"); + + celldata.resize(celldatanames.size()); + + CbArray3D<int> nodeNumbers(grid->getNumberOfNodesX(), grid->getNumberOfNodesY(), grid->getNumberOfNodesZ(), -1); + int nr = 0; + + for (uint xIndex = 0; xIndex < grid->getNumberOfNodesX(); xIndex++) + { + for (uint yIndex = 0; yIndex < grid->getNumberOfNodesY(); yIndex++) + { + for (uint zIndex = 0; zIndex < grid->getNumberOfNodesZ(); zIndex++) + { + real x, y, z; + uint index = + grid->getNumberOfNodesX() * grid->getNumberOfNodesY() * zIndex + + grid->getNumberOfNodesX() * yIndex + + xIndex; + + grid->transIndexToCoords(index, x, y, z); + + nodeNumbers(xIndex, yIndex, zIndex) = nr++; + nodes.emplace_back(UbTupleFloat3(float(x), float(y), float(z))); + } + } + } + + int SWB, SEB, NEB, NWB, SWT, SET, NET, NWT; + for (uint xIndex = 0; xIndex < grid->getNumberOfNodesX() - 1; xIndex++) + { + for (uint yIndex = 0; yIndex < grid->getNumberOfNodesY() - 1; yIndex++) + { + for (uint zIndex = 0; zIndex < grid->getNumberOfNodesZ() - 1; zIndex++) + { + real x, y, z; + uint index = grid->getNumberOfNodesX() * grid->getNumberOfNodesY() * zIndex + + grid->getNumberOfNodesX() * yIndex + + xIndex; + + grid->transIndexToCoords(index, x, y, z); + + if ((SWB = nodeNumbers(xIndex, yIndex, zIndex)) >= 0 + && (SEB = nodeNumbers(xIndex + 1, yIndex, zIndex)) >= 0 + && (NEB = nodeNumbers(xIndex + 1, yIndex + 1, zIndex)) >= 0 + && (NWB = nodeNumbers(xIndex, yIndex + 1, zIndex)) >= 0 + && (SWT = nodeNumbers(xIndex, yIndex, zIndex + 1)) >= 0 + && (SET = nodeNumbers(xIndex + 1, yIndex, zIndex + 1)) >= 0 + && (NET = nodeNumbers(xIndex + 1, yIndex + 1, zIndex + 1)) >= 0 + && (NWT = nodeNumbers(xIndex, yIndex + 1, zIndex + 1)) >= 0) + { + Cell cell(x, y, z, grid->getDelta()); + //if (grid->nodeInCellIs(cell, INVALID_OUT_OF_GRID) || grid->nodeInCellIs(cell, INVALID_COARSE_UNDER_FINE)) + // continue; + + cells.push_back(makeUbTuple(SWB, SEB, NEB, NWB, SWT, SET, NET, NWT)); + + //const char type = grid->getFieldEntry(grid->transCoordToIndex(nodes[SWB].v1, nodes[SWB].v2.v1, nodes[SWB].v2.v2)); + //const char type = grid->getFieldEntry(grid->transCoordToIndex(val<1>(nodes[SWB]), val<2>(nodes[SWB]), val<3>(nodes[SWB]))); + const char type = nodeInterpolationCellType[ grid->transCoordToIndex(val<1>(nodes[SWB]), val<2>(nodes[SWB]), val<3>(nodes[SWB])) ]; const char offset = nodeOffset [ grid->transCoordToIndex(val<1>(nodes[SWB]), val<2>(nodes[SWB]), val<3>(nodes[SWB])) ]; celldata[0].push_back( type ); celldata[1].push_back( offset ); - } - } - } - } + } + } + } + } WbWriterVtkXmlBinary::getInstance()->writeOctsWithCellData(name, nodes, cells, celldatanames, celldata); } @@ -319,18 +319,18 @@ void GridVTKWriter::openFile(const std::string& name, const std::string& mode) void GridVTKWriter::closeFile() { GridVTKWriter::end_line(); - fclose(file); + fclose(file); } void GridVTKWriter::writeHeader() { - fprintf(file, "# vtk DataFile Version 3.0\n"); - fprintf(file, "by MeshGenerator\n"); - if (isBinaryWritingFormat()) - fprintf(file, "BINARY\n"); - else - fprintf(file, "ASCII\n"); - fprintf(file, "DATASET UNSTRUCTURED_GRID\n"); + fprintf(file, "# vtk DataFile Version 3.0\n"); + fprintf(file, "by MeshGenerator\n"); + if (isBinaryWritingFormat()) + fprintf(file, "BINARY\n"); + else + fprintf(file, "ASCII\n"); + fprintf(file, "DATASET UNSTRUCTURED_GRID\n"); } void GridVTKWriter::writePoints(SPtr<Grid> grid) @@ -356,34 +356,34 @@ void GridVTKWriter::writePoints(SPtr<Grid> grid) void GridVTKWriter::writeCells(const unsigned int &size) { - fprintf(file, "\nCELLS %d %d\n", size, size * 2); - for (unsigned int i = 0; i < size; ++i) - { - if (isBinaryWritingFormat()){ - write_int(1); - write_int(i); - } - else - fprintf(file, "1 %d\n", i); - } - - fprintf(file, "\nCELL_TYPES %d\n", size); - for (unsigned int i = 0; i < size; ++i) - { - if (isBinaryWritingFormat()) - write_int(1); - else - fprintf(file, "1 "); - } - if (!isBinaryWritingFormat()) + fprintf(file, "\nCELLS %u %u\n", size, size * 2); + for (unsigned int i = 0; i < size; ++i) + { + if (isBinaryWritingFormat()){ + write_int(1); + write_int(i); + } + else + fprintf(file, "1 %u\n", i); + } + + fprintf(file, "\nCELL_TYPES %u\n", size); + for (unsigned int i = 0; i < size; ++i) + { + if (isBinaryWritingFormat()) + write_int(1); + else + fprintf(file, "1 "); + } + if (!isBinaryWritingFormat()) GridVTKWriter::end_line(); } void GridVTKWriter::writeTypeHeader(const unsigned int &size) { - fprintf(file, "\nPOINT_DATA %d\n", size); - fprintf(file, "SCALARS type int\n"); - fprintf(file, "LOOKUP_TABLE default\n"); + fprintf(file, "\nPOINT_DATA %u\n", size); + fprintf(file, "SCALARS type int\n"); + fprintf(file, "LOOKUP_TABLE default\n"); } void GridVTKWriter::writeTypes(SPtr<Grid> grid) @@ -402,38 +402,38 @@ void GridVTKWriter::writeTypes(SPtr<Grid> grid) void GridVTKWriter::end_line() { - char str2[8] = "\n"; - fprintf(file, "%s", str2); + char str2[8] = "\n"; + fprintf(file, "%s", str2); } void GridVTKWriter::write_int(int val) { - force_big_endian((unsigned char *)&val); - fwrite(&val, sizeof(int), 1, file); + force_big_endian((unsigned char *)&val); + fwrite(&val, sizeof(int), 1, file); } void GridVTKWriter::write_float(float val) { - force_big_endian((unsigned char *)&val); - fwrite(&val, sizeof(float), 1, file); + force_big_endian((unsigned char *)&val); + fwrite(&val, sizeof(float), 1, file); } void GridVTKWriter::force_big_endian(unsigned char *bytes) { - bool shouldSwap = false; - int tmp1 = 1; - unsigned char *tmp2 = (unsigned char *)&tmp1; - if (*tmp2 != 0) - shouldSwap = true; - - if (shouldSwap) - { - unsigned char tmp = bytes[0]; - bytes[0] = bytes[3]; - bytes[3] = tmp; - tmp = bytes[1]; - bytes[1] = bytes[2]; - bytes[2] = tmp; - } + bool shouldSwap = false; + int tmp1 = 1; + unsigned char *tmp2 = (unsigned char *)&tmp1; + if (*tmp2 != 0) + shouldSwap = true; + + if (shouldSwap) + { + unsigned char tmp = bytes[0]; + bytes[0] = bytes[3]; + bytes[3] = tmp; + tmp = bytes[1]; + bytes[1] = bytes[2]; + bytes[2] = tmp; + } } diff --git a/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.h b/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.h index cf33df096a6e670b65f79831d59927e3d7cea389..975b2d982ea3a5aee9fb9db8a773e02505ff9b8a 100644 --- a/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.h +++ b/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.h @@ -36,7 +36,6 @@ #include <string> #include "global.h" -#include "GridGenerator_export.h" enum class WRITING_FORMAT { BINARY, ASCII }; @@ -46,12 +45,12 @@ class GRIDGENERATOR_EXPORT GridVTKWriter { public: static void writeSparseGridToVTK(SPtr<Grid> grid, const std::string& name, WRITING_FORMAT format = WRITING_FORMAT::ASCII); - static void writeGridToVTKXML(SPtr<Grid> grid, const std::string& name, WRITING_FORMAT format = WRITING_FORMAT::ASCII); - static void writeInterpolationCellsToVTKXML(SPtr<Grid> grid, SPtr<Grid> gridCoarse, const std::string& name, WRITING_FORMAT format = WRITING_FORMAT::ASCII); + static void writeGridToVTKXML(SPtr<Grid> grid, const std::string& name); + static void writeInterpolationCellsToVTKXML(SPtr<Grid> grid, SPtr<Grid> gridCoarse, const std::string& name); private: - GridVTKWriter() {} - ~GridVTKWriter() {} + GridVTKWriter() = default; + ~GridVTKWriter() = default; static FILE *file; static WRITING_FORMAT format; diff --git a/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp b/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp index 173f79c184c0a455ffd5b27cae59e07fa6dd4fa6..d3eb221265b2f8c79d5aece8729585733c2d60e8 100644 --- a/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp +++ b/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp @@ -118,7 +118,7 @@ std::vector<Triangle> STLReader::readASCIISTLWithPatches(const std::string& name std::ifstream file; file.open(name.c_str(), std::ifstream::in); - if( !file.is_open() ) throw std::runtime_error(name + "cannot be opened!"); + if( !file.is_open() ) throw std::runtime_error(name + " cannot be opened!"); uint currentPatchIndex = 0; diff --git a/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp b/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp index 320a6e5fb7bb8e52a335722bca71d7d6a2a0c6de..23fb0f4e7f3e16702e9cb2459606986af1032e49 100644 --- a/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp +++ b/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp @@ -37,7 +37,6 @@ #include <iomanip> #include <omp.h> #include <cmath> -#include <stdint.h> #include "Core/Timer/Timer.h" @@ -56,7 +55,7 @@ using namespace vf::gpu; /*#################################################################################*/ /*---------------------------------public methods----------------------------------*/ /*---------------------------------------------------------------------------------*/ -void SimulationFileWriter::write(std::string folder, SPtr<GridBuilder> builder, FILEFORMAT format) +void SimulationFileWriter::write(const std::string& folder, SPtr<GridBuilder> builder, FILEFORMAT format) { SimulationFileWriter::folder = folder; @@ -133,7 +132,7 @@ void SimulationFileWriter::openFiles(SPtr<GridBuilder> builder) qNames.push_back(path + simulationFileNames::bottomBoundaryQ); qNames.push_back(path + simulationFileNames::frontBoundaryQ); qNames.push_back(path + simulationFileNames::backBoundaryQ); - qNames.push_back(path + simulationFileNames::geomBoundaryQ); + qNames.push_back(path + simulationFileNames::geomBoundaryQ); std::vector<std::string> valueNames; valueNames.push_back(path + simulationFileNames::inletBoundaryValues); @@ -142,7 +141,7 @@ void SimulationFileWriter::openFiles(SPtr<GridBuilder> builder) valueNames.push_back(path + simulationFileNames::bottomBoundaryValues); valueNames.push_back(path + simulationFileNames::frontBoundaryValues); valueNames.push_back(path + simulationFileNames::backBoundaryValues); - valueNames.push_back(path + simulationFileNames::geomBoundaryValues); + valueNames.push_back(path + simulationFileNames::geomBoundaryValues); for (int i = 0; i < QFILES; i++){ SPtr<std::ofstream> outQ(new std::ofstream); @@ -232,7 +231,7 @@ void SimulationFileWriter::writeLevelSize(uint numberOfNodes, FILEFORMAT format) const std::string zeroGeo = "16 "; if (format == FILEFORMAT::BINARY) - { + { //const uint zeroIndex = 0; //const uint zeroGeo = 16; @@ -258,7 +257,7 @@ void SimulationFileWriter::writeLevelSize(uint numberOfNodes, FILEFORMAT format) geoVecFile << numberOfNodes << "\n" << zeroGeo ; } else - { + { xCoordFile << numberOfNodes << "\n" << zeroIndex << "\n"; yCoordFile << numberOfNodes << "\n" << zeroIndex << "\n"; zCoordFile << numberOfNodes << "\n" << zeroIndex << "\n"; @@ -319,7 +318,7 @@ void SimulationFileWriter::writeCoordsNeighborsGeo(SPtr<GridBuilder> builder, in grid->transIndexToCoords(index, x, y, z); if (format == FILEFORMAT::BINARY) - { + { double tmpX = (double)x; double tmpY = (double)y; double tmpZ = (double)z; @@ -342,7 +341,7 @@ void SimulationFileWriter::writeCoordsNeighborsGeo(SPtr<GridBuilder> builder, in geoVecFile.write((char*)&type, sizeof(unsigned int)); } else - { + { xCoordFile << x << "\n"; yCoordFile << y << "\n"; zCoordFile << z << "\n"; @@ -446,7 +445,7 @@ void SimulationFileWriter::writeGridInterfaceOffsetToFile(uint numberOfNodes, st std::vector<std::vector<std::vector<real> > > SimulationFileWriter::createBCVectors(SPtr<Grid> grid) { std::vector<std::vector<std::vector<real> > > qs; - qs.resize(QFILES); + qs.resize(QFILES); for (uint i = 0; i < grid->getSize(); i++) { real x, y, z; @@ -472,9 +471,9 @@ void SimulationFileWriter::addShortQsToVector(int index, std::vector<std::vector for (int i = grid->getEndDirection(); i >= 0; i--) { - /*int qIndex = i * grid->getSize() + grid->getSparseIndex(index); - real q = grid->getDistribution()[qIndex];*/ - real q = grid->getQValue(index, i); + /*int qIndex = i * grid->getSize() + grid->getSparseIndex(index); + real q = grid->getDistribution()[qIndex];*/ + real q = grid->getQValue(index, i); if (q > 0) { //printf("Q%d (old:%d, new:%d), : %2.8f \n", i, coordsVec[index].matrixIndex, index, grid.d.f[i * grid.size + coordsVec[index].matrixIndex]); qKey += (uint32_t)pow(2, 26 - i); @@ -499,10 +498,10 @@ void SimulationFileWriter::addQsToVector(int index, std::vector<std::vector<std: { //int qIndex = i * grid->getSize() + grid->getSparseIndex(index); //real q = grid->getDistribution()[qIndex]; - real q = grid->getQValue(index, i); + real q = grid->getQValue(index, i); qNode.push_back(q); - if (q > 0) - printf("Q= %f; Index = %d \n", q, index); + if (q > 0) + printf("Q= %f; Index = %d \n", q, index); //qNode.push_back(q); // else // qNode.push_back(-1); @@ -540,8 +539,8 @@ void SimulationFileWriter::writeBoundaryQsFile(SPtr<GridBuilder> builder) // for (int rb = 0; rb < QFILES; rb++) { // for (int index = 0; index < qFiles[rb].size(); index++) { // //writeBoundary(qFiles[rb][index], rb); - // writeBoundaryShort(qFiles[rb][index], rb); - //} + // writeBoundaryShort(qFiles[rb][index], rb); + //} // } SideType sides[] = {SideType::MX, SideType::PX, SideType::PZ, SideType::MZ, SideType::MY, SideType::PY, SideType::GEOMETRY}; @@ -593,18 +592,18 @@ void SimulationFileWriter::writeBoundary(std::vector<real> boundary, int rb) void SimulationFileWriter::writeBoundaryShort(std::vector<real> boundary, int rb) { - uint32_t key = *((uint32_t*)&boundary[boundary.size() - 2]); - int index = (int)boundary[boundary.size() - 1]; + uint32_t key = *((uint32_t*)&boundary[boundary.size() - 2]); + int index = (int)boundary[boundary.size() - 1]; - *qStreams[rb] << (index + 1) << " " << key; + *qStreams[rb] << (index + 1) << " " << key; - for (std::size_t i = 0; i < boundary.size() - 2; i++) { - *qStreams[rb] << " " << std::fixed << std::setprecision(16) << boundary[i]; - } - *valueStreams[rb] << (index + 1) << " 0 0 0"; + for (std::size_t i = 0; i < boundary.size() - 2; i++) { + *qStreams[rb] << " " << std::fixed << std::setprecision(16) << boundary[i]; + } + *valueStreams[rb] << (index + 1) << " 0 0 0"; - *qStreams[rb] << "\n"; - *valueStreams[rb] << "\n"; + *qStreams[rb] << "\n"; + *valueStreams[rb] << "\n"; } void SimulationFileWriter::writeBoundaryShort(SPtr<Grid> grid, SPtr<gg::BoundaryCondition> boundaryCondition, uint side) diff --git a/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h b/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h index d5d2a377b33697704b86f8b78987fd0af75be415..f3851abfd3372e5d3548cf7c0cd02344aa8acbaa 100644 --- a/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h +++ b/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h @@ -42,7 +42,7 @@ #include "Core/NonCreatable.h" -#include "global.h" +#include "gpu/GridGenerator/global.h" class UnstructuredGridBuilder; class GridBuilder; @@ -60,7 +60,7 @@ enum class FILEFORMAT class SimulationFileWriter : private NonCreatable { public: - GRIDGENERATOR_EXPORT static void write(std::string folder, SPtr<GridBuilder> builder, FILEFORMAT format); + GRIDGENERATOR_EXPORT static void write(const std::string& folder, SPtr<GridBuilder> builder, FILEFORMAT format); private: static void write(SPtr<GridBuilder> builder, FILEFORMAT format); @@ -85,12 +85,12 @@ private: static void addQsToVector(int index, std::vector<std::vector<std::vector<real> > > &qs, SPtr<Grid> grid); static void fillRBForNode(int index, int direction, int directionSign, int rb, std::vector<std::vector<std::vector<real> > > &qs, SPtr<Grid> grid); static void writeBoundary(std::vector<real> boundary, int rb); - static void writeBoundaryShort(std::vector<real> boundary, int rb); - static void writeBoundaryShort(SPtr<Grid> grid, SPtr<gg::BoundaryCondition> boundaryCondition, uint side); + static void writeBoundaryShort(std::vector<real> boundary, int rb); + static void writeBoundaryShort(SPtr<Grid> grid, SPtr<gg::BoundaryCondition> boundaryCondition, uint side); static void writeCommunicationFiles(SPtr<GridBuilder> builder); - static void closeFiles(); + static void closeFiles(); static std::ofstream xCoordFile; diff --git a/src/gpu/GridGenerator/utilities/transformator/TransformatorImp.h b/src/gpu/GridGenerator/utilities/transformator/TransformatorImp.h index 81ba5a25badc879aa501256ed67eed0a4b39961c..40110a15d7deb0d62f12943a48536201022f2321 100644 --- a/src/gpu/GridGenerator/utilities/transformator/TransformatorImp.h +++ b/src/gpu/GridGenerator/utilities/transformator/TransformatorImp.h @@ -37,7 +37,6 @@ #include <sstream> #include "global.h" -#include "GridGenerator_export.h" #include "utilities/transformator/Transformator.h" #include "utilities/transformator/ArrowTransformator.h" diff --git a/src/gpu/VirtualFluids_GPU/CMakeLists.txt b/src/gpu/VirtualFluids_GPU/CMakeLists.txt index 116e987664ba14b83054c823ff9cf6505fccf769..759528e5346ba8d9899cb90eb64503b20a44c4fc 100644 --- a/src/gpu/VirtualFluids_GPU/CMakeLists.txt +++ b/src/gpu/VirtualFluids_GPU/CMakeLists.txt @@ -1,23 +1,28 @@ project(VirtualFluids_GPU LANGUAGES CUDA CXX) +find_package(CUDA REQUIRED) +include_directories("${CUDA_INCLUDE_DIRS}") + set(additional_libraries "") if(MSVC) set(additional_libraries ws2_32 Traffic) # ws_32 throws an error on Phoenix endif() -vf_add_library(PUBLIC_LINK basics lbmCuda PRIVATE_LINK ${additional_libraries} GridGenerator MPI::MPI_CXX cuda) - +vf_add_library(PUBLIC_LINK basics lbmCuda PRIVATE_LINK ${additional_libraries} GridGenerator MPI::MPI_CXX vf_cuda) #SET(TPN_WIN32 "/EHsc") #https://stackoverflow.com/questions/6832666/lnk2019-when-including-asio-headers-solution-generated-with-cmake #https://stackoverflow.com/questions/27442885/syntax-error-with-stdnumeric-limitsmax -set_target_properties(VirtualFluids_GPU PROPERTIES CUDA_SEPARABLE_COMPILATION ON) - +set_target_properties(VirtualFluids_GPU PROPERTIES CUDA_SEPARABLE_COMPILATION ON POSITION_INDEPENDENT_CODE ON) vf_add_tests() if(BUILD_VF_UNIT_TESTS) set_target_properties(VirtualFluids_GPUTests PROPERTIES CUDA_SEPARABLE_COMPILATION ON) set_source_files_properties(Kernel/Utilities/DistributionHelperTests.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(Communication/ExchangeData27Test.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(BoundaryConditions/BoundaryConditionFactoryTest.cpp PROPERTIES LANGUAGE CUDA) + target_include_directories(VirtualFluids_GPUTests PRIVATE "${VF_THIRD_DIR}/cuda_samples/") endif() diff --git a/src/gpu/VirtualFluids_GPU/Calculation/Calc2ndMoments.cpp b/src/gpu/VirtualFluids_GPU/Calculation/Calc2ndMoments.cpp index 262a49eaa8920e9e69694425e45ef71b41d913a2..f8f5c42b835a1a4ba55e378e624230bbb43dc05a 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/Calc2ndMoments.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/Calc2ndMoments.cpp @@ -2,13 +2,13 @@ #include <cuda_runtime.h> #include <helper_cuda.h> -void alloc2ndMoments(Parameter* para, CudaMemoryManager* cudaManager) +void alloc2ndMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { ////////////////////////////////////////////////////////////////////////// //allocation (device-memory + host-memory) - cudaManager->cudaAlloc2ndMoments(lev, para->getParH(lev)->size_Mat_SP); + cudaMemoryManager->cudaAlloc2ndMoments(lev, para->getParH(lev)->numberOfNodes); ////////////////////////////////////////////////////////////////////////// } } @@ -21,7 +21,7 @@ void init2ndMoments(Parameter* para) { ////////////////////////////////////////////////////////////////////////// //init host arrays - for (unsigned int pos=0;pos<para->getParH(lev)->size_Mat_SP;pos++) + for (unsigned int pos=0;pos<para->getParH(lev)->numberOfNodes;pos++) { para->getParH(lev)->kxyFromfcNEQ[pos] = 0.0; para->getParH(lev)->kyzFromfcNEQ[pos] = 0.0; @@ -35,7 +35,7 @@ void init2ndMoments(Parameter* para) -void calc2ndMoments(Parameter* para, CudaMemoryManager* cudaManager) +void calc2ndMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { @@ -46,17 +46,17 @@ void calc2ndMoments(Parameter* para, CudaMemoryManager* cudaManager) para->getParD(lev)->kxzFromfcNEQ, para->getParD(lev)->kxxMyyFromfcNEQ, para->getParD(lev)->kxxMzzFromfcNEQ, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, para->getParD(lev)->numberofthreads, - para->getParD(lev)->d0SP.f[0], - para->getParD(lev)->evenOrOdd); + para->getParD(lev)->distributions.f[0], + para->getParD(lev)->isEvenTimestep); ////////////////////////////////////////////////////////////////////////// //copy results to host - cudaManager->cudaCopy2ndMoments(lev, para->getParH(lev)->size_Mat_SP); + cudaMemoryManager->cudaCopy2ndMoments(lev, para->getParH(lev)->numberOfNodes); ////////////////////////////////////////////////////////////////////////// } } @@ -97,13 +97,13 @@ void calc2ndMoments(Parameter* para, CudaMemoryManager* cudaManager) -void alloc3rdMoments(Parameter* para, CudaMemoryManager* cudaManager) +void alloc3rdMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { ////////////////////////////////////////////////////////////////////////// //allocation (device-memory + host-memory) - cudaManager->cudaAlloc3rdMoments(lev, para->getParH(lev)->size_Mat_SP); + cudaMemoryManager->cudaAlloc3rdMoments(lev, para->getParH(lev)->numberOfNodes); ////////////////////////////////////////////////////////////////////////// } } @@ -116,7 +116,7 @@ void init3rdMoments(Parameter* para) { ////////////////////////////////////////////////////////////////////////// //init host arrays - for (unsigned int pos=0;pos<para->getParH(lev)->size_Mat_SP;pos++) + for (unsigned int pos=0;pos<para->getParH(lev)->numberOfNodes;pos++) { para->getParH(lev)->CUMbbb[pos] = 0.0; para->getParH(lev)->CUMabc[pos] = 0.0; @@ -132,7 +132,7 @@ void init3rdMoments(Parameter* para) -void calc3rdMoments(Parameter* para, CudaMemoryManager* cudaManager) +void calc3rdMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { @@ -145,17 +145,17 @@ void calc3rdMoments(Parameter* para, CudaMemoryManager* cudaManager) para->getParD(lev)->CUMcba, para->getParD(lev)->CUMacb, para->getParD(lev)->CUMcab, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, para->getParD(lev)->numberofthreads, - para->getParD(lev)->d0SP.f[0], - para->getParD(lev)->evenOrOdd); + para->getParD(lev)->distributions.f[0], + para->getParD(lev)->isEvenTimestep); ////////////////////////////////////////////////////////////////////////// //copy results to host - cudaManager->cudaCopy3rdMoments(lev, para->getParH(lev)->size_Mat_SP); + cudaMemoryManager->cudaCopy3rdMoments(lev, para->getParH(lev)->numberOfNodes); ////////////////////////////////////////////////////////////////////////// } } @@ -196,13 +196,13 @@ void calc3rdMoments(Parameter* para, CudaMemoryManager* cudaManager) -void allocHigherOrderMoments(Parameter* para, CudaMemoryManager* cudaManager) +void allocHigherOrderMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { ////////////////////////////////////////////////////////////////////////// //allocation (device-memory + host-memory) - cudaManager->cudaAllocHigherMoments(lev, para->getParH(lev)->size_Mat_SP); + cudaMemoryManager->cudaAllocHigherMoments(lev, para->getParH(lev)->numberOfNodes); ////////////////////////////////////////////////////////////////////////// } } @@ -215,7 +215,7 @@ void initHigherOrderMoments(Parameter* para) { ////////////////////////////////////////////////////////////////////////// //init host arrays - for (unsigned int pos=0;pos<para->getParH(lev)->size_Mat_SP;pos++) + for (unsigned int pos=0;pos<para->getParH(lev)->numberOfNodes;pos++) { para->getParH(lev)->CUMcbb[pos] = 0.0; para->getParH(lev)->CUMbcb[pos] = 0.0; @@ -234,7 +234,7 @@ void initHigherOrderMoments(Parameter* para) -void calcHigherOrderMoments(Parameter* para, CudaMemoryManager* cudaManager) +void calcHigherOrderMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { @@ -250,17 +250,17 @@ void calcHigherOrderMoments(Parameter* para, CudaMemoryManager* cudaManager) para->getParD(lev)->CUMcbc, para->getParD(lev)->CUMccb, para->getParD(lev)->CUMccc, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, para->getParD(lev)->numberofthreads, - para->getParD(lev)->d0SP.f[0], - para->getParD(lev)->evenOrOdd); + para->getParD(lev)->distributions.f[0], + para->getParD(lev)->isEvenTimestep); ////////////////////////////////////////////////////////////////////////// //copy results to host - cudaManager->cudaCopyHigherMoments(lev, para->getParH(lev)->size_Mat_SP); + cudaMemoryManager->cudaCopyHigherMoments(lev, para->getParH(lev)->numberOfNodes); ////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Calculation/Calc2ndMoments.h b/src/gpu/VirtualFluids_GPU/Calculation/Calc2ndMoments.h index db37289c3f3fe48fa071724d0fe268bfbf457bc0..42997be82687ab480a2d4d45b0793ba307e2ebf4 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/Calc2ndMoments.h +++ b/src/gpu/VirtualFluids_GPU/Calculation/Calc2ndMoments.h @@ -7,18 +7,18 @@ #include "GPU/CudaMemoryManager.h" //2nd -extern "C" void alloc2ndMoments(Parameter* para, CudaMemoryManager* cudaManager); -extern "C" void init2ndMoments(Parameter* para); -extern "C" void calc2ndMoments(Parameter* para, CudaMemoryManager* cudaManager); +void alloc2ndMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager); +void init2ndMoments(Parameter* para); +void calc2ndMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager); //3rd -extern "C" void alloc3rdMoments(Parameter* para, CudaMemoryManager* cudaManager); -extern "C" void init3rdMoments(Parameter* para); -extern "C" void calc3rdMoments(Parameter* para, CudaMemoryManager* cudaManager); +void alloc3rdMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager); +void init3rdMoments(Parameter* para); +void calc3rdMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager); //higher order -extern "C" void allocHigherOrderMoments(Parameter* para, CudaMemoryManager* cudaManager); -extern "C" void initHigherOrderMoments(Parameter* para); -extern "C" void calcHigherOrderMoments(Parameter* para, CudaMemoryManager* cudaManager); +void allocHigherOrderMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager); +void initHigherOrderMoments(Parameter* para); +void calcHigherOrderMoments(Parameter* para, CudaMemoryManager* cudaMemoryManager); #endif diff --git a/src/gpu/VirtualFluids_GPU/Calculation/CalcMedian.cpp b/src/gpu/VirtualFluids_GPU/Calculation/CalcMedian.cpp index 1adb709c5eb4f391756d455a53717a0d9cf72858..77db571f7f10e0ea0bff827400270dd074d4e666 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/CalcMedian.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/CalcMedian.cpp @@ -9,12 +9,12 @@ #include <cuda_runtime.h> #include <helper_cuda.h> -void allocMedian(Parameter* para, CudaMemoryManager* cudaManager) +void allocMedian(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { - cudaManager->cudaAllocMedianOut(lev); - for (unsigned int i = 0; i < para->getParH(lev)->size_Mat_SP; i++) + cudaMemoryManager->cudaAllocMedianOut(lev); + for (unsigned int i = 0; i < para->getParH(lev)->numberOfNodes; i++) { para->getParH(lev)->vx_SP_Med_Out[i] = (real)0.0; para->getParH(lev)->vy_SP_Med_Out[i] = (real)0.0; @@ -33,7 +33,7 @@ void calcMedian(Parameter* para, uint tdiff) { for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { - for (uint i = 0; i < para->getParH(lev)->size_Mat_SP; i++) + for (uint i = 0; i < para->getParH(lev)->numberOfNodes; i++) { para->getParH(lev)->vx_SP_Med_Out[i] = para->getParH(lev)->vx_SP_Med[i] / (real)tdiff; para->getParH(lev)->vy_SP_Med_Out[i] = para->getParH(lev)->vy_SP_Med[i] / (real)tdiff; @@ -58,9 +58,9 @@ void resetMedian(Parameter* para) para->getParD(lev)->vz_SP_Med, para->getParD(lev)->rho_SP_Med, para->getParD(lev)->press_SP_Med, - para->getParD(lev)->size_Mat_SP, + para->getParD(lev)->numberOfNodes, para->getParD(lev)->numberofthreads, - para->getParD(lev)->evenOrOdd); + para->getParD(lev)->isEvenTimestep); getLastCudaError("ResetMedianValuesSP27 execution failed"); } } @@ -70,12 +70,12 @@ void resetMedian(Parameter* para) //Advection-Diffusion -void allocMedianAD(Parameter* para, CudaMemoryManager* cudaManager) +void allocMedianAD(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { - cudaManager->cudaAllocMedianOutAD(lev); - for (unsigned int i = 0; i < para->getParH(lev)->size_Mat_SP; i++) + cudaMemoryManager->cudaAllocMedianOutAD(lev); + for (unsigned int i = 0; i < para->getParH(lev)->numberOfNodes; i++) { para->getParH(lev)->vx_SP_Med_Out[i] = (real)0.0; para->getParH(lev)->vy_SP_Med_Out[i] = (real)0.0; @@ -95,7 +95,7 @@ void calcMedianAD(Parameter* para, uint tdiff) { for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { - for (uint i = 0; i < para->getParH(lev)->size_Mat_SP; i++) + for (uint i = 0; i < para->getParH(lev)->numberOfNodes; i++) { para->getParH(lev)->vx_SP_Med_Out[i] = para->getParH(lev)->vx_SP_Med[i] / (real)tdiff; para->getParH(lev)->vy_SP_Med_Out[i] = para->getParH(lev)->vy_SP_Med[i] / (real)tdiff; @@ -122,9 +122,9 @@ void resetMedianAD(Parameter* para) para->getParD(lev)->rho_SP_Med, para->getParD(lev)->press_SP_Med, para->getParD(lev)->Conc_Med, - para->getParD(lev)->size_Mat_SP, + para->getParD(lev)->numberOfNodes, para->getParD(lev)->numberofthreads, - para->getParD(lev)->evenOrOdd); + para->getParD(lev)->isEvenTimestep); getLastCudaError("ResetMedianValuesSP27 execution failed"); } } diff --git a/src/gpu/VirtualFluids_GPU/Calculation/CalcMedian.h b/src/gpu/VirtualFluids_GPU/Calculation/CalcMedian.h index 93615575746c9d138867cc6b2c1c4a4e44c0f160..262c22a1a557bfdd6aefaee492d2f8351f166599 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/CalcMedian.h +++ b/src/gpu/VirtualFluids_GPU/Calculation/CalcMedian.h @@ -6,9 +6,9 @@ #include "Parameter/Parameter.h" #include "GPU/CudaMemoryManager.h" -extern "C" void allocMedian(Parameter* para, CudaMemoryManager* cudaManager); -extern "C" void allocMedianAD(Parameter* para, CudaMemoryManager* cudaManager); -extern "C" void calcMedian(Parameter* para, unsigned int tdiff); -extern "C" void resetMedian(Parameter* para); +void allocMedian(Parameter* para, CudaMemoryManager* cudaMemoryManager); +void allocMedianAD(Parameter* para, CudaMemoryManager* cudaMemoryManager); +void calcMedian(Parameter* para, unsigned int tdiff); +void resetMedian(Parameter* para); #endif diff --git a/src/gpu/VirtualFluids_GPU/Calculation/CalcTurbulenceIntensity.cpp b/src/gpu/VirtualFluids_GPU/Calculation/CalcTurbulenceIntensity.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e91fb6f5c232bd98073a1c930149693f8af4b078 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Calculation/CalcTurbulenceIntensity.cpp @@ -0,0 +1,182 @@ +// _ ___ __ __________ _ __ ______________ __ +// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ / ___/ __ / / / / +// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ / /___/ /_/ / / / / +// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) / /_) / ____/ /__/ / +// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ \____/_/ \_____/ +// +////////////////////////////////////////////////////////////////////////// +#include "Calculation/CalcTurbulenceIntensity.h" +#include <cuda_runtime.h> +#include <helper_cuda.h> +#include <basics/Core/StringUtilities/StringUtil.h> + +void allocTurbulenceIntensity(Parameter *para, CudaMemoryManager *cudaMemoryManager) +{ + for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { + cudaMemoryManager->cudaAllocTurbulenceIntensity(lev, para->getParH(lev)->numberOfNodes); + para->getParH(lev)->turbulenceIntensity.resize(para->getParH(lev)->numberOfNodes); + } + resetVelocityFluctuationsAndMeans(para, cudaMemoryManager); +} + + +void calcVelocityAndFluctuations(Parameter *para, CudaMemoryManager *cudaMemoryManager, uint tdiff) +{ + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { + cudaMemoryManager->cudaCopyTurbulenceIntensityDH(lev, para->getParH(lev)->numberOfNodes); + + for (uint i = 0; i < para->getParH(lev)->numberOfNodes; i++) { + // mean velocity + para->getParH(lev)->vx_mean[i] = para->getParH(lev)->vx_mean[i] / (real)tdiff; + para->getParH(lev)->vy_mean[i] = para->getParH(lev)->vy_mean[i] / (real)tdiff; + para->getParH(lev)->vz_mean[i] = para->getParH(lev)->vz_mean[i] / (real)tdiff; + + // fluctuations + para->getParH(lev)->vxx[i] = para->getParH(lev)->vxx[i] / (real)tdiff; + para->getParH(lev)->vyy[i] = para->getParH(lev)->vyy[i] / (real)tdiff; + para->getParH(lev)->vzz[i] = para->getParH(lev)->vzz[i] / (real)tdiff; + para->getParH(lev)->vxy[i] = para->getParH(lev)->vxy[i] / (real)tdiff; + para->getParH(lev)->vxz[i] = para->getParH(lev)->vxz[i] / (real)tdiff; + para->getParH(lev)->vyz[i] = para->getParH(lev)->vyz[i] / (real)tdiff; + + para->getParH(lev)->vxx[i] = + para->getParH(lev)->vxx[i] - para->getParH(lev)->vx_mean[i] * para->getParH(lev)->vx_mean[i]; + para->getParH(lev)->vyy[i] = + para->getParH(lev)->vyy[i] - para->getParH(lev)->vy_mean[i] * para->getParH(lev)->vy_mean[i]; + para->getParH(lev)->vzz[i] = + para->getParH(lev)->vzz[i] - para->getParH(lev)->vz_mean[i] * para->getParH(lev)->vz_mean[i]; + para->getParH(lev)->vxy[i] = + para->getParH(lev)->vxy[i] - para->getParH(lev)->vx_mean[i] * para->getParH(lev)->vy_mean[i]; + para->getParH(lev)->vxz[i] = + para->getParH(lev)->vxz[i] - para->getParH(lev)->vx_mean[i] * para->getParH(lev)->vz_mean[i]; + para->getParH(lev)->vyz[i] = + para->getParH(lev)->vyz[i] - para->getParH(lev)->vy_mean[i] * para->getParH(lev)->vz_mean[i]; + } + } +} + + +void calcTurbulenceIntensity(Parameter *para, CudaMemoryManager *cudaMemoryManager, uint tdiff) { + + + real fluc_squared; + real v_mean_squared; + + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { + calcVelocityAndFluctuations(para, cudaMemoryManager, tdiff); + + for (uint i = 0; i < para->getParH(lev)->numberOfNodes; i++) { + fluc_squared = (real)( + 1.0 / 3.0 * (para->getParH(lev)->vxx[i] + para->getParH(lev)->vyy[i] + para->getParH(lev)->vzz[i])); + v_mean_squared = para->getParH(lev)->vx_mean[i] * para->getParH(lev)->vx_mean[i] + + para->getParH(lev)->vy_mean[i] * para->getParH(lev)->vy_mean[i] + + para->getParH(lev)->vz_mean[i] * para->getParH(lev)->vz_mean[i]; + para->getParH(lev)->turbulenceIntensity[i] = (real)sqrt(fluc_squared / v_mean_squared); + } + } +} + + +void resetVelocityFluctuationsAndMeans(Parameter *para, CudaMemoryManager *cudaMemoryManager) +{ + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { + for (unsigned int i = 0; i < para->getParH(lev)->numberOfNodes; i++) { + para->getParH(lev)->vxx[i] = (real)0.0; + para->getParH(lev)->vyy[i] = (real)0.0; + para->getParH(lev)->vzz[i] = (real)0.0; + para->getParH(lev)->vxy[i] = (real)0.0; + para->getParH(lev)->vxz[i] = (real)0.0; + para->getParH(lev)->vyz[i] = (real)0.0; + para->getParH(lev)->vx_mean[i] = (real)0.0; + para->getParH(lev)->vy_mean[i] = (real)0.0; + para->getParH(lev)->vz_mean[i] = (real)0.0; + } + + cudaMemoryManager->cudaCopyTurbulenceIntensityHD(lev, para->getParH(lev)->numberOfNodes); + } +} + +void cudaFreeTurbulenceIntensityArrays(Parameter *para, CudaMemoryManager *cudaMemoryManager) +{ + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { + cudaMemoryManager->cudaFreeTurbulenceIntensity(lev); + } +} + +void writeTurbulenceIntensityToFile(Parameter *para, uint timestep) +{ + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { + std::vector<real *> data = { para->getParH(lev)->turbulenceIntensity.data() }; + std::vector<std::string> datanames = { "ti" }; + writeTiStuffToFile(para, timestep, para->getParH(lev)->numberOfNodes, data, datanames); + } +} + +void writeVeloFluctuationToFile(Parameter *para, uint timestep) +{ + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { + std::vector<real *> data = { para->getParH(lev)->vxx, para->getParH(lev)->vyy, para->getParH(lev)->vzz }; + std::vector<std::string> datanames = { "vxx", "vyy", "vzz" }; + writeTiStuffToFile(para, timestep, para->getParH(lev)->numberOfNodes, data, datanames); + } +} + +void writeVeloMeansToFile(Parameter *para, uint timestep) { + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { + std::vector<real *> data = { para->getParH(lev)->vx_mean, + para->getParH(lev)->vy_mean, + para->getParH(lev)->vz_mean }; + std::vector<std::string> datanames = { "vx_mean", "vy_mean", "vz_mean" }; + writeTiStuffToFile(para, timestep, para->getParH(lev)->numberOfNodes, data, datanames); + } +} + +void writeAllTiDatafToFile(Parameter *para, uint timestep) +{ + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { + std::vector<real *> data = { para->getParH(lev)->vxx, + para->getParH(lev)->vyy, + para->getParH(lev)->vzz, + para->getParH(lev)->vx_mean, + para->getParH(lev)->vy_mean, + para->getParH(lev)->vz_mean, + para->getParH(lev)->turbulenceIntensity.data() }; + std::vector<std::string> datanames = { "vxx", "vyy", "vzz", "vx_mean", "vy_mean", "vz_mean", "ti" }; + writeTiStuffToFile(para, timestep, para->getParH(lev)->numberOfNodes, data, datanames); + } +} + +void writeTiStuffToFile(Parameter *para, uint timestep, int sizeOfTiArray, std::vector<real *> &data, + std::vector<std::string> &datanames) +{ + //////////////////////////////////////////////////////////////////////// + // set filename + std::string names; + std::for_each(datanames.begin(), datanames.end(), [&names](const std::string &s) { return names += "_" + s; }); + std::string ffname = para->getFName() + StringUtil::toString<int>(para->getMyProcessID()) + "_" + + StringUtil::toString<int>(timestep) + names + "_ti.txt"; + const char *fname = ffname.c_str(); + //////////////////////////////////////////////////////////////////////// + // set ofstream + std::ofstream ostr; + //////////////////////////////////////////////////////////////////////// + // open file + ostr.open(fname); + //////////////////////////////////////////////////////////////////////// + // add header + ostr << "index_sp"; + for (auto name : datanames) ostr << "\t" << name; + ostr << std::endl; + //////////////////////////////////////////////////////////////////////// + // fill file with data + for (int i = 0; i < sizeOfTiArray; i++) { + ostr << i; + for (auto dataset : data) + ostr << "\t" << dataset[i]; + ostr << std::endl; + } + //////////////////////////////////////////////////////////////////////// + // close file + ostr.close(); + //////////////////////////////////////////////////////////////////////// +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Calculation/CalcTurbulenceIntensity.h b/src/gpu/VirtualFluids_GPU/Calculation/CalcTurbulenceIntensity.h new file mode 100644 index 0000000000000000000000000000000000000000..f70973eb5921a17c3229a026623de2a0ef9f3ce4 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Calculation/CalcTurbulenceIntensity.h @@ -0,0 +1,24 @@ +#ifndef CalcTurbulenceIntensity_H +#define CalcTurbulenceIntensity_H + +#include "LBM/LB.h" +#include "GPU/GPU_Interface.h" +#include "Parameter/Parameter.h" +#include "GPU/CudaMemoryManager.h" + +void allocTurbulenceIntensity(Parameter *para, CudaMemoryManager *cudaMemoryManager); +void calcVelocityAndFluctuations(Parameter *para, CudaMemoryManager *cudaMemoryManager, uint tdiff); +void calcTurbulenceIntensity(Parameter *para, CudaMemoryManager *cudaMemoryManager, uint tdiff); +void resetVelocityFluctuationsAndMeans(Parameter *para, CudaMemoryManager *cudaMemoryManager); +void cudaFreeTurbulenceIntensityArrays(Parameter *para, CudaMemoryManager *cudaMemoryManager); + + +void writeTurbulenceIntensityToFile(Parameter *para, uint timestep); +void writeVeloFluctuationToFile(Parameter *para, uint timeste); +void writeVeloMeansToFile(Parameter *para, uint timestep); +void writeAllTiDatafToFile(Parameter *para, uint timestep); + +void writeTiStuffToFile(Parameter *para, uint timestep, int sizeOfTiArray, std::vector<real *> &data, + std::vector<std::string> &datanames); + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Calculation/CollisionStrategy.h b/src/gpu/VirtualFluids_GPU/Calculation/CollisionStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..70894346cbd334da3a4f8aa82648c33fda733f76 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Calculation/CollisionStrategy.h @@ -0,0 +1,35 @@ +#ifndef COLLISONSTRATEGY_H +#define COLLISONSTRATEGY_H + +#include "UpdateGrid27.h" + +//! \brief get a function which performs the collision operator and performs the communication between gpus/ processes +//! \return a function to perform the collision and for multi-gpu simulations also the communication +std::function<void(UpdateGrid27 *updateGrid, Parameter *para, int level, unsigned int t)> + getFunctionForCollisionAndExchange(const bool useStreams, const int numberOfMpiProcesses, + const bool kernelNeedsFluidNodeIndicesToRun); + +//! \brief Version of collision: for multi-gpu simulations, without communication hiding ("streams"), for newer kernels that use an array of fluid nodes to determine which nodes to update +class CollisionAndExchange_noStreams_indexKernel +{ +public: + void operator()(UpdateGrid27 *updateGrid, Parameter *para, int level, unsigned int t); +}; + +//! \brief Version of collision: for multi-gpu simulations, without communication hiding ("streams"), for old kernels +//! \details the only options for old kernel +class CollisionAndExchange_noStreams_oldKernel +{ +public: + void operator()(UpdateGrid27 *updateGrid, Parameter *para, int level, unsigned int t); +}; + +//! \brief Version of collision: for multi-gpu simulations, with communication hiding ("streams"), for newer kernels that use an array of fluid nodes to determine which nodes to update +//! \details recommended for multi-gpu simulations if the chosen collision kernel supports the use of cuda streams +class CollisionAndExchange_streams +{ +public: + void operator()(UpdateGrid27 *updateGrid, Parameter *para, int level, unsigned int t); +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Calculation/CollisisionStrategy.cpp b/src/gpu/VirtualFluids_GPU/Calculation/CollisisionStrategy.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4a14d19c10936f84379f332ef24f081f0ebb0cb7 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Calculation/CollisisionStrategy.cpp @@ -0,0 +1,88 @@ +#include "CollisionStrategy.h" +#include "Parameter/CudaStreamManager.h" +#include "Parameter/Parameter.h" +#include "logger/Logger.h" + +std::function<void(UpdateGrid27 *updateGrid, Parameter *para, int level, unsigned int t)> +getFunctionForCollisionAndExchange(const bool useStreams, const int numberOfMpiProcesses, + const bool kernelNeedsFluidNodeIndicesToRun) +{ + VF_LOG_INFO("Function used for collisionAndExchange: "); + + if (useStreams && numberOfMpiProcesses > 1 && kernelNeedsFluidNodeIndicesToRun) { + VF_LOG_INFO("CollisionAndExchange_streams()"); + return CollisionAndExchange_streams(); + + } else if (useStreams && !kernelNeedsFluidNodeIndicesToRun) { + VF_LOG_INFO("Cuda Streams can only be used with kernels which run using fluidNodesIndices."); + + } else if (useStreams && numberOfMpiProcesses <= 1) { + VF_LOG_INFO("Cuda Streams can only be used with multiple MPI processes."); + + } else if (!useStreams && kernelNeedsFluidNodeIndicesToRun) { + VF_LOG_INFO("CollisionAndExchange_noStreams_indexKernel()"); + return CollisionAndExchange_noStreams_indexKernel(); + + } else if (!useStreams && !kernelNeedsFluidNodeIndicesToRun) { + VF_LOG_INFO("CollisionAndExchange_noStreams_oldKernel()"); + return CollisionAndExchange_noStreams_oldKernel(); + } + + throw std::runtime_error("Invalid Configuration for collision and exchange"); + return nullptr; +} + +void CollisionAndExchange_noStreams_indexKernel::operator()(UpdateGrid27 *updateGrid, Parameter *para, int level, + unsigned int t) +{ + //! \details steps: + //! + //! 1. run collision + //! + updateGrid->collisionUsingIndices(level, t, para->getParD(level)->fluidNodeIndices, + para->getParD(level)->numberOfFluidNodes, -1); + + //! 2. exchange information between GPUs + updateGrid->exchangeMultiGPU_noStreams_withPrepare(level, false); +} + +void CollisionAndExchange_noStreams_oldKernel::operator()(UpdateGrid27 *updateGrid, Parameter *para, int level, + unsigned int t) +{ + //! \details steps: + //! + //! 1. run collision + //! + updateGrid->collisionAllNodes(level, t); + + //! 2. exchange information between GPUs + updateGrid->exchangeMultiGPU_noStreams_withPrepare(level, false); +} + +void CollisionAndExchange_streams::operator()(UpdateGrid27 *updateGrid, Parameter *para, int level, unsigned int t) +{ + int borderStreamIndex = para->getStreamManager()->getBorderStreamIndex(); + int bulkStreamIndex = para->getStreamManager()->getBulkStreamIndex(); + + //! \details steps: + //! + //! 1. run collision for nodes which are at the border of the gpus/processes + //! + updateGrid->collisionUsingIndices(level, t, para->getParD(level)->fluidNodeIndicesBorder, + para->getParD(level)->numberOfFluidNodesBorder, borderStreamIndex); + + //! 2. prepare the exchange between gpus (collect the send nodes for communication in a buffer on the gpu) and trigger bulk kernel execution when finished + //! + updateGrid->prepareExchangeMultiGPU(level, borderStreamIndex); + if (para->getUseStreams()) + para->getStreamManager()->triggerStartBulkKernel(borderStreamIndex); + + //! 3. launch the collision kernel for bulk nodes + //! + para->getStreamManager()->waitOnStartBulkKernelEvent(bulkStreamIndex); + updateGrid->collisionUsingIndices(level, t, para->getParD(level)->fluidNodeIndices, + para->getParD(level)->numberOfFluidNodes, bulkStreamIndex); + + //! 4. exchange information between GPUs + updateGrid->exchangeMultiGPU(level, borderStreamIndex); +} diff --git a/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp b/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp index 112a29fcf57799df6f7baf0e79d4973fea26549d..9ee4cb917cdbf76dddf988b4456d5d611c9a11e0 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp @@ -17,13 +17,13 @@ using namespace std; -void calcCp(Parameter* para, CudaMemoryManager* cudaManager, int lev) +void calcCp(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev) { ////////////////////////////////////////////////////////////////////////// //copy to host - cudaManager->cudaCopyCpTop(lev); - cudaManager->cudaCopyCpBottom(lev); - cudaManager->cudaCopyCpBottom2(lev); + cudaMemoryManager->cudaCopyCpTop(lev); + cudaMemoryManager->cudaCopyCpBottom(lev); + cudaMemoryManager->cudaCopyCpBottom2(lev); ////////////////////////////////////////////////////////////////////////// //Parameter double rhoSI = 1.204; // kg/m^3 @@ -69,7 +69,7 @@ void printCpTopIntermediateStep(Parameter* para, unsigned int t, int lev) { ////////////////////////////////////////////////////////////////////////// //set filename - std::string ffname = para->getFName() + StringUtil::toString<int>(para->getMyID()) + "_" + StringUtil::toString<int>(t) + "_cp_top.txt"; + std::string ffname = para->getFName() + StringUtil::toString<int>(para->getMyProcessID()) + "_" + StringUtil::toString<int>(t) + "_cp_top.txt"; const char* fname = ffname.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream @@ -97,11 +97,11 @@ void printCpTopIntermediateStep(Parameter* para, unsigned int t, int lev) -void printCpTop(Parameter* para, CudaMemoryManager* cudaManager, int lev) +void printCpTop(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev) { ////////////////////////////////////////////////////////////////////////// //set filename - std::string ffname = para->getFName()+StringUtil::toString<int>(para->getMyID())+"_cp_top.txt"; + std::string ffname = para->getFName()+StringUtil::toString<int>(para->getMyProcessID())+"_cp_top.txt"; const char* fname = ffname.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream @@ -124,20 +124,20 @@ void printCpTop(Parameter* para, CudaMemoryManager* cudaManager, int lev) ostr.close(); ////////////////////////////////////////////////////////////////////////// para->getParH((int)lev)->cpTop.clear(); - cudaManager->cudaFreeCpTop(lev); + cudaMemoryManager->cudaFreeCpTop(lev); ////////////////////////////////////////////////////////////////////////// } -void printCpBottom(Parameter* para, CudaMemoryManager* cudaManager) +void printCpBottom(Parameter* para, CudaMemoryManager* cudaMemoryManager) { ////////////////////////////////////////////////////////////////////////// //set level int lev = para->getMaxLevel(); ////////////////////////////////////////////////////////////////////////// //set filename - std::string ffname = para->getFName()+StringUtil::toString<int>(para->getMyID())+"_cp_bottom.txt"; + std::string ffname = para->getFName()+StringUtil::toString<int>(para->getMyProcessID())+"_cp_bottom.txt"; const char* fname = ffname.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream @@ -160,20 +160,20 @@ void printCpBottom(Parameter* para, CudaMemoryManager* cudaManager) ostr.close(); ////////////////////////////////////////////////////////////////////////// para->getParH((int)lev)->cpBottom.clear(); - cudaManager->cudaFreeCpBottom(lev); + cudaMemoryManager->cudaFreeCpBottom(lev); ////////////////////////////////////////////////////////////////////////// } -void printCpBottom2(Parameter* para, CudaMemoryManager* cudaManager) +void printCpBottom2(Parameter* para, CudaMemoryManager* cudaMemoryManager) { ////////////////////////////////////////////////////////////////////////// //set level int lev = para->getMaxLevel(); ////////////////////////////////////////////////////////////////////////// //set filename - std::string ffname = para->getFName()+StringUtil::toString<int>(para->getMyID())+"_cp_bottom2.txt"; + std::string ffname = para->getFName()+StringUtil::toString<int>(para->getMyProcessID())+"_cp_bottom2.txt"; const char* fname = ffname.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream @@ -196,7 +196,7 @@ void printCpBottom2(Parameter* para, CudaMemoryManager* cudaManager) ostr.close(); ////////////////////////////////////////////////////////////////////////// para->getParH((int)lev)->cpBottom2.clear(); - cudaManager->cudaFreeCpBottom2(lev); + cudaMemoryManager->cudaFreeCpBottom2(lev); ////////////////////////////////////////////////////////////////////////// } @@ -233,13 +233,13 @@ void excludeGridInterfaceNodesForMirror(Parameter* para, int lev) for (unsigned int ifit = 0; ifit < para->getParH((int)lev)->K_CF; ifit++) { if ((para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH((int)lev)->intCF.ICellCFF[ifit]) || - (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborX_SP[para->getParH((int)lev)->intCF.ICellCFF[ifit]]) || - (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborY_SP[para->getParH((int)lev)->intCF.ICellCFF[ifit]]) || - (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborZ_SP[para->getParH((int)lev)->intCF.ICellCFF[ifit]]) || - (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborY_SP[para->getParH(lev + 1)->neighborX_SP[para->getParH((int)lev)->intCF.ICellCFF[ifit]]]) || - (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborZ_SP[para->getParH(lev + 1)->neighborX_SP[para->getParH((int)lev)->intCF.ICellCFF[ifit]]]) || - (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborZ_SP[para->getParH(lev + 1)->neighborY_SP[para->getParH((int)lev)->intCF.ICellCFF[ifit]]]) || - (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborZ_SP[para->getParH(lev + 1)->neighborY_SP[para->getParH(lev + 1)->neighborX_SP[para->getParH((int)lev)->intCF.ICellCFF[ifit]]]])) + (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborX[para->getParH((int)lev)->intCF.ICellCFF[ifit]]) || + (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborY[para->getParH((int)lev)->intCF.ICellCFF[ifit]]) || + (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborZ[para->getParH((int)lev)->intCF.ICellCFF[ifit]]) || + (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborY[para->getParH(lev + 1)->neighborX[para->getParH((int)lev)->intCF.ICellCFF[ifit]]]) || + (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborZ[para->getParH(lev + 1)->neighborX[para->getParH((int)lev)->intCF.ICellCFF[ifit]]]) || + (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborZ[para->getParH(lev + 1)->neighborY[para->getParH((int)lev)->intCF.ICellCFF[ifit]]]) || + (para->getParH(lev + 1)->cpTopIndex[it] == (int)para->getParH(lev + 1)->neighborZ[para->getParH(lev + 1)->neighborY[para->getParH(lev + 1)->neighborX[para->getParH((int)lev)->intCF.ICellCFF[ifit]]]])) { para->getParH(lev + 1)->isOutsideInterface.push_back(false); tempBool = false; @@ -283,11 +283,11 @@ void excludeGridInterfaceNodesForMirror(Parameter* para, int lev) -void calcPressForMirror(Parameter* para, CudaMemoryManager* cudaManager, int lev) +void calcPressForMirror(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev) { ////////////////////////////////////////////////////////////////////////// //copy to host - cudaManager->cudaCopyCpTop(lev); + cudaMemoryManager->cudaCopyCpTop(lev); ////////////////////////////////////////////////////////////////////////// //Parameter double pressSI; @@ -313,19 +313,19 @@ void printCaseFile(Parameter* para) ////////////////////////////////////////////////////////////////////////// double deltaXcoarse = 0.256; // [m] double deltat = (para->getVelocity() * deltaXcoarse) / (para->getVelocity() * para->getVelocityRatio()); - unsigned int numberOfSteps = (unsigned int)((para->getTEnd() - para->getTStartOut()) * pow(2,5) ); + unsigned int numberOfSteps = (unsigned int)((para->getTimestepEnd() - para->getTimestepStartOut()) * pow(2,5) ); //cout << "number of nodes:" << numberOfSteps << endl; ////////////////////////////////////////////////////////////////////////// //set filename - std::string ffname = para->getFName() + "_" + StringUtil::toString<int>(para->getMyID()) + ".case"; + std::string ffname = para->getFName() + "_" + StringUtil::toString<int>(para->getMyProcessID()) + ".case"; const char* fname = ffname.c_str(); ////////////////////////////////////////////////////////////////////////// //set filename geo - std::string ffnameGeo = para->getOutputPrefix() + "_" + StringUtil::toString<int>(para->getMyID()) + ".geo"; + std::string ffnameGeo = para->getOutputPrefix() + "_" + StringUtil::toString<int>(para->getMyProcessID()) + ".geo"; const char* fnameGeo = ffnameGeo.c_str(); ////////////////////////////////////////////////////////////////////////// //set filename scalar - std::string ffnameScalar = para->getOutputPrefix() + "_" + StringUtil::toString<int>(para->getMyID()) + ".*****.p"; + std::string ffnameScalar = para->getOutputPrefix() + "_" + StringUtil::toString<int>(para->getMyProcessID()) + ".*****.p"; const char* fnameScalar = ffnameScalar.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream @@ -370,11 +370,11 @@ void printCaseFile(Parameter* para) -extern "C" void printGeoFile(Parameter* para, bool fileFormat) +void printGeoFile(Parameter* para, bool fileFormat) { ////////////////////////////////////////////////////////////////////////// //set filename geo - std::string ffnameGeo = para->getOutputPrefix() + "_" + StringUtil::toString<int>(para->getMyID()); + std::string ffnameGeo = para->getOutputPrefix() + "_" + StringUtil::toString<int>(para->getMyProcessID()); const char* fnameGeo = ffnameGeo.c_str(); ////////////////////////////////////////////////////////////////////////// char fname[1024]; @@ -419,7 +419,7 @@ extern "C" void printGeoFile(Parameter* para, bool fileFormat) { if (para->getParH((int)lev)->isOutsideInterface[i]) { - ostr << (para->getParH((int)lev)->coordX_SP[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(0) + para->getTranslateLBMtoSI().at(0)) << std::endl; + ostr << (para->getParH((int)lev)->coordinateX[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(0) + para->getTranslateLBMtoSI().at(0)) << std::endl; } } } @@ -431,7 +431,7 @@ extern "C" void printGeoFile(Parameter* para, bool fileFormat) { if (para->getParH((int)lev)->isOutsideInterface[i]) { - ostr << (para->getParH((int)lev)->coordY_SP[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(1) + para->getTranslateLBMtoSI().at(1)) << std::endl; + ostr << (para->getParH((int)lev)->coordinateY[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(1) + para->getTranslateLBMtoSI().at(1)) << std::endl; } } } @@ -443,7 +443,7 @@ extern "C" void printGeoFile(Parameter* para, bool fileFormat) { if (para->getParH((int)lev)->isOutsideInterface[i]) { - ostr << (para->getParH((int)lev)->coordZ_SP[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(2) + para->getTranslateLBMtoSI().at(2)) << std::endl; + ostr << (para->getParH((int)lev)->coordinateZ[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(2) + para->getTranslateLBMtoSI().at(2)) << std::endl; } } } @@ -489,7 +489,7 @@ extern "C" void printGeoFile(Parameter* para, bool fileFormat) { if (para->getParH((int)lev)->isOutsideInterface[i]) { - tempCoord = (para->getParH((int)lev)->coordX_SP[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(0) + para->getTranslateLBMtoSI().at(0)); + tempCoord = (para->getParH((int)lev)->coordinateX[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(0) + para->getTranslateLBMtoSI().at(0)); writeFloatToFile(tempCoord, ostr); tempX++; } @@ -504,7 +504,7 @@ extern "C" void printGeoFile(Parameter* para, bool fileFormat) { if (para->getParH((int)lev)->isOutsideInterface[i]) { - tempCoord = (para->getParH((int)lev)->coordY_SP[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(1) + para->getTranslateLBMtoSI().at(1)); + tempCoord = (para->getParH((int)lev)->coordinateY[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(1) + para->getTranslateLBMtoSI().at(1)); writeFloatToFile(tempCoord, ostr); } } @@ -517,7 +517,7 @@ extern "C" void printGeoFile(Parameter* para, bool fileFormat) { if (para->getParH((int)lev)->isOutsideInterface[i]) { - tempCoord = (para->getParH((int)lev)->coordZ_SP[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(2) + para->getTranslateLBMtoSI().at(2)); + tempCoord = (para->getParH((int)lev)->coordinateZ[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(2) + para->getTranslateLBMtoSI().at(2)); writeFloatToFile(tempCoord, ostr); } } @@ -545,11 +545,11 @@ extern "C" void printGeoFile(Parameter* para, bool fileFormat) -extern "C" void printScalars(Parameter* para, bool fileFormat) +void printScalars(Parameter* para, bool fileFormat) { ////////////////////////////////////////////////////////////////////////// //set filename scalar - std::string ffnameScalar = para->getOutputPrefix() + "_" + StringUtil::toString<int>(para->getMyID()); + std::string ffnameScalar = para->getOutputPrefix() + "_" + StringUtil::toString<int>(para->getMyProcessID()); const char* fnameScalar = ffnameScalar.c_str(); ////////////////////////////////////////////////////////////////////////// char fname[1024]; diff --git a/src/gpu/VirtualFluids_GPU/Calculation/Cp.h b/src/gpu/VirtualFluids_GPU/Calculation/Cp.h index d11be83ce347c99f8e8a7e687a8016777c5eb3e8..bc70e1ae093269f038e699c0c5ce66cee63c0b12 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/Cp.h +++ b/src/gpu/VirtualFluids_GPU/Calculation/Cp.h @@ -6,23 +6,23 @@ #include "Parameter/Parameter.h" #include "GPU/CudaMemoryManager.h" -extern "C" void calcCp(Parameter* para, CudaMemoryManager* cudaManager, int lev); -extern "C" void printCpTopIntermediateStep(Parameter* para, unsigned int t, int lev); -extern "C" void printCpTop(Parameter* para, CudaMemoryManager* cudaManager, int lev); -extern "C" void printCpBottom(Parameter* para, CudaMemoryManager* cudaManager); -extern "C" void printCpBottom2(Parameter* para, CudaMemoryManager* cudaManager); +void calcCp(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev); +void printCpTopIntermediateStep(Parameter* para, unsigned int t, int lev); +void printCpTop(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev); +void printCpBottom(Parameter* para, CudaMemoryManager* cudaMemoryManager); +void printCpBottom2(Parameter* para, CudaMemoryManager* cudaMemoryManager); -extern "C" void excludeGridInterfaceNodesForMirror(Parameter* para, int lev); -extern "C" void calcPressForMirror(Parameter* para, CudaMemoryManager* cudaManager, int lev); +void excludeGridInterfaceNodesForMirror(Parameter* para, int lev); +void calcPressForMirror(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev); //Ensight Gold -extern "C" void printCaseFile(Parameter* para); -extern "C" void printGeoFile(Parameter* para, bool fileFormat); -extern "C" void printScalars(Parameter* para, bool fileFormat); +void printCaseFile(Parameter* para); +void printGeoFile(Parameter* para, bool fileFormat); +void printScalars(Parameter* para, bool fileFormat); //functions to write binary files -extern "C" void writeIntToFile(const int &i, std::ofstream &ofile); -extern "C" void writeFloatToFile(const float &f, std::ofstream &ofile); -extern "C" void writeStringToFile(const std::string &s, std::ofstream &ofile); +void writeIntToFile(const int &i, std::ofstream &ofile); +void writeFloatToFile(const float &f, std::ofstream &ofile); +void writeStringToFile(const std::string &s, std::ofstream &ofile); #endif diff --git a/src/gpu/VirtualFluids_GPU/Calculation/DragLift.cpp b/src/gpu/VirtualFluids_GPU/Calculation/DragLift.cpp index 1ebbfb6861458550a0442e927d138fb450baa2ba..97d2af28ef7f801e817dd6cae6ad58d244249e02 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/DragLift.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/DragLift.cpp @@ -16,13 +16,13 @@ using namespace std; -void calcDragLift(Parameter* para, CudaMemoryManager* cudaManager, int lev) +void calcDragLift(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev) { ////////////////////////////////////////////////////////////////////////// //copy to host //finest Grid ... with the geometry nodes //please test -> Copy == Alloc ?? - cudaManager->cudaCopyDragLift(lev, para->getParH(lev)->QGeom.kQ); + cudaMemoryManager->cudaCopyDragLift(lev, para->getParH(lev)->geometryBC.numberOfBCnodes); ////////////////////////////////////////////////////////////////////////// //calc drag double dragX = 0., dragY = 0., dragZ = 0.; @@ -55,7 +55,7 @@ void calcDragLift(Parameter* para, CudaMemoryManager* cudaManager, int lev) //double LBtoSI = 1.204 * (pow(delta_x, 4))/(pow(delta_t,2));//rho_SI * delta_x^4 / delta_t^2 = 1.204 kg/m^3 * (0.0045m)^4 / (0.00000757s)^2 ... LB to kg*m/s^2 //double LBtoSI = 1000 * (pow(delta_x, 4))/(pow(delta_t,2));//rho_SI * delta_x^4 / delta_t^2 = 1000 kg/m^3 * (0.1m)^4 / (0.00187s)^2 ... LB to kg*m/s^2 - for (int it = 0; it < para->getParH(lev)->QGeom.kQ; it++) + for (unsigned int it = 0; it < para->getParH(lev)->geometryBC.numberOfBCnodes; it++) { dragX += (double) (para->getParH(lev)->DragPreX[it] - para->getParH(lev)->DragPostX[it]); //Kraft da Impuls pro Zeitschritt merke: andere nennen es FD dragY += (double) (para->getParH(lev)->DragPreY[it] - para->getParH(lev)->DragPostY[it]); //Kraft da Impuls pro Zeitschritt merke: andere nennen es FD @@ -81,7 +81,7 @@ void calcDragLift(Parameter* para, CudaMemoryManager* cudaManager, int lev) -void allocDragLift(Parameter* para, CudaMemoryManager* cudaManager) +void allocDragLift(Parameter* para, CudaMemoryManager* cudaMemoryManager) { ////////////////////////////////////////////////////////////////////////// //set level @@ -90,21 +90,21 @@ void allocDragLift(Parameter* para, CudaMemoryManager* cudaManager) //allocation //finest Grid ... with the geometry nodes //please test -> Copy == Alloc ?? - cudaManager->cudaAllocDragLift(lev, para->getParH(lev)->QGeom.kQ); + cudaMemoryManager->cudaAllocDragLift(lev, para->getParH(lev)->geometryBC.numberOfBCnodes); ////////////////////////////////////////////////////////////////////////// - printf("\n Anzahl Elemente fuer Drag Lift = %d \n", para->getParH(lev)->QGeom.kQ); + printf("\n Anzahl Elemente fuer Drag Lift = %d \n", para->getParH(lev)->geometryBC.numberOfBCnodes); } -void printDragLift(Parameter* para, CudaMemoryManager* cudaManager, int timestep) +void printDragLift(Parameter* para, CudaMemoryManager* cudaMemoryManager, int timestep) { ////////////////////////////////////////////////////////////////////////// //set level int lev = para->getMaxLevel(); ////////////////////////////////////////////////////////////////////////// //set filename - std::string ffname = para->getFName()+StringUtil::toString<int>(para->getMyID())+"_"+StringUtil::toString<int>(timestep)+"_DragLift.txt"; + std::string ffname = para->getFName()+StringUtil::toString<int>(para->getMyProcessID())+"_"+StringUtil::toString<int>(timestep)+"_DragLift.txt"; const char* fname = ffname.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream @@ -122,9 +122,9 @@ void printDragLift(Parameter* para, CudaMemoryManager* cudaManager, int timestep //close file ostr.close(); ////////////////////////////////////////////////////////////////////////// - if (timestep == (int)para->getTEnd()) + if (timestep == (int)para->getTimestepEnd()) { - cudaManager->cudaFreeDragLift(lev); + cudaMemoryManager->cudaFreeDragLift(lev); } ////////////////////////////////////////////////////////////////////////// } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Calculation/DragLift.h b/src/gpu/VirtualFluids_GPU/Calculation/DragLift.h index 7c9dd586fa98434deddf91ad33d53e7a053005fd..8be15d423b65e0fdffc3a5af44e7dc5dbdbf4e6a 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/DragLift.h +++ b/src/gpu/VirtualFluids_GPU/Calculation/DragLift.h @@ -6,8 +6,8 @@ #include "Parameter/Parameter.h" #include "GPU/CudaMemoryManager.h" -extern "C" void calcDragLift(Parameter* para, CudaMemoryManager* cudaManager, int lev); -extern "C" void allocDragLift(Parameter* para, CudaMemoryManager* cudaManager); -extern "C" void printDragLift(Parameter* para, CudaMemoryManager* cudaManager, int timestep); +void calcDragLift(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev); +void allocDragLift(Parameter* para, CudaMemoryManager* cudaMemoryManager); +void printDragLift(Parameter* para, CudaMemoryManager* cudaMemoryManager, int timestep); #endif diff --git a/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp b/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp index 42d6a3cf4845ed52648e6f65e91250bae0344cc8..d62e8fee24dad1cde7ccd2044a5a5f9573f7ff82 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp @@ -41,7 +41,7 @@ ForceCalculations::~ForceCalculations() -void ForceCalculations::calcPIDControllerForForce(Parameter* para, CudaMemoryManager* cudaManager) +void ForceCalculations::calcPIDControllerForForce(Parameter* para, CudaMemoryManager* cudaMemoryManager) { ////////////////////////////////////////////////////////////////////////// double tempVeloX = 0.0, tempVeloY = 0.0, tempVeloZ = 0.0; @@ -53,32 +53,32 @@ void ForceCalculations::calcPIDControllerForForce(Parameter* para, CudaMemoryMan { ////////////////////////////////////////////////////////////////////// //measure the velocity - int numberOfElements = para->getParH(lev)->size_Mat_SP; + int numberOfElements = para->getParH(lev)->numberOfNodes; if (numberOfElements > 0) { - CalcMacCompSP27(para->getParD(lev)->vx_SP, - para->getParD(lev)->vy_SP, - para->getParD(lev)->vz_SP, - para->getParD(lev)->rho_SP, - para->getParD(lev)->press_SP, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, + CalcMacCompSP27(para->getParD(lev)->velocityX, + para->getParD(lev)->velocityY, + para->getParD(lev)->velocityZ, + para->getParD(lev)->rho, + para->getParD(lev)->pressure, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, para->getParD(lev)->numberofthreads, - para->getParD(lev)->d0SP.f[0], - para->getParD(lev)->evenOrOdd); + para->getParD(lev)->distributions.f[0], + para->getParD(lev)->isEvenTimestep); getLastCudaError("CalcMacSP27 execution failed"); ////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyPrint(lev); + cudaMemoryManager->cudaCopyPrint(lev); // para->cudaCopyForceVelo(i,numberOfElements); ////////////////////////////////////////////////////////////////// for (int j = 0; j < numberOfElements; j++) { - tempVeloX += (double)para->getParH(lev)->vx_SP[j]; - tempVeloY += (double)para->getParH(lev)->vy_SP[j]; - tempVeloZ += (double)para->getParH(lev)->vz_SP[j]; + tempVeloX += (double)para->getParH(lev)->velocityX[j]; + tempVeloY += (double)para->getParH(lev)->velocityY[j]; + tempVeloZ += (double)para->getParH(lev)->velocityZ[j]; } tempVeloX /= (double)numberOfElements; tempVeloY /= (double)numberOfElements; @@ -116,7 +116,7 @@ void ForceCalculations::calcPIDControllerForForce(Parameter* para, CudaMemoryMan para->getForcesHost()[1] = (real)(para->getForcesHost()[1] + y) * (real)0.0; para->getForcesHost()[2] = (real)(para->getForcesHost()[2] + y) * (real)0.0; ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyForcingToDevice(); + cudaMemoryManager->cudaCopyForcingToDevice(); ////////////////////////////////////////////////////////////////////////// } @@ -125,7 +125,7 @@ void ForceCalculations::printForcing(Parameter* para) { ////////////////////////////////////////////////////////////////////////// //set filename - std::string ffname = para->getFName() + StringUtil::toString<int>(para->getMyID()) + "_forcing.txt"; + std::string ffname = para->getFName() + StringUtil::toString<int>(para->getMyProcessID()) + "_forcing.txt"; const char* fname = ffname.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream diff --git a/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.h b/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.h index 3f69a61194db18f57398dab39667e33c844850a3..4506d23abd7068697a089c926d684406af789aef 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.h +++ b/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.h @@ -14,7 +14,7 @@ class ForceCalculations public: ForceCalculations(Parameter* para); ~ForceCalculations(); - void calcPIDControllerForForce(Parameter* para, CudaMemoryManager* cudaManager); + void calcPIDControllerForForce(Parameter* para, CudaMemoryManager* cudaMemoryManager); void printForcing(Parameter* para); private: @@ -35,8 +35,8 @@ private: }; -//extern "C" void calcVeloForce(Parameter* para); -//extern "C" void allocVeloForForcing(Parameter* para); -//extern "C" void printForcing(Parameter* para); +//void calcVeloForce(Parameter* para); +//void allocVeloForForcing(Parameter* para); +//void printForcing(Parameter* para); #endif /* FORCE_CALCULATIONS_H */ diff --git a/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.cpp b/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.cpp index bca6574bf74671eb998b037e90d23214874683e8..13b6bd662a1b51a9a7a850211751c8b8b5ecf329 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.cpp @@ -23,13 +23,13 @@ void setSizeOfPlane(Parameter* para, int lev, unsigned int z) for (unsigned int i=1; i<para->getParH(lev)->gridNX + 2 * STARTOFFX - 1; i++) { mm[0]= para->getParH(lev)->nx*(para->getParH(lev)->ny*k + j) + i; - mm[1]= mm[0] -1; //W - mm[2]= mm[0] -para->getParH(lev)->nx-1; //SW - mm[3]= mm[0] -para->getParH(lev)->nx; //S - mm[4]= mm[0]-(para->getParH(lev)->nx*para->getParH(lev)->ny); //B - mm[5]= mm[0]-(para->getParH(lev)->nx*para->getParH(lev)->ny) -1; //BW - mm[6]= mm[0]-(para->getParH(lev)->nx*para->getParH(lev)->ny)-para->getParH(lev)->nx; //BS - mm[7]= mm[0]-(para->getParH(lev)->nx*para->getParH(lev)->ny)-para->getParH(lev)->nx-1; //BSW + mm[1]= mm[0] -1; //DIR_M00 + mm[2]= mm[0] -para->getParH(lev)->nx-1; //DIR_MM0 + mm[3]= mm[0] -para->getParH(lev)->nx; //DIR_0M0 + mm[4]= mm[0]-(para->getParH(lev)->nx*para->getParH(lev)->ny); //DIR_00M + mm[5]= mm[0]-(para->getParH(lev)->nx*para->getParH(lev)->ny) -1; //DIR_M0M + mm[6]= mm[0]-(para->getParH(lev)->nx*para->getParH(lev)->ny)-para->getParH(lev)->nx; //DIR_0MM + mm[7]= mm[0]-(para->getParH(lev)->nx*para->getParH(lev)->ny)-para->getParH(lev)->nx-1; //DIR_MMM if ( para->getParH(lev)->geo[mm[0]] != GEO_VOID || para->getParH(lev)->geo[mm[1]] != GEO_VOID || @@ -61,7 +61,7 @@ void calcPressure(Parameter* para, std::string inorout, int lev) for (unsigned int i = 0; i < para->getParH(lev)->sizePlanePress; i++) { - sumrho += para->getParH(lev)->rho_SP[m]; + sumrho += para->getParH(lev)->rho[m]; anz++; m++; } @@ -101,7 +101,7 @@ void calcFlowRate(Parameter* para, int lev) { if (para->getParH(lev)->geo[m] == GEO_FLUID) { - sumvelo += para->getParH(lev)->vz_SP[para->getParH(lev)->k[m]]; + sumvelo += para->getParH(lev)->velocityZ[para->getParH(lev)->k[m]]; anz++; } m++; @@ -159,7 +159,7 @@ void calcFlowRate(Parameter* para, int lev) //advection + diffusion ////////////////////////////////////////////////////////////////////////// -void calcPlaneConc(Parameter* para, CudaMemoryManager* cudaManager, int lev) +void calcPlaneConc(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev) { ////////////////////////////////////////////////////////////////////////// //copy to host @@ -169,7 +169,7 @@ void calcPlaneConc(Parameter* para, CudaMemoryManager* cudaManager, int lev) //Version Press neighbor unsigned int NoNin = para->getParH(lev)->numberOfPointsCpTop; unsigned int NoNout1 = para->getParH(lev)->numberOfPointsCpBottom; - unsigned int NoNout2 = para->getParH(lev)->QPress.kQ; + unsigned int NoNout2 = para->getParH(lev)->pressureBC.numberOfBCnodes; //////////////////////////////////////////// ////Version cp top //unsigned int NoN = para->getParH(lev)->numberOfPointsCpTop; @@ -177,9 +177,9 @@ void calcPlaneConc(Parameter* para, CudaMemoryManager* cudaManager, int lev) ////Version cp bottom //unsigned int NoN = para->getParH(lev)->numberOfPointsCpBottom; - cudaManager->cudaCopyPlaneConcIn(lev, NoNin); - cudaManager->cudaCopyPlaneConcOut1(lev, NoNout1); - cudaManager->cudaCopyPlaneConcOut2(lev, NoNout2); + cudaMemoryManager->cudaCopyPlaneConcIn(lev, NoNin); + cudaMemoryManager->cudaCopyPlaneConcOut1(lev, NoNout1); + cudaMemoryManager->cudaCopyPlaneConcOut2(lev, NoNout2); //////////////////////////////////////////// //calculate concentration double concPlaneIn = 0.; @@ -189,7 +189,7 @@ void calcPlaneConc(Parameter* para, CudaMemoryManager* cudaManager, int lev) double counter1 = 0.; for (unsigned int it = 0; it < NoNin; it++) { - if (para->getParH(lev)->geoSP[it] == GEO_FLUID) + if (para->getParH(lev)->typeOfGridNode[it] == GEO_FLUID) { concPlaneIn += (double) (para->getParH(lev)->ConcPlaneIn[it]); counter1 += 1.; @@ -200,7 +200,7 @@ void calcPlaneConc(Parameter* para, CudaMemoryManager* cudaManager, int lev) counter1 = 0.; for (unsigned int it = 0; it < NoNout1; it++) { - if (para->getParH(lev)->geoSP[it] == GEO_FLUID) + if (para->getParH(lev)->typeOfGridNode[it] == GEO_FLUID) { concPlaneOut1 += (double) (para->getParH(lev)->ConcPlaneOut1[it]); counter1 += 1.; @@ -211,7 +211,7 @@ void calcPlaneConc(Parameter* para, CudaMemoryManager* cudaManager, int lev) counter1 = 0.; for (unsigned int it = 0; it < NoNout2; it++) { - if (para->getParH(lev)->geoSP[it] == GEO_FLUID) + if (para->getParH(lev)->typeOfGridNode[it] == GEO_FLUID) { concPlaneOut2 += (double) (para->getParH(lev)->ConcPlaneOut2[it]); counter1 += 1.; @@ -232,7 +232,7 @@ void calcPlaneConc(Parameter* para, CudaMemoryManager* cudaManager, int lev) -void allocPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) +void allocPlaneConc(Parameter* para, CudaMemoryManager* cudaMemoryManager) { ////////////////////////////////////////////////////////////////////////// //set level ---> maybe we need a loop @@ -243,10 +243,10 @@ void allocPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) //please test -> Copy == Alloc ?? //////////////////////////////////////////// //Version Press neighbor - cudaManager->cudaAllocPlaneConcIn(lev, para->getParH(lev)->numberOfPointsCpTop); - cudaManager->cudaAllocPlaneConcOut1(lev, para->getParH(lev)->numberOfPointsCpBottom); - cudaManager->cudaAllocPlaneConcOut2(lev, para->getParH(lev)->QPress.kQ); - printf("\n Number of elements plane concentration = %d + %d + %d \n", para->getParH(lev)->numberOfPointsCpTop, para->getParH(lev)->numberOfPointsCpBottom, para->getParH(lev)->QPress.kQ); + cudaMemoryManager->cudaAllocPlaneConcIn(lev, para->getParH(lev)->numberOfPointsCpTop); + cudaMemoryManager->cudaAllocPlaneConcOut1(lev, para->getParH(lev)->numberOfPointsCpBottom); + cudaMemoryManager->cudaAllocPlaneConcOut2(lev, para->getParH(lev)->pressureBC.numberOfBCnodes); + printf("\n Number of elements plane concentration = %d + %d + %d \n", para->getParH(lev)->numberOfPointsCpTop, para->getParH(lev)->numberOfPointsCpBottom, para->getParH(lev)->pressureBC.numberOfBCnodes); //////////////////////////////////////////// ////Version cp top //para->cudaAllocPlaneConc(lev, para->getParH(lev)->numberOfPointsCpTop); @@ -260,14 +260,14 @@ void allocPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) -void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) +void printPlaneConc(Parameter* para, CudaMemoryManager* cudaMemoryManager) { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //set level ---> maybe we need a loop int lev = para->getCoarse(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //set filename - std::string ffnameIn = para->getFName() + UbSystem::toString(para->getMyID()) + "_" + "In" + "_PlaneConc.txt"; + std::string ffnameIn = para->getFName() + UbSystem::toString(para->getMyProcessID()) + "_" + "In" + "_PlaneConc.txt"; const char* fnameIn = ffnameIn.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream @@ -287,7 +287,7 @@ void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //set filename - std::string ffnameOut1 = para->getFName() + UbSystem::toString(para->getMyID()) + "_" + "Out1" + "_PlaneConc.txt"; + std::string ffnameOut1 = para->getFName() + UbSystem::toString(para->getMyProcessID()) + "_" + "Out1" + "_PlaneConc.txt"; const char* fnameOut1 = ffnameOut1.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream @@ -307,7 +307,7 @@ void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //set filename - std::string ffnameOut2 = para->getFName() + UbSystem::toString(para->getMyID()) + "_" + "Out2" + "_PlaneConc.txt"; + std::string ffnameOut2 = para->getFName() + UbSystem::toString(para->getMyProcessID()) + "_" + "Out2" + "_PlaneConc.txt"; const char* fnameOut2 = ffnameOut2.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream @@ -325,7 +325,7 @@ void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) //close file ostrOut2.close(); ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaFreePlaneConc(lev); + cudaMemoryManager->cudaFreePlaneConc(lev); ////////////////////////////////////////////////////////////////////////// } @@ -335,14 +335,14 @@ void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) ////////////////////////////////////////////////////////////////////////// //Print Test round of Error -void printRE(Parameter* para, CudaMemoryManager* cudaManager, int timestep) +void printRE(Parameter* para, CudaMemoryManager* cudaMemoryManager, int timestep) { ////////////////////////////////////////////////////////////////////////// //set level int lev = 0; ////////////////////////////////////////////////////////////////////////// //set filename - std::string ffname = para->getFName()+StringUtil::toString<int>(para->getMyID())+"_"+StringUtil::toString<int>(timestep)+"_RE.txt"; + std::string ffname = para->getFName()+StringUtil::toString<int>(para->getMyProcessID())+"_"+StringUtil::toString<int>(timestep)+"_RE.txt"; const char* fname = ffname.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream @@ -353,17 +353,17 @@ void printRE(Parameter* para, CudaMemoryManager* cudaManager, int timestep) ////////////////////////////////////////////////////////////////////////// //fill file with data bool doNothing = false; - for (int i = 0; i < para->getParH(lev)->QPress.kQ; i++) + for (unsigned int i = 0; i < para->getParH(lev)->pressureBC.numberOfBCnodes; i++) { doNothing = false; for (std::size_t j = 0; j < 27; j++) { - if (para->getParH(lev)->kDistTestRE.f[0][j*para->getParH(lev)->QPress.kQ + i]==0) + if (para->getParH(lev)->kDistTestRE.f[0][j*para->getParH(lev)->pressureBC.numberOfBCnodes + i]==0) { doNothing = true; continue; } - ostr << para->getParH(lev)->kDistTestRE.f[0][j*para->getParH(lev)->QPress.kQ + i] << "\t"; + ostr << para->getParH(lev)->kDistTestRE.f[0][j*para->getParH(lev)->pressureBC.numberOfBCnodes + i] << "\t"; } if (doNothing==true) { @@ -375,9 +375,9 @@ void printRE(Parameter* para, CudaMemoryManager* cudaManager, int timestep) //close file ostr.close(); ////////////////////////////////////////////////////////////////////////// - if (timestep == (int)para->getTEnd()) + if (timestep == (int)para->getTimestepEnd()) { - cudaManager->cudaFreeTestRE(lev); + cudaMemoryManager->cudaFreeTestRE(lev); } ////////////////////////////////////////////////////////////////////////// } diff --git a/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.h b/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.h index a04e6b5c3bf403cd38282382f6db253831f30678..50f49b85df2a87e3921ac7133630c128da0caebd 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.h +++ b/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.h @@ -8,15 +8,15 @@ #include <iostream> #include <stdio.h> -extern "C" void setSizeOfPlane(Parameter* para, int lev, unsigned int z); -extern "C" void calcPressure(Parameter* para, std::string inorout, int lev); -extern "C" void calcFlowRate(Parameter* para, int lev); +void setSizeOfPlane(Parameter* para, int lev, unsigned int z); +void calcPressure(Parameter* para, std::string inorout, int lev); +void calcFlowRate(Parameter* para, int lev); //advection + diffusion -extern "C" void calcPlaneConc(Parameter* para, CudaMemoryManager* cudaManager, int lev); -extern "C" void allocPlaneConc(Parameter* para, CudaMemoryManager* cudaManager); -extern "C" void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager); +void calcPlaneConc(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev); +void allocPlaneConc(Parameter* para, CudaMemoryManager* cudaMemoryManager); +void printPlaneConc(Parameter* para, CudaMemoryManager* cudaMemoryManager); -extern "C" void printRE(Parameter* para, CudaMemoryManager* cudaManager, int timestep); +void printRE(Parameter* para, CudaMemoryManager* cudaMemoryManager, int timestep); #endif diff --git a/src/gpu/VirtualFluids_GPU/Calculation/PorousMedia.cpp b/src/gpu/VirtualFluids_GPU/Calculation/PorousMedia.cpp index 7ed86bf8f4fff30cac707c567cde9f8526f4ae6a..d70e8a8da75b2b7c30e700be3f3fec035ad1e4a6 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/PorousMedia.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/PorousMedia.cpp @@ -91,15 +91,15 @@ void PorousMedia::setResistanceLBM() //void PorousMedia::definePMarea(Parameter* para, unsigned int level) //{ // unsigned int counter = 0; -// for (unsigned int i = 0; i < para->getParH(level)->size_Mat_SP; i++) +// for (unsigned int i = 0; i < para->getParH(level)->numberOfNodes; i++) // { -// if (((para->getParH(level)->coordX_SP[i] >= this->startCoordX) && (para->getParH(level)->coordX_SP[i] <= this->endCoordX)) && -// ((para->getParH(level)->coordY_SP[i] >= this->startCoordY) && (para->getParH(level)->coordY_SP[i] <= this->endCoordY)) && -// ((para->getParH(level)->coordZ_SP[i] >= this->startCoordZ) && (para->getParH(level)->coordZ_SP[i] <= this->endCoordZ)) ) +// if (((para->getParH(level)->coordinateX[i] >= this->startCoordX) && (para->getParH(level)->coordinateX[i] <= this->endCoordX)) && +// ((para->getParH(level)->coordinateY[i] >= this->startCoordY) && (para->getParH(level)->coordinateY[i] <= this->endCoordY)) && +// ((para->getParH(level)->coordinateZ[i] >= this->startCoordZ) && (para->getParH(level)->coordinateZ[i] <= this->endCoordZ)) ) // { -// if (para->getParH(level)->geoSP[i] >= GEO_FLUID) +// if (para->getParH(level)->typeOfGridNode[i] >= GEO_FLUID) // { -// para->getParH(level)->geoSP[i] = this->geoID; +// para->getParH(level)->typeOfGridNode[i] = this->geoID; // nodeIDsPorousMedia.push_back(i); // counter++; // } diff --git a/src/gpu/VirtualFluids_GPU/Calculation/RefinementStrategy.cpp b/src/gpu/VirtualFluids_GPU/Calculation/RefinementStrategy.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cd74216e1fbe7b718c72046ace4b7d2e7cf451fe --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Calculation/RefinementStrategy.cpp @@ -0,0 +1,147 @@ +#include "RefinementStrategy.h" +#include "Parameter/CudaStreamManager.h" +#include "Parameter/Parameter.h" +#include "logger/Logger.h" + +std::function<void(UpdateGrid27 *updateGrid, Parameter *para, int level)> + getFunctionForRefinementAndExchange(const bool useStreams, const int numberOfMpiProcesses, const int maxLevel, + const bool useReducedCommunicationAfterFtoC) noexcept +{ + VF_LOG_INFO("Function used for refinementAndExchange: "); + if (maxLevel == 0) { + VF_LOG_INFO("only one level - no function needed."); + return NoRefinement(); + + } else if (numberOfMpiProcesses == 1) { + VF_LOG_INFO("only one process - no exchange needed: Refinement_noExchange()"); + return Refinement_noExchange(); + + } else if (numberOfMpiProcesses > 1 && useStreams && useReducedCommunicationAfterFtoC) { + VF_LOG_INFO("RefinementAndExchange_streams_exchangeInterface()"); + return RefinementAndExchange_streams_exchangeInterface(); + + } else if(numberOfMpiProcesses > 1 && useStreams && !useReducedCommunicationAfterFtoC){ + VF_LOG_INFO("refinementAndExchange_streams_completeExchange()"); + return RefinementAndExchange_streams_exchangeAllNodes(); + + } else if (numberOfMpiProcesses > 1 && !useStreams && useReducedCommunicationAfterFtoC) { + VF_LOG_INFO("RefinementAndExchange_noStreams_exchangeInterface()"); + return RefinementAndExchange_noStreams_exchangeInterface(); + + } else { + VF_LOG_INFO("RefinementAndExchange_noStreams_exchangeAllNodes()"); + return RefinementAndExchange_noStreams_exchangeAllNodes(); + } +} + +void NoRefinement::operator()(UpdateGrid27 *updateGrid, Parameter *para, int level){} + +void RefinementAndExchange_streams_exchangeInterface::operator()(UpdateGrid27 *updateGrid, Parameter *para, int level) +{ + int borderStreamIndex = para->getStreamManager()->getBorderStreamIndex(); + int bulkStreamIndex = para->getStreamManager()->getBulkStreamIndex(); + + //! \details steps: + //! + //! 1. Interpolation fine to coarse for nodes which are at the border of the gpus/processes + //! + updateGrid->fineToCoarse(level, ¶->getParD(level)->intFCBorder, para->getParD(level)->offFC, borderStreamIndex); + + //! 2. prepare the exchange between gpus (collect the send nodes for communication in a buffer on the gpu) and trigger bulk kernel execution when finished + //! + updateGrid->prepareExchangeMultiGPUAfterFtoC(level, borderStreamIndex); + if (para->getUseStreams()) + para->getStreamManager()->triggerStartBulkKernel(borderStreamIndex); + + //! 3. launch the bulk kernels for both interpolation processes (fine to coarse and coarse to fine) + //! + para->getStreamManager()->waitOnStartBulkKernelEvent(bulkStreamIndex); + updateGrid->fineToCoarse(level, ¶->getParD(level)->intFCBulk, para->getParD(level)->offFCBulk, bulkStreamIndex); + updateGrid->coarseToFine(level, ¶->getParD(level)->intCFBulk, para->getParD(level)->offCFBulk, bulkStreamIndex); + + //! 4. exchange information between GPUs (only nodes which are part of the interpolation) + //! + updateGrid->exchangeMultiGPUAfterFtoC(level, borderStreamIndex); + + // 5. interpolation fine to coarse for nodes which are at the border of the gpus/processes + //! + updateGrid->coarseToFine(level, ¶->getParD(level)->intCFBorder, para->getParD(level)->offCF, borderStreamIndex); + + cudaDeviceSynchronize(); +} + +void RefinementAndExchange_streams_exchangeAllNodes::operator()(UpdateGrid27 *updateGrid, Parameter *para, int level){ + int borderStreamIndex = para->getStreamManager()->getBorderStreamIndex(); + int bulkStreamIndex = para->getStreamManager()->getBulkStreamIndex(); + + //! \details steps: + //! + //! 1. interpolation fine to coarse for nodes which are at the border of the gpus/processes + //! + updateGrid->fineToCoarse(level, ¶->getParD(level)->intFCBorder, para->getParD(level)->offFC, borderStreamIndex); + + //! 2. prepare the exchange between gpus (collect the send nodes for communication in a buffer on the gpu) and trigger bulk kernel execution when finished + //! + updateGrid->prepareExchangeMultiGPU(level, borderStreamIndex); + if (para->getUseStreams()) + para->getStreamManager()->triggerStartBulkKernel(borderStreamIndex); + + //! 3. launch the bulk kernels for both interpolation processes (fine to coarse and coarse to fine) + //! + para->getStreamManager()->waitOnStartBulkKernelEvent(bulkStreamIndex); + updateGrid->fineToCoarse(level, ¶->getParD(level)->intFCBulk, para->getParD(level)->offFCBulk, bulkStreamIndex); + updateGrid->coarseToFine(level, ¶->getParD(level)->intCFBulk, para->getParD(level)->offCFBulk, bulkStreamIndex); + + //! 4. exchange information between GPUs (all nodes) + //! + updateGrid->exchangeMultiGPU(level, borderStreamIndex); + + // 5. interpolation fine to coarse for nodes which are at the border of the gpus/processes + //! + updateGrid->coarseToFine(level, ¶->getParD(level)->intCFBorder, para->getParD(level)->offCF, borderStreamIndex); + + cudaDeviceSynchronize(); +} + +void RefinementAndExchange_noStreams_exchangeInterface::operator()(UpdateGrid27 *updateGrid, Parameter *para, int level) +{ + //! \details steps: + //! + //! 1. interpolation fine to coarse + //! + updateGrid->fineToCoarse(level, ¶->getParD(level)->intFC, para->getParD(level)->offFC, -1); + + //! 2. exchange information between GPUs (only nodes which are part of the interpolation) + //! + updateGrid->exchangeMultiGPU_noStreams_withPrepare(level, true); + + //! 3. interpolation coarse to fine + updateGrid->coarseToFine(level, ¶->getParD(level)->intCF, para->getParD(level)->offCF, -1); +} + +void RefinementAndExchange_noStreams_exchangeAllNodes::operator()(UpdateGrid27 *updateGrid, Parameter *para, int level) +{ + //! \details steps: + //! + //! 1. interpolation fine to coarse + //! + updateGrid->fineToCoarse(level, ¶->getParD(level)->intFC, para->getParD(level)->offFC, -1); + + //! 2. exchange information between GPUs (all nodes) + //! + updateGrid->exchangeMultiGPU_noStreams_withPrepare(level, false); + + //! 3. interpolation coarse to fine + updateGrid->coarseToFine(level, ¶->getParD(level)->intCF, para->getParD(level)->offCF, -1); +} + +void Refinement_noExchange::operator()(UpdateGrid27 *updateGrid, Parameter *para, int level) +{ + //! \details steps: + //! + //! 1. interpolation fine to coarse + //! + updateGrid->fineToCoarse(level, ¶->getParD(level)->intFC, para->getParD(level)->offFC, -1); + //! 2. interpolation coarse to fine + updateGrid->coarseToFine(level, ¶->getParD(level)->intCF, para->getParD(level)->offCF, -1); +} diff --git a/src/gpu/VirtualFluids_GPU/Calculation/RefinementStrategy.h b/src/gpu/VirtualFluids_GPU/Calculation/RefinementStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..4da3174a9840563d9e75688b35ce61fe9e08c493 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Calculation/RefinementStrategy.h @@ -0,0 +1,56 @@ +#ifndef REFINEMENTSTRATEGY_H +#define REFINEMENTSTRATEGY_H + +#include "UpdateGrid27.h" + +//! \brief get a function which performs the interpolation between grid levels and performs the communication between gpus/ processes +//! \return a function to perform the interpolation and for multi-gpu simulations also the communication +std::function<void(UpdateGrid27 *updateGrid, Parameter *para, int level)> + getFunctionForRefinementAndExchange(const bool useStreams, const int numberOfMpiProcesses, const int maxLevel, + const bool useReducedCommunicationAfterFtoC) noexcept; + +//! \brief Version of refinement: for multi-gpu simulations, with communication hiding ("streams"), only exchange the interpolated cells +//! \details recommended for multi-gpu simulations if the chosen collision kernel supports the use of cuda streams +class RefinementAndExchange_streams_exchangeInterface +{ +public: + void operator()(UpdateGrid27 *updateGrid, Parameter *para, int level); +}; + +//! \brief Version of refinement: for multi-gpu simulations, with communication hiding ("streams"), exchange all nodes +class RefinementAndExchange_streams_exchangeAllNodes +{ +public: + void operator()(UpdateGrid27 *updateGrid, Parameter *para, int level); +}; + +//! \brief Version of refinement: for multi-gpu simulations, without communication hiding ("streams"), only exchange the interpolated cells +//! \details recommended for multi-gpu simulations if the chosen collision kernel does NOT support the use of cuda streams +class RefinementAndExchange_noStreams_exchangeInterface +{ +public: + void operator()(UpdateGrid27 *updateGrid, Parameter *para, int level); +}; + +//! \brief Version of refinement: for multi-gpu simulations, without communication hiding ("streams"), exchange all nodes +class RefinementAndExchange_noStreams_exchangeAllNodes +{ +public: + void operator()(UpdateGrid27 *updateGrid, Parameter *para, int level); +}; + +//! \brief Version of refinement: for single-gpu simulations +class Refinement_noExchange +{ +public: + void operator()(UpdateGrid27 *updateGrid, Parameter *para, int level); +}; + +//! \brief Version of refinement: for uniform simulations (no grid refinement) +class NoRefinement +{ +public: + void operator()(UpdateGrid27 *updateGrid, Parameter *para, int level); +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp index a061b83547c0ddf6bb67a4b48b8b6ee3503a8e58..296ab819c5538a6b6d6a6827b5c28cbc475af838 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp @@ -1,99 +1,106 @@ #include "UpdateGrid27.h" #include <cuda_runtime.h> #include <helper_cuda.h> -#include "Calculation/DragLift.h" -#include "Calculation/Cp.h" -//#include "Utilities/StringUtil.hpp" -//#include "Output/UnstructuredGridWriter.hpp" + #include "Communication/ExchangeData27.h" +#include "Parameter/CudaStreamManager.h" +#include "KernelManager/BCKernelManager.h" +#include "KernelManager/ADKernelManager.h" +#include "KernelManager/GridScalingKernelManager.h" +#include "TurbulenceModels/TurbulenceModelFactory.h" #include "Kernel/Kernel.h" -void interactWithActuators(Parameter* para, CudaMemoryManager* cudaManager, int level, unsigned int t); -void interactWithProbes(Parameter* para, CudaMemoryManager* cudaManager, int level, unsigned int t); +#include "CollisionStrategy.h" +#include "RefinementStrategy.h" -void updateGrid27(Parameter* para, - vf::gpu::Communicator& comm, - CudaMemoryManager* cudaManager, - std::vector<std::shared_ptr<PorousMedia>>& pm, - int level, - unsigned int t, - std::vector < SPtr< Kernel>>& kernels) +void UpdateGrid27::updateGrid(int level, unsigned int t) { ////////////////////////////////////////////////////////////////////////// - if( level != para->getFine() ) - { - updateGrid27(para, comm, cudaManager, pm, level+1, t, kernels); - updateGrid27(para, comm, cudaManager, pm, level+1, t, kernels); + if (level != para->getFine()) { + updateGrid(level + 1, t); + updateGrid(level + 1, t); } ////////////////////////////////////////////////////////////////////////// - collision(para, pm, level, t, kernels); + collision(this, para.get(), level, t); ////////////////////////////////////////////////////////////////////////// - exchangeMultiGPU(para, comm, cudaManager, level); + postCollisionBC(level); ////////////////////////////////////////////////////////////////////////// - postCollisionBC(para, level, t); + swapBetweenEvenAndOddTimestep(level); ////////////////////////////////////////////////////////////////////////// - swapBetweenEvenAndOddTimestep(para, level); - - ////////////////////////////////////////////////////////////////////////// + if (para->getUseWale()) //TODO: make WALE consistent with structure of other turbulence models + calcMacroscopicQuantities(level); - if (para->getUseWale()) - calcMacroscopicQuantities(para, level); + calcTurbulentViscosity(level); - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// - preCollisionBC(para, cudaManager, level, t); + this->preCollisionBC(level, t); ////////////////////////////////////////////////////////////////////////// - if( level != para->getFine() ) { - fineToCoarse(para, level); - - exchangeMultiGPU(para, comm, cudaManager, level); - - coarseToFine(para, level); + refinement(this, para.get(), level); } - interactWithActuators(para, cudaManager, level, t); + interactWithActuators(level, t); - interactWithProbes(para, cudaManager, level, t); + interactWithProbes(level, t); } -void collision(Parameter* para, std::vector<std::shared_ptr<PorousMedia>>& pm, int level, unsigned int t, std::vector < SPtr< Kernel>>& kernels) +void UpdateGrid27::collisionAllNodes(int level, unsigned int t) { kernels.at(level)->run(); ////////////////////////////////////////////////////////////////////////// if (para->getSimulatePorousMedia()) - collisionPorousMedia(para, pm, level); + collisionPorousMedia(level); ////////////////////////////////////////////////////////////////////////// if (para->getDiffOn()) - collisionAdvectionDiffusion(para, level); + collisionAdvectionDiffusion(level); } -void collisionPorousMedia(Parameter* para, std::vector<std::shared_ptr<PorousMedia>>& pm, int level) +void UpdateGrid27::collisionUsingIndices(int level, unsigned int t, uint *fluidNodeIndices, uint numberOfFluidNodes, int stream) +{ + if (fluidNodeIndices != nullptr && numberOfFluidNodes != 0) + kernels.at(level)->runOnIndices(fluidNodeIndices, numberOfFluidNodes, stream); + else + std::cout << "In collision: fluidNodeIndices or numberOfFluidNodes not definded" + << std::endl; + + ////////////////////////////////////////////////////////////////////////// + + if (para->getSimulatePorousMedia()) + collisionPorousMedia(level); + + ////////////////////////////////////////////////////////////////////////// + + if (para->getDiffOn()) + collisionAdvectionDiffusion(level); +} + +void UpdateGrid27::collisionPorousMedia(int level) { for( std::size_t i = 0; i < pm.size(); i++ ) { KernelPMCumOneCompSP27(para->getParD(level)->numberofthreads, para->getParD(level)->omega, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, level, para->getForcesDev(), pm[i]->getPorosity(), @@ -101,1184 +108,278 @@ void collisionPorousMedia(Parameter* para, std::vector<std::shared_ptr<PorousMed pm[i]->getForchheimerLBM(), pm[i]->getSizePM(), pm[i]->getHostNodeIDsPM(), - para->getParD(level)->evenOrOdd); - getLastCudaError("KernelPMCumOneCompSP27 execution failed"); + para->getParD(level)->isEvenTimestep); + getLastCudaError("KernelPMCumOneCompSP27 execution failed"); } } -void collisionAdvectionDiffusion(Parameter* para, int level) +void UpdateGrid27::collisionAdvectionDiffusion(int level) { - if (para->getDiffMod() == 7) - { - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // incompressible - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //KernelADincomp7(para->getParD(level)->numberofthreads, para->getParD(level)->diffusivity, para->getParD(level)->geoSP, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d7.f[0], para->getParD(level)->size_Mat_SP, - // para->getParD(level)->evenOrOdd); - //getLastCudaError("KernelADincomp7 execution failed"); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // compressible - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //KernelThS7( para->getParD(level)->numberofthreads, para->getParD(level)->diffusivity, para->getParD(level)->geoSP, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d7.f[0], para->getParD(level)->size_Mat_SP, - // para->getParD(level)->evenOrOdd); - //getLastCudaError("KernelThS7 execution failed"); - } - else if (para->getDiffMod() == 27) - { - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // incompressible - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //KernelADincomp27( para->getParD(level)->numberofthreads, para->getParD(level)->diffusivity, para->getParD(level)->geoSP, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d27.f[0], para->getParD(level)->size_Mat_SP, - // para->getParD(level)->evenOrOdd); - //getLastCudaError("KernelADincomp27 execution failed"); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // compressible - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //KernelThS27(para->getParD(level)->numberofthreads, - // para->getParD(level)->diffusivity, - // para->getParD(level)->geoSP, - // para->getParD(level)->neighborX_SP, - // para->getParD(level)->neighborY_SP, - // para->getParD(level)->neighborZ_SP, - // para->getParD(level)->d0SP.f[0], - // para->getParD(level)->d27.f[0], - // para->getParD(level)->size_Mat_SP, - // para->getParD(level)->evenOrOdd); - //getLastCudaError("KernelThS27 execution failed"); - } + this->adKernelManager->runADcollisionKernel(level); } -void exchangeMultiGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void UpdateGrid27::prepareExchangeMultiGPU(int level, int streamIndex) { - if (para->getNumprocs() > 1) - { - // St. Lenz: exchange for post-collision data and pre-collision data are identical! - - ////////////////////////////////////////////////////////////////////////// - //3D domain decomposition - exchangePostCollDataXGPU27(para, comm, cudaManager, level); - exchangePostCollDataYGPU27(para, comm, cudaManager, level); - exchangePostCollDataZGPU27(para, comm, cudaManager, level); - - ////////////////////////////////////////////////////////////////////////// - //3D domain decomposition convection diffusion - if (para->getDiffOn()==true) - { - exchangePostCollDataADXGPU27(para, comm, cudaManager, level); - exchangePostCollDataADYGPU27(para, comm, cudaManager, level); - exchangePostCollDataADZGPU27(para, comm, cudaManager, level); - } - - ////////////////////////////////////////////////////////////////////////// - // D E P R E C A T E D - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - //1D domain decomposition - //exchangePostCollDataGPU27(para, comm, level); - } + prepareExchangeCollDataXGPU27AllNodes(para.get(), level, streamIndex); + prepareExchangeCollDataYGPU27AllNodes(para.get(), level, streamIndex); + prepareExchangeCollDataZGPU27AllNodes(para.get(), level, streamIndex); } -void postCollisionBC(Parameter* para, int level, unsigned int t) +void UpdateGrid27::prepareExchangeMultiGPUAfterFtoC(int level, int streamIndex) +{ + prepareExchangeCollDataXGPU27AfterFtoC(para.get(), level, streamIndex); + prepareExchangeCollDataYGPU27AfterFtoC(para.get(), level, streamIndex); + prepareExchangeCollDataZGPU27AfterFtoC(para.get(), level, streamIndex); +} + +void UpdateGrid27::exchangeMultiGPU(int level, int streamIndex) { ////////////////////////////////////////////////////////////////////////// - // I N F L O W - ////////////////////////////////////////////////////////////////////////// + // 3D domain decomposition + exchangeCollDataXGPU27AllNodes(para.get(), comm, cudaMemoryManager.get(), level, streamIndex); + exchangeCollDataYGPU27AllNodes(para.get(), comm, cudaMemoryManager.get(), level, streamIndex); + exchangeCollDataZGPU27AllNodes(para.get(), comm, cudaMemoryManager.get(), level, streamIndex); - if (para->getParD(level)->kInflowQ > 0) - { - //QVelDev27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->Qinflow.Vx, para->getParD(level)->Qinflow.Vy, para->getParD(level)->Qinflow.Vz, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->Qinflow.k, para->getParD(level)->Qinflow.q27[0], - // para->getParD(level)->kInflowQ, para->getParD(level)->kInflowQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QVelDev27 execution failed"); - - //QVelDevComp27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->Qinflow.Vx, para->getParD(level)->Qinflow.Vy, para->getParD(level)->Qinflow.Vz, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->Qinflow.k, para->getParD(level)->Qinflow.q27[0], - // para->getParD(level)->kInflowQ, para->getParD(level)->kInflowQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QVelDevComp27 execution failed"); - - QVelDevCompZeroPress27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - para->getParD(level)->Qinflow.Vx, para->getParD(level)->Qinflow.Vy, para->getParD(level)->Qinflow.Vz, - para->getParD(level)->d0SP.f[0], para->getParD(level)->Qinflow.k, para->getParD(level)->Qinflow.q27[0], - para->getParD(level)->kInflowQ, para->getParD(level)->Qinflow.kArray, para->getParD(level)->omega, - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - getLastCudaError("QVelDevCompZeroPress27 execution failed"); - - ////////////////////////////////////////////////////////////////////////// - // D E P R E C A T E D - ////////////////////////////////////////////////////////////////////////// - - //QVelDevice1h27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->Qinflow.Vx, para->getParD(level)->Qinflow.Vy, para->getParD(level)->Qinflow.Vz, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->Qinflow.k, para->getParD(level)->Qinflow.q27[0], - // para->getParD(level)->kInflowQ, para->getParD(level)->kInflowQ, para->getParD(level)->omega, - // para->getPhi(), para->getAngularVelocity(), - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->coordX_SP, para->getParD(level)->coordY_SP, para->getParD(level)->coordZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QVelDev27 execution failed"); + scatterNodesFromRecvBufferXGPU27AllNodes(para.get(), level, streamIndex); + scatterNodesFromRecvBufferYGPU27AllNodes(para.get(), level, streamIndex); + scatterNodesFromRecvBufferZGPU27AllNodes(para.get(), level, streamIndex); + ////////////////////////////////////////////////////////////////////////// + // 3D domain decomposition convection diffusion + if (para->getDiffOn()) { + if (para->getUseStreams()) + std::cout << "Warning: Cuda streams not yet implemented for convection diffusion" << std::endl; + exchangePostCollDataADXGPU27(para.get(), comm, cudaMemoryManager.get(), level); + exchangePostCollDataADYGPU27(para.get(), comm, cudaMemoryManager.get(), level); + exchangePostCollDataADZGPU27(para.get(), comm, cudaMemoryManager.get(), level); } ////////////////////////////////////////////////////////////////////////// - // N O - S L I P + // D E P R E C A T E D ////////////////////////////////////////////////////////////////////////// - if (para->getParD(level)->kQ > 0) - { - //QDev27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QWall.k, para->getParD(level)->QWall.q27[0], - // para->getParD(level)->kQ, para->getParD(level)->kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QDev27 execution failed"); - - //BBDev27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QWall.k, para->getParD(level)->QWall.q27[0], - // para->getParD(level)->kQ, para->getParD(level)->kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("BBDev27 (Wall) execution failed"); - - //QDev27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QWall.k, para->getParD(level)->QWall.q27[0], - // para->getParD(level)->kQ, para->getParD(level)->kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QDev27 (Wall) execution failed"); - - QDevComp27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - para->getParD(level)->d0SP.f[0], para->getParD(level)->QWall.k, para->getParD(level)->QWall.q27[0], - para->getParD(level)->kQ, para->getParD(level)->kQ, para->getParD(level)->omega, - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - getLastCudaError("QDevComp27 (Wall) execution failed"); + ////////////////////////////////////////////////////////////////////////// + // 1D domain decomposition + // exchangePostCollDataGPU27(para, comm, level); +} +void UpdateGrid27::exchangeMultiGPU_noStreams_withPrepare(int level, bool useReducedComm) +{ + ////////////////////////////////////////////////////////////////////////// + // 3D domain decomposition + if (useReducedComm) { + // X + prepareExchangeCollDataXGPU27AfterFtoC(para.get(), level, -1); + exchangeCollDataXGPU27AfterFtoC(para.get(), comm, cudaMemoryManager.get(), level, -1); + scatterNodesFromRecvBufferXGPU27AfterFtoC(para.get(), level, -1); + // Y + prepareExchangeCollDataYGPU27AfterFtoC(para.get(), level, -1); + exchangeCollDataYGPU27AfterFtoC(para.get(), comm, cudaMemoryManager.get(), level, -1); + scatterNodesFromRecvBufferYGPU27AfterFtoC(para.get(), level, -1); + // Z + prepareExchangeCollDataZGPU27AfterFtoC(para.get(), level, -1); + exchangeCollDataZGPU27AfterFtoC(para.get(), comm, cudaMemoryManager.get(), level, -1); + scatterNodesFromRecvBufferZGPU27AfterFtoC(para.get(), level, -1); + } else { + // X + prepareExchangeCollDataXGPU27AllNodes(para.get(), level, -1); + exchangeCollDataXGPU27AllNodes(para.get(), comm, cudaMemoryManager.get(), level, -1); + scatterNodesFromRecvBufferXGPU27AllNodes(para.get(), level, -1); + // Y + prepareExchangeCollDataYGPU27AllNodes(para.get(), level, -1); + exchangeCollDataYGPU27AllNodes(para.get(), comm, cudaMemoryManager.get(), level, -1); + scatterNodesFromRecvBufferYGPU27AllNodes(para.get(), level, -1); + // Z + prepareExchangeCollDataZGPU27AllNodes(para.get(), level, -1); + exchangeCollDataZGPU27AllNodes(para.get(), comm, cudaMemoryManager.get(), level, -1); + scatterNodesFromRecvBufferZGPU27AllNodes(para.get(), level, -1); } ////////////////////////////////////////////////////////////////////////// - // S L I P + // 3D domain decomposition convection diffusion + if (para->getDiffOn()) { + if (para->getUseStreams()) + std::cout << "Warning: Cuda streams not yet implemented for convection diffusion" << std::endl; + exchangePostCollDataADXGPU27(para.get(), comm, cudaMemoryManager.get(), level); + exchangePostCollDataADYGPU27(para.get(), comm, cudaMemoryManager.get(), level); + exchangePostCollDataADZGPU27(para.get(), comm, cudaMemoryManager.get(), level); + } +} +void UpdateGrid27::exchangeMultiGPUAfterFtoC(int level, int streamIndex) +{ ////////////////////////////////////////////////////////////////////////// + // 3D domain decomposition + exchangeCollDataXGPU27AfterFtoC(para.get(), comm, cudaMemoryManager.get(), level, streamIndex); + exchangeCollDataYGPU27AfterFtoC(para.get(), comm, cudaMemoryManager.get(), level, streamIndex); + exchangeCollDataZGPU27AfterFtoC(para.get(), comm, cudaMemoryManager.get(), level, streamIndex); - if (para->getParD(level)->kSlipQ > 0) - { - //QSlipDev27( para->getParD(level)->numberofthreads, para->getParD(level)->d0SP.f[0], para->getParD(level)->QSlip.k, - // para->getParD(level)->QSlip.q27[0], para->getParD(level)->kSlipQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("Slip27 execution failed"); - - QSlipDevComp27( para->getParD(level)->numberofthreads, para->getParD(level)->d0SP.f[0], para->getParD(level)->QSlip.k, - para->getParD(level)->QSlip.q27[0], para->getParD(level)->kSlipQ, para->getParD(level)->omega, - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - getLastCudaError("QSlipDev27 execution failed"); + scatterNodesFromRecvBufferXGPU27AfterFtoC(para.get(), level, streamIndex); + scatterNodesFromRecvBufferYGPU27AfterFtoC(para.get(), level, streamIndex); + scatterNodesFromRecvBufferZGPU27AfterFtoC(para.get(), level, streamIndex); + + ////////////////////////////////////////////////////////////////////////// + // 3D domain decomposition convection diffusion + if (para->getDiffOn()) { + if (para->getUseStreams()) + std::cout << "Warning: Cuda streams not yet implemented for convection diffusion" << std::endl; + exchangePostCollDataADXGPU27(para.get(), comm, cudaMemoryManager.get(), level); + exchangePostCollDataADYGPU27(para.get(), comm, cudaMemoryManager.get(), level); + exchangePostCollDataADZGPU27(para.get(), comm, cudaMemoryManager.get(), level); } +} +void UpdateGrid27::postCollisionBC(int level) +{ ////////////////////////////////////////////////////////////////////////// - // G E O M E T R Y + // V E L O C I T Y (I N F L O W) + this->bcKernelManager->runVelocityBCKernelPost(level); + ////////////////////////////////////////////////////////////////////////// + // N O - S L I P + this->bcKernelManager->runNoSlipBCKernelPost(level); - if (para->getParD(level)->QGeom.kQ > 0) - { - if (para->getCalcDragLift()) - { - //Drag and Lift Part I - DragLiftPostD27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->QGeom.k, - para->getParD(level)->QGeom.q27[0], - para->getParD(level)->QGeom.kQ, - para->getParD(level)->DragPostX, - para->getParD(level)->DragPostY, - para->getParD(level)->DragPostZ, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - getLastCudaError("DragLift27 execution failed"); - } - - //BBDev27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QGeom.k, para->getParD(level)->QGeom.q27[0], - // para->getParD(level)->QGeom.kQ, para->getParD(level)->QGeom.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("BBDev27 (Wall) execution failed"); - - //QDev27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QGeom.k, para->getParD(level)->QGeom.q27[0], - // para->getParD(level)->QGeom.kQ, para->getParD(level)->QGeom.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QDev27 (Geom) execution failed"); - - //QVelDev27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->QGeom.Vx, para->getParD(level)->QGeom.Vy, para->getParD(level)->QGeom.Vz, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QGeom.k, para->getParD(level)->QGeom.q27[0], - // para->getParD(level)->QGeom.kQ, para->getParD(level)->QGeom.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QVelDev27 execution failed"); - - //QDevComp27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QGeom.k, para->getParD(level)->QGeom.q27[0], - // para->getParD(level)->QGeom.kQ, para->getParD(level)->QGeom.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QDevComp27 (Geom) execution failed"); - - //QVelDevComp27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->QGeom.Vx, para->getParD(level)->QGeom.Vy, para->getParD(level)->QGeom.Vz, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QGeom.k, para->getParD(level)->QGeom.q27[0], - // para->getParD(level)->QGeom.kQ, para->getParD(level)->QGeom.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QVelDevComp27 execution failed"); - - QVelDevCompZeroPress27( para->getParD(0)->numberofthreads, para->getParD(0)->nx, para->getParD(0)->ny, - para->getParD(0)->QGeom.Vx, para->getParD(0)->QGeom.Vy, para->getParD(0)->QGeom.Vz, - para->getParD(0)->d0SP.f[0], para->getParD(0)->QGeom.k, para->getParD(0)->QGeom.q27[0], - para->getParD(0)->QGeom.kQ, para->getParD(0)->QGeom.kQ, para->getParD(0)->omega, - para->getParD(0)->neighborX_SP, para->getParD(0)->neighborY_SP, para->getParD(0)->neighborZ_SP, - para->getParD(0)->size_Mat_SP, para->getParD(0)->evenOrOdd); - getLastCudaError("QVelDevCompZeroPress27 execution failed"); - - //QDev3rdMomentsComp27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QGeom.k, para->getParD(level)->QGeom.q27[0], - // para->getParD(level)->QGeom.kQ, para->getParD(level)->QGeom.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QDev3rdMomentsComp27 (Geom) execution failed"); - - //QSlipDev27( para->getParD(level)->numberofthreads, para->getParD(level)->d0SP.f[0], para->getParD(level)->QGeom.k, - // para->getParD(level)->QGeom.q27[0], para->getParD(level)->QGeom.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("Slip27 execution failed"); - - ////////////////////////////////////////////////////////////////////////// - // D E P R E C A T E D - ////////////////////////////////////////////////////////////////////////// - // the GridGenerator does currently not provide normals! - - //QSlipGeomDevComp27(para->getParD(level)->numberofthreads, para->getParD(level)->d0SP.f[0], para->getParD(level)->QGeom.k, - // para->getParD(level)->QGeom.q27[0], para->getParD(level)->QGeom.kQ, para->getParD(level)->omega, - // para->getParD(level)->QGeomNormalX.q27[0], para->getParD(level)->QGeomNormalY.q27[0], para->getParD(level)->QGeomNormalZ.q27[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QSlipGeomDev27 execution failed"); - - //QSlipNormDevComp27(para->getParD(level)->numberofthreads, para->getParD(level)->d0SP.f[0], para->getParD(level)->QGeom.k, - // para->getParD(level)->QGeom.q27[0], para->getParD(level)->QGeom.kQ, para->getParD(level)->omega, - // para->getParD(level)->QGeomNormalX.q27[0], para->getParD(level)->QGeomNormalY.q27[0], para->getParD(level)->QGeomNormalZ.q27[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QSlipGeomDev27 execution failed"); - } + ////////////////////////////////////////////////////////////////////////// + // S L I P + this->bcKernelManager->runSlipBCKernelPost(level); ////////////////////////////////////////////////////////////////////////// - // O U T F L O W + // S T R E S S (wall model) + this->bcKernelManager->runStressWallModelKernelPost(level); + ////////////////////////////////////////////////////////////////////////// + // G E O M E T R Y + this->bcKernelManager->runGeoBCKernelPost(level); - if (para->getParD(level)->kOutflowQ > 0) - { - ////////////////////////////////////////////////////////////////////////// - // D E P R E C A T E D - ////////////////////////////////////////////////////////////////////////// - - //QPressDevFixBackflow27( para->getParD(level)->numberofthreads, RhoBCOutflowD, - // para->getParD(level)->d0SP.f[0], QoutflowD.k, kOutflowQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QPressDev27 execution failed"); - } + ////////////////////////////////////////////////////////////////////////// + // O U T F L O W + this->bcKernelManager->runOutflowBCKernelPre(level); ////////////////////////////////////////////////////////////////////////// // P R E S S U R E - ////////////////////////////////////////////////////////////////////////// - - if (para->getParD(level)->kPressQ > 0) - { - //QPressDev27_IntBB( para->getParD(level)->numberofthreads, para->getParD(level)->QPress.RhoBC, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QPress.k, para->getParD(level)->QPress.q27[0], - // para->getParD(level)->QPress.kQ, para->getParD(level)->QPress.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QPressDev27_IntBB fine execution failed"); - } + this->bcKernelManager->runPressureBCKernelPost(level); ////////////////////////////////////////////////////////////////////////// // A D V E C T I O N D I F F U S I O N - ////////////////////////////////////////////////////////////////////////// - if (para->getDiffOn()) { - if (para->getDiffMod() == 7) - { - if (para->getParD(level)->QGeom.kQ > 0) - { - //QNoSlipADincompDev7( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d7.f[0], para->getParD(level)->Temp.temp, - // para->getParD(level)->diffusivity, para->getParD(level)->Temp.k, para->getParD(level)->QGeom.q27[0], - // para->getParD(level)->Temp.kTemp, para->getParD(level)->Temp.kTemp, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QNoSlipADincompDev7 execution failed"); - - ////////////////////////////////////////////////////////////////////////// - // C O M P R E S S I B L E - ////////////////////////////////////////////////////////////////////////// - - QADDev7( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - para->getParD(level)->d0SP.f[0], para->getParD(level)->d7.f[0], para->getParD(level)->Temp.temp, - para->getParD(level)->diffusivity, para->getParD(level)->Temp.k, para->getParD(level)->QGeom.q27[0], - para->getParD(level)->Temp.kTemp, para->getParD(level)->Temp.kTemp, para->getParD(level)->omega, - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - getLastCudaError("QADDev27 execution failed"); - } - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - if (para->getParD(level)->TempVel.kTemp > 0) - { - //QADVeloIncompDev7( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d7.f[0], para->getParD(level)->TempVel.tempPulse, - // para->getParD(level)->TempVel.velo, para->getParD(level)->diffusivity, para->getParD(level)->TempVel.k, - // para->getParD(level)->Qinflow.q27[0], para->getParD(level)->TempVel.kTemp, para->getParD(level)->TempVel.kTemp, - // para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - // para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QADVeloIncompDev7 execution failed"); - - ////////////////////////////////////////////////////////////////////////// - // D E P R E C A T E D - ////////////////////////////////////////////////////////////////////////// - - //if (t<15580)//(t>500000 && t<515580)//(t>300000 && t<315580) - //{ - // QADVeloIncompDev7(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d7.f[0], para->getParD(level)->TempVel.tempPulse, - // para->getParD(level)->TempVel.velo, para->getParD(level)->diffusivity, para->getParD(level)->TempVel.k, - // para->getParD(level)->Qinflow.q27[0], para->getParD(level)->TempVel.kTemp, para->getParD(level)->TempVel.kTemp, - // para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - // para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - // getLastCudaError("QADVeloIncompDev7 execution failed"); - //} - //else - //{ - // QADVeloIncompDev7(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d7.f[0], para->getParD(level)->TempVel.temp, - // para->getParD(level)->TempVel.velo, para->getParD(level)->diffusivity, para->getParD(level)->TempVel.k, - // para->getParD(level)->Qinflow.q27[0], para->getParD(level)->TempVel.kTemp, para->getParD(level)->TempVel.kTemp, - // para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - // para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - // getLastCudaError("QADVeloIncompDev7 execution failed"); - //} - - ////////////////////////////////////////////////////////////////////////// - // C O M P R E S S I B L E - ////////////////////////////////////////////////////////////////////////// - - QADVelDev7( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - para->getParD(level)->d0SP.f[0], para->getParD(level)->d7.f[0], para->getParD(level)->TempVel.temp, - para->getParD(level)->TempVel.velo, para->getParD(level)->diffusivity, para->getParD(level)->TempVel.k, - para->getParD(level)->Qinflow.q27[0], para->getParD(level)->TempVel.kTemp, para->getParD(level)->TempVel.kTemp, - para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - getLastCudaError("QADVelDev27 execution failed"); - } - - if (para->getParD(level)->TempPress.kTemp > 0) - { - //QADPressIncompDev7( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d7.f[0], para->getParD(level)->TempPress.temp, - // para->getParD(level)->TempPress.velo, para->getParD(level)->diffusivity, para->getParD(level)->TempPress.k, - // para->getParD(level)->QPress.q27[0], para->getParD(level)->TempPress.kTemp, para->getParD(level)->TempPress.kTemp, - // para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - // para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QADPressIncompDev7 execution failed"); - - ////////////////////////////////////////////////////////////////////////// - // C O M P R E S S I B L E - ////////////////////////////////////////////////////////////////////////// - - QADPressDev7( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - para->getParD(level)->d0SP.f[0], para->getParD(level)->d7.f[0], para->getParD(level)->TempPress.temp, - para->getParD(level)->TempPress.velo, para->getParD(level)->diffusivity, para->getParD(level)->TempPress.k, - para->getParD(level)->QPress.q27[0], para->getParD(level)->TempPress.kTemp, para->getParD(level)->TempPress.kTemp, - para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - getLastCudaError("QADPressDev27 execution failed"); - } - } - else if (para->getDiffMod() == 27) - { - if (para->getParD(level)->QGeom.kQ > 0) - { - //QNoSlipADincompDev27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d27.f[0], para->getParD(level)->Temp.temp, - // para->getParD(level)->diffusivity, para->getParD(level)->Temp.k, para->getParD(level)->QGeom.q27[0], - // para->getParD(level)->Temp.kTemp, para->getParD(level)->Temp.kTemp, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QNoSlipADincompDev27 execution failed"); - - ////////////////////////////////////////////////////////////////////////// - // C O M P R E S S I B L E - ////////////////////////////////////////////////////////////////////////// - - QADBBDev27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - para->getParD(level)->d0SP.f[0], para->getParD(level)->d27.f[0], para->getParD(level)->Temp.temp, - para->getParD(level)->diffusivity, para->getParD(level)->Temp.k, para->getParD(level)->QGeom.q27[0], - para->getParD(level)->Temp.kTemp, para->getParD(level)->Temp.kTemp, para->getParD(level)->omega, - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - getLastCudaError("QADBBDev27 execution failed"); - } - - if (para->getParD(level)->TempVel.kTemp > 0) - { - QADVeloIncompDev27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - para->getParD(level)->d0SP.f[0], para->getParD(level)->d27.f[0], para->getParD(level)->TempVel.temp, - para->getParD(level)->TempVel.velo, para->getParD(level)->diffusivity, para->getParD(level)->TempVel.k, - para->getParD(level)->Qinflow.q27[0], para->getParD(level)->TempVel.kTemp, para->getParD(level)->TempVel.kTemp, - para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - getLastCudaError("QADVeloIncompDev27 execution failed"); - - ////////////////////////////////////////////////////////////////////////// - // D E P R E C A T E D - ////////////////////////////////////////////////////////////////////////// - - //if (t>500000 && t<515580)//(t>300000 && t<315580) - //{ - // QADVeloIncompDev27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d27.f[0], para->getParD(level)->TempVel.tempPulse, - // para->getParD(level)->TempVel.velo, para->getParD(level)->diffusivity, para->getParD(level)->TempVel.k, - // para->getParD(level)->Qinflow.q27[0], para->getParD(level)->TempVel.kTemp, para->getParD(level)->TempVel.kTemp, - // para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - // para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - // getLastCudaError("QADVeloIncompDev27 execution failed"); - //} - //else - //{ - // QADVeloIncompDev27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d27.f[0], para->getParD(level)->TempVel.temp, - // para->getParD(level)->TempVel.velo, para->getParD(level)->diffusivity, para->getParD(level)->TempVel.k, - // para->getParD(level)->Qinflow.q27[0], para->getParD(level)->TempVel.kTemp, para->getParD(level)->TempVel.kTemp, - // para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - // para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - // getLastCudaError("QADVeloIncompDev27 execution failed"); - //} - - ////////////////////////////////////////////////////////////////////////// - // C O M P R E S S I B L E - ////////////////////////////////////////////////////////////////////////// - - QADVelDev27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - para->getParD(level)->d0SP.f[0], para->getParD(level)->d27.f[0], para->getParD(level)->TempVel.tempPulse, - para->getParD(level)->TempVel.velo, para->getParD(level)->diffusivity, para->getParD(level)->Qinflow.k, - para->getParD(level)->Qinflow.q27[0], para->getParD(level)->kInflowQ, para->getParD(level)->kInflowQ, - para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - getLastCudaError("QADVelDev27 execution failed"); - - ////////////////////////////////////////////////////////////////////////// - // D E P R E C A T E D - ////////////////////////////////////////////////////////////////////////// - - //if (t<1000)//(t>100000 && t<103895)//(t>1600000 && t<1662317)//(t>500000 && t<515580)//(t<1000)//(t<15580)//(t>400000 && t<415580)// - //{ - // QADVelDev27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d27.f[0], para->getParD(level)->TempVel.tempPulse, - // para->getParD(level)->TempVel.velo, para->getParD(level)->diffusivity, para->getParD(level)->Qinflow.k, - // para->getParD(level)->Qinflow.q27[0], para->getParD(level)->kInflowQ, para->getParD(level)->kInflowQ, - // para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - // para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - // getLastCudaError("QADVelDev27 execution failed"); - //} - //else - //{ - // QADVelDev27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d27.f[0], para->getParD(level)->TempVel.temp, - // para->getParD(level)->TempVel.velo, para->getParD(level)->diffusivity, para->getParD(level)->Qinflow.k, - // para->getParD(level)->Qinflow.q27[0], para->getParD(level)->kInflowQ, para->getParD(level)->kInflowQ, - // para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - // para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - // getLastCudaError("QADVelDev27 execution failed"); - //} - } - - if (para->getParD(level)->TempPress.kTemp > 0) - { - //QADPressIncompDev27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->d27.f[0], para->getParD(level)->TempPress.temp, - // para->getParD(level)->TempPress.velo, para->getParD(level)->diffusivity, para->getParD(level)->TempPress.k, - // para->getParD(level)->QPress.q27[0], para->getParD(level)->TempPress.kTemp, para->getParD(level)->TempPress.kTemp, - // para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - // para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QADPressIncompDev27 execution failed"); - - ////////////////////////////////////////////////////////////////////////// - // C O M P R E S S I B L E - ////////////////////////////////////////////////////////////////////////// - - QADPressDev27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - para->getParD(level)->d0SP.f[0], para->getParD(level)->d27.f[0], para->getParD(level)->TempPress.temp, - para->getParD(level)->TempPress.velo, para->getParD(level)->diffusivity, para->getParD(level)->TempPress.k, - para->getParD(level)->QPress.q27[0], para->getParD(level)->TempPress.kTemp, para->getParD(level)->TempPress.kTemp, - para->getParD(level)->omega, para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - getLastCudaError("QADPressDev27 execution failed"); - - } - } + this->adKernelManager->runADgeometryBCKernel(level); + this->adKernelManager->runADveloBCKernel(level); + this->adKernelManager->runADslipBCKernel(level); + this->adKernelManager->runADpressureBCKernel(level); } } -void swapBetweenEvenAndOddTimestep(Parameter* para, int level) +void UpdateGrid27::swapBetweenEvenAndOddTimestep(int level) { - if (para->getParD(level)->evenOrOdd==true) para->getParD(level)->evenOrOdd=false; - else para->getParD(level)->evenOrOdd=true; + if (para->getParD(level)->isEvenTimestep==true) para->getParD(level)->isEvenTimestep=false; + else para->getParD(level)->isEvenTimestep=true; } -void calcMacroscopicQuantities(Parameter* para, int level) +void UpdateGrid27::calcMacroscopicQuantities(int level) { - CalcMacCompSP27(para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->rho_SP, - para->getParD(level)->press_SP, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->numberofthreads, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->evenOrOdd); - getLastCudaError("CalcMacSP27 execution failed"); + CalcMacCompSP27(para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->rho, + para->getParD(level)->pressure, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->numberofthreads, + para->getParD(level)->distributions.f[0], + para->getParD(level)->isEvenTimestep); + getLastCudaError("CalcMacSP27 execution failed"); } -void preCollisionBC(Parameter* para, CudaMemoryManager* cudaManager, int level, unsigned int t) +void UpdateGrid27::preCollisionBC(int level, unsigned int t) { ////////////////////////////////////////////////////////////////////////// - // I N F L O W - ////////////////////////////////////////////////////////////////////////// + // V E L O C I T Y (I N F L O W) + this->bcKernelManager->runVelocityBCKernelPre(level); - if (para->getParD(level)->kInflowQ > 0) - { - //if ( myid == 0) - //{ - // VelSchlaffer27(para->getParD(level)->numberofthreads, t, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->Qinflow.Vz, - // para->getParD(level)->Qinflow.deltaVz, para->getParD(level)->Qinflow.k, - // para->getParD(level)->Qinflow.kN, para->getParD(level)->kInflowQ, - // para->getParD(level)->omega, para->getParD(level)->neighborX_SP, - // para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - // getLastCudaError("VelSchlaffer27 execution failed"); - //} - ////////////////////////////////////////////////////////////////////////////// - // high viscosity incompressible - //QVelDevIncompHighNu27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->Qinflow.Vx, para->getParD(level)->Qinflow.Vy, para->getParD(level)->Qinflow.Vz, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->Qinflow.k, para->getParD(level)->Qinflow.q27[0], - // para->getParD(level)->kInflowQ, para->getParD(level)->kInflowQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QVelDevComp27 execution failed"); - ////////////////////////////////////////////////////////////////////////////// - // high viscosity compressible - //QVelDevCompHighNu27(para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->Qinflow.Vx, para->getParD(level)->Qinflow.Vy, para->getParD(level)->Qinflow.Vz, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->Qinflow.k, para->getParD(level)->Qinflow.q27[0], - // para->getParD(level)->kInflowQ, para->getParD(level)->kInflowQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QVelDevComp27 execution failed"); - } - - ////////////////////////////////////////////////////////////////////////// - // G E O M E T R Y - ////////////////////////////////////////////////////////////////////////// - - if (para->getParD(level)->QGeom.kQ > 0) - { - if (para->getCalcDragLift()) - { - //Drag and Lift Part II - DragLiftPreD27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->QGeom.k, - para->getParD(level)->QGeom.q27[0], - para->getParD(level)->QGeom.kQ, - para->getParD(level)->DragPreX, - para->getParD(level)->DragPreY, - para->getParD(level)->DragPreZ, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - getLastCudaError("DragLift27 execution failed"); - //////////////////////////////////////////////////////////////////////////////// - //Calculation of Drag and Lift - //////////////////////////////////////////////////////////////////////////////// - calcDragLift(para, cudaManager, level); - //////////////////////////////////////////////////////////////////////////////// - } - - if (para->getCalcCp()) - { - //////////////////////////////////////////////////////////////////////////////// - //Calculation of cp - //////////////////////////////////////////////////////////////////////////////// - - if(t > para->getTStartOut()) - { - //////////////////////////////////////////////////////////////////////////////// - CalcCPtop27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->cpTopIndex, - para->getParD(level)->numberOfPointsCpTop, - para->getParD(level)->cpPressTop, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////////////// - CalcCPbottom27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->cpBottomIndex, - para->getParD(level)->numberOfPointsCpBottom, - para->getParD(level)->cpPressBottom, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////////////// - CalcCPbottom27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->cpBottom2Index, - para->getParD(level)->numberOfPointsCpBottom2, - para->getParD(level)->cpPressBottom2, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////////////// - calcCp(para, cudaManager, level); - } - } - - - //////////////////////////////////////////////////////////////////////////////// - // high viscosity incompressible - //QDevIncompHighNu27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QGeom.k, para->getParD(level)->QGeom.q27[0], - // para->getParD(level)->QGeom.kQ, para->getParD(level)->QGeom.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QDevComp27 (Geom) execution failed"); - ////////////////////////////////////////////////////////////////////////////////// - // high viscosity compressible - //QDevCompHighNu27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QGeom.k, para->getParD(level)->QGeom.q27[0], - // para->getParD(level)->QGeom.kQ, para->getParD(level)->QGeom.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QDevComp27 (Geom) execution failed"); - } + ////////////////////////////////////////////////////////////////////////// + // G E O M E T R Y + this->bcKernelManager->runGeoBCKernelPre(level, t, cudaMemoryManager.get()); ////////////////////////////////////////////////////////////////////////// // P R E S S U R E - ////////////////////////////////////////////////////////////////////////// + this->bcKernelManager->runPressureBCKernelPre(level); - if (para->getParD(level)->QPress.kQ > 0) - { - QPressNoRhoDev27(para->getParD(level)->numberofthreads, para->getParD(level)->QPress.RhoBC, - para->getParD(level)->d0SP.f[0], para->getParD(level)->QPress.k, - para->getParD(level)->QPress.kN, para->getParD(level)->QPress.kQ, para->getParD(level)->omega, - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - getLastCudaError("QPressNoRhoDev27 execution failed"); - - //QPressDevEQZ27(para->getParD(level)->numberofthreads, para->getParD(level)->QPress.RhoBC, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QPress.k, - // para->getParD(level)->QPress.kN, para->getParD(level)->kDistTestRE.f[0], - // para->getParD(level)->QPress.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(0)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QPressDevEQZ27 execution failed"); - - //QInflowScaleByPressDev27( para->getParD(level)->numberofthreads, para->getParD(level)->QPress.RhoBC, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QPress.k, - // para->getParD(level)->QPress.kN, para->getParD(level)->QPress.kQ, para->getParD(0)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(0)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QInflowScaleByPressDev27 execution failed"); - - //////////////////////////////////////////////////////////////////////////////// - //press NEQ incompressible - //QPressDevIncompNEQ27(para->getParD(level)->numberofthreads, para->getParD(level)->QPress.RhoBC, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QPress.k, - // para->getParD(level)->QPress.kN, para->getParD(level)->QPress.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QPressDevIncompNEQ27 execution failed"); - ////////////////////////////////////////////////////////////////////////////////// - //press NEQ compressible - //QPressDevNEQ27( para->getParD(level)->numberofthreads, para->getParD(level)->QPress.RhoBC, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->QPress.k, - // para->getParD(level)->QPress.kN, para->getParD(level)->QPress.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QPressDevNEQ27 execution failed"); - - } - - ////////////////////////////////////////////////////////////////////////// - // O U T F L O W ////////////////////////////////////////////////////////////////////////// - - if (para->getParD(level)->kOutflowQ > 0) - { - //QPressNoRhoDev27( para->getParD(level)->numberofthreads, para->getParD(level)->Qoutflow.RhoBC, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->Qoutflow.k, - // para->getParD(level)->Qoutflow.kN, para->getParD(level)->Qoutflow.kQ, para->getParD(level)->omega, - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("QPressNoRhoDev27 execution failed"); - - //if ( myid == numprocs - 1) - //PressSchlaffer27( para->getParD(level)->numberofthreads, para->getParD(level)->Qoutflow.RhoBC, - // para->getParD(level)->d0SP.f[0], para->getParD(level)->Qoutflow.Vx, - // para->getParD(level)->Qoutflow.Vy, para->getParD(level)->Qoutflow.Vz, - // para->getParD(level)->Qoutflow.deltaVz, para->getParD(level)->Qoutflow.k, - // para->getParD(level)->Qoutflow.kN, para->getParD(level)->kOutflowQ, - // para->getParD(level)->omega, para->getParD(level)->neighborX_SP, - // para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level)->evenOrOdd); - //getLastCudaError("PressSchlaffer27 execution failed"); - } + // O U T F L O W + this->bcKernelManager->runOutflowBCKernelPre(level); ////////////////////////////////////////////////////////////////////////////////// ////only for a round off error test - //para->cudaCopyTestREtoHost(0,para->getParH(0)->QPress.kQ); + //para->cudaCopyTestREtoHost(0,para->getParH(0)->pressureBC.numberOfBCnodes); //printRE(para, t); ////////////////////////////////////////////////////////////////////////////////// - - } -void fineToCoarse(Parameter* para, int level) +void UpdateGrid27::fineToCoarse(int level, InterpolationCellFC* icellFC, OffFC &offFC, + int streamIndex) { - //ScaleFC_comp_D3Q27F3(para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], para->getParD(level)->g6.g[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offFC); - //getLastCudaError("ScaleFC_comp_D3Q27F3 execution failed"); - - //ScaleFC_0817_comp_27(para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offFC); - //getLastCudaError("ScaleFC_0817_comp_27 execution failed"); - - //ScaleFC_RhoSq_3rdMom_comp_27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offFC); - //getLastCudaError("ScaleFC_RhoSq_3rdMom_comp_27 execution failed"); - - ScaleFC_RhoSq_comp_27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - para->getParD(level)->offFC); - getLastCudaError("ScaleFC27_RhoSq_comp execution failed"); - - //ScaleFC_AA2016_comp_27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offFC); - //getLastCudaError("ScaleFC_AA2016_comp_27 execution failed"); + gridScalingKernelManager->runFineToCoarseKernelLB(level, icellFC, offFC, streamIndex); - - - ////////////////////////////////////////////////////////////////////////// - // D E P R E C A T E D - ////////////////////////////////////////////////////////////////////////// - - //ScaleFC27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->gridNX); - //getLastCudaError("ScaleFC27 execution failed"); - - //ScaleFCEff27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offFC); - //getLastCudaError("ScaleFC27 execution failed"); - - //ScaleFCLast27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offFC); - //getLastCudaError("ScaleFC27 execution failed"); - - //ScaleFCpress27(para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offFC); - //getLastCudaError("ScaleFC27 execution failed"); - - // ScaleFC_Fix_comp_27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offFC); - // getLastCudaError("ScaleFC27 execution failed"); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // incompressible - //ScaleFC_Fix_27(para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offFC); - //getLastCudaError("ScaleFC27 execution failed"); - - //ScaleFC_NSPress_27(para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offFC); - //getLastCudaError("ScaleFC27 execution failed"); - - - ////////////////////////////////////////////////////////////////////////// - // A D V E C T I O N D I F F U S I O N - ////////////////////////////////////////////////////////////////////////// - - if (para->getDiffOn()) - { - if (para->getDiffMod() == 7) - { - //ScaleFCThS7( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->d7.f[0], para->getParD(level+1)->d7.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - // para->getParD(level)->K_FC, - // para->getParD(level)->vis, para->getParD(level)->diffusivity, para->getParD(level)->numberofthreads); - //getLastCudaError("ScaleFCTh7 execution failed"); - - ScaleFCThSMG7( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - para->getParD(level)->d7.f[0], para->getParD(level+1)->d7.f[0], - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - para->getParD(level)->K_FC, - para->getParD(level)->vis, para->getParD(level)->diffusivity, para->getParD(level)->numberofthreads, - para->getParD(level)->offFC); - getLastCudaError("ScaleFCTh7 execution failed"); - } - else if (para->getDiffMod() == 27) - { - ScaleFCThS27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - para->getParD(level)->d27.f[0], para->getParD(level+1)->d27.f[0], - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, - para->getParD(level)->K_FC, - para->getParD(level)->vis, para->getParD(level)->diffusivity, para->getParD(level)->numberofthreads, - para->getParD(level)->offFC); - getLastCudaError("ScaleFCTh27 execution failed"); + if (para->getDiffOn()) { + if (streamIndex != -1) { + printf("fineToCoarse Advection Diffusion not implemented"); // TODO + return; } - } - + gridScalingKernelManager->runFineToCoarseKernelAD(level); + } } -void coarseToFine(Parameter* para, int level) +void UpdateGrid27::coarseToFine(int level, InterpolationCellCF* icellCF, OffCF &offCF, + int streamIndex) { - //ScaleCF_comp_D3Q27F3(para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], para->getParD(level+1)->g6.g[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offCF); - //getLastCudaError("ScaleCF_comp_D3Q27F3 execution failed"); - - //ScaleCF_0817_comp_27(para->getParD(level)->d0SP.f[0], para->getParD(level + 1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offCF); - //getLastCudaError("ScaleCF_0817_comp_27 execution failed"); - - //ScaleCF_RhoSq_3rdMom_comp_27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offCF); - //getLastCudaError("ScaleCF_RhoSq_3rdMom_comp_27 execution failed"); - - ScaleCF_RhoSq_comp_27(para->getParD(level)->d0SP.f[0], para->getParD(level + 1)->d0SP.f[0], - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level + 1)->neighborX_SP, para->getParD(level + 1)->neighborY_SP, para->getParD(level + 1)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level + 1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level + 1)->omega, - para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - para->getParD(level + 1)->nx, para->getParD(level + 1)->ny, para->getParD(level)->numberofthreads, - para->getParD(level)->offCF); - getLastCudaError("ScaleCF27_RhoSq_comp execution failed"); - - //ScaleCF_AA2016_comp_27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offCF); - //getLastCudaError("ScaleCF_AA2016_comp_27 execution failed"); - - - - ////////////////////////////////////////////////////////////////////////// - // D E P R E C A T E D - ////////////////////////////////////////////////////////////////////////// - - //ScaleCF27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->gridNX); - //getLastCudaError("ScaleCF27 execution failed"); - - //ScaleCFEff27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offCF); - //getLastCudaError("ScaleCF27 execution failed"); - - //ScaleCFLast27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offCF); - //getLastCudaError("ScaleCF27 execution failed"); - - //ScaleCFpress27(para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offCF); - //getLastCudaError("ScaleCF27 execution failed"); - - // ScaleCF_Fix_comp_27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offCF); - // getLastCudaError("ScaleCF27 execution failed"); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // incompressible - //ScaleCF_Fix_27(para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offCF); - //getLastCudaError("ScaleCF27 execution failed"); - - //ScaleCF_NSPress_27(para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, - // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, - // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, - // para->getParD(level)->offCF); - //getLastCudaError("ScaleCF27 execution failed"); - - - ////////////////////////////////////////////////////////////////////////// - // A D V E C T I O N D I F F U S I O N - ////////////////////////////////////////////////////////////////////////// + this->gridScalingKernelManager->runCoarseToFineKernelLB(level, icellCF, offCF, streamIndex); if (para->getDiffOn()) { - if (para->getDiffMod() == 7) - { - //ScaleCFThS7( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - // para->getParD(level)->d7.f[0], para->getParD(level+1)->d7.f[0], - // para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - // para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - // para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - // para->getParD(level)->K_CF, - // para->getParD(level)->vis, para->getParD(level+1)->diffusivity, para->getParD(level)->numberofthreads); - //getLastCudaError("ScaleCFTh7 execution failed"); - - ScaleCFThSMG7( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - para->getParD(level)->d7.f[0], para->getParD(level+1)->d7.f[0], - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - para->getParD(level)->K_CF, - para->getParD(level)->vis, para->getParD(level+1)->diffusivity, para->getParD(level)->numberofthreads, - para->getParD(level)->offCF); - getLastCudaError("ScaleCFTh7 execution failed"); - } - else if (para->getDiffMod() == 27) - { - ScaleCFThS27( para->getParD(level)->d0SP.f[0], para->getParD(level+1)->d0SP.f[0], - para->getParD(level)->d27.f[0], para->getParD(level+1)->d27.f[0], - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - para->getParD(level+1)->neighborX_SP, para->getParD(level+1)->neighborY_SP, para->getParD(level+1)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, para->getParD(level+1)->size_Mat_SP, para->getParD(level)->evenOrOdd, - para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, - para->getParD(level)->K_CF, - para->getParD(level)->vis, para->getParD(level+1)->diffusivity, para->getParD(level)->numberofthreads, - para->getParD(level)->offCF); - getLastCudaError("ScaleCFTh27 execution failed"); + if (streamIndex != -1){ + printf("CoarseToFineWithStream Advection Diffusion not implemented"); // TODO + return; } - } - + this->gridScalingKernelManager->runCoarseToFineKernelAD(level); + } } -void interactWithActuators(Parameter* para, CudaMemoryManager* cudaManager, int level, unsigned int t) +void UpdateGrid27::interactWithActuators(int level, unsigned int t) { for( SPtr<PreCollisionInteractor> actuator: para->getActuators() ) { - actuator->interact(para, cudaManager, level, t); + actuator->interact(para.get(), cudaMemoryManager.get(), level, t); } } -void interactWithProbes(Parameter* para, CudaMemoryManager* cudaManager, int level, unsigned int t) +void UpdateGrid27::interactWithProbes(int level, unsigned int t) { for( SPtr<PreCollisionInteractor> probe: para->getProbes() ) { - probe->interact(para, cudaManager, level, t); + probe->interact(para.get(), cudaMemoryManager.get(), level, t); } -} \ No newline at end of file +} + +void UpdateGrid27::calcTurbulentViscosity(int level) +{ + this->tmFactory->runTurbulenceModelKernel(level); +} + +void UpdateGrid27::exchangeData(int level) +{ + exchangeMultiGPU_noStreams_withPrepare(level, false); +} + +UpdateGrid27::UpdateGrid27(SPtr<Parameter> para, vf::gpu::Communicator &comm, SPtr<CudaMemoryManager> cudaMemoryManager, + std::vector<std::shared_ptr<PorousMedia>> &pm, std::vector<SPtr<Kernel>> &kernels , BoundaryConditionFactory* bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory* scalingFactory) + : para(para), comm(comm), cudaMemoryManager(cudaMemoryManager), pm(pm), kernels(kernels), tmFactory(tmFactory) +{ + this->collision = getFunctionForCollisionAndExchange(para->getUseStreams(), para->getNumprocs(), para->getKernelNeedsFluidNodeIndicesToRun()); + this->refinement = getFunctionForRefinementAndExchange(para->getUseStreams(), para->getNumprocs(), para->getMaxLevel(), para->useReducedCommunicationAfterFtoC); + + this->bcKernelManager = std::make_shared<BCKernelManager>(para, bcFactory); + this->adKernelManager = std::make_shared<ADKernelManager>(para); + this->gridScalingKernelManager = std::make_shared<GridScalingKernelManager>(para, scalingFactory); +} diff --git a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h index ac0d13d6454e4002117dc2874df98172f8e79a30..8110923bf066412e2bb09ffa1f10efe3ddc983c7 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h +++ b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h @@ -8,34 +8,81 @@ #include "Communication/Communicator.h" #include "Calculation/PorousMedia.h" +class BCKernelManager; +class ADKernelManager; +class GridScalingKernelManager; class Kernel; +class BoundaryConditionFactory; +class GridScalingFactory; +class TurbulenceModelFactory; -extern "C" void updateGrid27(Parameter* para, - vf::gpu::Communicator& comm, - CudaMemoryManager* cudaManager, - std::vector<std::shared_ptr<PorousMedia>>& pm, - int level, - unsigned int t, - std::vector < SPtr< Kernel>>& kernels); +class UpdateGrid27; +using CollisionStrategy = std::function<void (UpdateGrid27* updateGrid, Parameter* para, int level, unsigned int t)>; +using RefinementStrategy = std::function<void (UpdateGrid27* updateGrid, Parameter* para, int level)>; -extern "C" void collision(Parameter* para, std::vector<std::shared_ptr<PorousMedia>>& pm, int level, unsigned int t, std::vector < SPtr< Kernel>>& kernels); -extern "C" void collisionPorousMedia(Parameter* para, std::vector<std::shared_ptr<PorousMedia>>& pm, int level); +class UpdateGrid27 +{ +public: + UpdateGrid27(SPtr<Parameter> para, vf::gpu::Communicator &comm, SPtr<CudaMemoryManager> cudaMemoryManager, + std::vector<std::shared_ptr<PorousMedia>> &pm, std::vector<SPtr<Kernel>> &kernels, BoundaryConditionFactory* bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory* scalingFactory); + void updateGrid(int level, unsigned int t); + void exchangeData(int level); -extern "C" void collisionAdvectionDiffusion(Parameter* para, int level); +private: + void collisionAllNodes(int level, unsigned int t); + void collisionUsingIndices(int level, unsigned int t, uint *fluidNodeIndices = nullptr, uint numberOfFluidNodes = 0, int stream = -1); + void collisionAdvectionDiffusion(int level); -extern "C" void exchangeMultiGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); + void postCollisionBC(int level); + void preCollisionBC(int level, unsigned int t); + void collisionPorousMedia(int level); -extern "C" void postCollisionBC(Parameter* para, int level, unsigned int t); + void fineToCoarse(int level, InterpolationCellFC* icellFC, OffFC &offFC, int streamIndex); + void coarseToFine(int level, InterpolationCellCF* icellCF, OffCF &offCF, int streamIndex); -extern "C" void swapBetweenEvenAndOddTimestep(Parameter* para, int level); + void prepareExchangeMultiGPU(int level, int streamIndex); + void prepareExchangeMultiGPUAfterFtoC(int level, int streamIndex); -extern "C" void calcMacroscopicQuantities(Parameter* para, int level); + void exchangeMultiGPU(int level, int streamIndex); + void exchangeMultiGPUAfterFtoC(int level, int streamIndex); + void exchangeMultiGPU_noStreams_withPrepare(int level, bool useReducedComm); -extern "C" void preCollisionBC(Parameter* para, CudaMemoryManager* cudaManager, int level, unsigned int t); + void swapBetweenEvenAndOddTimestep(int level); -extern "C" void fineToCoarse(Parameter* para, int level); + void calcMacroscopicQuantities(int level); + void calcTurbulentViscosity(int level); + void interactWithActuators(int level, unsigned int t); + void interactWithProbes(int level, unsigned int t); -extern "C" void coarseToFine(Parameter* para, int level); +private: + CollisionStrategy collision; + friend class CollisionAndExchange_noStreams_indexKernel; + friend class CollisionAndExchange_noStreams_oldKernel; + friend class CollisionAndExchange_streams; + + RefinementStrategy refinement; + friend class RefinementAndExchange_streams_exchangeInterface; + friend class RefinementAndExchange_streams_exchangeAllNodes; + friend class RefinementAndExchange_noStreams_exchangeInterface; + friend class RefinementAndExchange_noStreams_exchangeAllNodes; + friend class Refinement_noExchange; + friend class NoRefinement; + +private: + SPtr<Parameter> para; + vf::gpu::Communicator& comm; + SPtr<CudaMemoryManager> cudaMemoryManager; + std::vector<std::shared_ptr<PorousMedia>> pm; + std::vector<SPtr<Kernel>> kernels; + //! \property lbKernelManager is a shared pointer to an object of LBKernelManager + std::shared_ptr<BCKernelManager> bcKernelManager; + //! \property adKernelManager is a shared pointer to an object of ADKernelManager + std::shared_ptr<ADKernelManager> adKernelManager; + //! \property gridScalingKernelManager is a shared pointer to an object of GridScalingKernelManager + std::shared_ptr<GridScalingKernelManager> gridScalingKernelManager; + //! \property tmFactory is a shared pointer to an object of TurbulenceModelFactory + std::shared_ptr<TurbulenceModelFactory> tmFactory; +}; #endif diff --git a/src/gpu/VirtualFluids_GPU/Communication/CommunicationRoutine.h b/src/gpu/VirtualFluids_GPU/Communication/CommunicationRoutine.h new file mode 100644 index 0000000000000000000000000000000000000000..39866728b713c9c0c72cb5c62ba02f242e0ca68c --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Communication/CommunicationRoutine.h @@ -0,0 +1,19 @@ +#ifndef INDEX_EXCHANGE +#define INDEX_EXCHANGE + +#include <basics/Core/DataTypes.h> + +namespace vf::gpu +{ +class CommunicationRoutine +{ +public: + virtual ~CommunicationRoutine() = default; + + virtual void receive_send(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, + int size_buffer_send, int neighbor_rank_send) const = 0; + virtual int getPID() const = 0; +}; +} // namespace vf::gpu + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Communication/Communicator.cpp b/src/gpu/VirtualFluids_GPU/Communication/Communicator.cpp index 2743f454e321bf21cb4d0b7fd08aab8600a2bee8..5df66c788b2186b0bdfad1afa4798cee670ba53b 100644 --- a/src/gpu/VirtualFluids_GPU/Communication/Communicator.cpp +++ b/src/gpu/VirtualFluids_GPU/Communication/Communicator.cpp @@ -28,6 +28,10 @@ Communicator::Communicator() MPI_Comm_rank(MPI_COMM_WORLD, &PID); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); + commGPU = MPI_COMM_WORLD; + requestGPU.resize(0); + rcount = 0; + // Get a new communicator for a decomposition of the domain int isperiodic[1] = { 0 }; MPI_Cart_create(MPI_COMM_WORLD, 1, &numprocs, isperiodic, 1, &comm1d); @@ -215,4 +219,39 @@ int Communicator::mapCudaDevice(const int &rank, const int &size, const std::vec return device; } +std::vector<double> Communicator::gatherNUPS(double processNups) +{ + double *buffer_send = &processNups; + double *buffer_recv = (double *)malloc(sizeof(double) * this->numprocs); + + MPI_Gather(buffer_send, 1, MPI_DOUBLE, buffer_recv, 1, MPI_DOUBLE, 0, commGPU); + + if (this->PID == 0) + return std::vector<double>(buffer_recv, buffer_recv + this->numprocs); + return std::vector<double>(); } + +double Communicator::sumNups(double processNups) +{ + double *buffer_send = &processNups; + double *buffer_recv = (double *)malloc(sizeof(double)); + + MPI_Reduce(buffer_send, buffer_recv, 1, MPI_DOUBLE, MPI_SUM, 0, commGPU); + + return *buffer_recv; +} + +void Communicator::receive_send(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, + int size_buffer_send, int neighbor_rank_send) const +{ + MPI_Request recv_request; + MPI_Irecv(buffer_receive, size_buffer_recv, MPI_UNSIGNED, neighbor_rank_recv, 0, commGPU, &recv_request); + //printf("receive_send PID: %i, nbRev: nb_rank_recv: %i", this->getPID(), nb_rank_r); + //fflush(stdout); + MPI_Send(buffer_send, size_buffer_send, MPI_UNSIGNED, neighbor_rank_send, 0, commGPU); + //printf("receive_send PID: %i, sendUintGPU: nb_rank_send: %i", this->getPID(), nb_rank_s); + //fflush(stdout); + MPI_Wait(&recv_request, MPI_STATUSES_IGNORE); +} + +} // namespace vf::gpu diff --git a/src/gpu/VirtualFluids_GPU/Communication/Communicator.h b/src/gpu/VirtualFluids_GPU/Communication/Communicator.h index 256dde87e8ff6b3a8c7abcae0ac31466cc68ba95..aa63e1a09c305ceb5abe2b567b6988753bc48345 100644 --- a/src/gpu/VirtualFluids_GPU/Communication/Communicator.h +++ b/src/gpu/VirtualFluids_GPU/Communication/Communicator.h @@ -7,73 +7,78 @@ #include "VirtualFluids_GPU_export.h" +#include "CommunicationRoutine.h" #include <basics/Core/DataTypes.h> ////////////////////////////////// #ifdef VF_DOUBLE_ACCURACY -#define MPI_Type_GPU MPI_DOUBLE +#define MPI_Type_GPU MPI_DOUBLE #else -#define MPI_Type_GPU MPI_FLOAT +#define MPI_Type_GPU MPI_FLOAT #endif ////////////////////////////////// - namespace vf::gpu { - -class VIRTUALFLUIDS_GPU_EXPORT Communicator +class VIRTUALFLUIDS_GPU_EXPORT Communicator : public CommunicationRoutine { public: - static Communicator& getInstance(); - Communicator(const Communicator&) = delete; - Communicator& operator=(const Communicator&) = delete; + static Communicator &getInstance(); + Communicator(const Communicator &) = delete; + Communicator &operator=(const Communicator &) = delete; + ~Communicator() override; - void exchngBottomToTop(float* sbuf, float* rbuf, int count); - void exchngTopToBottom(float* sbuf, float* rbuf, int count); + void exchngBottomToTop(float *sbuf, float *rbuf, int count); + void exchngTopToBottom(float *sbuf, float *rbuf, int count); void waitAll(); - void distributeGeometry(unsigned int* dataRoot, unsigned int* dataNode, int dataSizePerNode); - int getPID() const; + void distributeGeometry(unsigned int *dataRoot, unsigned int *dataNode, int dataSizePerNode); + int getPID() const override; int getNummberOfProcess() const; int getNeighbourTop(); int getNeighbourBottom(); - void exchngData(float* sbuf_t, float* rbuf_t, float* sbuf_b, float* rbuf_b, int count); - void exchngDataNB(float* sbuf_t, int count_st, float* rbuf_t, int count_rt, float* sbuf_b, int count_sb, float* rbuf_b, int count_rb); + void exchngData(float *sbuf_t, float *rbuf_t, float *sbuf_b, float *rbuf_b, int count); + void exchngDataNB(float *sbuf_t, int count_st, float *rbuf_t, int count_rt, float *sbuf_b, int count_sb, + float *rbuf_b, int count_rb); ////////////////////////////////////////////////////////////////////////// - void exchngDataGPU(real* sbuf, int count_s, real* rbuf, int count_r, int nb_rank); - void sendRecvGPU(real* sbuf, int count_s, real* rbuf, int count_r, int nb_rank); - void nbRecvDataGPU( real* rbuf, int count_r, int nb_rank ); - void nbSendDataGPU( real* sbuf, int count_s, int nb_rank ); + void exchngDataGPU(real *sbuf, int count_s, real *rbuf, int count_r, int nb_rank); + void sendRecvGPU(real *sbuf, int count_s, real *rbuf, int count_r, int nb_rank); + void nbRecvDataGPU(real *rbuf, int count_r, int nb_rank); + void nbSendDataGPU(real *sbuf, int count_s, int nb_rank); void waitallGPU(); - void sendDataGPU( real* sbuf, int count_s, int nb_rank ); + void sendDataGPU(real *sbuf, int count_s, int nb_rank); void waitGPU(int id); void resetRequest(); void barrierGPU(); void barrier(); ////////////////////////////////////////////////////////////////////////// - void exchngDataGeo(int* sbuf_t, int* rbuf_t, int* sbuf_b, int* rbuf_b, int count); + void exchngDataGeo(int *sbuf_t, int *rbuf_t, int *sbuf_b, int *rbuf_b, int count); MPI_Comm getCommunicator(); void startTimer(); void stopTimer(); double getTime(); int mapCudaDevice(const int &rank, const int &size, const std::vector<unsigned int> &devices, const int &maxdev); + std::vector<double> gatherNUPS(double processNups); + double sumNups(double processNups); + ////////////////////////////////////////////////////////////////////////// + void receive_send(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, + int size_buffer_send, int neighbor_rank_send) const override; + private: - int numprocs, PID; - int nbrbottom, nbrtop; - MPI_Comm comm1d, commGPU; - MPI_Status status[4]; - MPI_Request request[4]; - ////////////////////////////////////////////////////////////////////////// - std::vector<MPI_Request> requestGPU; - int rcount; - ////////////////////////////////////////////////////////////////////////// - double starttime; - double endtime; - Communicator(); - ~Communicator(); + int numprocs, PID; + int nbrbottom, nbrtop; + MPI_Comm comm1d, commGPU; + MPI_Status status[4]; + MPI_Request request[4]; + ////////////////////////////////////////////////////////////////////////// + std::vector<MPI_Request> requestGPU; + int rcount; + ////////////////////////////////////////////////////////////////////////// + double starttime; + double endtime; + Communicator(); }; -} +} // namespace vf::gpu #endif - diff --git a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp index d91e86c3140bb08aa2d8ef28d7cc147b23a2b804..36c250401e0775b3abcc7d25c0f89fde0556631e 100644 --- a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp +++ b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp @@ -1,511 +1,396 @@ -#include "Communication/ExchangeData27.h" -#include <cuda_runtime.h> #include <helper_cuda.h> +#include <cuda_runtime.h> + +#include "Communication/ExchangeData27.h" +#include "Parameter/CudaStreamManager.h" + +using namespace vf::lbm::dir; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//3D domain decomposition +// 3D domain decomposition //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// X +// 3D domain decomposition: functions used by all directions //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePreCollDataXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void collectNodesInSendBufferGPU(Parameter *para, int level, int streamIndex, + std::vector<ProcessNeighbor27> *sendProcessNeighbor, + unsigned int numberOfSendProcessNeighbors) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - GetSendFsPreDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->sendProcessNeighborX[i].f[0], - para->getParD(level)->sendProcessNeighborX[i].index, - para->getParD(level)->sendProcessNeighborX[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborXFsDH(level, i); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborX[i].f[0], - para->getParH(level)->recvProcessNeighborX[i].numberOfFs, - para->getParH(level)->recvProcessNeighborX[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborX[i].f[0], - // para->getParH(level)->sendProcessNeighborX[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborX[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborX[i].f[0], - para->getParH(level)->sendProcessNeighborX[i].numberOfFs, - para->getParH(level)->sendProcessNeighborX[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborXFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPreDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->recvProcessNeighborX[i].f[0], - para->getParD(level)->recvProcessNeighborX[i].index, - para->getParD(level)->recvProcessNeighborX[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + cudaStream_t stream = (streamIndex == -1) ? CU_STREAM_LEGACY : para->getStreamManager()->getStream(streamIndex); + + for (unsigned int i = 0; i < numberOfSendProcessNeighbors; i++) { + GetSendFsPostDev27(para->getParD(level)->distributions.f[0], + (*sendProcessNeighbor)[i].f[0], + (*sendProcessNeighbor)[i].index, + (*sendProcessNeighbor)[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads, + stream); + } } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePostCollDataXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) + +void scatterNodesFromRecvBufferGPU(Parameter *para, int level, int streamIndex, + std::vector<ProcessNeighbor27> *recvProcessNeighborDev, + unsigned int numberOfRecvProcessNeighbors) +{ + cudaStream_t stream = (streamIndex == -1) ? CU_STREAM_LEGACY : para->getStreamManager()->getStream(streamIndex); + for (unsigned int i = 0; i < numberOfRecvProcessNeighbors; i++) { + SetRecvFsPostDev27(para->getParD(level)->distributions.f[0], + (*recvProcessNeighborDev)[i].f[0], + (*recvProcessNeighborDev)[i].index, + (*recvProcessNeighborDev)[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads, + stream); + } +} + +void startBlockingMpiSend(unsigned int numberOfSendProcessNeighbors, vf::gpu::Communicator &comm, + std::vector<ProcessNeighbor27> *sendProcessNeighborHost) +{ + for (unsigned int i = 0; i < numberOfSendProcessNeighbors; i++) { + comm.sendDataGPU((*sendProcessNeighborHost)[i].f[0], + (*sendProcessNeighborHost)[i].numberOfFs, + (*sendProcessNeighborHost)[i].rankNeighbor); + } +} + +void startNonBlockingMpiReceive(unsigned int numberOfSendProcessNeighbors, vf::gpu::Communicator &comm, + std::vector<ProcessNeighbor27> *recvProcessNeighborHost) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - GetSendFsPostDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->sendProcessNeighborX[i].f[0], - para->getParD(level)->sendProcessNeighborX[i].index, - para->getParD(level)->sendProcessNeighborX[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborXFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborX[i].f[0], - para->getParH(level)->recvProcessNeighborX[i].numberOfFs, - para->getParH(level)->recvProcessNeighborX[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborX[i].f[0], - // para->getParH(level)->sendProcessNeighborX[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborX[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborX[i].f[0], - para->getParH(level)->sendProcessNeighborX[i].numberOfFs, - para->getParH(level)->sendProcessNeighborX[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborXFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPostDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->recvProcessNeighborX[i].f[0], - para->getParD(level)->recvProcessNeighborX[i].index, - para->getParD(level)->recvProcessNeighborX[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + for (unsigned int i = 0; i < numberOfSendProcessNeighbors; i++) { + comm.nbRecvDataGPU((*recvProcessNeighborHost)[i].f[0], + (*recvProcessNeighborHost)[i].numberOfFs, + (*recvProcessNeighborHost)[i].rankNeighbor); + } } + +void copyEdgeNodes(std::vector<LBMSimulationParameter::EdgeNodePositions> &edgeNodes, + std::vector<ProcessNeighbor27> &recvProcessNeighborHost, + std::vector<ProcessNeighbor27> &sendProcessNeighborHost) +{ + int indexInSubdomainRecv = 0; + int indexInSubdomainSend = 0; + int numNodesInBufferRecv = 0; + int numNodesInBufferSend = 0; + +#pragma omp parallel for + for (uint i = 0; i < edgeNodes.size(); i++) { + indexInSubdomainRecv = edgeNodes[i].indexOfProcessNeighborRecv; + indexInSubdomainSend = edgeNodes[i].indexOfProcessNeighborSend; + numNodesInBufferRecv = recvProcessNeighborHost[indexInSubdomainRecv].numberOfNodes; + numNodesInBufferSend = sendProcessNeighborHost[indexInSubdomainSend].numberOfNodes; + if(edgeNodes[i].indexInSendBuffer >= numNodesInBufferSend){ + // for reduced communication after fine to coarse: only copy send nodes which are not part of the reduced comm + continue; + } + + // copy fs for all directions + for (int direction = 0; direction <= (int)ENDDIR; direction++) { + (sendProcessNeighborHost[indexInSubdomainSend].f[0] + + (direction * numNodesInBufferSend))[edgeNodes[i].indexInSendBuffer] = + (recvProcessNeighborHost[indexInSubdomainRecv].f[0] + + (direction * numNodesInBufferRecv))[edgeNodes[i].indexInRecvBuffer]; + } + } +} + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// X +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void prepareExchangeCollDataXGPU27AllNodes(Parameter *para, int level, int streamIndex) +{ + collectNodesInSendBufferGPU(para, level, streamIndex, ¶->getParD(level)->sendProcessNeighborX, + (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))); +} +void prepareExchangeCollDataXGPU27AfterFtoC(Parameter *para, int level, int streamIndex) +{ + collectNodesInSendBufferGPU(para, level, streamIndex, ¶->getParD(level)->sendProcessNeighborsAfterFtoCX, + (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))); +} +void exchangeCollDataXGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level, int streamIndex) +{ + exchangeCollDataXGPU27(para, comm, cudaMemoryManager, level, streamIndex, + ¶->getParD(level)->sendProcessNeighborX, + ¶->getParD(level)->recvProcessNeighborX, + ¶->getParH(level)->sendProcessNeighborX, + ¶->getParH(level)->recvProcessNeighborX); +} + +void exchangeCollDataXGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level, int streamIndex) +{ + exchangeCollDataXGPU27(para, comm, cudaMemoryManager, level, streamIndex, + ¶->getParD(level)->sendProcessNeighborsAfterFtoCX, + ¶->getParD(level)->recvProcessNeighborsAfterFtoCX, + ¶->getParH(level)->sendProcessNeighborsAfterFtoCX, + ¶->getParH(level)->recvProcessNeighborsAfterFtoCX); +} + +void scatterNodesFromRecvBufferXGPU27AllNodes(Parameter *para, int level, int streamIndex) +{ + scatterNodesFromRecvBufferGPU(para, level, streamIndex, ¶->getParD(level)->recvProcessNeighborX, + (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))); +} +void scatterNodesFromRecvBufferXGPU27AfterFtoC(Parameter *para, int level, int streamIndex) +{ + scatterNodesFromRecvBufferGPU(para, level, streamIndex, ¶->getParD(level)->recvProcessNeighborsAfterFtoCX, + (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))); +} + +void exchangeCollDataXGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, int level, + int streamIndex, + std::vector<ProcessNeighbor27> *sendProcessNeighborDev, + std::vector<ProcessNeighbor27> *recvProcessNeighborDev, + std::vector<ProcessNeighbor27> *sendProcessNeighborHost, + std::vector<ProcessNeighbor27> *recvProcessNeighborHost) +{ + cudaStream_t stream = (streamIndex == -1) ? CU_STREAM_LEGACY : para->getStreamManager()->getStream(streamIndex); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //! \details steps: + //! 1. copy data from device to host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + cudaMemoryManager->cudaCopyProcessNeighborXFsDH(level, i, (*sendProcessNeighborDev)[i].memsizeFs, streamIndex); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //! 2. start non-blocking receive (MPI) + startNonBlockingMpiReceive((unsigned int)(*sendProcessNeighborHost).size(), comm, recvProcessNeighborHost); + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //! 3. before sending data, wait for memcopy (from device to host) to finish + if (para->getUseStreams()) cudaStreamSynchronize(stream); + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //! 4. send data to neighboring process (MPI) + startBlockingMpiSend((unsigned int)(*sendProcessNeighborHost).size(), comm, sendProcessNeighborHost); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //! 5. wait for until data is received + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) comm.waitGPU(i); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //! 6. reset the request array, which was used for the mpi communication + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) comm.resetRequest(); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //! 7. copy received data from host to device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + cudaMemoryManager->cudaCopyProcessNeighborXFsHD(level, i, (*recvProcessNeighborDev)[i].memsizeFs, streamIndex); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Y //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePreCollDataYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void prepareExchangeCollDataYGPU27AllNodes(Parameter *para, int level, int streamIndex) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - GetSendFsPreDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->sendProcessNeighborY[i].f[0], - para->getParD(level)->sendProcessNeighborY[i].index, - para->getParD(level)->sendProcessNeighborY[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborYFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborY[i].f[0], - para->getParH(level)->recvProcessNeighborY[i].numberOfFs, - para->getParH(level)->recvProcessNeighborY[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborY[i].f[0], - // para->getParH(level)->sendProcessNeighborY[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborY[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborY[i].f[0], - para->getParH(level)->sendProcessNeighborY[i].numberOfFs, - para->getParH(level)->sendProcessNeighborY[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborYFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPreDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->recvProcessNeighborY[i].f[0], - para->getParD(level)->recvProcessNeighborY[i].index, - para->getParD(level)->recvProcessNeighborY[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + collectNodesInSendBufferGPU(para, level, streamIndex, ¶->getParD(level)->sendProcessNeighborY, + (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))); } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePostCollDataYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) + +void prepareExchangeCollDataYGPU27AfterFtoC(Parameter *para, int level, int streamIndex) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - GetSendFsPostDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->sendProcessNeighborY[i].f[0], - para->getParD(level)->sendProcessNeighborY[i].index, - para->getParD(level)->sendProcessNeighborY[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborYFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborY[i].f[0], - para->getParH(level)->recvProcessNeighborY[i].numberOfFs, - para->getParH(level)->recvProcessNeighborY[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborY[i].f[0], - // para->getParH(level)->sendProcessNeighborY[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborY[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborY[i].f[0], - para->getParH(level)->sendProcessNeighborY[i].numberOfFs, - para->getParH(level)->sendProcessNeighborY[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborYFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPostDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->recvProcessNeighborY[i].f[0], - para->getParD(level)->recvProcessNeighborY[i].index, - para->getParD(level)->recvProcessNeighborY[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + collectNodesInSendBufferGPU(para, level, streamIndex, ¶->getParD(level)->sendProcessNeighborsAfterFtoCY, + (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))); +} + +void exchangeCollDataYGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level, int streamIndex) +{ + exchangeCollDataYGPU27(para, comm, cudaMemoryManager, level, streamIndex, + ¶->getParD(level)->sendProcessNeighborY, + ¶->getParD(level)->recvProcessNeighborY, + ¶->getParH(level)->sendProcessNeighborY, + ¶->getParH(level)->recvProcessNeighborY); } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void exchangeCollDataYGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level, int streamIndex) +{ + exchangeCollDataYGPU27(para, comm, cudaMemoryManager, level, streamIndex, + ¶->getParD(level)->sendProcessNeighborsAfterFtoCY, + ¶->getParD(level)->recvProcessNeighborsAfterFtoCY, + ¶->getParH(level)->sendProcessNeighborsAfterFtoCY, + ¶->getParH(level)->recvProcessNeighborsAfterFtoCY); +} +void scatterNodesFromRecvBufferYGPU27AllNodes(Parameter *para, int level, int streamIndex) +{ + scatterNodesFromRecvBufferGPU(para, level, streamIndex, ¶->getParD(level)->recvProcessNeighborY, + (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))); +} +void scatterNodesFromRecvBufferYGPU27AfterFtoC(Parameter *para, int level, int streamIndex) +{ + scatterNodesFromRecvBufferGPU(para, level, streamIndex, ¶->getParD(level)->recvProcessNeighborsAfterFtoCY, + (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))); +} + +void exchangeCollDataYGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, int level, + int streamIndex, std::vector<ProcessNeighbor27> *sendProcessNeighborDev, + std::vector<ProcessNeighbor27> *recvProcessNeighborDev, + std::vector<ProcessNeighbor27> *sendProcessNeighborHost, + std::vector<ProcessNeighbor27> *recvProcessNeighborHost) +{ + cudaStream_t stream = (streamIndex == -1) ? CU_STREAM_LEGACY : para->getStreamManager()->getStream(streamIndex); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // copy Device to Host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + cudaMemoryManager->cudaCopyProcessNeighborYFsDH(level, i, (*sendProcessNeighborDev)[i].memsizeFs, streamIndex); + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + startNonBlockingMpiReceive((unsigned int)(*sendProcessNeighborHost).size(), comm, recvProcessNeighborHost); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // wait for memcopy device to host to finish before sending data + if (para->getUseStreams()) + cudaStreamSynchronize(stream); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // edge nodes: copy received node values from x + if (para->getUseStreams() && para->getNumberOfProcessNeighborsX(level, "recv") > 0 && + para->getParH(level)->sendProcessNeighborY.size() != 0) { + if (para->getParH(level)->sendProcessNeighborY[0].numberOfNodes == + (*sendProcessNeighborHost)[0].numberOfNodes) { + // check if in communication of all nodes (as opposed to reduced communication after fine to coarse) + copyEdgeNodes(para->getParH(level)->edgeNodesXtoY, para->getParH(level)->recvProcessNeighborX, + *sendProcessNeighborHost); + } else { + copyEdgeNodes(para->getParH(level)->edgeNodesXtoY, para->getParH(level)->recvProcessNeighborsAfterFtoCX, + *sendProcessNeighborHost); + } + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + startBlockingMpiSend((unsigned int)(*sendProcessNeighborHost).size(), comm, sendProcessNeighborHost); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // wait + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) comm.waitGPU(i); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // reset the request array + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) comm.resetRequest(); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // copy Host to Device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) { + cudaMemoryManager->cudaCopyProcessNeighborYFsHD(level, i, (*recvProcessNeighborDev)[i].memsizeFs, streamIndex); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Z //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePreCollDataZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void prepareExchangeCollDataZGPU27AllNodes(Parameter *para, int level, int streamIndex) +{ + collectNodesInSendBufferGPU(para, level, streamIndex, ¶->getParD(level)->sendProcessNeighborZ, + (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))); +} + +void prepareExchangeCollDataZGPU27AfterFtoC(Parameter *para, int level, int streamIndex) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - GetSendFsPreDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->sendProcessNeighborZ[i].f[0], - para->getParD(level)->sendProcessNeighborZ[i].index, - para->getParD(level)->sendProcessNeighborZ[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborZFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborZ[i].f[0], - para->getParH(level)->recvProcessNeighborZ[i].numberOfFs, - para->getParH(level)->recvProcessNeighborZ[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborZ[i].f[0], - // para->getParH(level)->sendProcessNeighborZ[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborZ[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborZ[i].f[0], - para->getParH(level)->sendProcessNeighborZ[i].numberOfFs, - para->getParH(level)->sendProcessNeighborZ[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborZFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPreDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->recvProcessNeighborZ[i].f[0], - para->getParD(level)->recvProcessNeighborZ[i].index, - para->getParD(level)->recvProcessNeighborZ[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + collectNodesInSendBufferGPU(para, level, streamIndex, ¶->getParD(level)->sendProcessNeighborsAfterFtoCZ, + (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))); } + +void exchangeCollDataZGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level, int streamIndex) +{ + exchangeCollDataZGPU27(para, comm, cudaMemoryManager, level, streamIndex, + ¶->getParD(level)->sendProcessNeighborZ, + ¶->getParD(level)->recvProcessNeighborZ, + ¶->getParH(level)->sendProcessNeighborZ, + ¶->getParH(level)->recvProcessNeighborZ); +} +void exchangeCollDataZGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level, int streamIndex) +{ + exchangeCollDataZGPU27(para, comm, cudaMemoryManager, level, streamIndex, + ¶->getParD(level)->sendProcessNeighborsAfterFtoCZ, + ¶->getParD(level)->recvProcessNeighborsAfterFtoCZ, + ¶->getParH(level)->sendProcessNeighborsAfterFtoCZ, + ¶->getParH(level)->recvProcessNeighborsAfterFtoCZ); +} + +void scatterNodesFromRecvBufferZGPU27AllNodes(Parameter *para, int level, int streamIndex) +{ + scatterNodesFromRecvBufferGPU(para, level, streamIndex, ¶->getParD(level)->recvProcessNeighborZ, + (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))); +} + +void scatterNodesFromRecvBufferZGPU27AfterFtoC(Parameter *para, int level, int streamIndex) +{ + scatterNodesFromRecvBufferGPU(para, level, streamIndex, ¶->getParD(level)->recvProcessNeighborsAfterFtoCZ, + (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))); +} + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePostCollDataZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangeCollDataZGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, int level, + int streamIndex, std::vector<ProcessNeighbor27> *sendProcessNeighborDev, + std::vector<ProcessNeighbor27> *recvProcessNeighborDev, + std::vector<ProcessNeighbor27> *sendProcessNeighborHost, + std::vector<ProcessNeighbor27> *recvProcessNeighborHost) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - GetSendFsPostDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->sendProcessNeighborZ[i].f[0], - para->getParD(level)->sendProcessNeighborZ[i].index, - para->getParD(level)->sendProcessNeighborZ[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborZFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborZ[i].f[0], - para->getParH(level)->recvProcessNeighborZ[i].numberOfFs, - para->getParH(level)->recvProcessNeighborZ[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborZ[i].f[0], - // para->getParH(level)->sendProcessNeighborZ[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborZ[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborZ[i].f[0], - para->getParH(level)->sendProcessNeighborZ[i].numberOfFs, - para->getParH(level)->sendProcessNeighborZ[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborZFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPostDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->recvProcessNeighborZ[i].f[0], - para->getParD(level)->recvProcessNeighborZ[i].index, - para->getParD(level)->recvProcessNeighborZ[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + cudaStream_t stream = (streamIndex == -1) ? CU_STREAM_LEGACY : para->getStreamManager()->getStream(streamIndex); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // copy Device to Host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + cudaMemoryManager->cudaCopyProcessNeighborZFsDH(level, i, (*sendProcessNeighborDev)[i].memsizeFs, streamIndex); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + startNonBlockingMpiReceive((unsigned int)(*sendProcessNeighborHost).size(), comm, recvProcessNeighborHost); + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // wait for memcopy device to host to finish before sending data + if (para->getUseStreams()) + cudaStreamSynchronize(stream); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // edge nodes: copy received node values from x + if (para->getUseStreams() && para->getNumberOfProcessNeighborsX(level, "recv") > 0 && + para->getParH(level)->sendProcessNeighborZ.size() != 0) { + if (para->getParH(level)->sendProcessNeighborZ[0].numberOfNodes == + (*sendProcessNeighborHost)[0].numberOfNodes) { + // check if in communication of all nodes (as opposed to reduced communication after fine to coarse) + copyEdgeNodes(para->getParH(level)->edgeNodesXtoZ, para->getParH(level)->recvProcessNeighborX, + *sendProcessNeighborHost); + } else { + copyEdgeNodes(para->getParH(level)->edgeNodesXtoZ, para->getParH(level)->recvProcessNeighborsAfterFtoCX, + *sendProcessNeighborHost); + } + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // edge nodes: copy received node values from y + if (para->getUseStreams() && para->getNumberOfProcessNeighborsY(level, "recv") > 0 && + para->getParH(level)->sendProcessNeighborZ.size() != 0) { + if (para->getParH(level)->sendProcessNeighborZ[0].numberOfNodes == + (*sendProcessNeighborHost)[0].numberOfNodes) { + // check if in communication of all nodes (as opposed to reduced communication after fine to coarse) + copyEdgeNodes(para->getParH(level)->edgeNodesYtoZ, para->getParH(level)->recvProcessNeighborY, + *sendProcessNeighborHost); + } else { + copyEdgeNodes(para->getParH(level)->edgeNodesYtoZ, para->getParH(level)->recvProcessNeighborsAfterFtoCY, + *sendProcessNeighborHost); + } + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + startBlockingMpiSend((unsigned int)(*sendProcessNeighborHost).size(), comm, sendProcessNeighborHost); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // wait + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) comm.waitGPU(i); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // reset the request array + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) comm.resetRequest(); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // copy Host to Device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + cudaMemoryManager->cudaCopyProcessNeighborZFsHD(level, i, (*recvProcessNeighborDev)[i].memsizeFs, streamIndex); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -529,44 +414,44 @@ void exchangePostCollDataZGPU27(Parameter* para, vf::gpu::Communicator& comm, Cu //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //1D domain decomposition //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePreCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangePreCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighbors(level, "send")); i++) - { - ////////////////////////////////////////////////////////////////////////// - GetSendFsPreDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->sendProcessNeighbor[i].f[0], - para->getParD(level)->sendProcessNeighbor[i].index, - para->getParD(level)->sendProcessNeighbor[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborFsDH(level, i); - ////////////////////////////////////////////////////////////////////////// - comm.exchngDataGPU(para->getParH(level)->sendProcessNeighbor[i].f[0], - para->getParH(level)->sendProcessNeighbor[i].numberOfFs, - para->getParH(level)->recvProcessNeighbor[i].f[0], - para->getParH(level)->recvProcessNeighbor[i].numberOfFs, - para->getParH(level)->sendProcessNeighbor[i].rankNeighbor); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPreDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->recvProcessNeighbor[i].f[0], - para->getParD(level)->recvProcessNeighbor[i].index, - para->getParD(level)->recvProcessNeighbor[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - } + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighbors(level, "send")); i++) + { + ////////////////////////////////////////////////////////////////////////// + GetSendFsPreDev27(para->getParD(level)->distributions.f[0], + para->getParD(level)->sendProcessNeighbor[i].f[0], + para->getParD(level)->sendProcessNeighbor[i].index, + para->getParD(level)->sendProcessNeighbor[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborFsDH(level, i); + ////////////////////////////////////////////////////////////////////////// + comm.exchngDataGPU(para->getParH(level)->sendProcessNeighbor[i].f[0], + para->getParH(level)->sendProcessNeighbor[i].numberOfFs, + para->getParH(level)->recvProcessNeighbor[i].f[0], + para->getParH(level)->recvProcessNeighbor[i].numberOfFs, + para->getParH(level)->sendProcessNeighbor[i].rankNeighbor); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborFsHD(level, i); + ////////////////////////////////////////////////////////////////////////// + SetRecvFsPreDev27(para->getParD(level)->distributions.f[0], + para->getParD(level)->recvProcessNeighbor[i].f[0], + para->getParD(level)->recvProcessNeighbor[i].index, + para->getParD(level)->recvProcessNeighbor[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -574,133 +459,85 @@ void exchangePreCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cuda //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighbors(level, "send")); i++) - { - ////////////////////////////////////////////////////////////////////////// - GetSendFsPostDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->sendProcessNeighbor[i].f[0], - para->getParD(level)->sendProcessNeighbor[i].index, - para->getParD(level)->sendProcessNeighbor[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborFsDH(level, i); - ////////////////////////////////////////////////////////////////////////// - comm.exchngDataGPU(para->getParH(level)->sendProcessNeighbor[i].f[0], - para->getParH(level)->sendProcessNeighbor[i].numberOfFs, - para->getParH(level)->recvProcessNeighbor[i].f[0], - para->getParH(level)->recvProcessNeighbor[i].numberOfFs, - para->getParH(level)->sendProcessNeighbor[i].rankNeighbor); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPostDev27(para->getParD(level)->d0SP.f[0], - para->getParD(level)->recvProcessNeighbor[i].f[0], - para->getParD(level)->recvProcessNeighbor[i].index, - para->getParD(level)->recvProcessNeighbor[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - } + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighbors(level, "send")); i++) + { + ////////////////////////////////////////////////////////////////////////// + GetSendFsPostDev27(para->getParD(level)->distributions.f[0], + para->getParD(level)->sendProcessNeighbor[i].f[0], + para->getParD(level)->sendProcessNeighbor[i].index, + para->getParD(level)->sendProcessNeighbor[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborFsDH(level, i); + ////////////////////////////////////////////////////////////////////////// + comm.exchngDataGPU(para->getParH(level)->sendProcessNeighbor[i].f[0], + para->getParH(level)->sendProcessNeighbor[i].numberOfFs, + para->getParH(level)->recvProcessNeighbor[i].f[0], + para->getParH(level)->recvProcessNeighbor[i].numberOfFs, + para->getParH(level)->sendProcessNeighbor[i].rankNeighbor); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborFsHD(level, i); + ////////////////////////////////////////////////////////////////////////// + SetRecvFsPostDev27(para->getParD(level)->distributions.f[0], + para->getParD(level)->recvProcessNeighbor[i].f[0], + para->getParD(level)->recvProcessNeighbor[i].index, + para->getParD(level)->recvProcessNeighbor[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + } } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -////3D domain decomposition -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//// X -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//void exchangePreCollDataXGPU27(Parameter* para, vf::gpu::Communicator& comm, int level) -//{ -// for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) -// { -// ////////////////////////////////////////////////////////////////////////// -// GetSendFsPreDev27(para->getParD(level)->d0SP.f[0], -// para->getParD(level)->sendProcessNeighborX[i].f[0], -// para->getParD(level)->sendProcessNeighborX[i].index, -// para->getParD(level)->sendProcessNeighborX[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborXFsDH(level, i); -// ////////////////////////////////////////////////////////////////////////// -// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborX[i].f[0], -// para->getParH(level)->sendProcessNeighborX[i].numberOfFs, -// para->getParH(level)->recvProcessNeighborX[i].f[0], -// para->getParH(level)->recvProcessNeighborX[i].numberOfFs, -// para->getParH(level)->sendProcessNeighborX[i].rankNeighbor); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborXFsHD(level, i); -// ////////////////////////////////////////////////////////////////////////// -// SetRecvFsPreDev27(para->getParD(level)->d0SP.f[0], -// para->getParD(level)->recvProcessNeighborX[i].f[0], -// para->getParD(level)->recvProcessNeighborX[i].index, -// para->getParD(level)->recvProcessNeighborX[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// } -//} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //void exchangePostCollDataXGPU27(Parameter* para, vf::gpu::Communicator& comm, int level) //{ -// for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) -// { -// ////////////////////////////////////////////////////////////////////////// -// GetSendFsPostDev27( para->getParD(level)->d0SP.f[0], -// para->getParD(level)->sendProcessNeighborX[i].f[0], -// para->getParD(level)->sendProcessNeighborX[i].index, -// para->getParD(level)->sendProcessNeighborX[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborXFsDH(level, i); -// ////////////////////////////////////////////////////////////////////////// -// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborX[i].f[0], -// para->getParH(level)->sendProcessNeighborX[i].numberOfFs, -// para->getParH(level)->recvProcessNeighborX[i].f[0], -// para->getParH(level)->recvProcessNeighborX[i].numberOfFs, -// para->getParH(level)->sendProcessNeighborX[i].rankNeighbor); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborXFsHD(level, i); -// ////////////////////////////////////////////////////////////////////////// -// SetRecvFsPostDev27( para->getParD(level)->d0SP.f[0], -// para->getParD(level)->recvProcessNeighborX[i].f[0], -// para->getParD(level)->recvProcessNeighborX[i].index, -// para->getParD(level)->recvProcessNeighborX[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// } +// for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) +// { +// ////////////////////////////////////////////////////////////////////////// +// GetSendFsPostDev27( para->getParD(level)->distributions.f[0], +// para->getParD(level)->sendProcessNeighborX[i].f[0], +// para->getParD(level)->sendProcessNeighborX[i].index, +// para->getParD(level)->sendProcessNeighborX[i].numberOfNodes, +// para->getParD(level)->neighborX, +// para->getParD(level)->neighborY_SP, +// para->getParD(level)->neighborZ, +// para->getParD(level)->numberOfNodes, +// para->getParD(level)->isEvenTimestep, +// para->getParD(level)->numberofthreads); +// ////////////////////////////////////////////////////////////////////////// +// para->cudaCopyProcessNeighborXFsDH(level, i); +// ////////////////////////////////////////////////////////////////////////// +// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborX[i].f[0], +// para->getParH(level)->sendProcessNeighborX[i].numberOfFs, +// para->getParH(level)->recvProcessNeighborX[i].f[0], +// para->getParH(level)->recvProcessNeighborX[i].numberOfFs, +// para->getParH(level)->sendProcessNeighborX[i].rankNeighbor); +// ////////////////////////////////////////////////////////////////////////// +// para->cudaCopyProcessNeighborXFsHD(level, i); +// ////////////////////////////////////////////////////////////////////////// +// SetRecvFsPostDev27( para->getParD(level)->distributions.f[0], +// para->getParD(level)->recvProcessNeighborX[i].f[0], +// para->getParD(level)->recvProcessNeighborX[i].index, +// para->getParD(level)->recvProcessNeighborX[i].numberOfNodes, +// para->getParD(level)->neighborX, +// para->getParD(level)->neighborY_SP, +// para->getParD(level)->neighborZ, +// para->getParD(level)->numberOfNodes, +// para->getParD(level)->isEvenTimestep, +// para->getParD(level)->numberofthreads); +// ////////////////////////////////////////////////////////////////////////// +// } //} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -712,82 +549,82 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //void exchangePreCollDataYGPU27(Parameter* para, vf::gpu::Communicator& comm, int level) //{ -// for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) -// { -// ////////////////////////////////////////////////////////////////////////// -// GetSendFsPreDev27(para->getParD(level)->d0SP.f[0], -// para->getParD(level)->sendProcessNeighborY[i].f[0], -// para->getParD(level)->sendProcessNeighborY[i].index, -// para->getParD(level)->sendProcessNeighborY[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborYFsDH(level, i); -// ////////////////////////////////////////////////////////////////////////// -// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborY[i].f[0], -// para->getParH(level)->sendProcessNeighborY[i].numberOfFs, -// para->getParH(level)->recvProcessNeighborY[i].f[0], -// para->getParH(level)->recvProcessNeighborY[i].numberOfFs, -// para->getParH(level)->sendProcessNeighborY[i].rankNeighbor); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborYFsHD(level, i); -// ////////////////////////////////////////////////////////////////////////// -// SetRecvFsPreDev27(para->getParD(level)->d0SP.f[0], -// para->getParD(level)->recvProcessNeighborY[i].f[0], -// para->getParD(level)->recvProcessNeighborY[i].index, -// para->getParD(level)->recvProcessNeighborY[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// } +// for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) +// { +// ////////////////////////////////////////////////////////////////////////// +// GetSendFsPreDev27(para->getParD(level)->distributions.f[0], +// para->getParD(level)->sendProcessNeighborY[i].f[0], +// para->getParD(level)->sendProcessNeighborY[i].index, +// para->getParD(level)->sendProcessNeighborY[i].numberOfNodes, +// para->getParD(level)->neighborX, +// para->getParD(level)->neighborY_SP, +// para->getParD(level)->neighborZ, +// para->getParD(level)->numberOfNodes, +// para->getParD(level)->isEvenTimestep, +// para->getParD(level)->numberofthreads); +// ////////////////////////////////////////////////////////////////////////// +// para->cudaCopyProcessNeighborYFsDH(level, i); +// ////////////////////////////////////////////////////////////////////////// +// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborY[i].f[0], +// para->getParH(level)->sendProcessNeighborY[i].numberOfFs, +// para->getParH(level)->recvProcessNeighborY[i].f[0], +// para->getParH(level)->recvProcessNeighborY[i].numberOfFs, +// para->getParH(level)->sendProcessNeighborY[i].rankNeighbor); +// ////////////////////////////////////////////////////////////////////////// +// para->cudaCopyProcessNeighborYFsHD(level, i); +// ////////////////////////////////////////////////////////////////////////// +// SetRecvFsPreDev27(para->getParD(level)->distributions.f[0], +// para->getParD(level)->recvProcessNeighborY[i].f[0], +// para->getParD(level)->recvProcessNeighborY[i].index, +// para->getParD(level)->recvProcessNeighborY[i].numberOfNodes, +// para->getParD(level)->neighborX, +// para->getParD(level)->neighborY_SP, +// para->getParD(level)->neighborZ, +// para->getParD(level)->numberOfNodes, +// para->getParD(level)->isEvenTimestep, +// para->getParD(level)->numberofthreads); +// ////////////////////////////////////////////////////////////////////////// +// } //} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //void exchangePostCollDataYGPU27(Parameter* para, vf::gpu::Communicator& comm, int level) //{ -// for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) -// { -// ////////////////////////////////////////////////////////////////////////// -// GetSendFsPostDev27( para->getParD(level)->d0SP.f[0], -// para->getParD(level)->sendProcessNeighborY[i].f[0], -// para->getParD(level)->sendProcessNeighborY[i].index, -// para->getParD(level)->sendProcessNeighborY[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborYFsDH(level, i); -// ////////////////////////////////////////////////////////////////////////// -// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborY[i].f[0], -// para->getParH(level)->sendProcessNeighborY[i].numberOfFs, -// para->getParH(level)->recvProcessNeighborY[i].f[0], -// para->getParH(level)->recvProcessNeighborY[i].numberOfFs, -// para->getParH(level)->sendProcessNeighborY[i].rankNeighbor); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborYFsHD(level, i); -// ////////////////////////////////////////////////////////////////////////// -// SetRecvFsPostDev27( para->getParD(level)->d0SP.f[0], -// para->getParD(level)->recvProcessNeighborY[i].f[0], -// para->getParD(level)->recvProcessNeighborY[i].index, -// para->getParD(level)->recvProcessNeighborY[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// } +// for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) +// { +// ////////////////////////////////////////////////////////////////////////// +// GetSendFsPostDev27( para->getParD(level)->distributions.f[0], +// para->getParD(level)->sendProcessNeighborY[i].f[0], +// para->getParD(level)->sendProcessNeighborY[i].index, +// para->getParD(level)->sendProcessNeighborY[i].numberOfNodes, +// para->getParD(level)->neighborX, +// para->getParD(level)->neighborY_SP, +// para->getParD(level)->neighborZ, +// para->getParD(level)->numberOfNodes, +// para->getParD(level)->isEvenTimestep, +// para->getParD(level)->numberofthreads); +// ////////////////////////////////////////////////////////////////////////// +// para->cudaCopyProcessNeighborYFsDH(level, i); +// ////////////////////////////////////////////////////////////////////////// +// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborY[i].f[0], +// para->getParH(level)->sendProcessNeighborY[i].numberOfFs, +// para->getParH(level)->recvProcessNeighborY[i].f[0], +// para->getParH(level)->recvProcessNeighborY[i].numberOfFs, +// para->getParH(level)->sendProcessNeighborY[i].rankNeighbor); +// ////////////////////////////////////////////////////////////////////////// +// para->cudaCopyProcessNeighborYFsHD(level, i); +// ////////////////////////////////////////////////////////////////////////// +// SetRecvFsPostDev27( para->getParD(level)->distributions.f[0], +// para->getParD(level)->recvProcessNeighborY[i].f[0], +// para->getParD(level)->recvProcessNeighborY[i].index, +// para->getParD(level)->recvProcessNeighborY[i].numberOfNodes, +// para->getParD(level)->neighborX, +// para->getParD(level)->neighborY_SP, +// para->getParD(level)->neighborZ, +// para->getParD(level)->numberOfNodes, +// para->getParD(level)->isEvenTimestep, +// para->getParD(level)->numberofthreads); +// ////////////////////////////////////////////////////////////////////////// +// } //} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -799,82 +636,82 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //void exchangePreCollDataZGPU27(Parameter* para, vf::gpu::Communicator& comm, int level) //{ -// for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) -// { -// ////////////////////////////////////////////////////////////////////////// -// GetSendFsPreDev27(para->getParD(level)->d0SP.f[0], -// para->getParD(level)->sendProcessNeighborZ[i].f[0], -// para->getParD(level)->sendProcessNeighborZ[i].index, -// para->getParD(level)->sendProcessNeighborZ[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborZFsDH(level, i); -// ////////////////////////////////////////////////////////////////////////// -// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborZ[i].f[0], -// para->getParH(level)->sendProcessNeighborZ[i].numberOfFs, -// para->getParH(level)->recvProcessNeighborZ[i].f[0], -// para->getParH(level)->recvProcessNeighborZ[i].numberOfFs, -// para->getParH(level)->sendProcessNeighborZ[i].rankNeighbor); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborZFsHD(level, i); -// ////////////////////////////////////////////////////////////////////////// -// SetRecvFsPreDev27(para->getParD(level)->d0SP.f[0], -// para->getParD(level)->recvProcessNeighborZ[i].f[0], -// para->getParD(level)->recvProcessNeighborZ[i].index, -// para->getParD(level)->recvProcessNeighborZ[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// } +// for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) +// { +// ////////////////////////////////////////////////////////////////////////// +// GetSendFsPreDev27(para->getParD(level)->distributions.f[0], +// para->getParD(level)->sendProcessNeighborZ[i].f[0], +// para->getParD(level)->sendProcessNeighborZ[i].index, +// para->getParD(level)->sendProcessNeighborZ[i].numberOfNodes, +// para->getParD(level)->neighborX, +// para->getParD(level)->neighborY_SP, +// para->getParD(level)->neighborZ, +// para->getParD(level)->numberOfNodes, +// para->getParD(level)->isEvenTimestep, +// para->getParD(level)->numberofthreads); +// ////////////////////////////////////////////////////////////////////////// +// para->cudaCopyProcessNeighborZFsDH(level, i); +// ////////////////////////////////////////////////////////////////////////// +// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborZ[i].f[0], +// para->getParH(level)->sendProcessNeighborZ[i].numberOfFs, +// para->getParH(level)->recvProcessNeighborZ[i].f[0], +// para->getParH(level)->recvProcessNeighborZ[i].numberOfFs, +// para->getParH(level)->sendProcessNeighborZ[i].rankNeighbor); +// ////////////////////////////////////////////////////////////////////////// +// para->cudaCopyProcessNeighborZFsHD(level, i); +// ////////////////////////////////////////////////////////////////////////// +// SetRecvFsPreDev27(para->getParD(level)->distributions.f[0], +// para->getParD(level)->recvProcessNeighborZ[i].f[0], +// para->getParD(level)->recvProcessNeighborZ[i].index, +// para->getParD(level)->recvProcessNeighborZ[i].numberOfNodes, +// para->getParD(level)->neighborX, +// para->getParD(level)->neighborY_SP, +// para->getParD(level)->neighborZ, +// para->getParD(level)->numberOfNodes, +// para->getParD(level)->isEvenTimestep, +// para->getParD(level)->numberofthreads); +// ////////////////////////////////////////////////////////////////////////// +// } //} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //void exchangePostCollDataZGPU27(Parameter* para, vf::gpu::Communicator& comm, int level) //{ -// for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) -// { -// ////////////////////////////////////////////////////////////////////////// -// GetSendFsPostDev27( para->getParD(level)->d0SP.f[0], -// para->getParD(level)->sendProcessNeighborZ[i].f[0], -// para->getParD(level)->sendProcessNeighborZ[i].index, -// para->getParD(level)->sendProcessNeighborZ[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborZFsDH(level, i); -// ////////////////////////////////////////////////////////////////////////// -// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborZ[i].f[0], -// para->getParH(level)->sendProcessNeighborZ[i].numberOfFs, -// para->getParH(level)->recvProcessNeighborZ[i].f[0], -// para->getParH(level)->recvProcessNeighborZ[i].numberOfFs, -// para->getParH(level)->sendProcessNeighborZ[i].rankNeighbor); -// ////////////////////////////////////////////////////////////////////////// -// para->cudaCopyProcessNeighborZFsHD(level, i); -// ////////////////////////////////////////////////////////////////////////// -// SetRecvFsPostDev27( para->getParD(level)->d0SP.f[0], -// para->getParD(level)->recvProcessNeighborZ[i].f[0], -// para->getParD(level)->recvProcessNeighborZ[i].index, -// para->getParD(level)->recvProcessNeighborZ[i].numberOfNodes, -// para->getParD(level)->neighborX_SP, -// para->getParD(level)->neighborY_SP, -// para->getParD(level)->neighborZ_SP, -// para->getParD(level)->size_Mat_SP, -// para->getParD(level)->evenOrOdd, -// para->getParD(level)->numberofthreads); -// ////////////////////////////////////////////////////////////////////////// -// } +// for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) +// { +// ////////////////////////////////////////////////////////////////////////// +// GetSendFsPostDev27( para->getParD(level)->distributions.f[0], +// para->getParD(level)->sendProcessNeighborZ[i].f[0], +// para->getParD(level)->sendProcessNeighborZ[i].index, +// para->getParD(level)->sendProcessNeighborZ[i].numberOfNodes, +// para->getParD(level)->neighborX, +// para->getParD(level)->neighborY_SP, +// para->getParD(level)->neighborZ, +// para->getParD(level)->numberOfNodes, +// para->getParD(level)->isEvenTimestep, +// para->getParD(level)->numberofthreads); +// ////////////////////////////////////////////////////////////////////////// +// para->cudaCopyProcessNeighborZFsDH(level, i); +// ////////////////////////////////////////////////////////////////////////// +// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborZ[i].f[0], +// para->getParH(level)->sendProcessNeighborZ[i].numberOfFs, +// para->getParH(level)->recvProcessNeighborZ[i].f[0], +// para->getParH(level)->recvProcessNeighborZ[i].numberOfFs, +// para->getParH(level)->sendProcessNeighborZ[i].rankNeighbor); +// ////////////////////////////////////////////////////////////////////////// +// para->cudaCopyProcessNeighborZFsHD(level, i); +// ////////////////////////////////////////////////////////////////////////// +// SetRecvFsPostDev27( para->getParD(level)->distributions.f[0], +// para->getParD(level)->recvProcessNeighborZ[i].f[0], +// para->getParD(level)->recvProcessNeighborZ[i].index, +// para->getParD(level)->recvProcessNeighborZ[i].numberOfNodes, +// para->getParD(level)->neighborX, +// para->getParD(level)->neighborY_SP, +// para->getParD(level)->neighborZ, +// para->getParD(level)->numberOfNodes, +// para->getParD(level)->isEvenTimestep, +// para->getParD(level)->numberofthreads); +// ////////////////////////////////////////////////////////////////////////// +// } //} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -932,166 +769,166 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // X //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePreCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangePreCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - GetSendFsPreDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->sendProcessNeighborADX[i].f[0], - para->getParD(level)->sendProcessNeighborADX[i].index, - para->getParD(level)->sendProcessNeighborADX[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborADXFsDH(level, i); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADX[i].f[0], - para->getParH(level)->recvProcessNeighborADX[i].numberOfFs, - para->getParH(level)->recvProcessNeighborADX[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADX[i].f[0], - // para->getParH(level)->sendProcessNeighborADX[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborADX[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADX[i].f[0], - para->getParH(level)->sendProcessNeighborADX[i].numberOfFs, - para->getParH(level)->sendProcessNeighborADX[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborADXFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPreDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->recvProcessNeighborADX[i].f[0], - para->getParD(level)->recvProcessNeighborADX[i].index, - para->getParD(level)->recvProcessNeighborADX[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Device to Host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + GetSendFsPreDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->sendProcessNeighborADX[i].f[0], + para->getParD(level)->sendProcessNeighborADX[i].index, + para->getParD(level)->sendProcessNeighborADX[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborADXFsDH(level, i); + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start non blocking MPI receive + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADX[i].f[0], + para->getParH(level)->recvProcessNeighborADX[i].numberOfFs, + para->getParH(level)->recvProcessNeighborADX[i].rankNeighbor); + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////start non blocking MPI send + //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + //{ + // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADX[i].f[0], + // para->getParH(level)->sendProcessNeighborADX[i].numberOfFs, + // para->getParH(level)->sendProcessNeighborADX[i].rankNeighbor); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////Waitall + //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) + //{ + // comm.waitallGPU(); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start blocking MPI send + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADX[i].f[0], + para->getParH(level)->sendProcessNeighborADX[i].numberOfFs, + para->getParH(level)->sendProcessNeighborADX[i].rankNeighbor); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Wait + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + comm.waitGPU(i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //reset the request array + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) + { + comm.resetRequest(); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Host to Device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + cudaMemoryManager->cudaCopyProcessNeighborADXFsHD(level, i); + ////////////////////////////////////////////////////////////////////////// + SetRecvFsPreDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->recvProcessNeighborADX[i].f[0], + para->getParD(level)->recvProcessNeighborADX[i].index, + para->getParD(level)->recvProcessNeighborADX[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePostCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangePostCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - GetSendFsPostDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->sendProcessNeighborADX[i].f[0], - para->getParD(level)->sendProcessNeighborADX[i].index, - para->getParD(level)->sendProcessNeighborADX[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborADXFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADX[i].f[0], - para->getParH(level)->recvProcessNeighborADX[i].numberOfFs, - para->getParH(level)->recvProcessNeighborADX[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADX[i].f[0], - // para->getParH(level)->sendProcessNeighborADX[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborADX[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADX[i].f[0], - para->getParH(level)->sendProcessNeighborADX[i].numberOfFs, - para->getParH(level)->sendProcessNeighborADX[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborADXFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPostDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->recvProcessNeighborADX[i].f[0], - para->getParD(level)->recvProcessNeighborADX[i].index, - para->getParD(level)->recvProcessNeighborADX[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Device to Host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + GetSendFsPostDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->sendProcessNeighborADX[i].f[0], + para->getParD(level)->sendProcessNeighborADX[i].index, + para->getParD(level)->sendProcessNeighborADX[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborADXFsDH(level, i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start non blocking MPI receive + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADX[i].f[0], + para->getParH(level)->recvProcessNeighborADX[i].numberOfFs, + para->getParH(level)->recvProcessNeighborADX[i].rankNeighbor); + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////start non blocking MPI send + //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + //{ + // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADX[i].f[0], + // para->getParH(level)->sendProcessNeighborADX[i].numberOfFs, + // para->getParH(level)->sendProcessNeighborADX[i].rankNeighbor); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////Waitall + //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) + //{ + // comm.waitallGPU(); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start blocking MPI send + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADX[i].f[0], + para->getParH(level)->sendProcessNeighborADX[i].numberOfFs, + para->getParH(level)->sendProcessNeighborADX[i].rankNeighbor); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Wait + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + comm.waitGPU(i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //reset the request array + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) + { + comm.resetRequest(); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Host to Device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + cudaMemoryManager->cudaCopyProcessNeighborADXFsHD(level, i); + ////////////////////////////////////////////////////////////////////////// + SetRecvFsPostDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->recvProcessNeighborADX[i].f[0], + para->getParD(level)->recvProcessNeighborADX[i].index, + para->getParD(level)->recvProcessNeighborADX[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1101,166 +938,166 @@ void exchangePostCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Y //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePreCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangePreCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - GetSendFsPreDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->sendProcessNeighborADY[i].f[0], - para->getParD(level)->sendProcessNeighborADY[i].index, - para->getParD(level)->sendProcessNeighborADY[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborADYFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADY[i].f[0], - para->getParH(level)->recvProcessNeighborADY[i].numberOfFs, - para->getParH(level)->recvProcessNeighborADY[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADY[i].f[0], - // para->getParH(level)->sendProcessNeighborADY[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborADY[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADY[i].f[0], - para->getParH(level)->sendProcessNeighborADY[i].numberOfFs, - para->getParH(level)->sendProcessNeighborADY[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborADYFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPreDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->recvProcessNeighborADY[i].f[0], - para->getParD(level)->recvProcessNeighborADY[i].index, - para->getParD(level)->recvProcessNeighborADY[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Device to Host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + GetSendFsPreDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->sendProcessNeighborADY[i].f[0], + para->getParD(level)->sendProcessNeighborADY[i].index, + para->getParD(level)->sendProcessNeighborADY[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborADYFsDH(level, i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start non blocking MPI receive + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADY[i].f[0], + para->getParH(level)->recvProcessNeighborADY[i].numberOfFs, + para->getParH(level)->recvProcessNeighborADY[i].rankNeighbor); + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////start non blocking MPI send + //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + //{ + // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADY[i].f[0], + // para->getParH(level)->sendProcessNeighborADY[i].numberOfFs, + // para->getParH(level)->sendProcessNeighborADY[i].rankNeighbor); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////Waitall + //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) + //{ + // comm.waitallGPU(); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start blocking MPI send + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADY[i].f[0], + para->getParH(level)->sendProcessNeighborADY[i].numberOfFs, + para->getParH(level)->sendProcessNeighborADY[i].rankNeighbor); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Wait + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + comm.waitGPU(i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //reset the request array + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) + { + comm.resetRequest(); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Host to Device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + cudaMemoryManager->cudaCopyProcessNeighborADYFsHD(level, i); + ////////////////////////////////////////////////////////////////////////// + SetRecvFsPreDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->recvProcessNeighborADY[i].f[0], + para->getParD(level)->recvProcessNeighborADY[i].index, + para->getParD(level)->recvProcessNeighborADY[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePostCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangePostCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - GetSendFsPostDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->sendProcessNeighborADY[i].f[0], - para->getParD(level)->sendProcessNeighborADY[i].index, - para->getParD(level)->sendProcessNeighborADY[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborADYFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADY[i].f[0], - para->getParH(level)->recvProcessNeighborADY[i].numberOfFs, - para->getParH(level)->recvProcessNeighborADY[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADY[i].f[0], - // para->getParH(level)->sendProcessNeighborADY[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborADY[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADY[i].f[0], - para->getParH(level)->sendProcessNeighborADY[i].numberOfFs, - para->getParH(level)->sendProcessNeighborADY[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborADYFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPostDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->recvProcessNeighborADY[i].f[0], - para->getParD(level)->recvProcessNeighborADY[i].index, - para->getParD(level)->recvProcessNeighborADY[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Device to Host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + GetSendFsPostDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->sendProcessNeighborADY[i].f[0], + para->getParD(level)->sendProcessNeighborADY[i].index, + para->getParD(level)->sendProcessNeighborADY[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborADYFsDH(level, i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start non blocking MPI receive + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADY[i].f[0], + para->getParH(level)->recvProcessNeighborADY[i].numberOfFs, + para->getParH(level)->recvProcessNeighborADY[i].rankNeighbor); + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////start non blocking MPI send + //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + //{ + // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADY[i].f[0], + // para->getParH(level)->sendProcessNeighborADY[i].numberOfFs, + // para->getParH(level)->sendProcessNeighborADY[i].rankNeighbor); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////Waitall + //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) + //{ + // comm.waitallGPU(); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start blocking MPI send + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADY[i].f[0], + para->getParH(level)->sendProcessNeighborADY[i].numberOfFs, + para->getParH(level)->sendProcessNeighborADY[i].rankNeighbor); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Wait + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + comm.waitGPU(i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //reset the request array + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) + { + comm.resetRequest(); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Host to Device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + cudaMemoryManager->cudaCopyProcessNeighborADYFsHD(level, i); + ////////////////////////////////////////////////////////////////////////// + SetRecvFsPostDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->recvProcessNeighborADY[i].f[0], + para->getParD(level)->recvProcessNeighborADY[i].index, + para->getParD(level)->recvProcessNeighborADY[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1270,166 +1107,166 @@ void exchangePostCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Z //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePreCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangePreCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - GetSendFsPreDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->sendProcessNeighborADZ[i].f[0], - para->getParD(level)->sendProcessNeighborADZ[i].index, - para->getParD(level)->sendProcessNeighborADZ[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborADZFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADZ[i].f[0], - para->getParH(level)->recvProcessNeighborADZ[i].numberOfFs, - para->getParH(level)->recvProcessNeighborADZ[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADZ[i].f[0], - // para->getParH(level)->sendProcessNeighborADZ[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborADZ[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADZ[i].f[0], - para->getParH(level)->sendProcessNeighborADZ[i].numberOfFs, - para->getParH(level)->sendProcessNeighborADZ[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborADZFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPreDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->recvProcessNeighborADZ[i].f[0], - para->getParD(level)->recvProcessNeighborADZ[i].index, - para->getParD(level)->recvProcessNeighborADZ[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Device to Host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + GetSendFsPreDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->sendProcessNeighborADZ[i].f[0], + para->getParD(level)->sendProcessNeighborADZ[i].index, + para->getParD(level)->sendProcessNeighborADZ[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborADZFsDH(level, i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start non blocking MPI receive + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADZ[i].f[0], + para->getParH(level)->recvProcessNeighborADZ[i].numberOfFs, + para->getParH(level)->recvProcessNeighborADZ[i].rankNeighbor); + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////start non blocking MPI send + //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + //{ + // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADZ[i].f[0], + // para->getParH(level)->sendProcessNeighborADZ[i].numberOfFs, + // para->getParH(level)->sendProcessNeighborADZ[i].rankNeighbor); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////Waitall + //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) + //{ + // comm.waitallGPU(); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start blocking MPI send + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADZ[i].f[0], + para->getParH(level)->sendProcessNeighborADZ[i].numberOfFs, + para->getParH(level)->sendProcessNeighborADZ[i].rankNeighbor); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Wait + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + comm.waitGPU(i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //reset the request array + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) + { + comm.resetRequest(); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Host to Device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + cudaMemoryManager->cudaCopyProcessNeighborADZFsHD(level, i); + ////////////////////////////////////////////////////////////////////////// + SetRecvFsPreDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->recvProcessNeighborADZ[i].f[0], + para->getParD(level)->recvProcessNeighborADZ[i].index, + para->getParD(level)->recvProcessNeighborADZ[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePostCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangePostCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - GetSendFsPostDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->sendProcessNeighborADZ[i].f[0], - para->getParD(level)->sendProcessNeighborADZ[i].index, - para->getParD(level)->sendProcessNeighborADZ[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborADZFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADZ[i].f[0], - para->getParH(level)->recvProcessNeighborADZ[i].numberOfFs, - para->getParH(level)->recvProcessNeighborADZ[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////start non blocking MPI send - //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - //{ - // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADZ[i].f[0], - // para->getParH(level)->sendProcessNeighborADZ[i].numberOfFs, - // para->getParH(level)->sendProcessNeighborADZ[i].rankNeighbor); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Waitall - //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) - //{ - // comm.waitallGPU(); - //} - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADZ[i].f[0], - para->getParH(level)->sendProcessNeighborADZ[i].numberOfFs, - para->getParH(level)->sendProcessNeighborADZ[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborADZFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - SetRecvFsPostDev27(para->getParD(level)->d27.f[0], - para->getParD(level)->recvProcessNeighborADZ[i].f[0], - para->getParD(level)->recvProcessNeighborADZ[i].index, - para->getParD(level)->recvProcessNeighborADZ[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Device to Host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + GetSendFsPostDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->sendProcessNeighborADZ[i].f[0], + para->getParD(level)->sendProcessNeighborADZ[i].index, + para->getParD(level)->sendProcessNeighborADZ[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborADZFsDH(level, i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start non blocking MPI receive + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADZ[i].f[0], + para->getParH(level)->recvProcessNeighborADZ[i].numberOfFs, + para->getParH(level)->recvProcessNeighborADZ[i].rankNeighbor); + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////start non blocking MPI send + //for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + //{ + // comm.nbSendDataGPU(para->getParH(level)->sendProcessNeighborADZ[i].f[0], + // para->getParH(level)->sendProcessNeighborADZ[i].numberOfFs, + // para->getParH(level)->sendProcessNeighborADZ[i].rankNeighbor); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////Waitall + //if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) + //{ + // comm.waitallGPU(); + //} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start blocking MPI send + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADZ[i].f[0], + para->getParH(level)->sendProcessNeighborADZ[i].numberOfFs, + para->getParH(level)->sendProcessNeighborADZ[i].rankNeighbor); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Wait + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + comm.waitGPU(i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //reset the request array + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) + { + comm.resetRequest(); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Host to Device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + cudaMemoryManager->cudaCopyProcessNeighborADZFsHD(level, i); + ////////////////////////////////////////////////////////////////////////// + SetRecvFsPostDev27(para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->recvProcessNeighborADZ[i].f[0], + para->getParD(level)->recvProcessNeighborADZ[i].index, + para->getParD(level)->recvProcessNeighborADZ[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1486,75 +1323,75 @@ void exchangePostCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // X //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangeCollDataF3XGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangeCollDataF3XGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - getSendGsDevF3( - para->getParD(level)->g6.g[0], - para->getParD(level)->sendProcessNeighborF3X[i].g[0], - para->getParD(level)->sendProcessNeighborF3X[i].index, - para->getParD(level)->sendProcessNeighborF3X[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborF3XFsDH(level, i); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.nbRecvDataGPU( - para->getParH(level)->recvProcessNeighborF3X[i].g[0], - para->getParH(level)->recvProcessNeighborF3X[i].numberOfGs, - para->getParH(level)->recvProcessNeighborF3X[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.sendDataGPU( - para->getParH(level)->sendProcessNeighborF3X[i].g[0], - para->getParH(level)->sendProcessNeighborF3X[i].numberOfGs, - para->getParH(level)->sendProcessNeighborF3X[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborF3XFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - setRecvGsDevF3( - para->getParD(level)->g6.g[0], - para->getParD(level)->recvProcessNeighborF3X[i].g[0], - para->getParD(level)->recvProcessNeighborF3X[i].index, - para->getParD(level)->recvProcessNeighborF3X[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Device to Host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + getSendGsDevF3( + para->getParD(level)->g6.g[0], + para->getParD(level)->sendProcessNeighborF3X[i].g[0], + para->getParD(level)->sendProcessNeighborF3X[i].index, + para->getParD(level)->sendProcessNeighborF3X[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborF3XFsDH(level, i); + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start non blocking MPI receive + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + comm.nbRecvDataGPU( + para->getParH(level)->recvProcessNeighborF3X[i].g[0], + para->getParH(level)->recvProcessNeighborF3X[i].numberOfGs, + para->getParH(level)->recvProcessNeighborF3X[i].rankNeighbor); + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start blocking MPI send + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + comm.sendDataGPU( + para->getParH(level)->sendProcessNeighborF3X[i].g[0], + para->getParH(level)->sendProcessNeighborF3X[i].numberOfGs, + para->getParH(level)->sendProcessNeighborF3X[i].rankNeighbor); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Wait + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + comm.waitGPU(i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //reset the request array + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) + { + comm.resetRequest(); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Host to Device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) + { + cudaMemoryManager->cudaCopyProcessNeighborF3XFsHD(level, i); + ////////////////////////////////////////////////////////////////////////// + setRecvGsDevF3( + para->getParD(level)->g6.g[0], + para->getParD(level)->recvProcessNeighborF3X[i].g[0], + para->getParD(level)->recvProcessNeighborF3X[i].index, + para->getParD(level)->recvProcessNeighborF3X[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1564,75 +1401,75 @@ void exchangeCollDataF3XGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMe //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Y //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangeCollDataF3YGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangeCollDataF3YGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - getSendGsDevF3( - para->getParD(level)->g6.g[0], - para->getParD(level)->sendProcessNeighborF3Y[i].g[0], - para->getParD(level)->sendProcessNeighborF3Y[i].index, - para->getParD(level)->sendProcessNeighborF3Y[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborF3YFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.nbRecvDataGPU( - para->getParH(level)->recvProcessNeighborF3Y[i].g[0], - para->getParH(level)->recvProcessNeighborF3Y[i].numberOfGs, - para->getParH(level)->recvProcessNeighborF3Y[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.sendDataGPU( - para->getParH(level)->sendProcessNeighborF3Y[i].g[0], - para->getParH(level)->sendProcessNeighborF3Y[i].numberOfGs, - para->getParH(level)->sendProcessNeighborF3Y[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborF3YFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - setRecvGsDevF3( - para->getParD(level)->g6.g[0], - para->getParD(level)->recvProcessNeighborF3Y[i].g[0], - para->getParD(level)->recvProcessNeighborF3Y[i].index, - para->getParD(level)->recvProcessNeighborF3Y[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Device to Host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + getSendGsDevF3( + para->getParD(level)->g6.g[0], + para->getParD(level)->sendProcessNeighborF3Y[i].g[0], + para->getParD(level)->sendProcessNeighborF3Y[i].index, + para->getParD(level)->sendProcessNeighborF3Y[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborF3YFsDH(level, i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start non blocking MPI receive + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + comm.nbRecvDataGPU( + para->getParH(level)->recvProcessNeighborF3Y[i].g[0], + para->getParH(level)->recvProcessNeighborF3Y[i].numberOfGs, + para->getParH(level)->recvProcessNeighborF3Y[i].rankNeighbor); + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start blocking MPI send + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + comm.sendDataGPU( + para->getParH(level)->sendProcessNeighborF3Y[i].g[0], + para->getParH(level)->sendProcessNeighborF3Y[i].numberOfGs, + para->getParH(level)->sendProcessNeighborF3Y[i].rankNeighbor); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Wait + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + comm.waitGPU(i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //reset the request array + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) + { + comm.resetRequest(); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Host to Device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) + { + cudaMemoryManager->cudaCopyProcessNeighborF3YFsHD(level, i); + ////////////////////////////////////////////////////////////////////////// + setRecvGsDevF3( + para->getParD(level)->g6.g[0], + para->getParD(level)->recvProcessNeighborF3Y[i].g[0], + para->getParD(level)->recvProcessNeighborF3Y[i].index, + para->getParD(level)->recvProcessNeighborF3Y[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1642,94 +1479,74 @@ void exchangeCollDataF3YGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMe //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Z //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangeCollDataF3ZGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level) +void exchangeCollDataF3ZGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Device to Host - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - getSendGsDevF3( - para->getParD(level)->g6.g[0], - para->getParD(level)->sendProcessNeighborF3Z[i].g[0], - para->getParD(level)->sendProcessNeighborF3Z[i].index, - para->getParD(level)->sendProcessNeighborF3Z[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyProcessNeighborF3ZFsDH(level, i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start non blocking MPI receive - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.nbRecvDataGPU( - para->getParH(level)->recvProcessNeighborF3Z[i].g[0], - para->getParH(level)->recvProcessNeighborF3Z[i].numberOfGs, - para->getParH(level)->recvProcessNeighborF3Z[i].rankNeighbor); - } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //start blocking MPI send - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.sendDataGPU( - para->getParH(level)->sendProcessNeighborF3Z[i].g[0], - para->getParH(level)->sendProcessNeighborF3Z[i].numberOfGs, - para->getParH(level)->sendProcessNeighborF3Z[i].rankNeighbor); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.waitGPU(i); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) - { - comm.resetRequest(); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //copy Host to Device - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - cudaManager->cudaCopyProcessNeighborF3ZFsHD(level, i); - ////////////////////////////////////////////////////////////////////////// - setRecvGsDevF3( - para->getParD(level)->g6.g[0], - para->getParD(level)->recvProcessNeighborF3Z[i].g[0], - para->getParD(level)->recvProcessNeighborF3Z[i].index, - para->getParD(level)->recvProcessNeighborF3Z[i].numberOfNodes, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd, - para->getParD(level)->numberofthreads); - } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Device to Host + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + getSendGsDevF3( + para->getParD(level)->g6.g[0], + para->getParD(level)->sendProcessNeighborF3Z[i].g[0], + para->getParD(level)->sendProcessNeighborF3Z[i].index, + para->getParD(level)->sendProcessNeighborF3Z[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborF3ZFsDH(level, i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start non blocking MPI receive + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + comm.nbRecvDataGPU( + para->getParH(level)->recvProcessNeighborF3Z[i].g[0], + para->getParH(level)->recvProcessNeighborF3Z[i].numberOfGs, + para->getParH(level)->recvProcessNeighborF3Z[i].rankNeighbor); + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //start blocking MPI send + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + comm.sendDataGPU( + para->getParH(level)->sendProcessNeighborF3Z[i].g[0], + para->getParH(level)->sendProcessNeighborF3Z[i].numberOfGs, + para->getParH(level)->sendProcessNeighborF3Z[i].rankNeighbor); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Wait + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + comm.waitGPU(i); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //reset the request array + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) + { + comm.resetRequest(); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //copy Host to Device + for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) + { + cudaMemoryManager->cudaCopyProcessNeighborF3ZFsHD(level, i); + ////////////////////////////////////////////////////////////////////////// + setRecvGsDevF3( + para->getParD(level)->g6.g[0], + para->getParD(level)->recvProcessNeighborF3Z[i].g[0], + para->getParD(level)->recvProcessNeighborF3Z[i].index, + para->getParD(level)->recvProcessNeighborF3Z[i].numberOfNodes, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h index 82662cdc55e8b0ff5f4afe7d31a6563579b45559..ec930ebbc06554e948204b74e79e0e25b85f57b5 100644 --- a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h +++ b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h @@ -1,39 +1,154 @@ #ifndef EXCHANGEDATA27_H #define EXCHANGEDATA27_H -#include "LBM/LB.h" -#include "GPU/GPU_Interface.h" -#include "Parameter/Parameter.h" #include "Communication/Communicator.h" #include "GPU/CudaMemoryManager.h" +#include "GPU/GPU_Interface.h" +#include "LBM/LB.h" +#include "Parameter/Parameter.h" + +//! \file ExchangeData27.h +//! \ingroup GPU +//! \author Martin Schoenherr, Anna Wellmann +//! \brief Routines for data exchange when running simulations on multiple GPUs + +////////////////////////////////////////////////////////////////////////// +// 1D domain decomposition +void exchangePreCollDataGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level); +void exchangePostCollDataGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level); +////////////////////////////////////////////////////////////////////////// +// 3D domain decomposition + +// functions used for all directions + +//! \brief Collect the send nodes in a buffer on the gpu +void collectNodesInSendBufferGPU(Parameter *para, int level, int streamIndex, + std::vector<ProcessNeighbor27> *sendProcessNeighbor, + unsigned int numberOfSendProcessNeighbors); +//! \brief Distribute the receive nodes from the buffer on the gpu +void scatterNodesFromRecvBufferGPU(Parameter *para, int level, int streamIndex, + std::vector<ProcessNeighbor27> *recvProcessNeighborDev, + unsigned int numberOfRecvProcessNeighbors); +//! \brief Copy nodes which are part of the communication in multiple directions +//! \details The nodes are copied from the receive buffer in one direction to the send buffer in another direction. The +//! copy operation is conducted on the cpu. +//! See [master thesis of Anna Wellmann (p. 56f: "Communication Hiding bei +//! der Verwendung eines uniformen Simulationsgitters")] +//! \param edgeNodes determines from where to where the nodes are +//! copied +//! \param recvProcessNeighborHost is a reference to the receive buffer on the host, nodes are copied from here +//! \param sendProcessNeighborHost is a reference to the send buffer on the host, nodes are copied to here +void copyEdgeNodes(std::vector<LBMSimulationParameter::EdgeNodePositions> &edgeNodes, + std::vector<ProcessNeighbor27> &recvProcessNeighborHost, + std::vector<ProcessNeighbor27> &sendProcessNeighborHost); ////////////////////////////////////////////////////////////////////////// -//1D domain decomposition -extern "C" void exchangePreCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -////////////////////////////////////////////////////////////////////////// -//3D domain decomposition -extern "C" void exchangePreCollDataXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangePreCollDataYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangePreCollDataZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangePostCollDataXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangePostCollDataYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangePostCollDataZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -////////////////////////////////////////////////////////////////////////// -//3D domain decomposition convection diffusion -extern "C" void exchangePreCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangePreCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangePreCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangePostCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangePostCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangePostCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -////////////////////////////////////////////////////////////////////////// -//3D domain decomposition F3 - K18/K20 -extern "C" void exchangeCollDataF3XGPU( Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangeCollDataF3YGPU( Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -extern "C" void exchangeCollDataF3ZGPU( Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaManager, int level); -////////////////////////////////////////////////////////////////////////// -extern "C" void barrierGPU(vf::gpu::Communicator& comm); +// x + +//! \brief Collect the send nodes for communication in the x direction in a buffer on the gpu +//! \details Needed to exchange all nodes, used in the communication after collision step +void prepareExchangeCollDataXGPU27AllNodes(Parameter *para, int level, int streamIndex); +//! \brief Collect the send nodes for communication in the x direction in a buffer on the gpu +//! \details Only exchange nodes which are part of the interpolation process on refined grids. This function is used in +//! the exchange which takes place after the interpolation fine to coarse and before the interpolation coarse to fine. +//! See [master thesis of Anna Wellmann] +void prepareExchangeCollDataXGPU27AfterFtoC(Parameter *para, int level, int streamIndex); +//! \brief Exchange routine in x direction for simulations on multiple gpus +//! \details Send and receive the nodes from the communication buffers on the gpus. +//! \param Communicator is needed for the communication between the processes with mpi +//! \param CudaMemoryManager is needed for moving the data between host and device +//! \param streamIndex is the index of a CUDA Stream, which is needed for communication hiding +//! \param sendProcessNeighborDev, recvProcessNeighborDev, sendProcessNeighborHost, recvProcessNeighborHost are pointers +//! to the send and receive arrays, both on the device and the host +void exchangeCollDataXGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level, int streamIndex, + std::vector<ProcessNeighbor27> *sendProcessNeighborDev, + std::vector<ProcessNeighbor27> *recvProcessNeighborDev, + std::vector<ProcessNeighbor27> *sendProcessNeighborHost, + std::vector<ProcessNeighbor27> *recvProcessNeighborHost); +//! \brief Calls exchangeCollDataXGPU27() for exchanging all nodes +//! \details Used in the communication after collision step +void exchangeCollDataXGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level, int streamIndex); +//! \brief Calls exchangeCollDataXGPU27() for exchanging the nodes, which are part of the communication between the two +//! interpolation processes on refined grids +//! \details Only exchange nodes which are part of the interpolation process on +//! refined grids. This function is used in the exchange which takes place after the interpolation fine to coarse and +//! before the interpolation coarse to fine. See [master thesis of Anna Wellmann] +void exchangeCollDataXGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level, int streamIndex); +//! \brief Distribute the receive nodes (x direction) from the buffer on the gpu +//! \details Needed to exchange all nodes, used in the communication after collision step +void scatterNodesFromRecvBufferXGPU27AllNodes(Parameter *para, int level, int streamIndex); +//! \brief Distribute the receive nodes (x direction) from the buffer on the gpu +//! \details Only exchange nodes which are part of the interpolation process on refined grids. This function is used in +//! the exchange which takes place after the interpolation fine to coarse and before the interpolation coarse to fine. +//! See [master thesis of Anna Wellmann] +void scatterNodesFromRecvBufferXGPU27AfterFtoC(Parameter *para, int level, int streamIndex); + +////////////////////////////////////////////////////////////////////////// +// y + +void prepareExchangeCollDataYGPU27AllNodes(Parameter *para, int level, int streamIndex); +void prepareExchangeCollDataYGPU27AfterFtoC(Parameter *para, int level, int streamIndex); + +void exchangeCollDataYGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level, int streamIndex, + std::vector<ProcessNeighbor27> *sendProcessNeighborDev, + std::vector<ProcessNeighbor27> *recvProcessNeighborDev, + std::vector<ProcessNeighbor27> *sendProcessNeighborHost, + std::vector<ProcessNeighbor27> *recvProcessNeighborHos); +void exchangeCollDataYGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level, int streamIndex); +void exchangeCollDataYGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level, int streamIndex); +void scatterNodesFromRecvBufferYGPU27AllNodes(Parameter *para, int level, int streamIndex); +void scatterNodesFromRecvBufferYGPU27AfterFtoC(Parameter *para, int level, int streamIndex); + +// z +void prepareExchangeCollDataZGPU27AllNodes(Parameter *para, int level, int streamIndex); +void prepareExchangeCollDataZGPU27AfterFtoC(Parameter *para, int level, int streamIndex); + +void exchangeCollDataZGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level, int streamIndex, + std::vector<ProcessNeighbor27> *sendProcessNeighborDev, + std::vector<ProcessNeighbor27> *recvProcessNeighborDev, + std::vector<ProcessNeighbor27> *sendProcessNeighborHost, + std::vector<ProcessNeighbor27> *recvProcessNeighborHost); +void exchangeCollDataZGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level, int streamIndex); +void exchangeCollDataZGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level, int streamIndex); + +void scatterNodesFromRecvBufferZGPU27AllNodes(Parameter *para, int level, int streamIndex); +void scatterNodesFromRecvBufferZGPU27AfterFtoC(Parameter *para, int level, int streamIndex); + +////////////////////////////////////////////////////////////////////////// +// 3D domain decomposition convection diffusion +void exchangePreCollDataADXGPU27(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level); +void exchangePreCollDataADYGPU27(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level); +void exchangePreCollDataADZGPU27(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level); +void exchangePostCollDataADXGPU27(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level); +void exchangePostCollDataADYGPU27(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level); +void exchangePostCollDataADZGPU27(Parameter *para, vf::gpu::Communicator &comm, + CudaMemoryManager *cudaMemoryManager, int level); +////////////////////////////////////////////////////////////////////////// +// 3D domain decomposition F3 - K18/K20 +void exchangeCollDataF3XGPU(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level); +void exchangeCollDataF3YGPU(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level); +void exchangeCollDataF3ZGPU(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, + int level); +////////////////////////////////////////////////////////////////////////// +void barrierGPU(vf::gpu::Communicator &comm); ////////////////////////////////////////////////////////////////////////// #endif diff --git a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27Test.cpp b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27Test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..473e8c1a5424cf7ddd05f6ed0a534814a3971dc6 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27Test.cpp @@ -0,0 +1,136 @@ +#include <gmock/gmock.h> + +#include <filesystem> + +#include "ExchangeData27.h" +#include "gpu/VirtualFluids_GPU/LBM/LB.h" + +#include <basics/config/ConfigurationFile.h> + +void setUpFsByCopyingF0(std::vector<real> &distributionVector, int numberOfNodes) +{ + for (uint direction = 0; direction < vf::lbm::dir::ENDDIR; direction++) { + distributionVector.insert(distributionVector.end(), distributionVector.begin(), + distributionVector.begin() + numberOfNodes); + } +} + +class ExchangeData27Test_CopyEdgeNodesXZTest : public testing::Test +{ +protected: + SPtr<Parameter> para; + int level = 0; + int numNodes = 10; + std::vector<real> recvFs; + std::vector<real> sendFs; + std::vector<ProcessNeighbor27> sendProcessNeighborHost; + std::vector<ProcessNeighbor27> recvProcessNeighborHost; + + void SetUp() override + { + para = std::make_shared<Parameter>(); + para->setMaxLevel(level + 1); // setMaxLevel resizes parH + para->initLBMSimulationParameter(); // init parH + + para->getParH(level)->edgeNodesXtoZ.emplace_back(0, 1, 0, 1); + para->getParH(level)->edgeNodesXtoZ.emplace_back(0, 6, 0, 6); + para->getParH(level)->edgeNodesXtoZ.emplace_back(0, 2, 0, 3); + para->getParH(level)->edgeNodesXtoZ.emplace_back(0, 7, 0, 8); + para->getParH(level)->edgeNodesXtoZ.emplace_back(0, 7, 0, 8); + para->getParH(level)->edgeNodesXtoZ.emplace_back(0, 7, 0, 8); + } + + void setUpRecvProcessNeighbors(int numberOfNodesInRecv) + { + recvFs.resize(numberOfNodesInRecv); + std::fill(recvFs.begin(), recvFs.end(), 0.5); // 0.5s should not be copied + for (LBMSimulationParameter::EdgeNodePositions edgeNode : para->getParH(level)->edgeNodesXtoZ) { + if (edgeNode.indexInRecvBuffer > numberOfNodesInRecv) { + continue; + } + recvFs[edgeNode.indexInRecvBuffer] = 0.1; // 0.1s should be copied + } + setUpFsByCopyingF0(recvFs, numberOfNodesInRecv); + + recvProcessNeighborHost.resize(1); + recvProcessNeighborHost[0].f[0] = recvFs.data(); + recvProcessNeighborHost[0].numberOfNodes = numberOfNodesInRecv; + } + + void setUpSendProcessNeighbors(int numberOfNodesInSend) + { + sendFs.resize(27 * numberOfNodesInSend); + std::fill(sendFs.begin(), sendFs.end(), 0.0); + + sendProcessNeighborHost.resize(1); + sendProcessNeighborHost[0].f[0] = sendFs.data(); + sendProcessNeighborHost[0].numberOfNodes = numberOfNodesInSend; + } +}; + +TEST_F(ExchangeData27Test_CopyEdgeNodesXZTest, copyEdgeNodes_XZ_CommunicationAfterFtoC_recvVectorFullSize) +{ + int numNodesAfterFtoC = 5; // indexInSend < 5 --> mode is in AfterFToC + setUpRecvProcessNeighbors(numNodes); + setUpSendProcessNeighbors(numNodesAfterFtoC); + + // expected + std::vector<real> expectedFs(numNodesAfterFtoC, 0.0); + expectedFs[1] = 0.1; + expectedFs[3] = 0.1; + setUpFsByCopyingF0(expectedFs, numNodesAfterFtoC); + + // act + copyEdgeNodes(para->getParH(level)->edgeNodesXtoZ, recvProcessNeighborHost, sendProcessNeighborHost); + + // convert result to std::vector + std::vector<real> result; + result.assign(sendProcessNeighborHost[0].f[0], sendProcessNeighborHost[0].f[0] + 27 * numNodesAfterFtoC); + + EXPECT_THAT(result, testing::Eq(expectedFs)); +} + +TEST_F(ExchangeData27Test_CopyEdgeNodesXZTest, copyEdgeNodes_XZ_CommunicationAfterFtoC_recvVectorShort) +{ + int numNodesAfterFtoC = 5; // indexInSend < 5 --> mode is in AfterFToC + setUpRecvProcessNeighbors(numNodesAfterFtoC); + setUpSendProcessNeighbors(numNodesAfterFtoC); + + // expected + std::vector<real> expectedFs(numNodesAfterFtoC, 0.0); + expectedFs[1] = 0.1; + expectedFs[3] = 0.1; + setUpFsByCopyingF0(expectedFs, numNodesAfterFtoC); + + // act + copyEdgeNodes(para->getParH(level)->edgeNodesXtoZ, recvProcessNeighborHost, sendProcessNeighborHost); + + // convert result to std::vector + std::vector<real> result; + result.assign(sendProcessNeighborHost[0].f[0], sendProcessNeighborHost[0].f[0] + 27 * numNodesAfterFtoC); + + EXPECT_THAT(result, testing::Eq(expectedFs)); +} + +TEST_F(ExchangeData27Test_CopyEdgeNodesXZTest, copyEdgeNodes_XZ_CommunicateAll) +{ + setUpRecvProcessNeighbors(numNodes); + setUpSendProcessNeighbors(numNodes); + + // expected + std::vector<real> expectedFs(numNodes, 0.0); + expectedFs[1] = 0.1; + expectedFs[3] = 0.1; + expectedFs[6] = 0.1; + expectedFs[8] = 0.1; + setUpFsByCopyingF0(expectedFs, numNodes); + + // act + copyEdgeNodes(para->getParH(level)->edgeNodesXtoZ, recvProcessNeighborHost, sendProcessNeighborHost); + + // convert result to std::vector + std::vector<real> result; + result.assign(sendProcessNeighborHost[0].f[0], sendProcessNeighborHost[0].f[0] + 27 * numNodes); + + EXPECT_THAT(result, testing::Eq(expectedFs)); +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp index f21ee67a1054f6395b84377cbb71c3b2ff9ceaec..e197fb5c28611e77406b30ab39aa6af2f54b9ef5 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp @@ -9,33 +9,44 @@ #include <GPU/CudaMemoryManager.h> -std::shared_ptr<GridProvider> GridProvider::makeGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager) +std::shared_ptr<GridProvider> GridProvider::makeGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator& communicator) { - return std::shared_ptr<GridProvider>(new GridGenerator(builder, para, cudaManager)); + return std::shared_ptr<GridProvider>(new GridGenerator(builder, para, cudaMemoryManager, communicator)); } -std::shared_ptr<GridProvider> GridProvider::makeGridReader(FILEFORMAT format, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager) +std::shared_ptr<GridProvider> GridProvider::makeGridReader(FILEFORMAT format, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager) { - return std::shared_ptr<GridProvider>(new GridReader(format, para, cudaManager)); + return std::shared_ptr<GridProvider>(new GridReader(format, para, cudaMemoryManager)); } void GridProvider::setNumberOfNodes(const int numberOfNodes, const int level) const { - para->getParH(level)->size_Mat_SP = numberOfNodes; - para->getParD(level)->size_Mat_SP = numberOfNodes; - para->getParH(level)->mem_size_real_SP = sizeof(real) * para->getParH(level)->size_Mat_SP; - para->getParH(level)->mem_size_int_SP = sizeof(uint) * para->getParH(level)->size_Mat_SP; - para->getParD(level)->mem_size_real_SP = sizeof(real) * para->getParD(level)->size_Mat_SP; - para->getParD(level)->mem_size_int_SP = sizeof(uint) * para->getParD(level)->size_Mat_SP; + para->getParH(level)->numberOfNodes = numberOfNodes; + para->getParD(level)->numberOfNodes = numberOfNodes; + para->getParH(level)->mem_size_real_SP = sizeof(real) * para->getParH(level)->numberOfNodes; + para->getParH(level)->mem_size_int_SP = sizeof(uint) * para->getParH(level)->numberOfNodes; + para->getParD(level)->mem_size_real_SP = sizeof(real) * para->getParD(level)->numberOfNodes; + para->getParD(level)->mem_size_int_SP = sizeof(uint) * para->getParD(level)->numberOfNodes; +} + +void GridProvider::setNumberOfFluidNodes(const int numberOfNodes, const int level) const +{ + para->getParH(level)->numberOfFluidNodes = numberOfNodes; + para->getParD(level)->numberOfFluidNodes = numberOfNodes; +} + +void GridProvider::setNumberOfFluidNodesBorder(const int numberOfNodes, const int level) const { + para->getParH(level)->numberOfFluidNodesBorder = numberOfNodes; + para->getParD(level)->numberOfFluidNodesBorder = numberOfNodes; } void GridProvider::setInitalNodeValues(const int numberOfNodes, const int level) const { for (int j = 1; j <= numberOfNodes; j++) { - const real coordX = para->getParH(level)->coordX_SP[j]; - const real coordY = para->getParH(level)->coordY_SP[j]; - const real coordZ = para->getParH(level)->coordZ_SP[j]; + const real coordX = para->getParH(level)->coordinateX[j]; + const real coordY = para->getParH(level)->coordinateY[j]; + const real coordZ = para->getParH(level)->coordinateZ[j]; real rho, vx, vy, vz; @@ -52,10 +63,10 @@ void GridProvider::setInitalNodeValues(const int numberOfNodes, const int level) vz = real(0.0); } - para->getParH(level)->rho_SP[j] = rho; - para->getParH(level)->vx_SP[j] = vx; - para->getParH(level)->vy_SP[j] = vy; - para->getParH(level)->vz_SP[j] = vz; + para->getParH(level)->rho[j] = rho; + para->getParH(level)->velocityX[j] = vx; + para->getParH(level)->velocityY[j] = vy; + para->getParH(level)->velocityZ[j] = vz; ////////////////////////////////////////////////////////////////////////// @@ -95,29 +106,27 @@ void GridProvider::setInitalNodeValues(const int numberOfNodes, const int level) void GridProvider::setPressSizePerLevel(int level, int sizePerLevel) const { - para->getParH(level)->QPress.kQ = sizePerLevel; - para->getParD(level)->QPress.kQ = sizePerLevel; - para->getParH(level)->kPressQread = sizePerLevel * para->getD3Qxx(); - para->getParD(level)->kPressQread = sizePerLevel * para->getD3Qxx(); + para->getParH(level)->pressureBC.numberOfBCnodes = sizePerLevel; + para->getParD(level)->pressureBC.numberOfBCnodes = sizePerLevel; + para->getParH(level)->numberOfPressureBCnodesRead = sizePerLevel * para->getD3Qxx(); + para->getParD(level)->numberOfPressureBCnodesRead = sizePerLevel * para->getD3Qxx(); } void GridProvider::setVelocitySizePerLevel(int level, int sizePerLevel) const { - para->getParH(level)->Qinflow.kQ = sizePerLevel; - para->getParD(level)->Qinflow.kQ = sizePerLevel; - para->getParH(level)->kInflowQ = sizePerLevel; - para->getParD(level)->kInflowQ = sizePerLevel; - para->getParH(level)->kInflowQread = sizePerLevel * para->getD3Qxx(); - para->getParD(level)->kInflowQread = sizePerLevel * para->getD3Qxx(); + para->getParH(level)->velocityBC.numberOfBCnodes = sizePerLevel; + para->getParD(level)->velocityBC.numberOfBCnodes = sizePerLevel; + para->getParH(level)->numberOfVeloBCnodesRead = sizePerLevel * para->getD3Qxx(); + para->getParD(level)->numberOfVeloBCnodesRead = sizePerLevel * para->getD3Qxx(); } void GridProvider::setOutflowSizePerLevel(int level, int sizePerLevel) const { - para->getParH(level)->Qoutflow.kQ = sizePerLevel; - para->getParD(level)->Qoutflow.kQ = sizePerLevel; - para->getParH(level)->kOutflowQread = sizePerLevel * para->getD3Qxx(); - para->getParD(level)->kOutflowQread = sizePerLevel * para->getD3Qxx(); + para->getParH(level)->outflowBC.numberOfBCnodes = sizePerLevel; + para->getParD(level)->outflowBC.numberOfBCnodes = sizePerLevel; + para->getParH(level)->numberOfOutflowBCnodesRead = sizePerLevel * para->getD3Qxx(); + para->getParD(level)->numberOfOutflowBCnodesRead = sizePerLevel * para->getD3Qxx(); } void GridProvider::allocAndCopyForcing() diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h index 70a2a8ec629809689096ce0b33a197924cf000a2..5fc5826735643ec748da169160e782004d7e5fb7 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h @@ -8,8 +8,11 @@ #include "PointerDefinitions.h" #include "VirtualFluids_GPU_export.h" - -#include <GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h> +#include "gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h" +namespace vf::gpu +{ +class Communicator; +} class Parameter; class GridBuilder; @@ -18,13 +21,16 @@ class CudaMemoryManager; class VIRTUALFLUIDS_GPU_EXPORT GridProvider { public: - static std::shared_ptr<GridProvider> makeGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager); - static std::shared_ptr<GridProvider> makeGridReader(FILEFORMAT format, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager); + static std::shared_ptr<GridProvider> makeGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator& communicator); + static std::shared_ptr<GridProvider> makeGridReader(FILEFORMAT format, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager); virtual void allocArrays_CoordNeighborGeo() = 0; virtual void allocArrays_BoundaryValues() = 0; virtual void allocArrays_BoundaryQs() = 0; virtual void allocArrays_OffsetScale() = 0; + virtual void allocArrays_fluidNodeIndices() = 0; + virtual void allocArrays_fluidNodeIndicesBorder() = 0; + virtual void setDimensions() = 0; virtual void setBoundingBox() = 0; virtual void initPeriodicNeigh(std::vector<std::vector<std::vector<unsigned int> > > periodV, std::vector<std::vector<unsigned int> > periodIndex, std::string way) = 0; @@ -34,11 +40,13 @@ public: virtual void freeMemoryOnHost(); virtual void cudaCopyDataToHost(int level); - virtual ~GridProvider() {} + virtual ~GridProvider() = default; virtual void initalGridInformations() = 0; protected: void setNumberOfNodes(const int numberOfNodes, const int level) const; + void setNumberOfFluidNodes(const int numberOfNodes, const int level) const; + void setNumberOfFluidNodesBorder(const int numberOfNodes, const int level) const; virtual void setInitalNodeValues(const int numberOfNodes, const int level) const; void setPressSizePerLevel(int level, int sizePerLevel) const; diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp index 940dbfa617ccd06f5d7b77527cc78b618062240a..fa432a1d9c3922b88e93588548db74083275ef1e 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp @@ -11,10 +11,12 @@ #include <GPU/CudaMemoryManager.h> #include "OffsetScale.h" -GridReader::GridReader(FILEFORMAT format, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager) +using namespace vf::lbm::dir; + +GridReader::GridReader(FILEFORMAT format, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager) { this->para = para; - this->cudaMemoryManager = cudaManager; + this->cudaMemoryManager = cudaMemoryManager; if (format == FILEFORMAT::ASCII) this->binaer = false; @@ -45,11 +47,11 @@ bool GridReader::getBinaer() void rearrangeGeometry(Parameter* para, int lev) { - for (uint index = 0; index < para->getParH(lev)->size_Mat_SP; index++) + for (uint index = 0; index < para->getParH(lev)->numberOfNodes; index++) { - if (para->getParH(lev)->geoSP[index] == GEO_FLUID_OLD) + if (para->getParH(lev)->typeOfGridNode[index] == GEO_FLUID_OLD) { - para->getParH(lev)->geoSP[index] = GEO_FLUID; + para->getParH(lev)->typeOfGridNode[index] = GEO_FLUID; } } } @@ -88,14 +90,14 @@ void GridReader::allocArrays_CoordNeighborGeo() if (para->getUseWale()) cudaMemoryManager->cudaAllocTurbulentViscosity(level); - coordX.initalCoords( para->getParH(level)->coordX_SP, level); - coordY.initalCoords( para->getParH(level)->coordY_SP, level); - coordZ.initalCoords( para->getParH(level)->coordZ_SP, level); - neighX->initalNeighbors( para->getParH(level)->neighborX_SP, level); - neighY->initalNeighbors( para->getParH(level)->neighborY_SP, level); - neighZ->initalNeighbors( para->getParH(level)->neighborZ_SP, level); - neighWSB->initalNeighbors(para->getParH(level)->neighborWSB_SP, level); - geoV.initalNeighbors( para->getParH(level)->geoSP, level); + coordX.initalCoords( para->getParH(level)->coordinateX, level); + coordY.initalCoords( para->getParH(level)->coordinateY, level); + coordZ.initalCoords( para->getParH(level)->coordinateZ, level); + neighX->initalNeighbors( para->getParH(level)->neighborX, level); + neighY->initalNeighbors( para->getParH(level)->neighborY, level); + neighZ->initalNeighbors( para->getParH(level)->neighborZ, level); + neighWSB->initalNeighbors(para->getParH(level)->neighborInverse, level); + geoV.initalNeighbors( para->getParH(level)->typeOfGridNode, level); rearrangeGeometry(para.get(), level); setInitalNodeValues(numberOfNodesPerLevel, level); @@ -216,6 +218,16 @@ void GridReader::allocArrays_OffsetScale() std::cout << "-----Ende OffsetScale------" << std::endl; } +void GridReader::allocArrays_fluidNodeIndices() { + std::cout << "GridReader::allocArrays_fluidNodeIndices not implemented" << std::endl; + // TODO +} + +void GridReader::allocArrays_fluidNodeIndicesBorder() { + std::cout << "GridReader::allocArrays_fluidNodeIndicesBorder not implemented" << std::endl; + // TODO +} + void GridReader::setPressureValues(int channelSide) const { @@ -238,9 +250,9 @@ void GridReader::setPressureValues(int channelSide) const void GridReader::setPressRhoBC(int sizePerLevel, int level, int channelSide) const { - BC_Values[channelSide]->setPressValues(para->getParH(level)->QPress.RhoBC, para->getParH(level)->QPress.kN, level); + BC_Values[channelSide]->setPressValues(para->getParH(level)->pressureBC.RhoBC, para->getParH(level)->pressureBC.kN, level); for (int m = 0; m < sizePerLevel; m++) - para->getParH(level)->QPress.RhoBC[m] = (para->getParH(level)->QPress.RhoBC[m] / para->getFactorPressBC()); + para->getParH(level)->pressureBC.RhoBC[m] = (para->getParH(level)->pressureBC.RhoBC[m] / para->getFactorPressBC()); } @@ -294,9 +306,9 @@ void GridReader::setVelocity(int level, int sizePerLevel) const { for (int index = 0; index < sizePerLevel; index++) { - para->getParH(level)->Qinflow.Vx[index] = this->velocityX_BCvalues[level][index] / para->getVelocityRatio(); - para->getParH(level)->Qinflow.Vy[index] = this->velocityY_BCvalues[level][index] / para->getVelocityRatio(); - para->getParH(level)->Qinflow.Vz[index] = this->velocityZ_BCvalues[level][index] / para->getVelocityRatio(); + para->getParH(level)->velocityBC.Vx[index] = this->velocityX_BCvalues[level][index] / para->getVelocityRatio(); + para->getParH(level)->velocityBC.Vy[index] = this->velocityY_BCvalues[level][index] / para->getVelocityRatio(); + para->getParH(level)->velocityBC.Vz[index] = this->velocityZ_BCvalues[level][index] / para->getVelocityRatio(); } } @@ -323,9 +335,9 @@ void GridReader::setOutflowValues(int channelSide) const void GridReader::setOutflow(int level, int sizePerLevel, int channelSide) const { - BC_Values[channelSide]->setOutflowValues(para->getParH(level)->Qoutflow.RhoBC, para->getParH(level)->Qoutflow.kN, level); + BC_Values[channelSide]->setOutflowValues(para->getParH(level)->outflowBC.RhoBC, para->getParH(level)->outflowBC.kN, level); for (int index = 0; index < sizePerLevel; index++) - para->getParH(level)->Qoutflow.RhoBC[index] = (para->getParH(level)->Qoutflow.RhoBC[index] / para->getFactorPressBC()) * (real)0.0; + para->getParH(level)->outflowBC.RhoBC[index] = (para->getParH(level)->outflowBC.RhoBC[index] / para->getFactorPressBC()) * (real)0.0; } @@ -352,24 +364,24 @@ void GridReader::initalValuesDomainDecompostion(int level) procNeighborsSendX.push_back(pnXsend); procNeighborsRecvX.push_back(pnXrecv); neighborRankX.push_back(process); - std::cout << "MyID: " << para->getMyID() << ", neighborRankX: " << process << std::endl; + std::cout << "MyID: " << para->getMyProcessID() << ", neighborRankX: " << process << std::endl; } if (para->getIsNeighborY()) { procNeighborsSendY.push_back(pnYsend); procNeighborsRecvY.push_back(pnYrecv); neighborRankY.push_back(process); - std::cout << "MyID: " << para->getMyID() << ", neighborRankY: " << process << std::endl; + std::cout << "MyID: " << para->getMyProcessID() << ", neighborRankY: " << process << std::endl; } if (para->getIsNeighborZ()) { procNeighborsSendZ.push_back(pnZsend); procNeighborsRecvZ.push_back(pnZrecv); neighborRankZ.push_back(process); - std::cout << "MyID: " << para->getMyID() << ", neighborRankZ: " << process << std::endl; + std::cout << "MyID: " << para->getMyProcessID() << ", neighborRankZ: " << process << std::endl; } } - std::cout << "MyID: " << para->getMyID() << ", size of neighborRankX: " << neighborRankX.size() << ", size of neighborRankY: " << neighborRankY.size() << ", size of neighborRankZ: " << neighborRankZ.size() << std::endl; + std::cout << "MyID: " << para->getMyProcessID() << ", size of neighborRankX: " << neighborRankX.size() << ", size of neighborRankY: " << neighborRankY.size() << ", size of neighborRankZ: " << neighborRankZ.size() << std::endl; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -386,7 +398,7 @@ void GridReader::initalValuesDomainDecompostion(int level) { //////////////////////////////////////////////////////////////////////////////////////// //send - std::cout << "size of Data for X send buffer, Level " << i << " : " << tempSend << std::endl; + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for X send buffer, Level " << i << " : " << tempSend << "\n"; //////////////////////////////////////////////////////////////////////////////////////// para->setNumberOfProcessNeighborsX((unsigned int)procNeighborsSendX.size(), i, "send"); para->getParH(i)->sendProcessNeighborX[j].rankNeighbor = neighborRankX[j]; @@ -559,7 +571,7 @@ void GridReader::allocArrays_BoundaryQs() for (int lev = 0; lev < (int)(velocityIndex.size()); lev++) { if (velocityIndex[lev].size() > 1) { - copyVectorsToQStruct(velocityQs[lev], velocityIndex[lev], para->getParH(lev)->Qinflow); + copyVectorsToQStruct(velocityQs[lev], velocityIndex[lev], para->getParH(lev)->velocityBC); cudaMemoryManager->cudaCopyVeloBC(lev); } } @@ -582,7 +594,7 @@ void GridReader::setPressQs(std::shared_ptr<BoundaryQs> boundaryQ) const if (hasQs(boundaryQ, level)) { this->printQSize("pressure", boundaryQ, level); - this->initalQStruct(para->getParH(level)->QPress, boundaryQ, level); + this->initalQStruct(para->getParH(level)->pressureBC, boundaryQ, level); cudaMemoryManager->cudaCopyPress(level); } } @@ -607,7 +619,7 @@ void GridReader::setOutflowQs(std::shared_ptr<BoundaryQs> boundaryQ) const if (hasQs(boundaryQ, level)) { this->printQSize("outflow", boundaryQ, level); - this->initalQStruct(para->getParH(level)->Qoutflow, boundaryQ, level); + this->initalQStruct(para->getParH(level)->outflowBC, boundaryQ, level); cudaMemoryManager->cudaCopyOutflowBC(level); } } @@ -621,8 +633,8 @@ void GridReader::setNoSlipQs(std::shared_ptr<BoundaryQs> boundaryQ) const { this->printQSize("no slip", boundaryQ, level); this->setSizeNoSlip(boundaryQ, level); - this->initalQStruct(para->getParH(level)->QWall, boundaryQ, level); - cudaMemoryManager->cudaCopyWallBC(level); + this->initalQStruct(para->getParH(level)->noSlipBC, boundaryQ, level); + cudaMemoryManager->cudaCopyNoSlipBC(level); } } } @@ -635,7 +647,7 @@ void GridReader::setGeoQs(std::shared_ptr<BoundaryQs> boundaryQ) const { this->printQSize("geo Qs", boundaryQ, level); this->setSizeGeoQs(boundaryQ, level); - this->initalQStruct(para->getParH(level)->QGeom, boundaryQ, level); + this->initalQStruct(para->getParH(level)->geometryBC, boundaryQ, level); modifyQElement(boundaryQ, level); @@ -647,10 +659,10 @@ void GridReader::setGeoQs(std::shared_ptr<BoundaryQs> boundaryQ) const void GridReader::modifyQElement(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const { QforBoundaryConditions Q; - real* QQ = para->getParH(level)->QGeom.q27[0]; - Q.q27[dirZERO] = &QQ[dirZERO * para->getParH(level)->QGeom.kQ]; + real* QQ = para->getParH(level)->geometryBC.q27[0]; + Q.q27[vf::lbm::dir::DIR_000] = &QQ[vf::lbm::dir::DIR_000 * para->getParH(level)->geometryBC.numberOfBCnodes]; for (unsigned int i = 0; i < boundaryQ->getSize(level); i++) - Q.q27[dirZERO][i] = 0.0f; + Q.q27[vf::lbm::dir::DIR_000][i] = 0.0f; } /*------------------------------------------------------------------------------------------------*/ @@ -667,7 +679,7 @@ void GridReader::copyVectorsToQStruct(std::vector<std::vector<real>> &Qs, std::vector<int> &index, QforBoundaryConditions &Q) const { QforBoundaryConditions qTemp; - this->setQ27Size(qTemp, Q.q27[0], Q.kQ); + this->setQ27Size(qTemp, Q.q27[0], Q.numberOfBCnodes); uint sizeOfValues = (uint)index.size(); @@ -686,7 +698,7 @@ void GridReader::initalQStruct(QforBoundaryConditions &Q, std::shared_ptr<Bounda unsigned int level) const { QforBoundaryConditions qTemp; - this->setQ27Size(qTemp, Q.q27[0], Q.kQ); + this->setQ27Size(qTemp, Q.q27[0], Q.numberOfBCnodes); boundaryQ->setValues(qTemp.q27, level); boundaryQ->setIndex(Q.k, level); } @@ -721,48 +733,46 @@ void GridReader::initalGridInformations() void GridReader::setQ27Size(QforBoundaryConditions &Q, real* QQ, unsigned int sizeQ) const { - Q.q27[dirE] = &QQ[dirE *sizeQ]; - Q.q27[dirW] = &QQ[dirW *sizeQ]; - Q.q27[dirN] = &QQ[dirN *sizeQ]; - Q.q27[dirS] = &QQ[dirS *sizeQ]; - Q.q27[dirT] = &QQ[dirT *sizeQ]; - Q.q27[dirB] = &QQ[dirB *sizeQ]; - Q.q27[dirNE] = &QQ[dirNE *sizeQ]; - Q.q27[dirSW] = &QQ[dirSW *sizeQ]; - Q.q27[dirSE] = &QQ[dirSE *sizeQ]; - Q.q27[dirNW] = &QQ[dirNW *sizeQ]; - Q.q27[dirTE] = &QQ[dirTE *sizeQ]; - Q.q27[dirBW] = &QQ[dirBW *sizeQ]; - Q.q27[dirBE] = &QQ[dirBE *sizeQ]; - Q.q27[dirTW] = &QQ[dirTW *sizeQ]; - Q.q27[dirTN] = &QQ[dirTN *sizeQ]; - Q.q27[dirBS] = &QQ[dirBS *sizeQ]; - Q.q27[dirBN] = &QQ[dirBN *sizeQ]; - Q.q27[dirTS] = &QQ[dirTS *sizeQ]; - Q.q27[dirZERO] = &QQ[dirZERO*sizeQ]; - Q.q27[dirTNE] = &QQ[dirTNE *sizeQ]; - Q.q27[dirTSW] = &QQ[dirTSW *sizeQ]; - Q.q27[dirTSE] = &QQ[dirTSE *sizeQ]; - Q.q27[dirTNW] = &QQ[dirTNW *sizeQ]; - Q.q27[dirBNE] = &QQ[dirBNE *sizeQ]; - Q.q27[dirBSW] = &QQ[dirBSW *sizeQ]; - Q.q27[dirBSE] = &QQ[dirBSE *sizeQ]; - Q.q27[dirBNW] = &QQ[dirBNW *sizeQ]; + Q.q27[DIR_P00] = &QQ[DIR_P00 *sizeQ]; + Q.q27[DIR_M00] = &QQ[DIR_M00 *sizeQ]; + Q.q27[DIR_0P0] = &QQ[DIR_0P0 *sizeQ]; + Q.q27[DIR_0M0] = &QQ[DIR_0M0 *sizeQ]; + Q.q27[DIR_00P] = &QQ[DIR_00P *sizeQ]; + Q.q27[DIR_00M] = &QQ[DIR_00M *sizeQ]; + Q.q27[DIR_PP0] = &QQ[DIR_PP0 *sizeQ]; + Q.q27[DIR_MM0] = &QQ[DIR_MM0 *sizeQ]; + Q.q27[DIR_PM0] = &QQ[DIR_PM0 *sizeQ]; + Q.q27[DIR_MP0] = &QQ[DIR_MP0 *sizeQ]; + Q.q27[DIR_P0P] = &QQ[DIR_P0P *sizeQ]; + Q.q27[DIR_M0M] = &QQ[DIR_M0M *sizeQ]; + Q.q27[DIR_P0M] = &QQ[DIR_P0M *sizeQ]; + Q.q27[DIR_M0P] = &QQ[DIR_M0P *sizeQ]; + Q.q27[DIR_0PP] = &QQ[DIR_0PP *sizeQ]; + Q.q27[DIR_0MM] = &QQ[DIR_0MM *sizeQ]; + Q.q27[DIR_0PM] = &QQ[DIR_0PM *sizeQ]; + Q.q27[DIR_0MP] = &QQ[DIR_0MP *sizeQ]; + Q.q27[DIR_000] = &QQ[DIR_000*sizeQ]; + Q.q27[DIR_PPP] = &QQ[DIR_PPP *sizeQ]; + Q.q27[DIR_MMP] = &QQ[DIR_MMP *sizeQ]; + Q.q27[DIR_PMP] = &QQ[DIR_PMP *sizeQ]; + Q.q27[DIR_MPP] = &QQ[DIR_MPP *sizeQ]; + Q.q27[DIR_PPM] = &QQ[DIR_PPM *sizeQ]; + Q.q27[DIR_MMM] = &QQ[DIR_MMM *sizeQ]; + Q.q27[DIR_PMM] = &QQ[DIR_PMM *sizeQ]; + Q.q27[DIR_MPM] = &QQ[DIR_MPM *sizeQ]; } void GridReader::setSizeNoSlip(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const { - para->getParH(level)->QWall.kQ = boundaryQ->getSize(level); - para->getParD(level)->QWall.kQ = para->getParH(level)->QWall.kQ; - para->getParH(level)->kQ = para->getParH(level)->QWall.kQ; - para->getParD(level)->kQ = para->getParH(level)->QWall.kQ; - cudaMemoryManager->cudaAllocWallBC(level); + para->getParH(level)->noSlipBC.numberOfBCnodes = boundaryQ->getSize(level); + para->getParD(level)->noSlipBC.numberOfBCnodes = para->getParH(level)->noSlipBC.numberOfBCnodes; + cudaMemoryManager->cudaAllocNoSlipBC(level); } void GridReader::setSizeGeoQs(std::shared_ptr<BoundaryQs> boundaryQ, unsigned int level) const { - para->getParH(level)->QGeom.kQ = boundaryQ->getSize(level); - para->getParD(level)->QGeom.kQ = para->getParH(level)->QGeom.kQ; + para->getParH(level)->geometryBC.numberOfBCnodes = boundaryQ->getSize(level); + para->getParD(level)->geometryBC.numberOfBCnodes = para->getParH(level)->geometryBC.numberOfBCnodes; cudaMemoryManager->cudaAllocGeomBC(level); } diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h index f7a4c43062da79d39c43e6822688c51ad55e7442..18efb6a7885191312ea4e2fbb22eb45162ab1de1 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h @@ -34,11 +34,13 @@ private: std::vector<std::vector<real>> outflowBCvalues; public: - GridReader(FILEFORMAT format, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager); + GridReader(FILEFORMAT format, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager); ~GridReader(); void allocArrays_CoordNeighborGeo() override; void allocArrays_BoundaryValues() override; void allocArrays_OffsetScale() override; + void allocArrays_fluidNodeIndices() override; + void allocArrays_fluidNodeIndicesBorder() override; void initalValuesDomainDecompostion(int level); diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp index 6edd22963d51404eaf683be77b74e1bba543881c..7f61b4357276f38d8fde71489dcf60348b402941 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp @@ -1,33 +1,41 @@ #include "GridGenerator.h" #include "Parameter/Parameter.h" -#include <GridGenerator/grid/GridBuilder/GridBuilder.h> -#include <GPU/CudaMemoryManager.h> +#include "GridGenerator/grid/GridBuilder/GridBuilder.h" +#include "GPU/CudaMemoryManager.h" +#include "IndexRearrangementForStreams.h" +#include "InterpolationCellGrouper.h" -#include <sstream> #include <iostream> +#include <algorithm> #include "utilities/math/Math.h" -#include "LBM/LB.h" #include "Output/QDebugWriter.hpp" #include "utilities/communication.h" +#include "Communication/Communicator.h" +using namespace vf::lbm::dir; - -GridGenerator::GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager) +GridGenerator::GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator& communicator): + mpiProcessID(communicator.getPID()), builder(builder) { - this->builder = builder; this->para = para; - this->cudaMemoryManager = cudaManager; + this->cudaMemoryManager = cudaMemoryManager; + this->indexRearrangement = std::make_unique<IndexRearrangementForStreams>(para, builder, communicator); + this->interpolationGrouper = std::make_unique<InterpolationCellGrouper>(para->getParHallLevels(), para->getParDallLevels(), builder); } -GridGenerator::~GridGenerator() -{ +GridGenerator::~GridGenerator() = default; +void GridGenerator::setIndexRearrangementForStreams(std::unique_ptr<IndexRearrangementForStreams> &&indexRearrangement) +{ + this->indexRearrangement = std::move(indexRearrangement); } void GridGenerator::initalGridInformations() { + if (para->getKernelNeedsFluidNodeIndicesToRun()) + builder->findFluidNodes(para->getUseStreams()); std::vector<int> gridX, gridY, gridZ; std::vector<int> distX, distY, distZ; const int numberOfGridLevels = builder->getNumberOfGridLevels(); @@ -44,41 +52,41 @@ void GridGenerator::initalGridInformations() void GridGenerator::allocArrays_CoordNeighborGeo() { const uint numberOfLevels = builder->getNumberOfGridLevels(); - std::cout << "Number of Level: " << numberOfLevels << std::endl; - int numberOfNodesGlobal = 0; - std::cout << "Number of Nodes: " << std::endl; - - for (uint level = 0; level < numberOfLevels; level++) - { - const int numberOfNodesPerLevel = builder->getNumberOfNodes(level) + 1; - numberOfNodesGlobal += numberOfNodesPerLevel; - std::cout << "Level " << level << " = " << numberOfNodesPerLevel << " Nodes" << std::endl; - - setNumberOfNodes(numberOfNodesPerLevel, level); - - cudaMemoryManager->cudaAllocCoord(level); + std::cout << "Number of Level: " << numberOfLevels << std::endl; + int numberOfNodesGlobal = 0; + std::cout << "Number of Nodes: " << std::endl; + + for (uint level = 0; level < numberOfLevels; level++) + { + const int numberOfNodesPerLevel = builder->getNumberOfNodes(level) + 1; + numberOfNodesGlobal += numberOfNodesPerLevel; + std::cout << "Level " << level << " = " << numberOfNodesPerLevel << " Nodes" << std::endl; + + setNumberOfNodes(numberOfNodesPerLevel, level); + + cudaMemoryManager->cudaAllocCoord(level); cudaMemoryManager->cudaAllocSP(level); //cudaMemoryManager->cudaAllocF3SP(level); - cudaMemoryManager->cudaAllocNeighborWSB(level); + cudaMemoryManager->cudaAllocNeighborWSB(level); - if(para->getUseWale()) + if(para->getUseTurbulentViscosity()) cudaMemoryManager->cudaAllocTurbulentViscosity(level); if(para->getIsBodyForce()) cudaMemoryManager->cudaAllocBodyForce(level); - builder->getNodeValues( - para->getParH(level)->coordX_SP, - para->getParH(level)->coordY_SP, - para->getParH(level)->coordZ_SP, - para->getParH(level)->neighborX_SP, - para->getParH(level)->neighborY_SP, - para->getParH(level)->neighborZ_SP, - para->getParH(level)->neighborWSB_SP, - para->getParH(level)->geoSP, - level); + builder->getNodeValues( + para->getParH(level)->coordinateX, + para->getParH(level)->coordinateY, + para->getParH(level)->coordinateZ, + para->getParH(level)->neighborX, + para->getParH(level)->neighborY, + para->getParH(level)->neighborZ, + para->getParH(level)->neighborInverse, + para->getParH(level)->typeOfGridNode, + level); - setInitalNodeValues(numberOfNodesPerLevel, level); + setInitalNodeValues(numberOfNodesPerLevel, level); cudaMemoryManager->cudaCopyNeighborWSB(level); cudaMemoryManager->cudaCopySP(level); @@ -87,67 +95,116 @@ void GridGenerator::allocArrays_CoordNeighborGeo() cudaMemoryManager->cudaCopyBodyForce(level); //std::cout << verifyNeighborIndices(level); - } - std::cout << "Number of Nodes: " << numberOfNodesGlobal << std::endl; - std::cout << "-----finish Coord, Neighbor, Geo------" << std::endl; + } + std::cout << "Number of Nodes: " << numberOfNodesGlobal << std::endl; + std::cout << "-----finish Coord, Neighbor, Geo------" << std::endl; +} + +void GridGenerator::allocArrays_fluidNodeIndices() { + for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { + setNumberOfFluidNodes(builder->getNumberOfFluidNodes(level), level); + cudaMemoryManager->cudaAllocFluidNodeIndices(level); + builder->getFluidNodeIndices(para->getParH(level)->fluidNodeIndices, level); + cudaMemoryManager->cudaCopyFluidNodeIndices(level); + } +} + +void GridGenerator::allocArrays_fluidNodeIndicesBorder() { + for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { + setNumberOfFluidNodesBorder(builder->getNumberOfFluidNodesBorder(level), level); + cudaMemoryManager->cudaAllocFluidNodeIndicesBorder(level); + builder->getFluidNodeIndicesBorder(para->getParH(level)->fluidNodeIndicesBorder, level); + cudaMemoryManager->cudaCopyFluidNodeIndicesBorder(level); + } } void GridGenerator::allocArrays_BoundaryValues() { - std::cout << "------read BoundaryValues------" << std::endl; + std::cout << "------read BoundaryValues------" << std::endl; + int blocks = 0; for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { const auto numberOfPressureValues = int(builder->getPressureSize(level)); + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size pressure level " << level << " : " << numberOfPressureValues << "\n"; - std::cout << "size pressure level " << level << " : " << numberOfPressureValues << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->QPress.kQ = numberOfPressureValues; - para->getParD(level)->QPress.kQ = numberOfPressureValues; - para->getParH(level)->kPressQread = numberOfPressureValues * para->getD3Qxx(); - para->getParD(level)->kPressQread = numberOfPressureValues * para->getD3Qxx(); + para->getParH(level)->pressureBC.numberOfBCnodes = 0; if (numberOfPressureValues > 1) { + blocks = (numberOfPressureValues / para->getParH(level)->numberofthreads) + 1; + para->getParH(level)->pressureBC.numberOfBCnodes = blocks * para->getParH(level)->numberofthreads; cudaMemoryManager->cudaAllocPress(level); - builder->getPressureValues(para->getParH(level)->QPress.RhoBC, para->getParH(level)->QPress.k, para->getParH(level)->QPress.kN, level); + builder->getPressureValues(para->getParH(level)->pressureBC.RhoBC, para->getParH(level)->pressureBC.k, para->getParH(level)->pressureBC.kN, level); cudaMemoryManager->cudaCopyPress(level); } + para->getParD(level)->pressureBC.numberOfBCnodes = para->getParH(level)->pressureBC.numberOfBCnodes; + para->getParH(level)->numberOfPressureBCnodesRead = para->getParH(level)->pressureBC.numberOfBCnodes * para->getD3Qxx(); + para->getParD(level)->numberOfPressureBCnodesRead = para->getParH(level)->pressureBC.numberOfBCnodes * para->getD3Qxx(); + } + + for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { + const auto numberOfSlipValues = int(builder->getSlipSize(level)); + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size slip level " << level << " : " << numberOfSlipValues << "\n"; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->slipBC.numberOfBCnodes = 0; + if (numberOfSlipValues > 1) + { + blocks = (numberOfSlipValues / para->getParH(level)->numberofthreads) + 1; + para->getParH(level)->slipBC.numberOfBCnodes = blocks * para->getParH(level)->numberofthreads; + cudaMemoryManager->cudaAllocSlipBC(level); + builder->getSlipValues(para->getParH(level)->slipBC.normalX, para->getParH(level)->slipBC.normalY, para->getParH(level)->slipBC.normalZ, para->getParH(level)->slipBC.k, level); + cudaMemoryManager->cudaCopySlipBC(level); + } + para->getParD(level)->slipBC.numberOfBCnodes = para->getParH(level)->slipBC.numberOfBCnodes; + para->getParH(level)->numberOfSlipBCnodesRead = para->getParH(level)->slipBC.numberOfBCnodes * para->getD3Qxx(); + para->getParD(level)->numberOfSlipBCnodesRead = para->getParH(level)->slipBC.numberOfBCnodes * para->getD3Qxx(); + } + + for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { + const auto numberOfStressValues = int(builder->getStressSize(level)); + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size stress level " << level << " : " << numberOfStressValues << "\n"; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->stressBC.numberOfBCnodes = 0; + if (numberOfStressValues > 1) + { + blocks = (numberOfStressValues / para->getParH(level)->numberofthreads) + 1; + para->getParH(level)->stressBC.numberOfBCnodes = blocks * para->getParH(level)->numberofthreads; + cudaMemoryManager->cudaAllocStressBC(level); + cudaMemoryManager->cudaAllocWallModel(level, para->getHasWallModelMonitor()); + builder->getStressValues( para->getParH(level)->stressBC.normalX, para->getParH(level)->stressBC.normalY, para->getParH(level)->stressBC.normalZ, + para->getParH(level)->stressBC.Vx, para->getParH(level)->stressBC.Vy, para->getParH(level)->stressBC.Vz, + para->getParH(level)->stressBC.Vx1, para->getParH(level)->stressBC.Vy1, para->getParH(level)->stressBC.Vz1, + para->getParH(level)->stressBC.k, para->getParH(level)->stressBC.kN, + para->getParH(level)->wallModel.samplingOffset, para->getParH(level)->wallModel.z0, + level); + + cudaMemoryManager->cudaCopyStressBC(level); + cudaMemoryManager->cudaCopyWallModel(level, para->getHasWallModelMonitor()); + } + para->getParD(level)->stressBC.numberOfBCnodes = para->getParH(level)->stressBC.numberOfBCnodes; + para->getParH(level)->numberOfStressBCnodesRead = para->getParH(level)->stressBC.numberOfBCnodes * para->getD3Qxx(); + para->getParD(level)->numberOfStressBCnodesRead = para->getParH(level)->stressBC.numberOfBCnodes * para->getD3Qxx(); } for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { const auto numberOfVelocityValues = int(builder->getVelocitySize(level)); - 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; - para->getParD(level)->Qinflow.kArray = para->getParH(level)->Qinflow.kArray; + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size velocity level " << level << " : " << numberOfVelocityValues << "\n"; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->Qinflow.kQ = numberOfVelocityValues; - para->getParD(level)->Qinflow.kQ = numberOfVelocityValues; - para->getParH(level)->kInflowQ = numberOfVelocityValues; - para->getParD(level)->kInflowQ = numberOfVelocityValues; - para->getParH(level)->kInflowQread = numberOfVelocityValues * para->getD3Qxx(); - para->getParD(level)->kInflowQread = numberOfVelocityValues * para->getD3Qxx(); + + para->getParH(level)->velocityBC.numberOfBCnodes = 0; if (numberOfVelocityValues > 1) { + blocks = (numberOfVelocityValues / para->getParH(level)->numberofthreads) + 1; + para->getParH(level)->velocityBC.numberOfBCnodes = blocks * para->getParH(level)->numberofthreads; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaAllocVeloBC(level); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - builder->getVelocityValues(para->getParH(level)->Qinflow.Vx, para->getParH(level)->Qinflow.Vy, para->getParH(level)->Qinflow.Vz, para->getParH(level)->Qinflow.k, level); - - - //for (int i = 0; i < numberOfVelocityValues; i++) - //{ - // std::cout << "index: " << para->getParH(level)->Qinflow.k[i]; - // std::cout << " (x,y,z)" << para->getParH(level)->coordX_SP[para->getParH(level)->Qinflow.k[i]]; - // std::cout << ", " << para->getParH(level)->coordY_SP[para->getParH(level)->Qinflow.k[i]]; - // std::cout << ", " << para->getParH(level)->coordZ_SP[para->getParH(level)->Qinflow.k[i]]; - // std::cout << " geo: " << para->getParH(level)->geoSP[para->getParH(level)->Qinflow.k[i]]; - // std::cout << std::endl; - //} - + builder->getVelocityValues(para->getParH(level)->velocityBC.Vx, para->getParH(level)->velocityBC.Vy, para->getParH(level)->velocityBC.Vz, para->getParH(level)->velocityBC.k, level); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -156,512 +213,550 @@ void GridGenerator::allocArrays_BoundaryValues() //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // advection - diffusion stuff if (para->getDiffOn()==true){ - ////////////////////////////////////////////////////////////////////////// - para->getParH(level)->TempVel.kTemp = numberOfVelocityValues; - //cout << "Groesse kTemp = " << para->getParH(i)->TempPress.kTemp << endl; - std::cout << "getTemperatureInit = " << para->getTemperatureInit() << std::endl; - std::cout << "getTemperatureBC = " << para->getTemperatureBC() << std::endl; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// + para->getParH(level)->TempVel.kTemp = para->getParH(level)->velocityBC.numberOfBCnodes; + //cout << "Groesse kTemp = " << para->getParH(i)->TempPress.kTemp << endl; + std::cout << "getTemperatureInit = " << para->getTemperatureInit() << std::endl; + std::cout << "getTemperatureBC = " << para->getTemperatureBC() << std::endl; + ////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaAllocTempVeloBC(level); - //cout << "nach alloc " << endl; - ////////////////////////////////////////////////////////////////////////// - for (int m = 0; m < numberOfVelocityValues; m++) - { - para->getParH(level)->TempVel.temp[m] = para->getTemperatureInit(); - para->getParH(level)->TempVel.tempPulse[m] = para->getTemperatureBC(); - para->getParH(level)->TempVel.velo[m] = para->getVelocity(); - para->getParH(level)->TempVel.k[m] = para->getParH(level)->Qinflow.k[m]; - } - ////////////////////////////////////////////////////////////////////////// - //cout << "vor copy " << endl; + //cout << "nach alloc " << endl; + ////////////////////////////////////////////////////////////////////////// + for (uint m = 0; m < para->getParH(level)->velocityBC.numberOfBCnodes; m++) + { + para->getParH(level)->TempVel.temp[m] = para->getTemperatureInit(); + para->getParH(level)->TempVel.tempPulse[m] = para->getTemperatureBC(); + para->getParH(level)->TempVel.velo[m] = para->getVelocity(); + para->getParH(level)->TempVel.k[m] = para->getParH(level)->velocityBC.k[m]; + } + ////////////////////////////////////////////////////////////////////////// + //cout << "vor copy " << endl; cudaMemoryManager->cudaCopyTempVeloBCHD(level); - //cout << "nach copy " << endl; - ////////////////////////////////////////////////////////////////////////// + //cout << "nach copy " << endl; + ////////////////////////////////////////////////////////////////////////// } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } + para->getParD(level)->velocityBC.numberOfBCnodes = para->getParH(level)->velocityBC.numberOfBCnodes; + para->getParH(level)->numberOfVeloBCnodesRead = para->getParH(level)->velocityBC.numberOfBCnodes * para->getD3Qxx(); + para->getParD(level)->numberOfVeloBCnodesRead = para->getParH(level)->velocityBC.numberOfBCnodes * para->getD3Qxx(); } if (builder->hasGeometryValues()) { - para->setGeometryValues(true); - for (uint i = 0; i < builder->getNumberOfGridLevels(); i++) { - int numberOfGeometryValues = builder->getGeometrySize(i); - std::cout << "size geometry values, Level " << i << " : " << numberOfGeometryValues << std::endl; + para->setUseGeometryValues(true); + for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { + int numberOfGeometryValues = builder->getGeometrySize(level); + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size geometry values, Level " << level << " : " << numberOfGeometryValues << "\n"; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - para->getParH(i)->QGeom.kQ = numberOfGeometryValues; - para->getParD(i)->QGeom.kQ = numberOfGeometryValues; + + para->getParH(level)->geometryBC.numberOfBCnodes = 0; if (numberOfGeometryValues > 0) { - + blocks = (numberOfGeometryValues / para->getParH(level)->numberofthreads) + 1; + para->getParH(level)->geometryBC.numberOfBCnodes = blocks * para->getParH(level)->numberofthreads; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - cudaMemoryManager->cudaAllocGeomValuesBC(i); + cudaMemoryManager->cudaAllocGeomValuesBC(level); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Indexarray - builder->getGeometryValues(para->getParH(i)->QGeom.Vx, para->getParH(i)->QGeom.Vy, para->getParH(i)->QGeom.Vz, i); + builder->getGeometryValues(para->getParH(level)->geometryBC.Vx, para->getParH(level)->geometryBC.Vy, para->getParH(level)->geometryBC.Vz, level); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - for (int m = 0; m < numberOfGeometryValues; m++) + for (uint m = 0; m < para->getParH(level)->geometryBC.numberOfBCnodes; m++) { - para->getParH(i)->QGeom.Vx[m] = para->getParH(i)->QGeom.Vx[m] / para->getVelocityRatio(); - para->getParH(i)->QGeom.Vy[m] = para->getParH(i)->QGeom.Vy[m] / para->getVelocityRatio(); - para->getParH(i)->QGeom.Vz[m] = para->getParH(i)->QGeom.Vz[m] / para->getVelocityRatio(); - //para->getParH(i)->QGeom.Vx[m] = para->getParH(i)->QGeom.Vx[m] / 100.0f; - //para->getParH(i)->QGeom.Vy[m] = para->getParH(i)->QGeom.Vy[m] / 100.0f; - //para->getParH(i)->QGeom.Vz[m] = para->getParH(i)->QGeom.Vz[m] / 100.0f; - //para->getParH(i)->QGeom.Vx[m] = 0.0f; - //para->getParH(i)->QGeom.Vy[m] = 0.0f; - //para->getParH(i)->QGeom.Vz[m] = 0.0f; + para->getParH(level)->geometryBC.Vx[m] = para->getParH(level)->geometryBC.Vx[m] / para->getVelocityRatio(); + para->getParH(level)->geometryBC.Vy[m] = para->getParH(level)->geometryBC.Vy[m] / para->getVelocityRatio(); + para->getParH(level)->geometryBC.Vz[m] = para->getParH(level)->geometryBC.Vz[m] / para->getVelocityRatio(); } - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////T�st - //for (int m = 0; m < temp4; m++) - //{ - // para->getParH(i)->QGeom.Vx[m] = para->getVelocity();//0.035f; - // para->getParH(i)->QGeom.Vy[m] = 0.0f;//para->getVelocity();//0.0f; - // para->getParH(i)->QGeom.Vz[m] = 0.0f; - //} - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - cudaMemoryManager->cudaCopyGeomValuesBC(i); + cudaMemoryManager->cudaCopyGeomValuesBC(level); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// advection - diffusion stuff //if (para->getDiffOn()==true){ - // ////////////////////////////////////////////////////////////////////////// - // para->getParH(i)->Temp.kTemp = temp4; - // cout << "Groesse kTemp = " << para->getParH(i)->Temp.kTemp << std::endl; - // ////////////////////////////////////////////////////////////////////////// - // para->cudaAllocTempNoSlipBC(i); - // ////////////////////////////////////////////////////////////////////////// - // for (int m = 0; m < temp4; m++) - // { - // para->getParH(i)->Temp.temp[m] = para->getTemperatureInit(); - // para->getParH(i)->Temp.k[m] = para->getParH(i)->QGeom.k[m]; - // } - // ////////////////////////////////////////////////////////////////////////// - // para->cudaCopyTempNoSlipBCHD(i); - // ////////////////////////////////////////////////////////////////////////// + // ////////////////////////////////////////////////////////////////////////// + // para->getParH(i)->Temp.kTemp = temp4; + // cout << "Groesse kTemp = " << para->getParH(i)->Temp.kTemp << "\n"; + // ////////////////////////////////////////////////////////////////////////// + // para->cudaAllocTempNoSlipBC(i); + // ////////////////////////////////////////////////////////////////////////// + // for (int m = 0; m < temp4; m++) + // { + // para->getParH(i)->Temp.temp[m] = para->getTemperatureInit(); + // para->getParH(i)->Temp.k[m] = para->getParH(i)->geometryBC.k[m]; + // } + // ////////////////////////////////////////////////////////////////////////// + // para->cudaCopyTempNoSlipBCHD(i); + // ////////////////////////////////////////////////////////////////////////// //} //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } + para->getParD(level)->geometryBC.numberOfBCnodes = para->getParH(level)->geometryBC.numberOfBCnodes; + } }//ende geo - if ((para->getNumprocs() > 1) /*&& (procNeighborsSendX.size() == procNeighborsRecvX.size())*/) - { - for (int direction = 0; direction < 6; direction++) - { - if( builder->getCommunicationProcess(direction) == INVALID_INDEX ) continue; + initalValuesDomainDecompostion(); +} - for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) +void GridGenerator::initalValuesDomainDecompostion() +{ + if (para->getNumprocs() < 2) + return; + if ((para->getNumprocs() > 1) /*&& (procNeighborsSendX.size() == procNeighborsRecvX.size())*/) { + + // direction has to be changed in case of periodic BCs and multiple sub domains + std::vector<int> fillOrder = { 0, 1, 2, 3, 4, 5 }; + + for (int direction = 0; direction < 6; direction++) { + if (direction % 2 > 0 && mpiProcessID % 2 > 0 && (builder->getCommunicationProcess(direction) == builder->getCommunicationProcess(direction - 1))) { - if( direction == CommunicationDirections::MX || direction == CommunicationDirections::PX ) - { - int j = (int)para->getParH(level)->sendProcessNeighborX.size(); - - para->getParH(level)->sendProcessNeighborX.emplace_back(); - para->getParD(level)->sendProcessNeighborX.emplace_back(); - para->getParH(level)->recvProcessNeighborX.emplace_back(); - para->getParD(level)->recvProcessNeighborX.emplace_back(); - if (para->getDiffOn()==true){ - para->getParH(level)->sendProcessNeighborADX.emplace_back(); - para->getParD(level)->sendProcessNeighborADX.emplace_back(); - para->getParH(level)->recvProcessNeighborADX.emplace_back(); - para->getParD(level)->recvProcessNeighborADX.emplace_back(); - } - - int tempSend = builder->getNumberOfSendIndices( direction, level ); - int tempRecv = builder->getNumberOfReceiveIndices( direction, level ); - if (tempSend > 0) - { - //////////////////////////////////////////////////////////////////////////////////////// - //send - std::cout << "size of Data for X send buffer, Level " << level << " : " << tempSend << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborX.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborX.back().numberOfNodes = tempSend; - para->getParD(level)->sendProcessNeighborX.back().numberOfNodes = tempSend; - para->getParH(level)->sendProcessNeighborX.back().numberOfFs = para->getD3Qxx() * tempSend; - para->getParD(level)->sendProcessNeighborX.back().numberOfFs = para->getD3Qxx() * tempSend; - para->getParH(level)->sendProcessNeighborX.back().memsizeIndex = sizeof(unsigned int)*tempSend; - para->getParD(level)->sendProcessNeighborX.back().memsizeIndex = sizeof(unsigned int)*tempSend; - para->getParH(level)->sendProcessNeighborX.back().memsizeFs = sizeof(real) *tempSend; - para->getParD(level)->sendProcessNeighborX.back().memsizeFs = sizeof(real) *tempSend; - //////////////////////////////////////////////////////////////////////////////////////// - //recv - std::cout << "size of Data for X receive buffer, Level " << level << " : " << tempRecv << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborX.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborX.back().numberOfNodes = tempRecv; - para->getParD(level)->recvProcessNeighborX.back().numberOfNodes = tempRecv; - para->getParH(level)->recvProcessNeighborX.back().numberOfFs = para->getD3Qxx() * tempRecv; - para->getParD(level)->recvProcessNeighborX.back().numberOfFs = para->getD3Qxx() * tempRecv; - para->getParH(level)->recvProcessNeighborX.back().memsizeIndex = sizeof(unsigned int)*tempRecv; - para->getParD(level)->recvProcessNeighborX.back().memsizeIndex = sizeof(unsigned int)*tempRecv; - para->getParH(level)->recvProcessNeighborX.back().memsizeFs = sizeof(real) *tempRecv; - para->getParD(level)->recvProcessNeighborX.back().memsizeFs = sizeof(real) *tempRecv; - //////////////////////////////////////////////////////////////////////////////////////// - //malloc on host and device - cudaMemoryManager->cudaAllocProcessNeighborX(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - //init index arrays - builder->getSendIndices (para->getParH(level)->sendProcessNeighborX[j].index, direction, level); - builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborX[j].index, direction, level); - //////////////////////////////////////////////////////////////////////////////////////// - cudaMemoryManager->cudaCopyProcessNeighborXIndex(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - } - } - - if( direction == CommunicationDirections::MY || direction == CommunicationDirections::PY ) - { - int j = (int)para->getParH(level)->sendProcessNeighborY.size(); - - para->getParH(level)->sendProcessNeighborY.emplace_back(); - para->getParD(level)->sendProcessNeighborY.emplace_back(); - para->getParH(level)->recvProcessNeighborY.emplace_back(); - para->getParD(level)->recvProcessNeighborY.emplace_back(); - if (para->getDiffOn()==true){ - para->getParH(level)->sendProcessNeighborADY.emplace_back(); - para->getParD(level)->sendProcessNeighborADY.emplace_back(); - para->getParH(level)->recvProcessNeighborADY.emplace_back(); - para->getParD(level)->recvProcessNeighborADY.emplace_back(); - } - - int tempSend = builder->getNumberOfSendIndices( direction, level ); - int tempRecv = builder->getNumberOfReceiveIndices( direction, level ); - if (tempSend > 0) - { - //////////////////////////////////////////////////////////////////////////////////////// - //send - std::cout << "size of Data for X send buffer, Level " << level << " : " << tempSend << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborY.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborY.back().numberOfNodes = tempSend; - para->getParD(level)->sendProcessNeighborY.back().numberOfNodes = tempSend; - para->getParH(level)->sendProcessNeighborY.back().numberOfFs = para->getD3Qxx() * tempSend; - para->getParD(level)->sendProcessNeighborY.back().numberOfFs = para->getD3Qxx() * tempSend; - para->getParH(level)->sendProcessNeighborY.back().memsizeIndex = sizeof(unsigned int)*tempSend; - para->getParD(level)->sendProcessNeighborY.back().memsizeIndex = sizeof(unsigned int)*tempSend; - para->getParH(level)->sendProcessNeighborY.back().memsizeFs = sizeof(real) *tempSend; - para->getParD(level)->sendProcessNeighborY.back().memsizeFs = sizeof(real) *tempSend; - //////////////////////////////////////////////////////////////////////////////////////// - //recv - std::cout << "size of Data for X receive buffer, Level " << level << " : " << tempRecv << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborY.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborY.back().numberOfNodes = tempRecv; - para->getParD(level)->recvProcessNeighborY.back().numberOfNodes = tempRecv; - para->getParH(level)->recvProcessNeighborY.back().numberOfFs = para->getD3Qxx() * tempRecv; - para->getParD(level)->recvProcessNeighborY.back().numberOfFs = para->getD3Qxx() * tempRecv; - para->getParH(level)->recvProcessNeighborY.back().memsizeIndex = sizeof(unsigned int)*tempRecv; - para->getParD(level)->recvProcessNeighborY.back().memsizeIndex = sizeof(unsigned int)*tempRecv; - para->getParH(level)->recvProcessNeighborY.back().memsizeFs = sizeof(real) *tempRecv; - para->getParD(level)->recvProcessNeighborY.back().memsizeFs = sizeof(real) *tempRecv; - //////////////////////////////////////////////////////////////////////////////////////// - //malloc on host and device - cudaMemoryManager->cudaAllocProcessNeighborY(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - //init index arrays - builder->getSendIndices (para->getParH(level)->sendProcessNeighborY[j].index, direction, level); - builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborY[j].index, direction, level); - //////////////////////////////////////////////////////////////////////////////////////// - cudaMemoryManager->cudaCopyProcessNeighborYIndex(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - } + int temp = fillOrder[direction]; + fillOrder[direction] = fillOrder[direction-1]; + fillOrder[direction-1] = temp; + } + } + + for (int direction : fillOrder) { + if (builder->getCommunicationProcess(direction) == INVALID_INDEX) + continue; + + for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { + if (direction == CommunicationDirections::MX || direction == CommunicationDirections::PX) { + int tempSend = builder->getNumberOfSendIndices(direction, level); + int tempRecv = builder->getNumberOfReceiveIndices(direction, level); + + if (tempSend > 0) { + int indexProcessNeighbor = (int)para->getParH(level)->sendProcessNeighborX.size(); + + para->getParH(level)->sendProcessNeighborX.emplace_back(); + para->getParD(level)->sendProcessNeighborX.emplace_back(); + para->getParH(level)->recvProcessNeighborX.emplace_back(); + para->getParD(level)->recvProcessNeighborX.emplace_back(); + if (para->getDiffOn() == true) { + para->getParH(level)->sendProcessNeighborADX.emplace_back(); + para->getParD(level)->sendProcessNeighborADX.emplace_back(); + para->getParH(level)->recvProcessNeighborADX.emplace_back(); + para->getParD(level)->recvProcessNeighborADX.emplace_back(); + } + //////////////////////////////////////////////////////////////////////////////////////// + // send + para->getParH(level)->sendProcessNeighborX.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for X send buffer, \t\tLevel " << level << " : " << tempSend + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->sendProcessNeighborX.back().numberOfNodes = tempSend; + para->getParD(level)->sendProcessNeighborX.back().numberOfNodes = tempSend; + para->getParH(level)->sendProcessNeighborX.back().numberOfFs = para->getD3Qxx() * tempSend; + para->getParD(level)->sendProcessNeighborX.back().numberOfFs = para->getD3Qxx() * tempSend; + para->getParH(level)->sendProcessNeighborX.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParD(level)->sendProcessNeighborX.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParH(level)->sendProcessNeighborX.back().memsizeFs = sizeof(real) * tempSend; + para->getParD(level)->sendProcessNeighborX.back().memsizeFs = sizeof(real) * tempSend; + //////////////////////////////////////////////////////////////////////////////////////// + // recv + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for X receive buffer, \tLevel " << level << " : " << tempRecv + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborX.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborX.back().numberOfNodes = tempRecv; + para->getParD(level)->recvProcessNeighborX.back().numberOfNodes = tempRecv; + para->getParH(level)->recvProcessNeighborX.back().numberOfFs = para->getD3Qxx() * tempRecv; + para->getParD(level)->recvProcessNeighborX.back().numberOfFs = para->getD3Qxx() * tempRecv; + para->getParH(level)->recvProcessNeighborX.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParD(level)->recvProcessNeighborX.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParH(level)->recvProcessNeighborX.back().memsizeFs = sizeof(real) * tempRecv; + para->getParD(level)->recvProcessNeighborX.back().memsizeFs = sizeof(real) * tempRecv; + //////////////////////////////////////////////////////////////////////////////////////// + // malloc on host and device + cudaMemoryManager->cudaAllocProcessNeighborX(level, indexProcessNeighbor); + //////////////////////////////////////////////////////////////////////////////////////// + // init index arrays + builder->getSendIndices(para->getParH(level)->sendProcessNeighborX[indexProcessNeighbor].index, direction, level); + builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborX[indexProcessNeighbor].index, direction, + level); + if (level != builder->getNumberOfGridLevels() - 1 && para->useReducedCommunicationAfterFtoC) + indexRearrangement->initCommunicationArraysForCommAfterFinetoCoarseX(level, indexProcessNeighbor, direction); + //////////////////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborXIndex(level, indexProcessNeighbor); + //////////////////////////////////////////////////////////////////////////////////////// + } } - - if( direction == CommunicationDirections::MZ || direction == CommunicationDirections::PZ ) - { - int j = (int)para->getParH(level)->sendProcessNeighborZ.size(); - - para->getParH(level)->sendProcessNeighborZ.emplace_back(); - para->getParD(level)->sendProcessNeighborZ.emplace_back(); - para->getParH(level)->recvProcessNeighborZ.emplace_back(); - para->getParD(level)->recvProcessNeighborZ.emplace_back(); - if (para->getDiffOn()==true){ - para->getParH(level)->sendProcessNeighborADZ.emplace_back(); - para->getParD(level)->sendProcessNeighborADZ.emplace_back(); - para->getParH(level)->recvProcessNeighborADZ.emplace_back(); - para->getParD(level)->recvProcessNeighborADZ.emplace_back(); - } - - int tempSend = builder->getNumberOfSendIndices( direction, level ); - int tempRecv = builder->getNumberOfReceiveIndices( direction, level ); - if (tempSend > 0) - { - //////////////////////////////////////////////////////////////////////////////////////// - //send - std::cout << "size of Data for X send buffer, Level " << level << " : " << tempSend << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborZ.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborZ.back().numberOfNodes = tempSend; - para->getParD(level)->sendProcessNeighborZ.back().numberOfNodes = tempSend; - para->getParH(level)->sendProcessNeighborZ.back().numberOfFs = para->getD3Qxx() * tempSend; - para->getParD(level)->sendProcessNeighborZ.back().numberOfFs = para->getD3Qxx() * tempSend; - para->getParH(level)->sendProcessNeighborZ.back().memsizeIndex = sizeof(unsigned int)*tempSend; - para->getParD(level)->sendProcessNeighborZ.back().memsizeIndex = sizeof(unsigned int)*tempSend; - para->getParH(level)->sendProcessNeighborZ.back().memsizeFs = sizeof(real) *tempSend; - para->getParD(level)->sendProcessNeighborZ.back().memsizeFs = sizeof(real) *tempSend; - //////////////////////////////////////////////////////////////////////////////////////// - //recv - std::cout << "size of Data for X receive buffer, Level " << level << " : " << tempRecv << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborZ.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborZ.back().numberOfNodes = tempRecv; - para->getParD(level)->recvProcessNeighborZ.back().numberOfNodes = tempRecv; - para->getParH(level)->recvProcessNeighborZ.back().numberOfFs = para->getD3Qxx() * tempRecv; - para->getParD(level)->recvProcessNeighborZ.back().numberOfFs = para->getD3Qxx() * tempRecv; - para->getParH(level)->recvProcessNeighborZ.back().memsizeIndex = sizeof(unsigned int)*tempRecv; - para->getParD(level)->recvProcessNeighborZ.back().memsizeIndex = sizeof(unsigned int)*tempRecv; - para->getParH(level)->recvProcessNeighborZ.back().memsizeFs = sizeof(real) *tempRecv; - para->getParD(level)->recvProcessNeighborZ.back().memsizeFs = sizeof(real) *tempRecv; - //////////////////////////////////////////////////////////////////////////////////////// - //malloc on host and device - cudaMemoryManager->cudaAllocProcessNeighborZ(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - //init index arrays - builder->getSendIndices (para->getParH(level)->sendProcessNeighborZ[j].index, direction, level); - builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborZ[j].index, direction, level); - //////////////////////////////////////////////////////////////////////////////////////// - cudaMemoryManager->cudaCopyProcessNeighborZIndex(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - } + + if (direction == CommunicationDirections::MY || direction == CommunicationDirections::PY) { + int tempSend = builder->getNumberOfSendIndices(direction, level); + int tempRecv = builder->getNumberOfReceiveIndices(direction, level); + + if (tempSend > 0) { + int indexProcessNeighbor = (int)para->getParH(level)->sendProcessNeighborY.size(); + + para->getParH(level)->sendProcessNeighborY.emplace_back(); + para->getParD(level)->sendProcessNeighborY.emplace_back(); + para->getParH(level)->recvProcessNeighborY.emplace_back(); + para->getParD(level)->recvProcessNeighborY.emplace_back(); + if (para->getDiffOn() == true) { + para->getParH(level)->sendProcessNeighborADY.emplace_back(); + para->getParD(level)->sendProcessNeighborADY.emplace_back(); + para->getParH(level)->recvProcessNeighborADY.emplace_back(); + para->getParD(level)->recvProcessNeighborADY.emplace_back(); + } + //////////////////////////////////////////////////////////////////////////////////////// + // send + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Y send buffer, \t\tLevel " << level << " : " << tempSend + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->sendProcessNeighborY.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->sendProcessNeighborY.back().numberOfNodes = tempSend; + para->getParD(level)->sendProcessNeighborY.back().numberOfNodes = tempSend; + para->getParH(level)->sendProcessNeighborY.back().numberOfFs = para->getD3Qxx() * tempSend; + para->getParD(level)->sendProcessNeighborY.back().numberOfFs = para->getD3Qxx() * tempSend; + para->getParH(level)->sendProcessNeighborY.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParD(level)->sendProcessNeighborY.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParH(level)->sendProcessNeighborY.back().memsizeFs = sizeof(real) * tempSend; + para->getParD(level)->sendProcessNeighborY.back().memsizeFs = sizeof(real) * tempSend; + //////////////////////////////////////////////////////////////////////////////////////// + // recv + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Y receive buffer, \tLevel " << level << " : " << tempRecv + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborY.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborY.back().numberOfNodes = tempRecv; + para->getParD(level)->recvProcessNeighborY.back().numberOfNodes = tempRecv; + para->getParH(level)->recvProcessNeighborY.back().numberOfFs = para->getD3Qxx() * tempRecv; + para->getParD(level)->recvProcessNeighborY.back().numberOfFs = para->getD3Qxx() * tempRecv; + para->getParH(level)->recvProcessNeighborY.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParD(level)->recvProcessNeighborY.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParH(level)->recvProcessNeighborY.back().memsizeFs = sizeof(real) * tempRecv; + para->getParD(level)->recvProcessNeighborY.back().memsizeFs = sizeof(real) * tempRecv; + //////////////////////////////////////////////////////////////////////////////////////// + // malloc on host and device + cudaMemoryManager->cudaAllocProcessNeighborY(level, indexProcessNeighbor); + //////////////////////////////////////////////////////////////////////////////////////// + // init index arrays + builder->getSendIndices(para->getParH(level)->sendProcessNeighborY[indexProcessNeighbor].index, direction, level); + builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborY[indexProcessNeighbor].index, direction, + level); + if (level != builder->getNumberOfGridLevels() - 1 && para->useReducedCommunicationAfterFtoC) + indexRearrangement->initCommunicationArraysForCommAfterFinetoCoarseY(level, indexProcessNeighbor, direction); + //////////////////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborYIndex(level, indexProcessNeighbor); + //////////////////////////////////////////////////////////////////////////////////////// + } } - } - } - } + if (direction == CommunicationDirections::MZ || direction == CommunicationDirections::PZ) { + int tempSend = builder->getNumberOfSendIndices(direction, level); + int tempRecv = builder->getNumberOfReceiveIndices(direction, level); + if (tempSend > 0) { + int indexProcessNeighbor = (int)para->getParH(level)->sendProcessNeighborZ.size(); + + para->getParH(level)->sendProcessNeighborZ.emplace_back(); + para->getParD(level)->sendProcessNeighborZ.emplace_back(); + para->getParH(level)->recvProcessNeighborZ.emplace_back(); + para->getParD(level)->recvProcessNeighborZ.emplace_back(); + if (para->getDiffOn() == true) { + para->getParH(level)->sendProcessNeighborADZ.emplace_back(); + para->getParD(level)->sendProcessNeighborADZ.emplace_back(); + para->getParH(level)->recvProcessNeighborADZ.emplace_back(); + para->getParD(level)->recvProcessNeighborADZ.emplace_back(); + } + //////////////////////////////////////////////////////////////////////////////////////// + // send + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Z send buffer, \t\tLevel " << level << " : " << tempSend + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->sendProcessNeighborZ.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->sendProcessNeighborZ.back().numberOfNodes = tempSend; + para->getParD(level)->sendProcessNeighborZ.back().numberOfNodes = tempSend; + para->getParH(level)->sendProcessNeighborZ.back().numberOfFs = para->getD3Qxx() * tempSend; + para->getParD(level)->sendProcessNeighborZ.back().numberOfFs = para->getD3Qxx() * tempSend; + para->getParH(level)->sendProcessNeighborZ.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParD(level)->sendProcessNeighborZ.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParH(level)->sendProcessNeighborZ.back().memsizeFs = sizeof(real) * tempSend; + para->getParD(level)->sendProcessNeighborZ.back().memsizeFs = sizeof(real) * tempSend; + //////////////////////////////////////////////////////////////////////////////////////// + // recv + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Z receive buffer, \tLevel " << level << " : " << tempRecv + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborZ.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborZ.back().numberOfNodes = tempRecv; + para->getParD(level)->recvProcessNeighborZ.back().numberOfNodes = tempRecv; + para->getParH(level)->recvProcessNeighborZ.back().numberOfFs = para->getD3Qxx() * tempRecv; + para->getParD(level)->recvProcessNeighborZ.back().numberOfFs = para->getD3Qxx() * tempRecv; + para->getParH(level)->recvProcessNeighborZ.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParD(level)->recvProcessNeighborZ.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParH(level)->recvProcessNeighborZ.back().memsizeFs = sizeof(real) * tempRecv; + para->getParD(level)->recvProcessNeighborZ.back().memsizeFs = sizeof(real) * tempRecv; + //////////////////////////////////////////////////////////////////////////////////////// + // malloc on host and device + cudaMemoryManager->cudaAllocProcessNeighborZ(level, indexProcessNeighbor); + //////////////////////////////////////////////////////////////////////////////////////// + // init index arrays + builder->getSendIndices(para->getParH(level)->sendProcessNeighborZ[indexProcessNeighbor].index, direction, level); + builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborZ[indexProcessNeighbor].index, direction, + level); + if (level != builder->getNumberOfGridLevels() - 1 && para->useReducedCommunicationAfterFtoC) + indexRearrangement->initCommunicationArraysForCommAfterFinetoCoarseZ(level, indexProcessNeighbor, direction); + //////////////////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborZIndex(level, indexProcessNeighbor); + //////////////////////////////////////////////////////////////////////////////////////// + } + } + } + } + } - // data exchange for F3 / G6 - if ((para->getNumprocs() > 1) && (para->getIsF3()) ) - { - for (int direction = 0; direction < 6; direction++) - { - if (builder->getCommunicationProcess(direction) == INVALID_INDEX) continue; + // data exchange for F3 / G6 + if ((para->getNumprocs() > 1) && (para->getIsF3())) { + for (int direction = 0; direction < 6; direction++) { + if (builder->getCommunicationProcess(direction) == INVALID_INDEX) + continue; - for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) - { - if (direction == CommunicationDirections::MX || direction == CommunicationDirections::PX) - { + for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { + if (direction == CommunicationDirections::MX || direction == CommunicationDirections::PX) { int j = (int)para->getParH(level)->sendProcessNeighborF3X.size(); - para->getParH(level)->sendProcessNeighborF3X.emplace_back(); - para->getParD(level)->sendProcessNeighborF3X.emplace_back(); - para->getParH(level)->recvProcessNeighborF3X.emplace_back(); - para->getParD(level)->recvProcessNeighborF3X.emplace_back(); - - int tempSend = builder->getNumberOfSendIndices(direction, level); - int tempRecv = builder->getNumberOfReceiveIndices(direction, level); - if (tempSend > 0) - { - //////////////////////////////////////////////////////////////////////////////////////// - //send - std::cout << "size of Data for X send buffer, Level " << level << " : " << tempSend << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborF3X.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborF3X.back().numberOfNodes = tempSend; - para->getParD(level)->sendProcessNeighborF3X.back().numberOfNodes = tempSend; - para->getParH(level)->sendProcessNeighborF3X.back().numberOfGs = 6 * tempSend; - para->getParD(level)->sendProcessNeighborF3X.back().numberOfGs = 6 * tempSend; - para->getParH(level)->sendProcessNeighborF3X.back().memsizeIndex = sizeof(unsigned int) * tempSend; - para->getParD(level)->sendProcessNeighborF3X.back().memsizeIndex = sizeof(unsigned int) * tempSend; - para->getParH(level)->sendProcessNeighborF3X.back().memsizeGs = sizeof(real) * para->getParH(level)->sendProcessNeighborF3X.back().numberOfGs; - para->getParD(level)->sendProcessNeighborF3X.back().memsizeGs = sizeof(real) * para->getParH(level)->sendProcessNeighborF3X.back().numberOfGs; - //////////////////////////////////////////////////////////////////////////////////////// - //recv - std::cout << "size of Data for X receive buffer, Level " << level << " : " << tempRecv << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborF3X.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborF3X.back().numberOfNodes = tempRecv; - para->getParD(level)->recvProcessNeighborF3X.back().numberOfNodes = tempRecv; - para->getParH(level)->recvProcessNeighborF3X.back().numberOfGs = 6 * tempRecv; - para->getParD(level)->recvProcessNeighborF3X.back().numberOfGs = 6 * tempRecv; - para->getParH(level)->recvProcessNeighborF3X.back().memsizeIndex = sizeof(unsigned int) * tempRecv; - para->getParD(level)->recvProcessNeighborF3X.back().memsizeIndex = sizeof(unsigned int) * tempRecv; - para->getParH(level)->recvProcessNeighborF3X.back().memsizeGs = sizeof(real) * para->getParH(level)->recvProcessNeighborF3X.back().numberOfGs; - para->getParD(level)->recvProcessNeighborF3X.back().memsizeGs = sizeof(real) * para->getParH(level)->recvProcessNeighborF3X.back().numberOfGs; - //////////////////////////////////////////////////////////////////////////////////////// - //malloc on host and device - cudaMemoryManager->cudaAllocProcessNeighborF3X(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - //init index arrays - builder->getSendIndices(para->getParH(level)->sendProcessNeighborF3X[j].index, direction, level); - builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborF3X[j].index, direction, level); - //////////////////////////////////////////////////////////////////////////////////////// - cudaMemoryManager->cudaCopyProcessNeighborF3XIndex(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - } - } - - if (direction == CommunicationDirections::MY || direction == CommunicationDirections::PY) - { + para->getParH(level)->sendProcessNeighborF3X.emplace_back(); + para->getParD(level)->sendProcessNeighborF3X.emplace_back(); + para->getParH(level)->recvProcessNeighborF3X.emplace_back(); + para->getParD(level)->recvProcessNeighborF3X.emplace_back(); + + int tempSend = builder->getNumberOfSendIndices(direction, level); + int tempRecv = builder->getNumberOfReceiveIndices(direction, level); + if (tempSend > 0) { + //////////////////////////////////////////////////////////////////////////////////////// + // send + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for X send buffer, \t\tLevel " << level << " : " << tempSend + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->sendProcessNeighborF3X.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->sendProcessNeighborF3X.back().numberOfNodes = tempSend; + para->getParD(level)->sendProcessNeighborF3X.back().numberOfNodes = tempSend; + para->getParH(level)->sendProcessNeighborF3X.back().numberOfGs = 6 * tempSend; + para->getParD(level)->sendProcessNeighborF3X.back().numberOfGs = 6 * tempSend; + para->getParH(level)->sendProcessNeighborF3X.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParD(level)->sendProcessNeighborF3X.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParH(level)->sendProcessNeighborF3X.back().memsizeGs = + sizeof(real) * para->getParH(level)->sendProcessNeighborF3X.back().numberOfGs; + para->getParD(level)->sendProcessNeighborF3X.back().memsizeGs = + sizeof(real) * para->getParH(level)->sendProcessNeighborF3X.back().numberOfGs; + //////////////////////////////////////////////////////////////////////////////////////// + // recv + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for X receive buffer, \tLevel " << level << " : " << tempRecv + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborF3X.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborF3X.back().numberOfNodes = tempRecv; + para->getParD(level)->recvProcessNeighborF3X.back().numberOfNodes = tempRecv; + para->getParH(level)->recvProcessNeighborF3X.back().numberOfGs = 6 * tempRecv; + para->getParD(level)->recvProcessNeighborF3X.back().numberOfGs = 6 * tempRecv; + para->getParH(level)->recvProcessNeighborF3X.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParD(level)->recvProcessNeighborF3X.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParH(level)->recvProcessNeighborF3X.back().memsizeGs = + sizeof(real) * para->getParH(level)->recvProcessNeighborF3X.back().numberOfGs; + para->getParD(level)->recvProcessNeighborF3X.back().memsizeGs = + sizeof(real) * para->getParH(level)->recvProcessNeighborF3X.back().numberOfGs; + //////////////////////////////////////////////////////////////////////////////////////// + // malloc on host and device + cudaMemoryManager->cudaAllocProcessNeighborF3X(level, j); + //////////////////////////////////////////////////////////////////////////////////////// + // init index arrays + builder->getSendIndices(para->getParH(level)->sendProcessNeighborF3X[j].index, direction, + level); + builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborF3X[j].index, direction, + level); + //////////////////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborF3XIndex(level, j); + //////////////////////////////////////////////////////////////////////////////////////// + } + } + + if (direction == CommunicationDirections::MY || direction == CommunicationDirections::PY) { int j = (int)para->getParH(level)->sendProcessNeighborF3Y.size(); - para->getParH(level)->sendProcessNeighborF3Y.emplace_back(); - para->getParD(level)->sendProcessNeighborF3Y.emplace_back(); - para->getParH(level)->recvProcessNeighborF3Y.emplace_back(); - para->getParD(level)->recvProcessNeighborF3Y.emplace_back(); - - int tempSend = builder->getNumberOfSendIndices(direction, level); - int tempRecv = builder->getNumberOfReceiveIndices(direction, level); - if (tempSend > 0) - { - //////////////////////////////////////////////////////////////////////////////////////// - //send - std::cout << "size of Data for X send buffer, Level " << level << " : " << tempSend << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborF3Y.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborF3Y.back().numberOfNodes = tempSend; - para->getParD(level)->sendProcessNeighborF3Y.back().numberOfNodes = tempSend; - para->getParH(level)->sendProcessNeighborF3Y.back().numberOfGs = 6 * tempSend; - para->getParD(level)->sendProcessNeighborF3Y.back().numberOfGs = 6 * tempSend; - para->getParH(level)->sendProcessNeighborF3Y.back().memsizeIndex = sizeof(unsigned int) * tempSend; - para->getParD(level)->sendProcessNeighborF3Y.back().memsizeIndex = sizeof(unsigned int) * tempSend; - para->getParH(level)->sendProcessNeighborF3Y.back().memsizeGs = sizeof(real) * para->getParH(level)->sendProcessNeighborF3Y.back().numberOfGs; - para->getParD(level)->sendProcessNeighborF3Y.back().memsizeGs = sizeof(real) * para->getParH(level)->sendProcessNeighborF3Y.back().numberOfGs; - //////////////////////////////////////////////////////////////////////////////////////// - //recv - std::cout << "size of Data for X receive buffer, Level " << level << " : " << tempRecv << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborF3Y.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborF3Y.back().numberOfNodes = tempRecv; - para->getParD(level)->recvProcessNeighborF3Y.back().numberOfNodes = tempRecv; - para->getParH(level)->recvProcessNeighborF3Y.back().numberOfGs = 6 * tempRecv; - para->getParD(level)->recvProcessNeighborF3Y.back().numberOfGs = 6 * tempRecv; - para->getParH(level)->recvProcessNeighborF3Y.back().memsizeIndex = sizeof(unsigned int) * tempRecv; - para->getParD(level)->recvProcessNeighborF3Y.back().memsizeIndex = sizeof(unsigned int) * tempRecv; - para->getParH(level)->recvProcessNeighborF3Y.back().memsizeGs = sizeof(real) * para->getParH(level)->recvProcessNeighborF3Y.back().numberOfGs; - para->getParD(level)->recvProcessNeighborF3Y.back().memsizeGs = sizeof(real) * para->getParH(level)->recvProcessNeighborF3Y.back().numberOfGs; - //////////////////////////////////////////////////////////////////////////////////////// - //malloc on host and device - cudaMemoryManager->cudaAllocProcessNeighborF3Y(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - //init index arrays - builder->getSendIndices(para->getParH(level)->sendProcessNeighborF3Y[j].index, direction, level); - builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborF3Y[j].index, direction, level); - //////////////////////////////////////////////////////////////////////////////////////// - cudaMemoryManager->cudaCopyProcessNeighborF3YIndex(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - } - } - - if (direction == CommunicationDirections::MZ || direction == CommunicationDirections::PZ) - { - int j = (int)para->getParH(level)->sendProcessNeighborF3Z.size(); + para->getParH(level)->sendProcessNeighborF3Y.emplace_back(); + para->getParD(level)->sendProcessNeighborF3Y.emplace_back(); + para->getParH(level)->recvProcessNeighborF3Y.emplace_back(); + para->getParD(level)->recvProcessNeighborF3Y.emplace_back(); + + int tempSend = builder->getNumberOfSendIndices(direction, level); + int tempRecv = builder->getNumberOfReceiveIndices(direction, level); + if (tempSend > 0) { + //////////////////////////////////////////////////////////////////////////////////////// + // send + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Y send buffer, \t\tLevel " << level << " : " << tempSend + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->sendProcessNeighborF3Y.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->sendProcessNeighborF3Y.back().numberOfNodes = tempSend; + para->getParD(level)->sendProcessNeighborF3Y.back().numberOfNodes = tempSend; + para->getParH(level)->sendProcessNeighborF3Y.back().numberOfGs = 6 * tempSend; + para->getParD(level)->sendProcessNeighborF3Y.back().numberOfGs = 6 * tempSend; + para->getParH(level)->sendProcessNeighborF3Y.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParD(level)->sendProcessNeighborF3Y.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParH(level)->sendProcessNeighborF3Y.back().memsizeGs = + sizeof(real) * para->getParH(level)->sendProcessNeighborF3Y.back().numberOfGs; + para->getParD(level)->sendProcessNeighborF3Y.back().memsizeGs = + sizeof(real) * para->getParH(level)->sendProcessNeighborF3Y.back().numberOfGs; + //////////////////////////////////////////////////////////////////////////////////////// + // recv + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Y receive buffer, \tLevel " << level << " : " << tempRecv + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborF3Y.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborF3Y.back().numberOfNodes = tempRecv; + para->getParD(level)->recvProcessNeighborF3Y.back().numberOfNodes = tempRecv; + para->getParH(level)->recvProcessNeighborF3Y.back().numberOfGs = 6 * tempRecv; + para->getParD(level)->recvProcessNeighborF3Y.back().numberOfGs = 6 * tempRecv; + para->getParH(level)->recvProcessNeighborF3Y.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParD(level)->recvProcessNeighborF3Y.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParH(level)->recvProcessNeighborF3Y.back().memsizeGs = + sizeof(real) * para->getParH(level)->recvProcessNeighborF3Y.back().numberOfGs; + para->getParD(level)->recvProcessNeighborF3Y.back().memsizeGs = + sizeof(real) * para->getParH(level)->recvProcessNeighborF3Y.back().numberOfGs; + //////////////////////////////////////////////////////////////////////////////////////// + // malloc on host and device + cudaMemoryManager->cudaAllocProcessNeighborF3Y(level, j); + //////////////////////////////////////////////////////////////////////////////////////// + // init index arrays + builder->getSendIndices(para->getParH(level)->sendProcessNeighborF3Y[j].index, direction, + level); + builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborF3Y[j].index, direction, + level); + //////////////////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborF3YIndex(level, j); + //////////////////////////////////////////////////////////////////////////////////////// + } + } - para->getParH(level)->sendProcessNeighborF3Z.emplace_back(); - para->getParD(level)->sendProcessNeighborF3Z.emplace_back(); - para->getParH(level)->recvProcessNeighborF3Z.emplace_back(); - para->getParD(level)->recvProcessNeighborF3Z.emplace_back(); - - int tempSend = builder->getNumberOfSendIndices(direction, level); - int tempRecv = builder->getNumberOfReceiveIndices(direction, level); - if (tempSend > 0) - { - //////////////////////////////////////////////////////////////////////////////////////// - //send - std::cout << "size of Data for X send buffer, Level " << level << " : " << tempSend << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborF3Z.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->sendProcessNeighborF3Z.back().numberOfNodes = tempSend; - para->getParD(level)->sendProcessNeighborF3Z.back().numberOfNodes = tempSend; - para->getParH(level)->sendProcessNeighborF3Z.back().numberOfGs = 6 * tempSend; - para->getParD(level)->sendProcessNeighborF3Z.back().numberOfGs = 6 * tempSend; - para->getParH(level)->sendProcessNeighborF3Z.back().memsizeIndex = sizeof(unsigned int) * tempSend; - para->getParD(level)->sendProcessNeighborF3Z.back().memsizeIndex = sizeof(unsigned int) * tempSend; - para->getParH(level)->sendProcessNeighborF3Z.back().memsizeGs = sizeof(real) * para->getParH(level)->sendProcessNeighborF3Z.back().numberOfGs; - para->getParD(level)->sendProcessNeighborF3Z.back().memsizeGs = sizeof(real) * para->getParH(level)->sendProcessNeighborF3Z.back().numberOfGs; - //////////////////////////////////////////////////////////////////////////////////////// - //recv - std::cout << "size of Data for X receive buffer, Level " << level << " : " << tempRecv << std::endl; - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborF3Z.back().rankNeighbor = builder->getCommunicationProcess(direction); - //////////////////////////////////////////////////////////////////////////////////////// - para->getParH(level)->recvProcessNeighborF3Z.back().numberOfNodes = tempRecv; - para->getParD(level)->recvProcessNeighborF3Z.back().numberOfNodes = tempRecv; - para->getParH(level)->recvProcessNeighborF3Z.back().numberOfGs = 6 * tempRecv; - para->getParD(level)->recvProcessNeighborF3Z.back().numberOfGs = 6 * tempRecv; - para->getParH(level)->recvProcessNeighborF3Z.back().memsizeIndex = sizeof(unsigned int) * tempRecv; - para->getParD(level)->recvProcessNeighborF3Z.back().memsizeIndex = sizeof(unsigned int) * tempRecv; - para->getParH(level)->recvProcessNeighborF3Z.back().memsizeGs = sizeof(real) * para->getParH(level)->recvProcessNeighborF3Z.back().numberOfGs; - para->getParD(level)->recvProcessNeighborF3Z.back().memsizeGs = sizeof(real) * para->getParH(level)->recvProcessNeighborF3Z.back().numberOfGs; - //////////////////////////////////////////////////////////////////////////////////////// - //malloc on host and device - cudaMemoryManager->cudaAllocProcessNeighborF3Z(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - //init index arrays - builder->getSendIndices(para->getParH(level)->sendProcessNeighborF3Z[j].index, direction, level); - builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborF3Z[j].index, direction, level); - //////////////////////////////////////////////////////////////////////////////////////// - cudaMemoryManager->cudaCopyProcessNeighborF3ZIndex(level, j); - //////////////////////////////////////////////////////////////////////////////////////// - } - } - - } - } - } + if (direction == CommunicationDirections::MZ || direction == CommunicationDirections::PZ) { + int j = (int)para->getParH(level)->sendProcessNeighborF3Z.size(); + para->getParH(level)->sendProcessNeighborF3Z.emplace_back(); + para->getParD(level)->sendProcessNeighborF3Z.emplace_back(); + para->getParH(level)->recvProcessNeighborF3Z.emplace_back(); + para->getParD(level)->recvProcessNeighborF3Z.emplace_back(); + + int tempSend = builder->getNumberOfSendIndices(direction, level); + int tempRecv = builder->getNumberOfReceiveIndices(direction, level); + if (tempSend > 0) { + //////////////////////////////////////////////////////////////////////////////////////// + // send + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Z send buffer, \t\tLevel " << level << " : " << tempSend + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->sendProcessNeighborF3Z.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->sendProcessNeighborF3Z.back().numberOfNodes = tempSend; + para->getParD(level)->sendProcessNeighborF3Z.back().numberOfNodes = tempSend; + para->getParH(level)->sendProcessNeighborF3Z.back().numberOfGs = 6 * tempSend; + para->getParD(level)->sendProcessNeighborF3Z.back().numberOfGs = 6 * tempSend; + para->getParH(level)->sendProcessNeighborF3Z.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParD(level)->sendProcessNeighborF3Z.back().memsizeIndex = + sizeof(unsigned int) * tempSend; + para->getParH(level)->sendProcessNeighborF3Z.back().memsizeGs = + sizeof(real) * para->getParH(level)->sendProcessNeighborF3Z.back().numberOfGs; + para->getParD(level)->sendProcessNeighborF3Z.back().memsizeGs = + sizeof(real) * para->getParH(level)->sendProcessNeighborF3Z.back().numberOfGs; + //////////////////////////////////////////////////////////////////////////////////////// + // recv + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Z receive buffer, \tLevel " << level << " : " << tempRecv + << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborF3Z.back().rankNeighbor = + builder->getCommunicationProcess(direction); + //////////////////////////////////////////////////////////////////////////////////////// + para->getParH(level)->recvProcessNeighborF3Z.back().numberOfNodes = tempRecv; + para->getParD(level)->recvProcessNeighborF3Z.back().numberOfNodes = tempRecv; + para->getParH(level)->recvProcessNeighborF3Z.back().numberOfGs = 6 * tempRecv; + para->getParD(level)->recvProcessNeighborF3Z.back().numberOfGs = 6 * tempRecv; + para->getParH(level)->recvProcessNeighborF3Z.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParD(level)->recvProcessNeighborF3Z.back().memsizeIndex = + sizeof(unsigned int) * tempRecv; + para->getParH(level)->recvProcessNeighborF3Z.back().memsizeGs = + sizeof(real) * para->getParH(level)->recvProcessNeighborF3Z.back().numberOfGs; + para->getParD(level)->recvProcessNeighborF3Z.back().memsizeGs = + sizeof(real) * para->getParH(level)->recvProcessNeighborF3Z.back().numberOfGs; + //////////////////////////////////////////////////////////////////////////////////////// + // malloc on host and device + cudaMemoryManager->cudaAllocProcessNeighborF3Z(level, j); + //////////////////////////////////////////////////////////////////////////////////////// + // init index arrays + builder->getSendIndices(para->getParH(level)->sendProcessNeighborF3Z[j].index, direction, + level); + builder->getReceiveIndices(para->getParH(level)->recvProcessNeighborF3Z[j].index, direction, + level); + //////////////////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyProcessNeighborF3ZIndex(level, j); + //////////////////////////////////////////////////////////////////////////////////////// + } + } + } + } + } } - void GridGenerator::allocArrays_BoundaryQs() { - std::cout << "------read BoundaryQs-------" << std::endl; + std::cout << "------read BoundaryQs-------" << std::endl; for (uint i = 0; i < builder->getNumberOfGridLevels(); i++) { - int numberOfPressureValues = (int)builder->getPressureSize(i); + const auto numberOfPressureValues = (int)builder->getPressureSize(i); if (numberOfPressureValues > 0) { - std::cout << "size Pressure: " << i << " : " << numberOfPressureValues << std::endl; + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size Pressure: " << i << " : " << numberOfPressureValues << "\n"; //cout << "Groesse Pressure: " << i << " : " << temp1 << "MyID: " << para->getMyID() << endl; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //preprocessing - real* QQ = para->getParH(i)->QPress.q27[0]; - unsigned int sizeQ = para->getParH(i)->QPress.kQ; + real* QQ = para->getParH(i)->pressureBC.q27[0]; + unsigned int sizeQ = para->getParH(i)->pressureBC.numberOfBCnodes; QforBoundaryConditions Q; - Q.q27[dirE] = &QQ[dirE *sizeQ]; - Q.q27[dirW] = &QQ[dirW *sizeQ]; - Q.q27[dirN] = &QQ[dirN *sizeQ]; - Q.q27[dirS] = &QQ[dirS *sizeQ]; - Q.q27[dirT] = &QQ[dirT *sizeQ]; - Q.q27[dirB] = &QQ[dirB *sizeQ]; - Q.q27[dirNE] = &QQ[dirNE *sizeQ]; - Q.q27[dirSW] = &QQ[dirSW *sizeQ]; - Q.q27[dirSE] = &QQ[dirSE *sizeQ]; - Q.q27[dirNW] = &QQ[dirNW *sizeQ]; - Q.q27[dirTE] = &QQ[dirTE *sizeQ]; - Q.q27[dirBW] = &QQ[dirBW *sizeQ]; - Q.q27[dirBE] = &QQ[dirBE *sizeQ]; - Q.q27[dirTW] = &QQ[dirTW *sizeQ]; - Q.q27[dirTN] = &QQ[dirTN *sizeQ]; - Q.q27[dirBS] = &QQ[dirBS *sizeQ]; - Q.q27[dirBN] = &QQ[dirBN *sizeQ]; - Q.q27[dirTS] = &QQ[dirTS *sizeQ]; - Q.q27[dirZERO] = &QQ[dirZERO*sizeQ]; - Q.q27[dirTNE] = &QQ[dirTNE *sizeQ]; - Q.q27[dirTSW] = &QQ[dirTSW *sizeQ]; - Q.q27[dirTSE] = &QQ[dirTSE *sizeQ]; - Q.q27[dirTNW] = &QQ[dirTNW *sizeQ]; - Q.q27[dirBNE] = &QQ[dirBNE *sizeQ]; - Q.q27[dirBSW] = &QQ[dirBSW *sizeQ]; - Q.q27[dirBSE] = &QQ[dirBSE *sizeQ]; - Q.q27[dirBNW] = &QQ[dirBNW *sizeQ]; + getPointersToBoundaryConditions(Q, QQ, sizeQ); builder->getPressureQs(Q.q27, i); @@ -683,7 +778,7 @@ void GridGenerator::allocArrays_BoundaryQs() { para->getParH(i)->TempPress.temp[m] = para->getTemperatureInit(); para->getParH(i)->TempPress.velo[m] = (real)0.0; - para->getParH(i)->TempPress.k[m] = para->getParH(i)->QPress.k[m]; + para->getParH(i)->TempPress.k[m] = para->getParH(i)->pressureBC.k[m]; } ////////////////////////////////////////////////////////////////////////// //cout << "vor copy" << endl; @@ -697,47 +792,58 @@ void GridGenerator::allocArrays_BoundaryQs() }//ende if }//ende oberste for schleife + for (uint i = 0; i < builder->getNumberOfGridLevels(); i++) { + int numberOfSlipValues = (int)builder->getSlipSize(i); + if (numberOfSlipValues > 0) + { + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size Slip: " << i << " : " << numberOfSlipValues << "\n"; + //cout << "Groesse Pressure: " << i << " : " << temp1 << "MyID: " << para->getMyID() << endl; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //preprocessing + real* QQ = para->getParH(i)->slipBC.q27[0]; + unsigned int sizeQ = para->getParH(i)->slipBC.numberOfBCnodes; + QforBoundaryConditions Q; + getPointersToBoundaryConditions(Q, QQ, sizeQ); + + builder->getSlipQs(Q.q27, i); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopySlipBC(i); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + }//ende if + }//ende oberste for schleife + for (uint i = 0; i < builder->getNumberOfGridLevels(); i++) { + int numberOfStressValues = (int)builder->getStressSize(i); + if (numberOfStressValues > 0) + { + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size Stress: " << i << " : " << numberOfStressValues << "\n"; + //cout << "Groesse Pressure: " << i << " : " << temp1 << "MyID: " << para->getMyID() << endl; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //preprocessing + real* QQ = para->getParH(i)->stressBC.q27[0]; + unsigned int sizeQ = para->getParH(i)->stressBC.numberOfBCnodes; + QforBoundaryConditions Q; + getPointersToBoundaryConditions(Q, QQ, sizeQ); + + builder->getStressQs(Q.q27, i); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyStressBC(i); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + }//ende if + }//ende oberste for schleife for (uint i = 0; i < builder->getNumberOfGridLevels(); i++) { const auto numberOfVelocityNodes = int(builder->getVelocitySize(i)); if (numberOfVelocityNodes > 0) { - std::cout << "size velocity level " << i << " : " << numberOfVelocityNodes << std::endl; - //cout << "Groesse velocity level: " << i << " : " << temp3 << "MyID: " << para->getMyID() << std::endl; + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size velocity level " << i << " : " << numberOfVelocityNodes << "\n"; + //cout << "Groesse velocity level: " << i << " : " << temp3 << "MyID: " << para->getMyID() << "\n"; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //preprocessing - real* QQ = para->getParH(i)->Qinflow.q27[0]; - unsigned int sizeQ = para->getParH(i)->Qinflow.kQ; + real* QQ = para->getParH(i)->velocityBC.q27[0]; + unsigned int sizeQ = para->getParH(i)->velocityBC.numberOfBCnodes; QforBoundaryConditions Q; - Q.q27[dirE] = &QQ[dirE *sizeQ]; - Q.q27[dirW] = &QQ[dirW *sizeQ]; - Q.q27[dirN] = &QQ[dirN *sizeQ]; - Q.q27[dirS] = &QQ[dirS *sizeQ]; - Q.q27[dirT] = &QQ[dirT *sizeQ]; - Q.q27[dirB] = &QQ[dirB *sizeQ]; - Q.q27[dirNE] = &QQ[dirNE *sizeQ]; - Q.q27[dirSW] = &QQ[dirSW *sizeQ]; - Q.q27[dirSE] = &QQ[dirSE *sizeQ]; - Q.q27[dirNW] = &QQ[dirNW *sizeQ]; - Q.q27[dirTE] = &QQ[dirTE *sizeQ]; - Q.q27[dirBW] = &QQ[dirBW *sizeQ]; - Q.q27[dirBE] = &QQ[dirBE *sizeQ]; - Q.q27[dirTW] = &QQ[dirTW *sizeQ]; - Q.q27[dirTN] = &QQ[dirTN *sizeQ]; - Q.q27[dirBS] = &QQ[dirBS *sizeQ]; - Q.q27[dirBN] = &QQ[dirBN *sizeQ]; - Q.q27[dirTS] = &QQ[dirTS *sizeQ]; - Q.q27[dirZERO] = &QQ[dirZERO*sizeQ]; - Q.q27[dirTNE] = &QQ[dirTNE *sizeQ]; - Q.q27[dirTSW] = &QQ[dirTSW *sizeQ]; - Q.q27[dirTSE] = &QQ[dirTSE *sizeQ]; - Q.q27[dirTNW] = &QQ[dirTNW *sizeQ]; - Q.q27[dirBNE] = &QQ[dirBNE *sizeQ]; - Q.q27[dirBSW] = &QQ[dirBSW *sizeQ]; - Q.q27[dirBSE] = &QQ[dirBSE *sizeQ]; - Q.q27[dirBNW] = &QQ[dirBNW *sizeQ]; - + getPointersToBoundaryConditions(Q, QQ, sizeQ); builder->getVelocityQs(Q.q27, i); if (para->getDiffOn()) { @@ -749,19 +855,19 @@ void GridGenerator::allocArrays_BoundaryQs() std::cout << "getTemperatureBC = " << para->getTemperatureBC() << std::endl; ////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaAllocTempVeloBC(i); - //cout << "nach alloc " << std::endl; + //cout << "nach alloc " << "\n"; ////////////////////////////////////////////////////////////////////////// for (int m = 0; m < numberOfVelocityNodes; m++) { para->getParH(i)->TempVel.temp[m] = para->getTemperatureInit(); para->getParH(i)->TempVel.tempPulse[m] = para->getTemperatureBC(); para->getParH(i)->TempVel.velo[m] = para->getVelocity(); - para->getParH(i)->TempVel.k[m] = para->getParH(i)->Qinflow.k[m]; + para->getParH(i)->TempVel.k[m] = para->getParH(i)->velocityBC.k[m]; } ////////////////////////////////////////////////////////////////////////// - //cout << "vor copy " << std::endl; + //cout << "vor copy " << "\n"; cudaMemoryManager->cudaCopyTempVeloBCHD(i); - //cout << "nach copy " << std::endl; + //cout << "nach copy " << "\n"; ////////////////////////////////////////////////////////////////////////// } cudaMemoryManager->cudaCopyVeloBC(i); @@ -771,70 +877,44 @@ void GridGenerator::allocArrays_BoundaryQs() for (uint i = 0; i < builder->getNumberOfGridLevels(); i++) { const int numberOfGeometryNodes = builder->getGeometrySize(i); - std::cout << "size of GeomBoundaryQs, Level " << i << " : " << numberOfGeometryNodes << std::endl; + *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of GeomBoundaryQs, Level " << i << " : " << numberOfGeometryNodes << "\n"; - para->getParH(i)->QGeom.kQ = numberOfGeometryNodes; - para->getParD(i)->QGeom.kQ = para->getParH(i)->QGeom.kQ; + para->getParH(i)->geometryBC.numberOfBCnodes = numberOfGeometryNodes; + para->getParD(i)->geometryBC.numberOfBCnodes = para->getParH(i)->geometryBC.numberOfBCnodes; if (numberOfGeometryNodes > 0) { //cout << "Groesse der Daten GeomBoundaryQs, Level: " << i << " : " << numberOfGeometryNodes << "MyID: " << para->getMyID() << endl; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //para->getParH(i)->QGeom.kQ = temp4; - //para->getParD(i)->QGeom.kQ = para->getParH(i)->QGeom.kQ; + //para->getParH(i)->geometryBC.numberOfBCnodes = temp4; + //para->getParD(i)->geometryBC.numberOfBCnodes = para->getParH(i)->geometryBC.numberOfBCnodes; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaAllocGeomBC(i); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //Indexarray - builder->getGeometryIndices(para->getParH(i)->QGeom.k, i); + builder->getGeometryIndices(para->getParH(i)->geometryBC.k, i); ////////////////////////////////////////////////////////////////////////// //preprocessing - real* QQ = para->getParH(i)->QGeom.q27[0]; - unsigned int sizeQ = para->getParH(i)->QGeom.kQ; + real* QQ = para->getParH(i)->geometryBC.q27[0]; + unsigned int sizeQ = para->getParH(i)->geometryBC.numberOfBCnodes; QforBoundaryConditions Q; - Q.q27[dirE] = &QQ[dirE *sizeQ]; - Q.q27[dirW] = &QQ[dirW *sizeQ]; - Q.q27[dirN] = &QQ[dirN *sizeQ]; - Q.q27[dirS] = &QQ[dirS *sizeQ]; - Q.q27[dirT] = &QQ[dirT *sizeQ]; - Q.q27[dirB] = &QQ[dirB *sizeQ]; - Q.q27[dirNE] = &QQ[dirNE *sizeQ]; - Q.q27[dirSW] = &QQ[dirSW *sizeQ]; - Q.q27[dirSE] = &QQ[dirSE *sizeQ]; - Q.q27[dirNW] = &QQ[dirNW *sizeQ]; - Q.q27[dirTE] = &QQ[dirTE *sizeQ]; - Q.q27[dirBW] = &QQ[dirBW *sizeQ]; - Q.q27[dirBE] = &QQ[dirBE *sizeQ]; - Q.q27[dirTW] = &QQ[dirTW *sizeQ]; - Q.q27[dirTN] = &QQ[dirTN *sizeQ]; - Q.q27[dirBS] = &QQ[dirBS *sizeQ]; - Q.q27[dirBN] = &QQ[dirBN *sizeQ]; - Q.q27[dirTS] = &QQ[dirTS *sizeQ]; - Q.q27[dirZERO] = &QQ[dirZERO*sizeQ]; - Q.q27[dirTNE] = &QQ[dirTNE *sizeQ]; - Q.q27[dirTSW] = &QQ[dirTSW *sizeQ]; - Q.q27[dirTSE] = &QQ[dirTSE *sizeQ]; - Q.q27[dirTNW] = &QQ[dirTNW *sizeQ]; - Q.q27[dirBNE] = &QQ[dirBNE *sizeQ]; - Q.q27[dirBSW] = &QQ[dirBSW *sizeQ]; - Q.q27[dirBSE] = &QQ[dirBSE *sizeQ]; - Q.q27[dirBNW] = &QQ[dirBNW *sizeQ]; + getPointersToBoundaryConditions(Q, QQ, sizeQ); ////////////////////////////////////////////////////////////////// builder->getGeometryQs(Q.q27, i); - //QDebugWriter::writeQValues(Q, para->getParH(i)->QGeom.k, para->getParH(i)->QGeom.kQ, "M:/TestGridGeneration/results/GeomGPU.dat"); + //QDebugWriter::writeQValues(Q, para->getParH(i)->geometryBC.k, para->getParH(i)->geometryBC.numberOfBCnodes, "M:/TestGridGeneration/results/GeomGPU.dat"); ////////////////////////////////////////////////////////////////// for (int node_i = 0; node_i < numberOfGeometryNodes; node_i++) { - Q.q27[dirZERO][node_i] = 0.0f; + Q.q27[DIR_000][node_i] = 0.0f; } //for(int test = 0; test < 3; test++) //{ - // for (int tmp = 0; tmp < 27; tmp++) - // { - // cout <<"Kuhs: " << Q.q27[tmp][test] << std::endl; - // } + // for (int tmp = 0; tmp < 27; tmp++) + // { + // cout <<"Kuhs: " << Q.q27[tmp][test] << "\n"; + // } //} //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -850,7 +930,7 @@ void GridGenerator::allocArrays_BoundaryQs() for (int m = 0; m < numberOfGeometryNodes; m++) { para->getParH(i)->Temp.temp[m] = para->getTemperatureInit(); - para->getParH(i)->Temp.k[m] = para->getParH(i)->QGeom.k[m]; + para->getParH(i)->Temp.k[m] = para->getParH(i)->geometryBC.k[m]; } ////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaCopyTempNoSlipBCHD(i); @@ -863,7 +943,7 @@ void GridGenerator::allocArrays_BoundaryQs() } - std::cout << "-----finish BoundaryQs------" << std::endl; + std::cout << "-----finish BoundaryQs------" << std::endl; } void GridGenerator::allocArrays_OffsetScale() @@ -898,60 +978,67 @@ void GridGenerator::allocArrays_OffsetScale() para->getParD(level)->mem_size_kFC_off = sizeof(real)* para->getParD(level)->K_FC; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //alloc - cudaMemoryManager->cudaAllocInterfaceCF(level); - cudaMemoryManager->cudaAllocInterfaceFC(level); - cudaMemoryManager->cudaAllocInterfaceOffCF(level); - cudaMemoryManager->cudaAllocInterfaceOffFC(level); + cudaMemoryManager->cudaAllocInterfaceCF(level); + cudaMemoryManager->cudaAllocInterfaceFC(level); + cudaMemoryManager->cudaAllocInterfaceOffCF(level); + cudaMemoryManager->cudaAllocInterfaceOffFC(level); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //init builder->getOffsetCF(para->getParH(level)->offCF.xOffCF, para->getParH(level)->offCF.yOffCF, para->getParH(level)->offCF.zOffCF, level); builder->getOffsetFC(para->getParH(level)->offFC.xOffFC, para->getParH(level)->offFC.yOffFC, para->getParH(level)->offFC.zOffFC, level); builder->getGridInterfaceIndices(para->getParH(level)->intCF.ICellCFC, para->getParH(level)->intCF.ICellCFF, para->getParH(level)->intFC.ICellFCC, para->getParH(level)->intFC.ICellFCF, level); + + if (para->getUseStreams() || para->getNumprocs() > 1) { + // split fine-to-coarse indices into border and bulk + interpolationGrouper->splitFineToCoarseIntoBorderAndBulk(level); + // split coarse-to-fine indices into border and bulk + interpolationGrouper->splitCoarseToFineIntoBorderAndBulk(level); + } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy - cudaMemoryManager->cudaCopyInterfaceCF(level); - cudaMemoryManager->cudaCopyInterfaceFC(level); - cudaMemoryManager->cudaCopyInterfaceOffCF(level); - cudaMemoryManager->cudaCopyInterfaceOffFC(level); + cudaMemoryManager->cudaCopyInterfaceCF(level); + cudaMemoryManager->cudaCopyInterfaceFC(level); + cudaMemoryManager->cudaCopyInterfaceOffCF(level); + cudaMemoryManager->cudaCopyInterfaceOffFC(level); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } } - void GridGenerator::setDimensions() { - //std::vector<int> localGridNX(1); - //std::vector<int> localGridNY(1); - //std::vector<int> localGridNZ(1); + //std::vector<int> localGridNX(1); + //std::vector<int> localGridNY(1); + //std::vector<int> localGridNZ(1); - //builder->getDimensions(localGridNX[0], localGridNY[0], localGridNZ[0], 0); + //builder->getDimensions(localGridNX[0], localGridNY[0], localGridNZ[0], 0); - //para->setGridX(localGridNX); - //para->setGridY(localGridNY); - //para->setGridZ(localGridNZ); + //para->setGridX(localGridNX); + //para->setGridY(localGridNY); + //para->setGridZ(localGridNZ); } void GridGenerator::setBoundingBox() { - std::vector<int> localGridNX(1); - std::vector<int> localGridNY(1); - std::vector<int> localGridNZ(1); - builder->getDimensions(localGridNX[0], localGridNY[0], localGridNZ[0], 0); - - std::vector<real> minX, maxX, minY, maxY, minZ, maxZ; - minX.push_back(0); - minY.push_back(0); - minZ.push_back(0); - - maxX.push_back((real)localGridNX[0]); - maxY.push_back((real)localGridNY[0]); - maxZ.push_back((real)localGridNZ[0]); - - para->setMinCoordX(minX); - para->setMinCoordY(minY); - para->setMinCoordZ(minZ); - para->setMaxCoordX(maxX); - para->setMaxCoordY(maxY); - para->setMaxCoordZ(maxZ); + std::vector<int> localGridNX(1); + std::vector<int> localGridNY(1); + std::vector<int> localGridNZ(1); + builder->getDimensions(localGridNX[0], localGridNY[0], localGridNZ[0], 0); + + std::vector<real> minX, maxX, minY, maxY, minZ, maxZ; + minX.push_back(0); + minY.push_back(0); + minZ.push_back(0); + + maxX.push_back((real)localGridNX[0]); + maxY.push_back((real)localGridNY[0]); + maxZ.push_back((real)localGridNZ[0]); + + para->setMinCoordX(minX); + para->setMinCoordY(minY); + para->setMinCoordZ(minZ); + para->setMaxCoordX(maxX); + para->setMaxCoordY(maxY); + para->setMaxCoordZ(maxZ); } void GridGenerator::initPeriodicNeigh(std::vector<std::vector<std::vector<uint> > > periodV, std::vector<std::vector<uint> > periodIndex, std::string way) @@ -973,7 +1060,7 @@ std::string GridGenerator::verifyNeighborIndices(int level) const int wrongNeighbors = 0; int stopperNodes = 0; - for (uint index = 0; index < para->getParH(level)->size_Mat_SP; index++) + for (uint index = 0; index < para->getParH(level)->numberOfNodes; index++) oss << verifyNeighborIndex(level, index, invalidNodes, stopperNodes, wrongNeighbors); @@ -988,38 +1075,38 @@ std::string GridGenerator::verifyNeighborIndex(int level, int index , int &inval { std::ostringstream oss; - const int geo = para->getParH(level)->geoSP[index]; + const int geo = para->getParH(level)->typeOfGridNode[index]; if (geo == 16) { stopperNodes++; return ""; } - real x = para->getParH(level)->coordX_SP[index]; - real y = para->getParH(level)->coordY_SP[index]; - real z = para->getParH(level)->coordZ_SP[index]; + real x = para->getParH(level)->coordinateX[index]; + real y = para->getParH(level)->coordinateY[index]; + real z = para->getParH(level)->coordinateZ[index]; - real delta = para->getParH(level)->coordX_SP[2] - para->getParH(level)->coordX_SP[1]; + real delta = para->getParH(level)->coordinateX[2] - para->getParH(level)->coordinateX[1]; - //std::cout << para->getParH(level)->coordX_SP[1] << ", " << para->getParH(level)->coordY_SP[1] << ", " << para->getParH(level)->coordZ_SP[1] << std::endl; - //std::cout << para->getParH(level)->coordX_SP[para->getParH(level)->size_Mat_SP - 1] << ", " << para->getParH(level)->coordY_SP[para->getParH(level)->size_Mat_SP - 1] << ", " << para->getParH(level)->coordZ_SP[para->getParH(level)->size_Mat_SP - 1] << std::endl; + //std::cout << para->getParH(level)->coordinateX[1] << ", " << para->getParH(level)->coordinateY[1] << ", " << para->getParH(level)->coordinateZ[1] << std::endl; + //std::cout << para->getParH(level)->coordinateX[para->getParH(level)->numberOfNodes - 1] << ", " << para->getParH(level)->coordinateY[para->getParH(level)->numberOfNodes - 1] << ", " << para->getParH(level)->coordinateZ[para->getParH(level)->numberOfNodes - 1] << std::endl; - real maxX = para->getParH(level)->coordX_SP[para->getParH(level)->size_Mat_SP - 1] - delta; - real maxY = para->getParH(level)->coordY_SP[para->getParH(level)->size_Mat_SP - 1] - delta; - real maxZ = para->getParH(level)->coordZ_SP[para->getParH(level)->size_Mat_SP - 1] - delta; - real realNeighborX = vf::Math::lessEqual(x + delta, maxX) ? x + delta : para->getParH(level)->coordX_SP[1]; - real realNeighborY = vf::Math::lessEqual(y + delta, maxY) ? y + delta : para->getParH(level)->coordY_SP[1]; - real realNeighborZ = vf::Math::lessEqual(z + delta, maxZ) ? z + delta : para->getParH(level)->coordZ_SP[1]; + real maxX = para->getParH(level)->coordinateX[para->getParH(level)->numberOfNodes - 1] - delta; + real maxY = para->getParH(level)->coordinateY[para->getParH(level)->numberOfNodes - 1] - delta; + real maxZ = para->getParH(level)->coordinateZ[para->getParH(level)->numberOfNodes - 1] - delta; + real realNeighborX = vf::Math::lessEqual(x + delta, maxX) ? x + delta : para->getParH(level)->coordinateX[1]; + real realNeighborY = vf::Math::lessEqual(y + delta, maxY) ? y + delta : para->getParH(level)->coordinateY[1]; + real realNeighborZ = vf::Math::lessEqual(z + delta, maxZ) ? z + delta : para->getParH(level)->coordinateZ[1]; - oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborX_SP[index], realNeighborX, y, z, "X"); - oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborY_SP[index], x, realNeighborY, z, "Y"); - oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborZ_SP[index], x, y, realNeighborZ, "Z"); + oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborX[index], realNeighborX, y, z, "X"); + oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborY[index], x, realNeighborY, z, "Y"); + oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborZ[index], x, y, realNeighborZ, "Z"); - oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborY_SP[this->para->getParH(level)->neighborX_SP[index]], realNeighborX, realNeighborY, z, "XY"); - oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborZ_SP[this->para->getParH(level)->neighborX_SP[index]], realNeighborX, y, realNeighborZ, "XZ"); - oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborZ_SP[this->para->getParH(level)->neighborY_SP[index]], x, realNeighborY, realNeighborZ, "YZ"); + oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborY[this->para->getParH(level)->neighborX[index]], realNeighborX, realNeighborY, z, "XY"); + oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborZ[this->para->getParH(level)->neighborX[index]], realNeighborX, y, realNeighborZ, "XZ"); + oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborZ[this->para->getParH(level)->neighborY[index]], x, realNeighborY, realNeighborZ, "YZ"); - oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborZ_SP[this->para->getParH(level)->neighborY_SP[this->para->getParH(level)->neighborX_SP[index]]], realNeighborX, realNeighborY, realNeighborZ, "XYZ"); + oss << checkNeighbor(level, x, y, z, index, wrongNeighbors, this->para->getParH(level)->neighborZ[this->para->getParH(level)->neighborY[this->para->getParH(level)->neighborX[index]]], realNeighborX, realNeighborY, realNeighborZ, "XYZ"); return oss.str(); } @@ -1036,9 +1123,9 @@ std::string GridGenerator::checkNeighbor(int level, real x, real y, real z, int // return oss.str(); //} - real neighborCoordX = para->getParH(level)->coordX_SP[neighborIndex]; - real neighborCoordY = para->getParH(level)->coordY_SP[neighborIndex]; - real neighborCoordZ = para->getParH(level)->coordZ_SP[neighborIndex]; + real neighborCoordX = para->getParH(level)->coordinateX[neighborIndex]; + real neighborCoordY = para->getParH(level)->coordinateY[neighborIndex]; + real neighborCoordZ = para->getParH(level)->coordinateZ[neighborIndex]; const bool neighborValid = vf::Math::equal(neighborX, neighborCoordX) && vf::Math::equal(neighborY, neighborCoordY) && vf::Math::equal(neighborZ, neighborCoordZ); @@ -1051,3 +1138,33 @@ std::string GridGenerator::checkNeighbor(int level, real x, real y, real z, int } return oss.str(); } + +void GridGenerator::getPointersToBoundaryConditions(QforBoundaryConditions& boundaryConditionStruct, real* subgridDistances, const unsigned int numberOfBCnodes){ + boundaryConditionStruct.q27[DIR_P00] = &subgridDistances[DIR_P00 * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_M00] = &subgridDistances[DIR_M00 * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_0P0] = &subgridDistances[DIR_0P0 * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_0M0] = &subgridDistances[DIR_0M0 * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_00P] = &subgridDistances[DIR_00P * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_00M] = &subgridDistances[DIR_00M * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_PP0] = &subgridDistances[DIR_PP0 * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_MM0] = &subgridDistances[DIR_MM0 * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_PM0] = &subgridDistances[DIR_PM0 * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_MP0] = &subgridDistances[DIR_MP0 * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_P0P] = &subgridDistances[DIR_P0P * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_M0M] = &subgridDistances[DIR_M0M * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_P0M] = &subgridDistances[DIR_P0M * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_M0P] = &subgridDistances[DIR_M0P * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_0PP] = &subgridDistances[DIR_0PP * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_0MM] = &subgridDistances[DIR_0MM * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_0PM] = &subgridDistances[DIR_0PM * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_0MP] = &subgridDistances[DIR_0MP * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_000] = &subgridDistances[DIR_000* numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_PPP] = &subgridDistances[DIR_PPP * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_MMP] = &subgridDistances[DIR_MMP * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_PMP] = &subgridDistances[DIR_PMP * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_MPP] = &subgridDistances[DIR_MPP * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_PPM] = &subgridDistances[DIR_PPM * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_MMM] = &subgridDistances[DIR_MMM * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_PMM] = &subgridDistances[DIR_PMM * numberOfBCnodes]; + boundaryConditionStruct.q27[DIR_MPM] = &subgridDistances[DIR_MPM * numberOfBCnodes]; +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h index 79f7f2b6a1d1fc45217cf5e28df4f5b599f5c0e4..d2f56e1df4ee5658c61b8e8a3e94a820d1a4f2f1 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file GridGenerator.h +//! \ingroup DataStructureInitializer +//! \author Martin Schoenherr +//======================================================================================= #ifndef GridReaderGenerator_H #define GridReaderGenerator_H @@ -5,69 +37,105 @@ #include <vector> #include <string> -#include <memory> #include "LBM/LB.h" class Parameter; class GridBuilder; +class IndexRearrangementForStreams; +class InterpolationCellGrouper; +//! \class GridGenerator derived class of GridProvider +//! \brief mapping the grid of grid generator to data structure for simulation class GridGenerator - : public GridProvider + : public GridProvider { private: - std::vector<std::string> channelDirections; - std::vector<std::string> channelBoundaryConditions; + //! \brief string vector with channel direction + std::vector<std::string> channelDirections; + //! \brief string vector with channel direction (boundary conditions) + std::vector<std::string> channelBoundaryConditions; - std::shared_ptr<GridBuilder> builder; + std::shared_ptr<GridBuilder> builder; + std::unique_ptr<const IndexRearrangementForStreams> indexRearrangement; + std::unique_ptr<const InterpolationCellGrouper> interpolationGrouper; + const uint mpiProcessID; public: - VIRTUALFLUIDS_GPU_EXPORT GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager); - VIRTUALFLUIDS_GPU_EXPORT virtual ~GridGenerator(); - - void allocArrays_CoordNeighborGeo() override; - void allocArrays_BoundaryValues() override; - void allocArrays_BoundaryQs() override; + VIRTUALFLUIDS_GPU_EXPORT GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator& communicator); + VIRTUALFLUIDS_GPU_EXPORT ~GridGenerator() override; + + //! \brief overwrites the default IndexRearrangementForStreams + void setIndexRearrangementForStreams(std::unique_ptr<IndexRearrangementForStreams>&& indexRearrangement); + + //! \brief allocates and initialized the data structures for Coordinates and node types + void allocArrays_CoordNeighborGeo() override; + //! \brief allocates and initialized the values at the boundary conditions + void allocArrays_BoundaryValues() override; + //! \brief allocates and initialized the sub-grid distances at the boundary conditions + void allocArrays_BoundaryQs() override; void allocArrays_OffsetScale() override; + void allocArrays_fluidNodeIndices() override; + void allocArrays_fluidNodeIndicesBorder() override; - virtual void setDimensions() override; - virtual void setBoundingBox() override; + virtual void setDimensions() override; + virtual void setBoundingBox() override; - virtual void initPeriodicNeigh(std::vector<std::vector<std::vector<unsigned int> > > periodV, std::vector<std::vector<unsigned int> > periodIndex, std::string way) override; - + virtual void initPeriodicNeigh(std::vector<std::vector<std::vector<unsigned int> > > periodV, std::vector<std::vector<unsigned int> > periodIndex, std::string way) override; + private: - void setPressureValues(int channelSide) const; - void setPressRhoBC(int sizePerLevel, int level, int channelSide) const; - - void setVelocityValues(int channelSide) const; - void setVelocity(int level, int sizePerLevel, int channelSide) const; - - void setOutflowValues(int channelSide) const; - void setOutflow(int level, int sizePerLevel, int channelSide) const; - - void setPressQs(int channelSide) const; - void setVelocityQs(int channelSide) const; - void setOutflowQs(int channelSide) const; - void setNoSlipQs(int channelSide) const; - void setGeoQs() const; - void modifyQElement(int channelSide, unsigned int level) const; - - void initalQStruct(QforBoundaryConditions& Q,int channelSide, unsigned int level) const; - void printQSize(std::string bc,int channelSide, unsigned int level) const; - void setSizeNoSlip(int channelSide, unsigned int level) const; - void setSizeGeoQs(unsigned int level) const; - void setQ27Size(QforBoundaryConditions &Q, real* QQ, unsigned int sizeQ) const; - bool hasQs(int channelSide, unsigned int level) const; - + void setPressureValues(int channelSide) const; + void setPressRhoBC(int sizePerLevel, int level, int channelSide) const; + + void setVelocityValues(int channelSide) const; + void setVelocity(int level, int sizePerLevel, int channelSide) const; + + void setOutflowValues(int channelSide) const; + void setOutflow(int level, int sizePerLevel, int channelSide) const; + + void setPressQs(int channelSide) const; + void setVelocityQs(int channelSide) const; + void setOutflowQs(int channelSide) const; + void setNoSlipQs(int channelSide) const; + void setGeoQs() const; + void modifyQElement(int channelSide, unsigned int level) const; + + void initalQStruct(QforBoundaryConditions& Q,int channelSide, unsigned int level) const; + void printQSize(std::string bc,int channelSide, unsigned int level) const; + void setSizeNoSlip(int channelSide, unsigned int level) const; + void setSizeGeoQs(unsigned int level) const; + void setQ27Size(QforBoundaryConditions &Q, real* QQ, unsigned int sizeQ) const; + bool hasQs(int channelSide, unsigned int level) const; + + void initalValuesDomainDecompostion(); public: void initalGridInformations() override; private: + //! \brief verifies if there are invalid nodes, stopper nodes or wrong neighbors std::string verifyNeighborIndices(int level) const; - std::string verifyNeighborIndex(int level, int index, int &invalidNodes, int &stopperNodes, int &wrongNeighbors) const; + //! \brief verifies single neighbor index + //! \param index type integer + //! \param invalidNodes reference to invalid nodes + //! \param stopperNodes reference to stopper nodes + //! \param wrongNeighbors reference to wrong neighbors + std::string verifyNeighborIndex(int level, int index , int &invalidNodes, int &stopperNodes, int &wrongNeighbors) const; + //! \brief check the neighbors + //! \param x,y,z lattice node position + //! \param numberOfWrongNeighbors reference to the number of wrong neighbors + //! \param neighborIndex index of neighbor node + //! \param neighborX,neighborY,neighborZ neighbor lattice node position + //! \param direction type string std::string checkNeighbor(int level, real x, real y, real z, int index, int& numberOfWrongNeihgbors, int neighborIndex, real neighborX, real neighborY, real neighborZ, std::string direction) const; + //! \brief create the pointers in the struct for the BoundaryConditions from the boundary condition array + //! \param boundaryConditionStruct is a struct containing information about the boundary condition + //! \param subgridDistances is a pointer to an array containing the subgrid distances + //! \param numberOfBCnodes is the number of lattice nodes in the boundary condition + static void getPointersToBoundaryConditions(QforBoundaryConditions& boundaryConditionStruct, real* subgridDistances, const unsigned int numberOfBCnodes); +private: + friend class GridGeneratorTests_initalValuesDomainDecompostion; }; #endif diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3009bc4ae449b917f494cdf39145a2e94df2ddb8 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp @@ -0,0 +1,144 @@ +#include "GridGenerator.h" +#include <gmock/gmock.h> + +#include "Communication/Communicator.h" +#include "DataTypes.h" +#include "GPU/CudaMemoryManager.h" +#include "IndexRearrangementForStreams.h" +#include "Parameter/Parameter.h" +#include "gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h" +#include "gpu/GridGenerator/grid/GridImp.h" +#include "gpu/GridGenerator/utilities/communication.h" + +namespace GridGeneratorTest +{ + +class LevelGridBuilderStub : public LevelGridBuilder +{ +private: + const SPtr<Grid> grid; + LevelGridBuilderStub() = default; + +public: + uint numberOfSendIndices = 0; + + explicit LevelGridBuilderStub(SPtr<Grid> grid) : LevelGridBuilder(), grid(grid){}; + + uint getCommunicationProcess(int direction) override + { + uint process = 0; + if (direction != CommunicationDirections::MX) + process = INVALID_INDEX; + return process; + } + + uint getNumberOfGridLevels() const override + { + return 2; + } + + uint getNumberOfSendIndices(int direction, uint level) override + { + return numberOfSendIndices; + } + + uint getNumberOfReceiveIndices(int direction, uint level) override + { + return 0; + } + + void getSendIndices(int *sendIndices, int direction, int level) override + { + } + + void getReceiveIndices(int *sendIndices, int direction, int level) override + { + } +}; + +class CudaMemoryManagerDouble : public CudaMemoryManager +{ +public: + explicit CudaMemoryManagerDouble(std::shared_ptr<Parameter> parameter) : CudaMemoryManager(parameter){}; + + void cudaAllocProcessNeighborX(int lev, unsigned int processNeighbor) override{}; + void cudaCopyProcessNeighborXIndex(int lev, unsigned int processNeighbor) override{}; +}; + +class IndexRearrangementForStreamsDouble : public IndexRearrangementForStreams +{ +public: + IndexRearrangementForStreamsDouble(std::shared_ptr<Parameter> para, std::shared_ptr<GridBuilder> builder, + vf::gpu::Communicator &communicator) + : IndexRearrangementForStreams(para, builder, communicator){}; + + void initCommunicationArraysForCommAfterFinetoCoarseX(uint level, int indexOfProcessNeighbor, + int direction) const override{}; + void initCommunicationArraysForCommAfterFinetoCoarseY(uint level, int indexOfProcessNeighbor, + int direction) const override{}; + void initCommunicationArraysForCommAfterFinetoCoarseZ(uint level, int indexOfProcessNeighbor, + int direction) const override{}; +}; + +} // namespace GridGeneratorTest + +using namespace GridGeneratorTest; + +class GridGeneratorTests_initalValuesDomainDecompostion : public testing::Test +{ +public: + void act() const + { + gridGenerator->initalValuesDomainDecompostion(); + } + +protected: + SPtr<Parameter> para; + std::shared_ptr<LevelGridBuilderStub> builder; + + const uint level = 1; + const uint direction = CommunicationDirections::MX; + + SPtr<GridGenerator> gridGenerator; + +private: + void SetUp() override + { + logging::Logger::addStream(&std::cout); + logging::Logger::setDebugLevel(logging::Logger::WARNING); + + para = std::make_shared<Parameter>(); + para->setMaxLevel(level + 1); // setMaxLevel resizes parH and parD + for (uint i = 0; i <= level; i++) { + para->parH[i] = std::make_shared<LBMSimulationParameter>(); + para->parD[i] = std::make_shared<LBMSimulationParameter>(); + } + para->setNumprocs(2); + + builder = std::make_shared<LevelGridBuilderStub>(nullptr); + vf::gpu::Communicator &communicator = vf::gpu::Communicator::getInstance(); + + gridGenerator = std::make_shared<GridGenerator>(builder, para, std::make_shared<CudaMemoryManagerDouble>(para), + communicator); + gridGenerator->setIndexRearrangementForStreams( + std::make_unique<IndexRearrangementForStreamsDouble>(para, builder, communicator)); + } +}; + +TEST_F(GridGeneratorTests_initalValuesDomainDecompostion, whenNoCommunication_sendProcessNeighborShouldNotExist) +{ + act(); + EXPECT_THAT(para->getParH(level)->sendProcessNeighborX.size(), testing::Eq(0)); + EXPECT_THAT(para->getParH(level)->sendProcessNeighborY.size(), testing::Eq(0)); + EXPECT_THAT(para->getParH(level)->sendProcessNeighborZ.size(), testing::Eq(0)); +} + +TEST_F(GridGeneratorTests_initalValuesDomainDecompostion, whenCommunicationInX_sendProcessNeighborShouldExistInX) +{ + builder->numberOfSendIndices = 1; + act(); + EXPECT_THAT(para->getParH(level)->sendProcessNeighborX.size(), + testing::Eq(1)); // one entry for CommunicationDirections::MX + EXPECT_THAT(para->getParH(level)->sendProcessNeighborY.size(), testing::Eq(0)); + EXPECT_THAT(para->getParH(level)->sendProcessNeighborZ.size(), testing::Eq(0)); +} diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4cd8769407220ec97030489585009d435a6cce8e --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp @@ -0,0 +1,525 @@ +#include "IndexRearrangementForStreams.h" + +#include "Communication/Communicator.h" +#include "Logger.h" +#include "Parameter/Parameter.h" +#include <GridGenerator/grid/Grid.h> +#include <GridGenerator/grid/GridBuilder/GridBuilder.h> + +#include <algorithm> +#include <iostream> + +IndexRearrangementForStreams::IndexRearrangementForStreams(std::shared_ptr<Parameter> para, + std::shared_ptr<GridBuilder> builder, + vf::gpu::CommunicationRoutine &communicator) + : para(para), builder(builder), communicator(communicator) +{ +} + +void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseX(uint level, + int indexOfProcessNeighbor, + int direction) const +{ + VF_LOG_INFO("Communication: reorder send indices in x direction"); + std::vector<uint> sendIndicesForCommAfterFtoCPositions = + initSendIndicesForCommAfterFToCX(level, indexOfProcessNeighbor, direction); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = + exchangeIndicesForCommAfterFtoCX(level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); + + initRecvIndicesForCommAfterFToCX(level, indexOfProcessNeighbor, direction, recvIndicesForCommAfterFtoCPositions); + + copyProcessNeighborToCommAfterFtoCX(level, indexOfProcessNeighbor); +} + +void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseY(uint level, + int indexOfProcessNeighbor, + int direction) const +{ + VF_LOG_INFO("Communication: reorder send indices in x direction"); + std::vector<uint> sendIndicesForCommAfterFtoCPositions = + initSendIndicesForCommAfterFToCY(level, indexOfProcessNeighbor, direction); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = + exchangeIndicesForCommAfterFtoCY(level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); + + initRecvIndicesForCommAfterFToCY(level, indexOfProcessNeighbor, direction, recvIndicesForCommAfterFtoCPositions); + + copyProcessNeighborToCommAfterFtoCY(level, indexOfProcessNeighbor); +} + +void IndexRearrangementForStreams::initCommunicationArraysForCommAfterFinetoCoarseZ(uint level, + int indexOfProcessNeighbor, + int direction) const +{ + VF_LOG_INFO("Communication: reorder send indices in z direction"); + std::vector<uint> sendIndicesForCommAfterFtoCPositions = + initSendIndicesForCommAfterFToCZ(level, indexOfProcessNeighbor, direction); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = + exchangeIndicesForCommAfterFtoCZ(level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); + + initRecvIndicesForCommAfterFToCZ(level, indexOfProcessNeighbor, direction, recvIndicesForCommAfterFtoCPositions); + + copyProcessNeighborToCommAfterFtoCZ(level, indexOfProcessNeighbor); +} + +std::vector<uint> IndexRearrangementForStreams::initSendIndicesForCommAfterFToCX(uint level, int indexOfProcessNeighbor, + int direction) const +{ + para->initProcessNeighborsAfterFtoCX(level); + std::vector<uint> sendIndicesForCommAfterFtoCPositions; + reorderSendIndicesForCommAfterFtoCX(direction, level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); + para->setSendProcessNeighborsAfterFtoCX( + para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); + return sendIndicesForCommAfterFtoCPositions; +} + +std::vector<uint> IndexRearrangementForStreams::initSendIndicesForCommAfterFToCY(uint level, int indexOfProcessNeighbor, + int direction) const +{ + para->initProcessNeighborsAfterFtoCY(level); + std::vector<uint> sendIndicesForCommAfterFtoCPositions; + reorderSendIndicesForCommAfterFtoCY(direction, level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); + para->setSendProcessNeighborsAfterFtoCY( + para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); + return sendIndicesForCommAfterFtoCPositions; +} + +std::vector<uint> IndexRearrangementForStreams::initSendIndicesForCommAfterFToCZ(uint level, int indexOfProcessNeighbor, + int direction) const +{ + para->initProcessNeighborsAfterFtoCZ(level); + std::vector<uint> sendIndicesForCommAfterFtoCPositions; + reorderSendIndicesForCommAfterFtoCZ(direction, level, indexOfProcessNeighbor, sendIndicesForCommAfterFtoCPositions); + para->setSendProcessNeighborsAfterFtoCZ( + para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); + return sendIndicesForCommAfterFtoCPositions; +} + +std::vector<uint> IndexRearrangementForStreams::exchangeIndicesForCommAfterFtoCX( + uint level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + // fill the receive vector with zeros as placeholders + // give vector an arbitrary size (larger than needed) // TODO: Find a better way + std::vector<uint> recvIndicesForCommAfterFtoCPositions( + (size_t)para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes * 2, 0); + + communicator.receive_send( + recvIndicesForCommAfterFtoCPositions.data(), (int)recvIndicesForCommAfterFtoCPositions.size(), + para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].rankNeighbor, + sendIndicesForCommAfterFtoCPositions.data(), (int)sendIndicesForCommAfterFtoCPositions.size(), + para->getParH(level)->sendProcessNeighborX[indexOfProcessNeighbor].rankNeighbor); + + // resize receiving vector to correct size + if ((uint)recvIndicesForCommAfterFtoCPositions.size() > 0) { + auto it = std::unique( + recvIndicesForCommAfterFtoCPositions.begin(), + recvIndicesForCommAfterFtoCPositions.end()); // finds the second zero when there are multiple zeros in a row + recvIndicesForCommAfterFtoCPositions.erase( + std::prev(it, 1), // begin erasing at the first zero + recvIndicesForCommAfterFtoCPositions.end()); // TODO: Find a better way + } + + return recvIndicesForCommAfterFtoCPositions; +} + +std::vector<uint> IndexRearrangementForStreams::exchangeIndicesForCommAfterFtoCY( + uint level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + // fill the receive vector with zeros as placeholders + // give vector an arbitrary size (larger than needed) // TODO: Find a better way + std::vector<uint> recvIndicesForCommAfterFtoCPositions( + (size_t)para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes * 2, 0); + + communicator.receive_send( + recvIndicesForCommAfterFtoCPositions.data(), (int)recvIndicesForCommAfterFtoCPositions.size(), + para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].rankNeighbor, + sendIndicesForCommAfterFtoCPositions.data(), (int)sendIndicesForCommAfterFtoCPositions.size(), + para->getParH(level)->sendProcessNeighborY[indexOfProcessNeighbor].rankNeighbor); + + // resize receiving vector to correct size + if ((uint)recvIndicesForCommAfterFtoCPositions.size() > 0) { + auto it = std::unique( + recvIndicesForCommAfterFtoCPositions.begin(), + recvIndicesForCommAfterFtoCPositions.end()); // finds the second zero when there are multiple zeros in a row + recvIndicesForCommAfterFtoCPositions.erase( + std::prev(it, 1), // begin erasing at the first zero + recvIndicesForCommAfterFtoCPositions.end()); // TODO: Find a better way + } + + return recvIndicesForCommAfterFtoCPositions; +} + +std::vector<uint> IndexRearrangementForStreams::exchangeIndicesForCommAfterFtoCZ( + uint level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + // fill the receive vector with zeros as placeholders + // give vector an arbitrary size (larger than needed) // TODO: Find a better way + std::vector<uint> recvIndicesForCommAfterFtoCPositions( + (size_t)para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes * 2, 0); + + communicator.receive_send( + recvIndicesForCommAfterFtoCPositions.data(), (int)recvIndicesForCommAfterFtoCPositions.size(), + para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].rankNeighbor, + sendIndicesForCommAfterFtoCPositions.data(), (int)sendIndicesForCommAfterFtoCPositions.size(), + para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighbor].rankNeighbor); + + // resize receiving vector to correct size + if ((uint)recvIndicesForCommAfterFtoCPositions.size() > 0) { + auto it = std::unique( + recvIndicesForCommAfterFtoCPositions.begin(), + recvIndicesForCommAfterFtoCPositions.end()); // finds the second zero when there are multiple zeros in a row + recvIndicesForCommAfterFtoCPositions.erase( + std::prev(it, 1), // begin erasing at the first zero + recvIndicesForCommAfterFtoCPositions.end()); // TODO: Find a better way + } + + return recvIndicesForCommAfterFtoCPositions; +} + +void IndexRearrangementForStreams::initRecvIndicesForCommAfterFToCX( + uint level, int indexOfProcessNeighbor, int direction, + std::vector<uint> &recvIndicesForCommAfterFtoCPositions) const +{ + reorderRecvIndicesForCommAfterFtoCX(direction, level, indexOfProcessNeighbor, recvIndicesForCommAfterFtoCPositions); + para->setRecvProcessNeighborsAfterFtoCX( + para->getParH(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); +} + +void IndexRearrangementForStreams::initRecvIndicesForCommAfterFToCY( + uint level, int indexOfProcessNeighbor, int direction, + std::vector<uint> &recvIndicesForCommAfterFtoCPositions) const +{ + reorderRecvIndicesForCommAfterFtoCY(direction, level, indexOfProcessNeighbor, recvIndicesForCommAfterFtoCPositions); + para->setRecvProcessNeighborsAfterFtoCY( + para->getParH(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); +} +void IndexRearrangementForStreams::initRecvIndicesForCommAfterFToCZ( + uint level, int indexOfProcessNeighbor, int direction, + std::vector<uint> &recvIndicesForCommAfterFtoCPositions) const +{ + reorderRecvIndicesForCommAfterFtoCZ(direction, level, indexOfProcessNeighbor, recvIndicesForCommAfterFtoCPositions); + para->setRecvProcessNeighborsAfterFtoCZ( + para->getParH(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes, level, + indexOfProcessNeighbor); +} + +void IndexRearrangementForStreams::copyProcessNeighborToCommAfterFtoCX(uint level, int indexOfProcessNeighbor) const +{ + // init f[0]* + para->getParD(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].f[0] = + para->getParD(level)->sendProcessNeighborX[indexOfProcessNeighbor].f[0]; + para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].f[0] = + para->getParH(level)->sendProcessNeighborX[indexOfProcessNeighbor].f[0]; + para->getParD(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].f[0] = + para->getParD(level)->recvProcessNeighborX[indexOfProcessNeighbor].f[0]; + para->getParH(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].f[0] = + para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].f[0]; + + // init index* + para->getParD(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].index = + para->getParD(level)->sendProcessNeighborX[indexOfProcessNeighbor].index; + para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].index = + para->getParH(level)->sendProcessNeighborX[indexOfProcessNeighbor].index; + para->getParD(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].index = + para->getParD(level)->recvProcessNeighborX[indexOfProcessNeighbor].index; + para->getParH(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].index = + para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].index; + + // rank neighbor + para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->sendProcessNeighborX[indexOfProcessNeighbor].rankNeighbor; + para->getParH(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].rankNeighbor; +} + +void IndexRearrangementForStreams::copyProcessNeighborToCommAfterFtoCY(uint level, int indexOfProcessNeighbor) const +{ + // init f[0]* + para->getParD(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].f[0] = + para->getParD(level)->sendProcessNeighborY[indexOfProcessNeighbor].f[0]; + para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].f[0] = + para->getParH(level)->sendProcessNeighborY[indexOfProcessNeighbor].f[0]; + para->getParD(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].f[0] = + para->getParD(level)->recvProcessNeighborY[indexOfProcessNeighbor].f[0]; + para->getParH(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].f[0] = + para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].f[0]; + + // init index* + para->getParD(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].index = + para->getParD(level)->sendProcessNeighborY[indexOfProcessNeighbor].index; + para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].index = + para->getParH(level)->sendProcessNeighborY[indexOfProcessNeighbor].index; + para->getParD(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].index = + para->getParD(level)->recvProcessNeighborY[indexOfProcessNeighbor].index; + para->getParH(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].index = + para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].index; + + // rank neighbor + para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->sendProcessNeighborY[indexOfProcessNeighbor].rankNeighbor; + para->getParH(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].rankNeighbor; +} + +void IndexRearrangementForStreams::copyProcessNeighborToCommAfterFtoCZ(uint level, int indexOfProcessNeighbor) const +{ + // init f[0]* + para->getParD(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].f[0] = + para->getParD(level)->sendProcessNeighborZ[indexOfProcessNeighbor].f[0]; + para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].f[0] = + para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighbor].f[0]; + para->getParD(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].f[0] = + para->getParD(level)->recvProcessNeighborZ[indexOfProcessNeighbor].f[0]; + para->getParH(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].f[0] = + para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].f[0]; + + // init index* + para->getParD(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].index = + para->getParD(level)->sendProcessNeighborZ[indexOfProcessNeighbor].index; + para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].index = + para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighbor].index; + para->getParD(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].index = + para->getParD(level)->recvProcessNeighborZ[indexOfProcessNeighbor].index; + para->getParH(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].index = + para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].index; + + // rank neighbor + para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighbor].rankNeighbor; + para->getParH(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].rankNeighbor = + para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].rankNeighbor; +} + +void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoCX( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + int *sendIndices = para->getParH(level)->sendProcessNeighborX[indexOfProcessNeighbor].index; + int &numberOfSendNodesAfterFtoC = + para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes; + reorderSendIndicesForCommAfterFtoC(sendIndices, numberOfSendNodesAfterFtoC, direction, level, + sendIndicesForCommAfterFtoCPositions); +} + +void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoCY( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + int *sendIndices = para->getParH(level)->sendProcessNeighborY[indexOfProcessNeighbor].index; + int &numberOfSendNodesAfterFtoC = + para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes; + reorderSendIndicesForCommAfterFtoC(sendIndices, numberOfSendNodesAfterFtoC, direction, level, + sendIndicesForCommAfterFtoCPositions); +} + +void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoCZ( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + int *sendIndices = para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighbor].index; + int &numberOfSendNodesAfterFtoC = + para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes; + reorderSendIndicesForCommAfterFtoC(sendIndices, numberOfSendNodesAfterFtoC, direction, level, + sendIndicesForCommAfterFtoCPositions); +} + +void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoC( + int *sendIndices, int &numberOfSendNodesAfterFtoC, int direction, int level, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + VF_LOG_INFO("Reorder send indices for communication after fine to coarse: level: {} direction: {}", level, + direction); + if (para->getParH(level)->intCF.kCF == 0 || para->getParH(level)->intFC.kFC == 0) + VF_LOG_CRITICAL("reorderSendIndicesForCommAfterFtoC(): para->getParH(level)->intCF needs to be initialized " + "before calling this function"); + + int sparseIndexSend; + std::vector<int> sendIndicesAfterFtoC; + std::vector<int> sendIndicesOther; + uint numberOfSendIndices = builder->getNumberOfSendIndices(direction, level); + + // iCellFCC + for (uint posInSendIndices = 0; posInSendIndices < numberOfSendIndices; posInSendIndices++) { + sparseIndexSend = sendIndices[posInSendIndices]; + if (isSparseIndexInICellFCC(para->getParH(level)->intFC.kFC, sparseIndexSend, level)) { + addUniqueIndexToCommunicationVectors(sendIndicesAfterFtoC, sparseIndexSend, + sendIndicesForCommAfterFtoCPositions, posInSendIndices); + } + } + + // iCellCFC + std::vector<uint> nodesCFC; + aggregateNodesInICellCFC(level, nodesCFC); + for (auto sparseIndex : nodesCFC) + findIfSparseIndexIsInSendIndicesAndAddToCommVectors(sparseIndex, sendIndices, numberOfSendIndices, + sendIndicesAfterFtoC, sendIndicesForCommAfterFtoCPositions); + + numberOfSendNodesAfterFtoC = (int)sendIndicesAfterFtoC.size(); + + findIndicesNotInCommAfterFtoC(numberOfSendIndices, sendIndices, sendIndicesAfterFtoC, sendIndicesOther); + + // copy new vectors back to sendIndices array + for (int i = 0; i < numberOfSendNodesAfterFtoC; i++) + sendIndices[i] = sendIndicesAfterFtoC[i]; + for (uint i = 0; i < (uint)sendIndicesOther.size(); i++) + sendIndices[i + numberOfSendNodesAfterFtoC] = sendIndicesOther[i]; + + VF_LOG_INFO("Reorder send indices: process {}, numberOfSendNodesAfterFtoC {}", communicator.getPID(), + numberOfSendNodesAfterFtoC); + + if (numberOfSendNodesAfterFtoC + sendIndicesOther.size() != numberOfSendIndices) { + VF_LOG_CRITICAL("reorderSendIndicesForCommAfterFtoC(): incorrect number of nodes"); + VF_LOG_CRITICAL("numberOfSendNodesAfterFtoC = {}, sendIndicesOther.size() = {}, numberOfSendIndices = {}", + numberOfSendNodesAfterFtoC, sendIndicesOther.size(), numberOfSendIndices); + } +} + +bool IndexRearrangementForStreams::isSparseIndexInICellFCC(uint sizeOfICellFCC, int sparseIndex, int level) const +{ + for (uint j = 0; j < sizeOfICellFCC; j++) { + if (sparseIndex < 0) + return false; + if (para->getParH(level)->intFC.ICellFCC[j] == (uint)sparseIndex) { + return true; + } + } + return false; +} + +void IndexRearrangementForStreams::aggregateNodesInICellCFC(int level, std::vector<uint> &nodesCFC) const +{ + uint sparseIndex; + uint *neighborX = para->getParH(level)->neighborX; + uint *neighborY = para->getParH(level)->neighborY; + uint *neighborZ = para->getParH(level)->neighborZ; + + for (uint x = 0; x < para->getParH(level)->intCF.kCF; x++) { + sparseIndex = para->getParH(level)->intCF.ICellCFC[x]; + nodesCFC.push_back(sparseIndex); + nodesCFC.push_back(neighborX[sparseIndex]); + nodesCFC.push_back(neighborY[sparseIndex]); + nodesCFC.push_back(neighborZ[sparseIndex]); + nodesCFC.push_back(neighborY[neighborX[sparseIndex]]); + nodesCFC.push_back(neighborZ[neighborX[sparseIndex]]); + nodesCFC.push_back(neighborZ[neighborY[sparseIndex]]); + nodesCFC.push_back(neighborZ[neighborY[neighborX[sparseIndex]]]); + } + + // remove duplicate nodes + std::sort(nodesCFC.begin(), nodesCFC.end()); + auto iterator = std::unique(nodesCFC.begin(), nodesCFC.end()); + nodesCFC.erase(iterator, nodesCFC.end()); +} + +void IndexRearrangementForStreams::addUniqueIndexToCommunicationVectors( + std::vector<int> &sendIndicesAfterFtoC, int &sparseIndexSend, + std::vector<unsigned int> &sendIndicesForCommAfterFtoCPositions, uint &posInSendIndices) const +{ + // add index to corresponding vectors, but omit indices which are already in sendIndicesAfterFtoC + if (std::find(sendIndicesAfterFtoC.begin(), sendIndicesAfterFtoC.end(), sparseIndexSend) == + sendIndicesAfterFtoC.end()) { + sendIndicesAfterFtoC.push_back(sparseIndexSend); + sendIndicesForCommAfterFtoCPositions.push_back(posInSendIndices); + } +} + +void IndexRearrangementForStreams::findIfSparseIndexIsInSendIndicesAndAddToCommVectors( + int sparseIndex, int *sendIndices, uint numberOfSendIndices, std::vector<int> &sendIndicesAfterFtoC, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + int sparseIndexSend; + for (uint posInSendIndices = 0; posInSendIndices < numberOfSendIndices; posInSendIndices++) { + sparseIndexSend = sendIndices[posInSendIndices]; + if (sparseIndex == sparseIndexSend) { + addUniqueIndexToCommunicationVectors(sendIndicesAfterFtoC, sparseIndex, + sendIndicesForCommAfterFtoCPositions, posInSendIndices); + break; + } + } +} + +void IndexRearrangementForStreams::findIndicesNotInCommAfterFtoC(const uint &numberOfSendOrRecvIndices, + int *sendOrReceiveIndices, + std::vector<int> &sendOrReceiveIndicesAfterFtoC, + std::vector<int> &sendOrIndicesOther) const +{ + int sparseIndexSend; + for (uint posInSendIndices = 0; posInSendIndices < numberOfSendOrRecvIndices; posInSendIndices++) { + sparseIndexSend = sendOrReceiveIndices[posInSendIndices]; + if (std::find(sendOrReceiveIndicesAfterFtoC.begin(), sendOrReceiveIndicesAfterFtoC.end(), sparseIndexSend) == + sendOrReceiveIndicesAfterFtoC.end()) + sendOrIndicesOther.push_back(sparseIndexSend); + } +} + +void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoCX( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + int *recvIndices = para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].index; + int &numberOfRecvNodesAfterFtoC = + para->getParH(level)->recvProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes; + reorderRecvIndicesForCommAfterFtoC(recvIndices, numberOfRecvNodesAfterFtoC, direction, level, + sendIndicesForCommAfterFtoCPositions); +} + +void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoCY( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + int *recvIndices = para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].index; + int &numberOfRecvNodesAfterFtoC = + para->getParH(level)->recvProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes; + reorderRecvIndicesForCommAfterFtoC(recvIndices, numberOfRecvNodesAfterFtoC, direction, level, + sendIndicesForCommAfterFtoCPositions); +} + +void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoCZ( + int direction, int level, int indexOfProcessNeighbor, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + int *recvIndices = para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].index; + int &numberOfRecvNodesAfterFtoC = + para->getParH(level)->recvProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes; + reorderRecvIndicesForCommAfterFtoC(recvIndices, numberOfRecvNodesAfterFtoC, direction, level, + sendIndicesForCommAfterFtoCPositions); +} + +void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoC( + int *recvIndices, int &numberOfRecvNodesAfterFtoC, int direction, int level, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const +{ + VF_LOG_INFO("Reorder recv indices for communication after fine to coarse: level: {} direction: {}", level, + direction); + + if (sendIndicesForCommAfterFtoCPositions.size() == 0) + VF_LOG_WARNING("ReorderRecvIndicesForCommAfterFtoC(): sendIndicesForCommAfterFtoCPositions is empty."); + + uint numberOfRecvIndices = builder->getNumberOfReceiveIndices(direction, level); + std::vector<int> recvIndicesAfterFtoC; + std::vector<int> recvIndicesOther; + + // find recvIndices for Communication after fine to coarse + for (uint vectorPos : sendIndicesForCommAfterFtoCPositions) + recvIndicesAfterFtoC.push_back(recvIndices[vectorPos]); + + findIndicesNotInCommAfterFtoC(numberOfRecvIndices, recvIndices, recvIndicesAfterFtoC, recvIndicesOther); + + numberOfRecvNodesAfterFtoC = (int)recvIndicesAfterFtoC.size(); + + // copy new vectors back to recvIndices array + for (int i = 0; i < numberOfRecvNodesAfterFtoC; i++) + recvIndices[i] = recvIndicesAfterFtoC[i]; + for (uint i = 0; i < (uint)recvIndicesOther.size(); i++) + recvIndices[i + numberOfRecvNodesAfterFtoC] = recvIndicesOther[i]; + + VF_LOG_INFO("Reorder send indices: process {}, numberOfRecvNodesAfterFtoC {}", communicator.getPID(), + numberOfRecvNodesAfterFtoC); + + if (numberOfRecvNodesAfterFtoC + recvIndicesOther.size() != numberOfRecvIndices) { + VF_LOG_CRITICAL("reorderRecvIndicesForCommAfterFtoC(): incorrect number of nodes"); + VF_LOG_CRITICAL("numberOfRecvNodesAfterFtoC = {}, recvIndicesOther.size() = {}, numberOfRecvIndices = {}", + numberOfRecvNodesAfterFtoC, recvIndicesOther.size(), numberOfRecvIndices); + } +} diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h new file mode 100644 index 0000000000000000000000000000000000000000..e6753e21be43a4f004d812cca8b9adafa501ffe8 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h @@ -0,0 +1,141 @@ +//! \file IndexRearrangementForStreams.h +//! \ingroup GPU +//! \author Anna Wellmann +//! \details See [master thesis of Anna Wellmann] + +#ifndef IndexRearrangementForStreams_H +#define IndexRearrangementForStreams_H + +#include <memory> +#include <vector> + +#include <basics/Core/DataTypes.h> + +class Parameter; +class GridBuilder; +namespace vf::gpu +{ +class CommunicationRoutine; +} + +class IndexRearrangementForStreams +{ +public: + //! \brief Construct IndexRearrangementForStreams object + IndexRearrangementForStreams(std::shared_ptr<Parameter> para, std::shared_ptr<GridBuilder> builder, vf::gpu::CommunicationRoutine& communicator); + + virtual ~IndexRearrangementForStreams() = default; + + ////////////////////////////////////////////////////////////////////////// + // communication after fine to coarse + ////////////////////////////////////////////////////////////////////////// + + //! \brief Initialize the arrays for the communication after the interpolation from fine to coarse in x direction + //! \details Only the nodes involved in the interpolation need to be exchanged. Therefore in this method all nodes, + //! which are part of the interpolation as well as the communication, are identified. + //!See [master thesis of Anna Wellmann (p. 59-62: "Reduzieren der auszutauschenden Knoten")] + virtual void initCommunicationArraysForCommAfterFinetoCoarseX(uint level, int j, int direction) const; + //! \brief Initialize the arrays for the communication after the interpolation from fine to coarse in y direction + //! \details --> see x direction + virtual void initCommunicationArraysForCommAfterFinetoCoarseY(uint level, int j, int direction) const; + //! \brief Initialize the arrays for the communication after the interpolation from fine to coarse in z direction + //! \details --> see x direction + virtual void initCommunicationArraysForCommAfterFinetoCoarseZ(uint level, int j, int direction) const; + +protected: + ////////////////////////////////////////////////////////////////////////// + // communication after fine to coarse + ////////////////////////////////////////////////////////////////////////// + + //! \brief Initializes the send indices for the communication after the interpolation from fine to coarse + std::vector<uint> initSendIndicesForCommAfterFToCX(uint level, int indexOfProcessNeighbor, int direction) const; + std::vector<uint> initSendIndicesForCommAfterFToCY(uint level, int indexOfProcessNeighbor, int direction) const; + std::vector<uint> initSendIndicesForCommAfterFToCZ(uint level, int indexOfProcessNeighbor, int direction) const; + + //! \brief send sendIndicesForCommAfterFtoCPositions to receiving process and receive + //! recvIndicesForCommAfterFtoCPositions from neighboring process + std::vector<uint> exchangeIndicesForCommAfterFtoCX(uint level, int indexOfProcessNeighbor, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + std::vector<uint> exchangeIndicesForCommAfterFtoCY(uint level, int indexOfProcessNeighbor, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + std::vector<uint> exchangeIndicesForCommAfterFtoCZ(uint level, int indexOfProcessNeighbor, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + + //! \brief Initializes the send indices for the communication after the interpolation from fine to coarse + void initRecvIndicesForCommAfterFToCX(uint level, int indexOfProcessNeighbor, int direction, std::vector<uint>& recvIndicesForCommAfterFtoCPositions) const; + void initRecvIndicesForCommAfterFToCY(uint level, int indexOfProcessNeighbor, int direction, std::vector<uint>& recvIndicesForCommAfterFtoCPositions) const; + void initRecvIndicesForCommAfterFToCZ(uint level, int indexOfProcessNeighbor, int direction, std::vector<uint>& recvIndicesForCommAfterFtoCPositions) const; + + //! \brief Initializes pointers for reduced communication after the interpolation from fine to coarse by copying + //! them from "normal" communication + void copyProcessNeighborToCommAfterFtoCX(uint level, int indexOfProcessNeighbor) const; + void copyProcessNeighborToCommAfterFtoCY(uint level, int indexOfProcessNeighbor) const; + void copyProcessNeighborToCommAfterFtoCZ(uint level, int indexOfProcessNeighbor) const; + + //! \brief --> see reorderSendIndicesForCommAfterFtoC + void reorderSendIndicesForCommAfterFtoCX(int direction, int level, int indexOfProcessNeighbor, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + void reorderSendIndicesForCommAfterFtoCY(int direction, int level, int indexOfProcessNeighbor, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + void reorderSendIndicesForCommAfterFtoCZ(int direction, int level, int indexOfProcessNeighbor, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + + //! \brief The send indices are reordered for the communication after the interpolation from fine to coarse + //! \details The indices of nodes which are part of the interpolation are moved to the front of vector with the send + //! indices. + //! \pre para->getParH(level)->intCF needs to be inititalized + //! \param sendIndices is the pointer to the vector with the send indices, which will be reordered in this function + //! \param numberOfSendNodesAfterFtoC will be set in this method + //! \param sendIndicesForCommAfterFtoCPositions stores each sendIndex's positions before reordering + void reorderSendIndicesForCommAfterFtoC(int *sendIndices, int &numberOfSendNodesAfterFtoC, int direction, + int level, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + //! \brief Check if a sparse index occurs in the ICellFCC + bool isSparseIndexInICellFCC(uint sizeOfICellFCC, int sparseIndexSend, int level) const; + //! \brief Aggregate all nodes in the coarse cells for the interpolation in coarse to fine + //! \details For the coarse cells in the interpolation from coarse to fine only one node is stored. This methods + //! looks for the other nodes of each cell and puts them into vector. Duplicate nodes are only stored once. + void aggregateNodesInICellCFC(int level, std::vector<uint> &nodesCFC) const; + //! \brief Add index to sendIndicesAfterFtoC and sendIndicesForCommAfterFtoCPositions, but omit indices which are already in sendIndicesAfterFtoC + void addUniqueIndexToCommunicationVectors(std::vector<int> &sendIndicesAfterFtoC, int &sparseIndexSend, + std::vector<unsigned int> &sendIndicesForCommAfterFtoCPositions, + uint &posInSendIndices) const; + //! \brief Find if a sparse index is a send index. If true, call addUniqueIndexToCommunicationVectors() + void + findIfSparseIndexIsInSendIndicesAndAddToCommVectors(int sparseIndex, int *sendIndices, uint numberOfSendIndices, + std::vector<int> &sendIndicesAfterFtoC, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + //! \brief Find all indices which are not part of the communication after the interpolation from fine to coarse + void findIndicesNotInCommAfterFtoC(const uint &numberOfSendOrRecvIndices, int *sendOrReceiveIndices, + std::vector<int> &sendOrReceiveIndicesAfterFtoC, + std::vector<int> &sendOrIndicesOther) const; + + //! \brief --> see reorderRecvIndicesForCommAfterFtoC + void reorderRecvIndicesForCommAfterFtoCX(int direction, int level, int indexOfProcessNeighbor, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + void reorderRecvIndicesForCommAfterFtoCY(int direction, int level, int indexOfProcessNeighbor, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + void reorderRecvIndicesForCommAfterFtoCZ(int direction, int level, int indexOfProcessNeighbor, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + + //! \brief Reorder the receive indices in the same way that the send indices were reordered. + //! \details When the send indices are reordered, the receive indices need to be reordered accordingly. + //! \pre sendIndicesForCommAfterFtoCPositions should not be empty + //! \param recvIndices is the pointer to the vector with the receive indices, which will be reordered in this function + //! \param numberOfRecvNodesAfterFtoC will be set in this function + //! \param sendIndicesForCommAfterFtoCPositions stores each sendIndex's positions before reordering and is used to reorder the receive indices in the same way + void reorderRecvIndicesForCommAfterFtoC(int *recvIndices, int &numberOfRecvNodesAfterFtoC, int direction, + int level, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) const; + +private: + std::shared_ptr<GridBuilder> builder; + std::shared_ptr<Parameter> para; + vf::gpu::CommunicationRoutine& communicator; + + // used for tests + friend class IndexRearrangementForStreamsTest_reorderSendIndices; + friend class IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX; + friend class IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY; + friend class IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ; +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7bf534013ab68ba6a58fb3f33ca4ae03610cc12d --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp @@ -0,0 +1,552 @@ +#include <gmock/gmock.h> + +#include <algorithm> +#include <iostream> +#include <vector> + +#include "Utilities/testUtilitiesGPU.h" + +#include "Communication/Communicator.h" +#include "DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h" +#include "Parameter/Parameter.h" +#include "basics/config/ConfigurationFile.h" +#include "gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h" +#include "gpu/GridGenerator/grid/GridImp.h" +#include "gpu/GridGenerator/utilities/communication.h" +#include "gpu/VirtualFluids_GPU/Communication/Communicator.cpp" + +namespace indexRearrangementTests +{ +template <typename T> +bool vectorsAreEqual(const T *vector1, const std::vector<T>& vectorExpected) +{ + for (uint i = 0; i < vectorExpected.size(); i++) { + if (vector1[i] != vectorExpected[i]) + return false; + } + return true; +} + +class LevelGridBuilderDouble : public LevelGridBuilder +{ +private: + SPtr<Grid> grid; + LevelGridBuilderDouble() = default; + + uint numberOfSendIndices; + +public: + LevelGridBuilderDouble(SPtr<Grid> grid) : LevelGridBuilder(), grid(grid){}; + SPtr<Grid> getGrid(uint level) override + { + return grid; + }; + void setNumberOfSendIndices(uint numberOfSendIndices) + { + this->numberOfSendIndices = numberOfSendIndices; + }; + uint getNumberOfSendIndices(int direction, uint level) override + { + return numberOfSendIndices; + }; +}; + +class GridImpDouble : public GridImp +{ +private: + std::vector<uint> fluidNodeIndicesBorder; + +public: + GridImpDouble(Object *object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, + Distribution d, uint level) + : GridImp(object, startX, startY, startZ, endX, endY, endZ, delta, d, level) + { + } + + static SPtr<GridImpDouble> makeShared(Object *object, real startX, real startY, real startZ, real endX, real endY, + real endZ, real delta, Distribution d, uint level) + { + SPtr<GridImpDouble> grid(new GridImpDouble(object, startX, startY, startZ, endX, endY, endZ, delta, d, level)); + return grid; + } +}; + +} // namespace indexRearrangementTests + +////////////////////////////////////////////////////////////////////////// +// Test reorderSendIndices +////////////////////////////////////////////////////////////////////////// +using namespace indexRearrangementTests; + +struct SendIndicesForCommAfterFtoCX { + // data to work on + std::vector<int> sendIndices = { 10, 11, 12, 13, 14, 15, 16 }; + const int level = 0; + const int direction = CommunicationDirections::MX; + const int numberOfProcessNeighbors = 1; + const int indexOfProcessNeighbor = 0; + + std::vector<uint> iCellCFC = { 8, 10, 12 }; + std::vector<uint> iCellFCC = { 14, 16, 18 }; + const uint kCF = (uint)iCellCFC.size(); + const uint kFC = (uint)iCellFCC.size(); + uint neighborX[18] = { 0u }; + uint neighborY[18] = { 0u }; + uint neighborZ[18] = { 0u }; + + // output data + std::vector<uint> sendIndicesForCommAfterFtoCPositions; + + // expected data + const std::vector<uint> sendIndicesForCommAfterFtoCPositions_expected = { 4, 6, 0, 2 }; + const std::vector<int> sendProcessNeighborX_expected = { 14, 16, 10, 12, 11, 13, 15 }; + const int numberOfSendNodesAfterFtoC_expected = (int)sendIndicesForCommAfterFtoCPositions_expected.size(); +}; + +class IndexRearrangementForStreamsTest_reorderSendIndices : public testing::Test +{ +protected: + SendIndicesForCommAfterFtoCX si; + SPtr<Parameter> para; + std::unique_ptr<IndexRearrangementForStreams> testSubject; + + void act() + { + testSubject->reorderSendIndicesForCommAfterFtoCX(si.direction, si.level, si.indexOfProcessNeighbor, + si.sendIndicesForCommAfterFtoCPositions); + }; + +private: + void SetUp() override + { + logging::Logger::addStream(&std::cout); + + SPtr<GridImpDouble> grid = + GridImpDouble::makeShared(nullptr, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, Distribution(), 1); + std::shared_ptr<LevelGridBuilderDouble> builder = std::make_shared<LevelGridBuilderDouble>(grid); + builder->setNumberOfSendIndices((uint)si.sendIndices.size()); + + para = testingVF::createParameterForLevel(si.level); + + para->getParH(si.level)->intFC.kFC = si.kFC; + para->getParH(si.level)->intFC.ICellFCC = &(si.iCellFCC.front()); + para->getParH(si.level)->intCF.ICellCFC = &(si.iCellCFC.front()); + para->getParH(si.level)->intCF.kCF = si.kCF; + para->getParH(si.level)->neighborX = si.neighborX; + para->getParH(si.level)->neighborY = si.neighborY; + para->getParH(si.level)->neighborZ = si.neighborZ; + + para->setNumberOfProcessNeighborsX(si.numberOfProcessNeighbors, si.level, "send"); + para->getParH(si.level)->sendProcessNeighborX[si.indexOfProcessNeighbor].index = si.sendIndices.data(); + para->initProcessNeighborsAfterFtoCX(si.level); + + testSubject = std::make_unique<IndexRearrangementForStreams>( + IndexRearrangementForStreams(para, builder, vf::gpu::Communicator::getInstance())); + }; +}; + +TEST_F(IndexRearrangementForStreamsTest_reorderSendIndices, reorderSendIndicesForCommAfterFtoCX) +{ + act(); + + EXPECT_THAT(si.sendIndicesForCommAfterFtoCPositions.size(), + testing::Eq(si.sendIndicesForCommAfterFtoCPositions_expected.size())); + EXPECT_THAT(si.sendIndicesForCommAfterFtoCPositions, testing::Eq(si.sendIndicesForCommAfterFtoCPositions_expected)); + + EXPECT_THAT(para->getParH(si.level)->sendProcessNeighborsAfterFtoCX[si.indexOfProcessNeighbor].numberOfNodes, + testing::Eq(si.numberOfSendNodesAfterFtoC_expected)); + EXPECT_TRUE(vectorsAreEqual(para->getParH(si.level)->sendProcessNeighborX[si.indexOfProcessNeighbor].index, + si.sendProcessNeighborX_expected)) + << "sendProcessNeighborX[].index does not match the expected vector"; +} + +////////////////////////////////////////////////////////////////////////// +// Test exchangeIndicesForCommAfterFtoC +////////////////////////////////////////////////////////////////////////// + +class CommunicationRoutineDouble : public vf::gpu::CommunicationRoutine +{ +public: + void receive_send(uint *buffer_receive, int, int, uint *, int, int) const override + { + for (int i = 0; i < (int)receivedIndices.size(); ++i) { + *(buffer_receive + i) = receivedIndices[i]; + } + } + + int getPID() const override + { + return 0; + } + + void setReceivedIndices(const std::vector<uint>& receivedIndices) + { + this->receivedIndices = receivedIndices; + } + +private: + std::vector<uint> receivedIndices; +}; + +class IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX : public testing::Test +{ + +public: + void createTestSubject(vf::gpu::CommunicationRoutine &CommunicationRoutine) + { + sut = std::make_unique<IndexRearrangementForStreams>(para, builder, CommunicationRoutine); + } + +protected: + std::vector<uint> act() + { + return sut->exchangeIndicesForCommAfterFtoCX(level, indexOfProcessNeighbor, + sendIndicesForCommAfterFtoCPositions); + } + +protected: + SPtr<Parameter> para; + std::shared_ptr<LevelGridBuilderDouble> builder; + std::unique_ptr<IndexRearrangementForStreams> sut; + const uint level = 1; + const int indexOfProcessNeighbor = 0; + const uint numberOfProcessNeighbors = 2; + std::vector<uint> sendIndicesForCommAfterFtoCPositions = { 1, 2, 3 }; + +private: + void SetUp() override + { + logging::Logger::addStream(&std::cout); + + para = testingVF::createParameterForLevel(level); + + para->setNumberOfProcessNeighborsX(numberOfProcessNeighbors, level, "send"); + para->initProcessNeighborsAfterFtoCX(level); + para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes = 3; + + para->setNumberOfProcessNeighborsX(numberOfProcessNeighbors, level, "recv"); + para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].rankNeighbor = 0; + + SPtr<GridImpDouble> grid = + GridImpDouble::makeShared(nullptr, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, Distribution(), 1); + builder = std::make_shared<LevelGridBuilderDouble>(grid); + }; +}; + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, emptyRecvInX) +{ + CommunicationRoutineDouble communicator; + communicator.setReceivedIndices(std::vector<uint>()); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(0)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, zeroRecvIndexX) +{ + CommunicationRoutineDouble communicator; + communicator.setReceivedIndices({ 0 }); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(0)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, oneRecvIndexX) +{ + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 10 }; + std::vector<uint> receivedIndicesByComm(4, 0); + std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); + communicator.setReceivedIndices(receivedIndicesByComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(1)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, threeRecvIndicesX) +{ + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 10, 20, 30 }; + std::vector<uint> receivedIndicesByComm(5, 0); + std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); + communicator.setReceivedIndices(receivedIndicesByComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(3)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, sixRecvIndicesX) +{ + // this test shows the limits of the current approach. The last index is always deleted + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 10, 20, 30, 40, 50 }; + std::vector<uint> receivedIndicesByComm = { 10, 20, 30, 40, 50, 60 }; + communicator.setReceivedIndices(receivedIndicesByComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(5)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, recvIndicesXContainZero) +{ + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 0, 20, 30, 40 }; + std::vector<uint> receivedIndicesByComm(6, 0); + std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); + communicator.setReceivedIndices(receivedIndicesByComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(4)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} + +class IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY : public testing::Test +{ + +public: + void createTestSubject(vf::gpu::CommunicationRoutine &CommunicationRoutine) + { + sut = std::make_unique<IndexRearrangementForStreams>(para, builder, CommunicationRoutine); + } + +protected: + std::vector<uint> act() + { + return sut->exchangeIndicesForCommAfterFtoCY(level, indexOfProcessNeighbor, + sendIndicesForCommAfterFtoCPositions); + } + +protected: + SPtr<Parameter> para; + std::shared_ptr<LevelGridBuilderDouble> builder; + std::unique_ptr<IndexRearrangementForStreams> sut; + const uint level = 1; + const int indexOfProcessNeighbor = 0; + const uint numberOfProcessNeighbors = 2; + std::vector<uint> sendIndicesForCommAfterFtoCPositions = { 1, 2, 3 }; + +private: + void SetUp() override + { + logging::Logger::addStream(&std::cout); + + para = testingVF::createParameterForLevel(level); + + para->setNumberOfProcessNeighborsY(numberOfProcessNeighbors, level, "send"); + para->initProcessNeighborsAfterFtoCY(level); + para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes = 3; + + para->setNumberOfProcessNeighborsY(numberOfProcessNeighbors, level, "recv"); + para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].rankNeighbor = 0; + + SPtr<GridImpDouble> grid = + GridImpDouble::makeShared(nullptr, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, Distribution(), 1); + builder = std::make_shared<LevelGridBuilderDouble>(grid); + }; +}; + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, emptyRecvInY) +{ + CommunicationRoutineDouble communicator; + communicator.setReceivedIndices(std::vector<uint>()); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(0)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, zeroRecvIndexY) +{ + CommunicationRoutineDouble communicator; + communicator.setReceivedIndices({ 0 }); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(0)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, oneRecvIndexY) +{ + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 10 }; + std::vector<uint> receivedIndicesByComm(4, 0); + std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); + communicator.setReceivedIndices(receivedIndicesByComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(1)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, threeRecvIndicesY) +{ + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 10, 20, 30 }; + std::vector<uint> receivedIndicesByComm(5, 0); + std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); + communicator.setReceivedIndices(receivedIndicesByComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(3)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, sixRecvIndicesY) +{ + // this test shows the limits of the current approach. The last index is always deleted + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 10, 20, 30, 40, 50 }; + std::vector<uint> receivedIndicesByComm = { 10, 20, 30, 40, 50, 60 }; + communicator.setReceivedIndices(receivedIndicesByComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(5)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, recvIndicesYContainZero) +{ + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 0, 20, 30, 40 }; + std::vector<uint> receivedIndicesByComm(6, 0); + std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); + communicator.setReceivedIndices(receivedIndicesByComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(4)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} + +class IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ : public testing::Test +{ + +public: + void createTestSubject(vf::gpu::CommunicationRoutine &CommunicationRoutine) + { + sut = std::make_unique<IndexRearrangementForStreams>(para, builder, CommunicationRoutine); + } + +protected: + std::vector<uint> act() + { + return sut->exchangeIndicesForCommAfterFtoCZ(level, indexOfProcessNeighbor, + sendIndicesForCommAfterFtoCPositions); + } + +protected: + SPtr<Parameter> para; + std::shared_ptr<LevelGridBuilderDouble> builder; + std::unique_ptr<IndexRearrangementForStreams> sut; + const uint level = 1; + const int indexOfProcessNeighbor = 0; + const uint numberOfProcessNeighbors = 2; + std::vector<uint> sendIndicesForCommAfterFtoCPositions = { 1, 2, 3 }; + +private: + void SetUp() override + { + logging::Logger::addStream(&std::cout); + + para = testingVF::createParameterForLevel(level); + + para->setNumberOfProcessNeighborsZ(numberOfProcessNeighbors, level, "send"); + para->initProcessNeighborsAfterFtoCZ(level); + para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes = 3; + + para->setNumberOfProcessNeighborsZ(numberOfProcessNeighbors, level, "recv"); + para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].rankNeighbor = 0; + + SPtr<GridImpDouble> grid = + GridImpDouble::makeShared(nullptr, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, Distribution(), 1); + builder = std::make_shared<LevelGridBuilderDouble>(grid); + }; +}; + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, emptyRecvInZ) +{ + CommunicationRoutineDouble communicator; + communicator.setReceivedIndices(std::vector<uint>()); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(0)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, zeroRecvIndexZ) +{ + CommunicationRoutineDouble communicator; + communicator.setReceivedIndices({ 0 }); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(0)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, oneRecvIndexZ) +{ + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 10 }; + std::vector<uint> receivedIndicesBZComm(4, 0); + std::copy(expected.begin(), expected.end(), receivedIndicesBZComm.begin()); + communicator.setReceivedIndices(receivedIndicesBZComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(1)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, threeRecvIndicesZ) +{ + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 10, 20, 30 }; + std::vector<uint> receivedIndicesBZComm(5, 0); + std::copy(expected.begin(), expected.end(), receivedIndicesBZComm.begin()); + communicator.setReceivedIndices(receivedIndicesBZComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(3)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, sixRecvIndicesYZ) +{ + // this test shows the limits of the current approach. The last index is always deleted + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 10, 20, 30, 40, 50 }; + std::vector<uint> receivedIndicesByComm = { 10, 20, 30, 40, 50, 60 }; + communicator.setReceivedIndices(receivedIndicesByComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(5)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} + +TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, recvIndicesZContainZero) +{ + CommunicationRoutineDouble communicator; + std::vector<uint> expected = { 0, 20, 30, 40 }; + std::vector<uint> receivedIndicesByComm(6, 0); + std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); + communicator.setReceivedIndices(receivedIndicesByComm); + createTestSubject(communicator); + + std::vector<uint> recvIndicesForCommAfterFtoCPositions = act(); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions.size(), testing::Eq(4)); + EXPECT_THAT(recvIndicesForCommAfterFtoCPositions, testing::Eq(expected)); +} diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/InterpolationCellGrouper.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/InterpolationCellGrouper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..347ab362d1f6b28a6c2b46f2e885085f955fb34e --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/InterpolationCellGrouper.cpp @@ -0,0 +1,182 @@ +#include "InterpolationCellGrouper.h" + +#include "Parameter/Parameter.h" +#include <GridGenerator/grid/Grid.h> +#include <GridGenerator/grid/GridBuilder/GridBuilder.h> + +InterpolationCellGrouper::InterpolationCellGrouper(const LBMSimulationParameters &parHs, + const LBMSimulationParameters &parDs, SPtr<GridBuilder> builder) + : parHs(parHs), parDs(parDs), builder(builder) +{ +} + +void InterpolationCellGrouper::splitFineToCoarseIntoBorderAndBulk(uint level) const +{ + this->reorderFineToCoarseIntoBorderAndBulk(level); + + parDs[level]->intFCBorder.kFC = parHs[level]->intFCBorder.kFC; + parDs[level]->intFCBulk.kFC = parHs[level]->intFCBulk.kFC; + parDs[level]->intFCBorder.ICellFCC = parDs[level]->intFC.ICellFCC; + parDs[level]->intFCBulk.ICellFCC = parDs[level]->intFCBorder.ICellFCC + parDs[level]->intFCBorder.kFC; + parDs[level]->intFCBorder.ICellFCF = parDs[level]->intFC.ICellFCF; + parDs[level]->intFCBulk.ICellFCF = parDs[level]->intFCBorder.ICellFCF + parDs[level]->intFCBorder.kFC; + parDs[level]->offFCBulk.xOffFC = parDs[level]->offFC.xOffFC + parDs[level]->intFCBorder.kFC; + parDs[level]->offFCBulk.yOffFC = parDs[level]->offFC.yOffFC + parDs[level]->intFCBorder.kFC; + parDs[level]->offFCBulk.zOffFC = parDs[level]->offFC.zOffFC + parDs[level]->intFCBorder.kFC; +} + +void InterpolationCellGrouper::reorderFineToCoarseIntoBorderAndBulk(uint level) const +{ + // create some local variables for better readability + uint *iCellFccAll = parHs[level]->intFC.ICellFCC; + uint *iCellFcfAll = parHs[level]->intFC.ICellFCF; + auto grid = this->builder->getGrid(level); + + std::vector<uint> iCellFccBorderVector; + std::vector<uint> iCellFccBulkVector; + std::vector<uint> iCellFcfBorderVector; + std::vector<uint> iCellFcfBulkVector; + std::vector<real> xOffFCBorderVector; + std::vector<real> yOffFCBorderVector; + std::vector<real> zOffFCBorderVector; + std::vector<real> xOffFCBulkVector; + std::vector<real> yOffFCBulkVector; + std::vector<real> zOffFCBulkVector; + + // fill border and bulk vectors with iCellFCs + for (uint i = 0; i < parHs[level]->intFC.kFC; i++) + if (grid->isSparseIndexInFluidNodeIndicesBorder(iCellFccAll[i])) { + iCellFccBorderVector.push_back(iCellFccAll[i]); + iCellFcfBorderVector.push_back(iCellFcfAll[i]); + xOffFCBorderVector.push_back(parHs[level]->offFC.xOffFC[i]); + yOffFCBorderVector.push_back(parHs[level]->offFC.yOffFC[i]); + zOffFCBorderVector.push_back(parHs[level]->offFC.zOffFC[i]); + } else { + iCellFccBulkVector.push_back(iCellFccAll[i]); + iCellFcfBulkVector.push_back(iCellFcfAll[i]); + xOffFCBulkVector.push_back(parHs[level]->offFC.xOffFC[i]); + yOffFCBulkVector.push_back(parHs[level]->offFC.yOffFC[i]); + zOffFCBulkVector.push_back(parHs[level]->offFC.zOffFC[i]); + } + + // set new sizes and pointers + parHs[level]->intFCBorder.ICellFCC = iCellFccAll; + parHs[level]->intFCBorder.ICellFCF = iCellFcfAll; + parHs[level]->intFCBorder.kFC = (uint)iCellFccBorderVector.size(); + parHs[level]->intFCBulk.kFC = (uint)iCellFccBulkVector.size(); + parHs[level]->intFCBulk.ICellFCC = iCellFccAll + parHs[level]->intFCBorder.kFC; + parHs[level]->intFCBulk.ICellFCF = iCellFcfAll + parHs[level]->intFCBorder.kFC; + parHs[level]->offFCBulk.xOffFC = parHs[level]->offFC.xOffFC + parHs[level]->intFCBorder.kFC; + parHs[level]->offFCBulk.yOffFC = parHs[level]->offFC.yOffFC + parHs[level]->intFCBorder.kFC; + parHs[level]->offFCBulk.zOffFC = parHs[level]->offFC.zOffFC + parHs[level]->intFCBorder.kFC; + + // copy the created vectors to the memory addresses of the old arrays + // this is inefficient :( + for (uint i = 0; i < (uint)iCellFccBorderVector.size(); i++) { + iCellFccAll[i] = iCellFccBorderVector[i]; + iCellFcfAll[i] = iCellFcfBorderVector[i]; + parHs[level]->offFC.xOffFC[i] = xOffFCBorderVector[i]; + parHs[level]->offFC.yOffFC[i] = yOffFCBorderVector[i]; + parHs[level]->offFC.zOffFC[i] = zOffFCBorderVector[i]; + } + for (uint i = 0; i < (uint)iCellFccBulkVector.size(); i++) { + parHs[level]->intFCBulk.ICellFCC[i] = iCellFccBulkVector[i]; + parHs[level]->intFCBulk.ICellFCF[i] = iCellFcfBulkVector[i]; + parHs[level]->offFCBulk.xOffFC[i] = xOffFCBulkVector[i]; + parHs[level]->offFCBulk.yOffFC[i] = yOffFCBulkVector[i]; + parHs[level]->offFCBulk.zOffFC[i] = zOffFCBulkVector[i]; + } +} + +void InterpolationCellGrouper::splitCoarseToFineIntoBorderAndBulk(uint level) const +{ + this->reorderCoarseToFineIntoBorderAndBulk(level); + + parDs[level]->intCFBorder.kCF = parHs[level]->intCFBorder.kCF; + parDs[level]->intCFBulk.kCF = parHs[level]->intCFBulk.kCF; + parDs[level]->intCFBorder.ICellCFC = parDs[level]->intCF.ICellCFC; + parDs[level]->intCFBulk.ICellCFC = parDs[level]->intCFBorder.ICellCFC + parDs[level]->intCFBorder.kCF; + parDs[level]->intCFBorder.ICellCFF = parDs[level]->intCF.ICellCFF; + parDs[level]->intCFBulk.ICellCFF = parDs[level]->intCFBorder.ICellCFF + parDs[level]->intCFBorder.kCF; + parDs[level]->offCFBulk.xOffCF = parDs[level]->offCF.xOffCF + parDs[level]->intCFBorder.kCF; + parDs[level]->offCFBulk.yOffCF = parDs[level]->offCF.yOffCF + parDs[level]->intCFBorder.kCF; + parDs[level]->offCFBulk.zOffCF = parDs[level]->offCF.zOffCF + parDs[level]->intCFBorder.kCF; +} + +void InterpolationCellGrouper::reorderCoarseToFineIntoBorderAndBulk(uint level) const +{ + // create some local variables for better readability + uint *iCellCfcAll = parHs[level]->intCF.ICellCFC; + uint *iCellCffAll = parHs[level]->intCF.ICellCFF; + uint *neighborX = this->parHs[level]->neighborX; + uint *neighborY = this->parHs[level]->neighborY; + uint *neighborZ = this->parHs[level]->neighborZ; + auto grid = this->builder->getGrid(level); + + std::vector<uint> iCellCfcBorderVector; + std::vector<uint> iCellCfcBulkVector; + std::vector<uint> iCellCffBorderVector; + std::vector<uint> iCellCffBulkVector; + std::vector<real> xOffCFBorderVector; + std::vector<real> yOffCFBorderVector; + std::vector<real> zOffCFBorderVector; + std::vector<real> xOffCFBulkVector; + std::vector<real> yOffCFBulkVector; + std::vector<real> zOffCFBulkVector; + uint sparseIndexOfICellBSW; + + // fill border and bulk vectors with iCellCFs + for (uint i = 0; i < parHs[level]->intCF.kCF; i++) { + sparseIndexOfICellBSW = iCellCfcAll[i]; + + if (grid->isSparseIndexInFluidNodeIndicesBorder(sparseIndexOfICellBSW) || + grid->isSparseIndexInFluidNodeIndicesBorder(neighborX[sparseIndexOfICellBSW]) || + grid->isSparseIndexInFluidNodeIndicesBorder(neighborY[sparseIndexOfICellBSW]) || + grid->isSparseIndexInFluidNodeIndicesBorder(neighborZ[sparseIndexOfICellBSW]) || + grid->isSparseIndexInFluidNodeIndicesBorder(neighborY[neighborX[sparseIndexOfICellBSW]]) || + grid->isSparseIndexInFluidNodeIndicesBorder(neighborZ[neighborX[sparseIndexOfICellBSW]]) || + grid->isSparseIndexInFluidNodeIndicesBorder(neighborZ[neighborY[sparseIndexOfICellBSW]]) || + grid->isSparseIndexInFluidNodeIndicesBorder(neighborZ[neighborY[neighborX[sparseIndexOfICellBSW]]])) { + + iCellCfcBorderVector.push_back(iCellCfcAll[i]); + iCellCffBorderVector.push_back(iCellCffAll[i]); + xOffCFBorderVector.push_back(parHs[level]->offCF.xOffCF[i]); + yOffCFBorderVector.push_back(parHs[level]->offCF.yOffCF[i]); + zOffCFBorderVector.push_back(parHs[level]->offCF.zOffCF[i]); + } else { + iCellCfcBulkVector.push_back(iCellCfcAll[i]); + iCellCffBulkVector.push_back(iCellCffAll[i]); + xOffCFBulkVector.push_back(parHs[level]->offCF.xOffCF[i]); + yOffCFBulkVector.push_back(parHs[level]->offCF.yOffCF[i]); + zOffCFBulkVector.push_back(parHs[level]->offCF.zOffCF[i]); + } + } + + // set new sizes and pointers + parHs[level]->intCFBorder.ICellCFC = parHs[level]->intCF.ICellCFC; + parHs[level]->intCFBorder.ICellCFF = parHs[level]->intCF.ICellCFF; + parHs[level]->intCFBorder.kCF = (uint)iCellCfcBorderVector.size(); + parHs[level]->intCFBulk.kCF = (uint)iCellCfcBulkVector.size(); + parHs[level]->intCFBulk.ICellCFC = parHs[level]->intCF.ICellCFC + parHs[level]->intCFBorder.kCF; + parHs[level]->intCFBulk.ICellCFF = parHs[level]->intCF.ICellCFF + parHs[level]->intCFBorder.kCF; + parHs[level]->offCFBulk.xOffCF = parHs[level]->offCF.xOffCF + parHs[level]->intCFBorder.kCF; + parHs[level]->offCFBulk.yOffCF = parHs[level]->offCF.yOffCF + parHs[level]->intCFBorder.kCF; + parHs[level]->offCFBulk.zOffCF = parHs[level]->offCF.zOffCF + parHs[level]->intCFBorder.kCF; + + // copy the created vectors to the memory addresses of the old arrays + // this is inefficient :( + for (uint i = 0; i < (uint)iCellCfcBorderVector.size(); i++) { + parHs[level]->intCFBorder.ICellCFC[i] = iCellCfcBorderVector[i]; + parHs[level]->intCFBorder.ICellCFF[i] = iCellCffBorderVector[i]; + parHs[level]->offCF.xOffCF[i] = xOffCFBorderVector[i]; + parHs[level]->offCF.yOffCF[i] = yOffCFBorderVector[i]; + parHs[level]->offCF.zOffCF[i] = zOffCFBorderVector[i]; + } + for (uint i = 0; i < (uint)iCellCfcBulkVector.size(); i++) { + parHs[level]->intCFBulk.ICellCFC[i] = iCellCfcBulkVector[i]; + parHs[level]->intCFBulk.ICellCFF[i] = iCellCffBulkVector[i]; + parHs[level]->offCFBulk.xOffCF[i] = xOffCFBulkVector[i]; + parHs[level]->offCFBulk.yOffCF[i] = yOffCFBulkVector[i]; + parHs[level]->offCFBulk.zOffCF[i] = zOffCFBulkVector[i]; + } +} diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/InterpolationCellGrouper.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/InterpolationCellGrouper.h new file mode 100644 index 0000000000000000000000000000000000000000..5471194f643e044a7c2cdca1db45017b9d3a1022 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/InterpolationCellGrouper.h @@ -0,0 +1,74 @@ +//! \file InterpolationCellGrouper.h +//! \ingroup GPU +//! \author Anna Wellmann +//! \details See [master thesis of Anna Wellmann] + +#ifndef InterpolationCellGrouper_H +#define InterpolationCellGrouper_H + +#include <basics/Core/DataTypes.h> +#include <basics/PointerDefinitions.h> +#include <memory> +#include <vector> + +struct LBMSimulationParameter; +class GridBuilder; + +using LBMSimulationParameters = std::vector<std::shared_ptr<LBMSimulationParameter>>; + +class InterpolationCellGrouper { +public: + //! \brief Construct InterpolationCellGrouper object + InterpolationCellGrouper(const LBMSimulationParameters &parHs, const LBMSimulationParameters &parDs, + SPtr<GridBuilder> builder); + + ////////////////////////////////////////////////////////////////////////// + // split interpolation cells + ////////////////////////////////////////////////////////////////////////// + + //! \brief Split the interpolation cells from coarse to fine into border an bulk + //! \details For communication hiding, the interpolation cells from the coarse to the fine grid need to be split + //! into two groups: + //! + //! - cells which are at the border between two gpus --> "border" + //! + //! - the other cells which are not directly related to the communication between the two gpus --> "bulk" + //! + //! see [master thesis of Anna Wellmann (p. 62-68: "Überdeckung der reduzierten Kommunikation")] + void splitCoarseToFineIntoBorderAndBulk(uint level) const; + + //! \brief Split the interpolation cells from fine to coarse into border an bulk + //! \details For communication hiding, the interpolation cells from the fine to the coarse grid need to be split + //! into two groups: + //! + //! - cells which are at the border between two gpus --> "border" + //! + //! - the other cells which are not directly related to the communication between the two gpus --> "bulk" + //! + //! See [master thesis of Anna Wellmann (p. 62-68: "Überdeckung der reduzierten Kommunikation")] + void splitFineToCoarseIntoBorderAndBulk(uint level) const; + +protected: + ////////////////////////////////////////////////////////////////////////// + // split interpolation cells + ////////////////////////////////////////////////////////////////////////// + + //! \brief This function reorders the arrays of CFC/CFF indices and sets the pointers and sizes of the new + //! subarrays: \details The coarse cells for interpolation from coarse to fine (iCellCFC) are divided into two + //! subgroups: border and bulk. The fine cells (iCellCFF) are reordered accordingly. The offset cells (xOffCF, + //! yOffCF, zOffCF) must be reordered in the same way. + void reorderCoarseToFineIntoBorderAndBulk(uint level) const; + + //! \brief This function reorders the arrays of FCC/FCF indices and return pointers and sizes of the new subarrays: + //! \details The coarse cells for interpolation from fine to coarse (iCellFCC) are divided into two subgroups: + //! border and bulk. The fine cells (iCellFCF) are reordered accordingly. The offset cells (xOffFC, + //! yOffFC, zOffFC) must be reordered in the same way. + void reorderFineToCoarseIntoBorderAndBulk(uint level) const; + +private: + SPtr<GridBuilder> builder; + const LBMSimulationParameters &parHs; + const LBMSimulationParameters &parDs; +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/InterpolationCellGrouperTest.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/InterpolationCellGrouperTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..664552b2f47542cc6ae3d4940c2b74ede1beff91 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/InterpolationCellGrouperTest.cpp @@ -0,0 +1,251 @@ +#include <gmock/gmock.h> +#include "Utilities/testUtilitiesGPU.h" + +#include <iostream> + +#include "DataStructureInitializer/GridReaderGenerator/InterpolationCellGrouper.h" +#include "Parameter/Parameter.h" +#include "gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h" +#include "gpu/GridGenerator/grid/GridImp.h" + +template <typename T> +bool vectorsAreEqual(const T * vector1, const std::vector<T>& vectorExpected) +{ + for (uint i = 0; i < vectorExpected.size(); i++) { + if (vector1[i] != vectorExpected[i]) + return false; + } + return true; +} + +class LevelGridBuilderDouble : public LevelGridBuilder +{ +private: + SPtr<Grid> grid; + LevelGridBuilderDouble() = default; + +public: + explicit LevelGridBuilderDouble(SPtr<Grid> grid) : LevelGridBuilder(), grid(grid){}; + SPtr<Grid> getGrid(uint) override + { + return grid; + }; +}; + +class GridImpDouble : public GridImp +{ +private: + std::vector<uint> fluidNodeIndicesBorder; + +public: + GridImpDouble(Object *object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, + Distribution d, uint level) + : GridImp(object, startX, startY, startZ, endX, endY, endZ, delta, d, level) + { + } + + static SPtr<GridImpDouble> makeShared() + { + SPtr<GridImpDouble> grid(new GridImpDouble(nullptr, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, Distribution(), 1)); + return grid; + } + + void setFluidNodeIndicesBorder(const std::vector<uint>& fluidNodeIndicesBorder) + { + this->fluidNodeIndicesBorder = fluidNodeIndicesBorder; + } + + bool isSparseIndexInFluidNodeIndicesBorder(uint &sparseIndex) const override + { + return std::find(this->fluidNodeIndicesBorder.begin(), this->fluidNodeIndicesBorder.end(), sparseIndex) != + this->fluidNodeIndicesBorder.end(); + } +}; + +struct CFBorderBulk { + // data to work on + std::vector<uint> fluidNodeIndicesBorder = { 10, 11, 12, 13, 14, 15, 16 }; + std::vector<uint> iCellCFC = { 1, 11, 3, 13, 5, 15, 7 }; + std::vector<uint> iCellCFF = { 2, 12, 4, 14, 6, 16, 8 }; + const uint sizeOfICellCf = (uint)iCellCFC.size(); + uint neighborX[17] = { 0u }; + uint neighborY[17] = { 0u }; + uint neighborZ[17] = { 0u }; + const int level = 0; + std::vector<real> offsetCFx = { 1, 11, 3, 13, 5, 15, 7 }; + std::vector<real> offsetCFy = { 101, 111, 103, 113, 105, 115, 107 }; + std::vector<real> offsetCFz = { 1001, 1011, 1003, 1013, 1005, 1015, 1007 }; + + // expected data + std::vector<uint> iCellCfcBorder_expected = { 11, 13, 15 }; + std::vector<uint> iCellCfcBulk_expected = { 1, 3, 5, 7 }; + std::vector<uint> iCellCffBorder_expected = { 12, 14, 16 }; + std::vector<uint> iCellCffBulk_expected = { 2, 4, 6, 8 }; + std::vector<real> offsetCFx_Border_expected = { 11, 13, 15 }; + std::vector<real> offsetCFx_Bulk_expected = { 1, 3, 5, 7 }; + std::vector<real> offsetCFy_Border_expected = { 111, 113, 115 }; + std::vector<real> offsetCFy_Bulk_expected = { 101, 103, 105, 107 }; + std::vector<real> offsetCFz_Border_expected = { 1011, 1013, 1015 }; + std::vector<real> offsetCFz_Bulk_expected = { 1001, 1003, 1005, 1007 }; +}; + +class InterpolationCellGrouperTest_IndicesCFBorderBulkTest : public testing::Test +{ +protected: + CFBorderBulk cf; + SPtr<Parameter> para; + std::unique_ptr<InterpolationCellGrouper> testSubject; + +private: + std::unique_ptr<InterpolationCellGrouper> createTestSubjectCFBorderBulk() + { + SPtr<GridImpDouble> grid = + GridImpDouble::makeShared(); + grid->setFluidNodeIndicesBorder(cf.fluidNodeIndicesBorder); + std::shared_ptr<LevelGridBuilderDouble> builder = std::make_shared<LevelGridBuilderDouble>(grid); + + para = testingVF::createParameterForLevel(cf.level); + para->getParH(cf.level)->intCF.ICellCFC = &(cf.iCellCFC.front()); + para->getParH(cf.level)->intCF.ICellCFF = &(cf.iCellCFF.front()); + para->getParH(cf.level)->neighborX = cf.neighborX; + para->getParH(cf.level)->neighborY = cf.neighborY; + para->getParH(cf.level)->neighborZ = cf.neighborZ; + para->getParH(cf.level)->intCF.kCF = cf.sizeOfICellCf; + para->getParH(cf.level)->offCF.xOffCF = &(cf.offsetCFx.front()); + para->getParH(cf.level)->offCF.yOffCF = &(cf.offsetCFy.front()); + para->getParH(cf.level)->offCF.zOffCF = &(cf.offsetCFz.front()); + + return std::make_unique<InterpolationCellGrouper>(para->getParHallLevels(), para->getParDallLevels(), builder); + }; + + void SetUp() override + { + testSubject = createTestSubjectCFBorderBulk(); + } +}; + +TEST_F(InterpolationCellGrouperTest_IndicesCFBorderBulkTest, splitCoarseToFineIntoBorderAndBulk) +{ + testSubject->splitCoarseToFineIntoBorderAndBulk(cf.level); + + EXPECT_THAT(para->getParH(cf.level)->intCFBorder.kCF + para->getParH(cf.level)->intCFBulk.kCF, + testing::Eq(cf.sizeOfICellCf)) + << "The number of interpolation cells from coarse to fine changed during reordering."; + + // check coarse to fine border (coarse nodes) + EXPECT_THAT(para->getParH(cf.level)->intCFBorder.kCF, testing::Eq((uint)cf.iCellCfcBorder_expected.size())); + EXPECT_TRUE(vectorsAreEqual(para->getParH(cf.level)->intCFBorder.ICellCFC, cf.iCellCfcBorder_expected)) + << "intCFBorder.ICellCFC does not match the expected border vector"; + // check coarse to fine border (fine nodes) + EXPECT_THAT(para->getParH(cf.level)->intCFBorder.kCF, testing::Eq((uint)cf.iCellCffBorder_expected.size())); + EXPECT_TRUE(vectorsAreEqual(para->getParH(cf.level)->intCFBorder.ICellCFF, cf.iCellCffBorder_expected)) + << "intCFBorder.ICellCFF does not match the expected border vector"; + + // check coarse to fine bulk (coarse nodes) + EXPECT_THAT(para->getParH(cf.level)->intCFBulk.kCF, testing::Eq((uint)cf.iCellCfcBulk_expected.size())); + EXPECT_TRUE(vectorsAreEqual(para->getParH(cf.level)->intCFBulk.ICellCFC, cf.iCellCfcBulk_expected)) + << "intCFBulk.ICellCFC does not match the expected bulk vector"; + // check coarse to fine bulk (fine nodes) + EXPECT_THAT(para->getParH(cf.level)->intCFBulk.kCF, testing::Eq((uint)cf.iCellCffBulk_expected.size())); + EXPECT_TRUE(vectorsAreEqual(para->getParH(cf.level)->intCFBulk.ICellCFF, cf.iCellCffBulk_expected)) + << "intCFBulk.ICellCFF does not match the expected bulk vector"; + + // check offset cells + EXPECT_TRUE(vectorsAreEqual(para->getParH(cf.level)->offCF.xOffCF, cf.offsetCFx_Border_expected)); + EXPECT_TRUE(vectorsAreEqual(para->getParH(cf.level)->offCFBulk.xOffCF, cf.offsetCFx_Bulk_expected)); + EXPECT_TRUE(vectorsAreEqual(para->getParH(cf.level)->offCF.yOffCF, cf.offsetCFy_Border_expected)); + EXPECT_TRUE(vectorsAreEqual(para->getParH(cf.level)->offCFBulk.yOffCF, cf.offsetCFy_Bulk_expected)); + EXPECT_TRUE(vectorsAreEqual(para->getParH(cf.level)->offCF.zOffCF, cf.offsetCFz_Border_expected)); + EXPECT_TRUE(vectorsAreEqual(para->getParH(cf.level)->offCFBulk.zOffCF, cf.offsetCFz_Bulk_expected)); +} + +struct FCBorderBulk { + // data to work on + std::vector<uint> fluidNodeIndicesBorder = { 110, 111, 112, 113, 114, 115, 116 }; + std::vector<uint> iCellFCC = { 11, 111, 13, 113, 15, 115, 17 }; + std::vector<uint> iCellFCF = { 12, 112, 14, 114, 16, 116, 18 }; + const uint sizeOfICellFC = (uint)iCellFCC.size(); + const int level = 1; + std::vector<real> offsetFCx = { 11, 111, 13, 113, 15, 115, 17 }; + std::vector<real> offsetFCy = { 1101, 1111, 1103, 1113, 1105, 1115, 1107 }; + std::vector<real> offsetFCz = { 11001, 11011, 11003, 11013, 11005, 11015, 11007 }; + + // expected data + std::vector<uint> iCellFccBorder_expected = { 111, 113, 115 }; + std::vector<uint> iCellFccBulk_expected = { 11, 13, 15, 17 }; + std::vector<uint> iCellFcfBorder_expected = { 112, 114, 116 }; + std::vector<uint> iCellFcfBulk_expected = { 12, 14, 16, 18 }; + std::vector<real> offsetFCx_Border_expected = { 111, 113, 115 }; + std::vector<real> offsetFCx_Bulk_expected = { 11, 13, 15, 17 }; + std::vector<real> offsetFCy_Border_expected = { 1111, 1113, 1115 }; + std::vector<real> offsetFCy_Bulk_expected = { 1101, 1103, 1105, 1107 }; + std::vector<real> offsetFCz_Border_expected = { 11011, 11013, 11015 }; + std::vector<real> offsetFCz_Bulk_expected = { 11001, 11003, 11005, 11007 }; +}; + +class InterpolationCellGrouperTest_IndicesFCBorderBulkTest : public testing::Test +{ +protected: + FCBorderBulk fc; + SPtr<Parameter> para; + std::unique_ptr<InterpolationCellGrouper> testSubject; + +private: + std::unique_ptr<InterpolationCellGrouper> createTestSubjectFCBorderBulk() + { + SPtr<GridImpDouble> grid = + GridImpDouble::makeShared(); + grid->setFluidNodeIndicesBorder(fc.fluidNodeIndicesBorder); + std::shared_ptr<LevelGridBuilderDouble> builder = std::make_shared<LevelGridBuilderDouble>(grid); + + para = testingVF::createParameterForLevel(fc.level); + para->getParH(fc.level)->intFC.ICellFCC = &(fc.iCellFCC.front()); + para->getParH(fc.level)->intFC.ICellFCF = &(fc.iCellFCF.front()); + para->getParH(fc.level)->intFC.kFC = fc.sizeOfICellFC; + para->getParH(fc.level)->offFC.xOffFC = &(fc.offsetFCx.front()); + para->getParH(fc.level)->offFC.yOffFC = &(fc.offsetFCy.front()); + para->getParH(fc.level)->offFC.zOffFC = &(fc.offsetFCz.front()); + + return std::make_unique<InterpolationCellGrouper>(para->getParHallLevels(), para->getParDallLevels(), builder); + }; + + void SetUp() override + { + testSubject = createTestSubjectFCBorderBulk(); + } +}; + +TEST_F(InterpolationCellGrouperTest_IndicesFCBorderBulkTest, splitFineToCoarseIntoBorderAndBulk) +{ + testSubject->splitFineToCoarseIntoBorderAndBulk(fc.level); + + EXPECT_THAT(para->getParH(fc.level)->intFCBorder.kFC + para->getParH(fc.level)->intFCBulk.kFC, + testing::Eq(fc.sizeOfICellFC)) + << "The number of interpolation cells from coarse to fine changed during reordering."; + + // check coarse to fine border (coarse nodes) + EXPECT_THAT(para->getParH(fc.level)->intFCBorder.kFC, testing::Eq((uint)fc.iCellFccBorder_expected.size())); + EXPECT_TRUE(vectorsAreEqual(para->getParH(fc.level)->intFCBorder.ICellFCC, fc.iCellFccBorder_expected)) + << "intFCBorder.ICellFCC does not match the expected border vector"; + // check coarse to fine border (fine nodes) + EXPECT_THAT(para->getParH(fc.level)->intFCBorder.kFC, testing::Eq((uint)fc.iCellFcfBorder_expected.size())); + EXPECT_TRUE(vectorsAreEqual(para->getParH(fc.level)->intFCBorder.ICellFCF, fc.iCellFcfBorder_expected)) + << "intFCBorder.ICellFCF does not match the expected border vector"; + + // check coarse to fine bulk (coarse nodes) + EXPECT_THAT(para->getParH(fc.level)->intFCBulk.kFC, testing::Eq((uint)fc.iCellFccBulk_expected.size())); + EXPECT_TRUE(vectorsAreEqual(para->getParH(fc.level)->intFCBulk.ICellFCC, fc.iCellFccBulk_expected)) + << "intFCBulk.ICellFCC does not match the expected bulk vector"; + // check coarse to fine bulk (fine nodes) + EXPECT_THAT(para->getParH(fc.level)->intFCBulk.kFC, testing::Eq((uint)fc.iCellFcfBulk_expected.size())); + EXPECT_TRUE(vectorsAreEqual(para->getParH(fc.level)->intFCBulk.ICellFCF, fc.iCellFcfBulk_expected)) + << "intFCBulk.ICellFCF does not match the expected bulk vector"; + + // check offset cells + EXPECT_TRUE(vectorsAreEqual(para->getParH(fc.level)->offFC.xOffFC, fc.offsetFCx_Border_expected)); + EXPECT_TRUE(vectorsAreEqual(para->getParH(fc.level)->offFCBulk.xOffFC, fc.offsetFCx_Bulk_expected)); + EXPECT_TRUE(vectorsAreEqual(para->getParH(fc.level)->offFC.yOffFC, fc.offsetFCy_Border_expected)); + EXPECT_TRUE(vectorsAreEqual(para->getParH(fc.level)->offFCBulk.yOffFC, fc.offsetFCy_Bulk_expected)); + EXPECT_TRUE(vectorsAreEqual(para->getParH(fc.level)->offFC.zOffFC, fc.offsetFCz_Border_expected)); + EXPECT_TRUE(vectorsAreEqual(para->getParH(fc.level)->offFCBulk.zOffFC, fc.offsetFCz_Bulk_expected)); +} diff --git a/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.cpp b/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bff054eb174a0f5fa34119deedde6f1c9733d83c --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.cpp @@ -0,0 +1,166 @@ +#include "BoundaryConditionFactory.h" +#include "GPU/GPU_Interface.h" +#include "Parameter/Parameter.h" +#include "grid/BoundaryConditions/BoundaryCondition.h" +#include <variant> + +void BoundaryConditionFactory::setVelocityBoundaryCondition(VelocityBC boundaryConditionType) +{ + this->velocityBoundaryCondition = boundaryConditionType; +} + +void BoundaryConditionFactory::setNoSlipBoundaryCondition(const NoSlipBC boundaryConditionType) +{ + this->noSlipBoundaryCondition = boundaryConditionType; +} + +void BoundaryConditionFactory::setSlipBoundaryCondition(const SlipBC boundaryConditionType) +{ + this->slipBoundaryCondition = boundaryConditionType; +} + +void BoundaryConditionFactory::setPressureBoundaryCondition(const PressureBC boundaryConditionType) +{ + this->pressureBoundaryCondition = boundaryConditionType; +} + +void BoundaryConditionFactory::setGeometryBoundaryCondition( + const std::variant<VelocityBC, NoSlipBC, SlipBC> boundaryConditionType) +{ + this->geometryBoundaryCondition = boundaryConditionType; +} + +void BoundaryConditionFactory::setStressBoundaryCondition(const StressBC boundaryConditionType) +{ + this->stressBoundaryCondition = boundaryConditionType; +} + +boundaryCondition BoundaryConditionFactory::getVelocityBoundaryConditionPost(bool isGeometryBC) const +{ + const VelocityBC &boundaryCondition = + isGeometryBC ? std::get<VelocityBC>(this->geometryBoundaryCondition) : this->velocityBoundaryCondition; + + // for descriptions of the boundary conditions refer to the header + switch (boundaryCondition) { + case VelocityBC::VelocitySimpleBounceBackCompressible: + return QVelDevicePlainBB27; + break; + case VelocityBC::VelocityIncompressible: + return QVelDev27; + break; + case VelocityBC::VelocityCompressible: + return QVelDevComp27; + break; + case VelocityBC::VelocityAndPressureCompressible: + return QVelDevCompZeroPress27; + break; + default: + return nullptr; + } +} + +boundaryCondition BoundaryConditionFactory::getNoSlipBoundaryConditionPost(bool isGeometryBC) const +{ + const NoSlipBC &boundaryCondition = + isGeometryBC ? std::get<NoSlipBC>(this->geometryBoundaryCondition) : this->noSlipBoundaryCondition; + + // for descriptions of the boundary conditions refer to the header + switch (boundaryCondition) { + case NoSlipBC::NoSlipImplicitBounceBack: + return [](LBMSimulationParameter *, QforBoundaryConditions *) {}; + break; + case NoSlipBC::NoSlipBounceBack: + return BBDev27; + break; + case NoSlipBC::NoSlipIncompressible: + return QDev27; + break; + case NoSlipBC::NoSlipCompressible: + return QDevComp27; + break; + case NoSlipBC::NoSlip3rdMomentsCompressible: + return QDev3rdMomentsComp27; + break; + default: + return nullptr; + } +} + +boundaryCondition BoundaryConditionFactory::getSlipBoundaryConditionPost(bool isGeometryBC) const +{ + const SlipBC &boundaryCondition = + isGeometryBC ? std::get<SlipBC>(this->geometryBoundaryCondition) : this->slipBoundaryCondition; + + // for descriptions of the boundary conditions refer to the header + switch (boundaryCondition) { + case SlipBC::SlipIncompressible: + return QSlipDev27; + break; + case SlipBC::SlipCompressible: + return QSlipDevComp27; + break; + case SlipBC::SlipBounceBack: + return BBSlipDevComp27; + break; + case SlipBC::SlipCompressibleTurbulentViscosity: + return QSlipDevCompTurbulentViscosity27; + break; + case SlipBC::SlipPressureCompressibleTurbulentViscosity: + return QSlipPressureDevCompTurbulentViscosity27; + break; + default: + return nullptr; + } +} + +boundaryCondition BoundaryConditionFactory::getPressureBoundaryConditionPre() const +{ + // for descriptions of the boundary conditions refer to the header + switch (this->pressureBoundaryCondition) { + case PressureBC::PressureEquilibrium: + return QPressDev27; + break; + case PressureBC::PressureEquilibrium2: + return QPressDevEQZ27; + break; + case PressureBC::PressureNonEquilibriumIncompressible: + return QPressDevIncompNEQ27; + break; + case PressureBC::PressureNonEquilibriumCompressible: + return QPressDevNEQ27; + break; + case PressureBC::OutflowNonReflective: + return QPressNoRhoDev27; + break; + default: + return nullptr; + } +} + +boundaryConditionWithParameter BoundaryConditionFactory::getStressBoundaryConditionPost() const +{ + switch (this->stressBoundaryCondition) { + case StressBC::StressBounceBack: + return BBStressDev27; + break; + case StressBC::StressPressureBounceBack: + return BBStressPressureDev27; + break; + case StressBC::StressCompressible: + return QStressDevComp27; + break; + default: + return nullptr; + } +} + +boundaryCondition BoundaryConditionFactory::getGeometryBoundaryConditionPost() const +{ + if (std::holds_alternative<VelocityBC>(this->geometryBoundaryCondition)) + return this->getVelocityBoundaryConditionPost(true); + else if (std::holds_alternative<NoSlipBC>(this->geometryBoundaryCondition)) + return this->getNoSlipBoundaryConditionPost(true); + else if (std::holds_alternative<SlipBC>(this->geometryBoundaryCondition)) + return this->getSlipBoundaryConditionPost(true); + return nullptr; +} diff --git a/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.h b/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..9d6872c4847be72dff4be7137b774c8082e39e34 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.h @@ -0,0 +1,169 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file BoundaryConditionFactory.h +//! \ingroup Factories +//! \author Anna Wellmann +//======================================================================================= +#ifndef BC_FACTORY +#define BC_FACTORY + +#include <functional> +#include <map> +#include <string> +#include <variant> + +#include "LBM/LB.h" +#include "Parameter/Parameter.h" +#include "gpu/GridGenerator/grid/BoundaryConditions/Side.h" + +struct LBMSimulationParameter; +class Parameter; + +using boundaryCondition = std::function<void(LBMSimulationParameter *, QforBoundaryConditions *)>; +using boundaryConditionWithParameter = std::function<void(Parameter *, QforBoundaryConditions *, const int level)>; + +class BoundaryConditionFactory +{ +public: + //! \brief An enumeration for selecting a velocity boundary condition + enum class VelocityBC { + //! - VelocitySimpleBounceBackCompressible = plain bounce back velocity boundary condition + VelocitySimpleBounceBackCompressible, + //! - VelocityIncompressible = interpolated velocity boundary condition, based on subgrid distances + VelocityIncompressible, + //! - VelocityCompressible = interpolated velocity boundary condition, based on subgrid distances + VelocityCompressible, + //! - VelocityAndPressureCompressible = interpolated velocity boundary condition, based on subgrid distances. + //! Also sets the pressure to the bulk pressure. Can be combined with OutflowNonReflective + VelocityAndPressureCompressible, + //! - NotSpecified = the user did not set a boundary condition + NotSpecified + }; + + //! \brief An enumeration for selecting a no-slip boundary condition + enum class NoSlipBC { + //! - NoSlipImplicitBounceBack = implicit bounce back by Esoteric Twist + NoSlipImplicitBounceBack, + //! - NoSlipBounceBack = bounce back no-slip boundary condition + NoSlipBounceBack, + //! - NoSlipIncompressible = interpolated no-slip boundary condition, based on subgrid distances + NoSlipIncompressible, + //! - NoSlipCompressible = interpolated no-slip boundary condition, based on subgrid distances + NoSlipCompressible, + //! - NoSlipCompressible = interpolated no-slip boundary condition, based on subgrid distances + //! Also uses the third order moments. + NoSlip3rdMomentsCompressible + }; + + //! \brief An enumeration for selecting a slip boundary condition + enum class SlipBC { + //! - SlipIncompressible = interpolated slip boundary condition, based on subgrid distances + SlipIncompressible, + //! - SlipCompressible = interpolated slip boundary condition, based on subgrid distances + SlipCompressible, + //! - SlipBounceBack = simple bounce-back slip boundary condition. + SlipBounceBack, + //! With turbulent viscosity -> para->setUseTurbulentViscosity(true) has to be set to true + SlipCompressibleTurbulentViscosity, + //! With turbulent viscosity -> para->setUseTurbulentViscosity(true) has to be set to true + SlipPressureCompressibleTurbulentViscosity, + //! - NotSpecified = the user did not set a boundary condition + NotSpecified + }; + + //! \brief An enumeration for selecting a pressure boundary condition + enum class PressureBC { + //! - PressureEquilibrium = pressure boundary condition based on equilibrium + PressureEquilibrium, // incorrect pressure :( + //! - PressureEquilibrium2 = pressure boundary condition based on equilibrium (potentially better?! than PressureEquilibrium) + PressureEquilibrium2, // is broken --> nan :( + //! - PressureNonEquilibriumIncompressible = pressure boundary condition based on non-equilibrium + PressureNonEquilibriumIncompressible, + //! - PressureNonEquilibriumCompressible = pressure boundary condition based on non-equilibrium + PressureNonEquilibriumCompressible, + //! - OutflowNonReflective = outflow boundary condition, should be combined with VelocityAndPressureCompressible + OutflowNonReflective, + //! - NotSpecified = the user did not set a boundary condition + NotSpecified + }; + + //! \brief An enumeration for selecting a stress boundary condition + enum class StressBC { + //! - StressCompressible + StressCompressible, + //! - StressBounceBack + StressBounceBack, + //! - StressPressureBounceBack + StressPressureBounceBack, + //! - NotSpecified = the user did not set a boundary condition + NotSpecified + }; + + // enum class OutflowBoundaryCondition {}; // TODO: + // https://git.rz.tu-bs.de/m.schoenherr/VirtualFluids_dev/-/issues/16 + + void setVelocityBoundaryCondition(const BoundaryConditionFactory::VelocityBC boundaryConditionType); + void setNoSlipBoundaryCondition(const BoundaryConditionFactory::NoSlipBC boundaryConditionType); + void setSlipBoundaryCondition(const BoundaryConditionFactory::SlipBC boundaryConditionType); + void setPressureBoundaryCondition(const BoundaryConditionFactory::PressureBC boundaryConditionType); + void setStressBoundaryCondition(const BoundaryConditionFactory::StressBC boundaryConditionType); + //! \brief set a boundary condition for the geometry + //! param boundaryConditionType: a velocity, no-slip or slip boundary condition + //! \details suggestions for boundaryConditionType: + //! + //! - velocity: VelocityIncompressible, VelocityCompressible, VelocityAndPressureCompressible + //! + //! - no-slip: NoSlipBounceBack, NoSlipIncompressible, NoSlipCompressible, NoSlip3rdMomentsCompressible + //! + //! - slip: only use a slip boundary condition which sets the normals + void setGeometryBoundaryCondition(const std::variant<VelocityBC, NoSlipBC, SlipBC> boundaryConditionType); + + // void setOutflowBoundaryCondition(...); // TODO: + // https://git.rz.tu-bs.de/m.schoenherr/VirtualFluids_dev/-/issues/16 + + [[nodiscard]] boundaryCondition getVelocityBoundaryConditionPost(bool isGeometryBC = false) const; + [[nodiscard]] boundaryCondition getNoSlipBoundaryConditionPost(bool isGeometryBC = false) const; + [[nodiscard]] boundaryCondition getSlipBoundaryConditionPost(bool isGeometryBC = false) const; + [[nodiscard]] boundaryCondition getPressureBoundaryConditionPre() const; + [[nodiscard]] boundaryCondition getGeometryBoundaryConditionPost() const; + + [[nodiscard]] boundaryConditionWithParameter getStressBoundaryConditionPost() const; + +private: + VelocityBC velocityBoundaryCondition = VelocityBC::NotSpecified; + NoSlipBC noSlipBoundaryCondition = NoSlipBC::NoSlipImplicitBounceBack; + SlipBC slipBoundaryCondition = SlipBC::NotSpecified; + PressureBC pressureBoundaryCondition = PressureBC::NotSpecified; + std::variant<VelocityBC, NoSlipBC, SlipBC> geometryBoundaryCondition = NoSlipBC::NoSlipImplicitBounceBack; + StressBC stressBoundaryCondition = StressBC::NotSpecified; + + // OutflowBoundaryConditon outflowBC // TODO: https://git.rz.tu-bs.de/m.schoenherr/VirtualFluids_dev/-/issues/16 +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactoryTest.cpp b/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactoryTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..14d01d6df3334d767d97e8db87b7e2a9964022e3 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactoryTest.cpp @@ -0,0 +1,238 @@ +#include <gmock/gmock.h> +#include <typeindex> + +#include "BoundaryConditionFactory.h" +#include "GPU/GPU_Interface.h" +#include "gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h" + +using bcFunction = void (*)(LBMSimulationParameter *, QforBoundaryConditions *); +using bcFunctionParamter = void (*)(Parameter *, QforBoundaryConditions *, const int level); + +// tests for default boundary conditions +TEST(BoundaryConditionFactoryTest, defaultVelocityBC) +{ + auto bcFactory = BoundaryConditionFactory(); + auto bc = bcFactory.getVelocityBoundaryConditionPost(); + EXPECT_THAT(bc, testing::Eq(nullptr)); + EXPECT_THROW(bc(nullptr, nullptr), std::bad_function_call); +} + +TEST(BoundaryConditionFactoryTest, defaultNoSlipBC) +{ + auto bcFactory = BoundaryConditionFactory(); + auto bc = bcFactory.getNoSlipBoundaryConditionPost(); + EXPECT_NO_THROW(bc(nullptr, nullptr)); // empty lambda function should not throw +} + +TEST(BoundaryConditionFactoryTest, defaultSlipBC) +{ + auto bcFactory = BoundaryConditionFactory(); + auto bc = bcFactory.getSlipBoundaryConditionPost(); + EXPECT_THAT(bc, testing::Eq(nullptr)); + EXPECT_THROW(bc(nullptr, nullptr), std::bad_function_call); +} + +TEST(BoundaryConditionFactoryTest, defaultPressureBC) +{ + auto bcFactory = BoundaryConditionFactory(); + auto bc = bcFactory.getPressureBoundaryConditionPre(); + EXPECT_THAT(bc, testing::Eq(nullptr)); + EXPECT_THROW(bc(nullptr, nullptr), std::bad_function_call); +} + +TEST(BoundaryConditionFactoryTest, defaultGeometryBC) +{ + auto bcFactory = BoundaryConditionFactory(); + auto bc = bcFactory.getGeometryBoundaryConditionPost(); + EXPECT_NO_THROW(bc(nullptr, nullptr)); // empty lambda function should not throw +} + +TEST(BoundaryConditionFactoryTest, defaultStressBC) +{ + auto bcFactory = BoundaryConditionFactory(); + auto bc = bcFactory.getStressBoundaryConditionPost(); + EXPECT_THAT(bc, testing::Eq(nullptr)); + EXPECT_THROW(bc(nullptr, nullptr, 0), std::bad_function_call); +} + +bcFunction getVelocityBcTarget(BoundaryConditionFactory &bcFactory) +{ + auto bc = bcFactory.getVelocityBoundaryConditionPost(); + void (*bcTarget)(LBMSimulationParameter *, QforBoundaryConditions *) = + (*bc.target<void (*)(LBMSimulationParameter *, QforBoundaryConditions *)>()); + return bcTarget; +} + +// tests for boundary conditions whcih are set by the user (tests both set and get functions) + +TEST(BoundaryConditionFactoryTest, velocityBC) +{ + auto bcFactory = BoundaryConditionFactory(); + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocitySimpleBounceBackCompressible); + EXPECT_TRUE(*(getVelocityBcTarget(bcFactory)) == QVelDevicePlainBB27) + << "The returned boundary condition is not the expected function QVelDevicePlainBB27."; + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityIncompressible); + EXPECT_TRUE(*(getVelocityBcTarget(bcFactory)) == QVelDev27) + << "The returned boundary condition is not the expected function QVelDev27."; + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + EXPECT_TRUE(*(getVelocityBcTarget(bcFactory)) == QVelDevComp27) + << "The returned boundary condition is not the expected function QVelDevComp27."; + + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); + EXPECT_TRUE(*(getVelocityBcTarget(bcFactory)) == QVelDevCompZeroPress27) + << "The returned boundary condition is not the expected function QVelDevCompZeroPress27."; +} + +bcFunction getNoSlipBcTarget(BoundaryConditionFactory &bcFactory) +{ + auto bc = bcFactory.getNoSlipBoundaryConditionPost(); + void (*bcTarget)(LBMSimulationParameter *, QforBoundaryConditions *) = + (*bc.target<void (*)(LBMSimulationParameter *, QforBoundaryConditions *)>()); + return bcTarget; +} + +TEST(BoundaryConditionFactoryTest, noSlipBC) +{ + auto bcFactory = BoundaryConditionFactory(); + + bcFactory.setNoSlipBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipImplicitBounceBack); + auto bc = bcFactory.getNoSlipBoundaryConditionPost(); + EXPECT_NO_THROW(bc(nullptr, nullptr)); // empty lambda function should not throw + + bcFactory.setNoSlipBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipBounceBack); + EXPECT_TRUE( *(getNoSlipBcTarget(bcFactory)) == BBDev27) + << "The returned boundary condition is not the expected function BBDev27."; + + bcFactory.setNoSlipBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipIncompressible); + EXPECT_TRUE( *(getNoSlipBcTarget(bcFactory)) == QDev27) + << "The returned boundary condition is not the expected function QDev27."; + + bcFactory.setNoSlipBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + EXPECT_TRUE( *(getNoSlipBcTarget(bcFactory)) == QDevComp27) + << "The returned boundary condition is not the expected function QDevComp27."; + + bcFactory.setNoSlipBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlip3rdMomentsCompressible); + EXPECT_TRUE( *(getNoSlipBcTarget(bcFactory)) == QDev3rdMomentsComp27) + << "The returned boundary condition is not the expected function BBDev27."; +} + +bcFunction getSlipBcTarget(BoundaryConditionFactory &bcFactory) +{ + auto bc = bcFactory.getSlipBoundaryConditionPost(); + void (*bcTarget)(LBMSimulationParameter *, QforBoundaryConditions *) = + (*bc.target<void (*)(LBMSimulationParameter *, QforBoundaryConditions *)>()); + return bcTarget; +} + +TEST(BoundaryConditionFactoryTest, slipBC) +{ + auto bcFactory = BoundaryConditionFactory(); + + bcFactory.setSlipBoundaryCondition(BoundaryConditionFactory::SlipBC::SlipIncompressible); + EXPECT_TRUE( *(getSlipBcTarget(bcFactory)) == QSlipDev27) + << "The returned boundary condition is not the expected function QSlipDev27."; + + bcFactory.setSlipBoundaryCondition(BoundaryConditionFactory::SlipBC::SlipCompressible); + EXPECT_TRUE( *(getSlipBcTarget(bcFactory)) == QSlipDevComp27) + << "The returned boundary condition is not the expected function QSlipDevComp27."; + + bcFactory.setSlipBoundaryCondition(BoundaryConditionFactory::SlipBC::SlipCompressibleTurbulentViscosity); + EXPECT_TRUE( *(getSlipBcTarget(bcFactory)) == QSlipDevCompTurbulentViscosity27) + << "The returned boundary condition is not the expected function QSlipDevCompTurbulentViscosity27."; +} + +bcFunction getPressureBcTarget(BoundaryConditionFactory &bcFactory) +{ + auto bc = bcFactory.getPressureBoundaryConditionPre(); + void (*bcTarget)(LBMSimulationParameter *, QforBoundaryConditions *) = + (*bc.target<void (*)(LBMSimulationParameter *, QforBoundaryConditions *)>()); + return bcTarget; +} + +TEST(BoundaryConditionFactoryTest, pressureBC) +{ + auto bcFactory = BoundaryConditionFactory(); + + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureEquilibrium); + EXPECT_TRUE( *(getPressureBcTarget(bcFactory)) == QPressDev27) + << "The returned boundary condition is not the expected function QPressDev27."; + + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureEquilibrium2); + EXPECT_TRUE( *(getPressureBcTarget(bcFactory)) == QPressDevEQZ27) + << "The returned boundary condition is not the expected function QPressDevEQZ27."; + + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumIncompressible); + EXPECT_TRUE( *(getPressureBcTarget(bcFactory)) == QPressDevIncompNEQ27) + << "The returned boundary condition is not the expected function QPressDevIncompNEQ27."; + + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); + EXPECT_TRUE( *(getPressureBcTarget(bcFactory)) == QPressDevNEQ27) + << "The returned boundary condition is not the expected function QPressDevNEQ27."; + + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); + EXPECT_TRUE( *(getPressureBcTarget(bcFactory)) == QPressNoRhoDev27) + << "The returned boundary condition is not the expected function QPressNoRhoDev27."; +} + +bcFunction getGeometryBcTarget(BoundaryConditionFactory &bcFactory) +{ + auto bc = bcFactory.getGeometryBoundaryConditionPost(); + void (*bcTarget)(LBMSimulationParameter *, QforBoundaryConditions *) = + (*bc.target<void (*)(LBMSimulationParameter *, QforBoundaryConditions *)>()); + return bcTarget; +} + +TEST(BoundaryConditionFactoryTest, geometryBC) +{ + auto bcFactory = BoundaryConditionFactory(); + + // velocity + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityIncompressible); + EXPECT_TRUE( *(getGeometryBcTarget(bcFactory)) == QVelDev27) + << "The returned boundary condition is not the expected function QVelDev27."; + + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + EXPECT_TRUE( *(getGeometryBcTarget(bcFactory)) == QVelDevComp27) + << "The returned boundary condition is not the expected function QVelDevComp27."; + + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); + EXPECT_TRUE( *(getGeometryBcTarget(bcFactory)) == QVelDevCompZeroPress27) + << "The returned boundary condition is not the expected function QVelDevCompZeroPress27."; + + // no slip + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipImplicitBounceBack); + auto bc = bcFactory.getGeometryBoundaryConditionPost(); + EXPECT_NO_THROW(bc(nullptr, nullptr)); // empty lambda function should not throw + + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipIncompressible); + EXPECT_TRUE( *(getGeometryBcTarget(bcFactory)) == QDev27) + << "The returned boundary condition is not the expected function QDev27."; + + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); + EXPECT_TRUE( *(getGeometryBcTarget(bcFactory)) == QDevComp27) + << "The returned boundary condition is not the expected function QDevComp27."; + + bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlip3rdMomentsCompressible); + EXPECT_TRUE( *(getGeometryBcTarget(bcFactory)) == QDev3rdMomentsComp27) + << "The returned boundary condition is not the expected function QDev3rdMomentsComp27."; +} + +TEST(BoundaryConditionFactoryTest, stressBoundaryConditions) +{ + auto bcFactory = BoundaryConditionFactory(); + + bcFactory.setStressBoundaryCondition(BoundaryConditionFactory::StressBC::StressBounceBack); + auto bc = bcFactory.getStressBoundaryConditionPost(); + auto bcTarget = *bc.target<bcFunctionParamter>(); + EXPECT_TRUE(*bcTarget == BBStressDev27) + << "The returned boundary condition is not the expected function BBStressDev27."; + + bcFactory.setStressBoundaryCondition(BoundaryConditionFactory::StressBC::StressCompressible); + bc = bcFactory.getStressBoundaryConditionPost(); + bcTarget = *bc.target<bcFunctionParamter>(); + EXPECT_TRUE(*bcTarget == QStressDevComp27) + << "The returned boundary condition is not the expected function QStressDevComp27."; +} diff --git a/src/gpu/VirtualFluids_GPU/Factories/GridScalingFactory.cpp b/src/gpu/VirtualFluids_GPU/Factories/GridScalingFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..00a4c79574ce9d8ae372bfe9f7e546c05175bb10 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Factories/GridScalingFactory.cpp @@ -0,0 +1,37 @@ +#include "GridScalingFactory.h" +#include "GPU/GPU_Interface.h" + +void GridScalingFactory::setScalingFactory(const GridScalingFactory::GridScaling gridScalingType) +{ + this->gridScaling = gridScalingType; +} + +gridScalingFC GridScalingFactory::getGridScalingFC() const +{ + // for descriptions of the scaling types refer to the header + switch (gridScaling) { + case GridScaling::ScaleRhoSq: + return ScaleFC_RhoSq_comp_27; + break; + case GridScaling::ScaleCompressible: + return ScaleFC_compressible; + break; + default: + return nullptr; + } +} + +gridScalingCF GridScalingFactory::getGridScalingCF() const +{ + // for descriptions of the scaling types refer to the header + switch (gridScaling) { + case GridScaling::ScaleRhoSq: + return ScaleCF_RhoSq_comp_27; + break; + case GridScaling::ScaleCompressible: + return ScaleCF_compressible; + break; + default: + return nullptr; + } +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Factories/GridScalingFactory.h b/src/gpu/VirtualFluids_GPU/Factories/GridScalingFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..7d7c20c63a01e2dba6a5578c6520c0ab06894b3c --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Factories/GridScalingFactory.h @@ -0,0 +1,69 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file GridScalingFactory.h +//! \ingroup Factories +//! \author Anna Wellmann, Martin Schönherr +//======================================================================================= +#ifndef GS_FACTORY +#define GS_FACTORY + +#include <functional> + +#include "LBM/LB.h" +#include "Parameter/Parameter.h" + +struct LBMSimulationParameter; +class Parameter; +struct CUstream_st; + +using gridScalingFC = std::function<void(LBMSimulationParameter *, LBMSimulationParameter *, ICellFC *, OffFC&, CUstream_st *stream)>; +using gridScalingCF = std::function<void(LBMSimulationParameter *, LBMSimulationParameter *, ICellCF *, OffCF&, CUstream_st *stream)>; + +class GridScalingFactory +{ +public: + //! \brief An enumeration for selecting a scaling function + enum class GridScaling { + //! - ScaleCompressible = basic scaling for compressible fluid flow + ScaleCompressible, + //! - DEPRECATED: ScaleRhoSq = scaling for cumulant kernel rho squared + ScaleRhoSq, + NotSpecified + }; + + void setScalingFactory(const GridScalingFactory::GridScaling gridScalingType); + + [[nodiscard]] gridScalingFC getGridScalingFC() const; + [[nodiscard]] gridScalingCF getGridScalingCF() const; + +private: + GridScaling gridScaling = GridScaling::NotSpecified; +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/FindInterface/FindInterface.h b/src/gpu/VirtualFluids_GPU/FindInterface/FindInterface.h index 0053494d62bf13c2bf87a9f589baef42940865ae..3be49570b33d99f9517796b33934dee1e2f31221 100644 --- a/src/gpu/VirtualFluids_GPU/FindInterface/FindInterface.h +++ b/src/gpu/VirtualFluids_GPU/FindInterface/FindInterface.h @@ -2,10 +2,10 @@ #define FINDINTERFACE_H #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" -extern "C" void interpolation(InterpolationCellCF &intCF, InterpolationCellFC &intFC, +void interpolation(InterpolationCellCF &intCF, InterpolationCellFC &intFC, unsigned int LxCoarse, unsigned int LyCoarse, unsigned int LzCoarse, unsigned int LxFine, unsigned int LyFine, unsigned int LzFine, unsigned int dNx, unsigned int dNy, unsigned int dNz, diff --git a/src/gpu/VirtualFluids_GPU/FindQ/DefineBCs.cpp b/src/gpu/VirtualFluids_GPU/FindQ/DefineBCs.cpp index 9b2635e2aa7fa0a5729f998391298b726df4f882..d36d3f9a58246eb344a90a21709314ade414378c 100644 --- a/src/gpu/VirtualFluids_GPU/FindQ/DefineBCs.cpp +++ b/src/gpu/VirtualFluids_GPU/FindQ/DefineBCs.cpp @@ -1,18 +1,18 @@ #include "FindQ/DefineBCs.h" #include "FindQ/FindQ.h" -void findPressQShip(Parameter* para, CudaMemoryManager* cudaManager) +void findPressQShip(Parameter* para, CudaMemoryManager* cudaMemoryManager) { //x = begin (0) findKforQPressX0(para, para->getCoarse()); - cudaManager->cudaAllocPressX0(para->getCoarse()); + cudaMemoryManager->cudaAllocPressX0(para->getCoarse()); findQPressX0(para, para->getCoarse()); - cudaManager->cudaCopyPressX0(para->getCoarse()); + cudaMemoryManager->cudaCopyPressX0(para->getCoarse()); //x = end (1) findKforQPressX1(para, para->getCoarse()); - cudaManager->cudaAllocPressX1(para->getCoarse()); + cudaMemoryManager->cudaAllocPressX1(para->getCoarse()); findQPressX1(para, para->getCoarse()); - cudaManager->cudaCopyPressX1(para->getCoarse()); + cudaMemoryManager->cudaCopyPressX1(para->getCoarse()); //for (int lev = para->getFine(); lev >= para->getCoarse(); lev--) //{ // findKforQPressX1(para, lev); @@ -25,62 +25,53 @@ void findPressQShip(Parameter* para, CudaMemoryManager* cudaManager) -void findQ27(Parameter* para, CudaMemoryManager* cudaManager) +void findQ27(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for (int lev = para->getFine(); lev >= para->getCoarse(); lev--) { findKforQ(para, lev); + para->getParD(lev)->noSlipBC.numberOfBCnodes = para->getParH(lev)->noSlipBC.numberOfBCnodes; + printf("numberOfBCnodes= %d\n", para->getParH(lev)->noSlipBC.numberOfBCnodes); - para->getParH(lev)->kQ = para->getParH(lev)->QWall.kQ; - para->getParD(lev)->kQ = para->getParH(lev)->QWall.kQ; - para->getParD(lev)->QWall.kQ = para->getParH(lev)->QWall.kQ; - printf("kQ= %d\n", para->getParH(lev)->kQ); - - cudaManager->cudaAllocWallBC(lev); + cudaMemoryManager->cudaAllocNoSlipBC(lev); findQ(para, lev); + para->getParD(lev)->noSlipBC.numberOfBCnodes = para->getParH(lev)->noSlipBC.numberOfBCnodes; + printf("numberOfBCnodes= %d\n", para->getParH(lev)->noSlipBC.numberOfBCnodes); - para->getParH(lev)->kQ = para->getParH(lev)->QWall.kQ; - para->getParD(lev)->kQ = para->getParH(lev)->QWall.kQ; - para->getParD(lev)->QWall.kQ = para->getParH(lev)->QWall.kQ; - printf("kQ= %d\n", para->getParH(lev)->kQ); - - cudaManager->cudaCopyWallBC(lev); + cudaMemoryManager->cudaCopyNoSlipBC(lev); } } -void findBC27(Parameter* para, CudaMemoryManager* cudaManager) -{ - if ( para->getMyID() == 0) +void findBC27(Parameter* para, CudaMemoryManager* cudaMemoryManager) +{ + if ( para->getMyProcessID() == 0) { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Inflow findKforQInflow(para); - para->getParH(para->getCoarse())->kInflowQ = para->getParH(para->getCoarse())->Qinflow.kQ; - para->getParD(para->getCoarse())->kInflowQ = para->getParH(para->getCoarse())->Qinflow.kQ; - printf("kInflowQ= %d\n", para->getParH(para->getCoarse())->kInflowQ); + printf("numberOfVeloBCnodes= %d\n", para->getParH(para->getCoarse())->velocityBC.numberOfBCnodes); - cudaManager->cudaAllocVeloBC(0); //level = 0 + cudaMemoryManager->cudaAllocVeloBC(0); //level = 0 findQInflow(para); - cudaManager->cudaCopyVeloBC(0); //level = 0 + cudaMemoryManager->cudaCopyVeloBC(0); //level = 0 } - //...!!!...next if gets a block comment for a simple test... + // TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 + //...!!!...next if gets a block comment for a simple test... //if ( para->getMyID() == para->getNumprocs() - 1) //{ // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // //Outflow // findKforQOutflow(para); - // para->getParH(para->getCoarse())->kOutflowQ = para->getParH(para->getCoarse())->Qoutflow.kQ; - // para->getParD(para->getCoarse())->kOutflowQ = para->getParH(para->getCoarse())->Qoutflow.kQ; - // printf("kOutflowQ= %d\n", para->getParH(para->getCoarse())->kOutflowQ); + // printf("numberOfOutflowBCnodes= %d\n", para->getParH(para->getCoarse())->outflowBC.numberOfBCnodes); // para->cudaAllocPressBC(); @@ -95,12 +86,12 @@ void findBC27(Parameter* para, CudaMemoryManager* cudaManager) // by ////////////////////////////////////////////////////////////////////////////////////////////// // Maddin Schlaffer ////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //findKforQSchlaff( para->getParH(para->getCoarse())->nx, - // para->getParH(para->getCoarse())->ny, - // para->getParH(para->getCoarse())->gridNX, - // para->getParH(para->getCoarse())->gridNY, - // para->getParH(para->getCoarse())->gridNZ, - // para->getParH(para->getCoarse())->geo, + //findKforQSchlaff( para->getParH(para->getCoarse())->nx, + // para->getParH(para->getCoarse())->ny, + // para->getParH(para->getCoarse())->gridNX, + // para->getParH(para->getCoarse())->gridNY, + // para->getParH(para->getCoarse())->gridNZ, + // para->getParH(para->getCoarse())->geo, // QnH, // QsH, // QeH, @@ -109,9 +100,9 @@ void findBC27(Parameter* para, CudaMemoryManager* cudaManager) //// Allocate Host Memory ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////North - //unsigned int mem_size_N_Q_k = sizeof(int)*QnH.kQ; - //unsigned int mem_size_N_Q_q = sizeof(real)*QnH.kQ; - //kNQ = QnH.kQ; + //unsigned int mem_size_N_Q_k = sizeof(int)*QnH.numberOfBCnodes; + //unsigned int mem_size_N_Q_q = sizeof(real)*QnH.numberOfBCnodes; + //kNQ = QnH.numberOfBCnodes; //printf("kNQ= %d\n",kNQ); //cudaHostMemoryAllocate((void**) &QnH.q27[0], para->getD3Qxx()*mem_size_N_Q_q ); //cudaHostMemoryAllocate((void**) &QnH.k, mem_size_N_Q_k ); @@ -121,9 +112,9 @@ void findBC27(Parameter* para, CudaMemoryManager* cudaManager) //cudaHostMemoryAllocate((void**) &deltaVNH, mem_size_N_Q_q ); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////South - //unsigned int mem_size_S_Q_k = sizeof(int)*QsH.kQ; - //unsigned int mem_size_S_Q_q = sizeof(real)*QsH.kQ; - //kSQ = QsH.kQ; + //unsigned int mem_size_S_Q_k = sizeof(int)*QsH.numberOfBCnodes; + //unsigned int mem_size_S_Q_q = sizeof(real)*QsH.numberOfBCnodes; + //kSQ = QsH.numberOfBCnodes; //printf("kSQ= %d\n",kSQ); //cudaHostMemoryAllocate((void**) &QsH.q27[0], para->getD3Qxx()*mem_size_S_Q_q ); //cudaHostMemoryAllocate((void**) &QsH.k, mem_size_S_Q_k ); @@ -133,9 +124,9 @@ void findBC27(Parameter* para, CudaMemoryManager* cudaManager) //cudaHostMemoryAllocate((void**) &deltaVSH, mem_size_S_Q_q ); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////East - //unsigned int mem_size_E_Q_k = sizeof(int)*QeH.kQ; - //unsigned int mem_size_E_Q_q = sizeof(real)*QeH.kQ; - //kEQ = QeH.kQ; + //unsigned int mem_size_E_Q_k = sizeof(int)*QeH.numberOfBCnodes; + //unsigned int mem_size_E_Q_q = sizeof(real)*QeH.numberOfBCnodes; + //kEQ = QeH.numberOfBCnodes; //printf("kEQ= %d\n",kEQ); //cudaHostMemoryAllocate((void**) &QeH.q27[0], para->getD3Qxx()*mem_size_E_Q_q ); //cudaHostMemoryAllocate((void**) &QeH.k, mem_size_E_Q_k ); @@ -145,9 +136,9 @@ void findBC27(Parameter* para, CudaMemoryManager* cudaManager) //cudaHostMemoryAllocate((void**) &deltaVEH, mem_size_E_Q_q ); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////West - //unsigned int mem_size_W_Q_k = sizeof(int)*QwH.kQ; - //unsigned int mem_size_W_Q_q = sizeof(real)*QwH.kQ; - //kWQ = QwH.kQ; + //unsigned int mem_size_W_Q_k = sizeof(int)*QwH.numberOfBCnodes; + //unsigned int mem_size_W_Q_q = sizeof(real)*QwH.numberOfBCnodes; + //kWQ = QwH.numberOfBCnodes; //printf("kWQ= %d\n",kWQ); //cudaHostMemoryAllocate((void**) &QwH.q27[0], para->getD3Qxx()*mem_size_W_Q_q ); //cudaHostMemoryAllocate((void**) &QwH.k, mem_size_W_Q_k ); @@ -157,13 +148,13 @@ void findBC27(Parameter* para, CudaMemoryManager* cudaManager) //cudaHostMemoryAllocate((void**) &deltaVWH, mem_size_W_Q_q ); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////find inflow Q's on coarse grid - //findQSchlaff( para->getParH(para->getCoarse())->nx, - // para->getParH(para->getCoarse())->ny, - // para->getParH(para->getCoarse())->gridNX, - // para->getParH(para->getCoarse())->gridNY, - // para->getParH(para->getCoarse())->gridNZ, - // para->getParH(para->getCoarse())->geo, - // para->getParH(para->getCoarse())->k, + //findQSchlaff( para->getParH(para->getCoarse())->nx, + // para->getParH(para->getCoarse())->ny, + // para->getParH(para->getCoarse())->gridNX, + // para->getParH(para->getCoarse())->gridNY, + // para->getParH(para->getCoarse())->gridNZ, + // para->getParH(para->getCoarse())->geo, + // para->getParH(para->getCoarse())->k, // kNQ, VxNH, VyNH, VzNH, deltaVNH, QnH.q27[0], QnH, // kSQ, VxSH, VySH, VzSH, deltaVSH, QsH.q27[0], QsH, // kEQ, VxEH, VyEH, VzEH, deltaVEH, QeH.q27[0], QeH, @@ -171,7 +162,7 @@ void findBC27(Parameter* para, CudaMemoryManager* cudaManager) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Allocate Device Memory ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////North + ////North //cudaMemoryAllocate((void**) &QnD.q27[0], para->getD3Qxx()* mem_size_N_Q_q ); //cudaMemoryAllocate((void**) &QnD.k, mem_size_N_Q_k ); //cudaMemoryAllocate((void**) &VxND, mem_size_N_Q_q ); @@ -205,7 +196,7 @@ void findBC27(Parameter* para, CudaMemoryManager* cudaManager) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Copy Host Memory to Device ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////North + ////North //cudaMemoryCopy(QnD.q27[0], QnH.q27[0], para->getD3Qxx()* mem_size_N_Q_q, cudaMemcpyHostToDevice); //cudaMemoryCopy(QnD.k, QnH.k, mem_size_N_Q_k, cudaMemcpyHostToDevice); //cudaMemoryCopy(VxND, VxNH, mem_size_N_Q_q, cudaMemcpyHostToDevice); diff --git a/src/gpu/VirtualFluids_GPU/FindQ/DefineBCs.h b/src/gpu/VirtualFluids_GPU/FindQ/DefineBCs.h index 261c20a8dc472e36357a71757666e03290268586..045d77f25cab213dfd130fe068f0724b6955bc4d 100644 --- a/src/gpu/VirtualFluids_GPU/FindQ/DefineBCs.h +++ b/src/gpu/VirtualFluids_GPU/FindQ/DefineBCs.h @@ -2,14 +2,14 @@ #define DEFINE_BCS_H #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include "Parameter/Parameter.h" #include "GPU/CudaMemoryManager.h" -extern "C" void findQ27(Parameter* para, CudaMemoryManager* cudaManager); +void findQ27(Parameter* para, CudaMemoryManager* cudaMemoryManager); -extern "C" void findBC27(Parameter* para, CudaMemoryManager* cudaManager); +void findBC27(Parameter* para, CudaMemoryManager* cudaMemoryManager); -extern "C" void findPressQShip(Parameter* para, CudaMemoryManager* cudaManager); +void findPressQShip(Parameter* para, CudaMemoryManager* cudaMemoryManager); #endif diff --git a/src/gpu/VirtualFluids_GPU/FindQ/FindQ.cpp b/src/gpu/VirtualFluids_GPU/FindQ/FindQ.cpp index ee52a7a85550c686a7ab9565812d137ee64ab3e1..19be37ed5324f48627506bb3e2508a9a1b97cf52 100644 --- a/src/gpu/VirtualFluids_GPU/FindQ/FindQ.cpp +++ b/src/gpu/VirtualFluids_GPU/FindQ/FindQ.cpp @@ -1,28 +1,37 @@ #include "FindQ/FindQ.h" +#include "logger/Logger.h" +#include "lbm/constants/D3Q27.h" +using namespace vf::lbm::dir; //////////////////////////////////////////////////////////////////////////////// void findQ(Parameter* para, int lev) { + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + + VF_LOG_CRITICAL("findQ() is deprecated! - see comment above for more information"); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// + ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; real ON[27]; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// unsigned int i, j, k, m, mm, l; - int nx = para->getParH(lev)->nx; - int ny = para->getParH(lev)->ny; + int nx = para->getParH(lev)->nx; + int ny = para->getParH(lev)->ny; unsigned int nnx = para->getParH(lev)->gridNX; unsigned int nny = para->getParH(lev)->gridNY; unsigned int nnz = para->getParH(lev)->gridNZ; int* geo_mat = para->getParH(lev)->geo; unsigned int* kk = para->getParH(para->getCoarse())->k; - unsigned int sizeQ = para->getParH(lev)->kQ; - real* QQ = para->getParH(lev)->QWall.q27[0]; - QforBoundaryConditions &QIN = para->getParH(lev)->QWall; - QIN.kQ = 0; + unsigned int sizeQ = para->getParH(lev)->noSlipBC.numberOfBCnodes; + real* QQ = para->getParH(lev)->noSlipBC.q27[0]; + QforBoundaryConditions &QIN = para->getParH(lev)->noSlipBC; + QIN.numberOfBCnodes = 0; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //int relx, rely, relz; @@ -32,36 +41,36 @@ void findQ(Parameter* para, int lev) //real radius = nny / 5.f;//2.56f; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// QforBoundaryConditions Q; - Q.q27[dirE ] = &QQ[dirE *sizeQ]; - Q.q27[dirW ] = &QQ[dirW *sizeQ]; - Q.q27[dirN ] = &QQ[dirN *sizeQ]; - Q.q27[dirS ] = &QQ[dirS *sizeQ]; - Q.q27[dirT ] = &QQ[dirT *sizeQ]; - Q.q27[dirB ] = &QQ[dirB *sizeQ]; - Q.q27[dirNE ] = &QQ[dirNE *sizeQ]; - Q.q27[dirSW ] = &QQ[dirSW *sizeQ]; - Q.q27[dirSE ] = &QQ[dirSE *sizeQ]; - Q.q27[dirNW ] = &QQ[dirNW *sizeQ]; - Q.q27[dirTE ] = &QQ[dirTE *sizeQ]; - Q.q27[dirBW ] = &QQ[dirBW *sizeQ]; - Q.q27[dirBE ] = &QQ[dirBE *sizeQ]; - Q.q27[dirTW ] = &QQ[dirTW *sizeQ]; - Q.q27[dirTN ] = &QQ[dirTN *sizeQ]; - Q.q27[dirBS ] = &QQ[dirBS *sizeQ]; - Q.q27[dirBN ] = &QQ[dirBN *sizeQ]; - Q.q27[dirTS ] = &QQ[dirTS *sizeQ]; - Q.q27[dirZERO] = &QQ[dirZERO*sizeQ]; - Q.q27[dirTNE ] = &QQ[dirTNE *sizeQ]; - Q.q27[dirTSW ] = &QQ[dirTSW *sizeQ]; - Q.q27[dirTSE ] = &QQ[dirTSE *sizeQ]; - Q.q27[dirTNW ] = &QQ[dirTNW *sizeQ]; - Q.q27[dirBNE ] = &QQ[dirBNE *sizeQ]; - Q.q27[dirBSW ] = &QQ[dirBSW *sizeQ]; - Q.q27[dirBSE ] = &QQ[dirBSE *sizeQ]; - Q.q27[dirBNW ] = &QQ[dirBNW *sizeQ]; + Q.q27[DIR_P00 ] = &QQ[DIR_P00 *sizeQ]; + Q.q27[DIR_M00 ] = &QQ[DIR_M00 *sizeQ]; + Q.q27[DIR_0P0 ] = &QQ[DIR_0P0 *sizeQ]; + Q.q27[DIR_0M0 ] = &QQ[DIR_0M0 *sizeQ]; + Q.q27[DIR_00P ] = &QQ[DIR_00P *sizeQ]; + Q.q27[DIR_00M ] = &QQ[DIR_00M *sizeQ]; + Q.q27[DIR_PP0 ] = &QQ[DIR_PP0 *sizeQ]; + Q.q27[DIR_MM0 ] = &QQ[DIR_MM0 *sizeQ]; + Q.q27[DIR_PM0 ] = &QQ[DIR_PM0 *sizeQ]; + Q.q27[DIR_MP0 ] = &QQ[DIR_MP0 *sizeQ]; + Q.q27[DIR_P0P ] = &QQ[DIR_P0P *sizeQ]; + Q.q27[DIR_M0M ] = &QQ[DIR_M0M *sizeQ]; + Q.q27[DIR_P0M ] = &QQ[DIR_P0M *sizeQ]; + Q.q27[DIR_M0P ] = &QQ[DIR_M0P *sizeQ]; + Q.q27[DIR_0PP ] = &QQ[DIR_0PP *sizeQ]; + Q.q27[DIR_0MM ] = &QQ[DIR_0MM *sizeQ]; + Q.q27[DIR_0PM ] = &QQ[DIR_0PM *sizeQ]; + Q.q27[DIR_0MP ] = &QQ[DIR_0MP *sizeQ]; + Q.q27[DIR_000] = &QQ[DIR_000*sizeQ]; + Q.q27[DIR_PPP ] = &QQ[DIR_PPP *sizeQ]; + Q.q27[DIR_MMP ] = &QQ[DIR_MMP *sizeQ]; + Q.q27[DIR_PMP ] = &QQ[DIR_PMP *sizeQ]; + Q.q27[DIR_MPP ] = &QQ[DIR_MPP *sizeQ]; + Q.q27[DIR_PPM ] = &QQ[DIR_PPM *sizeQ]; + Q.q27[DIR_MMM ] = &QQ[DIR_MMM *sizeQ]; + Q.q27[DIR_PMM ] = &QQ[DIR_PMM *sizeQ]; + Q.q27[DIR_MPM ] = &QQ[DIR_MPM *sizeQ]; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// for(k=STARTOFFZ + 1 ; k<=nnz+STARTOFFZ-2 ; k++){ - for(j=STARTOFFY + 1 ; j<=nny+STARTOFFY-2 ; j++){ //j<=nny/2+STARTOFFY //j<=STARTOFFY+1 + for(j=STARTOFFY + 1 ; j<=nny+STARTOFFY-2 ; j++){ //j<=nny/2+STARTOFFY //j<=STARTOFFY+1 for(i=STARTOFFX + 1; i<=nnx+STARTOFFX-2 ; i++){ m = nx*(ny*k + j) + i; if(geo_mat[m]==GEO_FLUID){ @@ -73,8 +82,8 @@ void findQ(Parameter* para, int lev) mm = nx*(ny*(k+ez[l]) + (j+ey[l])) + (i+ex[l]); if((geo_mat[mm] == GEO_SOLID) || (geo_mat[mm] == GEO_VOID)){ //ON[l] = -(((real)ex[l]*(real)relx + (real)ey[l]*(real)rely + (real)ez[l]*(real)relz +/*+/- Achtung, innen und aussen nicht verwechseln!!*/ - // sqrt(pow((real)ex[l]*(real)relx + (real)ey[l]*(real)rely + (real)ez[l]*(real)relz,2) + - // (pow((real)ex[l],2) + pow((real)ey[l],2) + pow((real)ez[l],2))* (pow(radius,2) - + // sqrt(pow((real)ex[l]*(real)relx + (real)ey[l]*(real)rely + (real)ez[l]*(real)relz,2) + + // (pow((real)ex[l],2) + pow((real)ey[l],2) + pow((real)ez[l],2))* (pow(radius,2) - // pow((real)relx,2) - pow((real)rely,2) - pow((real)relz,2)))) // /(pow((real)ex[l],2) + pow((real)ey[l],2) + pow((real)ez[l],2))); ON[l] = (real)0.5f;//1.0f; @@ -86,95 +95,95 @@ void findQ(Parameter* para, int lev) } if (ON[18]==(real)1.f) { - QIN.k[QIN.kQ] = kk[m]; - - //Q.q27[dirE ][QIN.kQ] = -1.f; - //Q.q27[dirW ][QIN.kQ] = -1.f; - //Q.q27[dirN ][QIN.kQ] = 0.f; - //Q.q27[dirS ][QIN.kQ] = -1.f; - //Q.q27[dirT ][QIN.kQ] = -1.f; - //Q.q27[dirB ][QIN.kQ] = -1.f; - //Q.q27[dirNE ][QIN.kQ] = 0.f; - //Q.q27[dirSW ][QIN.kQ] = -1.f; - //Q.q27[dirSE ][QIN.kQ] = -1.f; - //Q.q27[dirNW ][QIN.kQ] = 0.f; - //Q.q27[dirTE ][QIN.kQ] = -1.f; - //Q.q27[dirBW ][QIN.kQ] = -1.f; - //Q.q27[dirBE ][QIN.kQ] = -1.f; - //Q.q27[dirTW ][QIN.kQ] = -1.f; - //Q.q27[dirTN ][QIN.kQ] = 0.f; - //Q.q27[dirBS ][QIN.kQ] = -1.f; - //Q.q27[dirBN ][QIN.kQ] = 0.f; - //Q.q27[dirTS ][QIN.kQ] = -1.f; - //Q.q27[dirZERO][QIN.kQ] = -1.f; - //Q.q27[dirTNE ][QIN.kQ] = 0.f; - //Q.q27[dirTSW ][QIN.kQ] = -1.f; - //Q.q27[dirTSE ][QIN.kQ] = -1.f; - //Q.q27[dirTNW ][QIN.kQ] = 0.f; - //Q.q27[dirBNE ][QIN.kQ] = 0.f; - //Q.q27[dirBSW ][QIN.kQ] = -1.f; - //Q.q27[dirBSE ][QIN.kQ] = -1.f; - //Q.q27[dirBNW ][QIN.kQ] = 0.f; - - //Q.q27[dirE ][QIN.kQ] = ON[dirW ]; - //Q.q27[dirW ][QIN.kQ] = ON[dirE ]; - //Q.q27[dirN ][QIN.kQ] = ON[dirS ]; - //Q.q27[dirS ][QIN.kQ] = ON[dirN ]; - //Q.q27[dirT ][QIN.kQ] = ON[dirB ]; - //Q.q27[dirB ][QIN.kQ] = ON[dirT ]; - //Q.q27[dirNE ][QIN.kQ] = ON[dirSW ]; - //Q.q27[dirSW ][QIN.kQ] = ON[dirNE ]; - //Q.q27[dirSE ][QIN.kQ] = ON[dirNW ]; - //Q.q27[dirNW ][QIN.kQ] = ON[dirSE ]; - //Q.q27[dirTE ][QIN.kQ] = ON[dirBW ]; - //Q.q27[dirBW ][QIN.kQ] = ON[dirTE ]; - //Q.q27[dirBE ][QIN.kQ] = ON[dirTW ]; - //Q.q27[dirTW ][QIN.kQ] = ON[dirBE ]; - //Q.q27[dirTN ][QIN.kQ] = ON[dirBS ]; - //Q.q27[dirBS ][QIN.kQ] = ON[dirTN ]; - //Q.q27[dirBN ][QIN.kQ] = ON[dirTS ]; - //Q.q27[dirTS ][QIN.kQ] = ON[dirBN ]; - //Q.q27[dirZERO][QIN.kQ] = ON[dirZERO]; - //Q.q27[dirTNE ][QIN.kQ] = ON[dirBSW ]; - //Q.q27[dirTSW ][QIN.kQ] = ON[dirBNE ]; - //Q.q27[dirTSE ][QIN.kQ] = ON[dirBNW ]; - //Q.q27[dirTNW ][QIN.kQ] = ON[dirBSE ]; - //Q.q27[dirBNE ][QIN.kQ] = ON[dirTSW ]; - //Q.q27[dirBSW ][QIN.kQ] = ON[dirTNE ]; - //Q.q27[dirBSE ][QIN.kQ] = ON[dirTNW ]; - //Q.q27[dirBNW ][QIN.kQ] = ON[dirTSE ]; - - Q.q27[dirE ][QIN.kQ] = ON[dirE ]; - Q.q27[dirW ][QIN.kQ] = ON[dirW ]; - Q.q27[dirN ][QIN.kQ] = ON[dirN ]; - Q.q27[dirS ][QIN.kQ] = ON[dirS ]; - Q.q27[dirT ][QIN.kQ] = ON[dirT ]; - Q.q27[dirB ][QIN.kQ] = ON[dirB ]; - Q.q27[dirNE ][QIN.kQ] = ON[dirNE ]; - Q.q27[dirSW ][QIN.kQ] = ON[dirSW ]; - Q.q27[dirSE ][QIN.kQ] = ON[dirSE ]; - Q.q27[dirNW ][QIN.kQ] = ON[dirNW ]; - Q.q27[dirTE ][QIN.kQ] = ON[dirTE ]; - Q.q27[dirBW ][QIN.kQ] = ON[dirBW ]; - Q.q27[dirBE ][QIN.kQ] = ON[dirBE ]; - Q.q27[dirTW ][QIN.kQ] = ON[dirTW ]; - Q.q27[dirTN ][QIN.kQ] = ON[dirTN ]; - Q.q27[dirBS ][QIN.kQ] = ON[dirBS ]; - Q.q27[dirBN ][QIN.kQ] = ON[dirBN ]; - Q.q27[dirTS ][QIN.kQ] = ON[dirTS ]; - Q.q27[dirZERO][QIN.kQ] = ON[dirZERO]; - Q.q27[dirTNE ][QIN.kQ] = ON[dirTNE ]; - Q.q27[dirTSW ][QIN.kQ] = ON[dirTSW ]; - Q.q27[dirTSE ][QIN.kQ] = ON[dirTSE ]; - Q.q27[dirTNW ][QIN.kQ] = ON[dirTNW ]; - Q.q27[dirBNE ][QIN.kQ] = ON[dirBNE ]; - Q.q27[dirBSW ][QIN.kQ] = ON[dirBSW ]; - Q.q27[dirBSE ][QIN.kQ] = ON[dirBSE ]; - Q.q27[dirBNW ][QIN.kQ] = ON[dirBNW ]; - - QIN.kQ++; - } - } + QIN.k[QIN.numberOfBCnodes] = kk[m]; + + //Q.q27[DIR_P00 ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_M00 ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_0P0 ][QIN.numberOfBCnodes] = 0.f; + //Q.q27[DIR_0M0 ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_00P ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_00M ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_PP0 ][QIN.numberOfBCnodes] = 0.f; + //Q.q27[DIR_MM0 ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_PM0 ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_MP0 ][QIN.numberOfBCnodes] = 0.f; + //Q.q27[DIR_P0P ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_M0M ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_P0M ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_M0P ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_0PP ][QIN.numberOfBCnodes] = 0.f; + //Q.q27[DIR_0MM ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_0PM ][QIN.numberOfBCnodes] = 0.f; + //Q.q27[DIR_0MP ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_000][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_PPP ][QIN.numberOfBCnodes] = 0.f; + //Q.q27[DIR_MMP ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_PMP ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_MPP ][QIN.numberOfBCnodes] = 0.f; + //Q.q27[DIR_PPM ][QIN.numberOfBCnodes] = 0.f; + //Q.q27[DIR_MMM ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_PMM ][QIN.numberOfBCnodes] = -1.f; + //Q.q27[DIR_MPM ][QIN.numberOfBCnodes] = 0.f; + + //Q.q27[DIR_P00 ][QIN.numberOfBCnodes] = ON[DIR_M00 ]; + //Q.q27[DIR_M00 ][QIN.numberOfBCnodes] = ON[DIR_P00 ]; + //Q.q27[DIR_0P0 ][QIN.numberOfBCnodes] = ON[DIR_0M0 ]; + //Q.q27[DIR_0M0 ][QIN.numberOfBCnodes] = ON[DIR_0P0 ]; + //Q.q27[DIR_00P ][QIN.numberOfBCnodes] = ON[DIR_00M ]; + //Q.q27[DIR_00M ][QIN.numberOfBCnodes] = ON[DIR_00P ]; + //Q.q27[DIR_PP0 ][QIN.numberOfBCnodes] = ON[DIR_MM0 ]; + //Q.q27[DIR_MM0 ][QIN.numberOfBCnodes] = ON[DIR_PP0 ]; + //Q.q27[DIR_PM0 ][QIN.numberOfBCnodes] = ON[DIR_MP0 ]; + //Q.q27[DIR_MP0 ][QIN.numberOfBCnodes] = ON[DIR_PM0 ]; + //Q.q27[DIR_P0P ][QIN.numberOfBCnodes] = ON[DIR_M0M ]; + //Q.q27[DIR_M0M ][QIN.numberOfBCnodes] = ON[DIR_P0P ]; + //Q.q27[DIR_P0M ][QIN.numberOfBCnodes] = ON[DIR_M0P ]; + //Q.q27[DIR_M0P ][QIN.numberOfBCnodes] = ON[DIR_P0M ]; + //Q.q27[DIR_0PP ][QIN.numberOfBCnodes] = ON[DIR_0MM ]; + //Q.q27[DIR_0MM ][QIN.numberOfBCnodes] = ON[DIR_0PP ]; + //Q.q27[DIR_0PM ][QIN.numberOfBCnodes] = ON[DIR_0MP ]; + //Q.q27[DIR_0MP ][QIN.numberOfBCnodes] = ON[DIR_0PM ]; + //Q.q27[DIR_000][QIN.numberOfBCnodes] = ON[DIR_000]; + //Q.q27[DIR_PPP ][QIN.numberOfBCnodes] = ON[DIR_MMM ]; + //Q.q27[DIR_MMP ][QIN.numberOfBCnodes] = ON[DIR_PPM ]; + //Q.q27[DIR_PMP ][QIN.numberOfBCnodes] = ON[DIR_MPM ]; + //Q.q27[DIR_MPP ][QIN.numberOfBCnodes] = ON[DIR_PMM ]; + //Q.q27[DIR_PPM ][QIN.numberOfBCnodes] = ON[DIR_MMP ]; + //Q.q27[DIR_MMM ][QIN.numberOfBCnodes] = ON[DIR_PPP ]; + //Q.q27[DIR_PMM ][QIN.numberOfBCnodes] = ON[DIR_MPP ]; + //Q.q27[DIR_MPM ][QIN.numberOfBCnodes] = ON[DIR_PMP ]; + + Q.q27[DIR_P00 ][QIN.numberOfBCnodes] = ON[DIR_P00 ]; + Q.q27[DIR_M00 ][QIN.numberOfBCnodes] = ON[DIR_M00 ]; + Q.q27[DIR_0P0 ][QIN.numberOfBCnodes] = ON[DIR_0P0 ]; + Q.q27[DIR_0M0 ][QIN.numberOfBCnodes] = ON[DIR_0M0 ]; + Q.q27[DIR_00P ][QIN.numberOfBCnodes] = ON[DIR_00P ]; + Q.q27[DIR_00M ][QIN.numberOfBCnodes] = ON[DIR_00M ]; + Q.q27[DIR_PP0 ][QIN.numberOfBCnodes] = ON[DIR_PP0 ]; + Q.q27[DIR_MM0 ][QIN.numberOfBCnodes] = ON[DIR_MM0 ]; + Q.q27[DIR_PM0 ][QIN.numberOfBCnodes] = ON[DIR_PM0 ]; + Q.q27[DIR_MP0 ][QIN.numberOfBCnodes] = ON[DIR_MP0 ]; + Q.q27[DIR_P0P ][QIN.numberOfBCnodes] = ON[DIR_P0P ]; + Q.q27[DIR_M0M ][QIN.numberOfBCnodes] = ON[DIR_M0M ]; + Q.q27[DIR_P0M ][QIN.numberOfBCnodes] = ON[DIR_P0M ]; + Q.q27[DIR_M0P ][QIN.numberOfBCnodes] = ON[DIR_M0P ]; + Q.q27[DIR_0PP ][QIN.numberOfBCnodes] = ON[DIR_0PP ]; + Q.q27[DIR_0MM ][QIN.numberOfBCnodes] = ON[DIR_0MM ]; + Q.q27[DIR_0PM ][QIN.numberOfBCnodes] = ON[DIR_0PM ]; + Q.q27[DIR_0MP ][QIN.numberOfBCnodes] = ON[DIR_0MP ]; + Q.q27[DIR_000][QIN.numberOfBCnodes] = ON[DIR_000]; + Q.q27[DIR_PPP ][QIN.numberOfBCnodes] = ON[DIR_PPP ]; + Q.q27[DIR_MMP ][QIN.numberOfBCnodes] = ON[DIR_MMP ]; + Q.q27[DIR_PMP ][QIN.numberOfBCnodes] = ON[DIR_PMP ]; + Q.q27[DIR_MPP ][QIN.numberOfBCnodes] = ON[DIR_MPP ]; + Q.q27[DIR_PPM ][QIN.numberOfBCnodes] = ON[DIR_PPM ]; + Q.q27[DIR_MMM ][QIN.numberOfBCnodes] = ON[DIR_MMM ]; + Q.q27[DIR_PMM ][QIN.numberOfBCnodes] = ON[DIR_PMM ]; + Q.q27[DIR_MPM ][QIN.numberOfBCnodes] = ON[DIR_MPM ]; + + QIN.numberOfBCnodes++; + } + } } } } @@ -183,8 +192,14 @@ void findQ(Parameter* para, int lev) //////////////////////////////////////////////////////////////////////////////// void findKforQ(Parameter* para, int lev) { + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + + VF_LOG_CRITICAL("findKforQ() is deprecated! - see comment above for more information"); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// + ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; @@ -192,14 +207,14 @@ void findKforQ(Parameter* para, int lev) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// unsigned int i, j, k, m, mm, l; real test = (real)0.f; - int nx = para->getParH(lev)->nx; - int ny = para->getParH(lev)->ny; + int nx = para->getParH(lev)->nx; + int ny = para->getParH(lev)->ny; unsigned int nnx = para->getParH(lev)->gridNX; unsigned int nny = para->getParH(lev)->gridNY; unsigned int nnz = para->getParH(lev)->gridNZ; - int* geo_mat = para->getParH(lev)->geo; - QforBoundaryConditions &QIN = para->getParH(lev)->QWall; - QIN.kQ = 0; + int* geo_mat = para->getParH(lev)->geo; + QforBoundaryConditions &QIN = para->getParH(lev)->noSlipBC; + QIN.numberOfBCnodes = 0; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// for(k=STARTOFFZ + 1 ; k<=nnz+STARTOFFZ-2 ; k++){ @@ -211,7 +226,7 @@ void findKforQ(Parameter* para, int lev) for(l=0;l<=26;l++){ mm = nx*(ny*(k+ez[l]) + (j+ey[l])) + (i+ex[l]); if((geo_mat[mm] == GEO_SOLID) || (geo_mat[mm] == GEO_VOID)){ - ON[l] =(real) 1.f; + ON[l] =(real) 1.f; } else{ ON[l] = (real)0.f; @@ -220,9 +235,9 @@ void findKforQ(Parameter* para, int lev) } if (test>0) { - QIN.kQ++; - } - } + QIN.numberOfBCnodes++; + } + } } } } @@ -232,36 +247,42 @@ void findKforQ(Parameter* para, int lev) void findQ_MG( int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, unsigned int* kk, unsigned int sizeQ, real* QQ, QforBoundaryConditions &QIN) { QforBoundaryConditions Q; - Q.q27[dirE ] = &QQ[dirE *sizeQ]; - Q.q27[dirW ] = &QQ[dirW *sizeQ]; - Q.q27[dirN ] = &QQ[dirN *sizeQ]; - Q.q27[dirS ] = &QQ[dirS *sizeQ]; - Q.q27[dirT ] = &QQ[dirT *sizeQ]; - Q.q27[dirB ] = &QQ[dirB *sizeQ]; - Q.q27[dirNE ] = &QQ[dirNE *sizeQ]; - Q.q27[dirSW ] = &QQ[dirSW *sizeQ]; - Q.q27[dirSE ] = &QQ[dirSE *sizeQ]; - Q.q27[dirNW ] = &QQ[dirNW *sizeQ]; - Q.q27[dirTE ] = &QQ[dirTE *sizeQ]; - Q.q27[dirBW ] = &QQ[dirBW *sizeQ]; - Q.q27[dirBE ] = &QQ[dirBE *sizeQ]; - Q.q27[dirTW ] = &QQ[dirTW *sizeQ]; - Q.q27[dirTN ] = &QQ[dirTN *sizeQ]; - Q.q27[dirBS ] = &QQ[dirBS *sizeQ]; - Q.q27[dirBN ] = &QQ[dirBN *sizeQ]; - Q.q27[dirTS ] = &QQ[dirTS *sizeQ]; - Q.q27[dirZERO] = &QQ[dirZERO*sizeQ]; - Q.q27[dirTNE ] = &QQ[dirTNE *sizeQ]; - Q.q27[dirTSW ] = &QQ[dirTSW *sizeQ]; - Q.q27[dirTSE ] = &QQ[dirTSE *sizeQ]; - Q.q27[dirTNW ] = &QQ[dirTNW *sizeQ]; - Q.q27[dirBNE ] = &QQ[dirBNE *sizeQ]; - Q.q27[dirBSW ] = &QQ[dirBSW *sizeQ]; - Q.q27[dirBSE ] = &QQ[dirBSE *sizeQ]; - Q.q27[dirBNW ] = &QQ[dirBNW *sizeQ]; + Q.q27[DIR_P00 ] = &QQ[DIR_P00 *sizeQ]; + Q.q27[DIR_M00 ] = &QQ[DIR_M00 *sizeQ]; + Q.q27[DIR_0P0 ] = &QQ[DIR_0P0 *sizeQ]; + Q.q27[DIR_0M0 ] = &QQ[DIR_0M0 *sizeQ]; + Q.q27[DIR_00P ] = &QQ[DIR_00P *sizeQ]; + Q.q27[DIR_00M ] = &QQ[DIR_00M *sizeQ]; + Q.q27[DIR_PP0 ] = &QQ[DIR_PP0 *sizeQ]; + Q.q27[DIR_MM0 ] = &QQ[DIR_MM0 *sizeQ]; + Q.q27[DIR_PM0 ] = &QQ[DIR_PM0 *sizeQ]; + Q.q27[DIR_MP0 ] = &QQ[DIR_MP0 *sizeQ]; + Q.q27[DIR_P0P ] = &QQ[DIR_P0P *sizeQ]; + Q.q27[DIR_M0M ] = &QQ[DIR_M0M *sizeQ]; + Q.q27[DIR_P0M ] = &QQ[DIR_P0M *sizeQ]; + Q.q27[DIR_M0P ] = &QQ[DIR_M0P *sizeQ]; + Q.q27[DIR_0PP ] = &QQ[DIR_0PP *sizeQ]; + Q.q27[DIR_0MM ] = &QQ[DIR_0MM *sizeQ]; + Q.q27[DIR_0PM ] = &QQ[DIR_0PM *sizeQ]; + Q.q27[DIR_0MP ] = &QQ[DIR_0MP *sizeQ]; + Q.q27[DIR_000] = &QQ[DIR_000*sizeQ]; + Q.q27[DIR_PPP ] = &QQ[DIR_PPP *sizeQ]; + Q.q27[DIR_MMP ] = &QQ[DIR_MMP *sizeQ]; + Q.q27[DIR_PMP ] = &QQ[DIR_PMP *sizeQ]; + Q.q27[DIR_MPP ] = &QQ[DIR_MPP *sizeQ]; + Q.q27[DIR_PPM ] = &QQ[DIR_PPM *sizeQ]; + Q.q27[DIR_MMM ] = &QQ[DIR_MMM *sizeQ]; + Q.q27[DIR_PMM ] = &QQ[DIR_PMM *sizeQ]; + Q.q27[DIR_MPM ] = &QQ[DIR_MPM *sizeQ]; + + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + + VF_LOG_CRITICAL("findQ_MG() is deprecated! - see comment above for more information"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// + ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; @@ -276,7 +297,7 @@ void findQ_MG( int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int unsigned int centerZ = nnz / 2; real radius = nny / 2.56f; - QIN.kQ = 0; + QIN.numberOfBCnodes = 0; for(k=STARTOFFZ+2 ; k<=nnz+STARTOFFZ-3 ; k++){ for(j=STARTOFFY+2 ; j<=nny+STARTOFFY-3 ; j++){ @@ -290,10 +311,10 @@ void findQ_MG( int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int for(l=0;l<=26;l++){ mm = nx*(ny*(k+ez[l]) + (j+ey[l])) + (i+ex[l]); if(geo_mat[mm] == GEO_FLUID){ - ON[l] = -(((real)ex[l]*(real)relx + (real)ey[l]*(real)rely + (real)ez[l]*(real)relz + - sqrt(pow((real)ex[l]*(real)relx + (real)ey[l]*(real)rely + (real)ez[l]*(real)relz,2) + + ON[l] = -(((real)ex[l]*(real)relx + (real)ey[l]*(real)rely + (real)ez[l]*(real)relz + + sqrt(pow((real)ex[l]*(real)relx + (real)ey[l]*(real)rely + (real)ez[l]*(real)relz,2) + (pow((real)ex[l],2) + pow((real)ey[l],2) + pow((real)ez[l],2))* - (pow(radius,2) - pow((real)relx,2) - pow((real)rely,2) - + (pow(radius,2) - pow((real)relx,2) - pow((real)rely,2) - pow((real)relz,2))))/(pow((real)ex[l],2) + pow((real)ey[l],2) + pow((real)ez[l],2))); ON[18] = (real)1.f; //ZERO @@ -304,39 +325,39 @@ void findQ_MG( int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int } if (ON[18]==1.f) { - QIN.k[QIN.kQ] = kk[m]; - - Q.q27[dirE ][QIN.kQ] = ON[dirE ]; - Q.q27[dirW ][QIN.kQ] = ON[dirW ]; - Q.q27[dirN ][QIN.kQ] = ON[dirN ]; - Q.q27[dirS ][QIN.kQ] = ON[dirS ]; - Q.q27[dirT ][QIN.kQ] = ON[dirT ]; - Q.q27[dirB ][QIN.kQ] = ON[dirB ]; - Q.q27[dirNE ][QIN.kQ] = ON[dirNE ]; - Q.q27[dirSW ][QIN.kQ] = ON[dirSW ]; - Q.q27[dirSE ][QIN.kQ] = ON[dirSE ]; - Q.q27[dirNW ][QIN.kQ] = ON[dirNW ]; - Q.q27[dirTE ][QIN.kQ] = ON[dirTE ]; - Q.q27[dirBW ][QIN.kQ] = ON[dirBW ]; - Q.q27[dirBE ][QIN.kQ] = ON[dirBE ]; - Q.q27[dirTW ][QIN.kQ] = ON[dirTW ]; - Q.q27[dirTN ][QIN.kQ] = ON[dirTN ]; - Q.q27[dirBS ][QIN.kQ] = ON[dirBS ]; - Q.q27[dirBN ][QIN.kQ] = ON[dirBN ]; - Q.q27[dirTS ][QIN.kQ] = ON[dirTS ]; - Q.q27[dirZERO][QIN.kQ] = ON[dirZERO]; - Q.q27[dirTNE ][QIN.kQ] = ON[dirTNE ]; - Q.q27[dirTSW ][QIN.kQ] = ON[dirTSW ]; - Q.q27[dirTSE ][QIN.kQ] = ON[dirTSE ]; - Q.q27[dirTNW ][QIN.kQ] = ON[dirTNW ]; - Q.q27[dirBNE ][QIN.kQ] = ON[dirBNE ]; - Q.q27[dirBSW ][QIN.kQ] = ON[dirBSW ]; - Q.q27[dirBSE ][QIN.kQ] = ON[dirBSE ]; - Q.q27[dirBNW ][QIN.kQ] = ON[dirBNW ]; - - QIN.kQ++; - } - } + QIN.k[QIN.numberOfBCnodes] = kk[m]; + + Q.q27[DIR_P00 ][QIN.numberOfBCnodes] = ON[DIR_P00 ]; + Q.q27[DIR_M00 ][QIN.numberOfBCnodes] = ON[DIR_M00 ]; + Q.q27[DIR_0P0 ][QIN.numberOfBCnodes] = ON[DIR_0P0 ]; + Q.q27[DIR_0M0 ][QIN.numberOfBCnodes] = ON[DIR_0M0 ]; + Q.q27[DIR_00P ][QIN.numberOfBCnodes] = ON[DIR_00P ]; + Q.q27[DIR_00M ][QIN.numberOfBCnodes] = ON[DIR_00M ]; + Q.q27[DIR_PP0 ][QIN.numberOfBCnodes] = ON[DIR_PP0 ]; + Q.q27[DIR_MM0 ][QIN.numberOfBCnodes] = ON[DIR_MM0 ]; + Q.q27[DIR_PM0 ][QIN.numberOfBCnodes] = ON[DIR_PM0 ]; + Q.q27[DIR_MP0 ][QIN.numberOfBCnodes] = ON[DIR_MP0 ]; + Q.q27[DIR_P0P ][QIN.numberOfBCnodes] = ON[DIR_P0P ]; + Q.q27[DIR_M0M ][QIN.numberOfBCnodes] = ON[DIR_M0M ]; + Q.q27[DIR_P0M ][QIN.numberOfBCnodes] = ON[DIR_P0M ]; + Q.q27[DIR_M0P ][QIN.numberOfBCnodes] = ON[DIR_M0P ]; + Q.q27[DIR_0PP ][QIN.numberOfBCnodes] = ON[DIR_0PP ]; + Q.q27[DIR_0MM ][QIN.numberOfBCnodes] = ON[DIR_0MM ]; + Q.q27[DIR_0PM ][QIN.numberOfBCnodes] = ON[DIR_0PM ]; + Q.q27[DIR_0MP ][QIN.numberOfBCnodes] = ON[DIR_0MP ]; + Q.q27[DIR_000][QIN.numberOfBCnodes] = ON[DIR_000]; + Q.q27[DIR_PPP ][QIN.numberOfBCnodes] = ON[DIR_PPP ]; + Q.q27[DIR_MMP ][QIN.numberOfBCnodes] = ON[DIR_MMP ]; + Q.q27[DIR_PMP ][QIN.numberOfBCnodes] = ON[DIR_PMP ]; + Q.q27[DIR_MPP ][QIN.numberOfBCnodes] = ON[DIR_MPP ]; + Q.q27[DIR_PPM ][QIN.numberOfBCnodes] = ON[DIR_PPM ]; + Q.q27[DIR_MMM ][QIN.numberOfBCnodes] = ON[DIR_MMM ]; + Q.q27[DIR_PMM ][QIN.numberOfBCnodes] = ON[DIR_PMM ]; + Q.q27[DIR_MPM ][QIN.numberOfBCnodes] = ON[DIR_MPM ]; + + QIN.numberOfBCnodes++; + } + } } } } @@ -345,8 +366,14 @@ void findQ_MG( int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int //////////////////////////////////////////////////////////////////////////////// void findKforQ_MG(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, QforBoundaryConditions &QIN) { + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + + VF_LOG_CRITICAL("findKforQ_MG() is deprecated! - see comment above for more information"); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// + ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; @@ -356,7 +383,7 @@ void findKforQ_MG(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned i unsigned int i, j, k, m, mm, l; real test = (real)0.f; - QIN.kQ = 0; + QIN.numberOfBCnodes = 0; for(k=STARTOFFZ+2 ; k<=nnz+STARTOFFZ-3 ; k++){ for(j=STARTOFFY+2 ; j<=nny+STARTOFFY-3 ; j++){ @@ -367,7 +394,7 @@ void findKforQ_MG(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned i for(l=0;l<=26;l++){ mm = nx*(ny*(k+ez[l]) + (j+ey[l])) + (i+ex[l]); if(geo_mat[mm] == GEO_FLUID){ - ON[l] = (real)1.f; + ON[l] = (real)1.f; } else{ ON[l] = (real)0.f; @@ -376,9 +403,9 @@ void findKforQ_MG(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned i } if (test>0) { - QIN.kQ++; - } - } + QIN.numberOfBCnodes++; + } + } } } } @@ -387,68 +414,67 @@ void findKforQ_MG(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned i //////////////////////////////////////////////////////////////////////////////// void findQInflow(Parameter* para) { - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// - //int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; - //int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; - //int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; - //real ON[27]; + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + VF_LOG_CRITICAL("findQInflow() is deprecated! - see comment above for more information"); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// unsigned int i, j, k, m;//, mm, l; - //int nx = para->getParH(para->getFine())->nx; - //int ny = para->getParH(para->getFine())->ny; - //unsigned int nnx = para->getParH(para->getFine())->gridNX; - //unsigned int nny = para->getParH(para->getFine())->gridNY; - //unsigned int nnz = para->getParH(para->getFine())->gridNZ; - //int* geo_mat = para->getParH(para->getFine())->geo; + //int nx = para->getParH(para->getFine())->nx; + //int ny = para->getParH(para->getFine())->ny; + //unsigned int nnx = para->getParH(para->getFine())->gridNX; + //unsigned int nny = para->getParH(para->getFine())->gridNY; + //unsigned int nnz = para->getParH(para->getFine())->gridNZ; + //int* geo_mat = para->getParH(para->getFine())->geo; //unsigned int* kk = para->getParH(para->getFine())->k; - int nx = para->getParH(para->getCoarse())->nx; - int ny = para->getParH(para->getCoarse())->ny; - unsigned int nnx = para->getParH(para->getCoarse())->gridNX; - unsigned int nny = para->getParH(para->getCoarse())->gridNY; - unsigned int nnz = para->getParH(para->getCoarse())->gridNZ; - int* geo_mat = para->getParH(para->getCoarse())->geo; + int nx = para->getParH(para->getCoarse())->nx; + int ny = para->getParH(para->getCoarse())->ny; + unsigned int nnx = para->getParH(para->getCoarse())->gridNX; + unsigned int nny = para->getParH(para->getCoarse())->gridNY; + unsigned int nnz = para->getParH(para->getCoarse())->gridNZ; + int* geo_mat = para->getParH(para->getCoarse())->geo; unsigned int* kk = para->getParH(para->getCoarse())->k; - unsigned int sizeQ = para->getParH(para->getCoarse())->kInflowQ; - //real* rhoBC = para->getParH(para->getCoarse())->Qinflow.RhoBC; - real u0 = para->getVelocity(); - real* vx = para->getParH(para->getCoarse())->Qinflow.Vx; - real* vy = para->getParH(para->getCoarse())->Qinflow.Vy; - real* vz = para->getParH(para->getCoarse())->Qinflow.Vz; - real*deltaVz = para->getParH(para->getCoarse())->Qinflow.deltaVz; - real* QQ = para->getParH(para->getCoarse())->Qinflow.q27[0]; - QforBoundaryConditions &QIN = para->getParH(para->getCoarse())->Qinflow; + unsigned int sizeQ = para->getParH(para->getCoarse())->velocityBC.numberOfBCnodes; + //real* rhoBC = para->getParH(para->getCoarse())->velocityBC.RhoBC; + real u0 = para->getVelocity(); + real* vx = para->getParH(para->getCoarse())->velocityBC.Vx; + real* vy = para->getParH(para->getCoarse())->velocityBC.Vy; + real* vz = para->getParH(para->getCoarse())->velocityBC.Vz; + real*deltaVz = para->getParH(para->getCoarse())->velocityBC.deltaVz; + real* QQ = para->getParH(para->getCoarse())->velocityBC.q27[0]; + QforBoundaryConditions &QIN = para->getParH(para->getCoarse())->velocityBC; //unsigned int nxny = nx*ny; - QIN.kQ = 0; + QIN.numberOfBCnodes = 0; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// QforBoundaryConditions Q; - Q.q27[dirE ] = &QQ[dirE *sizeQ]; - Q.q27[dirW ] = &QQ[dirW *sizeQ]; - Q.q27[dirN ] = &QQ[dirN *sizeQ]; - Q.q27[dirS ] = &QQ[dirS *sizeQ]; - Q.q27[dirT ] = &QQ[dirT *sizeQ]; - Q.q27[dirB ] = &QQ[dirB *sizeQ]; - Q.q27[dirNE ] = &QQ[dirNE *sizeQ]; - Q.q27[dirSW ] = &QQ[dirSW *sizeQ]; - Q.q27[dirSE ] = &QQ[dirSE *sizeQ]; - Q.q27[dirNW ] = &QQ[dirNW *sizeQ]; - Q.q27[dirTE ] = &QQ[dirTE *sizeQ]; - Q.q27[dirBW ] = &QQ[dirBW *sizeQ]; - Q.q27[dirBE ] = &QQ[dirBE *sizeQ]; - Q.q27[dirTW ] = &QQ[dirTW *sizeQ]; - Q.q27[dirTN ] = &QQ[dirTN *sizeQ]; - Q.q27[dirBS ] = &QQ[dirBS *sizeQ]; - Q.q27[dirBN ] = &QQ[dirBN *sizeQ]; - Q.q27[dirTS ] = &QQ[dirTS *sizeQ]; - Q.q27[dirZERO] = &QQ[dirZERO*sizeQ]; - Q.q27[dirTNE ] = &QQ[dirTNE *sizeQ]; - Q.q27[dirTSW ] = &QQ[dirTSW *sizeQ]; - Q.q27[dirTSE ] = &QQ[dirTSE *sizeQ]; - Q.q27[dirTNW ] = &QQ[dirTNW *sizeQ]; - Q.q27[dirBNE ] = &QQ[dirBNE *sizeQ]; - Q.q27[dirBSW ] = &QQ[dirBSW *sizeQ]; - Q.q27[dirBSE ] = &QQ[dirBSE *sizeQ]; - Q.q27[dirBNW ] = &QQ[dirBNW *sizeQ]; + Q.q27[DIR_P00 ] = &QQ[DIR_P00 *sizeQ]; + Q.q27[DIR_M00 ] = &QQ[DIR_M00 *sizeQ]; + Q.q27[DIR_0P0 ] = &QQ[DIR_0P0 *sizeQ]; + Q.q27[DIR_0M0 ] = &QQ[DIR_0M0 *sizeQ]; + Q.q27[DIR_00P ] = &QQ[DIR_00P *sizeQ]; + Q.q27[DIR_00M ] = &QQ[DIR_00M *sizeQ]; + Q.q27[DIR_PP0 ] = &QQ[DIR_PP0 *sizeQ]; + Q.q27[DIR_MM0 ] = &QQ[DIR_MM0 *sizeQ]; + Q.q27[DIR_PM0 ] = &QQ[DIR_PM0 *sizeQ]; + Q.q27[DIR_MP0 ] = &QQ[DIR_MP0 *sizeQ]; + Q.q27[DIR_P0P ] = &QQ[DIR_P0P *sizeQ]; + Q.q27[DIR_M0M ] = &QQ[DIR_M0M *sizeQ]; + Q.q27[DIR_P0M ] = &QQ[DIR_P0M *sizeQ]; + Q.q27[DIR_M0P ] = &QQ[DIR_M0P *sizeQ]; + Q.q27[DIR_0PP ] = &QQ[DIR_0PP *sizeQ]; + Q.q27[DIR_0MM ] = &QQ[DIR_0MM *sizeQ]; + Q.q27[DIR_0PM ] = &QQ[DIR_0PM *sizeQ]; + Q.q27[DIR_0MP ] = &QQ[DIR_0MP *sizeQ]; + Q.q27[DIR_000] = &QQ[DIR_000*sizeQ]; + Q.q27[DIR_PPP ] = &QQ[DIR_PPP *sizeQ]; + Q.q27[DIR_MMP ] = &QQ[DIR_MMP *sizeQ]; + Q.q27[DIR_PMP ] = &QQ[DIR_PMP *sizeQ]; + Q.q27[DIR_MPP ] = &QQ[DIR_MPP *sizeQ]; + Q.q27[DIR_PPM ] = &QQ[DIR_PPM *sizeQ]; + Q.q27[DIR_MMM ] = &QQ[DIR_MMM *sizeQ]; + Q.q27[DIR_PMM ] = &QQ[DIR_PMM *sizeQ]; + Q.q27[DIR_MPM ] = &QQ[DIR_MPM *sizeQ]; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //unsigned int li = ((nnx+STARTOFFX-2)-(STARTOFFX+1)-1); //unsigned int lj = ((nny+STARTOFFY-2)-(STARTOFFY+1)-1); @@ -460,74 +486,80 @@ void findQInflow(Parameter* para) for(i=STARTOFFX/*+1*/; i<=nnx+STARTOFFX/*-2*/ ; i++){ m = nx*(ny*k + j) + i; if(geo_mat[m]==GEO_FLUID){ - QIN.k[QIN.kQ] = kk[m]; - //vx[QIN.kQ] = (real)0.f; - vx[QIN.kQ] = u0; - vy[QIN.kQ] = (real)0.f; - vz[QIN.kQ] = (real)0.f; - //vz[QIN.kQ] = u0; - //vz[QIN.kQ] = (real)(u0*2.f)*((-4.f*i*i + nnx*(-2.f - 4.f*STARTOFFX) - 4.f*(-1.5f + STARTOFFX)*(0.5f + STARTOFFX) + i*(-4.f + 4.f*nnx + 8.f*STARTOFFX))*(-4.f*j*j + nny*(-2.f - 4.f*STARTOFFY) - 4.f*(-1.5f + STARTOFFY)*(0.5f + STARTOFFY) + j*(-4.f + 4.f*nny + 8.f*STARTOFFY)))/((2.f - nnx)*(2.f - nnx)*(2.f - nny)*(2.f - nny)); - //vz[QIN.kQ] = (real)(16.f*(u0*2.f)*(i-(STARTOFFX+1)-0.5f)*(li-1.5f-(i-(STARTOFFX+1)))*(j-(STARTOFFY+1)-0.5f)*(lj-1.5f-(j-(STARTOFFY+1))))/(li*lj*li*lj); - //vz[QIN.kQ] = (real)(16.f*(u0*2.f)*i*j*(nx-i)*(ny-j))/(nx*nx*ny*ny); - deltaVz[QIN.kQ] = (real)0.f; + QIN.k[QIN.numberOfBCnodes] = kk[m]; + //vx[QIN.numberOfBCnodes] = (real)0.f; + vx[QIN.numberOfBCnodes] = u0; + vy[QIN.numberOfBCnodes] = (real)0.f; + vz[QIN.numberOfBCnodes] = (real)0.f; + //vz[QIN.numberOfBCnodes] = u0; + //vz[QIN.numberOfBCnodes] = (real)(u0*2.f)*((-4.f*i*i + nnx*(-2.f - 4.f*STARTOFFX) - 4.f*(-1.5f + STARTOFFX)*(0.5f + STARTOFFX) + i*(-4.f + 4.f*nnx + 8.f*STARTOFFX))*(-4.f*j*j + nny*(-2.f - 4.f*STARTOFFY) - 4.f*(-1.5f + STARTOFFY)*(0.5f + STARTOFFY) + j*(-4.f + 4.f*nny + 8.f*STARTOFFY)))/((2.f - nnx)*(2.f - nnx)*(2.f - nny)*(2.f - nny)); + //vz[QIN.numberOfBCnodes] = (real)(16.f*(u0*2.f)*(i-(STARTOFFX+1)-0.5f)*(li-1.5f-(i-(STARTOFFX+1)))*(j-(STARTOFFY+1)-0.5f)*(lj-1.5f-(j-(STARTOFFY+1))))/(li*lj*li*lj); + //vz[QIN.numberOfBCnodes] = (real)(16.f*(u0*2.f)*i*j*(nx-i)*(ny-j))/(nx*nx*ny*ny); + deltaVz[QIN.numberOfBCnodes] = (real)0.f; ////////////////////////////////////////////////////////////////////////// - //Q.q27[dirE ][QIN.kQ] = (real)-1.f; - //Q.q27[dirW ][QIN.kQ] = (real)-1.f; - //Q.q27[dirN ][QIN.kQ] = (real)-1.f; - //Q.q27[dirS ][QIN.kQ] = (real)-1.f; - //Q.q27[dirT ][QIN.kQ] = (real)-1.f; - //Q.q27[dirB ][QIN.kQ] = (real)1.f; - //Q.q27[dirNE ][QIN.kQ] = (real)-1.f; - //Q.q27[dirSW ][QIN.kQ] = (real)-1.f; - //Q.q27[dirSE ][QIN.kQ] = (real)-1.f; - //Q.q27[dirNW ][QIN.kQ] = (real)-1.f; - //Q.q27[dirTE ][QIN.kQ] = (real)-1.f; - //Q.q27[dirBW ][QIN.kQ] = (real)1.f; - //Q.q27[dirBE ][QIN.kQ] = (real)1.f; - //Q.q27[dirTW ][QIN.kQ] = (real)-1.f; - //Q.q27[dirTN ][QIN.kQ] = (real)-1.f; - //Q.q27[dirBS ][QIN.kQ] = (real)1.f; - //Q.q27[dirBN ][QIN.kQ] = (real)1.f; - //Q.q27[dirTS ][QIN.kQ] = (real)-1.f; - //Q.q27[dirZERO][QIN.kQ] = (real)-1.f; - //Q.q27[dirTNE ][QIN.kQ] = (real)-1.f; - //Q.q27[dirTSW ][QIN.kQ] = (real)-1.f; - //Q.q27[dirTSE ][QIN.kQ] = (real)-1.f; - //Q.q27[dirTNW ][QIN.kQ] = (real)-1.f; - //Q.q27[dirBNE ][QIN.kQ] = (real)1.f; - //Q.q27[dirBSW ][QIN.kQ] = (real)1.f; - //Q.q27[dirBSE ][QIN.kQ] = (real)1.f; - //Q.q27[dirBNW ][QIN.kQ] = (real)1.f; + //Q.q27[DIR_P00 ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_M00 ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_0P0 ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_0M0 ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_00P ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_00M ][QIN.numberOfBCnodes] = (real)1.f; + //Q.q27[DIR_PP0 ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_MM0 ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_PM0 ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_MP0 ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_P0P ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_M0M ][QIN.numberOfBCnodes] = (real)1.f; + //Q.q27[DIR_P0M ][QIN.numberOfBCnodes] = (real)1.f; + //Q.q27[DIR_M0P ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_0PP ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_0MM ][QIN.numberOfBCnodes] = (real)1.f; + //Q.q27[DIR_0PM ][QIN.numberOfBCnodes] = (real)1.f; + //Q.q27[DIR_0MP ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_000][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_PPP ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_MMP ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_PMP ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_MPP ][QIN.numberOfBCnodes] = (real)-1.f; + //Q.q27[DIR_PPM ][QIN.numberOfBCnodes] = (real)1.f; + //Q.q27[DIR_MMM ][QIN.numberOfBCnodes] = (real)1.f; + //Q.q27[DIR_PMM ][QIN.numberOfBCnodes] = (real)1.f; + //Q.q27[DIR_MPM ][QIN.numberOfBCnodes] = (real)1.f; ////////////////////////////////////////////////////////////////////////// - Q.q27[dirE ][QIN.kQ] = (real)-1.f; - Q.q27[dirW ][QIN.kQ] = (real)-1.f; - Q.q27[dirN ][QIN.kQ] = (real)-1.f; - Q.q27[dirS ][QIN.kQ] = (real)-1.f; - Q.q27[dirT ][QIN.kQ] = (real)1.f; - Q.q27[dirB ][QIN.kQ] = (real)-1.f; - Q.q27[dirNE ][QIN.kQ] = (real)-1.f; - Q.q27[dirSW ][QIN.kQ] = (real)-1.f; - Q.q27[dirSE ][QIN.kQ] = (real)-1.f; - Q.q27[dirNW ][QIN.kQ] = (real)-1.f; - Q.q27[dirTE ][QIN.kQ] = (real)1.f; - Q.q27[dirBW ][QIN.kQ] = (real)-1.f; - Q.q27[dirBE ][QIN.kQ] = (real)-1.f; - Q.q27[dirTW ][QIN.kQ] = (real)1.f; - Q.q27[dirTN ][QIN.kQ] = (real)1.f; - Q.q27[dirBS ][QIN.kQ] = (real)-1.f; - Q.q27[dirBN ][QIN.kQ] = (real)-1.f; - Q.q27[dirTS ][QIN.kQ] = (real)1.f; - Q.q27[dirZERO][QIN.kQ] = (real)-1.f; - Q.q27[dirTNE ][QIN.kQ] = (real)1.f; - Q.q27[dirTSW ][QIN.kQ] = (real)1.f; - Q.q27[dirTSE ][QIN.kQ] = (real)1.f; - Q.q27[dirTNW ][QIN.kQ] = (real)1.f; - Q.q27[dirBNE ][QIN.kQ] = (real)-1.f; - Q.q27[dirBSW ][QIN.kQ] = (real)-1.f; - Q.q27[dirBSE ][QIN.kQ] = (real)-1.f; - Q.q27[dirBNW ][QIN.kQ] = (real)-1.f; + + + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + + Q.q27[DIR_P00 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_M00 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0P0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0M0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_00P ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_00M ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PP0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MM0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PM0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MP0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_P0P ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_M0M ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_P0M ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_M0P ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_0PP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_0MM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0PM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0MP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_000][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PPP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_MMP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_PMP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_MPP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_PPM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MMM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PMM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MPM ][QIN.numberOfBCnodes] = (real)-1.f; ////////////////////////////////////////////////////////////////////////// - QIN.kQ++; + QIN.numberOfBCnodes++; } } } @@ -551,42 +583,42 @@ void findQInflow(Parameter* para) // } // if (ON[18]==1.f) // { - // QIN.k[QIN.kQ] = m; - // vx[QIN.kQ] = 0.f; - // vy[QIN.kQ] = 0.f; - // vz[QIN.kQ] = u0; - - // Q.q27[dirE ][QIN.kQ] = ON[dirE ]; - // Q.q27[dirW ][QIN.kQ] = ON[dirW ]; - // Q.q27[dirN ][QIN.kQ] = ON[dirN ]; - // Q.q27[dirS ][QIN.kQ] = ON[dirS ]; - // Q.q27[dirT ][QIN.kQ] = ON[dirT ]; - // Q.q27[dirB ][QIN.kQ] = ON[dirB ]; - // Q.q27[dirNE ][QIN.kQ] = ON[dirNE ]; - // Q.q27[dirSW ][QIN.kQ] = ON[dirSW ]; - // Q.q27[dirSE ][QIN.kQ] = ON[dirSE ]; - // Q.q27[dirNW ][QIN.kQ] = ON[dirNW ]; - // Q.q27[dirTE ][QIN.kQ] = ON[dirTE ]; - // Q.q27[dirBW ][QIN.kQ] = ON[dirBW ]; - // Q.q27[dirBE ][QIN.kQ] = ON[dirBE ]; - // Q.q27[dirTW ][QIN.kQ] = ON[dirTW ]; - // Q.q27[dirTN ][QIN.kQ] = ON[dirTN ]; - // Q.q27[dirBS ][QIN.kQ] = ON[dirBS ]; - // Q.q27[dirBN ][QIN.kQ] = ON[dirBN ]; - // Q.q27[dirTS ][QIN.kQ] = ON[dirTS ]; - // Q.q27[dirZERO][QIN.kQ] = ON[dirZERO]; - // Q.q27[dirTNE ][QIN.kQ] = ON[dirTNE ]; - // Q.q27[dirTSW ][QIN.kQ] = ON[dirTSW ]; - // Q.q27[dirTSE ][QIN.kQ] = ON[dirTSE ]; - // Q.q27[dirTNW ][QIN.kQ] = ON[dirTNW ]; - // Q.q27[dirBNE ][QIN.kQ] = ON[dirBNE ]; - // Q.q27[dirBSW ][QIN.kQ] = ON[dirBSW ]; - // Q.q27[dirBSE ][QIN.kQ] = ON[dirBSE ]; - // Q.q27[dirBNW ][QIN.kQ] = ON[dirBNW ]; - - // QIN.kQ++; - // } - // } + // QIN.k[QIN.numberOfBCnodes] = m; + // vx[QIN.numberOfBCnodes] = 0.f; + // vy[QIN.numberOfBCnodes] = 0.f; + // vz[QIN.numberOfBCnodes] = u0; + + // Q.q27[DIR_P00 ][QIN.numberOfBCnodes] = ON[DIR_P00 ]; + // Q.q27[DIR_M00 ][QIN.numberOfBCnodes] = ON[DIR_M00 ]; + // Q.q27[DIR_0P0 ][QIN.numberOfBCnodes] = ON[DIR_0P0 ]; + // Q.q27[DIR_0M0 ][QIN.numberOfBCnodes] = ON[DIR_0M0 ]; + // Q.q27[DIR_00P ][QIN.numberOfBCnodes] = ON[DIR_00P ]; + // Q.q27[DIR_00M ][QIN.numberOfBCnodes] = ON[DIR_00M ]; + // Q.q27[DIR_PP0 ][QIN.numberOfBCnodes] = ON[DIR_PP0 ]; + // Q.q27[DIR_MM0 ][QIN.numberOfBCnodes] = ON[DIR_MM0 ]; + // Q.q27[DIR_PM0 ][QIN.numberOfBCnodes] = ON[DIR_PM0 ]; + // Q.q27[DIR_MP0 ][QIN.numberOfBCnodes] = ON[DIR_MP0 ]; + // Q.q27[DIR_P0P ][QIN.numberOfBCnodes] = ON[DIR_P0P ]; + // Q.q27[DIR_M0M ][QIN.numberOfBCnodes] = ON[DIR_M0M ]; + // Q.q27[DIR_P0M ][QIN.numberOfBCnodes] = ON[DIR_P0M ]; + // Q.q27[DIR_M0P ][QIN.numberOfBCnodes] = ON[DIR_M0P ]; + // Q.q27[DIR_0PP ][QIN.numberOfBCnodes] = ON[DIR_0PP ]; + // Q.q27[DIR_0MM ][QIN.numberOfBCnodes] = ON[DIR_0MM ]; + // Q.q27[DIR_0PM ][QIN.numberOfBCnodes] = ON[DIR_0PM ]; + // Q.q27[DIR_0MP ][QIN.numberOfBCnodes] = ON[DIR_0MP ]; + // Q.q27[DIR_000][QIN.numberOfBCnodes] = ON[DIR_000]; + // Q.q27[DIR_PPP ][QIN.numberOfBCnodes] = ON[DIR_PPP ]; + // Q.q27[DIR_MMP ][QIN.numberOfBCnodes] = ON[DIR_MMP ]; + // Q.q27[DIR_PMP ][QIN.numberOfBCnodes] = ON[DIR_PMP ]; + // Q.q27[DIR_MPP ][QIN.numberOfBCnodes] = ON[DIR_MPP ]; + // Q.q27[DIR_PPM ][QIN.numberOfBCnodes] = ON[DIR_PPM ]; + // Q.q27[DIR_MMM ][QIN.numberOfBCnodes] = ON[DIR_MMM ]; + // Q.q27[DIR_PMM ][QIN.numberOfBCnodes] = ON[DIR_PMM ]; + // Q.q27[DIR_MPM ][QIN.numberOfBCnodes] = ON[DIR_MPM ]; + + // QIN.numberOfBCnodes++; + // } + // } // } // } //} @@ -610,42 +642,42 @@ void findQInflow(Parameter* para) // } // if (ON[18]==1.f) // { - // QIN.k[QIN.kQ] = m; - // vx[QIN.kQ] = u0;//0.f; - // vy[QIN.kQ] = 0.f; - // vz[QIN.kQ] = 0.f;//u0; - - // Q.q27[dirE ][QIN.kQ] = ON[dirE ]; - // Q.q27[dirW ][QIN.kQ] = ON[dirW ]; - // Q.q27[dirN ][QIN.kQ] = ON[dirN ]; - // Q.q27[dirS ][QIN.kQ] = ON[dirS ]; - // Q.q27[dirT ][QIN.kQ] = ON[dirT ]; - // Q.q27[dirB ][QIN.kQ] = ON[dirB ]; - // Q.q27[dirNE ][QIN.kQ] = ON[dirNE ]; - // Q.q27[dirSW ][QIN.kQ] = ON[dirSW ]; - // Q.q27[dirSE ][QIN.kQ] = ON[dirSE ]; - // Q.q27[dirNW ][QIN.kQ] = ON[dirNW ]; - // Q.q27[dirTE ][QIN.kQ] = ON[dirTE ]; - // Q.q27[dirBW ][QIN.kQ] = ON[dirBW ]; - // Q.q27[dirBE ][QIN.kQ] = ON[dirBE ]; - // Q.q27[dirTW ][QIN.kQ] = ON[dirTW ]; - // Q.q27[dirTN ][QIN.kQ] = ON[dirTN ]; - // Q.q27[dirBS ][QIN.kQ] = ON[dirBS ]; - // Q.q27[dirBN ][QIN.kQ] = ON[dirBN ]; - // Q.q27[dirTS ][QIN.kQ] = ON[dirTS ]; - // Q.q27[dirZERO][QIN.kQ] = ON[dirZERO]; - // Q.q27[dirTNE ][QIN.kQ] = ON[dirTNE ]; - // Q.q27[dirTSW ][QIN.kQ] = ON[dirTSW ]; - // Q.q27[dirTSE ][QIN.kQ] = ON[dirTSE ]; - // Q.q27[dirTNW ][QIN.kQ] = ON[dirTNW ]; - // Q.q27[dirBNE ][QIN.kQ] = ON[dirBNE ]; - // Q.q27[dirBSW ][QIN.kQ] = ON[dirBSW ]; - // Q.q27[dirBSE ][QIN.kQ] = ON[dirBSE ]; - // Q.q27[dirBNW ][QIN.kQ] = ON[dirBNW ]; - - // QIN.kQ++; - // } - // } + // QIN.k[QIN.numberOfBCnodes] = m; + // vx[QIN.numberOfBCnodes] = u0;//0.f; + // vy[QIN.numberOfBCnodes] = 0.f; + // vz[QIN.numberOfBCnodes] = 0.f;//u0; + + // Q.q27[DIR_P00 ][QIN.numberOfBCnodes] = ON[DIR_P00 ]; + // Q.q27[DIR_M00 ][QIN.numberOfBCnodes] = ON[DIR_M00 ]; + // Q.q27[DIR_0P0 ][QIN.numberOfBCnodes] = ON[DIR_0P0 ]; + // Q.q27[DIR_0M0 ][QIN.numberOfBCnodes] = ON[DIR_0M0 ]; + // Q.q27[DIR_00P ][QIN.numberOfBCnodes] = ON[DIR_00P ]; + // Q.q27[DIR_00M ][QIN.numberOfBCnodes] = ON[DIR_00M ]; + // Q.q27[DIR_PP0 ][QIN.numberOfBCnodes] = ON[DIR_PP0 ]; + // Q.q27[DIR_MM0 ][QIN.numberOfBCnodes] = ON[DIR_MM0 ]; + // Q.q27[DIR_PM0 ][QIN.numberOfBCnodes] = ON[DIR_PM0 ]; + // Q.q27[DIR_MP0 ][QIN.numberOfBCnodes] = ON[DIR_MP0 ]; + // Q.q27[DIR_P0P ][QIN.numberOfBCnodes] = ON[DIR_P0P ]; + // Q.q27[DIR_M0M ][QIN.numberOfBCnodes] = ON[DIR_M0M ]; + // Q.q27[DIR_P0M ][QIN.numberOfBCnodes] = ON[DIR_P0M ]; + // Q.q27[DIR_M0P ][QIN.numberOfBCnodes] = ON[DIR_M0P ]; + // Q.q27[DIR_0PP ][QIN.numberOfBCnodes] = ON[DIR_0PP ]; + // Q.q27[DIR_0MM ][QIN.numberOfBCnodes] = ON[DIR_0MM ]; + // Q.q27[DIR_0PM ][QIN.numberOfBCnodes] = ON[DIR_0PM ]; + // Q.q27[DIR_0MP ][QIN.numberOfBCnodes] = ON[DIR_0MP ]; + // Q.q27[DIR_000][QIN.numberOfBCnodes] = ON[DIR_000]; + // Q.q27[DIR_PPP ][QIN.numberOfBCnodes] = ON[DIR_PPP ]; + // Q.q27[DIR_MMP ][QIN.numberOfBCnodes] = ON[DIR_MMP ]; + // Q.q27[DIR_PMP ][QIN.numberOfBCnodes] = ON[DIR_PMP ]; + // Q.q27[DIR_MPP ][QIN.numberOfBCnodes] = ON[DIR_MPP ]; + // Q.q27[DIR_PPM ][QIN.numberOfBCnodes] = ON[DIR_PPM ]; + // Q.q27[DIR_MMM ][QIN.numberOfBCnodes] = ON[DIR_MMM ]; + // Q.q27[DIR_PMM ][QIN.numberOfBCnodes] = ON[DIR_PMM ]; + // Q.q27[DIR_MPM ][QIN.numberOfBCnodes] = ON[DIR_MPM ]; + + // QIN.numberOfBCnodes++; + // } + // } // } // } //} @@ -654,8 +686,13 @@ void findQInflow(Parameter* para) //////////////////////////////////////////////////////////////////////////////// void findKforQInflow(Parameter* para) { + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + VF_LOG_CRITICAL("findKforQInflow() is deprecated! - see comment above for more information"); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// + ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// //int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; //int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; @@ -664,21 +701,21 @@ void findKforQInflow(Parameter* para) //unsigned int mm; unsigned int i, j, k, m, l; real test = 0.f; - //int nx = para->getParH(para->getFine())->nx; - //int ny = para->getParH(para->getFine())->ny; - //unsigned int nnx = para->getParH(para->getFine())->gridNX; - //unsigned int nny = para->getParH(para->getFine())->gridNY; - //unsigned int nnz = para->getParH(para->getFine())->gridNZ; - //int* geo_mat = para->getParH(para->getFine())->geo; - int nx = para->getParH(para->getCoarse())->nx; - int ny = para->getParH(para->getCoarse())->ny; - unsigned int nnx = para->getParH(para->getCoarse())->gridNX; - unsigned int nny = para->getParH(para->getCoarse())->gridNY; - unsigned int nnz = para->getParH(para->getCoarse())->gridNZ; + //int nx = para->getParH(para->getFine())->nx; + //int ny = para->getParH(para->getFine())->ny; + //unsigned int nnx = para->getParH(para->getFine())->gridNX; + //unsigned int nny = para->getParH(para->getFine())->gridNY; + //unsigned int nnz = para->getParH(para->getFine())->gridNZ; + //int* geo_mat = para->getParH(para->getFine())->geo; + int nx = para->getParH(para->getCoarse())->nx; + int ny = para->getParH(para->getCoarse())->ny; + unsigned int nnx = para->getParH(para->getCoarse())->gridNX; + unsigned int nny = para->getParH(para->getCoarse())->gridNY; + unsigned int nnz = para->getParH(para->getCoarse())->gridNZ; int* geo_mat = para->getParH(para->getCoarse())->geo; - QforBoundaryConditions &QIN = para->getParH(para->getCoarse())->Qinflow; + QforBoundaryConditions &QIN = para->getParH(para->getCoarse())->velocityBC; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - QIN.kQ = 0; + QIN.numberOfBCnodes = 0; k=nnz+STARTOFFZ-1/*3*/; //k=STARTOFFZ+1; @@ -691,7 +728,7 @@ void findKforQInflow(Parameter* para) for(l=0;l<=26;l++){ //mm = nx*(ny*(k+ez[l]) + (j+ey[l])) + (i+ex[l]); if(ez[l]==1/*-1*/){ - ON[l] = (real) 1.f; + ON[l] = (real) 1.f; } else{ ON[l] = (real) 0.f; @@ -700,9 +737,9 @@ void findKforQInflow(Parameter* para) } if (test>0) { - QIN.kQ++; - } - } + QIN.numberOfBCnodes++; + } + } } } } @@ -716,7 +753,7 @@ void findKforQInflow(Parameter* para) // for(l=0;l<=26;l++){ // mm = nx*(ny*(k+ez[l]) + (j+ey[l])) + (i+ex[l]); // if(geo_mat[mm] == GEO_VELO){ - // ON[l] = 1.f; + // ON[l] = 1.f; // } // else{ // ON[l] = 0.f; @@ -725,9 +762,9 @@ void findKforQInflow(Parameter* para) // } // if (test>0) // { - // QIN.kQ++; - // } - // } + // QIN.numberOfBCnodes++; + // } + // } // } // } //} @@ -737,68 +774,73 @@ void findKforQInflow(Parameter* para) //////////////////////////////////////////////////////////////////////////////// void findQOutflow(Parameter* para) { + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + VF_LOG_CRITICAL("findQOutflow() is deprecated! - see comment above for more information"); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// + ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// //int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; //int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; //int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; //real ON[27]; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// unsigned int i, j, k, m;//, mm, l; - //int nx = para->getParH(para->getFine())->nx; - //int ny = para->getParH(para->getFine())->ny; - //unsigned int nnx = para->getParH(para->getFine())->gridNX; - //unsigned int nny = para->getParH(para->getFine())->gridNY; - //unsigned int nnz = para->getParH(para->getFine())->gridNZ; - //int* geo_mat = para->getParH(para->getFine())->geo; + //int nx = para->getParH(para->getFine())->nx; + //int ny = para->getParH(para->getFine())->ny; + //unsigned int nnx = para->getParH(para->getFine())->gridNX; + //unsigned int nny = para->getParH(para->getFine())->gridNY; + //unsigned int nnz = para->getParH(para->getFine())->gridNZ; + //int* geo_mat = para->getParH(para->getFine())->geo; //unsigned int* kk = para->getParH(para->getFine())->k; - int nx = para->getParH(para->getCoarse())->nx; - int ny = para->getParH(para->getCoarse())->ny; - unsigned int nnx = para->getParH(para->getCoarse())->gridNX; - unsigned int nny = para->getParH(para->getCoarse())->gridNY; - unsigned int nnz = para->getParH(para->getCoarse())->gridNZ; - int* geo_mat = para->getParH(para->getCoarse())->geo; + int nx = para->getParH(para->getCoarse())->nx; + int ny = para->getParH(para->getCoarse())->ny; + unsigned int nnx = para->getParH(para->getCoarse())->gridNX; + unsigned int nny = para->getParH(para->getCoarse())->gridNY; + unsigned int nnz = para->getParH(para->getCoarse())->gridNZ; + int* geo_mat = para->getParH(para->getCoarse())->geo; unsigned int* kk = para->getParH(para->getCoarse())->k; - unsigned int sizeQ = para->getParH(para->getCoarse())->kOutflowQ; - real* rhoBC = para->getParH(para->getCoarse())->Qoutflow.RhoBC; - real u0 = para->getVelocity(); - real* vx = para->getParH(para->getCoarse())->Qoutflow.Vx; - real* vy = para->getParH(para->getCoarse())->Qoutflow.Vy; - real* vz = para->getParH(para->getCoarse())->Qoutflow.Vz; - real*deltaVz = para->getParH(para->getCoarse())->Qoutflow.deltaVz; - real* QQ = para->getParH(para->getCoarse())->Qoutflow.q27[0]; - QforBoundaryConditions &QIN = para->getParH(para->getCoarse())->Qoutflow; + unsigned int sizeQ = para->getParH(para->getCoarse())->outflowBC.numberOfBCnodes; + real* rhoBC = para->getParH(para->getCoarse())->outflowBC.RhoBC; + real u0 = para->getVelocity(); + real* vx = para->getParH(para->getCoarse())->outflowBC.Vx; + real* vy = para->getParH(para->getCoarse())->outflowBC.Vy; + real* vz = para->getParH(para->getCoarse())->outflowBC.Vz; + real*deltaVz = para->getParH(para->getCoarse())->outflowBC.deltaVz; + real* QQ = para->getParH(para->getCoarse())->outflowBC.q27[0]; + QforBoundaryConditions &QIN = para->getParH(para->getCoarse())->outflowBC; unsigned int nxny = nx*ny; - QIN.kQ = 0; + QIN.numberOfBCnodes = 0; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// QforBoundaryConditions Q; - Q.q27[dirE ] = &QQ[dirE *sizeQ]; - Q.q27[dirW ] = &QQ[dirW *sizeQ]; - Q.q27[dirN ] = &QQ[dirN *sizeQ]; - Q.q27[dirS ] = &QQ[dirS *sizeQ]; - Q.q27[dirT ] = &QQ[dirT *sizeQ]; - Q.q27[dirB ] = &QQ[dirB *sizeQ]; - Q.q27[dirNE ] = &QQ[dirNE *sizeQ]; - Q.q27[dirSW ] = &QQ[dirSW *sizeQ]; - Q.q27[dirSE ] = &QQ[dirSE *sizeQ]; - Q.q27[dirNW ] = &QQ[dirNW *sizeQ]; - Q.q27[dirTE ] = &QQ[dirTE *sizeQ]; - Q.q27[dirBW ] = &QQ[dirBW *sizeQ]; - Q.q27[dirBE ] = &QQ[dirBE *sizeQ]; - Q.q27[dirTW ] = &QQ[dirTW *sizeQ]; - Q.q27[dirTN ] = &QQ[dirTN *sizeQ]; - Q.q27[dirBS ] = &QQ[dirBS *sizeQ]; - Q.q27[dirBN ] = &QQ[dirBN *sizeQ]; - Q.q27[dirTS ] = &QQ[dirTS *sizeQ]; - Q.q27[dirZERO] = &QQ[dirZERO*sizeQ]; - Q.q27[dirTNE ] = &QQ[dirTNE *sizeQ]; - Q.q27[dirTSW ] = &QQ[dirTSW *sizeQ]; - Q.q27[dirTSE ] = &QQ[dirTSE *sizeQ]; - Q.q27[dirTNW ] = &QQ[dirTNW *sizeQ]; - Q.q27[dirBNE ] = &QQ[dirBNE *sizeQ]; - Q.q27[dirBSW ] = &QQ[dirBSW *sizeQ]; - Q.q27[dirBSE ] = &QQ[dirBSE *sizeQ]; - Q.q27[dirBNW ] = &QQ[dirBNW *sizeQ]; + Q.q27[DIR_P00 ] = &QQ[DIR_P00 *sizeQ]; + Q.q27[DIR_M00 ] = &QQ[DIR_M00 *sizeQ]; + Q.q27[DIR_0P0 ] = &QQ[DIR_0P0 *sizeQ]; + Q.q27[DIR_0M0 ] = &QQ[DIR_0M0 *sizeQ]; + Q.q27[DIR_00P ] = &QQ[DIR_00P *sizeQ]; + Q.q27[DIR_00M ] = &QQ[DIR_00M *sizeQ]; + Q.q27[DIR_PP0 ] = &QQ[DIR_PP0 *sizeQ]; + Q.q27[DIR_MM0 ] = &QQ[DIR_MM0 *sizeQ]; + Q.q27[DIR_PM0 ] = &QQ[DIR_PM0 *sizeQ]; + Q.q27[DIR_MP0 ] = &QQ[DIR_MP0 *sizeQ]; + Q.q27[DIR_P0P ] = &QQ[DIR_P0P *sizeQ]; + Q.q27[DIR_M0M ] = &QQ[DIR_M0M *sizeQ]; + Q.q27[DIR_P0M ] = &QQ[DIR_P0M *sizeQ]; + Q.q27[DIR_M0P ] = &QQ[DIR_M0P *sizeQ]; + Q.q27[DIR_0PP ] = &QQ[DIR_0PP *sizeQ]; + Q.q27[DIR_0MM ] = &QQ[DIR_0MM *sizeQ]; + Q.q27[DIR_0PM ] = &QQ[DIR_0PM *sizeQ]; + Q.q27[DIR_0MP ] = &QQ[DIR_0MP *sizeQ]; + Q.q27[DIR_000] = &QQ[DIR_000*sizeQ]; + Q.q27[DIR_PPP ] = &QQ[DIR_PPP *sizeQ]; + Q.q27[DIR_MMP ] = &QQ[DIR_MMP *sizeQ]; + Q.q27[DIR_PMP ] = &QQ[DIR_PMP *sizeQ]; + Q.q27[DIR_MPP ] = &QQ[DIR_MPP *sizeQ]; + Q.q27[DIR_PPM ] = &QQ[DIR_PPM *sizeQ]; + Q.q27[DIR_MMM ] = &QQ[DIR_MMM *sizeQ]; + Q.q27[DIR_PMM ] = &QQ[DIR_PMM *sizeQ]; + Q.q27[DIR_MPM ] = &QQ[DIR_MPM *sizeQ]; //unsigned int li = ((nnx+STARTOFFX-2)-(STARTOFFX+1)-1); @@ -810,44 +852,44 @@ void findQOutflow(Parameter* para) for(i=STARTOFFX+1; i<=nnx+STARTOFFX-2 ; i++){ m = nx*(ny*k + j) + i; if(geo_mat[m]==GEO_FLUID){ - QIN.k[QIN.kQ] = kk[m]; - QIN.kN[QIN.kQ] = kk[m-nxny]; - rhoBC[QIN.kQ] = (real)0.f; - vx[QIN.kQ] = (real)0.f; - vy[QIN.kQ] = (real)0.f; - //vz[QIN.kQ] = u0; - vz[QIN.kQ] = (real)(u0*2.f)*((-4.f*i*i + nnx*(-2.f - 4.f*STARTOFFX) - 4.f*(-1.5f + STARTOFFX)*(0.5f + STARTOFFX) + i*(-4.f + 4.f*nnx + 8.f*STARTOFFX))*(-4.f*j*j + nny*(-2.f - 4.f*STARTOFFY) - 4.f*(-1.5f + STARTOFFY)*(0.5f + STARTOFFY) + j*(-4.f + 4.f*nny + 8.f*STARTOFFY)))/((2.f - nnx)*(2.f - nnx)*(2.f - nny)*(2.f - nny)); - //vz[QIN.kQ] = (real)(16.f*(u0*2.f)*(i-(STARTOFFX+1)-0.5f)*(li-1.5f-(i-(STARTOFFX+1)))*(j-(STARTOFFY+1)-0.5f)*(lj-1.5f-(j-(STARTOFFY+1))))/(li*lj*li*lj); - //vz[QIN.kQ] = (real)(16.f*(u0*2.f)*i*j*(nx-i)*(ny-j))/(nx*nx*ny*ny); - deltaVz[QIN.kQ] = (real)0.f; - Q.q27[dirE ][QIN.kQ] = (real)-1.f; - Q.q27[dirW ][QIN.kQ] = (real)-1.f; - Q.q27[dirN ][QIN.kQ] = (real)-1.f; - Q.q27[dirS ][QIN.kQ] = (real)-1.f; - Q.q27[dirT ][QIN.kQ] = (real)1.f; - Q.q27[dirB ][QIN.kQ] = (real)-1.f; - Q.q27[dirNE ][QIN.kQ] = (real)-1.f; - Q.q27[dirSW ][QIN.kQ] = (real)-1.f; - Q.q27[dirSE ][QIN.kQ] = (real)-1.f; - Q.q27[dirNW ][QIN.kQ] = (real)-1.f; - Q.q27[dirTE ][QIN.kQ] = (real)1.f; - Q.q27[dirBW ][QIN.kQ] = (real)-1.f; - Q.q27[dirBE ][QIN.kQ] = (real)-1.f; - Q.q27[dirTW ][QIN.kQ] = (real)1.f; - Q.q27[dirTN ][QIN.kQ] = (real)1.f; - Q.q27[dirBS ][QIN.kQ] = (real)-1.f; - Q.q27[dirBN ][QIN.kQ] = (real)-1.f; - Q.q27[dirTS ][QIN.kQ] = (real)1.f; - Q.q27[dirZERO][QIN.kQ] = (real)-1.f; - Q.q27[dirTNE ][QIN.kQ] = (real)1.f; - Q.q27[dirTSW ][QIN.kQ] = (real)1.f; - Q.q27[dirTSE ][QIN.kQ] = (real)1.f; - Q.q27[dirTNW ][QIN.kQ] = (real)1.f; - Q.q27[dirBNE ][QIN.kQ] = (real)-1.f; - Q.q27[dirBSW ][QIN.kQ] = (real)-1.f; - Q.q27[dirBSE ][QIN.kQ] = (real)-1.f; - Q.q27[dirBNW ][QIN.kQ] = (real)-1.f; - QIN.kQ++; + QIN.k[QIN.numberOfBCnodes] = kk[m]; + QIN.kN[QIN.numberOfBCnodes] = kk[m-nxny]; + rhoBC[QIN.numberOfBCnodes] = (real)0.f; + vx[QIN.numberOfBCnodes] = (real)0.f; + vy[QIN.numberOfBCnodes] = (real)0.f; + //vz[QIN.numberOfBCnodes] = u0; + vz[QIN.numberOfBCnodes] = (real)(u0*2.f)*((-4.f*i*i + nnx*(-2.f - 4.f*STARTOFFX) - 4.f*(-1.5f + STARTOFFX)*(0.5f + STARTOFFX) + i*(-4.f + 4.f*nnx + 8.f*STARTOFFX))*(-4.f*j*j + nny*(-2.f - 4.f*STARTOFFY) - 4.f*(-1.5f + STARTOFFY)*(0.5f + STARTOFFY) + j*(-4.f + 4.f*nny + 8.f*STARTOFFY)))/((2.f - nnx)*(2.f - nnx)*(2.f - nny)*(2.f - nny)); + //vz[QIN.numberOfBCnodes] = (real)(16.f*(u0*2.f)*(i-(STARTOFFX+1)-0.5f)*(li-1.5f-(i-(STARTOFFX+1)))*(j-(STARTOFFY+1)-0.5f)*(lj-1.5f-(j-(STARTOFFY+1))))/(li*lj*li*lj); + //vz[QIN.numberOfBCnodes] = (real)(16.f*(u0*2.f)*i*j*(nx-i)*(ny-j))/(nx*nx*ny*ny); + deltaVz[QIN.numberOfBCnodes] = (real)0.f; + Q.q27[DIR_P00 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_M00 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0P0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0M0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_00P ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_00M ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PP0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MM0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PM0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MP0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_P0P ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_M0M ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_P0M ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_M0P ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_0PP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_0MM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0PM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0MP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_000][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PPP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_MMP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_PMP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_MPP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_PPM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MMM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PMM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MPM ][QIN.numberOfBCnodes] = (real)-1.f; + QIN.numberOfBCnodes++; } } } @@ -855,17 +897,22 @@ void findQOutflow(Parameter* para) //i = nnx / 2 + STARTOFFX; //j = nny / 2 + STARTOFFY; //k = nnz / 2 + STARTOFFZ; - //QIN.kQ = 0; - //rhoBC[QIN.kQ] = 0.1f; - //QIN.kQ++; + //QIN.numberOfBCnodes = 0; + //rhoBC[QIN.numberOfBCnodes] = 0.1f; + //QIN.numberOfBCnodes++; } //////////////////////////////////////////////////////////////////////////////// void findKforQOutflow(Parameter* para) { + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + VF_LOG_CRITICAL("findKforQOutflow() is deprecated! - see comment above for more information"); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// + ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// //int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; //int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; @@ -874,20 +921,20 @@ void findKforQOutflow(Parameter* para) //unsigned int mm; unsigned int i, j, k, m, l; real test = (real) 0.f; - //int nx = para->getParH(para->getFine())->nx; - //int ny = para->getParH(para->getFine())->ny; - //unsigned int nnx = para->getParH(para->getFine())->gridNX; - //unsigned int nny = para->getParH(para->getFine())->gridNY; - //unsigned int nnz = para->getParH(para->getFine())->gridNZ; - //int* geo_mat = para->getParH(para->getFine())->geo; - int nx = para->getParH(para->getCoarse())->nx; - int ny = para->getParH(para->getCoarse())->ny; - unsigned int nnx = para->getParH(para->getCoarse())->gridNX; - unsigned int nny = para->getParH(para->getCoarse())->gridNY; - unsigned int nnz = para->getParH(para->getCoarse())->gridNZ; - int* geo_mat = para->getParH(para->getCoarse())->geo; - QforBoundaryConditions &QIN = para->getParH(para->getCoarse())->Qoutflow; - QIN.kQ = 0; + //int nx = para->getParH(para->getFine())->nx; + //int ny = para->getParH(para->getFine())->ny; + //unsigned int nnx = para->getParH(para->getFine())->gridNX; + //unsigned int nny = para->getParH(para->getFine())->gridNY; + //unsigned int nnz = para->getParH(para->getFine())->gridNZ; + //int* geo_mat = para->getParH(para->getFine())->geo; + int nx = para->getParH(para->getCoarse())->nx; + int ny = para->getParH(para->getCoarse())->ny; + unsigned int nnx = para->getParH(para->getCoarse())->gridNX; + unsigned int nny = para->getParH(para->getCoarse())->gridNY; + unsigned int nnz = para->getParH(para->getCoarse())->gridNZ; + int* geo_mat = para->getParH(para->getCoarse())->geo; + QforBoundaryConditions &QIN = para->getParH(para->getCoarse())->outflowBC; + QIN.numberOfBCnodes = 0; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// k=nnz+STARTOFFZ-3; @@ -900,7 +947,7 @@ void findKforQOutflow(Parameter* para) for(l=0;l<=26;l++){ //mm = nx*(ny*(k+ez[l]) + (j+ey[l])) + (i+ex[l]); if(ez[l]==1){ - ON[l] = (real) 1.f; + ON[l] = (real) 1.f; } else{ ON[l] = (real) 0.f; @@ -909,56 +956,56 @@ void findKforQOutflow(Parameter* para) } if (test>0) { - QIN.kQ++; - } - } + QIN.numberOfBCnodes++; + } + } } } } - //QIN.kQ = 0; - //QIN.kQ++; + //QIN.numberOfBCnodes = 0; + //QIN.numberOfBCnodes++; } - +// TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 ////////////////////////////////////////////////////////////////////////////////// -//void findQSchlaff( int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, unsigned int* kk, +//void findQSchlaff( int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, unsigned int* kk, // unsigned int sizeQN, real* vxN, real* vyN, real* vzN, real*deltaVN, real* QQN, QforBoundaryConditions &QNin, // unsigned int sizeQS, real* vxS, real* vyS, real* vzS, real*deltaVS, real* QQS, QforBoundaryConditions &QSin, // unsigned int sizeQE, real* vxE, real* vyE, real* vzE, real*deltaVE, real* QQE, QforBoundaryConditions &QEin, // unsigned int sizeQW, real* vxW, real* vyW, real* vzW, real*deltaVW, real* QQW, QforBoundaryConditions &QWin) //{ // QforBoundaryConditions QN; -// QN.q27[dirE ] = &QQN[dirE *sizeQN]; -// QN.q27[dirW ] = &QQN[dirW *sizeQN]; -// QN.q27[dirN ] = &QQN[dirN *sizeQN]; -// QN.q27[dirS ] = &QQN[dirS *sizeQN]; -// QN.q27[dirT ] = &QQN[dirT *sizeQN]; -// QN.q27[dirB ] = &QQN[dirB *sizeQN]; -// QN.q27[dirNE ] = &QQN[dirNE *sizeQN]; -// QN.q27[dirSW ] = &QQN[dirSW *sizeQN]; -// QN.q27[dirSE ] = &QQN[dirSE *sizeQN]; -// QN.q27[dirNW ] = &QQN[dirNW *sizeQN]; -// QN.q27[dirTE ] = &QQN[dirTE *sizeQN]; -// QN.q27[dirBW ] = &QQN[dirBW *sizeQN]; -// QN.q27[dirBE ] = &QQN[dirBE *sizeQN]; -// QN.q27[dirTW ] = &QQN[dirTW *sizeQN]; -// QN.q27[dirTN ] = &QQN[dirTN *sizeQN]; -// QN.q27[dirBS ] = &QQN[dirBS *sizeQN]; -// QN.q27[dirBN ] = &QQN[dirBN *sizeQN]; -// QN.q27[dirTS ] = &QQN[dirTS *sizeQN]; -// QN.q27[dirZERO] = &QQN[dirZERO*sizeQN]; -// QN.q27[dirTNE ] = &QQN[dirTNE *sizeQN]; -// QN.q27[dirTSW ] = &QQN[dirTSW *sizeQN]; -// QN.q27[dirTSE ] = &QQN[dirTSE *sizeQN]; -// QN.q27[dirTNW ] = &QQN[dirTNW *sizeQN]; -// QN.q27[dirBNE ] = &QQN[dirBNE *sizeQN]; -// QN.q27[dirBSW ] = &QQN[dirBSW *sizeQN]; -// QN.q27[dirBSE ] = &QQN[dirBSE *sizeQN]; -// QN.q27[dirBNW ] = &QQN[dirBNW *sizeQN]; +// QN.q27[DIR_P00 ] = &QQN[DIR_P00 *sizeQN]; +// QN.q27[DIR_M00 ] = &QQN[DIR_M00 *sizeQN]; +// QN.q27[DIR_0P0 ] = &QQN[DIR_0P0 *sizeQN]; +// QN.q27[DIR_0M0 ] = &QQN[DIR_0M0 *sizeQN]; +// QN.q27[DIR_00P ] = &QQN[DIR_00P *sizeQN]; +// QN.q27[DIR_00M ] = &QQN[DIR_00M *sizeQN]; +// QN.q27[DIR_PP0 ] = &QQN[DIR_PP0 *sizeQN]; +// QN.q27[DIR_MM0 ] = &QQN[DIR_MM0 *sizeQN]; +// QN.q27[DIR_PM0 ] = &QQN[DIR_PM0 *sizeQN]; +// QN.q27[DIR_MP0 ] = &QQN[DIR_MP0 *sizeQN]; +// QN.q27[DIR_P0P ] = &QQN[DIR_P0P *sizeQN]; +// QN.q27[DIR_M0M ] = &QQN[DIR_M0M *sizeQN]; +// QN.q27[DIR_P0M ] = &QQN[DIR_P0M *sizeQN]; +// QN.q27[DIR_M0P ] = &QQN[DIR_M0P *sizeQN]; +// QN.q27[DIR_0PP ] = &QQN[DIR_0PP *sizeQN]; +// QN.q27[DIR_0MM ] = &QQN[DIR_0MM *sizeQN]; +// QN.q27[DIR_0PM ] = &QQN[DIR_0PM *sizeQN]; +// QN.q27[DIR_0MP ] = &QQN[DIR_0MP *sizeQN]; +// QN.q27[DIR_000] = &QQN[DIR_000*sizeQN]; +// QN.q27[DIR_PPP ] = &QQN[DIR_PPP *sizeQN]; +// QN.q27[DIR_MMP ] = &QQN[DIR_MMP *sizeQN]; +// QN.q27[DIR_PMP ] = &QQN[DIR_PMP *sizeQN]; +// QN.q27[DIR_MPP ] = &QQN[DIR_MPP *sizeQN]; +// QN.q27[DIR_PPM ] = &QQN[DIR_PPM *sizeQN]; +// QN.q27[DIR_MMM ] = &QQN[DIR_MMM *sizeQN]; +// QN.q27[DIR_PMM ] = &QQN[DIR_PMM *sizeQN]; +// QN.q27[DIR_MPM ] = &QQN[DIR_MPM *sizeQN]; // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// +// ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// // int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; // int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; // int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; @@ -967,11 +1014,11 @@ void findKforQOutflow(Parameter* para) //} // ////////////////////////////////////////////////////////////////////////////////// -//void findKforQSchlaff(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, +//void findKforQSchlaff(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, // QforBoundaryConditions &QN, QforBoundaryConditions &QS, QforBoundaryConditions &QE, QforBoundaryConditions &QW) //{ // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// +// ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// // int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; // int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; // int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; @@ -980,10 +1027,10 @@ void findKforQOutflow(Parameter* para) // unsigned int i, j, k, m, mm, l; // real test = (real) 0.f; // -// QN.kQ = 0; -// QS.kQ = 0; -// QE.kQ = 0; -// QW.kQ = 0; +// QN.numberOfBCnodes = 0; +// QS.numberOfBCnodes = 0; +// QE.numberOfBCnodes = 0; +// QW.numberOfBCnodes = 0; // // for(k=STARTOFFZ+1 ; k<=nnz+STARTOFFZ-2 ; k++){ // for(j=STARTOFFY+1 ; j<=nny+STARTOFFY-2 ; j++){ @@ -994,7 +1041,7 @@ void findKforQOutflow(Parameter* para) // for(l=0;l<=26;l++){ // mm = nx*(ny*(k+ez[l]) + (j+ey[l])) + (i+ex[l]); // if(ez[l]==1){ -// ON[l] = (real) 1.f; +// ON[l] = (real) 1.f; // } // else{ // ON[l] = (real) 0.f; @@ -1003,9 +1050,9 @@ void findKforQOutflow(Parameter* para) // } // if (test>0) // { -// QN.kQ++; -// } -// } +// QN.numberOfBCnodes++; +// } +// } // } // } // } @@ -1016,61 +1063,66 @@ void findKforQOutflow(Parameter* para) //////////////////////////////////////////////////////////////////////////////// void findQPressX0(Parameter* para, int lev) { + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + VF_LOG_CRITICAL("findKforQPressX0() is deprecated! - see comment above for more information"); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// + ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// //int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; //int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; //int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// unsigned int i, j, k, m; - int nx = para->getParH(lev)->nx; - int ny = para->getParH(lev)->ny; - unsigned int nnx = para->getParH(lev)->gridNX; - unsigned int nny = para->getParH(lev)->gridNY; - unsigned int nnz = para->getParH(lev)->gridNZ; - int* geo_mat = para->getParH(lev)->geo; + int nx = para->getParH(lev)->nx; + int ny = para->getParH(lev)->ny; + unsigned int nnx = para->getParH(lev)->gridNX; + unsigned int nny = para->getParH(lev)->gridNY; + unsigned int nnz = para->getParH(lev)->gridNZ; + int* geo_mat = para->getParH(lev)->geo; unsigned int* kk = para->getParH(lev)->k; - //unsigned int sizeQ = para->getParH(lev)->kOutflowQ; - unsigned int sizeQ = para->getParH(lev)->QpressX0.kQ; + //unsigned int sizeQ = para->getParH(lev)->outflowBC.numberOfBCnodes; + unsigned int sizeQ = para->getParH(lev)->QpressX0.numberOfBCnodes; real* rhoBC = para->getParH(lev)->QpressX0.RhoBC; - real u0 = para->getVelocity(); - real* vx = para->getParH(lev)->QpressX0.Vx; - real* vy = para->getParH(lev)->QpressX0.Vy; - real* vz = para->getParH(lev)->QpressX0.Vz; + real u0 = para->getVelocity(); + real* vx = para->getParH(lev)->QpressX0.Vx; + real* vy = para->getParH(lev)->QpressX0.Vy; + real* vz = para->getParH(lev)->QpressX0.Vz; real*deltaVz = para->getParH(lev)->QpressX0.deltaVz; - real* QQ = para->getParH(lev)->QpressX0.q27[0]; + real* QQ = para->getParH(lev)->QpressX0.q27[0]; QforBoundaryConditions &QIN = para->getParH(lev)->QpressX0; //unsigned int nxny = nx*ny; - QIN.kQ = 0; + QIN.numberOfBCnodes = 0; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// QforBoundaryConditions Q; - Q.q27[dirE ] = &QQ[dirE *sizeQ]; - Q.q27[dirW ] = &QQ[dirW *sizeQ]; - Q.q27[dirN ] = &QQ[dirN *sizeQ]; - Q.q27[dirS ] = &QQ[dirS *sizeQ]; - Q.q27[dirT ] = &QQ[dirT *sizeQ]; - Q.q27[dirB ] = &QQ[dirB *sizeQ]; - Q.q27[dirNE ] = &QQ[dirNE *sizeQ]; - Q.q27[dirSW ] = &QQ[dirSW *sizeQ]; - Q.q27[dirSE ] = &QQ[dirSE *sizeQ]; - Q.q27[dirNW ] = &QQ[dirNW *sizeQ]; - Q.q27[dirTE ] = &QQ[dirTE *sizeQ]; - Q.q27[dirBW ] = &QQ[dirBW *sizeQ]; - Q.q27[dirBE ] = &QQ[dirBE *sizeQ]; - Q.q27[dirTW ] = &QQ[dirTW *sizeQ]; - Q.q27[dirTN ] = &QQ[dirTN *sizeQ]; - Q.q27[dirBS ] = &QQ[dirBS *sizeQ]; - Q.q27[dirBN ] = &QQ[dirBN *sizeQ]; - Q.q27[dirTS ] = &QQ[dirTS *sizeQ]; - Q.q27[dirZERO] = &QQ[dirZERO*sizeQ]; - Q.q27[dirTNE ] = &QQ[dirTNE *sizeQ]; - Q.q27[dirTSW ] = &QQ[dirTSW *sizeQ]; - Q.q27[dirTSE ] = &QQ[dirTSE *sizeQ]; - Q.q27[dirTNW ] = &QQ[dirTNW *sizeQ]; - Q.q27[dirBNE ] = &QQ[dirBNE *sizeQ]; - Q.q27[dirBSW ] = &QQ[dirBSW *sizeQ]; - Q.q27[dirBSE ] = &QQ[dirBSE *sizeQ]; - Q.q27[dirBNW ] = &QQ[dirBNW *sizeQ]; + Q.q27[DIR_P00 ] = &QQ[DIR_P00 *sizeQ]; + Q.q27[DIR_M00 ] = &QQ[DIR_M00 *sizeQ]; + Q.q27[DIR_0P0 ] = &QQ[DIR_0P0 *sizeQ]; + Q.q27[DIR_0M0 ] = &QQ[DIR_0M0 *sizeQ]; + Q.q27[DIR_00P ] = &QQ[DIR_00P *sizeQ]; + Q.q27[DIR_00M ] = &QQ[DIR_00M *sizeQ]; + Q.q27[DIR_PP0 ] = &QQ[DIR_PP0 *sizeQ]; + Q.q27[DIR_MM0 ] = &QQ[DIR_MM0 *sizeQ]; + Q.q27[DIR_PM0 ] = &QQ[DIR_PM0 *sizeQ]; + Q.q27[DIR_MP0 ] = &QQ[DIR_MP0 *sizeQ]; + Q.q27[DIR_P0P ] = &QQ[DIR_P0P *sizeQ]; + Q.q27[DIR_M0M ] = &QQ[DIR_M0M *sizeQ]; + Q.q27[DIR_P0M ] = &QQ[DIR_P0M *sizeQ]; + Q.q27[DIR_M0P ] = &QQ[DIR_M0P *sizeQ]; + Q.q27[DIR_0PP ] = &QQ[DIR_0PP *sizeQ]; + Q.q27[DIR_0MM ] = &QQ[DIR_0MM *sizeQ]; + Q.q27[DIR_0PM ] = &QQ[DIR_0PM *sizeQ]; + Q.q27[DIR_0MP ] = &QQ[DIR_0MP *sizeQ]; + Q.q27[DIR_000] = &QQ[DIR_000*sizeQ]; + Q.q27[DIR_PPP ] = &QQ[DIR_PPP *sizeQ]; + Q.q27[DIR_MMP ] = &QQ[DIR_MMP *sizeQ]; + Q.q27[DIR_PMP ] = &QQ[DIR_PMP *sizeQ]; + Q.q27[DIR_MPP ] = &QQ[DIR_MPP *sizeQ]; + Q.q27[DIR_PPM ] = &QQ[DIR_PPM *sizeQ]; + Q.q27[DIR_MMM ] = &QQ[DIR_MMM *sizeQ]; + Q.q27[DIR_PMM ] = &QQ[DIR_PMM *sizeQ]; + Q.q27[DIR_MPM ] = &QQ[DIR_MPM *sizeQ]; //unsigned int li = ((nnx+STARTOFFX-2)-(STARTOFFX+1)-1); @@ -1083,44 +1135,44 @@ void findQPressX0(Parameter* para, int lev) //for(i=STARTOFFX+1; i<=nnx+STARTOFFX-2 ; i++){ m = nx*(ny*k + j) + i; if(geo_mat[m]==GEO_FLUID){ - QIN.k[QIN.kQ] = kk[m]; - QIN.kN[QIN.kQ] = kk[m+1]; - rhoBC[QIN.kQ] = (real)0.f; - vx[QIN.kQ] = (real)0.f; - vy[QIN.kQ] = (real)0.f; - //vz[QIN.kQ] = u0; - vz[QIN.kQ] = (real)(u0*2.f)*((-4.f*i*i + nnx*(-2.f - 4.f*STARTOFFX) - 4.f*(-1.5f + STARTOFFX)*(0.5f + STARTOFFX) + i*(-4.f + 4.f*nnx + 8.f*STARTOFFX))*(-4.f*j*j + nny*(-2.f - 4.f*STARTOFFY) - 4.f*(-1.5f + STARTOFFY)*(0.5f + STARTOFFY) + j*(-4.f + 4.f*nny + 8.f*STARTOFFY)))/((2.f - nnx)*(2.f - nnx)*(2.f - nny)*(2.f - nny)); - //vz[QIN.kQ] = (real)(16.f*(u0*2.f)*(i-(STARTOFFX+1)-0.5f)*(li-1.5f-(i-(STARTOFFX+1)))*(j-(STARTOFFY+1)-0.5f)*(lj-1.5f-(j-(STARTOFFY+1))))/(li*lj*li*lj); - //vz[QIN.kQ] = (real)(16.f*(u0*2.f)*i*j*(nx-i)*(ny-j))/(nx*nx*ny*ny); - deltaVz[QIN.kQ] = (real)0.f; - Q.q27[dirE ][QIN.kQ] = (real)-1.f; - Q.q27[dirW ][QIN.kQ] = (real)1.f; - Q.q27[dirN ][QIN.kQ] = (real)-1.f; - Q.q27[dirS ][QIN.kQ] = (real)-1.f; - Q.q27[dirT ][QIN.kQ] = (real)-1.f; - Q.q27[dirB ][QIN.kQ] = (real)-1.f; - Q.q27[dirNE ][QIN.kQ] = (real)-1.f; - Q.q27[dirSW ][QIN.kQ] = (real)1.f; - Q.q27[dirSE ][QIN.kQ] = (real)-1.f; - Q.q27[dirNW ][QIN.kQ] = (real)1.f; - Q.q27[dirTE ][QIN.kQ] = (real)-1.f; - Q.q27[dirBW ][QIN.kQ] = (real)1.f; - Q.q27[dirBE ][QIN.kQ] = (real)-1.f; - Q.q27[dirTW ][QIN.kQ] = (real)1.f; - Q.q27[dirTN ][QIN.kQ] = (real)-1.f; - Q.q27[dirBS ][QIN.kQ] = (real)-1.f; - Q.q27[dirBN ][QIN.kQ] = (real)-1.f; - Q.q27[dirTS ][QIN.kQ] = (real)-1.f; - Q.q27[dirZERO][QIN.kQ] = (real)-1.f; - Q.q27[dirTNE ][QIN.kQ] = (real)-1.f; - Q.q27[dirTSW ][QIN.kQ] = (real)1.f; - Q.q27[dirTSE ][QIN.kQ] = (real)-1.f; - Q.q27[dirTNW ][QIN.kQ] = (real)1.f; - Q.q27[dirBNE ][QIN.kQ] = (real)-1.f; - Q.q27[dirBSW ][QIN.kQ] = (real)1.f; - Q.q27[dirBSE ][QIN.kQ] = (real)-1.f; - Q.q27[dirBNW ][QIN.kQ] = (real)1.f; - QIN.kQ++; + QIN.k[QIN.numberOfBCnodes] = kk[m]; + QIN.kN[QIN.numberOfBCnodes] = kk[m+1]; + rhoBC[QIN.numberOfBCnodes] = (real)0.f; + vx[QIN.numberOfBCnodes] = (real)0.f; + vy[QIN.numberOfBCnodes] = (real)0.f; + //vz[QIN.numberOfBCnodes] = u0; + vz[QIN.numberOfBCnodes] = (real)(u0*2.f)*((-4.f*i*i + nnx*(-2.f - 4.f*STARTOFFX) - 4.f*(-1.5f + STARTOFFX)*(0.5f + STARTOFFX) + i*(-4.f + 4.f*nnx + 8.f*STARTOFFX))*(-4.f*j*j + nny*(-2.f - 4.f*STARTOFFY) - 4.f*(-1.5f + STARTOFFY)*(0.5f + STARTOFFY) + j*(-4.f + 4.f*nny + 8.f*STARTOFFY)))/((2.f - nnx)*(2.f - nnx)*(2.f - nny)*(2.f - nny)); + //vz[QIN.numberOfBCnodes] = (real)(16.f*(u0*2.f)*(i-(STARTOFFX+1)-0.5f)*(li-1.5f-(i-(STARTOFFX+1)))*(j-(STARTOFFY+1)-0.5f)*(lj-1.5f-(j-(STARTOFFY+1))))/(li*lj*li*lj); + //vz[QIN.numberOfBCnodes] = (real)(16.f*(u0*2.f)*i*j*(nx-i)*(ny-j))/(nx*nx*ny*ny); + deltaVz[QIN.numberOfBCnodes] = (real)0.f; + Q.q27[DIR_P00 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_M00 ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_0P0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0M0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_00P ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_00M ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PP0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MM0 ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_PM0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MP0 ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_P0P ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_M0M ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_P0M ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_M0P ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_0PP ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0MM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0PM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0MP ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_000][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PPP ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MMP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_PMP ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MPP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_PPM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MMM ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_PMM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_MPM ][QIN.numberOfBCnodes] = (real)1.f; + QIN.numberOfBCnodes++; } } } @@ -1129,8 +1181,13 @@ void findQPressX0(Parameter* para, int lev) //////////////////////////////////////////////////////////////////////////////// void findKforQPressX0(Parameter* para, int lev) { + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + VF_LOG_CRITICAL("findKforQPressX0() is deprecated! - see comment above for more information"); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// + ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// //int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; //int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; @@ -1139,14 +1196,14 @@ void findKforQPressX0(Parameter* para, int lev) //unsigned int mm; unsigned int i, j, k, m, l; real test = (real) 0.f; - int nx = para->getParH(lev)->nx; - int ny = para->getParH(lev)->ny; - //unsigned int nnx = para->getParH(lev)->gridNX; - unsigned int nny = para->getParH(lev)->gridNY; - unsigned int nnz = para->getParH(lev)->gridNZ; - int* geo_mat = para->getParH(lev)->geo; + int nx = para->getParH(lev)->nx; + int ny = para->getParH(lev)->ny; + //unsigned int nnx = para->getParH(lev)->gridNX; + unsigned int nny = para->getParH(lev)->gridNY; + unsigned int nnz = para->getParH(lev)->gridNZ; + int* geo_mat = para->getParH(lev)->geo; QforBoundaryConditions &QIN = para->getParH(lev)->QpressX0; - QIN.kQ = 0; + QIN.numberOfBCnodes = 0; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// i=STARTOFFX+1; @@ -1161,7 +1218,7 @@ void findKforQPressX0(Parameter* para, int lev) for(l=0;l<=26;l++){ //mm = nx*(ny*(k+ez[l]) + (j+ey[l])) + (i+ex[l]); if(ez[l]==1){ - ON[l] = (real) 1.f; + ON[l] = (real) 1.f; } else{ ON[l] = (real) 0.f; @@ -1170,9 +1227,9 @@ void findKforQPressX0(Parameter* para, int lev) } if (test>0) { - QIN.kQ++; - } - } + QIN.numberOfBCnodes++; + } + } } } } @@ -1182,61 +1239,66 @@ void findKforQPressX0(Parameter* para, int lev) //////////////////////////////////////////////////////////////////////////////// void findQPressX1(Parameter* para, int lev) { + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + VF_LOG_CRITICAL("findQPressX1() is deprecated! - see comment above for more information"); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// + ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// //int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; //int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; //int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// unsigned int i, j, k, m; - int nx = para->getParH(lev)->nx; - int ny = para->getParH(lev)->ny; - unsigned int nnx = para->getParH(lev)->gridNX; - unsigned int nny = para->getParH(lev)->gridNY; - unsigned int nnz = para->getParH(lev)->gridNZ; - int* geo_mat = para->getParH(lev)->geo; + int nx = para->getParH(lev)->nx; + int ny = para->getParH(lev)->ny; + unsigned int nnx = para->getParH(lev)->gridNX; + unsigned int nny = para->getParH(lev)->gridNY; + unsigned int nnz = para->getParH(lev)->gridNZ; + int* geo_mat = para->getParH(lev)->geo; unsigned int* kk = para->getParH(lev)->k; - //unsigned int sizeQ = para->getParH(lev)->kOutflowQ; - unsigned int sizeQ = para->getParH(lev)->QpressX1.kQ; + //unsigned int sizeQ = para->getParH(lev)->outflowBC.numberOfBCnodes; + unsigned int sizeQ = para->getParH(lev)->QpressX1.numberOfBCnodes; real* rhoBC = para->getParH(lev)->QpressX1.RhoBC; - real u0 = para->getVelocity(); - real* vx = para->getParH(lev)->QpressX1.Vx; - real* vy = para->getParH(lev)->QpressX1.Vy; - real* vz = para->getParH(lev)->QpressX1.Vz; + real u0 = para->getVelocity(); + real* vx = para->getParH(lev)->QpressX1.Vx; + real* vy = para->getParH(lev)->QpressX1.Vy; + real* vz = para->getParH(lev)->QpressX1.Vz; real*deltaVz = para->getParH(lev)->QpressX1.deltaVz; - real* QQ = para->getParH(lev)->QpressX1.q27[0]; + real* QQ = para->getParH(lev)->QpressX1.q27[0]; QforBoundaryConditions &QIN = para->getParH(lev)->QpressX1; //unsigned int nxny = nx*ny; - QIN.kQ = 0; + QIN.numberOfBCnodes = 0; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// QforBoundaryConditions Q; - Q.q27[dirE ] = &QQ[dirE *sizeQ]; - Q.q27[dirW ] = &QQ[dirW *sizeQ]; - Q.q27[dirN ] = &QQ[dirN *sizeQ]; - Q.q27[dirS ] = &QQ[dirS *sizeQ]; - Q.q27[dirT ] = &QQ[dirT *sizeQ]; - Q.q27[dirB ] = &QQ[dirB *sizeQ]; - Q.q27[dirNE ] = &QQ[dirNE *sizeQ]; - Q.q27[dirSW ] = &QQ[dirSW *sizeQ]; - Q.q27[dirSE ] = &QQ[dirSE *sizeQ]; - Q.q27[dirNW ] = &QQ[dirNW *sizeQ]; - Q.q27[dirTE ] = &QQ[dirTE *sizeQ]; - Q.q27[dirBW ] = &QQ[dirBW *sizeQ]; - Q.q27[dirBE ] = &QQ[dirBE *sizeQ]; - Q.q27[dirTW ] = &QQ[dirTW *sizeQ]; - Q.q27[dirTN ] = &QQ[dirTN *sizeQ]; - Q.q27[dirBS ] = &QQ[dirBS *sizeQ]; - Q.q27[dirBN ] = &QQ[dirBN *sizeQ]; - Q.q27[dirTS ] = &QQ[dirTS *sizeQ]; - Q.q27[dirZERO] = &QQ[dirZERO*sizeQ]; - Q.q27[dirTNE ] = &QQ[dirTNE *sizeQ]; - Q.q27[dirTSW ] = &QQ[dirTSW *sizeQ]; - Q.q27[dirTSE ] = &QQ[dirTSE *sizeQ]; - Q.q27[dirTNW ] = &QQ[dirTNW *sizeQ]; - Q.q27[dirBNE ] = &QQ[dirBNE *sizeQ]; - Q.q27[dirBSW ] = &QQ[dirBSW *sizeQ]; - Q.q27[dirBSE ] = &QQ[dirBSE *sizeQ]; - Q.q27[dirBNW ] = &QQ[dirBNW *sizeQ]; + Q.q27[DIR_P00 ] = &QQ[DIR_P00 *sizeQ]; + Q.q27[DIR_M00 ] = &QQ[DIR_M00 *sizeQ]; + Q.q27[DIR_0P0 ] = &QQ[DIR_0P0 *sizeQ]; + Q.q27[DIR_0M0 ] = &QQ[DIR_0M0 *sizeQ]; + Q.q27[DIR_00P ] = &QQ[DIR_00P *sizeQ]; + Q.q27[DIR_00M ] = &QQ[DIR_00M *sizeQ]; + Q.q27[DIR_PP0 ] = &QQ[DIR_PP0 *sizeQ]; + Q.q27[DIR_MM0 ] = &QQ[DIR_MM0 *sizeQ]; + Q.q27[DIR_PM0 ] = &QQ[DIR_PM0 *sizeQ]; + Q.q27[DIR_MP0 ] = &QQ[DIR_MP0 *sizeQ]; + Q.q27[DIR_P0P ] = &QQ[DIR_P0P *sizeQ]; + Q.q27[DIR_M0M ] = &QQ[DIR_M0M *sizeQ]; + Q.q27[DIR_P0M ] = &QQ[DIR_P0M *sizeQ]; + Q.q27[DIR_M0P ] = &QQ[DIR_M0P *sizeQ]; + Q.q27[DIR_0PP ] = &QQ[DIR_0PP *sizeQ]; + Q.q27[DIR_0MM ] = &QQ[DIR_0MM *sizeQ]; + Q.q27[DIR_0PM ] = &QQ[DIR_0PM *sizeQ]; + Q.q27[DIR_0MP ] = &QQ[DIR_0MP *sizeQ]; + Q.q27[DIR_000] = &QQ[DIR_000*sizeQ]; + Q.q27[DIR_PPP ] = &QQ[DIR_PPP *sizeQ]; + Q.q27[DIR_MMP ] = &QQ[DIR_MMP *sizeQ]; + Q.q27[DIR_PMP ] = &QQ[DIR_PMP *sizeQ]; + Q.q27[DIR_MPP ] = &QQ[DIR_MPP *sizeQ]; + Q.q27[DIR_PPM ] = &QQ[DIR_PPM *sizeQ]; + Q.q27[DIR_MMM ] = &QQ[DIR_MMM *sizeQ]; + Q.q27[DIR_PMM ] = &QQ[DIR_PMM *sizeQ]; + Q.q27[DIR_MPM ] = &QQ[DIR_MPM *sizeQ]; //unsigned int li = ((nnx+STARTOFFX-2)-(STARTOFFX+1)-1); @@ -1249,44 +1311,44 @@ void findQPressX1(Parameter* para, int lev) //for(i=STARTOFFX+1; i<=nnx+STARTOFFX-2 ; i++){ m = nx*(ny*k + j) + i; if(geo_mat[m]==GEO_FLUID){ - QIN.k[QIN.kQ] = kk[m]; - QIN.kN[QIN.kQ] = kk[m-1]; - rhoBC[QIN.kQ] = (real)0.f; - vx[QIN.kQ] = (real)0.f; - vy[QIN.kQ] = (real)0.f; - //vz[QIN.kQ] = u0; - vz[QIN.kQ] = (real)(u0*2.f)*((-4.f*i*i + nnx*(-2.f - 4.f*STARTOFFX) - 4.f*(-1.5f + STARTOFFX)*(0.5f + STARTOFFX) + i*(-4.f + 4.f*nnx + 8.f*STARTOFFX))*(-4.f*j*j + nny*(-2.f - 4.f*STARTOFFY) - 4.f*(-1.5f + STARTOFFY)*(0.5f + STARTOFFY) + j*(-4.f + 4.f*nny + 8.f*STARTOFFY)))/((2.f - nnx)*(2.f - nnx)*(2.f - nny)*(2.f - nny)); - //vz[QIN.kQ] = (real)(16.f*(u0*2.f)*(i-(STARTOFFX+1)-0.5f)*(li-1.5f-(i-(STARTOFFX+1)))*(j-(STARTOFFY+1)-0.5f)*(lj-1.5f-(j-(STARTOFFY+1))))/(li*lj*li*lj); - //vz[QIN.kQ] = (real)(16.f*(u0*2.f)*i*j*(nx-i)*(ny-j))/(nx*nx*ny*ny); - deltaVz[QIN.kQ] = (real)0.f; - Q.q27[dirE ][QIN.kQ] = (real)1.f; - Q.q27[dirW ][QIN.kQ] = (real)-1.f; - Q.q27[dirN ][QIN.kQ] = (real)-1.f; - Q.q27[dirS ][QIN.kQ] = (real)-1.f; - Q.q27[dirT ][QIN.kQ] = (real)-1.f; - Q.q27[dirB ][QIN.kQ] = (real)-1.f; - Q.q27[dirNE ][QIN.kQ] = (real)1.f; - Q.q27[dirSW ][QIN.kQ] = (real)-1.f; - Q.q27[dirSE ][QIN.kQ] = (real)1.f; - Q.q27[dirNW ][QIN.kQ] = (real)-1.f; - Q.q27[dirTE ][QIN.kQ] = (real)1.f; - Q.q27[dirBW ][QIN.kQ] = (real)-1.f; - Q.q27[dirBE ][QIN.kQ] = (real)1.f; - Q.q27[dirTW ][QIN.kQ] = (real)-1.f; - Q.q27[dirTN ][QIN.kQ] = (real)-1.f; - Q.q27[dirBS ][QIN.kQ] = (real)-1.f; - Q.q27[dirBN ][QIN.kQ] = (real)-1.f; - Q.q27[dirTS ][QIN.kQ] = (real)-1.f; - Q.q27[dirZERO][QIN.kQ] = (real)-1.f; - Q.q27[dirTNE ][QIN.kQ] = (real)1.f; - Q.q27[dirTSW ][QIN.kQ] = (real)-1.f; - Q.q27[dirTSE ][QIN.kQ] = (real)1.f; - Q.q27[dirTNW ][QIN.kQ] = (real)-1.f; - Q.q27[dirBNE ][QIN.kQ] = (real)1.f; - Q.q27[dirBSW ][QIN.kQ] = (real)-1.f; - Q.q27[dirBSE ][QIN.kQ] = (real)1.f; - Q.q27[dirBNW ][QIN.kQ] = (real)-1.f; - QIN.kQ++; + QIN.k[QIN.numberOfBCnodes] = kk[m]; + QIN.kN[QIN.numberOfBCnodes] = kk[m-1]; + rhoBC[QIN.numberOfBCnodes] = (real)0.f; + vx[QIN.numberOfBCnodes] = (real)0.f; + vy[QIN.numberOfBCnodes] = (real)0.f; + //vz[QIN.numberOfBCnodes] = u0; + vz[QIN.numberOfBCnodes] = (real)(u0*2.f)*((-4.f*i*i + nnx*(-2.f - 4.f*STARTOFFX) - 4.f*(-1.5f + STARTOFFX)*(0.5f + STARTOFFX) + i*(-4.f + 4.f*nnx + 8.f*STARTOFFX))*(-4.f*j*j + nny*(-2.f - 4.f*STARTOFFY) - 4.f*(-1.5f + STARTOFFY)*(0.5f + STARTOFFY) + j*(-4.f + 4.f*nny + 8.f*STARTOFFY)))/((2.f - nnx)*(2.f - nnx)*(2.f - nny)*(2.f - nny)); + //vz[QIN.numberOfBCnodes] = (real)(16.f*(u0*2.f)*(i-(STARTOFFX+1)-0.5f)*(li-1.5f-(i-(STARTOFFX+1)))*(j-(STARTOFFY+1)-0.5f)*(lj-1.5f-(j-(STARTOFFY+1))))/(li*lj*li*lj); + //vz[QIN.numberOfBCnodes] = (real)(16.f*(u0*2.f)*i*j*(nx-i)*(ny-j))/(nx*nx*ny*ny); + deltaVz[QIN.numberOfBCnodes] = (real)0.f; + Q.q27[DIR_P00 ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_M00 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0P0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0M0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_00P ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_00M ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PP0 ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_MM0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PM0 ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_MP0 ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_P0P ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_M0M ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_P0M ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_M0P ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0PP ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0MM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0PM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_0MP ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_000][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PPP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_MMP ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PMP ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_MPP ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PPM ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_MMM ][QIN.numberOfBCnodes] = (real)-1.f; + Q.q27[DIR_PMM ][QIN.numberOfBCnodes] = (real)1.f; + Q.q27[DIR_MPM ][QIN.numberOfBCnodes] = (real)-1.f; + QIN.numberOfBCnodes++; } } } @@ -1295,8 +1357,13 @@ void findQPressX1(Parameter* para, int lev) //////////////////////////////////////////////////////////////////////////////// void findKforQPressX1(Parameter* para, int lev) { + // ! CAUTION ! Do not use this function! + // As the order of the distributions was changed in July 2022, this does not work anymore. + // https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/14 + VF_LOG_CRITICAL("findKforQPressX1() is deprecated! - see comment above for more information"); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////// E W N S T B NE SW SE NW TE BW BE TW TN BS BN TS ZERO TNE BNE TSE BSE TNW BNW TSW BSW //////////////////////// + ////////////// DIR_P00 DIR_M00 DIR_0P0 DIR_0M0 DIR_00P DIR_00M DIR_PP0 DIR_MM0 DIR_PM0 DIR_MP0 DIR_P0P DIR_M0M DIR_P0M DIR_M0P DIR_0PP DIR_0MM DIR_0PM DIR_0MP ZERO DIR_PPP DIR_PPM DIR_PMP DIR_PMM DIR_MPP DIR_MPM DIR_MMP DIR_MMM //////////////////////// //int ex[27]={ 1, -1, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}; //int ey[27]={ 0, 0, 1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 1, 1, -1, -1, 1, 1, -1, -1}; int ez[27]={ 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, -1, 1, 1, -1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1}; @@ -1305,14 +1372,14 @@ void findKforQPressX1(Parameter* para, int lev) //unsigned int mm; unsigned int i, j, k, m, l; real test = (real) 0.f; - int nx = para->getParH(lev)->nx; - int ny = para->getParH(lev)->ny; - unsigned int nnx = para->getParH(lev)->gridNX; - unsigned int nny = para->getParH(lev)->gridNY; - unsigned int nnz = para->getParH(lev)->gridNZ; - int* geo_mat = para->getParH(lev)->geo; + int nx = para->getParH(lev)->nx; + int ny = para->getParH(lev)->ny; + unsigned int nnx = para->getParH(lev)->gridNX; + unsigned int nny = para->getParH(lev)->gridNY; + unsigned int nnz = para->getParH(lev)->gridNZ; + int* geo_mat = para->getParH(lev)->geo; QforBoundaryConditions &QIN = para->getParH(lev)->QpressX1; - QIN.kQ = 0; + QIN.numberOfBCnodes = 0; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// i=nnx+STARTOFFX-3; @@ -1327,7 +1394,7 @@ void findKforQPressX1(Parameter* para, int lev) for(l=0;l<=26;l++){ //mm = nx*(ny*(k+ez[l]) + (j+ey[l])) + (i+ex[l]); if(ez[l]==1){ - ON[l] = (real) 1.f; + ON[l] = (real) 1.f; } else{ ON[l] = (real) 0.f; @@ -1336,9 +1403,9 @@ void findKforQPressX1(Parameter* para, int lev) } if (test>0) { - QIN.kQ++; - } - } + QIN.numberOfBCnodes++; + } + } } } } diff --git a/src/gpu/VirtualFluids_GPU/FindQ/FindQ.h b/src/gpu/VirtualFluids_GPU/FindQ/FindQ.h index 54ccfd62dfe25adac799530f74c6d6c764efcb50..551205bd54d9685e9aa6ab8be47ac9e274546f40 100644 --- a/src/gpu/VirtualFluids_GPU/FindQ/FindQ.h +++ b/src/gpu/VirtualFluids_GPU/FindQ/FindQ.h @@ -2,44 +2,45 @@ #define FIND_Q_H #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include "Parameter/Parameter.h" -extern "C" void findQ(Parameter* para, int lev); +void findQ(Parameter* para, int lev); -extern "C" void findKforQ(Parameter* para, int lev); +void findKforQ(Parameter* para, int lev); -extern "C" void findQ_MG(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, unsigned int* kk, unsigned int sizeQ, real* QQ, QforBoundaryConditions &QIN); +void findQ_MG(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, unsigned int* kk, unsigned int sizeQ, real* QQ, QforBoundaryConditions &QIN); -extern "C" void findKforQ_MG(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, QforBoundaryConditions &QIN); +void findKforQ_MG(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, QforBoundaryConditions &QIN); -extern "C" void findQInflow(Parameter* para); +void findQInflow(Parameter* para); -extern "C" void findKforQInflow(Parameter* para); +void findKforQInflow(Parameter* para); -extern "C" void findQPressInflow(Parameter* para); +void findQPressInflow(Parameter* para); -extern "C" void findKforQPressInflow(Parameter* para); +void findKforQPressInflow(Parameter* para); -extern "C" void findQOutflow(Parameter* para); +void findQOutflow(Parameter* para); -extern "C" void findKforQOutflow(Parameter* para); +void findKforQOutflow(Parameter* para); -//extern "C" void findQSchlaff( int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, unsigned int* kk, +// TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 +//void findQSchlaff( int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, unsigned int* kk, // unsigned int sizeQN, real* vxN, real* vyN, real* vzN, real*deltaVN, real* QQN, QforBoundaryConditions &QNin, // unsigned int sizeQS, real* vxS, real* vyS, real* vzS, real*deltaVS, real* QQS, QforBoundaryConditions &QSin, // unsigned int sizeQE, real* vxE, real* vyE, real* vzE, real*deltaVE, real* QQE, QforBoundaryConditions &QEin, // unsigned int sizeQW, real* vxW, real* vyW, real* vzW, real*deltaVW, real* QQW, QforBoundaryConditions &QWin); // -//extern "C" void findKforQSchlaff(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, QforBoundaryConditions &QN, QforBoundaryConditions &QS, QforBoundaryConditions &QE, QforBoundaryConditions &QW); +//void findKforQSchlaff(int nx, int ny, unsigned int nnx, unsigned int nny, unsigned int nnz, int* geo_mat, QforBoundaryConditions &QN, QforBoundaryConditions &QS, QforBoundaryConditions &QE, QforBoundaryConditions &QW); -extern "C" void findKforQPressX1(Parameter* para, int lev); +void findKforQPressX1(Parameter* para, int lev); -extern "C" void findQPressX1(Parameter* para, int lev); +void findQPressX1(Parameter* para, int lev); -extern "C" void findKforQPressX0(Parameter* para, int lev); +void findKforQPressX0(Parameter* para, int lev); -extern "C" void findQPressX0(Parameter* para, int lev); +void findQPressX0(Parameter* para, int lev); #endif diff --git a/src/gpu/VirtualFluids_GPU/GPU/AdvecDiffBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/AdvecDiffBCs27.cu deleted file mode 100644 index 0643e59cc3052d1cfb67b5c3e59ed531d54625de..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/GPU/AdvecDiffBCs27.cu +++ /dev/null @@ -1,6759 +0,0 @@ -/* Device code */ -#include "LBM/LB.h" -#include "LBM/D3Q27.h" - -#include <lbm/constants/NumericConstants.h> - -using namespace vf::lbm::constant; - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QADPress7( int inx, - int iny, - real* DD, - real* DD7, - real* temp, - real* velo, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - - Distributions7 D7; - if (evenOrOdd==true) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - ////////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB;//, - // *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - // *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - // *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - // *q_dirBSE, *q_dirBNW; - - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - //q_dirNE = &QQ[dirNE *sizeQ]; - //q_dirSW = &QQ[dirSW *sizeQ]; - //q_dirSE = &QQ[dirSE *sizeQ]; - //q_dirNW = &QQ[dirNW *sizeQ]; - //q_dirTE = &QQ[dirTE *sizeQ]; - //q_dirBW = &QQ[dirBW *sizeQ]; - //q_dirBE = &QQ[dirBE *sizeQ]; - //q_dirTW = &QQ[dirTW *sizeQ]; - //q_dirTN = &QQ[dirTN *sizeQ]; - //q_dirBS = &QQ[dirBS *sizeQ]; - //q_dirBN = &QQ[dirBN *sizeQ]; - //q_dirTS = &QQ[dirTS *sizeQ]; - //q_dirTNE = &QQ[dirTNE *sizeQ]; - //q_dirTSW = &QQ[dirTSW *sizeQ]; - //q_dirTSE = &QQ[dirTSE *sizeQ]; - //q_dirTNW = &QQ[dirTNW *sizeQ]; - //q_dirBNE = &QQ[dirBNE *sizeQ]; - //q_dirBSW = &QQ[dirBSW *sizeQ]; - //q_dirBSE = &QQ[dirBSE *sizeQ]; - //q_dirBNW = &QQ[dirBNW *sizeQ]; - ////////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, - f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - /*real drho*/; - //real vx1_Inflow = zero; - //real vx2_Inflow = zero; - //real vx3_Inflow = velo[k]; - //real ux_sq_Inflow = vx1_Inflow * vx1_Inflow; - //real uy_sq_Inflow = vx2_Inflow * vx2_Inflow; - //real uz_sq_Inflow = vx3_Inflow * vx3_Inflow; - - - //drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - // f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - // f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); - - //real vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - // (f_E - f_W); - - //real vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - // (f_N - f_S); - - //real vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - // (f_T - f_B); - - real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+ ((D.f[dirZERO])[kzero]); - real rho = rho0 + c1o1; - real OORho = c1o1/rho; - real vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - real vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - real vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - - //real cu_sq =1.5*(vx1*vx1+vx2*vx2+vx3*vx3); - real ux_sq = vx1 * vx1; - real uy_sq = vx2 * vx2; - real uz_sq = vx3 * vx3; - real omegaD = c3o1 - sqrt(c3o1); - real Lam = -(c1o2-c1o1/omegaD); - real nue_d = Lam/c3o1; - //real ae = zero; - real ae = diffusivity/nue_d - c1o1; - - real f7_ZERO,f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; - real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; - real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; - //real TempD = temp[k]; - - - f7_ZERO = (D7.f[0])[kzero]; - f7_W = (D7.f[1])[ke ]; - f7_E = (D7.f[2])[kw ]; - f7_S = (D7.f[3])[kn ]; - f7_N = (D7.f[4])[ks ]; - f7_B = (D7.f[5])[kt ]; - f7_T = (D7.f[6])[kb ]; - - real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; - - //feq7_ZERO = ConcD*(c1o3*(ae*(-3.0))-(ux_sq+uy_sq+uz_sq)); - feq7_E = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)+vx1*c1o2); - feq7_W = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)-vx1*c1o2); - feq7_N = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)+vx2*c1o2); - feq7_S = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)-vx2*c1o2); - feq7_T = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)+vx3*c1o2); - feq7_B = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)-vx3*c1o2); - - //feq7_ZERO = TempD*(c1o3*(ae*(-3.0f))-(ux_sq+uy_sq+uz_sq)); - feqW7_E = feq7_E;// TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)+vx1_Inflow*c1o2); - feqW7_W = feq7_W;// TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)-vx1_Inflow*c1o2); - feqW7_N = feq7_N;// TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)+vx2_Inflow*c1o2); - feqW7_S = feq7_S;// TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)-vx2_Inflow*c1o2); - feqW7_T = feq7_T;// TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)+vx3_Inflow*c1o2); - feqW7_B = feq7_B;// TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)-vx3_Inflow*c1o2); - - ////////////////////////////////////////////////////////////////////////// - //pointertausch - if (evenOrOdd==false) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=0.1f; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //(D7.f[1])[ke ] = f7_E - feq7_E + feqW7_W; //E - //(D7.f[2])[kw ] = f7_W - feq7_W + feqW7_E; //W - //(D7.f[3])[kn ] = f7_N - feq7_N + feqW7_S; //N - //(D7.f[4])[ks ] = f7_S - feq7_S + feqW7_N; //S - //(D7.f[5])[kt ] = f7_T - feq7_T + feqW7_B; //T - //(D7.f[6])[kb ] = f7_B - feq7_B + feqW7_T; //B - - ////////////////////////////////////////////////////////////////////////// - //mit Q's - real /*feq,*/ q; - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[2])[kw]=(c2o1*feqW7_W-(f7_E*(q*omegaD-c1o1)-omegaD*feq7_E*(q-c1o1))/(omegaD-c1o1)+f7_W*q)/(q+c1o1);//f7_W - feq7_W + feqW7_E; - } - - q = q_dirW[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[1])[ke]=(c2o1*feqW7_E-(f7_W*(q*omegaD-c1o1)-omegaD*feq7_W*(q-c1o1))/(omegaD-c1o1)+f7_E*q)/(q+c1o1);//f7_E - feq7_E + feqW7_W; - } - - q = q_dirN[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[4])[ks]=(c2o1*feqW7_S-(f7_N*(q*omegaD-1.)-omegaD*feq7_N*(q-c1o1))/(omegaD-c1o1)+f7_S*q)/(q+c1o1);//f7_S - feq7_S + feqW7_N; - } - - q = q_dirS[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[3])[kn]=(c2o1*feqW7_N-(f7_S*(q*omegaD-c1o1)-omegaD*feq7_S*(q-c1o1))/(omegaD-c1o1)+f7_N*q)/(q+c1o1);//f7_N - feq7_N + feqW7_S; - } - - q = q_dirT[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[6])[kb]=(c2o1*feqW7_B-(f7_T*(q*omegaD-1.)-omegaD*feq7_T*(q-c1o1))/(omegaD-c1o1)+f7_B*q)/(q+c1o1);//f7_B - feq7_B + feqW7_T; - } - - q = q_dirB[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[5])[kt]=(c2o1*feqW7_T-(f7_B*(q*omegaD-c1o1)-omegaD*feq7_B*(q-c1o1))/(omegaD-c1o1)+f7_T*q)/(q+c1o1);//f7_T - feq7_T + feqW7_B; - } - - //////////////////////////////////////////////////////////////////////////// - ////ohne Q's - //real /*feq,*/ q; - //q = q_dirE[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[2])[kw]=f7_W - feq7_W + feqW7_E; - //} - - //q = q_dirW[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[1])[ke]=f7_E - feq7_E + feqW7_W; - //} - - //q = q_dirN[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[4])[ks]=f7_S - feq7_S + feqW7_N; - //} - - //q = q_dirS[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[3])[kn]=f7_N - feq7_N + feqW7_S; - //} - - //q = q_dirT[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[6])[kb]=f7_B - feq7_B + feqW7_T; - //} - - //q = q_dirB[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[5])[kt]=f7_T - feq7_T + feqW7_B; - //} - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QADPress27( int inx, - int iny, - real* DD, - real* DD27, - real* temp, - real* velo, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - - Distributions27 D27; - if (evenOrOdd==true) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; - //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - real f_ZERO = (D.f[dirZERO])[kzero]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real vx1, vx2, vx3, /*drho, feq,*/ q; - //drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - // f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - // f_T + f_B + f_N + f_S + f_E + f_W + f_ZERO; - - //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - // (f_E - f_W); - - - //vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - // (f_N - f_S); - - //vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - // (f_T - f_B); - real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+ f_ZERO; - real rho = rho0 + c1o1; - real OORho = c1o1/rho; - vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - //////////////////////////////////////////////////////////////////////////////// - real f27_W = (D27.f[dirE ])[ke ]; - real f27_E = (D27.f[dirW ])[kw ]; - real f27_S = (D27.f[dirN ])[kn ]; - real f27_N = (D27.f[dirS ])[ks ]; - real f27_B = (D27.f[dirT ])[kt ]; - real f27_T = (D27.f[dirB ])[kb ]; - real f27_SW = (D27.f[dirNE ])[kne ]; - real f27_NE = (D27.f[dirSW ])[ksw ]; - real f27_NW = (D27.f[dirSE ])[kse ]; - real f27_SE = (D27.f[dirNW ])[knw ]; - real f27_BW = (D27.f[dirTE ])[kte ]; - real f27_TE = (D27.f[dirBW ])[kbw ]; - real f27_TW = (D27.f[dirBE ])[kbe ]; - real f27_BE = (D27.f[dirTW ])[ktw ]; - real f27_BS = (D27.f[dirTN ])[ktn ]; - real f27_TN = (D27.f[dirBS ])[kbs ]; - real f27_TS = (D27.f[dirBN ])[kbn ]; - real f27_BN = (D27.f[dirTS ])[kts ]; - real f27_ZERO = (D27.f[dirZERO])[kzero]; - real f27_BSW = (D27.f[dirTNE ])[ktne ]; - real f27_BNE = (D27.f[dirTSW ])[ktsw ]; - real f27_BNW = (D27.f[dirTSE ])[ktse ]; - real f27_BSE = (D27.f[dirTNW ])[ktnw ]; - real f27_TSW = (D27.f[dirBNE ])[kbne ]; - real f27_TNE = (D27.f[dirBSW ])[kbsw ]; - real f27_TNW = (D27.f[dirBSE ])[kbse ]; - real f27_TSE = (D27.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - //////////////////////////////////////////////////////////////////////////////// - real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + - f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + - f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; - - ////real feq27_ZERO = c8over27* ConcD*(one-cu_sq); - //real feq27_E = c2over27* (ConcD+(one+ConcD)*(three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq)); - //real feq27_W = c2over27* (ConcD+(one+ConcD)*(three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq)); - //real feq27_N = c2over27* (ConcD+(one+ConcD)*(three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq)); - //real feq27_S = c2over27* (ConcD+(one+ConcD)*(three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq)); - //real feq27_T = c2over27* (ConcD+(one+ConcD)*(three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq)); - //real feq27_B = c2over27* (ConcD+(one+ConcD)*(three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq)); - //real feq27_NE = c1over54* (ConcD+(one+ConcD)*(three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - //real feq27_SW = c1over54* (ConcD+(one+ConcD)*(three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - //real feq27_SE = c1over54* (ConcD+(one+ConcD)*(three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - //real feq27_NW = c1over54* (ConcD+(one+ConcD)*(three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - //real feq27_TE = c1over54* (ConcD+(one+ConcD)*(three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - //real feq27_BW = c1over54* (ConcD+(one+ConcD)*(three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - //real feq27_BE = c1over54* (ConcD+(one+ConcD)*(three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - //real feq27_TW = c1over54* (ConcD+(one+ConcD)*(three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - //real feq27_TN = c1over54* (ConcD+(one+ConcD)*(three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - //real feq27_BS = c1over54* (ConcD+(one+ConcD)*(three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - //real feq27_BN = c1over54* (ConcD+(one+ConcD)*(three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - //real feq27_TS = c1over54* (ConcD+(one+ConcD)*(three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - //real feq27_TNE = c1over216*(ConcD+(one+ConcD)*(three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - //real feq27_BSW = c1over216*(ConcD+(one+ConcD)*(three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - //real feq27_BNE = c1over216*(ConcD+(one+ConcD)*(three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - //real feq27_TSW = c1over216*(ConcD+(one+ConcD)*(three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - //real feq27_TSE = c1over216*(ConcD+(one+ConcD)*(three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - //real feq27_BNW = c1over216*(ConcD+(one+ConcD)*(three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - //real feq27_BSE = c1over216*(ConcD+(one+ConcD)*(three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - //real feq27_TNW = c1over216*(ConcD+(one+ConcD)*(three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); - // - real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //real TempD = temp[k]; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // velocity inflow - //vx1 = zero; - //vx2 = zero; - //vx3 = velo[k]; - - //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); - real feqW27_E = feq27_E ;// c2over27* TempD*(one+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq); - real feqW27_W = feq27_W ;// c2over27* TempD*(one+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq); - real feqW27_N = feq27_N ;// c2over27* TempD*(one+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq); - real feqW27_S = feq27_S ;// c2over27* TempD*(one+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq); - real feqW27_T = feq27_T ;// c2over27* TempD*(one+three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq); - real feqW27_B = feq27_B ;// c2over27* TempD*(one+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq); - real feqW27_NE = feq27_NE ;// c1over54* TempD*(one+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - real feqW27_SW = feq27_SW ;// c1over54* TempD*(one+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - real feqW27_SE = feq27_SE ;// c1over54* TempD*(one+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - real feqW27_NW = feq27_NW ;// c1over54* TempD*(one+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - real feqW27_TE = feq27_TE ;// c1over54* TempD*(one+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - real feqW27_BW = feq27_BW ;// c1over54* TempD*(one+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - real feqW27_BE = feq27_BE ;// c1over54* TempD*(one+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - real feqW27_TW = feq27_TW ;// c1over54* TempD*(one+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - real feqW27_TN = feq27_TN ;// c1over54* TempD*(one+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq); - real feqW27_BS = feq27_BS ;// c1over54* TempD*(one+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - real feqW27_BN = feq27_BN ;// c1over54* TempD*(one+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq); - real feqW27_TS = feq27_TS ;// c1over54* TempD*(one+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - real feqW27_TNE = feq27_TNE;// c1over216*TempD*(one+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - real feqW27_BSW = feq27_BSW;// c1over216*TempD*(one+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - real feqW27_BNE = feq27_BNE;// c1over216*TempD*(one+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - real feqW27_TSW = feq27_TSW;// c1over216*TempD*(one+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - real feqW27_TSE = feq27_TSE;// c1over216*TempD*(one+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - real feqW27_BNW = feq27_BNW;// c1over216*TempD*(one+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - real feqW27_BSE = feq27_BSE;// c1over216*TempD*(one+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - real feqW27_TNW = feq27_TNW;// c1over216*TempD*(one+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real omegaD = c3o1 - sqrt(c3o1); - //real Lam = -(c1o2-one/omegaD); - //real nue_d = Lam/three; - //real ae = zero; - //real ae = diffusivity/nue_d - one; - - - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirW ])[kw ]=(c2o1*feqW27_W -(f27_E *(q*omegaD-c1o1)-omegaD*feq27_E *(q-c1o1))/(omegaD-c1o1)+f27_W *q)/(q+c1o1); - q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirE ])[ke ]=(c2o1*feqW27_E -(f27_W *(q*omegaD-c1o1)-omegaD*feq27_W *(q-c1o1))/(omegaD-c1o1)+f27_E *q)/(q+c1o1); - q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirS ])[ks ]=(c2o1*feqW27_S -(f27_N *(q*omegaD-c1o1)-omegaD*feq27_N *(q-c1o1))/(omegaD-c1o1)+f27_S *q)/(q+c1o1); - q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirN ])[kn ]=(c2o1*feqW27_N -(f27_S *(q*omegaD-c1o1)-omegaD*feq27_S *(q-c1o1))/(omegaD-c1o1)+f27_N *q)/(q+c1o1); - q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirB ])[kb ]=(c2o1*feqW27_B -(f27_T *(q*omegaD-c1o1)-omegaD*feq27_T *(q-c1o1))/(omegaD-c1o1)+f27_B *q)/(q+c1o1); - q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirT ])[kt ]=(c2o1*feqW27_T -(f27_B *(q*omegaD-c1o1)-omegaD*feq27_B *(q-c1o1))/(omegaD-c1o1)+f27_T *q)/(q+c1o1); - q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSW ])[ksw ]=(c2o1*feqW27_SW -(f27_NE *(q*omegaD-c1o1)-omegaD*feq27_NE *(q-c1o1))/(omegaD-c1o1)+f27_SW *q)/(q+c1o1); - q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNE ])[kne ]=(c2o1*feqW27_NE -(f27_SW *(q*omegaD-c1o1)-omegaD*feq27_SW *(q-c1o1))/(omegaD-c1o1)+f27_NE *q)/(q+c1o1); - q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNW ])[knw ]=(c2o1*feqW27_NW -(f27_SE *(q*omegaD-c1o1)-omegaD*feq27_SE *(q-c1o1))/(omegaD-c1o1)+f27_NW *q)/(q+c1o1); - q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSE ])[kse ]=(c2o1*feqW27_SE -(f27_NW *(q*omegaD-c1o1)-omegaD*feq27_NW *(q-c1o1))/(omegaD-c1o1)+f27_SE *q)/(q+c1o1); - q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBW ])[kbw ]=(c2o1*feqW27_BW -(f27_TE *(q*omegaD-c1o1)-omegaD*feq27_TE *(q-c1o1))/(omegaD-c1o1)+f27_BW *q)/(q+c1o1); - q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTE ])[kte ]=(c2o1*feqW27_TE -(f27_BW *(q*omegaD-c1o1)-omegaD*feq27_BW *(q-c1o1))/(omegaD-c1o1)+f27_TE *q)/(q+c1o1); - q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTW ])[ktw ]=(c2o1*feqW27_TW -(f27_BE *(q*omegaD-c1o1)-omegaD*feq27_BE *(q-c1o1))/(omegaD-c1o1)+f27_TW *q)/(q+c1o1); - q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBE ])[kbe ]=(c2o1*feqW27_BE -(f27_TW *(q*omegaD-c1o1)-omegaD*feq27_TW *(q-c1o1))/(omegaD-c1o1)+f27_BE *q)/(q+c1o1); - q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBS ])[kbs ]=(c2o1*feqW27_BS -(f27_TN *(q*omegaD-c1o1)-omegaD*feq27_TN *(q-c1o1))/(omegaD-c1o1)+f27_BS *q)/(q+c1o1); - q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTN ])[ktn ]=(c2o1*feqW27_TN -(f27_BS *(q*omegaD-c1o1)-omegaD*feq27_BS *(q-c1o1))/(omegaD-c1o1)+f27_TN *q)/(q+c1o1); - q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTS ])[kts ]=(c2o1*feqW27_TS -(f27_BN *(q*omegaD-c1o1)-omegaD*feq27_BN *(q-c1o1))/(omegaD-c1o1)+f27_TS *q)/(q+c1o1); - q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBN ])[kbn ]=(c2o1*feqW27_BN -(f27_TS *(q*omegaD-c1o1)-omegaD*feq27_TS *(q-c1o1))/(omegaD-c1o1)+f27_BN *q)/(q+c1o1); - q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSW])[kbsw]=(c2o1*feqW27_BSW-(f27_TNE*(q*omegaD-c1o1)-omegaD*feq27_TNE*(q-c1o1))/(omegaD-c1o1)+f27_BSW*q)/(q+c1o1); - q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNE])[ktne]=(c2o1*feqW27_TNE-(f27_BSW*(q*omegaD-c1o1)-omegaD*feq27_BSW*(q-c1o1))/(omegaD-c1o1)+f27_TNE*q)/(q+c1o1); - q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSW])[ktsw]=(c2o1*feqW27_TSW-(f27_BNE*(q*omegaD-c1o1)-omegaD*feq27_BNE*(q-c1o1))/(omegaD-c1o1)+f27_TSW*q)/(q+c1o1); - q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNE])[kbne]=(c2o1*feqW27_BNE-(f27_TSW*(q*omegaD-c1o1)-omegaD*feq27_TSW*(q-c1o1))/(omegaD-c1o1)+f27_BNE*q)/(q+c1o1); - q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNW])[kbnw]=(c2o1*feqW27_BNW-(f27_TSE*(q*omegaD-c1o1)-omegaD*feq27_TSE*(q-c1o1))/(omegaD-c1o1)+f27_BNW*q)/(q+c1o1); - q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSE])[ktse]=(c2o1*feqW27_TSE-(f27_BNW*(q*omegaD-c1o1)-omegaD*feq27_BNW*(q-c1o1))/(omegaD-c1o1)+f27_TSE*q)/(q+c1o1); - q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNW])[ktnw]=(c2o1*feqW27_TNW-(f27_BSE*(q*omegaD-c1o1)-omegaD*feq27_BSE*(q-c1o1))/(omegaD-c1o1)+f27_TNW*q)/(q+c1o1); - q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSE])[kbse]=(c2o1*feqW27_BSE-(f27_TNW*(q*omegaD-c1o1)-omegaD*feq27_TNW*(q-c1o1))/(omegaD-c1o1)+f27_BSE*q)/(q+c1o1); - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QADPressNEQNeighbor27( - real* DD, - real* DD27, - int* k_Q, - int* k_N, - int kQ, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd - ) -{ - Distributions27 D; - if (evenOrOdd == true) - { - D.f[dirE] = &DD[dirE *size_Mat]; - D.f[dirW] = &DD[dirW *size_Mat]; - D.f[dirN] = &DD[dirN *size_Mat]; - D.f[dirS] = &DD[dirS *size_Mat]; - D.f[dirT] = &DD[dirT *size_Mat]; - D.f[dirB] = &DD[dirB *size_Mat]; - D.f[dirNE] = &DD[dirNE *size_Mat]; - D.f[dirSW] = &DD[dirSW *size_Mat]; - D.f[dirSE] = &DD[dirSE *size_Mat]; - D.f[dirNW] = &DD[dirNW *size_Mat]; - D.f[dirTE] = &DD[dirTE *size_Mat]; - D.f[dirBW] = &DD[dirBW *size_Mat]; - D.f[dirBE] = &DD[dirBE *size_Mat]; - D.f[dirTW] = &DD[dirTW *size_Mat]; - D.f[dirTN] = &DD[dirTN *size_Mat]; - D.f[dirBS] = &DD[dirBS *size_Mat]; - D.f[dirBN] = &DD[dirBN *size_Mat]; - D.f[dirTS] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE] = &DD[dirTNE *size_Mat]; - D.f[dirTSW] = &DD[dirTSW *size_Mat]; - D.f[dirTSE] = &DD[dirTSE *size_Mat]; - D.f[dirTNW] = &DD[dirTNW *size_Mat]; - D.f[dirBNE] = &DD[dirBNE *size_Mat]; - D.f[dirBSW] = &DD[dirBSW *size_Mat]; - D.f[dirBSE] = &DD[dirBSE *size_Mat]; - D.f[dirBNW] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW] = &DD[dirE *size_Mat]; - D.f[dirE] = &DD[dirW *size_Mat]; - D.f[dirS] = &DD[dirN *size_Mat]; - D.f[dirN] = &DD[dirS *size_Mat]; - D.f[dirB] = &DD[dirT *size_Mat]; - D.f[dirT] = &DD[dirB *size_Mat]; - D.f[dirSW] = &DD[dirNE *size_Mat]; - D.f[dirNE] = &DD[dirSW *size_Mat]; - D.f[dirNW] = &DD[dirSE *size_Mat]; - D.f[dirSE] = &DD[dirNW *size_Mat]; - D.f[dirBW] = &DD[dirTE *size_Mat]; - D.f[dirTE] = &DD[dirBW *size_Mat]; - D.f[dirTW] = &DD[dirBE *size_Mat]; - D.f[dirBE] = &DD[dirTW *size_Mat]; - D.f[dirBS] = &DD[dirTN *size_Mat]; - D.f[dirTN] = &DD[dirBS *size_Mat]; - D.f[dirTS] = &DD[dirBN *size_Mat]; - D.f[dirBN] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE] = &DD[dirBSW *size_Mat]; - D.f[dirTSW] = &DD[dirBNE *size_Mat]; - D.f[dirTSE] = &DD[dirBNW *size_Mat]; - D.f[dirTNW] = &DD[dirBSE *size_Mat]; - D.f[dirBNE] = &DD[dirTSW *size_Mat]; - D.f[dirBSW] = &DD[dirTNE *size_Mat]; - D.f[dirBSE] = &DD[dirTNW *size_Mat]; - D.f[dirBNW] = &DD[dirTSE *size_Mat]; - } - - Distributions27 D27; - if (evenOrOdd == true) - { - D27.f[dirE] = &DD27[dirE *size_Mat]; - D27.f[dirW] = &DD27[dirW *size_Mat]; - D27.f[dirN] = &DD27[dirN *size_Mat]; - D27.f[dirS] = &DD27[dirS *size_Mat]; - D27.f[dirT] = &DD27[dirT *size_Mat]; - D27.f[dirB] = &DD27[dirB *size_Mat]; - D27.f[dirNE] = &DD27[dirNE *size_Mat]; - D27.f[dirSW] = &DD27[dirSW *size_Mat]; - D27.f[dirSE] = &DD27[dirSE *size_Mat]; - D27.f[dirNW] = &DD27[dirNW *size_Mat]; - D27.f[dirTE] = &DD27[dirTE *size_Mat]; - D27.f[dirBW] = &DD27[dirBW *size_Mat]; - D27.f[dirBE] = &DD27[dirBE *size_Mat]; - D27.f[dirTW] = &DD27[dirTW *size_Mat]; - D27.f[dirTN] = &DD27[dirTN *size_Mat]; - D27.f[dirBS] = &DD27[dirBS *size_Mat]; - D27.f[dirBN] = &DD27[dirBN *size_Mat]; - D27.f[dirTS] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW] = &DD27[dirE *size_Mat]; - D27.f[dirE] = &DD27[dirW *size_Mat]; - D27.f[dirS] = &DD27[dirN *size_Mat]; - D27.f[dirN] = &DD27[dirS *size_Mat]; - D27.f[dirB] = &DD27[dirT *size_Mat]; - D27.f[dirT] = &DD27[dirB *size_Mat]; - D27.f[dirSW] = &DD27[dirNE *size_Mat]; - D27.f[dirNE] = &DD27[dirSW *size_Mat]; - D27.f[dirNW] = &DD27[dirSE *size_Mat]; - D27.f[dirSE] = &DD27[dirNW *size_Mat]; - D27.f[dirBW] = &DD27[dirTE *size_Mat]; - D27.f[dirTE] = &DD27[dirBW *size_Mat]; - D27.f[dirTW] = &DD27[dirBE *size_Mat]; - D27.f[dirBE] = &DD27[dirTW *size_Mat]; - D27.f[dirBS] = &DD27[dirTN *size_Mat]; - D27.f[dirTN] = &DD27[dirBS *size_Mat]; - D27.f[dirTS] = &DD27[dirBN *size_Mat]; - D27.f[dirBN] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if (k < kQ) - { - //////////////////////////////////////////////////////////////////////////////// - //Fluid - BC Nodes - //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero = KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - //distributions - real f_W = (D.f[dirE])[ke]; - real f_E = (D.f[dirW])[kw]; - real f_S = (D.f[dirN])[kn]; - real f_N = (D.f[dirS])[ks]; - real f_B = (D.f[dirT])[kt]; - real f_T = (D.f[dirB])[kb]; - real f_SW = (D.f[dirNE])[kne]; - real f_NE = (D.f[dirSW])[ksw]; - real f_NW = (D.f[dirSE])[kse]; - real f_SE = (D.f[dirNW])[knw]; - real f_BW = (D.f[dirTE])[kte]; - real f_TE = (D.f[dirBW])[kbw]; - real f_TW = (D.f[dirBE])[kbe]; - real f_BE = (D.f[dirTW])[ktw]; - real f_BS = (D.f[dirTN])[ktn]; - real f_TN = (D.f[dirBS])[kbs]; - real f_TS = (D.f[dirBN])[kbn]; - real f_BN = (D.f[dirTS])[kts]; - real f_ZERO = (D.f[dirZERO])[kzero]; - real f_BSW = (D.f[dirTNE])[ktne]; - real f_BNE = (D.f[dirTSW])[ktsw]; - real f_BNW = (D.f[dirTSE])[ktse]; - real f_BSE = (D.f[dirTNW])[ktnw]; - real f_TSW = (D.f[dirBNE])[kbne]; - real f_TNE = (D.f[dirBSW])[kbsw]; - real f_TNW = (D.f[dirBSE])[kbse]; - real f_TSE = (D.f[dirBNW])[kbnw]; - //////////////////////////////////////////////////////////////////////////////// - //macroscopic values - real rho0 = - (f_TNE + f_BSW) + (f_TSW + f_BNE) + (f_TSE + f_BNW) + (f_TNW + f_BSE) + - (f_NE + f_SW ) + (f_NW + f_SE ) + (f_TE + f_BW ) + (f_BE + f_TW ) + - (f_TN + f_BS ) + (f_BN + f_TS ) + - (f_E + f_W ) + (f_N + f_S ) + (f_T + f_B ) + f_ZERO; - real rho = rho0 + c1o1; - real OORho = c1o1 / rho; - - real vx1 = - OORho*((f_TNE - f_BSW) + (f_BNE - f_TSW) + (f_TSE - f_BNW) + (f_BSE - f_TNW) + - (f_NE - f_SW) + (f_SE - f_NW) + (f_TE - f_BW) + (f_BE - f_TW) + (f_E - f_W)); - real vx2 = - OORho*((f_TNE - f_BSW) + (f_BNE - f_TSW) + (f_BNW - f_TSE) + (f_TNW - f_BSE) + - (f_NE - f_SW) + (f_NW - f_SE) + (f_TN - f_BS) + (f_BN - f_TS) + (f_N - f_S)); - real vx3 = - OORho*((f_TNE - f_BSW) + (f_TSW - f_BNE) + (f_TSE - f_BNW) + (f_TNW - f_BSE) + - (f_TE - f_BW) + (f_TW - f_BE) + (f_TN - f_BS) + (f_TS - f_BN) + (f_T - f_B)); - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //AD - BC Nodes - //////////////////////////////////////////////////////////////////////////////// - //distributions - real f27_W = (D27.f[dirE])[ke]; - real f27_E = (D27.f[dirW])[kw]; - real f27_S = (D27.f[dirN])[kn]; - real f27_N = (D27.f[dirS])[ks]; - real f27_B = (D27.f[dirT])[kt]; - real f27_T = (D27.f[dirB])[kb]; - real f27_SW = (D27.f[dirNE])[kne]; - real f27_NE = (D27.f[dirSW])[ksw]; - real f27_NW = (D27.f[dirSE])[kse]; - real f27_SE = (D27.f[dirNW])[knw]; - real f27_BW = (D27.f[dirTE])[kte]; - real f27_TE = (D27.f[dirBW])[kbw]; - real f27_TW = (D27.f[dirBE])[kbe]; - real f27_BE = (D27.f[dirTW])[ktw]; - real f27_BS = (D27.f[dirTN])[ktn]; - real f27_TN = (D27.f[dirBS])[kbs]; - real f27_TS = (D27.f[dirBN])[kbn]; - real f27_BN = (D27.f[dirTS])[kts]; - real f27_ZERO = (D27.f[dirZERO])[kzero]; - real f27_BSW = (D27.f[dirTNE])[ktne]; - real f27_BNE = (D27.f[dirTSW])[ktsw]; - real f27_BNW = (D27.f[dirTSE])[ktse]; - real f27_BSE = (D27.f[dirTNW])[ktnw]; - real f27_TSW = (D27.f[dirBNE])[kbne]; - real f27_TNE = (D27.f[dirBSW])[kbsw]; - real f27_TNW = (D27.f[dirBSE])[kbse]; - real f27_TSE = (D27.f[dirBNW])[kbnw]; - //////////////////////////////////////////////////////////////////////////////// - real cusq = c3o2*(vx1*vx1 + vx2*vx2 + vx3*vx3); - //////////////////////////////////////////////////////////////////////////////// - //concentration - real ConcD = - (f27_TNE + f27_BSW) + (f27_TSW + f27_BNE) + (f27_TSE + f27_BNW) + (f27_TNW + f27_BSE) + - (f27_NE + f27_SW ) + (f27_NW + f27_SE ) + (f27_TE + f27_BW ) + (f27_BE + f27_TW ) + - (f27_TN + f27_BS ) + (f27_BN + f27_TS ) + - (f27_E + f27_W ) + (f27_N + f27_S ) + (f27_T + f27_B ) + f27_ZERO; - //////////////////////////////////////////////////////////////////////////////// - //calculate non-equilibrium - f27_ZERO -= c8o27* (ConcD-(ConcD+c1o1)*cusq); - f27_E -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cusq)); - f27_W -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cusq)); - f27_N -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cusq)); - f27_S -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cusq)); - f27_T -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx3)+c9o2*( vx3)*( vx3)-cusq)); - f27_B -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cusq)); - f27_NE -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cusq)); - f27_SW -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cusq)); - f27_SE -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cusq)); - f27_NW -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cusq)); - f27_TE -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cusq)); - f27_BW -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cusq)); - f27_BE -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cusq)); - f27_TW -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cusq)); - f27_TN -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cusq)); - f27_BS -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cusq)); - f27_BN -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cusq)); - f27_TS -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cusq)); - f27_TNE -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cusq)); - f27_BSW -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cusq)); - f27_BNE -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cusq)); - f27_TSW -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cusq)); - f27_TSE -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cusq)); - f27_BNW -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq)); - f27_BSE -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq)); - f27_TNW -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq)); - //////////////////////////////////////////////////////////////////////////////// - ConcD = c0o1; - //////////////////////////////////////////////////////////////////////////////// - //add BC equilibrium - f27_ZERO += c8o27* (ConcD-(ConcD+c1o1)*cusq); - f27_E += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cusq)); - f27_W += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cusq)); - f27_N += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cusq)); - f27_S += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cusq)); - f27_T += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx3)+c9o2*( vx3)*( vx3)-cusq)); - f27_B += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cusq)); - f27_NE += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cusq)); - f27_SW += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cusq)); - f27_SE += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cusq)); - f27_NW += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cusq)); - f27_TE += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cusq)); - f27_BW += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cusq)); - f27_BE += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cusq)); - f27_TW += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cusq)); - f27_TN += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cusq)); - f27_BS += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cusq)); - f27_BN += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cusq)); - f27_TS += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cusq)); - f27_TNE += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cusq)); - f27_BSW += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cusq)); - f27_BNE += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cusq)); - f27_TSW += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cusq)); - f27_TSE += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cusq)); - f27_BNW += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq)); - f27_BSE += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq)); - f27_TNW += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq)); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - __syncthreads(); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Neighbors of BC Nodes - //////////////////////////////////////////////////////////////////////////////// - //index neighbor - unsigned int KNQK = k_N[k]; - unsigned int kNzero = KNQK; - unsigned int kNe = KNQK; - unsigned int kNw = neighborX[KNQK]; - unsigned int kNn = KNQK; - unsigned int kNs = neighborY[KNQK]; - unsigned int kNt = KNQK; - unsigned int kNb = neighborZ[KNQK]; - unsigned int kNsw = neighborY[kNw]; - unsigned int kNne = KNQK; - unsigned int kNse = kNs; - unsigned int kNnw = kNw; - unsigned int kNbw = neighborZ[kNw]; - unsigned int kNte = KNQK; - unsigned int kNbe = kNb; - unsigned int kNtw = kNw; - unsigned int kNbs = neighborZ[kNs]; - unsigned int kNtn = KNQK; - unsigned int kNbn = kNb; - unsigned int kNts = kNs; - unsigned int kNtse = kNs; - unsigned int kNbnw = kNbw; - unsigned int kNtnw = kNw; - unsigned int kNbse = kNbs; - unsigned int kNtsw = kNsw; - unsigned int kNbne = kNb; - unsigned int kNtne = KNQK; - unsigned int kNbsw = neighborZ[kNsw]; - //////////////////////////////////////////////////////////////////////////////// - //update distributions at neighbor nodes - (D27.f[dirE ])[kNe ] = f27_W ; - (D27.f[dirW ])[kNw ] = f27_E ; - (D27.f[dirN ])[kNn ] = f27_S ; - (D27.f[dirS ])[kNs ] = f27_N ; - (D27.f[dirT ])[kNt ] = f27_B ; - (D27.f[dirB ])[kNb ] = f27_T ; - (D27.f[dirNE ])[kNne ] = f27_SW ; - (D27.f[dirSW ])[kNsw ] = f27_NE ; - (D27.f[dirSE ])[kNse ] = f27_NW ; - (D27.f[dirNW ])[kNnw ] = f27_SE ; - (D27.f[dirTE ])[kNte ] = f27_BW ; - (D27.f[dirBW ])[kNbw ] = f27_TE ; - (D27.f[dirBE ])[kNbe ] = f27_TW ; - (D27.f[dirTW ])[kNtw ] = f27_BE ; - (D27.f[dirTN ])[kNtn ] = f27_BS ; - (D27.f[dirBS ])[kNbs ] = f27_TN ; - (D27.f[dirBN ])[kNbn ] = f27_TS ; - (D27.f[dirTS ])[kNts ] = f27_BN ; - (D27.f[dirZERO])[kNzero] = f27_ZERO; - (D27.f[dirTNE ])[kNtne ] = f27_BSW ; - (D27.f[dirTSW ])[kNtsw ] = f27_BNE ; - (D27.f[dirTSE ])[kNtse ] = f27_BNW ; - (D27.f[dirTNW ])[kNtnw ] = f27_BSE ; - (D27.f[dirBNE ])[kNbne ] = f27_TSW ; - (D27.f[dirBSW ])[kNbsw ] = f27_TNE ; - (D27.f[dirBSE ])[kNbse ] = f27_TNW ; - (D27.f[dirBNW ])[kNbnw ] = f27_TSE ; - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QADVel7( int inx, - int iny, - real* DD, - real* DD7, - real* temp, - real* velo, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - - Distributions7 D7; - if (evenOrOdd==true) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - ////////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB;//, - // *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - // *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - // *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - // *q_dirBSE, *q_dirBNW; - - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - //q_dirNE = &QQ[dirNE *sizeQ]; - //q_dirSW = &QQ[dirSW *sizeQ]; - //q_dirSE = &QQ[dirSE *sizeQ]; - //q_dirNW = &QQ[dirNW *sizeQ]; - //q_dirTE = &QQ[dirTE *sizeQ]; - //q_dirBW = &QQ[dirBW *sizeQ]; - //q_dirBE = &QQ[dirBE *sizeQ]; - //q_dirTW = &QQ[dirTW *sizeQ]; - //q_dirTN = &QQ[dirTN *sizeQ]; - //q_dirBS = &QQ[dirBS *sizeQ]; - //q_dirBN = &QQ[dirBN *sizeQ]; - //q_dirTS = &QQ[dirTS *sizeQ]; - //q_dirTNE = &QQ[dirTNE *sizeQ]; - //q_dirTSW = &QQ[dirTSW *sizeQ]; - //q_dirTSE = &QQ[dirTSE *sizeQ]; - //q_dirTNW = &QQ[dirTNW *sizeQ]; - //q_dirBNE = &QQ[dirBNE *sizeQ]; - //q_dirBSW = &QQ[dirBSW *sizeQ]; - //q_dirBSE = &QQ[dirBSE *sizeQ]; - //q_dirBNW = &QQ[dirBNW *sizeQ]; - ////////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, - f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - /*real drho*/; - real vx1_Inflow = c0o1; - real vx2_Inflow = c0o1; - real vx3_Inflow = velo[k]; - real ux_sq_Inflow = vx1_Inflow * vx1_Inflow; - real uy_sq_Inflow = vx2_Inflow * vx2_Inflow; - real uz_sq_Inflow = vx3_Inflow * vx3_Inflow; - - - ////drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - //// f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - //// f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); - - //real vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - // (f_E - f_W); - - //real vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - // (f_N - f_S); - - //real vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - // (f_T - f_B); - - real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+ ((D.f[dirZERO])[kzero]); - real rho = rho0 + c1o1; - real OORho = c1o1/rho; - real vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - real vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - real vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - - //real cu_sq =1.5f*(vx1*vx1+vx2*vx2+vx3*vx3); - real ux_sq = vx1 * vx1; - real uy_sq = vx2 * vx2; - real uz_sq = vx3 * vx3; - real omegaD = c3o1 - sqrt(c3o1); - real Lam = -(c1o2-c1o1/omegaD); - real nue_d = Lam/c3o1; - //real ae = zero; - real ae = diffusivity/nue_d - c1o1; - - real f7_ZERO,f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; - real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; - real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; - real TempD = temp[k]; - - - f7_ZERO = (D7.f[0])[kzero]; - f7_W = (D7.f[1])[ke ]; - f7_E = (D7.f[2])[kw ]; - f7_S = (D7.f[3])[kn ]; - f7_N = (D7.f[4])[ks ]; - f7_B = (D7.f[5])[kt ]; - f7_T = (D7.f[6])[kb ]; - - real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; - - //feq7_ZERO = ConcD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); - feq7_E = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)+vx1*c1o2); - feq7_W = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)-vx1*c1o2); - feq7_N = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)+vx2*c1o2); - feq7_S = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)-vx2*c1o2); - feq7_T = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)+vx3*c1o2); - feq7_B = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)-vx3*c1o2); - - //feq7_ZERO = TempD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); - feqW7_E = TempD*(c1o6*(ae+c1o1)+c1o2*(ux_sq_Inflow)+vx1_Inflow*c1o2); - feqW7_W = TempD*(c1o6*(ae+c1o1)+c1o2*(ux_sq_Inflow)-vx1_Inflow*c1o2); - feqW7_N = TempD*(c1o6*(ae+c1o1)+c1o2*(uy_sq_Inflow)+vx2_Inflow*c1o2); - feqW7_S = TempD*(c1o6*(ae+c1o1)+c1o2*(uy_sq_Inflow)-vx2_Inflow*c1o2); - feqW7_T = TempD*(c1o6*(ae+c1o1)+c1o2*(uz_sq_Inflow)+vx3_Inflow*c1o2); - feqW7_B = TempD*(c1o6*(ae+c1o1)+c1o2*(uz_sq_Inflow)-vx3_Inflow*c1o2); - - ////////////////////////////////////////////////////////////////////////// - //pointertausch - if (evenOrOdd==false) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //(D7.f[1])[ke ] = f7_E - feq7_E + feqW7_W; //E - //(D7.f[2])[kw ] = f7_W - feq7_W + feqW7_E; //W - //(D7.f[3])[kn ] = f7_N - feq7_N + feqW7_S; //N - //(D7.f[4])[ks ] = f7_S - feq7_S + feqW7_N; //S - //(D7.f[5])[kt ] = f7_T - feq7_T + feqW7_B; //T - //(D7.f[6])[kb ] = f7_B - feq7_B + feqW7_T; //B - - ////////////////////////////////////////////////////////////////////////// - //mit Q's - real /*feq,*/ q; - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[2])[kw]=(c2o1*feqW7_W-(f7_E*(q*omegaD-c1o1)-omegaD*feq7_E*(q-c1o1))/(omegaD-c1o1)+f7_W*q)/(q+c1o1);//f7_W - feq7_W + feqW7_E; - } - - q = q_dirW[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[1])[ke]=(c2o1*feqW7_E-(f7_W*(q*omegaD-c1o1)-omegaD*feq7_W*(q-c1o1))/(omegaD-c1o1)+f7_E*q)/(q+c1o1);//f7_E - feq7_E + feqW7_W; - } - - q = q_dirN[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[4])[ks]=(c2o1*feqW7_S-(f7_N*(q*omegaD-c1o1)-omegaD*feq7_N*(q-c1o1))/(omegaD-c1o1)+f7_S*q)/(q+c1o1);//f7_S - feq7_S + feqW7_N; - } - - q = q_dirS[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[3])[kn]=(c2o1*feqW7_N-(f7_S*(q*omegaD-c1o1)-omegaD*feq7_S*(q-c1o1))/(omegaD-c1o1)+f7_N*q)/(q+c1o1);//f7_N - feq7_N + feqW7_S; - } - - q = q_dirT[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[6])[kb]=(c2o1*feqW7_B-(f7_T*(q*omegaD-c1o1)-omegaD*feq7_T*(q-c1o1))/(omegaD-c1o1)+f7_B*q)/(q+c1o1);//f7_B - feq7_B + feqW7_T; - } - - q = q_dirB[k]; - if (q>=c0o1 && q<=c1o1) - { - //q=0.; - (D7.f[5])[kt]=(c2o1*feqW7_T-(f7_B*(q*omegaD-c1o1)-omegaD*feq7_B*(q-c1o1))/(omegaD-c1o1)+f7_T*q)/(q+c1o1);//f7_T - feq7_T + feqW7_B; - } - - //////////////////////////////////////////////////////////////////////////// - ////ohne Q's - //real /*feq,*/ q; - //q = q_dirE[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[2])[kw]=f7_W - feq7_W + feqW7_E; - //} - - //q = q_dirW[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[1])[ke]=f7_E - feq7_E + feqW7_W; - //} - - //q = q_dirN[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[4])[ks]=f7_S - feq7_S + feqW7_N; - //} - - //q = q_dirS[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[3])[kn]=f7_N - feq7_N + feqW7_S; - //} - - //q = q_dirT[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[6])[kb]=f7_B - feq7_B + feqW7_T; - //} - - //q = q_dirB[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[5])[kt]=f7_T - feq7_T + feqW7_B; - //} - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QADVel27(int inx, - int iny, - real* DD, - real* DD27, - real* temp, - real* velo, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - - Distributions27 D27; - if (evenOrOdd==true) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; - //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - real f_ZERO = (D.f[dirZERO])[kzero]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real vx1, vx2, vx3, /*drho, feq,*/ q; - ////drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - //// f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - //// f_T + f_B + f_N + f_S + f_E + f_W + f_ZERO; - - //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - // (f_E - f_W); - - - //vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - // (f_N - f_S); - - //vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - // (f_T - f_B); - real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+ f_ZERO; - real rho = rho0 + c1o1; - real OORho = c1o1/rho; - vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - //////////////////////////////////////////////////////////////////////////////// - //real f27_W = (D27.f[dirE ])[ke ]; - //real f27_E = (D27.f[dirW ])[kw ]; - //real f27_S = (D27.f[dirN ])[kn ]; - //real f27_N = (D27.f[dirS ])[ks ]; - //real f27_B = (D27.f[dirT ])[kt ]; - //real f27_T = (D27.f[dirB ])[kb ]; - //real f27_SW = (D27.f[dirNE ])[kne ]; - //real f27_NE = (D27.f[dirSW ])[ksw ]; - //real f27_NW = (D27.f[dirSE ])[kse ]; - //real f27_SE = (D27.f[dirNW ])[knw ]; - //real f27_BW = (D27.f[dirTE ])[kte ]; - //real f27_TE = (D27.f[dirBW ])[kbw ]; - //real f27_TW = (D27.f[dirBE ])[kbe ]; - //real f27_BE = (D27.f[dirTW ])[ktw ]; - //real f27_BS = (D27.f[dirTN ])[ktn ]; - //real f27_TN = (D27.f[dirBS ])[kbs ]; - //real f27_TS = (D27.f[dirBN ])[kbn ]; - //real f27_BN = (D27.f[dirTS ])[kts ]; - //real f27_ZERO = (D27.f[dirZERO])[kzero]; - //real f27_BSW = (D27.f[dirTNE ])[ktne ]; - //real f27_BNE = (D27.f[dirTSW ])[ktsw ]; - //real f27_BNW = (D27.f[dirTSE ])[ktse ]; - //real f27_BSE = (D27.f[dirTNW ])[ktnw ]; - //real f27_TSW = (D27.f[dirBNE ])[kbne ]; - //real f27_TNE = (D27.f[dirBSW ])[kbsw ]; - //real f27_TNW = (D27.f[dirBSE ])[kbse ]; - //real f27_TSE = (D27.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - //////////////////////////////////////////////////////////////////////////////// - //real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + - // f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + - // f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; - - //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); - //real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - //real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - //real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - //real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - //real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - //real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - //real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - //real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - //real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - //real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - //real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - //real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - //real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - //real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - //real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - //real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - //real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - //real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - //real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - //real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - //real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - //real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - //real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - //real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - //real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - //real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real TempD = temp[k]; - //real TempD = four; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // velocity inflow - //vx1 = velo[k]; //zero; - //vx2 = zero; //velo[k];//zero;//velo[k]; - //vx3 = zero; - - ////real feqW27_ZERO = c8over27* TempD*(one-cu_sq); - //real feqW27_E = c2over27* (TempD+(one+TempD)*(three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq)); - //real feqW27_W = c2over27* (TempD+(one+TempD)*(three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq)); - //real feqW27_N = c2over27* (TempD+(one+TempD)*(three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq)); - //real feqW27_S = c2over27* (TempD+(one+TempD)*(three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq)); - //real feqW27_T = c2over27* (TempD+(one+TempD)*(three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq)); - //real feqW27_B = c2over27* (TempD+(one+TempD)*(three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq)); - //real feqW27_NE = c1over54* (TempD+(one+TempD)*(three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - //real feqW27_SW = c1over54* (TempD+(one+TempD)*(three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - //real feqW27_SE = c1over54* (TempD+(one+TempD)*(three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - //real feqW27_NW = c1over54* (TempD+(one+TempD)*(three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - //real feqW27_TE = c1over54* (TempD+(one+TempD)*(three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - //real feqW27_BW = c1over54* (TempD+(one+TempD)*(three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - //real feqW27_BE = c1over54* (TempD+(one+TempD)*(three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - //real feqW27_TW = c1over54* (TempD+(one+TempD)*(three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - //real feqW27_TN = c1over54* (TempD+(one+TempD)*(three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - //real feqW27_BS = c1over54* (TempD+(one+TempD)*(three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - //real feqW27_BN = c1over54* (TempD+(one+TempD)*(three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - //real feqW27_TS = c1over54* (TempD+(one+TempD)*(three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - //real feqW27_TNE = c1over216*(TempD+(one+TempD)*(three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - //real feqW27_BSW = c1over216*(TempD+(one+TempD)*(three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - //real feqW27_BNE = c1over216*(TempD+(one+TempD)*(three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - //real feqW27_TSW = c1over216*(TempD+(one+TempD)*(three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - //real feqW27_TSE = c1over216*(TempD+(one+TempD)*(three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - //real feqW27_BNW = c1over216*(TempD+(one+TempD)*(three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - //real feqW27_BSE = c1over216*(TempD+(one+TempD)*(three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - //real feqW27_TNW = c1over216*(TempD+(one+TempD)*(three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); - // - real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real omegaD = c3o1 - sqrt(c3o1); - //real Lam = -(c1o2-one/omegaD); - //real nue_d = Lam/three; - //real ae = zero; - //real ae = diffusivity/nue_d - one; - - - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //(D27.f[dirW ])[kw ]= four; - //(D27.f[dirE ])[ke ]= four; - //(D27.f[dirS ])[ks ]= four; - //(D27.f[dirN ])[kn ]= four; - //(D27.f[dirB ])[kb ]= four; - //(D27.f[dirT ])[kt ]= four; - //(D27.f[dirSW ])[ksw ]= four; - //(D27.f[dirNE ])[kne ]= four; - //(D27.f[dirNW ])[knw ]= four; - //(D27.f[dirSE ])[kse ]= four; - //(D27.f[dirBW ])[kbw ]= four; - //(D27.f[dirTE ])[kte ]= four; - //(D27.f[dirTW ])[ktw ]= four; - //(D27.f[dirBE ])[kbe ]= four; - //(D27.f[dirBS ])[kbs ]= four; - //(D27.f[dirTN ])[ktn ]= four; - //(D27.f[dirTS ])[kts ]= four; - //(D27.f[dirBN ])[kbn ]= four; - //(D27.f[dirBSW])[kbsw]= four; - //(D27.f[dirTNE])[ktne]= four; - //(D27.f[dirTSW])[ktsw]= four; - //(D27.f[dirBNE])[kbne]= four; - //(D27.f[dirBNW])[kbnw]= four; - //(D27.f[dirTSE])[ktse]= four; - //(D27.f[dirTNW])[ktnw]= four; - //(D27.f[dirBSE])[kbse]= four; - q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirW ])[kw ]= -feqW27_W + c2o1 * c2o27 * TempD; - q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirE ])[ke ]= -feqW27_E + c2o1 * c2o27 * TempD; - q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirS ])[ks ]= -feqW27_S + c2o1 * c2o27 * TempD; - q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirN ])[kn ]= -feqW27_N + c2o1 * c2o27 * TempD; - q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirB ])[kb ]= -feqW27_B + c2o1 * c2o27 * TempD; - q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirT ])[kt ]= -feqW27_T + c2o1 * c2o27 * TempD; - q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSW ])[ksw ]= -feqW27_SW + c2o1 * c1o54 * TempD; - q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNE ])[kne ]= -feqW27_NE + c2o1 * c1o54 * TempD; - q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNW ])[knw ]= -feqW27_NW + c2o1 * c1o54 * TempD; - q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSE ])[kse ]= -feqW27_SE + c2o1 * c1o54 * TempD; - q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBW ])[kbw ]= -feqW27_BW + c2o1 * c1o54 * TempD; - q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTE ])[kte ]= -feqW27_TE + c2o1 * c1o54 * TempD; - q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTW ])[ktw ]= -feqW27_TW + c2o1 * c1o54 * TempD; - q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBE ])[kbe ]= -feqW27_BE + c2o1 * c1o54 * TempD; - q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBS ])[kbs ]= -feqW27_BS + c2o1 * c1o54 * TempD; - q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTN ])[ktn ]= -feqW27_TN + c2o1 * c1o54 * TempD; - q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTS ])[kts ]= -feqW27_TS + c2o1 * c1o54 * TempD; - q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBN ])[kbn ]= -feqW27_BN + c2o1 * c1o54 * TempD; - q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSW])[kbsw]= -feqW27_BSW+ c2o1 * c1o216 * TempD; - q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNE])[ktne]= -feqW27_TNE+ c2o1 * c1o216 * TempD; - q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSW])[ktsw]= -feqW27_TSW+ c2o1 * c1o216 * TempD; - q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNE])[kbne]= -feqW27_BNE+ c2o1 * c1o216 * TempD; - q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNW])[kbnw]= -feqW27_BNW+ c2o1 * c1o216 * TempD; - q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSE])[ktse]= -feqW27_TSE+ c2o1 * c1o216 * TempD; - q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNW])[ktnw]= -feqW27_TNW+ c2o1 * c1o216 * TempD; - q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSE])[kbse]= -feqW27_BSE+ c2o1 * c1o216 * TempD; - //q = q_dirE[k]; if (q>=zero && q<=one) (D27.f[dirW ])[kw ]=(two*feqW27_W -(f27_E *(q*omegaD-one)-omegaD*feq27_E *(q-one))/(omegaD-one)+f27_W *q)/(q+one); - //q = q_dirW[k]; if (q>=zero && q<=one) (D27.f[dirE ])[ke ]=(two*feqW27_E -(f27_W *(q*omegaD-one)-omegaD*feq27_W *(q-one))/(omegaD-one)+f27_E *q)/(q+one); - //q = q_dirN[k]; if (q>=zero && q<=one) (D27.f[dirS ])[ks ]=(two*feqW27_S -(f27_N *(q*omegaD-one)-omegaD*feq27_N *(q-one))/(omegaD-one)+f27_S *q)/(q+one); - //q = q_dirS[k]; if (q>=zero && q<=one) (D27.f[dirN ])[kn ]=(two*feqW27_N -(f27_S *(q*omegaD-one)-omegaD*feq27_S *(q-one))/(omegaD-one)+f27_N *q)/(q+one); - //q = q_dirT[k]; if (q>=zero && q<=one) (D27.f[dirB ])[kb ]=(two*feqW27_B -(f27_T *(q*omegaD-one)-omegaD*feq27_T *(q-one))/(omegaD-one)+f27_B *q)/(q+one); - //q = q_dirB[k]; if (q>=zero && q<=one) (D27.f[dirT ])[kt ]=(two*feqW27_T -(f27_B *(q*omegaD-one)-omegaD*feq27_B *(q-one))/(omegaD-one)+f27_T *q)/(q+one); - //q = q_dirNE[k]; if (q>=zero && q<=one) (D27.f[dirSW ])[ksw ]=(two*feqW27_SW -(f27_NE *(q*omegaD-one)-omegaD*feq27_NE *(q-one))/(omegaD-one)+f27_SW *q)/(q+one); - //q = q_dirSW[k]; if (q>=zero && q<=one) (D27.f[dirNE ])[kne ]=(two*feqW27_NE -(f27_SW *(q*omegaD-one)-omegaD*feq27_SW *(q-one))/(omegaD-one)+f27_NE *q)/(q+one); - //q = q_dirSE[k]; if (q>=zero && q<=one) (D27.f[dirNW ])[knw ]=(two*feqW27_NW -(f27_SE *(q*omegaD-one)-omegaD*feq27_SE *(q-one))/(omegaD-one)+f27_NW *q)/(q+one); - //q = q_dirNW[k]; if (q>=zero && q<=one) (D27.f[dirSE ])[kse ]=(two*feqW27_SE -(f27_NW *(q*omegaD-one)-omegaD*feq27_NW *(q-one))/(omegaD-one)+f27_SE *q)/(q+one); - //q = q_dirTE[k]; if (q>=zero && q<=one) (D27.f[dirBW ])[kbw ]=(two*feqW27_BW -(f27_TE *(q*omegaD-one)-omegaD*feq27_TE *(q-one))/(omegaD-one)+f27_BW *q)/(q+one); - //q = q_dirBW[k]; if (q>=zero && q<=one) (D27.f[dirTE ])[kte ]=(two*feqW27_TE -(f27_BW *(q*omegaD-one)-omegaD*feq27_BW *(q-one))/(omegaD-one)+f27_TE *q)/(q+one); - //q = q_dirBE[k]; if (q>=zero && q<=one) (D27.f[dirTW ])[ktw ]=(two*feqW27_TW -(f27_BE *(q*omegaD-one)-omegaD*feq27_BE *(q-one))/(omegaD-one)+f27_TW *q)/(q+one); - //q = q_dirTW[k]; if (q>=zero && q<=one) (D27.f[dirBE ])[kbe ]=(two*feqW27_BE -(f27_TW *(q*omegaD-one)-omegaD*feq27_TW *(q-one))/(omegaD-one)+f27_BE *q)/(q+one); - //q = q_dirTN[k]; if (q>=zero && q<=one) (D27.f[dirBS ])[kbs ]=(two*feqW27_BS -(f27_TN *(q*omegaD-one)-omegaD*feq27_TN *(q-one))/(omegaD-one)+f27_BS *q)/(q+one); - //q = q_dirBS[k]; if (q>=zero && q<=one) (D27.f[dirTN ])[ktn ]=(two*feqW27_TN -(f27_BS *(q*omegaD-one)-omegaD*feq27_BS *(q-one))/(omegaD-one)+f27_TN *q)/(q+one); - //q = q_dirBN[k]; if (q>=zero && q<=one) (D27.f[dirTS ])[kts ]=(two*feqW27_TS -(f27_BN *(q*omegaD-one)-omegaD*feq27_BN *(q-one))/(omegaD-one)+f27_TS *q)/(q+one); - //q = q_dirTS[k]; if (q>=zero && q<=one) (D27.f[dirBN ])[kbn ]=(two*feqW27_BN -(f27_TS *(q*omegaD-one)-omegaD*feq27_TS *(q-one))/(omegaD-one)+f27_BN *q)/(q+one); - //q = q_dirTNE[k]; if (q>=zero && q<=one) (D27.f[dirBSW])[kbsw]=(two*feqW27_BSW-(f27_TNE*(q*omegaD-one)-omegaD*feq27_TNE*(q-one))/(omegaD-one)+f27_BSW*q)/(q+one); - //q = q_dirBSW[k]; if (q>=zero && q<=one) (D27.f[dirTNE])[ktne]=(two*feqW27_TNE-(f27_BSW*(q*omegaD-one)-omegaD*feq27_BSW*(q-one))/(omegaD-one)+f27_TNE*q)/(q+one); - //q = q_dirBNE[k]; if (q>=zero && q<=one) (D27.f[dirTSW])[ktsw]=(two*feqW27_TSW-(f27_BNE*(q*omegaD-one)-omegaD*feq27_BNE*(q-one))/(omegaD-one)+f27_TSW*q)/(q+one); - //q = q_dirTSW[k]; if (q>=zero && q<=one) (D27.f[dirBNE])[kbne]=(two*feqW27_BNE-(f27_TSW*(q*omegaD-one)-omegaD*feq27_TSW*(q-one))/(omegaD-one)+f27_BNE*q)/(q+one); - //q = q_dirTSE[k]; if (q>=zero && q<=one) (D27.f[dirBNW])[kbnw]=(two*feqW27_BNW-(f27_TSE*(q*omegaD-one)-omegaD*feq27_TSE*(q-one))/(omegaD-one)+f27_BNW*q)/(q+one); - //q = q_dirBNW[k]; if (q>=zero && q<=one) (D27.f[dirTSE])[ktse]=(two*feqW27_TSE-(f27_BNW*(q*omegaD-one)-omegaD*feq27_BNW*(q-one))/(omegaD-one)+f27_TSE*q)/(q+one); - //q = q_dirBSE[k]; if (q>=zero && q<=one) (D27.f[dirTNW])[ktnw]=(two*feqW27_TNW-(f27_BSE*(q*omegaD-one)-omegaD*feq27_BSE*(q-one))/(omegaD-one)+f27_TNW*q)/(q+one); - //q = q_dirTNW[k]; if (q>=zero && q<=one) (D27.f[dirBSE])[kbse]=(two*feqW27_BSE-(f27_TNW*(q*omegaD-one)-omegaD*feq27_TNW*(q-one))/(omegaD-one)+f27_BSE*q)/(q+one); - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QAD7( int inx, - int iny, - real* DD, - real* DD7, - real* temp, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - - Distributions7 D7; - if (evenOrOdd==true) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - ////////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB;//, - // *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - // *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - // *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - // *q_dirBSE, *q_dirBNW; - - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - //q_dirNE = &QQ[dirNE *sizeQ]; - //q_dirSW = &QQ[dirSW *sizeQ]; - //q_dirSE = &QQ[dirSE *sizeQ]; - //q_dirNW = &QQ[dirNW *sizeQ]; - //q_dirTE = &QQ[dirTE *sizeQ]; - //q_dirBW = &QQ[dirBW *sizeQ]; - //q_dirBE = &QQ[dirBE *sizeQ]; - //q_dirTW = &QQ[dirTW *sizeQ]; - //q_dirTN = &QQ[dirTN *sizeQ]; - //q_dirBS = &QQ[dirBS *sizeQ]; - //q_dirBN = &QQ[dirBN *sizeQ]; - //q_dirTS = &QQ[dirTS *sizeQ]; - //q_dirTNE = &QQ[dirTNE *sizeQ]; - //q_dirTSW = &QQ[dirTSW *sizeQ]; - //q_dirTSE = &QQ[dirTSE *sizeQ]; - //q_dirTNW = &QQ[dirTNW *sizeQ]; - //q_dirBNE = &QQ[dirBNE *sizeQ]; - //q_dirBSW = &QQ[dirBSW *sizeQ]; - //q_dirBSE = &QQ[dirBSE *sizeQ]; - //q_dirBNW = &QQ[dirBNW *sizeQ]; - ////////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, - f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real vx1, vx2, vx3/*, drho*/; - //drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - // f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - // f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); - - //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - // (f_E - f_W); - - - //vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - // (f_N - f_S); - - //vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - // (f_T - f_B); - real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+ ((D.f[dirZERO])[kzero]); - real rho = rho0 + c1o1; - real OORho = c1o1/rho; - vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - - //real cu_sq =c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - real ux_sq = vx1 * vx1; - real uy_sq = vx2 * vx2; - real uz_sq = vx3 * vx3; - real omegaD = c3o1 - sqrt(c3o1); - real Lam = -(c1o2-c1o1/omegaD); - real nue_d = Lam/c3o1; - //real ae = zero; - real ae = diffusivity/nue_d - c1o1; - - real f7_ZERO,f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; - real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; - real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; - real TempD = temp[k]; - - - f7_ZERO = (D7.f[0])[kzero]; - f7_W = (D7.f[1])[ke ]; - f7_E = (D7.f[2])[kw ]; - f7_S = (D7.f[3])[kn ]; - f7_N = (D7.f[4])[ks ]; - f7_B = (D7.f[5])[kt ]; - f7_T = (D7.f[6])[kb ]; - - real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; - - //feq7_ZERO = ConcD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); - feq7_E = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)+vx1*c1o2); - feq7_W = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)-vx1*c1o2); - feq7_N = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)+vx2*c1o2); - feq7_S = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)-vx2*c1o2); - feq7_T = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)+vx3*c1o2); - feq7_B = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)-vx3*c1o2); - - //feq7_ZERO = TempD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); - feqW7_E = TempD*(c1o6*(ae+c1o1));//+c1o2*(ux_sq)+vx1*c1o2); - feqW7_W = TempD*(c1o6*(ae+c1o1));//+c1o2*(ux_sq)-vx1*c1o2); - feqW7_N = TempD*(c1o6*(ae+c1o1));//+c1o2*(uy_sq)+vx2*c1o2); - feqW7_S = TempD*(c1o6*(ae+c1o1));//+c1o2*(uy_sq)-vx2*c1o2); - feqW7_T = TempD*(c1o6*(ae+c1o1));//+c1o2*(uz_sq)+vx3*c1o2); - feqW7_B = TempD*(c1o6*(ae+c1o1));//+c1o2*(uz_sq)-vx3*c1o2); - - ////////////////////////////////////////////////////////////////////////// - //pointertausch - if (evenOrOdd==false) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //(D7.f[1])[ke ] = f7_E - feq7_E + feqW7_W; //E - //(D7.f[2])[kw ] = f7_W - feq7_W + feqW7_E; //W - //(D7.f[3])[kn ] = f7_N - feq7_N + feqW7_S; //N - //(D7.f[4])[ks ] = f7_S - feq7_S + feqW7_N; //S - //(D7.f[5])[kt ] = f7_T - feq7_T + feqW7_B; //T - //(D7.f[6])[kb ] = f7_B - feq7_B + feqW7_T; //B - - //////////////////////////////////////////////////////////////////////////// - ////mit Q's - //real /*feq,*/ q; - //q = q_dirE[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[2])[kw]=(two*feqW7_W-(f7_E*(q*omegaD-one)-omegaD*feq7_E*(q-one))/(omegaD-one)+f7_W*q)/(q+one);//f7_W - feq7_W + feqW7_E; - //} - - //q = q_dirW[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[1])[ke]=(two*feqW7_E-(f7_W*(q*omegaD-one)-omegaD*feq7_W*(q-one))/(omegaD-one)+f7_E*q)/(q+one);//f7_E - feq7_E + feqW7_W; - //} - - //q = q_dirN[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[4])[ks]=(two*feqW7_S-(f7_N*(q*omegaD-one)-omegaD*feq7_N*(q-one))/(omegaD-one)+f7_S*q)/(q+one);//f7_S - feq7_S + feqW7_N; - //} - - //q = q_dirS[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[3])[kn]=(two*feqW7_N-(f7_S*(q*omegaD-one)-omegaD*feq7_S*(q-one))/(omegaD-one)+f7_N*q)/(q+one);//f7_N - feq7_N + feqW7_S; - //} - - //q = q_dirT[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[6])[kb]=(two*feqW7_B-(f7_T*(q*omegaD-one)-omegaD*feq7_T*(q-one))/(omegaD-one)+f7_B*q)/(q+one);//f7_B - feq7_B + feqW7_T; - //} - - //q = q_dirB[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[5])[kt]=(two*feqW7_T-(f7_B*(q*omegaD-one)-omegaD*feq7_B*(q-one))/(omegaD-one)+f7_T*q)/(q+one);//f7_T - feq7_T + feqW7_B; - //} - - ////////////////////////////////////////////////////////////////////////// - //ohne Q's - real /*feq,*/ q; - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[2])[kw]=f7_W - feq7_W + feqW7_E; - } - - q = q_dirW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[1])[ke]=f7_E - feq7_E + feqW7_W; - } - - q = q_dirN[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[4])[ks]=f7_S - feq7_S + feqW7_N; - } - - q = q_dirS[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[3])[kn]=f7_N - feq7_N + feqW7_S; - } - - q = q_dirT[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[6])[kb]=f7_B - feq7_B + feqW7_T; - } - - q = q_dirB[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[5])[kt]=f7_T - feq7_T + feqW7_B; - } - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QADDirichlet27( int inx, - int iny, - real* DD, - real* DD27, - real* temp, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - - Distributions27 D27; - if (evenOrOdd==true) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; - //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - real f_ZERO = (D.f[dirZERO])[kzero]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real vx1, vx2, vx3, /*drho, feq,*/ q; - ////drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - //// f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - //// f_T + f_B + f_N + f_S + f_E + f_W + f_ZERO; - - //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - // (f_E - f_W); - - - //vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - // (f_N - f_S); - - //vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - // (f_T - f_B); - real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+f_ZERO; - real rho = rho0 + c1o1; - real OORho = c1o1/rho; - vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - //////////////////////////////////////////////////////////////////////////////// - real f27_W = (D27.f[dirE ])[ke ]; - real f27_E = (D27.f[dirW ])[kw ]; - real f27_S = (D27.f[dirN ])[kn ]; - real f27_N = (D27.f[dirS ])[ks ]; - real f27_B = (D27.f[dirT ])[kt ]; - real f27_T = (D27.f[dirB ])[kb ]; - real f27_SW = (D27.f[dirNE ])[kne ]; - real f27_NE = (D27.f[dirSW ])[ksw ]; - real f27_NW = (D27.f[dirSE ])[kse ]; - real f27_SE = (D27.f[dirNW ])[knw ]; - real f27_BW = (D27.f[dirTE ])[kte ]; - real f27_TE = (D27.f[dirBW ])[kbw ]; - real f27_TW = (D27.f[dirBE ])[kbe ]; - real f27_BE = (D27.f[dirTW ])[ktw ]; - real f27_BS = (D27.f[dirTN ])[ktn ]; - real f27_TN = (D27.f[dirBS ])[kbs ]; - real f27_TS = (D27.f[dirBN ])[kbn ]; - real f27_BN = (D27.f[dirTS ])[kts ]; - real f27_ZERO = (D27.f[dirZERO])[kzero]; - real f27_BSW = (D27.f[dirTNE ])[ktne ]; - real f27_BNE = (D27.f[dirTSW ])[ktsw ]; - real f27_BNW = (D27.f[dirTSE ])[ktse ]; - real f27_BSE = (D27.f[dirTNW ])[ktnw ]; - real f27_TSW = (D27.f[dirBNE ])[kbne ]; - real f27_TNE = (D27.f[dirBSW ])[kbsw ]; - real f27_TNW = (D27.f[dirBSE ])[kbse ]; - real f27_TSE = (D27.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - //////////////////////////////////////////////////////////////////////////////// - real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + - f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + - f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; - - //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); - real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real TempD = temp[k];//one;//temp[k]; - - //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); - real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real omegaD = c3o1 - sqrt(c3o1); - //real Lam = -(c1o2-one/omegaD); - //real nue_d = Lam/three; - //real ae = zero; - //real ae = diffusivity/nue_d - one; - - - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=0.1f; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - q = q_dirE[ ke ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirW ])[kw ]=(c2o1*feqW27_W -(f27_E *(q*omegaD-c1o1)-omegaD*feq27_E *(q-c1o1))/(omegaD-c1o1)+f27_W *q)/(q+c1o1); - q = q_dirW[ kw ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirE ])[ke ]=(c2o1*feqW27_E -(f27_W *(q*omegaD-c1o1)-omegaD*feq27_W *(q-c1o1))/(omegaD-c1o1)+f27_E *q)/(q+c1o1); - q = q_dirN[ kn ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirS ])[ks ]=(c2o1*feqW27_S -(f27_N *(q*omegaD-c1o1)-omegaD*feq27_N *(q-c1o1))/(omegaD-c1o1)+f27_S *q)/(q+c1o1); - q = q_dirS[ ks ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirN ])[kn ]=(c2o1*feqW27_N -(f27_S *(q*omegaD-c1o1)-omegaD*feq27_S *(q-c1o1))/(omegaD-c1o1)+f27_N *q)/(q+c1o1); - q = q_dirT[ kt ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirB ])[kb ]=(c2o1*feqW27_B -(f27_T *(q*omegaD-c1o1)-omegaD*feq27_T *(q-c1o1))/(omegaD-c1o1)+f27_B *q)/(q+c1o1); - q = q_dirB[ kb ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirT ])[kt ]=(c2o1*feqW27_T -(f27_B *(q*omegaD-c1o1)-omegaD*feq27_B *(q-c1o1))/(omegaD-c1o1)+f27_T *q)/(q+c1o1); - q = q_dirNE[ kne ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSW ])[ksw ]=(c2o1*feqW27_SW -(f27_NE *(q*omegaD-c1o1)-omegaD*feq27_NE *(q-c1o1))/(omegaD-c1o1)+f27_SW *q)/(q+c1o1); - q = q_dirSW[ ksw ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNE ])[kne ]=(c2o1*feqW27_NE -(f27_SW *(q*omegaD-c1o1)-omegaD*feq27_SW *(q-c1o1))/(omegaD-c1o1)+f27_NE *q)/(q+c1o1); - q = q_dirSE[ kse ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNW ])[knw ]=(c2o1*feqW27_NW -(f27_SE *(q*omegaD-c1o1)-omegaD*feq27_SE *(q-c1o1))/(omegaD-c1o1)+f27_NW *q)/(q+c1o1); - q = q_dirNW[ knw ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSE ])[kse ]=(c2o1*feqW27_SE -(f27_NW *(q*omegaD-c1o1)-omegaD*feq27_NW *(q-c1o1))/(omegaD-c1o1)+f27_SE *q)/(q+c1o1); - q = q_dirTE[ kte ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBW ])[kbw ]=(c2o1*feqW27_BW -(f27_TE *(q*omegaD-c1o1)-omegaD*feq27_TE *(q-c1o1))/(omegaD-c1o1)+f27_BW *q)/(q+c1o1); - q = q_dirBW[ kbw ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTE ])[kte ]=(c2o1*feqW27_TE -(f27_BW *(q*omegaD-c1o1)-omegaD*feq27_BW *(q-c1o1))/(omegaD-c1o1)+f27_TE *q)/(q+c1o1); - q = q_dirBE[ kbe ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTW ])[ktw ]=(c2o1*feqW27_TW -(f27_BE *(q*omegaD-c1o1)-omegaD*feq27_BE *(q-c1o1))/(omegaD-c1o1)+f27_TW *q)/(q+c1o1); - q = q_dirTW[ ktw ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBE ])[kbe ]=(c2o1*feqW27_BE -(f27_TW *(q*omegaD-c1o1)-omegaD*feq27_TW *(q-c1o1))/(omegaD-c1o1)+f27_BE *q)/(q+c1o1); - q = q_dirTN[ ktn ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBS ])[kbs ]=(c2o1*feqW27_BS -(f27_TN *(q*omegaD-c1o1)-omegaD*feq27_TN *(q-c1o1))/(omegaD-c1o1)+f27_BS *q)/(q+c1o1); - q = q_dirBS[ kbs ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTN ])[ktn ]=(c2o1*feqW27_TN -(f27_BS *(q*omegaD-c1o1)-omegaD*feq27_BS *(q-c1o1))/(omegaD-c1o1)+f27_TN *q)/(q+c1o1); - q = q_dirBN[ kbn ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTS ])[kts ]=(c2o1*feqW27_TS -(f27_BN *(q*omegaD-c1o1)-omegaD*feq27_BN *(q-c1o1))/(omegaD-c1o1)+f27_TS *q)/(q+c1o1); - q = q_dirTS[ kts ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBN ])[kbn ]=(c2o1*feqW27_BN -(f27_TS *(q*omegaD-c1o1)-omegaD*feq27_TS *(q-c1o1))/(omegaD-c1o1)+f27_BN *q)/(q+c1o1); - q = q_dirTNE[ktne ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSW])[kbsw]=(c2o1*feqW27_BSW-(f27_TNE*(q*omegaD-c1o1)-omegaD*feq27_TNE*(q-c1o1))/(omegaD-c1o1)+f27_BSW*q)/(q+c1o1); - q = q_dirBSW[kbsw ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNE])[ktne]=(c2o1*feqW27_TNE-(f27_BSW*(q*omegaD-c1o1)-omegaD*feq27_BSW*(q-c1o1))/(omegaD-c1o1)+f27_TNE*q)/(q+c1o1); - q = q_dirBNE[kbne ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSW])[ktsw]=(c2o1*feqW27_TSW-(f27_BNE*(q*omegaD-c1o1)-omegaD*feq27_BNE*(q-c1o1))/(omegaD-c1o1)+f27_TSW*q)/(q+c1o1); - q = q_dirTSW[ktsw ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNE])[kbne]=(c2o1*feqW27_BNE-(f27_TSW*(q*omegaD-c1o1)-omegaD*feq27_TSW*(q-c1o1))/(omegaD-c1o1)+f27_BNE*q)/(q+c1o1); - q = q_dirTSE[ktse ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNW])[kbnw]=(c2o1*feqW27_BNW-(f27_TSE*(q*omegaD-c1o1)-omegaD*feq27_TSE*(q-c1o1))/(omegaD-c1o1)+f27_BNW*q)/(q+c1o1); - q = q_dirBNW[kbnw ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSE])[ktse]=(c2o1*feqW27_TSE-(f27_BNW*(q*omegaD-c1o1)-omegaD*feq27_BNW*(q-c1o1))/(omegaD-c1o1)+f27_TSE*q)/(q+c1o1); - q = q_dirBSE[kbse ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNW])[ktnw]=(c2o1*feqW27_TNW-(f27_BSE*(q*omegaD-c1o1)-omegaD*feq27_BSE*(q-c1o1))/(omegaD-c1o1)+f27_TNW*q)/(q+c1o1); - q = q_dirTNW[ktnw ]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSE])[kbse]=(c2o1*feqW27_BSE-(f27_TNW*(q*omegaD-c1o1)-omegaD*feq27_TNW*(q-c1o1))/(omegaD-c1o1)+f27_BSE*q)/(q+c1o1); - //q = q_dirE[k]; if (q>=zero && q<=one) (D27.f[dirW ])[kw ]=(two*feqW27_W -(f27_E *(q*omegaD-one)-omegaD*feq27_E *(q-one))/(omegaD-one)+f27_W *q)/(q+one); - //q = q_dirW[k]; if (q>=zero && q<=one) (D27.f[dirE ])[ke ]=(two*feqW27_E -(f27_W *(q*omegaD-one)-omegaD*feq27_W *(q-one))/(omegaD-one)+f27_E *q)/(q+one); - //q = q_dirN[k]; if (q>=zero && q<=one) (D27.f[dirS ])[ks ]=(two*feqW27_S -(f27_N *(q*omegaD-one)-omegaD*feq27_N *(q-one))/(omegaD-one)+f27_S *q)/(q+one); - //q = q_dirS[k]; if (q>=zero && q<=one) (D27.f[dirN ])[kn ]=(two*feqW27_N -(f27_S *(q*omegaD-one)-omegaD*feq27_S *(q-one))/(omegaD-one)+f27_N *q)/(q+one); - //q = q_dirT[k]; if (q>=zero && q<=one) (D27.f[dirB ])[kb ]=(two*feqW27_B -(f27_T *(q*omegaD-one)-omegaD*feq27_T *(q-one))/(omegaD-one)+f27_B *q)/(q+one); - //q = q_dirB[k]; if (q>=zero && q<=one) (D27.f[dirT ])[kt ]=(two*feqW27_T -(f27_B *(q*omegaD-one)-omegaD*feq27_B *(q-one))/(omegaD-one)+f27_T *q)/(q+one); - //q = q_dirNE[k]; if (q>=zero && q<=one) (D27.f[dirSW ])[ksw ]=(two*feqW27_SW -(f27_NE *(q*omegaD-one)-omegaD*feq27_NE *(q-one))/(omegaD-one)+f27_SW *q)/(q+one); - //q = q_dirSW[k]; if (q>=zero && q<=one) (D27.f[dirNE ])[kne ]=(two*feqW27_NE -(f27_SW *(q*omegaD-one)-omegaD*feq27_SW *(q-one))/(omegaD-one)+f27_NE *q)/(q+one); - //q = q_dirSE[k]; if (q>=zero && q<=one) (D27.f[dirNW ])[knw ]=(two*feqW27_NW -(f27_SE *(q*omegaD-one)-omegaD*feq27_SE *(q-one))/(omegaD-one)+f27_NW *q)/(q+one); - //q = q_dirNW[k]; if (q>=zero && q<=one) (D27.f[dirSE ])[kse ]=(two*feqW27_SE -(f27_NW *(q*omegaD-one)-omegaD*feq27_NW *(q-one))/(omegaD-one)+f27_SE *q)/(q+one); - //q = q_dirTE[k]; if (q>=zero && q<=one) (D27.f[dirBW ])[kbw ]=(two*feqW27_BW -(f27_TE *(q*omegaD-one)-omegaD*feq27_TE *(q-one))/(omegaD-one)+f27_BW *q)/(q+one); - //q = q_dirBW[k]; if (q>=zero && q<=one) (D27.f[dirTE ])[kte ]=(two*feqW27_TE -(f27_BW *(q*omegaD-one)-omegaD*feq27_BW *(q-one))/(omegaD-one)+f27_TE *q)/(q+one); - //q = q_dirBE[k]; if (q>=zero && q<=one) (D27.f[dirTW ])[ktw ]=(two*feqW27_TW -(f27_BE *(q*omegaD-one)-omegaD*feq27_BE *(q-one))/(omegaD-one)+f27_TW *q)/(q+one); - //q = q_dirTW[k]; if (q>=zero && q<=one) (D27.f[dirBE ])[kbe ]=(two*feqW27_BE -(f27_TW *(q*omegaD-one)-omegaD*feq27_TW *(q-one))/(omegaD-one)+f27_BE *q)/(q+one); - //q = q_dirTN[k]; if (q>=zero && q<=one) (D27.f[dirBS ])[kbs ]=(two*feqW27_BS -(f27_TN *(q*omegaD-one)-omegaD*feq27_TN *(q-one))/(omegaD-one)+f27_BS *q)/(q+one); - //q = q_dirBS[k]; if (q>=zero && q<=one) (D27.f[dirTN ])[ktn ]=(two*feqW27_TN -(f27_BS *(q*omegaD-one)-omegaD*feq27_BS *(q-one))/(omegaD-one)+f27_TN *q)/(q+one); - //q = q_dirBN[k]; if (q>=zero && q<=one) (D27.f[dirTS ])[kts ]=(two*feqW27_TS -(f27_BN *(q*omegaD-one)-omegaD*feq27_BN *(q-one))/(omegaD-one)+f27_TS *q)/(q+one); - //q = q_dirTS[k]; if (q>=zero && q<=one) (D27.f[dirBN ])[kbn ]=(two*feqW27_BN -(f27_TS *(q*omegaD-one)-omegaD*feq27_TS *(q-one))/(omegaD-one)+f27_BN *q)/(q+one); - //q = q_dirTNE[k]; if (q>=zero && q<=one) (D27.f[dirBSW])[kbsw]=(two*feqW27_BSW-(f27_TNE*(q*omegaD-one)-omegaD*feq27_TNE*(q-one))/(omegaD-one)+f27_BSW*q)/(q+one); - //q = q_dirBSW[k]; if (q>=zero && q<=one) (D27.f[dirTNE])[ktne]=(two*feqW27_TNE-(f27_BSW*(q*omegaD-one)-omegaD*feq27_BSW*(q-one))/(omegaD-one)+f27_TNE*q)/(q+one); - //q = q_dirBNE[k]; if (q>=zero && q<=one) (D27.f[dirTSW])[ktsw]=(two*feqW27_TSW-(f27_BNE*(q*omegaD-one)-omegaD*feq27_BNE*(q-one))/(omegaD-one)+f27_TSW*q)/(q+one); - //q = q_dirTSW[k]; if (q>=zero && q<=one) (D27.f[dirBNE])[kbne]=(two*feqW27_BNE-(f27_TSW*(q*omegaD-one)-omegaD*feq27_TSW*(q-one))/(omegaD-one)+f27_BNE*q)/(q+one); - //q = q_dirTSE[k]; if (q>=zero && q<=one) (D27.f[dirBNW])[kbnw]=(two*feqW27_BNW-(f27_TSE*(q*omegaD-one)-omegaD*feq27_TSE*(q-one))/(omegaD-one)+f27_BNW*q)/(q+one); - //q = q_dirBNW[k]; if (q>=zero && q<=one) (D27.f[dirTSE])[ktse]=(two*feqW27_TSE-(f27_BNW*(q*omegaD-one)-omegaD*feq27_BNW*(q-one))/(omegaD-one)+f27_TSE*q)/(q+one); - //q = q_dirBSE[k]; if (q>=zero && q<=one) (D27.f[dirTNW])[ktnw]=(two*feqW27_TNW-(f27_BSE*(q*omegaD-one)-omegaD*feq27_BSE*(q-one))/(omegaD-one)+f27_TNW*q)/(q+one); - //q = q_dirTNW[k]; if (q>=zero && q<=one) (D27.f[dirBSE])[kbse]=(two*feqW27_BSE-(f27_TNW*(q*omegaD-one)-omegaD*feq27_TNW*(q-one))/(omegaD-one)+f27_BSE*q)/(q+one); - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QADBB27(int inx, - int iny, - real* DD, - real* DD27, - real* temp, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - //Distributions27 D; - //if (evenOrOdd==true) - //{ - // D.f[dirE ] = &DD[dirE *size_Mat]; - // D.f[dirW ] = &DD[dirW *size_Mat]; - // D.f[dirN ] = &DD[dirN *size_Mat]; - // D.f[dirS ] = &DD[dirS *size_Mat]; - // D.f[dirT ] = &DD[dirT *size_Mat]; - // D.f[dirB ] = &DD[dirB *size_Mat]; - // D.f[dirNE ] = &DD[dirNE *size_Mat]; - // D.f[dirSW ] = &DD[dirSW *size_Mat]; - // D.f[dirSE ] = &DD[dirSE *size_Mat]; - // D.f[dirNW ] = &DD[dirNW *size_Mat]; - // D.f[dirTE ] = &DD[dirTE *size_Mat]; - // D.f[dirBW ] = &DD[dirBW *size_Mat]; - // D.f[dirBE ] = &DD[dirBE *size_Mat]; - // D.f[dirTW ] = &DD[dirTW *size_Mat]; - // D.f[dirTN ] = &DD[dirTN *size_Mat]; - // D.f[dirBS ] = &DD[dirBS *size_Mat]; - // D.f[dirBN ] = &DD[dirBN *size_Mat]; - // D.f[dirTS ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - // D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - // D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - // D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - // D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - // D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - //} - //else - //{ - // D.f[dirW ] = &DD[dirE *size_Mat]; - // D.f[dirE ] = &DD[dirW *size_Mat]; - // D.f[dirS ] = &DD[dirN *size_Mat]; - // D.f[dirN ] = &DD[dirS *size_Mat]; - // D.f[dirB ] = &DD[dirT *size_Mat]; - // D.f[dirT ] = &DD[dirB *size_Mat]; - // D.f[dirSW ] = &DD[dirNE *size_Mat]; - // D.f[dirNE ] = &DD[dirSW *size_Mat]; - // D.f[dirNW ] = &DD[dirSE *size_Mat]; - // D.f[dirSE ] = &DD[dirNW *size_Mat]; - // D.f[dirBW ] = &DD[dirTE *size_Mat]; - // D.f[dirTE ] = &DD[dirBW *size_Mat]; - // D.f[dirTW ] = &DD[dirBE *size_Mat]; - // D.f[dirBE ] = &DD[dirTW *size_Mat]; - // D.f[dirBS ] = &DD[dirTN *size_Mat]; - // D.f[dirTN ] = &DD[dirBS *size_Mat]; - // D.f[dirTS ] = &DD[dirBN *size_Mat]; - // D.f[dirBN ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - // D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - // D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - // D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - // D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - // D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - //} - - Distributions27 D27; - if (evenOrOdd==true) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; - //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - //unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - //real f_W = (D.f[dirE ])[ke ]; - //real f_E = (D.f[dirW ])[kw ]; - //real f_S = (D.f[dirN ])[kn ]; - //real f_N = (D.f[dirS ])[ks ]; - //real f_B = (D.f[dirT ])[kt ]; - //real f_T = (D.f[dirB ])[kb ]; - //real f_SW = (D.f[dirNE ])[kne ]; - //real f_NE = (D.f[dirSW ])[ksw ]; - //real f_NW = (D.f[dirSE ])[kse ]; - //real f_SE = (D.f[dirNW ])[knw ]; - //real f_BW = (D.f[dirTE ])[kte ]; - //real f_TE = (D.f[dirBW ])[kbw ]; - //real f_TW = (D.f[dirBE ])[kbe ]; - //real f_BE = (D.f[dirTW ])[ktw ]; - //real f_BS = (D.f[dirTN ])[ktn ]; - //real f_TN = (D.f[dirBS ])[kbs ]; - //real f_TS = (D.f[dirBN ])[kbn ]; - //real f_BN = (D.f[dirTS ])[kts ]; - //real f_ZERO = (D.f[dirZERO])[kzero]; - //real f_BSW = (D.f[dirTNE ])[ktne ]; - //real f_BNE = (D.f[dirTSW ])[ktsw ]; - //real f_BNW = (D.f[dirTSE ])[ktse ]; - //real f_BSE = (D.f[dirTNW ])[ktnw ]; - //real f_TSW = (D.f[dirBNE ])[kbne ]; - //real f_TNE = (D.f[dirBSW ])[kbsw ]; - //real f_TNW = (D.f[dirBSE ])[kbse ]; - //real f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - //real vx1, vx2, vx3, /*drho, feq,*/ q; - real q; - ////drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - //// f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - //// f_T + f_B + f_N + f_S + f_E + f_W + f_ZERO; - - //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - // (f_E - f_W); - - - //vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - // (f_N - f_S); - - //vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - // (f_T - f_B); - //real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+f_ZERO; - //real rho = rho0 + c1o1; - //real OORho = c1o1/rho; - //vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - //vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - //vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - //////////////////////////////////////////////////////////////////////////////// - real f27_W = (D27.f[dirE ])[ke ]; - real f27_E = (D27.f[dirW ])[kw ]; - real f27_S = (D27.f[dirN ])[kn ]; - real f27_N = (D27.f[dirS ])[ks ]; - real f27_B = (D27.f[dirT ])[kt ]; - real f27_T = (D27.f[dirB ])[kb ]; - real f27_SW = (D27.f[dirNE ])[kne ]; - real f27_NE = (D27.f[dirSW ])[ksw ]; - real f27_NW = (D27.f[dirSE ])[kse ]; - real f27_SE = (D27.f[dirNW ])[knw ]; - real f27_BW = (D27.f[dirTE ])[kte ]; - real f27_TE = (D27.f[dirBW ])[kbw ]; - real f27_TW = (D27.f[dirBE ])[kbe ]; - real f27_BE = (D27.f[dirTW ])[ktw ]; - real f27_BS = (D27.f[dirTN ])[ktn ]; - real f27_TN = (D27.f[dirBS ])[kbs ]; - real f27_TS = (D27.f[dirBN ])[kbn ]; - real f27_BN = (D27.f[dirTS ])[kts ]; - //real f27_ZERO = (D27.f[dirZERO])[kzero]; - real f27_BSW = (D27.f[dirTNE ])[ktne ]; - real f27_BNE = (D27.f[dirTSW ])[ktsw ]; - real f27_BNW = (D27.f[dirTSE ])[ktse ]; - real f27_BSE = (D27.f[dirTNW ])[ktnw ]; - real f27_TSW = (D27.f[dirBNE ])[kbne ]; - real f27_TNE = (D27.f[dirBSW ])[kbsw ]; - real f27_TNW = (D27.f[dirBSE ])[kbse ]; - real f27_TSE = (D27.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - //real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - //////////////////////////////////////////////////////////////////////////////// - //real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + - // f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + - // f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; - - //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); - //real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - //real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - //real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - //real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - //real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - //real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - //real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - //real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - //real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - //real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - //real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - //real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - //real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - //real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - //real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - //real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - //real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - //real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - //real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - //real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - //real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - //real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - //real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - //real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - //real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - //real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //real TempD = temp[k]; - - //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); - //real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - //real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - //real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - //real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - //real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - //real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - //real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - //real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - //real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - //real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - //real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - //real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - //real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - //real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - //real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - //real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - //real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - //real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - //real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - //real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - //real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - //real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - //real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - //real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - //real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - //real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real omegaD = c3o1 - sqrt(c3o1); - //real Lam = -(c1o2-one/omegaD); - //real nue_d = Lam/three; - //real ae = zero; - //real ae = diffusivity/nue_d - one; - - - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=0.1f; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirW ])[kw ]=f27_E ; - q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirE ])[ke ]=f27_W ; - q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirS ])[ks ]=f27_N ; - q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirN ])[kn ]=f27_S ; - q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirB ])[kb ]=f27_T ; - q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirT ])[kt ]=f27_B ; - q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSW ])[ksw ]=f27_NE ; - q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNE ])[kne ]=f27_SW ; - q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNW ])[knw ]=f27_SE ; - q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSE ])[kse ]=f27_NW ; - q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBW ])[kbw ]=f27_TE ; - q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTE ])[kte ]=f27_BW ; - q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTW ])[ktw ]=f27_BE ; - q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBE ])[kbe ]=f27_TW ; - q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBS ])[kbs ]=f27_TN ; - q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTN ])[ktn ]=f27_BS ; - q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTS ])[kts ]=f27_BN ; - q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBN ])[kbn ]=f27_TS ; - q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSW])[kbsw]=f27_TNE; - q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNE])[ktne]=f27_BSW; - q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSW])[ktsw]=f27_BNE; - q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNE])[kbne]=f27_TSW; - q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNW])[kbnw]=f27_TSE; - q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSE])[ktse]=f27_BNW; - q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNW])[ktnw]=f27_BSE; - q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSE])[kbse]=f27_TNW; - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -////// ////// -////// incomp ////// -////// ////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QNoSlipADincomp7( int inx, - int iny, - real* DD, - real* DD7, - real* temp, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - //Distributions27 D; - //if (evenOrOdd==true) - //{ - // D.f[dirE ] = &DD[dirE *size_Mat]; - // D.f[dirW ] = &DD[dirW *size_Mat]; - // D.f[dirN ] = &DD[dirN *size_Mat]; - // D.f[dirS ] = &DD[dirS *size_Mat]; - // D.f[dirT ] = &DD[dirT *size_Mat]; - // D.f[dirB ] = &DD[dirB *size_Mat]; - // D.f[dirNE ] = &DD[dirNE *size_Mat]; - // D.f[dirSW ] = &DD[dirSW *size_Mat]; - // D.f[dirSE ] = &DD[dirSE *size_Mat]; - // D.f[dirNW ] = &DD[dirNW *size_Mat]; - // D.f[dirTE ] = &DD[dirTE *size_Mat]; - // D.f[dirBW ] = &DD[dirBW *size_Mat]; - // D.f[dirBE ] = &DD[dirBE *size_Mat]; - // D.f[dirTW ] = &DD[dirTW *size_Mat]; - // D.f[dirTN ] = &DD[dirTN *size_Mat]; - // D.f[dirBS ] = &DD[dirBS *size_Mat]; - // D.f[dirBN ] = &DD[dirBN *size_Mat]; - // D.f[dirTS ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - // D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - // D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - // D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - // D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - // D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - //} - //else - //{ - // D.f[dirW ] = &DD[dirE *size_Mat]; - // D.f[dirE ] = &DD[dirW *size_Mat]; - // D.f[dirS ] = &DD[dirN *size_Mat]; - // D.f[dirN ] = &DD[dirS *size_Mat]; - // D.f[dirB ] = &DD[dirT *size_Mat]; - // D.f[dirT ] = &DD[dirB *size_Mat]; - // D.f[dirSW ] = &DD[dirNE *size_Mat]; - // D.f[dirNE ] = &DD[dirSW *size_Mat]; - // D.f[dirNW ] = &DD[dirSE *size_Mat]; - // D.f[dirSE ] = &DD[dirNW *size_Mat]; - // D.f[dirBW ] = &DD[dirTE *size_Mat]; - // D.f[dirTE ] = &DD[dirBW *size_Mat]; - // D.f[dirTW ] = &DD[dirBE *size_Mat]; - // D.f[dirBE ] = &DD[dirTW *size_Mat]; - // D.f[dirBS ] = &DD[dirTN *size_Mat]; - // D.f[dirTN ] = &DD[dirBS *size_Mat]; - // D.f[dirTS ] = &DD[dirBN *size_Mat]; - // D.f[dirBN ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - // D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - // D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - // D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - // D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - // D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - //} - - Distributions7 D7; - if (evenOrOdd==true) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - ////////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB; - - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - ////////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - //unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - //unsigned int ksw = neighborY[kw]; - //unsigned int kne = KQK; - //unsigned int kse = ks; - //unsigned int knw = kw; - //unsigned int kbw = neighborZ[kw]; - //unsigned int kte = KQK; - //unsigned int kbe = kb; - //unsigned int ktw = kw; - //unsigned int kbs = neighborZ[ks]; - //unsigned int ktn = KQK; - //unsigned int kbn = kb; - //unsigned int kts = ks; - //unsigned int ktse = ks; - //unsigned int kbnw = kbw; - //unsigned int ktnw = kw; - //unsigned int kbse = kbs; - //unsigned int ktsw = ksw; - //unsigned int kbne = kb; - //unsigned int ktne = KQK; - //unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - //real f_W = (D.f[dirE ])[ke ]; - //real f_E = (D.f[dirW ])[kw ]; - //real f_S = (D.f[dirN ])[kn ]; - //real f_N = (D.f[dirS ])[ks ]; - //real f_B = (D.f[dirT ])[kt ]; - //real f_T = (D.f[dirB ])[kb ]; - //real f_SW = (D.f[dirNE ])[kne ]; - //real f_NE = (D.f[dirSW ])[ksw ]; - //real f_NW = (D.f[dirSE ])[kse ]; - //real f_SE = (D.f[dirNW ])[knw ]; - //real f_BW = (D.f[dirTE ])[kte ]; - //real f_TE = (D.f[dirBW ])[kbw ]; - //real f_TW = (D.f[dirBE ])[kbe ]; - //real f_BE = (D.f[dirTW ])[ktw ]; - //real f_BS = (D.f[dirTN ])[ktn ]; - //real f_TN = (D.f[dirBS ])[kbs ]; - //real f_TS = (D.f[dirBN ])[kbn ]; - //real f_BN = (D.f[dirTS ])[kts ]; - //real f_BSW = (D.f[dirTNE ])[ktne ]; - //real f_BNE = (D.f[dirTSW ])[ktsw ]; - //real f_BNW = (D.f[dirTSE ])[ktse ]; - //real f_BSE = (D.f[dirTNW ])[ktnw ]; - //real f_TSW = (D.f[dirBNE ])[kbne ]; - //real f_TNE = (D.f[dirBSW ])[kbsw ]; - //real f_TNW = (D.f[dirBSE ])[kbse ]; - //real f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - //real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - //real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - //real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - ////d�rrrrrty !!!!!!!!!!!!! - // real vx1 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - // real vx2 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - // real vx3 = ten * ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - - //real cu_sq =c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - //real ux_sq = vx1 * vx1; - //real uy_sq = vx2 * vx2; - //real uz_sq = vx3 * vx3; - //////////////////////////////////////////////////////////////////////////////// - //BGK - //real omegaD = three - sqrt(three); - //real Lam = -(c1o2-one/omegaD); - //real nue_d = Lam/three; - //real ae = diffusivity/nue_d - one; //zero; - - real f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; - //real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; - //real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; - real TempD = temp[k]; - - - //f7_ZERO = (D7.f[0])[kzero]; - f7_W = (D7.f[1])[ke ]; - f7_E = (D7.f[2])[kw ]; - f7_S = (D7.f[3])[kn ]; - f7_N = (D7.f[4])[ks ]; - f7_B = (D7.f[5])[kt ]; - f7_T = (D7.f[6])[kb ]; - - //real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; - - ////feq7_ZERO = ConcD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); - //feq7_E = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)+vx1*c1o2); - //feq7_W = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)-vx1*c1o2); - //feq7_N = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)+vx2*c1o2); - //feq7_S = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)-vx2*c1o2); - //feq7_T = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)+vx3*c1o2); - //feq7_B = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)-vx3*c1o2); - - ////feq7_ZERO = TempD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); - //feqW7_E = TempD*(c1o6*(ae+one));//+c1o2*(ux_sq)+vx1*c1o2); - //feqW7_W = TempD*(c1o6*(ae+one));//+c1o2*(ux_sq)-vx1*c1o2); - //feqW7_N = TempD*(c1o6*(ae+one));//+c1o2*(uy_sq)+vx2*c1o2); - //feqW7_S = TempD*(c1o6*(ae+one));//+c1o2*(uy_sq)-vx2*c1o2); - //feqW7_T = TempD*(c1o6*(ae+one));//+c1o2*(uz_sq)+vx3*c1o2); - //feqW7_B = TempD*(c1o6*(ae+one));//+c1o2*(uz_sq)-vx3*c1o2); - - //////////////////////////////////////////////////////////////////////////////// - //TRT - real cs2 = c1o4; - ////////////////////////////////////////////////////////////////////////// - //pointertausch - if (evenOrOdd==false) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - //////////////////////////////////////////////////////////////////////////// - ////mit Q's - //real /*feq,*/ q; - //q = q_dirE[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[2])[kw]=(two*feqW7_W-(f7_E*(q*omegaD-one)-omegaD*feq7_E*(q-one))/(omegaD-one)+f7_W*q)/(q+one);//f7_W - feq7_W + feqW7_E; - //} - - //q = q_dirW[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[1])[ke]=(two*feqW7_E-(f7_W*(q*omegaD-one)-omegaD*feq7_W*(q-one))/(omegaD-one)+f7_E*q)/(q+one);//f7_E - feq7_E + feqW7_W; - //} - - //q = q_dirN[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[4])[ks]=(two*feqW7_S-(f7_N*(q*omegaD-one)-omegaD*feq7_N*(q-one))/(omegaD-one)+f7_S*q)/(q+one);//f7_S - feq7_S + feqW7_N; - //} - - //q = q_dirS[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[3])[kn]=(two*feqW7_N-(f7_S*(q*omegaD-one)-omegaD*feq7_S*(q-one))/(omegaD-one)+f7_N*q)/(q+one);//f7_N - feq7_N + feqW7_S; - //} - - //q = q_dirT[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[6])[kb]=(two*feqW7_B-(f7_T*(q*omegaD-one)-omegaD*feq7_T*(q-one))/(omegaD-one)+f7_B*q)/(q+one);//f7_B - feq7_B + feqW7_T; - //} - - //q = q_dirB[k]; - //if (q>=zero && q<=one) - //{ - // //q=zero; - // (D7.f[5])[kt]=(two*feqW7_T-(f7_B*(q*omegaD-one)-omegaD*feq7_B*(q-one))/(omegaD-one)+f7_T*q)/(q+one);//f7_T - feq7_T + feqW7_B; - //} - - //////////////////////////////////////////////////////////////////////////// - ////ohne Q's - //real /*feq,*/ q; - //q = q_dirE[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[2])[kw]=f7_W;// - feq7_W + feqW7_E; - //} - - //q = q_dirW[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[1])[ke]=f7_E;// - feq7_E + feqW7_W; - //} - - //q = q_dirN[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[4])[ks]=f7_S;// - feq7_S + feqW7_N; - //} - - //q = q_dirS[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[3])[kn]=f7_N;// - feq7_N + feqW7_S; - //} - - //q = q_dirT[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[6])[kb]=f7_B;// - feq7_B + feqW7_T; - //} - - //q = q_dirB[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[5])[kt]=f7_T;// - feq7_T + feqW7_B; - //} - - - ////////////////////////////////////////////////////////////////////////// - //ohne Q's aber mit TRT - real /*feq,*/ q; - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[2])[kw]= -f7_W + cs2 * TempD; - } - - q = q_dirW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[1])[ke]= -f7_E + cs2 * TempD; - } - - q = q_dirN[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[4])[ks]= -f7_S + cs2 * TempD; - } - - q = q_dirS[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[3])[kn]= -f7_N + cs2 * TempD; - } - - q = q_dirT[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[6])[kb]= -f7_B + cs2 * TempD; - } - - q = q_dirB[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[5])[kt]= -f7_T + cs2 * TempD; - } - - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QNoSlipADincomp27(int inx, - int iny, - real* DD, - real* DD27, - real* temp, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - - Distributions27 D27; - if (evenOrOdd==true) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; - //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - //real f_ZERO = (D.f[dirZERO])[kzero]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - //////////////////////////////////////////////////////////////////////////////// - real f27_W = (D27.f[dirE ])[ke ]; - real f27_E = (D27.f[dirW ])[kw ]; - real f27_S = (D27.f[dirN ])[kn ]; - real f27_N = (D27.f[dirS ])[ks ]; - real f27_B = (D27.f[dirT ])[kt ]; - real f27_T = (D27.f[dirB ])[kb ]; - real f27_SW = (D27.f[dirNE ])[kne ]; - real f27_NE = (D27.f[dirSW ])[ksw ]; - real f27_NW = (D27.f[dirSE ])[kse ]; - real f27_SE = (D27.f[dirNW ])[knw ]; - real f27_BW = (D27.f[dirTE ])[kte ]; - real f27_TE = (D27.f[dirBW ])[kbw ]; - real f27_TW = (D27.f[dirBE ])[kbe ]; - real f27_BE = (D27.f[dirTW ])[ktw ]; - real f27_BS = (D27.f[dirTN ])[ktn ]; - real f27_TN = (D27.f[dirBS ])[kbs ]; - real f27_TS = (D27.f[dirBN ])[kbn ]; - real f27_BN = (D27.f[dirTS ])[kts ]; - real f27_ZERO = (D27.f[dirZERO])[kzero]; - real f27_BSW = (D27.f[dirTNE ])[ktne ]; - real f27_BNE = (D27.f[dirTSW ])[ktsw ]; - real f27_BNW = (D27.f[dirTSE ])[ktse ]; - real f27_BSE = (D27.f[dirTNW ])[ktnw ]; - real f27_TSW = (D27.f[dirBNE ])[kbne ]; - real f27_TNE = (D27.f[dirBSW ])[kbsw ]; - real f27_TNW = (D27.f[dirBSE ])[kbse ]; - real f27_TSE = (D27.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - //////////////////////////////////////////////////////////////////////////////// - real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + - f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + - f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; - - //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); - real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real TempD = temp[k]; - - //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); - real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real omegaD = c3o1 - sqrt(c3o1); - //real Lam = -(c1o2-one/omegaD); - //real nue_d = Lam/three; - //real ae = zero; - //real ae = diffusivity/nue_d - one; - - - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=0.1f; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real q; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirW ])[kw ]=(c2o1*feqW27_W -(f27_E *(q*omegaD-c1o1)-omegaD*feq27_E *(q-c1o1))/(omegaD-c1o1)+f27_W *q)/(q+c1o1); - q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirE ])[ke ]=(c2o1*feqW27_E -(f27_W *(q*omegaD-c1o1)-omegaD*feq27_W *(q-c1o1))/(omegaD-c1o1)+f27_E *q)/(q+c1o1); - q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirS ])[ks ]=(c2o1*feqW27_S -(f27_N *(q*omegaD-c1o1)-omegaD*feq27_N *(q-c1o1))/(omegaD-c1o1)+f27_S *q)/(q+c1o1); - q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirN ])[kn ]=(c2o1*feqW27_N -(f27_S *(q*omegaD-c1o1)-omegaD*feq27_S *(q-c1o1))/(omegaD-c1o1)+f27_N *q)/(q+c1o1); - q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirB ])[kb ]=(c2o1*feqW27_B -(f27_T *(q*omegaD-c1o1)-omegaD*feq27_T *(q-c1o1))/(omegaD-c1o1)+f27_B *q)/(q+c1o1); - q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirT ])[kt ]=(c2o1*feqW27_T -(f27_B *(q*omegaD-c1o1)-omegaD*feq27_B *(q-c1o1))/(omegaD-c1o1)+f27_T *q)/(q+c1o1); - q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSW ])[ksw ]=(c2o1*feqW27_SW -(f27_NE *(q*omegaD-c1o1)-omegaD*feq27_NE *(q-c1o1))/(omegaD-c1o1)+f27_SW *q)/(q+c1o1); - q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNE ])[kne ]=(c2o1*feqW27_NE -(f27_SW *(q*omegaD-c1o1)-omegaD*feq27_SW *(q-c1o1))/(omegaD-c1o1)+f27_NE *q)/(q+c1o1); - q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNW ])[knw ]=(c2o1*feqW27_NW -(f27_SE *(q*omegaD-c1o1)-omegaD*feq27_SE *(q-c1o1))/(omegaD-c1o1)+f27_NW *q)/(q+c1o1); - q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSE ])[kse ]=(c2o1*feqW27_SE -(f27_NW *(q*omegaD-c1o1)-omegaD*feq27_NW *(q-c1o1))/(omegaD-c1o1)+f27_SE *q)/(q+c1o1); - q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBW ])[kbw ]=(c2o1*feqW27_BW -(f27_TE *(q*omegaD-c1o1)-omegaD*feq27_TE *(q-c1o1))/(omegaD-c1o1)+f27_BW *q)/(q+c1o1); - q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTE ])[kte ]=(c2o1*feqW27_TE -(f27_BW *(q*omegaD-c1o1)-omegaD*feq27_BW *(q-c1o1))/(omegaD-c1o1)+f27_TE *q)/(q+c1o1); - q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTW ])[ktw ]=(c2o1*feqW27_TW -(f27_BE *(q*omegaD-c1o1)-omegaD*feq27_BE *(q-c1o1))/(omegaD-c1o1)+f27_TW *q)/(q+c1o1); - q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBE ])[kbe ]=(c2o1*feqW27_BE -(f27_TW *(q*omegaD-c1o1)-omegaD*feq27_TW *(q-c1o1))/(omegaD-c1o1)+f27_BE *q)/(q+c1o1); - q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBS ])[kbs ]=(c2o1*feqW27_BS -(f27_TN *(q*omegaD-c1o1)-omegaD*feq27_TN *(q-c1o1))/(omegaD-c1o1)+f27_BS *q)/(q+c1o1); - q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTN ])[ktn ]=(c2o1*feqW27_TN -(f27_BS *(q*omegaD-c1o1)-omegaD*feq27_BS *(q-c1o1))/(omegaD-c1o1)+f27_TN *q)/(q+c1o1); - q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTS ])[kts ]=(c2o1*feqW27_TS -(f27_BN *(q*omegaD-c1o1)-omegaD*feq27_BN *(q-c1o1))/(omegaD-c1o1)+f27_TS *q)/(q+c1o1); - q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBN ])[kbn ]=(c2o1*feqW27_BN -(f27_TS *(q*omegaD-c1o1)-omegaD*feq27_TS *(q-c1o1))/(omegaD-c1o1)+f27_BN *q)/(q+c1o1); - q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSW])[kbsw]=(c2o1*feqW27_BSW-(f27_TNE*(q*omegaD-c1o1)-omegaD*feq27_TNE*(q-c1o1))/(omegaD-c1o1)+f27_BSW*q)/(q+c1o1); - q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNE])[ktne]=(c2o1*feqW27_TNE-(f27_BSW*(q*omegaD-c1o1)-omegaD*feq27_BSW*(q-c1o1))/(omegaD-c1o1)+f27_TNE*q)/(q+c1o1); - q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSW])[ktsw]=(c2o1*feqW27_TSW-(f27_BNE*(q*omegaD-c1o1)-omegaD*feq27_BNE*(q-c1o1))/(omegaD-c1o1)+f27_TSW*q)/(q+c1o1); - q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNE])[kbne]=(c2o1*feqW27_BNE-(f27_TSW*(q*omegaD-c1o1)-omegaD*feq27_TSW*(q-c1o1))/(omegaD-c1o1)+f27_BNE*q)/(q+c1o1); - q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNW])[kbnw]=(c2o1*feqW27_BNW-(f27_TSE*(q*omegaD-c1o1)-omegaD*feq27_TSE*(q-c1o1))/(omegaD-c1o1)+f27_BNW*q)/(q+c1o1); - q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSE])[ktse]=(c2o1*feqW27_TSE-(f27_BNW*(q*omegaD-c1o1)-omegaD*feq27_BNW*(q-c1o1))/(omegaD-c1o1)+f27_TSE*q)/(q+c1o1); - q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNW])[ktnw]=(c2o1*feqW27_TNW-(f27_BSE*(q*omegaD-c1o1)-omegaD*feq27_BSE*(q-c1o1))/(omegaD-c1o1)+f27_TNW*q)/(q+c1o1); - q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSE])[kbse]=(c2o1*feqW27_BSE-(f27_TNW*(q*omegaD-c1o1)-omegaD*feq27_TNW*(q-c1o1))/(omegaD-c1o1)+f27_BSE*q)/(q+c1o1); - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QADVeloIncomp7( int inx, - int iny, - real* DD, - real* DD7, - real* temp, - real* velo, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - //Distributions27 D; - //if (evenOrOdd==true) - //{ - // D.f[dirE ] = &DD[dirE *size_Mat]; - // D.f[dirW ] = &DD[dirW *size_Mat]; - // D.f[dirN ] = &DD[dirN *size_Mat]; - // D.f[dirS ] = &DD[dirS *size_Mat]; - // D.f[dirT ] = &DD[dirT *size_Mat]; - // D.f[dirB ] = &DD[dirB *size_Mat]; - // D.f[dirNE ] = &DD[dirNE *size_Mat]; - // D.f[dirSW ] = &DD[dirSW *size_Mat]; - // D.f[dirSE ] = &DD[dirSE *size_Mat]; - // D.f[dirNW ] = &DD[dirNW *size_Mat]; - // D.f[dirTE ] = &DD[dirTE *size_Mat]; - // D.f[dirBW ] = &DD[dirBW *size_Mat]; - // D.f[dirBE ] = &DD[dirBE *size_Mat]; - // D.f[dirTW ] = &DD[dirTW *size_Mat]; - // D.f[dirTN ] = &DD[dirTN *size_Mat]; - // D.f[dirBS ] = &DD[dirBS *size_Mat]; - // D.f[dirBN ] = &DD[dirBN *size_Mat]; - // D.f[dirTS ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - // D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - // D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - // D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - // D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - // D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - //} - //else - //{ - // D.f[dirW ] = &DD[dirE *size_Mat]; - // D.f[dirE ] = &DD[dirW *size_Mat]; - // D.f[dirS ] = &DD[dirN *size_Mat]; - // D.f[dirN ] = &DD[dirS *size_Mat]; - // D.f[dirB ] = &DD[dirT *size_Mat]; - // D.f[dirT ] = &DD[dirB *size_Mat]; - // D.f[dirSW ] = &DD[dirNE *size_Mat]; - // D.f[dirNE ] = &DD[dirSW *size_Mat]; - // D.f[dirNW ] = &DD[dirSE *size_Mat]; - // D.f[dirSE ] = &DD[dirNW *size_Mat]; - // D.f[dirBW ] = &DD[dirTE *size_Mat]; - // D.f[dirTE ] = &DD[dirBW *size_Mat]; - // D.f[dirTW ] = &DD[dirBE *size_Mat]; - // D.f[dirBE ] = &DD[dirTW *size_Mat]; - // D.f[dirBS ] = &DD[dirTN *size_Mat]; - // D.f[dirTN ] = &DD[dirBS *size_Mat]; - // D.f[dirTS ] = &DD[dirBN *size_Mat]; - // D.f[dirBN ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - // D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - // D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - // D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - // D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - // D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - //} - - Distributions7 D7; - if (evenOrOdd==true) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - ////////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB; - - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - ////////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - //unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - //unsigned int ksw = neighborY[kw]; - //unsigned int kne = KQK; - //unsigned int kse = ks; - //unsigned int knw = kw; - //unsigned int kbw = neighborZ[kw]; - //unsigned int kte = KQK; - //unsigned int kbe = kb; - //unsigned int ktw = kw; - //unsigned int kbs = neighborZ[ks]; - //unsigned int ktn = KQK; - //unsigned int kbn = kb; - //unsigned int kts = ks; - //unsigned int ktse = ks; - //unsigned int kbnw = kbw; - //unsigned int ktnw = kw; - //unsigned int kbse = kbs; - //unsigned int ktsw = ksw; - //unsigned int kbne = kb; - //unsigned int ktne = KQK; - //unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - //real f_W = (D.f[dirE ])[ke ]; - //real f_E = (D.f[dirW ])[kw ]; - //real f_S = (D.f[dirN ])[kn ]; - //real f_N = (D.f[dirS ])[ks ]; - //real f_B = (D.f[dirT ])[kt ]; - //real f_T = (D.f[dirB ])[kb ]; - //real f_SW = (D.f[dirNE ])[kne ]; - //real f_NE = (D.f[dirSW ])[ksw ]; - //real f_NW = (D.f[dirSE ])[kse ]; - //real f_SE = (D.f[dirNW ])[knw ]; - //real f_BW = (D.f[dirTE ])[kte ]; - //real f_TE = (D.f[dirBW ])[kbw ]; - //real f_TW = (D.f[dirBE ])[kbe ]; - //real f_BE = (D.f[dirTW ])[ktw ]; - //real f_BS = (D.f[dirTN ])[ktn ]; - //real f_TN = (D.f[dirBS ])[kbs ]; - //real f_TS = (D.f[dirBN ])[kbn ]; - //real f_BN = (D.f[dirTS ])[kts ]; - //real f_BSW = (D.f[dirTNE ])[ktne ]; - //real f_BNE = (D.f[dirTSW ])[ktsw ]; - //real f_BNW = (D.f[dirTSE ])[ktse ]; - //real f_BSE = (D.f[dirTNW ])[ktnw ]; - //real f_TSW = (D.f[dirBNE ])[kbne ]; - //real f_TNE = (D.f[dirBSW ])[kbsw ]; - //real f_TNW = (D.f[dirBSE ])[kbse ]; - //real f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - //real vx1_Inflow = c0o1; - //real vx2_Inflow = velo[k]; - //real vx3_Inflow = c0o1; - //real ux_sq_Inflow = vx1_Inflow * vx1_Inflow; - //real uy_sq_Inflow = vx2_Inflow * vx2_Inflow; - //real uz_sq_Inflow = vx3_Inflow * vx3_Inflow; - //////////////////////////////////////////////////////////////////////////////// - //real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - //real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - //real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - ////d�rrrrrty !!!!!!!!!!!!! - // real vx1 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - // real vx2 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - // real vx3 = ten * ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - //////////////////////////////////////////////////////////////////////////////// - //real cu_sq =1.5f*(vx1*vx1+vx2*vx2+vx3*vx3); - //real ux_sq = vx1 * vx1; - //real uy_sq = vx2 * vx2; - //real uz_sq = vx3 * vx3; - - real f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; - //real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; - //real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; - real TempD = temp[k]; - - //f7_ZERO = (D7.f[0])[kzero]; - f7_W = (D7.f[1])[ke ]; - f7_E = (D7.f[2])[kw ]; - f7_S = (D7.f[3])[kn ]; - f7_N = (D7.f[4])[ks ]; - f7_B = (D7.f[5])[kt ]; - f7_T = (D7.f[6])[kb ]; - - //real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; - - //////////////////////////////////////////////////////////////////////////////// - //BGK - //real omegaD = three - sqrt(three); - //real Lam = -(c1o2-one/omegaD); - //real nue_d = Lam/three; - ////real ae = zero; - //real ae = diffusivity/nue_d - one; - - ////feq7_ZERO = ConcD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); - //feq7_E = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)+vx1*c1o2); - //feq7_W = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)-vx1*c1o2); - //feq7_N = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)+vx2*c1o2); - //feq7_S = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)-vx2*c1o2); - //feq7_T = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)+vx3*c1o2); - //feq7_B = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)-vx3*c1o2); - - ////feq7_ZERO = TempD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); - //feqW7_E = TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)+vx1_Inflow*c1o2); - //feqW7_W = TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)-vx1_Inflow*c1o2); - //feqW7_N = TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)+vx2_Inflow*c1o2); - //feqW7_S = TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)-vx2_Inflow*c1o2); - //feqW7_T = TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)+vx3_Inflow*c1o2); - //feqW7_B = TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)-vx3_Inflow*c1o2); - - // //////////////////////////////////////////////////////////////////////////////// - ////TRT Yoshida Kernel - based on Ying - real cs2 = c1o4; - // real Lam = diffusivity/(one)/cs2; - // real omegaD = - one / (Lam + c1o2); - // real ae = zero; - // //////////////////////////////////////////////////////////////////////////////// - //real Mom000 = f7_ZERO + f7_W + f7_E + f7_N + f7_S + f7_T + f7_B; //1 - // real Mom100 = f7_E - f7_W; - // real Mom010 = f7_N - f7_S; - // real Mom001 = f7_T - f7_B; - // real Mom222 = six*f7_ZERO - f7_W - f7_E - f7_N - f7_S - f7_T - f7_B; - // real Mom200 = two*f7_W + two*f7_E - f7_N - f7_S - f7_T - f7_B; - // real Mom022 = f7_N + f7_S - f7_T - f7_B; - - // real Meq000 = ConcD; - // real Meq100 = ConcD*vx1; - // real Meq010 = ConcD*vx2; - // real Meq001 = ConcD*vx3; - // real Meq222 = c3o4*ConcD; - // real Meq200 = zero; - // real Meq022 = zero; - - // // relaxation TRT Yoshida - - // // odd - // Mom100 = omegaD * (Mom100-Meq100); - // Mom010 = omegaD * (Mom010-Meq010); - // Mom001 = omegaD * (Mom001-Meq001); - // - // // even - // Mom000 = -one*(Mom000-Meq000); - // Mom222 = -one*(Mom222-Meq222); - // Mom200 = -one*(Mom200-Meq200); - // Mom022 = -one*(Mom022-Meq022); - // - // //Back transformation to distributions - // f7_ZERO = f7_ZERO + c1o7*Mom000 + c1o7*Mom222; //1 - // f7_E = f7_E + c1o7*Mom000 + c1o2*Mom100 - c1o6*c1o7*Mom222 + c1o6*Mom200; //2 - // f7_W = f7_W + c1o7*Mom000 - c1o2*Mom100 - c1o6*c1o7*Mom222 + c1o6*Mom200; //3 - // f7_N = f7_N + c1o7*Mom000 + c1o2*Mom010 - c1o6*c1o7*Mom222 - c1o12*Mom200 + c1o4 *Mom022; //4 - // f7_S = f7_S + c1o7*Mom000 - c1o2*Mom010 - c1o6*c1o7*Mom222 - c1o12*Mom200 + c1o4 *Mom022; //5 - // f7_T = f7_T + c1o7*Mom000 + c1o2*Mom001 - c1o6*c1o7*Mom222 - c1o12*Mom200 - c1o4 *Mom022; //6 - // f7_B = f7_B + c1o7*Mom000 - c1o2*Mom001 - c1o6*c1o7*Mom222 - c1o12*Mom200 - c1o4 *Mom022; //7 - - - - - - ////////////////////////////////////////////////////////////////////////// - //pointertausch - if (evenOrOdd==false) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - //////////////////////////////////////////////////////////////////////////// - ////mit Q's - //real /*feq,*/ q; - //q = q_dirE[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[2])[kw]=(two*feqW7_W-(f7_E*(q*omegaD-one)-omegaD*feq7_E*(q-one))/(omegaD-one)+f7_W*q)/(q+one);//f7_W - feq7_W + feqW7_E; - //} - - //q = q_dirW[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[1])[ke]=(two*feqW7_E-(f7_W*(q*omegaD-one)-omegaD*feq7_W*(q-one))/(omegaD-one)+f7_E*q)/(q+one);//f7_E - feq7_E + feqW7_W; - //} - - //q = q_dirN[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[4])[ks]=(two*feqW7_S-(f7_N*(q*omegaD-one)-omegaD*feq7_N*(q-one))/(omegaD-one)+f7_S*q)/(q+one);//f7_S - feq7_S + feqW7_N; - //} - - //q = q_dirS[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[3])[kn]=(two*feqW7_N-(f7_S*(q*omegaD-one)-omegaD*feq7_S*(q-one))/(omegaD-one)+f7_N*q)/(q+one);//f7_N - feq7_N + feqW7_S; - //} - - //q = q_dirT[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[6])[kb]=(two*feqW7_B-(f7_T*(q*omegaD-one)-omegaD*feq7_T*(q-one))/(omegaD-one)+f7_B*q)/(q+one);//f7_B - feq7_B + feqW7_T; - //} - - //q = q_dirB[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[5])[kt]=(two*feqW7_T-(f7_B*(q*omegaD-one)-omegaD*feq7_B*(q-one))/(omegaD-one)+f7_T*q)/(q+one);//f7_T - feq7_T + feqW7_B; - //} - - //////////////////////////////////////////////////////////////////////////// - ////ohne Q's - //real /*feq,*/ q; - //q = q_dirE[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[2])[kw]=f7_W - feq7_W + feqW7_E; - //} - - //q = q_dirW[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[1])[ke]=f7_E - feq7_E + feqW7_W; - //} - - //q = q_dirN[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[4])[ks]=f7_S - feq7_S + feqW7_N; - //} - - //q = q_dirS[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[3])[kn]=f7_N - feq7_N + feqW7_S; - //} - - //q = q_dirT[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[6])[kb]=f7_B - feq7_B + feqW7_T; - //} - - //q = q_dirB[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[5])[kt]=f7_T - feq7_T + feqW7_B; - //} - - ////////////////////////////////////////////////////////////////////////// - //ohne Q's aber mit TRT - real /*feq,*/ q; - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[2])[kw]= -f7_W + cs2 * TempD; - } - - q = q_dirW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[1])[ke]= -f7_E + cs2 * TempD; - } - - q = q_dirN[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[4])[ks]= -f7_S + cs2 * TempD; - } - - q = q_dirS[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[3])[kn]= -f7_N + cs2 * TempD; - } - - q = q_dirT[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[6])[kb]= -f7_B + cs2 * TempD; - } - - q = q_dirB[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[5])[kt]= -f7_T + cs2 * TempD; - } - - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QADVeloIncomp27( int inx, - int iny, - real* DD, - real* DD27, - real* temp, - real* velo, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - - Distributions27 D27; - if (evenOrOdd==true) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; - //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - //unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - //real f_ZERO = (D.f[dirZERO])[kzero]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - //////////////////////////////////////////////////////////////////////////////// - //real f27_W = (D27.f[dirE ])[ke ]; - //real f27_E = (D27.f[dirW ])[kw ]; - //real f27_S = (D27.f[dirN ])[kn ]; - //real f27_N = (D27.f[dirS ])[ks ]; - //real f27_B = (D27.f[dirT ])[kt ]; - //real f27_T = (D27.f[dirB ])[kb ]; - //real f27_SW = (D27.f[dirNE ])[kne ]; - //real f27_NE = (D27.f[dirSW ])[ksw ]; - //real f27_NW = (D27.f[dirSE ])[kse ]; - //real f27_SE = (D27.f[dirNW ])[knw ]; - //real f27_BW = (D27.f[dirTE ])[kte ]; - //real f27_TE = (D27.f[dirBW ])[kbw ]; - //real f27_TW = (D27.f[dirBE ])[kbe ]; - //real f27_BE = (D27.f[dirTW ])[ktw ]; - //real f27_BS = (D27.f[dirTN ])[ktn ]; - //real f27_TN = (D27.f[dirBS ])[kbs ]; - //real f27_TS = (D27.f[dirBN ])[kbn ]; - //real f27_BN = (D27.f[dirTS ])[kts ]; - //real f27_ZERO = (D27.f[dirZERO])[kzero]; - //real f27_BSW = (D27.f[dirTNE ])[ktne ]; - //real f27_BNE = (D27.f[dirTSW ])[ktsw ]; - //real f27_BNW = (D27.f[dirTSE ])[ktse ]; - //real f27_BSE = (D27.f[dirTNW ])[ktnw ]; - //real f27_TSW = (D27.f[dirBNE ])[kbne ]; - //real f27_TNE = (D27.f[dirBSW ])[kbsw ]; - //real f27_TNW = (D27.f[dirBSE ])[kbse ]; - //real f27_TSE = (D27.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - //////////////////////////////////////////////////////////////////////////////// - //real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + - // f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + - // f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; - - //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); - //real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - //real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - //real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - //real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - //real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - //real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - //real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - //real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - //real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - //real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - //real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - //real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - //real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - //real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - //real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - //real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - //real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - //real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - //real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - //real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - //real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - //real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - //real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - //real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - //real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - //real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real TempD = temp[k]; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // velocity inflow - vx1 = velo[k];//zero; - vx2 = c0o1;//velo[k]; - vx3 = c0o1; - - //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); - real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real omegaD = c3o1 - sqrt(c3o1); - //real Lam = -(c1o2-one/omegaD); - //real nue_d = Lam/three; - //real ae = zero; - //real ae = diffusivity/nue_d - one; - - - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real q; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirW ])[kw ]= -feqW27_W + c2o1 * c2o27 * TempD; - q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirE ])[ke ]= -feqW27_E + c2o1 * c2o27 * TempD; - q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirS ])[ks ]= -feqW27_S + c2o1 * c2o27 * TempD; - q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirN ])[kn ]= -feqW27_N + c2o1 * c2o27 * TempD; - q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirB ])[kb ]= -feqW27_B + c2o1 * c2o27 * TempD; - q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirT ])[kt ]= -feqW27_T + c2o1 * c2o27 * TempD; - q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSW ])[ksw ]= -feqW27_SW + c2o1 * c1o54 * TempD; - q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNE ])[kne ]= -feqW27_NE + c2o1 * c1o54 * TempD; - q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNW ])[knw ]= -feqW27_NW + c2o1 * c1o54 * TempD; - q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSE ])[kse ]= -feqW27_SE + c2o1 * c1o54 * TempD; - q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBW ])[kbw ]= -feqW27_BW + c2o1 * c1o54 * TempD; - q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTE ])[kte ]= -feqW27_TE + c2o1 * c1o54 * TempD; - q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTW ])[ktw ]= -feqW27_TW + c2o1 * c1o54 * TempD; - q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBE ])[kbe ]= -feqW27_BE + c2o1 * c1o54 * TempD; - q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBS ])[kbs ]= -feqW27_BS + c2o1 * c1o54 * TempD; - q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTN ])[ktn ]= -feqW27_TN + c2o1 * c1o54 * TempD; - q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTS ])[kts ]= -feqW27_TS + c2o1 * c1o54 * TempD; - q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBN ])[kbn ]= -feqW27_BN + c2o1 * c1o54 * TempD; - q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSW])[kbsw]= -feqW27_BSW+ c2o1 * c1o216 * TempD; - q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNE])[ktne]= -feqW27_TNE+ c2o1 * c1o216 * TempD; - q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSW])[ktsw]= -feqW27_TSW+ c2o1 * c1o216 * TempD; - q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNE])[kbne]= -feqW27_BNE+ c2o1 * c1o216 * TempD; - q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNW])[kbnw]= -feqW27_BNW+ c2o1 * c1o216 * TempD; - q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSE])[ktse]= -feqW27_TSE+ c2o1 * c1o216 * TempD; - q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNW])[ktnw]= -feqW27_TNW+ c2o1 * c1o216 * TempD; - q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSE])[kbse]= -feqW27_BSE+ c2o1 * c1o216 * TempD; - //q = q_dirE[k]; if (q>=zero && q<=one) (D27.f[dirW ])[kw ]=(two*feqW27_W -(f27_E *(q*omegaD-one)-omegaD*feq27_E *(q-one))/(omegaD-one)+f27_W *q)/(q+one); - //q = q_dirW[k]; if (q>=zero && q<=one) (D27.f[dirE ])[ke ]=(two*feqW27_E -(f27_W *(q*omegaD-one)-omegaD*feq27_W *(q-one))/(omegaD-one)+f27_E *q)/(q+one); - //q = q_dirN[k]; if (q>=zero && q<=one) (D27.f[dirS ])[ks ]=(two*feqW27_S -(f27_N *(q*omegaD-one)-omegaD*feq27_N *(q-one))/(omegaD-one)+f27_S *q)/(q+one); - //q = q_dirS[k]; if (q>=zero && q<=one) (D27.f[dirN ])[kn ]=(two*feqW27_N -(f27_S *(q*omegaD-one)-omegaD*feq27_S *(q-one))/(omegaD-one)+f27_N *q)/(q+one); - //q = q_dirT[k]; if (q>=zero && q<=one) (D27.f[dirB ])[kb ]=(two*feqW27_B -(f27_T *(q*omegaD-one)-omegaD*feq27_T *(q-one))/(omegaD-one)+f27_B *q)/(q+one); - //q = q_dirB[k]; if (q>=zero && q<=one) (D27.f[dirT ])[kt ]=(two*feqW27_T -(f27_B *(q*omegaD-one)-omegaD*feq27_B *(q-one))/(omegaD-one)+f27_T *q)/(q+one); - //q = q_dirNE[k]; if (q>=zero && q<=one) (D27.f[dirSW ])[ksw ]=(two*feqW27_SW -(f27_NE *(q*omegaD-one)-omegaD*feq27_NE *(q-one))/(omegaD-one)+f27_SW *q)/(q+one); - //q = q_dirSW[k]; if (q>=zero && q<=one) (D27.f[dirNE ])[kne ]=(two*feqW27_NE -(f27_SW *(q*omegaD-one)-omegaD*feq27_SW *(q-one))/(omegaD-one)+f27_NE *q)/(q+one); - //q = q_dirSE[k]; if (q>=zero && q<=one) (D27.f[dirNW ])[knw ]=(two*feqW27_NW -(f27_SE *(q*omegaD-one)-omegaD*feq27_SE *(q-one))/(omegaD-one)+f27_NW *q)/(q+one); - //q = q_dirNW[k]; if (q>=zero && q<=one) (D27.f[dirSE ])[kse ]=(two*feqW27_SE -(f27_NW *(q*omegaD-one)-omegaD*feq27_NW *(q-one))/(omegaD-one)+f27_SE *q)/(q+one); - //q = q_dirTE[k]; if (q>=zero && q<=one) (D27.f[dirBW ])[kbw ]=(two*feqW27_BW -(f27_TE *(q*omegaD-one)-omegaD*feq27_TE *(q-one))/(omegaD-one)+f27_BW *q)/(q+one); - //q = q_dirBW[k]; if (q>=zero && q<=one) (D27.f[dirTE ])[kte ]=(two*feqW27_TE -(f27_BW *(q*omegaD-one)-omegaD*feq27_BW *(q-one))/(omegaD-one)+f27_TE *q)/(q+one); - //q = q_dirBE[k]; if (q>=zero && q<=one) (D27.f[dirTW ])[ktw ]=(two*feqW27_TW -(f27_BE *(q*omegaD-one)-omegaD*feq27_BE *(q-one))/(omegaD-one)+f27_TW *q)/(q+one); - //q = q_dirTW[k]; if (q>=zero && q<=one) (D27.f[dirBE ])[kbe ]=(two*feqW27_BE -(f27_TW *(q*omegaD-one)-omegaD*feq27_TW *(q-one))/(omegaD-one)+f27_BE *q)/(q+one); - //q = q_dirTN[k]; if (q>=zero && q<=one) (D27.f[dirBS ])[kbs ]=(two*feqW27_BS -(f27_TN *(q*omegaD-one)-omegaD*feq27_TN *(q-one))/(omegaD-one)+f27_BS *q)/(q+one); - //q = q_dirBS[k]; if (q>=zero && q<=one) (D27.f[dirTN ])[ktn ]=(two*feqW27_TN -(f27_BS *(q*omegaD-one)-omegaD*feq27_BS *(q-one))/(omegaD-one)+f27_TN *q)/(q+one); - //q = q_dirBN[k]; if (q>=zero && q<=one) (D27.f[dirTS ])[kts ]=(two*feqW27_TS -(f27_BN *(q*omegaD-one)-omegaD*feq27_BN *(q-one))/(omegaD-one)+f27_TS *q)/(q+one); - //q = q_dirTS[k]; if (q>=zero && q<=one) (D27.f[dirBN ])[kbn ]=(two*feqW27_BN -(f27_TS *(q*omegaD-one)-omegaD*feq27_TS *(q-one))/(omegaD-one)+f27_BN *q)/(q+one); - //q = q_dirTNE[k]; if (q>=zero && q<=one) (D27.f[dirBSW])[kbsw]=(two*feqW27_BSW-(f27_TNE*(q*omegaD-one)-omegaD*feq27_TNE*(q-one))/(omegaD-one)+f27_BSW*q)/(q+one); - //q = q_dirBSW[k]; if (q>=zero && q<=one) (D27.f[dirTNE])[ktne]=(two*feqW27_TNE-(f27_BSW*(q*omegaD-one)-omegaD*feq27_BSW*(q-one))/(omegaD-one)+f27_TNE*q)/(q+one); - //q = q_dirBNE[k]; if (q>=zero && q<=one) (D27.f[dirTSW])[ktsw]=(two*feqW27_TSW-(f27_BNE*(q*omegaD-one)-omegaD*feq27_BNE*(q-one))/(omegaD-one)+f27_TSW*q)/(q+one); - //q = q_dirTSW[k]; if (q>=zero && q<=one) (D27.f[dirBNE])[kbne]=(two*feqW27_BNE-(f27_TSW*(q*omegaD-one)-omegaD*feq27_TSW*(q-one))/(omegaD-one)+f27_BNE*q)/(q+one); - //q = q_dirTSE[k]; if (q>=zero && q<=one) (D27.f[dirBNW])[kbnw]=(two*feqW27_BNW-(f27_TSE*(q*omegaD-one)-omegaD*feq27_TSE*(q-one))/(omegaD-one)+f27_BNW*q)/(q+one); - //q = q_dirBNW[k]; if (q>=zero && q<=one) (D27.f[dirTSE])[ktse]=(two*feqW27_TSE-(f27_BNW*(q*omegaD-one)-omegaD*feq27_BNW*(q-one))/(omegaD-one)+f27_TSE*q)/(q+one); - //q = q_dirBSE[k]; if (q>=zero && q<=one) (D27.f[dirTNW])[ktnw]=(two*feqW27_TNW-(f27_BSE*(q*omegaD-one)-omegaD*feq27_BSE*(q-one))/(omegaD-one)+f27_TNW*q)/(q+one); - //q = q_dirTNW[k]; if (q>=zero && q<=one) (D27.f[dirBSE])[kbse]=(two*feqW27_BSE-(f27_TNW*(q*omegaD-one)-omegaD*feq27_TNW*(q-one))/(omegaD-one)+f27_BSE*q)/(q+one); - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QADPressIncomp7(int inx, - int iny, - real* DD, - real* DD7, - real* temp, - real* velo, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - /* Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - }*/ - - Distributions7 D7; - if (evenOrOdd==true) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - ////////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB; - - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - ////////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - //unsigned int ksw = neighborY[kw]; - //unsigned int kne = KQK; - //unsigned int kse = ks; - //unsigned int knw = kw; - //unsigned int kbw = neighborZ[kw]; - //unsigned int kte = KQK; - //unsigned int kbe = kb; - //unsigned int ktw = kw; - //unsigned int kbs = neighborZ[ks]; - //unsigned int ktn = KQK; - //unsigned int kbn = kb; - //unsigned int kts = ks; - //unsigned int ktse = ks; - //unsigned int kbnw = kbw; - //unsigned int ktnw = kw; - //unsigned int kbse = kbs; - //unsigned int ktsw = ksw; - //unsigned int kbne = kb; - //unsigned int ktne = KQK; - //unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - /* real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, - f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ];*/ - //////////////////////////////////////////////////////////////////////////////// - //real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - //real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - //real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - ////d�rrrrrty !!!!!!!!!!!!! - // real vx1 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - // real vx2 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - // real vx3 = ten * ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - - //real cu_sq =1.5*(vx1*vx1+vx2*vx2+vx3*vx3); - //real ux_sq = vx1 * vx1; - //real uy_sq = vx2 * vx2; - //real uz_sq = vx3 * vx3; - ////////////////////////////////////////////////////////////////////////// - //BGK - //real omegaD = three - sqrt(three); - //real Lam = -(c1o2-one/omegaD); - //real nue_d = Lam/three; - ////real ae = zero; - //real ae = diffusivity/nue_d - one; - - real f7_ZERO,f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; - //real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; - //real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; - //real TempD = temp[k]; - - - f7_ZERO = (D7.f[0])[kzero]; - f7_W = (D7.f[1])[ke ]; - f7_E = (D7.f[2])[kw ]; - f7_S = (D7.f[3])[kn ]; - f7_N = (D7.f[4])[ks ]; - f7_B = (D7.f[5])[kt ]; - f7_T = (D7.f[6])[kb ]; - - real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; - - ////feq7_ZERO = ConcD*(c1o3*(ae*(-3.0))-(ux_sq+uy_sq+uz_sq)); - //feq7_E = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)+vx1*c1o2); - //feq7_W = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)-vx1*c1o2); - //feq7_N = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)+vx2*c1o2); - //feq7_S = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)-vx2*c1o2); - //feq7_T = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)+vx3*c1o2); - //feq7_B = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)-vx3*c1o2); - - ////feq7_ZERO = TempD*(c1o3*(ae*(-3.0f))-(ux_sq+uy_sq+uz_sq)); - //feqW7_E = feq7_E;// TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)+vx1_Inflow*c1o2); - //feqW7_W = feq7_W;// TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)-vx1_Inflow*c1o2); - //feqW7_N = feq7_N;// TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)+vx2_Inflow*c1o2); - //feqW7_S = feq7_S;// TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)-vx2_Inflow*c1o2); - //feqW7_T = feq7_T;// TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)+vx3_Inflow*c1o2); - //feqW7_B = feq7_B;// TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)-vx3_Inflow*c1o2); - - ////////////////////////////////////////////////////////////////////////// - //TRT Yoshida Kernel - based on Ying - real cs2 = c1o4; - real Lam = diffusivity/(c1o1)/cs2; - //real omegaD = - c1o1 / (Lam + c1o2); - real nue_d = Lam/c3o1; - - ////////////////////////////////////////////////////////////////////////// - //pointertausch - if (evenOrOdd==false) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - - //////////////////////////////////////////////////////////////////////////// - ////mit Q's - //real /*feq,*/ q; - //q = q_dirE[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[2])[kw]=(two*feqW7_W-(f7_E*(q*omegaD-one)-omegaD*feq7_E*(q-one))/(omegaD-one)+f7_W*q)/(q+one);//f7_W - feq7_W + feqW7_E; - //} - - //q = q_dirW[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[1])[ke]=(two*feqW7_E-(f7_W*(q*omegaD-one)-omegaD*feq7_W*(q-one))/(omegaD-one)+f7_E*q)/(q+one);//f7_E - feq7_E + feqW7_W; - //} - - //q = q_dirN[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[4])[ks]=(two*feqW7_S-(f7_N*(q*omegaD-1.)-omegaD*feq7_N*(q-one))/(omegaD-one)+f7_S*q)/(q+one);//f7_S - feq7_S + feqW7_N; - //} - - //q = q_dirS[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[3])[kn]=(two*feqW7_N-(f7_S*(q*omegaD-one)-omegaD*feq7_S*(q-one))/(omegaD-one)+f7_N*q)/(q+one);//f7_N - feq7_N + feqW7_S; - //} - - //q = q_dirT[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[6])[kb]=(two*feqW7_B-(f7_T*(q*omegaD-1.)-omegaD*feq7_T*(q-one))/(omegaD-one)+f7_B*q)/(q+one);//f7_B - feq7_B + feqW7_T; - //} - - //q = q_dirB[k]; - //if (q>=zero && q<=one) - //{ - // //q=0.; - // (D7.f[5])[kt]=(two*feqW7_T-(f7_B*(q*omegaD-one)-omegaD*feq7_B*(q-one))/(omegaD-one)+f7_T*q)/(q+one);//f7_T - feq7_T + feqW7_B; - //} - - //////////////////////////////////////////////////////////////////////////// - ////ohne Q's - //real /*feq,*/ q; - //q = q_dirE[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[2])[kw]= 0.1;//test - // //(D7.f[2])[kw]=f7_W - feq7_W + feqW7_E; - //} - - //q = q_dirW[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[1])[ke]= 0.1;//test - // //(D7.f[1])[ke]=f7_E - feq7_E + feqW7_W; - //} - - //q = q_dirN[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[4])[ks]= 0.1;//test - // //(D7.f[4])[ks]=f7_S - feq7_S + feqW7_N; - //} - - //q = q_dirS[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[3])[kn]= 0.1;//test - // //(D7.f[3])[kn]=f7_N - feq7_N + feqW7_S; - //} - - //q = q_dirT[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[6])[kb]= 0.1;//test - // //(D7.f[6])[kb]=f7_B - feq7_B + feqW7_T; - //} - - //q = q_dirB[k]; - //if (q>=zero && q<=one) - //{ - // (D7.f[5])[kt]= 0.1;//test - // //(D7.f[5])[kt]=f7_T - feq7_T + feqW7_B; - //} - - - ////////////////////////////////////////////////////////////////////////// - //ohne Q's aber mit TRT - real /*feq,*/ q; - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[2])[kw]= f7_W + nue_d * ConcD; - } - - q = q_dirW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[1])[ke]= f7_E + nue_d * ConcD; - } - - q = q_dirN[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[4])[ks]= f7_S + nue_d * ConcD; - } - - q = q_dirS[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[3])[kn]= f7_N + nue_d * ConcD; - } - - q = q_dirT[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[6])[kb]= f7_B + nue_d * ConcD; - } - - q = q_dirB[k]; - if (q>=c0o1 && q<=c1o1) - { - (D7.f[5])[kt]= f7_T + nue_d * ConcD; - } - - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QADPressIncomp27( int inx, - int iny, - real* DD, - real* DD27, - real* temp, - real* velo, - real diffusivity, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - - Distributions27 D27; - if (evenOrOdd==true) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<kQ) - { - //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; - //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - //unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - //real f_ZERO = (D.f[dirZERO])[kzero]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); - real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); - real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); - //////////////////////////////////////////////////////////////////////////////// - //real f27_W = (D27.f[dirE ])[ke ]; - //real f27_E = (D27.f[dirW ])[kw ]; - //real f27_S = (D27.f[dirN ])[kn ]; - //real f27_N = (D27.f[dirS ])[ks ]; - //real f27_B = (D27.f[dirT ])[kt ]; - //real f27_T = (D27.f[dirB ])[kb ]; - //real f27_SW = (D27.f[dirNE ])[kne ]; - //real f27_NE = (D27.f[dirSW ])[ksw ]; - //real f27_NW = (D27.f[dirSE ])[kse ]; - //real f27_SE = (D27.f[dirNW ])[knw ]; - //real f27_BW = (D27.f[dirTE ])[kte ]; - //real f27_TE = (D27.f[dirBW ])[kbw ]; - //real f27_TW = (D27.f[dirBE ])[kbe ]; - //real f27_BE = (D27.f[dirTW ])[ktw ]; - //real f27_BS = (D27.f[dirTN ])[ktn ]; - //real f27_TN = (D27.f[dirBS ])[kbs ]; - //real f27_TS = (D27.f[dirBN ])[kbn ]; - //real f27_BN = (D27.f[dirTS ])[kts ]; - //real f27_ZERO = (D27.f[dirZERO])[kzero]; - //real f27_BSW = (D27.f[dirTNE ])[ktne ]; - //real f27_BNE = (D27.f[dirTSW ])[ktsw ]; - //real f27_BNW = (D27.f[dirTSE ])[ktse ]; - //real f27_BSE = (D27.f[dirTNW ])[ktnw ]; - //real f27_TSW = (D27.f[dirBNE ])[kbne ]; - //real f27_TNE = (D27.f[dirBSW ])[kbsw ]; - //real f27_TNW = (D27.f[dirBSE ])[kbse ]; - //real f27_TSE = (D27.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - //////////////////////////////////////////////////////////////////////////////// - //real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + - //f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + - //f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; - - //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); - /*real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);*/ - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real TempD = temp[k]; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // velocity inflow - //vx1 = zero; - //vx2 = zero; - //vx3 = velo[k]; - - //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); - real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); //feq27_E ;// - real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); //feq27_W ;// - real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); //feq27_N ;// - real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); //feq27_S ;// - real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); //feq27_T ;// - real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); //feq27_B ;// - real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); //feq27_NE ;// - real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); //feq27_SW ;// - real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); //feq27_SE ;// - real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); //feq27_NW ;// - real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); //feq27_TE ;// - real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); //feq27_BW ;// - real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); //feq27_BE ;// - real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); //feq27_TW ;// - real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); //feq27_TN ;// - real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); //feq27_BS ;// - real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); //feq27_BN ;// - real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); //feq27_TS ;// - real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); //feq27_TNE;// - real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); //feq27_BSW;// - real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); //feq27_BNE;// - real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); //feq27_TSW;// - real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); //feq27_TSE;// - real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); //feq27_BNW;// - real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); //feq27_BSE;// - real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); //feq27_TNW;// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real omegaD = c3o1 - sqrt(c3o1); - //real Lam = -(c1o2-one/omegaD); - //real nue_d = Lam/three; - //real ae = zero; - //real ae = diffusivity/nue_d - one; - - - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real q; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirW ])[kw ]= -feqW27_W + c2o1 * c2o27 * TempD; - q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirE ])[ke ]= -feqW27_E + c2o1 * c2o27 * TempD; - q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirS ])[ks ]= -feqW27_S + c2o1 * c2o27 * TempD; - q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirN ])[kn ]= -feqW27_N + c2o1 * c2o27 * TempD; - q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirB ])[kb ]= -feqW27_B + c2o1 * c2o27 * TempD; - q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirT ])[kt ]= -feqW27_T + c2o1 * c2o27 * TempD; - q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSW ])[ksw ]= -feqW27_SW + c2o1 * c1o54 * TempD; - q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNE ])[kne ]= -feqW27_NE + c2o1 * c1o54 * TempD; - q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirNW ])[knw ]= -feqW27_NW + c2o1 * c1o54 * TempD; - q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirSE ])[kse ]= -feqW27_SE + c2o1 * c1o54 * TempD; - q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBW ])[kbw ]= -feqW27_BW + c2o1 * c1o54 * TempD; - q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTE ])[kte ]= -feqW27_TE + c2o1 * c1o54 * TempD; - q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTW ])[ktw ]= -feqW27_TW + c2o1 * c1o54 * TempD; - q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBE ])[kbe ]= -feqW27_BE + c2o1 * c1o54 * TempD; - q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBS ])[kbs ]= -feqW27_BS + c2o1 * c1o54 * TempD; - q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTN ])[ktn ]= -feqW27_TN + c2o1 * c1o54 * TempD; - q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTS ])[kts ]= -feqW27_TS + c2o1 * c1o54 * TempD; - q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBN ])[kbn ]= -feqW27_BN + c2o1 * c1o54 * TempD; - q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSW])[kbsw]= -feqW27_BSW+ c2o1 * c1o216 * TempD; - q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNE])[ktne]= -feqW27_TNE+ c2o1 * c1o216 * TempD; - q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSW])[ktsw]= -feqW27_TSW+ c2o1 * c1o216 * TempD; - q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNE])[kbne]= -feqW27_BNE+ c2o1 * c1o216 * TempD; - q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBNW])[kbnw]= -feqW27_BNW+ c2o1 * c1o216 * TempD; - q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTSE])[ktse]= -feqW27_TSE+ c2o1 * c1o216 * TempD; - q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirTNW])[ktnw]= -feqW27_TNW+ c2o1 * c1o216 * TempD; - q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[dirBSE])[kbse]= -feqW27_BSE+ c2o1 * c1o216 * TempD; - //q = q_dirE[k]; if (q>=zero && q<=one) (D27.f[dirW ])[kw ]=(two*feqW27_W -(f27_E *(q*omegaD-one)-omegaD*feq27_E *(q-one))/(omegaD-one)+f27_W *q)/(q+one); - //q = q_dirW[k]; if (q>=zero && q<=one) (D27.f[dirE ])[ke ]=(two*feqW27_E -(f27_W *(q*omegaD-one)-omegaD*feq27_W *(q-one))/(omegaD-one)+f27_E *q)/(q+one); - //q = q_dirN[k]; if (q>=zero && q<=one) (D27.f[dirS ])[ks ]=(two*feqW27_S -(f27_N *(q*omegaD-one)-omegaD*feq27_N *(q-one))/(omegaD-one)+f27_S *q)/(q+one); - //q = q_dirS[k]; if (q>=zero && q<=one) (D27.f[dirN ])[kn ]=(two*feqW27_N -(f27_S *(q*omegaD-one)-omegaD*feq27_S *(q-one))/(omegaD-one)+f27_N *q)/(q+one); - //q = q_dirT[k]; if (q>=zero && q<=one) (D27.f[dirB ])[kb ]=(two*feqW27_B -(f27_T *(q*omegaD-one)-omegaD*feq27_T *(q-one))/(omegaD-one)+f27_B *q)/(q+one); - //q = q_dirB[k]; if (q>=zero && q<=one) (D27.f[dirT ])[kt ]=(two*feqW27_T -(f27_B *(q*omegaD-one)-omegaD*feq27_B *(q-one))/(omegaD-one)+f27_T *q)/(q+one); - //q = q_dirNE[k]; if (q>=zero && q<=one) (D27.f[dirSW ])[ksw ]=(two*feqW27_SW -(f27_NE *(q*omegaD-one)-omegaD*feq27_NE *(q-one))/(omegaD-one)+f27_SW *q)/(q+one); - //q = q_dirSW[k]; if (q>=zero && q<=one) (D27.f[dirNE ])[kne ]=(two*feqW27_NE -(f27_SW *(q*omegaD-one)-omegaD*feq27_SW *(q-one))/(omegaD-one)+f27_NE *q)/(q+one); - //q = q_dirSE[k]; if (q>=zero && q<=one) (D27.f[dirNW ])[knw ]=(two*feqW27_NW -(f27_SE *(q*omegaD-one)-omegaD*feq27_SE *(q-one))/(omegaD-one)+f27_NW *q)/(q+one); - //q = q_dirNW[k]; if (q>=zero && q<=one) (D27.f[dirSE ])[kse ]=(two*feqW27_SE -(f27_NW *(q*omegaD-one)-omegaD*feq27_NW *(q-one))/(omegaD-one)+f27_SE *q)/(q+one); - //q = q_dirTE[k]; if (q>=zero && q<=one) (D27.f[dirBW ])[kbw ]=(two*feqW27_BW -(f27_TE *(q*omegaD-one)-omegaD*feq27_TE *(q-one))/(omegaD-one)+f27_BW *q)/(q+one); - //q = q_dirBW[k]; if (q>=zero && q<=one) (D27.f[dirTE ])[kte ]=(two*feqW27_TE -(f27_BW *(q*omegaD-one)-omegaD*feq27_BW *(q-one))/(omegaD-one)+f27_TE *q)/(q+one); - //q = q_dirBE[k]; if (q>=zero && q<=one) (D27.f[dirTW ])[ktw ]=(two*feqW27_TW -(f27_BE *(q*omegaD-one)-omegaD*feq27_BE *(q-one))/(omegaD-one)+f27_TW *q)/(q+one); - //q = q_dirTW[k]; if (q>=zero && q<=one) (D27.f[dirBE ])[kbe ]=(two*feqW27_BE -(f27_TW *(q*omegaD-one)-omegaD*feq27_TW *(q-one))/(omegaD-one)+f27_BE *q)/(q+one); - //q = q_dirTN[k]; if (q>=zero && q<=one) (D27.f[dirBS ])[kbs ]=(two*feqW27_BS -(f27_TN *(q*omegaD-one)-omegaD*feq27_TN *(q-one))/(omegaD-one)+f27_BS *q)/(q+one); - //q = q_dirBS[k]; if (q>=zero && q<=one) (D27.f[dirTN ])[ktn ]=(two*feqW27_TN -(f27_BS *(q*omegaD-one)-omegaD*feq27_BS *(q-one))/(omegaD-one)+f27_TN *q)/(q+one); - //q = q_dirBN[k]; if (q>=zero && q<=one) (D27.f[dirTS ])[kts ]=(two*feqW27_TS -(f27_BN *(q*omegaD-one)-omegaD*feq27_BN *(q-one))/(omegaD-one)+f27_TS *q)/(q+one); - //q = q_dirTS[k]; if (q>=zero && q<=one) (D27.f[dirBN ])[kbn ]=(two*feqW27_BN -(f27_TS *(q*omegaD-one)-omegaD*feq27_TS *(q-one))/(omegaD-one)+f27_BN *q)/(q+one); - //q = q_dirTNE[k]; if (q>=zero && q<=one) (D27.f[dirBSW])[kbsw]=(two*feqW27_BSW-(f27_TNE*(q*omegaD-one)-omegaD*feq27_TNE*(q-one))/(omegaD-one)+f27_BSW*q)/(q+one); - //q = q_dirBSW[k]; if (q>=zero && q<=one) (D27.f[dirTNE])[ktne]=(two*feqW27_TNE-(f27_BSW*(q*omegaD-one)-omegaD*feq27_BSW*(q-one))/(omegaD-one)+f27_TNE*q)/(q+one); - //q = q_dirBNE[k]; if (q>=zero && q<=one) (D27.f[dirTSW])[ktsw]=(two*feqW27_TSW-(f27_BNE*(q*omegaD-one)-omegaD*feq27_BNE*(q-one))/(omegaD-one)+f27_TSW*q)/(q+one); - //q = q_dirTSW[k]; if (q>=zero && q<=one) (D27.f[dirBNE])[kbne]=(two*feqW27_BNE-(f27_TSW*(q*omegaD-one)-omegaD*feq27_TSW*(q-one))/(omegaD-one)+f27_BNE*q)/(q+one); - //q = q_dirTSE[k]; if (q>=zero && q<=one) (D27.f[dirBNW])[kbnw]=(two*feqW27_BNW-(f27_TSE*(q*omegaD-one)-omegaD*feq27_TSE*(q-one))/(omegaD-one)+f27_BNW*q)/(q+one); - //q = q_dirBNW[k]; if (q>=zero && q<=one) (D27.f[dirTSE])[ktse]=(two*feqW27_TSE-(f27_BNW*(q*omegaD-one)-omegaD*feq27_BNW*(q-one))/(omegaD-one)+f27_TSE*q)/(q+one); - //q = q_dirBSE[k]; if (q>=zero && q<=one) (D27.f[dirTNW])[ktnw]=(two*feqW27_TNW-(f27_BSE*(q*omegaD-one)-omegaD*feq27_BSE*(q-one))/(omegaD-one)+f27_TNW*q)/(q+one); - //q = q_dirTNW[k]; if (q>=zero && q<=one) (D27.f[dirBSE])[kbse]=(two*feqW27_BSE-(f27_TNW*(q*omegaD-one)-omegaD*feq27_TNW*(q-one))/(omegaD-one)+f27_BSE*q)/(q+one); - } -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - diff --git a/src/gpu/VirtualFluids_GPU/GPU/AdvectionDiffusion27chim.cu b/src/gpu/VirtualFluids_GPU/GPU/AdvectionDiffusion27chim.cu new file mode 100644 index 0000000000000000000000000000000000000000..8f54358e04063c9063c873caf02a86e76bb7f936 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/AdvectionDiffusion27chim.cu @@ -0,0 +1,536 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file AdvectionDiffusion27chim.cu +//! \ingroup GPU +//! \author Martin Schoenherr +//======================================================================================= +/* Device code */ +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" + +#include <lbm/constants/NumericConstants.h> + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + +//////////////////////////////////////////////////////////////////////////////// +//! \brief forward chimera transformation \ref forwardChimera +//! - Chimera transform from distributions to central moments as defined in Eq. (43)-(45) in \ref +//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a> +inline __device__ void forwardChimera(real &mfa, real &mfb, real &mfc, real vv, real v2) { + real m1 = (mfa + mfc) + mfb; + real m2 = mfc - mfa; + mfc = (mfc + mfa) + (v2*m1 - c2o1*vv*m2); + mfb = m2 - vv*m1; + mfa = m1; +} + + +//////////////////////////////////////////////////////////////////////////////// +//! \brief backward chimera transformation \ref backwardChimera +//! - Chimera transform from central moments to distributions as defined in Eq. (88)-(96) in \ref +//! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a> +inline __device__ void backwardChimera(real &mfa, real &mfb, real &mfc, real vv, real v2) { + real ma = (mfc + mfa*(v2 - vv))*c1o2 + mfb*(vv - c1o2); + real mb = ((mfa - mfc) - mfa*v2) - c2o1*mfb*vv; + mfc = (mfc + mfa*(v2 + vv))*c1o2 + mfb*(vv + c1o2); + mfb = mb; + mfa = ma; +} + + +//////////////////////////////////////////////////////////////////////////////// +__global__ void Factorized_Central_Moments_Advection_Diffusion_Device_Kernel( + real omegaDiffusivity, + uint* typeOfGridNode, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + real* distributions, + real* distributionsAD, + int size_Mat, + real* forces, + bool isEvenTimestep) +{ + ////////////////////////////////////////////////////////////////////////// + //! Cumulant K17 Kernel is based on \ref + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! and \ref + //! <a href="https://doi.org/10.1016/j.jcp.2017.07.004"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.07.004 ]</b></a> + //! + //! The cumulant kernel is executed in the following steps + //! + //////////////////////////////////////////////////////////////////////////////// + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; + const unsigned y = blockIdx.x; + const unsigned z = blockIdx.y; + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + + ////////////////////////////////////////////////////////////////////////// + // run for all indices in size_Mat and fluid nodes + if ((k < size_Mat) && (typeOfGridNode[k] == GEO_FLUID)) + { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + if (isEvenTimestep) + { + dist.f[DIR_P00 ] = &distributions[DIR_P00 *size_Mat]; + dist.f[DIR_M00 ] = &distributions[DIR_M00 *size_Mat]; + dist.f[DIR_0P0 ] = &distributions[DIR_0P0 *size_Mat]; + dist.f[DIR_0M0 ] = &distributions[DIR_0M0 *size_Mat]; + dist.f[DIR_00P ] = &distributions[DIR_00P *size_Mat]; + dist.f[DIR_00M ] = &distributions[DIR_00M *size_Mat]; + dist.f[DIR_PP0 ] = &distributions[DIR_PP0 *size_Mat]; + dist.f[DIR_MM0 ] = &distributions[DIR_MM0 *size_Mat]; + dist.f[DIR_PM0 ] = &distributions[DIR_PM0 *size_Mat]; + dist.f[DIR_MP0 ] = &distributions[DIR_MP0 *size_Mat]; + dist.f[DIR_P0P ] = &distributions[DIR_P0P *size_Mat]; + dist.f[DIR_M0M ] = &distributions[DIR_M0M *size_Mat]; + dist.f[DIR_P0M ] = &distributions[DIR_P0M *size_Mat]; + dist.f[DIR_M0P ] = &distributions[DIR_M0P *size_Mat]; + dist.f[DIR_0PP ] = &distributions[DIR_0PP *size_Mat]; + dist.f[DIR_0MM ] = &distributions[DIR_0MM *size_Mat]; + dist.f[DIR_0PM ] = &distributions[DIR_0PM *size_Mat]; + dist.f[DIR_0MP ] = &distributions[DIR_0MP *size_Mat]; + dist.f[DIR_000] = &distributions[DIR_000*size_Mat]; + dist.f[DIR_PPP ] = &distributions[DIR_PPP *size_Mat]; + dist.f[DIR_MMP ] = &distributions[DIR_MMP *size_Mat]; + dist.f[DIR_PMP ] = &distributions[DIR_PMP *size_Mat]; + dist.f[DIR_MPP ] = &distributions[DIR_MPP *size_Mat]; + dist.f[DIR_PPM ] = &distributions[DIR_PPM *size_Mat]; + dist.f[DIR_MMM ] = &distributions[DIR_MMM *size_Mat]; + dist.f[DIR_PMM ] = &distributions[DIR_PMM *size_Mat]; + dist.f[DIR_MPM ] = &distributions[DIR_MPM *size_Mat]; + } + else + { + dist.f[DIR_M00 ] = &distributions[DIR_P00 *size_Mat]; + dist.f[DIR_P00 ] = &distributions[DIR_M00 *size_Mat]; + dist.f[DIR_0M0 ] = &distributions[DIR_0P0 *size_Mat]; + dist.f[DIR_0P0 ] = &distributions[DIR_0M0 *size_Mat]; + dist.f[DIR_00M ] = &distributions[DIR_00P *size_Mat]; + dist.f[DIR_00P ] = &distributions[DIR_00M *size_Mat]; + dist.f[DIR_MM0 ] = &distributions[DIR_PP0 *size_Mat]; + dist.f[DIR_PP0 ] = &distributions[DIR_MM0 *size_Mat]; + dist.f[DIR_MP0 ] = &distributions[DIR_PM0 *size_Mat]; + dist.f[DIR_PM0 ] = &distributions[DIR_MP0 *size_Mat]; + dist.f[DIR_M0M ] = &distributions[DIR_P0P *size_Mat]; + dist.f[DIR_P0P ] = &distributions[DIR_M0M *size_Mat]; + dist.f[DIR_M0P ] = &distributions[DIR_P0M *size_Mat]; + dist.f[DIR_P0M ] = &distributions[DIR_M0P *size_Mat]; + dist.f[DIR_0MM ] = &distributions[DIR_0PP *size_Mat]; + dist.f[DIR_0PP ] = &distributions[DIR_0MM *size_Mat]; + dist.f[DIR_0MP ] = &distributions[DIR_0PM *size_Mat]; + dist.f[DIR_0PM ] = &distributions[DIR_0MP *size_Mat]; + dist.f[DIR_000] = &distributions[DIR_000*size_Mat]; + dist.f[DIR_MMM ] = &distributions[DIR_PPP *size_Mat]; + dist.f[DIR_PPM ] = &distributions[DIR_MMP *size_Mat]; + dist.f[DIR_MPM ] = &distributions[DIR_PMP *size_Mat]; + dist.f[DIR_PMM ] = &distributions[DIR_MPP *size_Mat]; + dist.f[DIR_MMP ] = &distributions[DIR_PPM *size_Mat]; + dist.f[DIR_PPP ] = &distributions[DIR_MMM *size_Mat]; + dist.f[DIR_MPP ] = &distributions[DIR_PMM *size_Mat]; + dist.f[DIR_PMP ] = &distributions[DIR_MPM *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + Distributions27 distAD; + if (isEvenTimestep) + { + distAD.f[DIR_P00 ] = &distributionsAD[DIR_P00 *size_Mat]; + distAD.f[DIR_M00 ] = &distributionsAD[DIR_M00 *size_Mat]; + distAD.f[DIR_0P0 ] = &distributionsAD[DIR_0P0 *size_Mat]; + distAD.f[DIR_0M0 ] = &distributionsAD[DIR_0M0 *size_Mat]; + distAD.f[DIR_00P ] = &distributionsAD[DIR_00P *size_Mat]; + distAD.f[DIR_00M ] = &distributionsAD[DIR_00M *size_Mat]; + distAD.f[DIR_PP0 ] = &distributionsAD[DIR_PP0 *size_Mat]; + distAD.f[DIR_MM0 ] = &distributionsAD[DIR_MM0 *size_Mat]; + distAD.f[DIR_PM0 ] = &distributionsAD[DIR_PM0 *size_Mat]; + distAD.f[DIR_MP0 ] = &distributionsAD[DIR_MP0 *size_Mat]; + distAD.f[DIR_P0P ] = &distributionsAD[DIR_P0P *size_Mat]; + distAD.f[DIR_M0M ] = &distributionsAD[DIR_M0M *size_Mat]; + distAD.f[DIR_P0M ] = &distributionsAD[DIR_P0M *size_Mat]; + distAD.f[DIR_M0P ] = &distributionsAD[DIR_M0P *size_Mat]; + distAD.f[DIR_0PP ] = &distributionsAD[DIR_0PP *size_Mat]; + distAD.f[DIR_0MM ] = &distributionsAD[DIR_0MM *size_Mat]; + distAD.f[DIR_0PM ] = &distributionsAD[DIR_0PM *size_Mat]; + distAD.f[DIR_0MP ] = &distributionsAD[DIR_0MP *size_Mat]; + distAD.f[DIR_000] = &distributionsAD[DIR_000*size_Mat]; + distAD.f[DIR_PPP ] = &distributionsAD[DIR_PPP *size_Mat]; + distAD.f[DIR_MMP ] = &distributionsAD[DIR_MMP *size_Mat]; + distAD.f[DIR_PMP ] = &distributionsAD[DIR_PMP *size_Mat]; + distAD.f[DIR_MPP ] = &distributionsAD[DIR_MPP *size_Mat]; + distAD.f[DIR_PPM ] = &distributionsAD[DIR_PPM *size_Mat]; + distAD.f[DIR_MMM ] = &distributionsAD[DIR_MMM *size_Mat]; + distAD.f[DIR_PMM ] = &distributionsAD[DIR_PMM *size_Mat]; + distAD.f[DIR_MPM ] = &distributionsAD[DIR_MPM *size_Mat]; + } + else + { + distAD.f[DIR_M00 ] = &distributionsAD[DIR_P00 *size_Mat]; + distAD.f[DIR_P00 ] = &distributionsAD[DIR_M00 *size_Mat]; + distAD.f[DIR_0M0 ] = &distributionsAD[DIR_0P0 *size_Mat]; + distAD.f[DIR_0P0 ] = &distributionsAD[DIR_0M0 *size_Mat]; + distAD.f[DIR_00M ] = &distributionsAD[DIR_00P *size_Mat]; + distAD.f[DIR_00P ] = &distributionsAD[DIR_00M *size_Mat]; + distAD.f[DIR_MM0 ] = &distributionsAD[DIR_PP0 *size_Mat]; + distAD.f[DIR_PP0 ] = &distributionsAD[DIR_MM0 *size_Mat]; + distAD.f[DIR_MP0 ] = &distributionsAD[DIR_PM0 *size_Mat]; + distAD.f[DIR_PM0 ] = &distributionsAD[DIR_MP0 *size_Mat]; + distAD.f[DIR_M0M ] = &distributionsAD[DIR_P0P *size_Mat]; + distAD.f[DIR_P0P ] = &distributionsAD[DIR_M0M *size_Mat]; + distAD.f[DIR_M0P ] = &distributionsAD[DIR_P0M *size_Mat]; + distAD.f[DIR_P0M ] = &distributionsAD[DIR_M0P *size_Mat]; + distAD.f[DIR_0MM ] = &distributionsAD[DIR_0PP *size_Mat]; + distAD.f[DIR_0PP ] = &distributionsAD[DIR_0MM *size_Mat]; + distAD.f[DIR_0MP ] = &distributionsAD[DIR_0PM *size_Mat]; + distAD.f[DIR_0PM ] = &distributionsAD[DIR_0MP *size_Mat]; + distAD.f[DIR_000] = &distributionsAD[DIR_000*size_Mat]; + distAD.f[DIR_MMM ] = &distributionsAD[DIR_PPP *size_Mat]; + distAD.f[DIR_PPM ] = &distributionsAD[DIR_MMP *size_Mat]; + distAD.f[DIR_MPM ] = &distributionsAD[DIR_PMP *size_Mat]; + distAD.f[DIR_PMM ] = &distributionsAD[DIR_MPP *size_Mat]; + distAD.f[DIR_MMP ] = &distributionsAD[DIR_PPM *size_Mat]; + distAD.f[DIR_PPP ] = &distributionsAD[DIR_MMM *size_Mat]; + distAD.f[DIR_MPP ] = &distributionsAD[DIR_PMM *size_Mat]; + distAD.f[DIR_PMP ] = &distributionsAD[DIR_MPM *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + //! - Set neighbor indices (necessary for indirect addressing) + uint kw = neighborX[k]; + uint ks = neighborY[k]; + uint kb = neighborZ[k]; + uint ksw = neighborY[kw]; + uint kbw = neighborZ[kw]; + uint kbs = neighborZ[ks]; + uint kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions Fluid + //! + real fcbb = (dist.f[DIR_P00 ])[k]; + real fabb = (dist.f[DIR_M00 ])[kw]; + real fbcb = (dist.f[DIR_0P0 ])[k]; + real fbab = (dist.f[DIR_0M0 ])[ks]; + real fbbc = (dist.f[DIR_00P ])[k]; + real fbba = (dist.f[DIR_00M ])[kb]; + real fccb = (dist.f[DIR_PP0 ])[k]; + real faab = (dist.f[DIR_MM0 ])[ksw]; + real fcab = (dist.f[DIR_PM0 ])[ks]; + real facb = (dist.f[DIR_MP0 ])[kw]; + real fcbc = (dist.f[DIR_P0P ])[k]; + real faba = (dist.f[DIR_M0M ])[kbw]; + real fcba = (dist.f[DIR_P0M ])[kb]; + real fabc = (dist.f[DIR_M0P ])[kw]; + real fbcc = (dist.f[DIR_0PP ])[k]; + real fbaa = (dist.f[DIR_0MM ])[kbs]; + real fbca = (dist.f[DIR_0PM ])[kb]; + real fbac = (dist.f[DIR_0MP ])[ks]; + real fbbb = (dist.f[DIR_000])[k]; + real fccc = (dist.f[DIR_PPP ])[k]; + real faac = (dist.f[DIR_MMP ])[ksw]; + real fcac = (dist.f[DIR_PMP ])[ks]; + real facc = (dist.f[DIR_MPP ])[kw]; + real fcca = (dist.f[DIR_PPM ])[kb]; + real faaa = (dist.f[DIR_MMM ])[kbsw]; + real fcaa = (dist.f[DIR_PMM ])[kbs]; + real faca = (dist.f[DIR_MPM ])[kbw]; + //////////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions Advection Diffusion + //! + real mfcbb = (distAD.f[DIR_P00 ])[k]; + real mfabb = (distAD.f[DIR_M00 ])[kw]; + real mfbcb = (distAD.f[DIR_0P0 ])[k]; + real mfbab = (distAD.f[DIR_0M0 ])[ks]; + real mfbbc = (distAD.f[DIR_00P ])[k]; + real mfbba = (distAD.f[DIR_00M ])[kb]; + real mfccb = (distAD.f[DIR_PP0 ])[k]; + real mfaab = (distAD.f[DIR_MM0 ])[ksw]; + real mfcab = (distAD.f[DIR_PM0 ])[ks]; + real mfacb = (distAD.f[DIR_MP0 ])[kw]; + real mfcbc = (distAD.f[DIR_P0P ])[k]; + real mfaba = (distAD.f[DIR_M0M ])[kbw]; + real mfcba = (distAD.f[DIR_P0M ])[kb]; + real mfabc = (distAD.f[DIR_M0P ])[kw]; + real mfbcc = (distAD.f[DIR_0PP ])[k]; + real mfbaa = (distAD.f[DIR_0MM ])[kbs]; + real mfbca = (distAD.f[DIR_0PM ])[kb]; + real mfbac = (distAD.f[DIR_0MP ])[ks]; + real mfbbb = (distAD.f[DIR_000])[k]; + real mfccc = (distAD.f[DIR_PPP ])[k]; + real mfaac = (distAD.f[DIR_MMP ])[ksw]; + real mfcac = (distAD.f[DIR_PMP ])[ks]; + real mfacc = (distAD.f[DIR_MPP ])[kw]; + real mfcca = (distAD.f[DIR_PPM ])[kb]; + real mfaaa = (distAD.f[DIR_MMM ])[kbsw]; + real mfcaa = (distAD.f[DIR_PMM ])[kbs]; + real mfaca = (distAD.f[DIR_MPM ])[kbw]; + //////////////////////////////////////////////////////////////////////////////////// + //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // fluid component + real drhoFluid = + ((((fccc + faaa) + (faca + fcac)) + ((facc + fcaa) + (faac + fcca))) + + (((fbac + fbca) + (fbaa + fbcc)) + ((fabc + fcba) + (faba + fcbc)) + ((facb + fcab) + (faab + fccb))) + + ((fabb + fcbb) + (fbab + fbcb) + (fbba + fbbc))) + fbbb; + + real rhoFluid = c1o1 + drhoFluid; + real OOrhoFluid = c1o1 / rhoFluid; + + real vvx = + ((((fccc - faaa) + (fcac - faca)) + ((fcaa - facc) + (fcca - faac))) + + (((fcba - fabc) + (fcbc - faba)) + ((fcab - facb) + (fccb - faab))) + + (fcbb - fabb)) * OOrhoFluid; + real vvy = + ((((fccc - faaa) + (faca - fcac)) + ((facc - fcaa) + (fcca - faac))) + + (((fbca - fbac) + (fbcc - fbaa)) + ((facb - fcab) + (fccb - faab))) + + (fbcb - fbab)) * OOrhoFluid; + real vvz = + ((((fccc - faaa) + (fcac - faca)) + ((facc - fcaa) + (faac - fcca))) + + (((fbac - fbca) + (fbcc - fbaa)) + ((fabc - fcba) + (fcbc - faba))) + + (fbbc - fbba)) * OOrhoFluid; + //////////////////////////////////////////////////////////////////////////////////// + // second component + real rho = + ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + + ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + real fx = forces[0]; + real fy = forces[1]; + real fz = -rho*forces[2]; + vvx += fx*c1o2; + vvy += fy*c1o2; + vvz += fz*c1o2; + //////////////////////////////////////////////////////////////////////////////////// + // calculate the square of velocities for this lattice node + real vx2 = vvx*vvx; + real vy2 = vvy*vvy; + real vz2 = vvz*vvz; + //////////////////////////////////////////////////////////////////////////////////// + //real omegaDiffusivity = c2o1 / (c6o1 * diffusivity + c1o1); + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from distributions to central moments as defined in Eq. (43)-(45) in \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + forwardChimera(mfaaa, mfaab, mfaac, vvz, vz2); + forwardChimera(mfaba, mfabb, mfabc, vvz, vz2); + forwardChimera(mfaca, mfacb, mfacc, vvz, vz2); + forwardChimera(mfbaa, mfbab, mfbac, vvz, vz2); + forwardChimera(mfbba, mfbbb, mfbbc, vvz, vz2); + forwardChimera(mfbca, mfbcb, mfbcc, vvz, vz2); + forwardChimera(mfcaa, mfcab, mfcac, vvz, vz2); + forwardChimera(mfcba, mfcbb, mfcbc, vvz, vz2); + forwardChimera(mfcca, mfccb, mfccc, vvz, vz2); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + forwardChimera(mfaaa, mfaba, mfaca, vvy, vy2); + forwardChimera(mfaab, mfabb, mfacb, vvy, vy2); + forwardChimera(mfaac, mfabc, mfacc, vvy, vy2); + forwardChimera(mfbaa, mfbba, mfbca, vvy, vy2); + forwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2); + forwardChimera(mfbac, mfbbc, mfbcc, vvy, vy2); + forwardChimera(mfcaa, mfcba, mfcca, vvy, vy2); + forwardChimera(mfcab, mfcbb, mfccb, vvy, vy2); + forwardChimera(mfcac, mfcbc, mfccc, vvy, vy2); + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + forwardChimera(mfaaa, mfbaa, mfcaa, vvx, vx2); + forwardChimera(mfaba, mfbba, mfcba, vvx, vx2); + forwardChimera(mfaca, mfbca, mfcca, vvx, vx2); + forwardChimera(mfaab, mfbab, mfcab, vvx, vx2); + forwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2); + forwardChimera(mfacb, mfbcb, mfccb, vvx, vx2); + forwardChimera(mfaac, mfbac, mfcac, vvx, vx2); + forwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2); + forwardChimera(mfacc, mfbcc, mfccc, vvx, vx2); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Factorized central moments for Advection Diffusion Equation - Eq. (15)-(16) in \ref + //! <a href="https://doi.org/10.1016/j.advwatres.2015.09.015"><b>[ X. Yang et al. (2016), DOI: 10.1016/j.advwatres.2015.09.015]</b></a> + //! + + // linearized orthogonalization of 3rd order central moments + real Mabc = mfabc - mfaba*c1o3; + real Mbca = mfbca - mfbaa*c1o3; + real Macb = mfacb - mfaab*c1o3; + real Mcba = mfcba - mfaba*c1o3; + real Mcab = mfcab - mfaab*c1o3; + real Mbac = mfbac - mfbaa*c1o3; + // linearized orthogonalization of 5th order central moments + real Mcbc = mfcbc - mfaba*c1o9; + real Mbcc = mfbcc - mfbaa*c1o9; + real Mccb = mfccb - mfaab*c1o9; + + // collision of 1st order moments + mfbaa *= c1o1 - omegaDiffusivity; + mfaba *= c1o1 - omegaDiffusivity; + mfaab *= c1o1 - omegaDiffusivity; + + // equilibration of 3rd order moments + Mabc = c0o1; + Mbca = c0o1; + Macb = c0o1; + Mcba = c0o1; + Mcab = c0o1; + Mbac = c0o1; + mfbbb = c0o1; + + // equilibration of 5th order moments + Mcbc = c0o1; + Mbcc = c0o1; + Mccb = c0o1; + + // equilibration of 2nd order moments + mfbba = c0o1; + mfbab = c0o1; + mfabb = c0o1; + + mfcaa = c1o3 * rho; + mfaca = c1o3 * rho; + mfaac = c1o3 * rho; + + // equilibration of 4th order moments + mfacc = c1o9 * rho; + mfcac = c1o9 * rho; + mfcca = c1o9 * rho; + + mfcbb = c0o1; + mfbcb = c0o1; + mfbbc = c0o1; + + // equilibration of 6th order moment + mfccc = c1o27 * rho; + + // from linearized orthogonalization 3rd order central moments to central moments + mfabc = Mabc + mfaba*c1o3; + mfbca = Mbca + mfbaa*c1o3; + mfacb = Macb + mfaab*c1o3; + mfcba = Mcba + mfaba*c1o3; + mfcab = Mcab + mfaab*c1o3; + mfbac = Mbac + mfbaa*c1o3; + + // from linearized orthogonalization 5th order central moments to central moments + mfcbc = Mcbc + mfaba*c1o9; + mfbcc = Mbcc + mfbaa*c1o9; + mfccb = Mccb + mfaab*c1o9; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from central moments to distributions as defined in Eq. (88)-(96) in \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + backwardChimera(mfaaa, mfbaa, mfcaa, vvx, vx2); + backwardChimera(mfaba, mfbba, mfcba, vvx, vx2); + backwardChimera(mfaca, mfbca, mfcca, vvx, vx2); + backwardChimera(mfaab, mfbab, mfcab, vvx, vx2); + backwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2); + backwardChimera(mfacb, mfbcb, mfccb, vvx, vx2); + backwardChimera(mfaac, mfbac, mfcac, vvx, vx2); + backwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2); + backwardChimera(mfacc, mfbcc, mfccc, vvx, vx2); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardChimera(mfaaa, mfaba, mfaca, vvy, vy2); + backwardChimera(mfaab, mfabb, mfacb, vvy, vy2); + backwardChimera(mfaac, mfabc, mfacc, vvy, vy2); + backwardChimera(mfbaa, mfbba, mfbca, vvy, vy2); + backwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2); + backwardChimera(mfbac, mfbbc, mfbcc, vvy, vy2); + backwardChimera(mfcaa, mfcba, mfcca, vvy, vy2); + backwardChimera(mfcab, mfcbb, mfccb, vvy, vy2); + backwardChimera(mfcac, mfcbc, mfccc, vvy, vy2); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardChimera(mfaaa, mfaab, mfaac, vvz, vz2); + backwardChimera(mfaba, mfabb, mfabc, vvz, vz2); + backwardChimera(mfaca, mfacb, mfacc, vvz, vz2); + backwardChimera(mfbaa, mfbab, mfbac, vvz, vz2); + backwardChimera(mfbba, mfbbb, mfbbc, vvz, vz2); + backwardChimera(mfbca, mfbcb, mfbcc, vvz, vz2); + backwardChimera(mfcaa, mfcab, mfcac, vvz, vz2); + backwardChimera(mfcba, mfcbb, mfcbc, vvz, vz2); + backwardChimera(mfcca, mfccb, mfccc, vvz, vz2); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Write distributions: style of reading and writing the distributions from/to + //! stored arrays dependent on timestep is based on the esoteric twist algorithm + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + (distAD.f[DIR_P00 ])[k ] = mfabb; + (distAD.f[DIR_M00 ])[kw ] = mfcbb; + (distAD.f[DIR_0P0 ])[k ] = mfbab; + (distAD.f[DIR_0M0 ])[ks ] = mfbcb; + (distAD.f[DIR_00P ])[k ] = mfbba; + (distAD.f[DIR_00M ])[kb ] = mfbbc; + (distAD.f[DIR_PP0 ])[k ] = mfaab; + (distAD.f[DIR_MM0 ])[ksw ] = mfccb; + (distAD.f[DIR_PM0 ])[ks ] = mfacb; + (distAD.f[DIR_MP0 ])[kw ] = mfcab; + (distAD.f[DIR_P0P ])[k ] = mfaba; + (distAD.f[DIR_M0M ])[kbw ] = mfcbc; + (distAD.f[DIR_P0M ])[kb ] = mfabc; + (distAD.f[DIR_M0P ])[kw ] = mfcba; + (distAD.f[DIR_0PP ])[k ] = mfbaa; + (distAD.f[DIR_0MM ])[kbs ] = mfbcc; + (distAD.f[DIR_0PM ])[kb ] = mfbac; + (distAD.f[DIR_0MP ])[ks ] = mfbca; + (distAD.f[DIR_000])[k ] = mfbbb; + (distAD.f[DIR_PPP ])[k ] = mfaaa; + (distAD.f[DIR_PMP ])[ks ] = mfaca; + (distAD.f[DIR_PPM ])[kb ] = mfaac; + (distAD.f[DIR_PMM ])[kbs ] = mfacc; + (distAD.f[DIR_MPP ])[kw ] = mfcaa; + (distAD.f[DIR_MMP ])[ksw ] = mfcca; + (distAD.f[DIR_MPM ])[kbw ] = mfcac; + (distAD.f[DIR_MMM ])[kbsw] = mfccc; + } +} +//////////////////////////////////////////////////////////////////////////////// + diff --git a/src/gpu/VirtualFluids_GPU/GPU/AdvectionDiffusionBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/AdvectionDiffusionBCs27.cu new file mode 100644 index 0000000000000000000000000000000000000000..ecf98a7494a0a5e1c81c1040917e941f066605e6 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/AdvectionDiffusionBCs27.cu @@ -0,0 +1,7147 @@ +/* Device code */ +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" + +#include <lbm/constants/NumericConstants.h> + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + +////////////////////////////////////////////////////////////////////////////// +__global__ void QADPress7( real* DD, + real* DD7, + real* temp, + real* velo, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + + Distributions7 D7; + if (isEvenTimestep==true) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + ////////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB;//, + // *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + // *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + // *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + // *q_dirBSE, *q_dirBNW; + + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + //q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + //q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + //q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + //q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + //q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + //q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + //q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + //q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + //q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + //q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + //q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + //q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + //q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + //q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + //q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + //q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + //q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + //q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + //q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + //q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + ////////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, + f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; + + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + /*real drho*/; + //real vx1_Inflow = zero; + //real vx2_Inflow = zero; + //real vx3_Inflow = velo[k]; + //real ux_sq_Inflow = vx1_Inflow * vx1_Inflow; + //real uy_sq_Inflow = vx2_Inflow * vx2_Inflow; + //real uz_sq_Inflow = vx3_Inflow * vx3_Inflow; + + + //drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + // f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + // f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); + + //real vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + // (f_E - f_W); + + //real vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + // (f_N - f_S); + + //real vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + // (f_T - f_B); + + real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+ ((D.f[DIR_000])[kzero]); + real rho = rho0 + c1o1; + real OORho = c1o1/rho; + real vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + real vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + real vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + + //real cu_sq =1.5*(vx1*vx1+vx2*vx2+vx3*vx3); + real ux_sq = vx1 * vx1; + real uy_sq = vx2 * vx2; + real uz_sq = vx3 * vx3; + real omegaD = c3o1 - sqrt(c3o1); + real Lam = -(c1o2-c1o1/omegaD); + real nue_d = Lam/c3o1; + //real ae = zero; + real ae = diffusivity/nue_d - c1o1; + + real f7_ZERO,f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; + real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; + real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; + //real TempD = temp[k]; + + + f7_ZERO = (D7.f[0])[kzero]; + f7_W = (D7.f[1])[ke ]; + f7_E = (D7.f[2])[kw ]; + f7_S = (D7.f[3])[kn ]; + f7_N = (D7.f[4])[ks ]; + f7_B = (D7.f[5])[kt ]; + f7_T = (D7.f[6])[kb ]; + + real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; + + //feq7_ZERO = ConcD*(c1o3*(ae*(-3.0))-(ux_sq+uy_sq+uz_sq)); + feq7_E = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)+vx1*c1o2); + feq7_W = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)-vx1*c1o2); + feq7_N = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)+vx2*c1o2); + feq7_S = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)-vx2*c1o2); + feq7_T = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)+vx3*c1o2); + feq7_B = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)-vx3*c1o2); + + //feq7_ZERO = TempD*(c1o3*(ae*(-3.0f))-(ux_sq+uy_sq+uz_sq)); + feqW7_E = feq7_E;// TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)+vx1_Inflow*c1o2); + feqW7_W = feq7_W;// TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)-vx1_Inflow*c1o2); + feqW7_N = feq7_N;// TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)+vx2_Inflow*c1o2); + feqW7_S = feq7_S;// TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)-vx2_Inflow*c1o2); + feqW7_T = feq7_T;// TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)+vx3_Inflow*c1o2); + feqW7_B = feq7_B;// TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)-vx3_Inflow*c1o2); + + ////////////////////////////////////////////////////////////////////////// + //pointertausch + if (isEvenTimestep==false) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Test + //(D.f[DIR_000])[k]=0.1f; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //(D7.f[1])[ke ] = f7_E - feq7_E + feqW7_W; //DIR_P00 + //(D7.f[2])[kw ] = f7_W - feq7_W + feqW7_E; //DIR_M00 + //(D7.f[3])[kn ] = f7_N - feq7_N + feqW7_S; //DIR_0P0 + //(D7.f[4])[ks ] = f7_S - feq7_S + feqW7_N; //DIR_0M0 + //(D7.f[5])[kt ] = f7_T - feq7_T + feqW7_B; //DIR_00P + //(D7.f[6])[kb ] = f7_B - feq7_B + feqW7_T; //DIR_00M + + ////////////////////////////////////////////////////////////////////////// + //mit Q's + real /*feq,*/ q; + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[2])[kw]=(c2o1*feqW7_W-(f7_E*(q*omegaD-c1o1)-omegaD*feq7_E*(q-c1o1))/(omegaD-c1o1)+f7_W*q)/(q+c1o1);//f7_W - feq7_W + feqW7_E; + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[1])[ke]=(c2o1*feqW7_E-(f7_W*(q*omegaD-c1o1)-omegaD*feq7_W*(q-c1o1))/(omegaD-c1o1)+f7_E*q)/(q+c1o1);//f7_E - feq7_E + feqW7_W; + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[4])[ks]=(c2o1*feqW7_S-(f7_N*(q*omegaD-1.)-omegaD*feq7_N*(q-c1o1))/(omegaD-c1o1)+f7_S*q)/(q+c1o1);//f7_S - feq7_S + feqW7_N; + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[3])[kn]=(c2o1*feqW7_N-(f7_S*(q*omegaD-c1o1)-omegaD*feq7_S*(q-c1o1))/(omegaD-c1o1)+f7_N*q)/(q+c1o1);//f7_N - feq7_N + feqW7_S; + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[6])[kb]=(c2o1*feqW7_B-(f7_T*(q*omegaD-1.)-omegaD*feq7_T*(q-c1o1))/(omegaD-c1o1)+f7_B*q)/(q+c1o1);//f7_B - feq7_B + feqW7_T; + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[5])[kt]=(c2o1*feqW7_T-(f7_B*(q*omegaD-c1o1)-omegaD*feq7_B*(q-c1o1))/(omegaD-c1o1)+f7_T*q)/(q+c1o1);//f7_T - feq7_T + feqW7_B; + } + + //////////////////////////////////////////////////////////////////////////// + ////ohne Q's + //real /*feq,*/ q; + //q = q_dirE[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[2])[kw]=f7_W - feq7_W + feqW7_E; + //} + + //q = q_dirW[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[1])[ke]=f7_E - feq7_E + feqW7_W; + //} + + //q = q_dirN[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[4])[ks]=f7_S - feq7_S + feqW7_N; + //} + + //q = q_dirS[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[3])[kn]=f7_N - feq7_N + feqW7_S; + //} + + //q = q_dirT[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[6])[kb]=f7_B - feq7_B + feqW7_T; + //} + + //q = q_dirB[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[5])[kt]=f7_T - feq7_T + feqW7_B; + //} + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QADPress27( real* DD, + real* DD27, + real* temp, + real* velo, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + + Distributions27 D27; + if (isEvenTimestep==true) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + //////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, + *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + *q_dirBSE, *q_dirBNW; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + real f_W = (D.f[DIR_P00 ])[ke ]; + real f_E = (D.f[DIR_M00 ])[kw ]; + real f_S = (D.f[DIR_0P0 ])[kn ]; + real f_N = (D.f[DIR_0M0 ])[ks ]; + real f_B = (D.f[DIR_00P ])[kt ]; + real f_T = (D.f[DIR_00M ])[kb ]; + real f_SW = (D.f[DIR_PP0 ])[kne ]; + real f_NE = (D.f[DIR_MM0 ])[ksw ]; + real f_NW = (D.f[DIR_PM0 ])[kse ]; + real f_SE = (D.f[DIR_MP0 ])[knw ]; + real f_BW = (D.f[DIR_P0P ])[kte ]; + real f_TE = (D.f[DIR_M0M ])[kbw ]; + real f_TW = (D.f[DIR_P0M ])[kbe ]; + real f_BE = (D.f[DIR_M0P ])[ktw ]; + real f_BS = (D.f[DIR_0PP ])[ktn ]; + real f_TN = (D.f[DIR_0MM ])[kbs ]; + real f_TS = (D.f[DIR_0PM ])[kbn ]; + real f_BN = (D.f[DIR_0MP ])[kts ]; + real f_ZERO = (D.f[DIR_000])[kzero]; + real f_BSW = (D.f[DIR_PPP ])[ktne ]; + real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + real f_BNW = (D.f[DIR_PMP ])[ktse ]; + real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + real f_TSW = (D.f[DIR_PPM ])[kbne ]; + real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + real f_TNW = (D.f[DIR_PMM ])[kbse ]; + real f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real vx1, vx2, vx3, /*drho, feq,*/ q; + //drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + // f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + // f_T + f_B + f_N + f_S + f_E + f_W + f_ZERO; + + //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + // (f_E - f_W); + + + //vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + // (f_N - f_S); + + //vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + // (f_T - f_B); + real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+ f_ZERO; + real rho = rho0 + c1o1; + real OORho = c1o1/rho; + vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + //////////////////////////////////////////////////////////////////////////////// + real f27_W = (D27.f[DIR_P00 ])[ke ]; + real f27_E = (D27.f[DIR_M00 ])[kw ]; + real f27_S = (D27.f[DIR_0P0 ])[kn ]; + real f27_N = (D27.f[DIR_0M0 ])[ks ]; + real f27_B = (D27.f[DIR_00P ])[kt ]; + real f27_T = (D27.f[DIR_00M ])[kb ]; + real f27_SW = (D27.f[DIR_PP0 ])[kne ]; + real f27_NE = (D27.f[DIR_MM0 ])[ksw ]; + real f27_NW = (D27.f[DIR_PM0 ])[kse ]; + real f27_SE = (D27.f[DIR_MP0 ])[knw ]; + real f27_BW = (D27.f[DIR_P0P ])[kte ]; + real f27_TE = (D27.f[DIR_M0M ])[kbw ]; + real f27_TW = (D27.f[DIR_P0M ])[kbe ]; + real f27_BE = (D27.f[DIR_M0P ])[ktw ]; + real f27_BS = (D27.f[DIR_0PP ])[ktn ]; + real f27_TN = (D27.f[DIR_0MM ])[kbs ]; + real f27_TS = (D27.f[DIR_0PM ])[kbn ]; + real f27_BN = (D27.f[DIR_0MP ])[kts ]; + real f27_ZERO = (D27.f[DIR_000])[kzero]; + real f27_BSW = (D27.f[DIR_PPP ])[ktne ]; + real f27_BNE = (D27.f[DIR_MMP ])[ktsw ]; + real f27_BNW = (D27.f[DIR_PMP ])[ktse ]; + real f27_BSE = (D27.f[DIR_MPP ])[ktnw ]; + real f27_TSW = (D27.f[DIR_PPM ])[kbne ]; + real f27_TNE = (D27.f[DIR_MMM ])[kbsw ]; + real f27_TNW = (D27.f[DIR_PMM ])[kbse ]; + real f27_TSE = (D27.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); + //////////////////////////////////////////////////////////////////////////////// + real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + + f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + + f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; + + ////real feq27_ZERO = c8over27* ConcD*(one-cu_sq); + //real feq27_E = c2over27* (ConcD+(one+ConcD)*(three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq)); + //real feq27_W = c2over27* (ConcD+(one+ConcD)*(three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq)); + //real feq27_N = c2over27* (ConcD+(one+ConcD)*(three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq)); + //real feq27_S = c2over27* (ConcD+(one+ConcD)*(three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq)); + //real feq27_T = c2over27* (ConcD+(one+ConcD)*(three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq)); + //real feq27_B = c2over27* (ConcD+(one+ConcD)*(three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq)); + //real feq27_NE = c1over54* (ConcD+(one+ConcD)*(three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + //real feq27_SW = c1over54* (ConcD+(one+ConcD)*(three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + //real feq27_SE = c1over54* (ConcD+(one+ConcD)*(three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + //real feq27_NW = c1over54* (ConcD+(one+ConcD)*(three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + //real feq27_TE = c1over54* (ConcD+(one+ConcD)*(three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + //real feq27_BW = c1over54* (ConcD+(one+ConcD)*(three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + //real feq27_BE = c1over54* (ConcD+(one+ConcD)*(three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + //real feq27_TW = c1over54* (ConcD+(one+ConcD)*(three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + //real feq27_TN = c1over54* (ConcD+(one+ConcD)*(three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + //real feq27_BS = c1over54* (ConcD+(one+ConcD)*(three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + //real feq27_BN = c1over54* (ConcD+(one+ConcD)*(three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + //real feq27_TS = c1over54* (ConcD+(one+ConcD)*(three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + //real feq27_TNE = c1over216*(ConcD+(one+ConcD)*(three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + //real feq27_BSW = c1over216*(ConcD+(one+ConcD)*(three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + //real feq27_BNE = c1over216*(ConcD+(one+ConcD)*(three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + //real feq27_TSW = c1over216*(ConcD+(one+ConcD)*(three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + //real feq27_TSE = c1over216*(ConcD+(one+ConcD)*(three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + //real feq27_BNW = c1over216*(ConcD+(one+ConcD)*(three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + //real feq27_BSE = c1over216*(ConcD+(one+ConcD)*(three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + //real feq27_TNW = c1over216*(ConcD+(one+ConcD)*(three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + // + real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //real TempD = temp[k]; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // velocity inflow + //vx1 = zero; + //vx2 = zero; + //vx3 = velo[k]; + + //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); + real feqW27_E = feq27_E ;// c2over27* TempD*(one+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq); + real feqW27_W = feq27_W ;// c2over27* TempD*(one+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq); + real feqW27_N = feq27_N ;// c2over27* TempD*(one+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq); + real feqW27_S = feq27_S ;// c2over27* TempD*(one+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq); + real feqW27_T = feq27_T ;// c2over27* TempD*(one+three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq); + real feqW27_B = feq27_B ;// c2over27* TempD*(one+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq); + real feqW27_NE = feq27_NE ;// c1over54* TempD*(one+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + real feqW27_SW = feq27_SW ;// c1over54* TempD*(one+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + real feqW27_SE = feq27_SE ;// c1over54* TempD*(one+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + real feqW27_NW = feq27_NW ;// c1over54* TempD*(one+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + real feqW27_TE = feq27_TE ;// c1over54* TempD*(one+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + real feqW27_BW = feq27_BW ;// c1over54* TempD*(one+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + real feqW27_BE = feq27_BE ;// c1over54* TempD*(one+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + real feqW27_TW = feq27_TW ;// c1over54* TempD*(one+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + real feqW27_TN = feq27_TN ;// c1over54* TempD*(one+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq); + real feqW27_BS = feq27_BS ;// c1over54* TempD*(one+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + real feqW27_BN = feq27_BN ;// c1over54* TempD*(one+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq); + real feqW27_TS = feq27_TS ;// c1over54* TempD*(one+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + real feqW27_TNE = feq27_TNE;// c1over216*TempD*(one+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + real feqW27_BSW = feq27_BSW;// c1over216*TempD*(one+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + real feqW27_BNE = feq27_BNE;// c1over216*TempD*(one+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + real feqW27_TSW = feq27_TSW;// c1over216*TempD*(one+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + real feqW27_TSE = feq27_TSE;// c1over216*TempD*(one+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + real feqW27_BNW = feq27_BNW;// c1over216*TempD*(one+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + real feqW27_BSE = feq27_BSE;// c1over216*TempD*(one+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + real feqW27_TNW = feq27_TNW;// c1over216*TempD*(one+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real omegaD = c3o1 - sqrt(c3o1); + //real Lam = -(c1o2-one/omegaD); + //real nue_d = Lam/three; + //real ae = zero; + //real ae = diffusivity/nue_d - one; + + + ////////////////////////////////////////////////////////////////////////// + if (isEvenTimestep==false) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Test + //(D.f[DIR_000])[k]=c1o10; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M00 ])[kw ]=(c2o1*feqW27_W -(f27_E *(q*omegaD-c1o1)-omegaD*feq27_E *(q-c1o1))/(omegaD-c1o1)+f27_W *q)/(q+c1o1); + q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P00 ])[ke ]=(c2o1*feqW27_E -(f27_W *(q*omegaD-c1o1)-omegaD*feq27_W *(q-c1o1))/(omegaD-c1o1)+f27_E *q)/(q+c1o1); + q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0M0 ])[ks ]=(c2o1*feqW27_S -(f27_N *(q*omegaD-c1o1)-omegaD*feq27_N *(q-c1o1))/(omegaD-c1o1)+f27_S *q)/(q+c1o1); + q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0P0 ])[kn ]=(c2o1*feqW27_N -(f27_S *(q*omegaD-c1o1)-omegaD*feq27_S *(q-c1o1))/(omegaD-c1o1)+f27_N *q)/(q+c1o1); + q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00M ])[kb ]=(c2o1*feqW27_B -(f27_T *(q*omegaD-c1o1)-omegaD*feq27_T *(q-c1o1))/(omegaD-c1o1)+f27_B *q)/(q+c1o1); + q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00P ])[kt ]=(c2o1*feqW27_T -(f27_B *(q*omegaD-c1o1)-omegaD*feq27_B *(q-c1o1))/(omegaD-c1o1)+f27_T *q)/(q+c1o1); + q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MM0 ])[ksw ]=(c2o1*feqW27_SW -(f27_NE *(q*omegaD-c1o1)-omegaD*feq27_NE *(q-c1o1))/(omegaD-c1o1)+f27_SW *q)/(q+c1o1); + q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PP0 ])[kne ]=(c2o1*feqW27_NE -(f27_SW *(q*omegaD-c1o1)-omegaD*feq27_SW *(q-c1o1))/(omegaD-c1o1)+f27_NE *q)/(q+c1o1); + q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MP0 ])[knw ]=(c2o1*feqW27_NW -(f27_SE *(q*omegaD-c1o1)-omegaD*feq27_SE *(q-c1o1))/(omegaD-c1o1)+f27_NW *q)/(q+c1o1); + q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PM0 ])[kse ]=(c2o1*feqW27_SE -(f27_NW *(q*omegaD-c1o1)-omegaD*feq27_NW *(q-c1o1))/(omegaD-c1o1)+f27_SE *q)/(q+c1o1); + q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0M ])[kbw ]=(c2o1*feqW27_BW -(f27_TE *(q*omegaD-c1o1)-omegaD*feq27_TE *(q-c1o1))/(omegaD-c1o1)+f27_BW *q)/(q+c1o1); + q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0P ])[kte ]=(c2o1*feqW27_TE -(f27_BW *(q*omegaD-c1o1)-omegaD*feq27_BW *(q-c1o1))/(omegaD-c1o1)+f27_TE *q)/(q+c1o1); + q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0P ])[ktw ]=(c2o1*feqW27_TW -(f27_BE *(q*omegaD-c1o1)-omegaD*feq27_BE *(q-c1o1))/(omegaD-c1o1)+f27_TW *q)/(q+c1o1); + q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0M ])[kbe ]=(c2o1*feqW27_BE -(f27_TW *(q*omegaD-c1o1)-omegaD*feq27_TW *(q-c1o1))/(omegaD-c1o1)+f27_BE *q)/(q+c1o1); + q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MM ])[kbs ]=(c2o1*feqW27_BS -(f27_TN *(q*omegaD-c1o1)-omegaD*feq27_TN *(q-c1o1))/(omegaD-c1o1)+f27_BS *q)/(q+c1o1); + q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PP ])[ktn ]=(c2o1*feqW27_TN -(f27_BS *(q*omegaD-c1o1)-omegaD*feq27_BS *(q-c1o1))/(omegaD-c1o1)+f27_TN *q)/(q+c1o1); + q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MP ])[kts ]=(c2o1*feqW27_TS -(f27_BN *(q*omegaD-c1o1)-omegaD*feq27_BN *(q-c1o1))/(omegaD-c1o1)+f27_TS *q)/(q+c1o1); + q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PM ])[kbn ]=(c2o1*feqW27_BN -(f27_TS *(q*omegaD-c1o1)-omegaD*feq27_TS *(q-c1o1))/(omegaD-c1o1)+f27_BN *q)/(q+c1o1); + q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMM])[kbsw]=(c2o1*feqW27_BSW-(f27_TNE*(q*omegaD-c1o1)-omegaD*feq27_TNE*(q-c1o1))/(omegaD-c1o1)+f27_BSW*q)/(q+c1o1); + q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPP])[ktne]=(c2o1*feqW27_TNE-(f27_BSW*(q*omegaD-c1o1)-omegaD*feq27_BSW*(q-c1o1))/(omegaD-c1o1)+f27_TNE*q)/(q+c1o1); + q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMP])[ktsw]=(c2o1*feqW27_TSW-(f27_BNE*(q*omegaD-c1o1)-omegaD*feq27_BNE*(q-c1o1))/(omegaD-c1o1)+f27_TSW*q)/(q+c1o1); + q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPM])[kbne]=(c2o1*feqW27_BNE-(f27_TSW*(q*omegaD-c1o1)-omegaD*feq27_TSW*(q-c1o1))/(omegaD-c1o1)+f27_BNE*q)/(q+c1o1); + q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPM])[kbnw]=(c2o1*feqW27_BNW-(f27_TSE*(q*omegaD-c1o1)-omegaD*feq27_TSE*(q-c1o1))/(omegaD-c1o1)+f27_BNW*q)/(q+c1o1); + q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMP])[ktse]=(c2o1*feqW27_TSE-(f27_BNW*(q*omegaD-c1o1)-omegaD*feq27_BNW*(q-c1o1))/(omegaD-c1o1)+f27_TSE*q)/(q+c1o1); + q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPP])[ktnw]=(c2o1*feqW27_TNW-(f27_BSE*(q*omegaD-c1o1)-omegaD*feq27_BSE*(q-c1o1))/(omegaD-c1o1)+f27_TNW*q)/(q+c1o1); + q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMM])[kbse]=(c2o1*feqW27_BSE-(f27_TNW*(q*omegaD-c1o1)-omegaD*feq27_TNW*(q-c1o1))/(omegaD-c1o1)+f27_BSE*q)/(q+c1o1); + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QADPressNEQNeighbor27( + real* DD, + real* DD27, + int* k_Q, + int* k_N, + int numberOfBCnodes, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep + ) +{ + Distributions27 D; + if (isEvenTimestep == true) + { + D.f[DIR_P00] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM] = &DD[DIR_PMP *size_Mat]; + } + + Distributions27 D27; + if (isEvenTimestep == true) + { + D27.f[DIR_P00] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if (k < numberOfBCnodes) + { + //////////////////////////////////////////////////////////////////////////////// + //Fluid - BC Nodes + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero = KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + //distributions + real f_W = (D.f[DIR_P00])[ke]; + real f_E = (D.f[DIR_M00])[kw]; + real f_S = (D.f[DIR_0P0])[kn]; + real f_N = (D.f[DIR_0M0])[ks]; + real f_B = (D.f[DIR_00P])[kt]; + real f_T = (D.f[DIR_00M])[kb]; + real f_SW = (D.f[DIR_PP0])[kne]; + real f_NE = (D.f[DIR_MM0])[ksw]; + real f_NW = (D.f[DIR_PM0])[kse]; + real f_SE = (D.f[DIR_MP0])[knw]; + real f_BW = (D.f[DIR_P0P])[kte]; + real f_TE = (D.f[DIR_M0M])[kbw]; + real f_TW = (D.f[DIR_P0M])[kbe]; + real f_BE = (D.f[DIR_M0P])[ktw]; + real f_BS = (D.f[DIR_0PP])[ktn]; + real f_TN = (D.f[DIR_0MM])[kbs]; + real f_TS = (D.f[DIR_0PM])[kbn]; + real f_BN = (D.f[DIR_0MP])[kts]; + real f_ZERO = (D.f[DIR_000])[kzero]; + real f_BSW = (D.f[DIR_PPP])[ktne]; + real f_BNE = (D.f[DIR_MMP])[ktsw]; + real f_BNW = (D.f[DIR_PMP])[ktse]; + real f_BSE = (D.f[DIR_MPP])[ktnw]; + real f_TSW = (D.f[DIR_PPM])[kbne]; + real f_TNE = (D.f[DIR_MMM])[kbsw]; + real f_TNW = (D.f[DIR_PMM])[kbse]; + real f_TSE = (D.f[DIR_MPM])[kbnw]; + //////////////////////////////////////////////////////////////////////////////// + //macroscopic values + real rho0 = + (f_TNE + f_BSW) + (f_TSW + f_BNE) + (f_TSE + f_BNW) + (f_TNW + f_BSE) + + (f_NE + f_SW ) + (f_NW + f_SE ) + (f_TE + f_BW ) + (f_BE + f_TW ) + + (f_TN + f_BS ) + (f_BN + f_TS ) + + (f_E + f_W ) + (f_N + f_S ) + (f_T + f_B ) + f_ZERO; + real rho = rho0 + c1o1; + real OORho = c1o1 / rho; + + real vx1 = + OORho*((f_TNE - f_BSW) + (f_BNE - f_TSW) + (f_TSE - f_BNW) + (f_BSE - f_TNW) + + (f_NE - f_SW) + (f_SE - f_NW) + (f_TE - f_BW) + (f_BE - f_TW) + (f_E - f_W)); + real vx2 = + OORho*((f_TNE - f_BSW) + (f_BNE - f_TSW) + (f_BNW - f_TSE) + (f_TNW - f_BSE) + + (f_NE - f_SW) + (f_NW - f_SE) + (f_TN - f_BS) + (f_BN - f_TS) + (f_N - f_S)); + real vx3 = + OORho*((f_TNE - f_BSW) + (f_TSW - f_BNE) + (f_TSE - f_BNW) + (f_TNW - f_BSE) + + (f_TE - f_BW) + (f_TW - f_BE) + (f_TN - f_BS) + (f_TS - f_BN) + (f_T - f_B)); + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //AD - BC Nodes + //////////////////////////////////////////////////////////////////////////////// + //distributions + real f27_W = (D27.f[DIR_P00])[ke]; + real f27_E = (D27.f[DIR_M00])[kw]; + real f27_S = (D27.f[DIR_0P0])[kn]; + real f27_N = (D27.f[DIR_0M0])[ks]; + real f27_B = (D27.f[DIR_00P])[kt]; + real f27_T = (D27.f[DIR_00M])[kb]; + real f27_SW = (D27.f[DIR_PP0])[kne]; + real f27_NE = (D27.f[DIR_MM0])[ksw]; + real f27_NW = (D27.f[DIR_PM0])[kse]; + real f27_SE = (D27.f[DIR_MP0])[knw]; + real f27_BW = (D27.f[DIR_P0P])[kte]; + real f27_TE = (D27.f[DIR_M0M])[kbw]; + real f27_TW = (D27.f[DIR_P0M])[kbe]; + real f27_BE = (D27.f[DIR_M0P])[ktw]; + real f27_BS = (D27.f[DIR_0PP])[ktn]; + real f27_TN = (D27.f[DIR_0MM])[kbs]; + real f27_TS = (D27.f[DIR_0PM])[kbn]; + real f27_BN = (D27.f[DIR_0MP])[kts]; + real f27_ZERO = (D27.f[DIR_000])[kzero]; + real f27_BSW = (D27.f[DIR_PPP])[ktne]; + real f27_BNE = (D27.f[DIR_MMP])[ktsw]; + real f27_BNW = (D27.f[DIR_PMP])[ktse]; + real f27_BSE = (D27.f[DIR_MPP])[ktnw]; + real f27_TSW = (D27.f[DIR_PPM])[kbne]; + real f27_TNE = (D27.f[DIR_MMM])[kbsw]; + real f27_TNW = (D27.f[DIR_PMM])[kbse]; + real f27_TSE = (D27.f[DIR_MPM])[kbnw]; + //////////////////////////////////////////////////////////////////////////////// + real cusq = c3o2*(vx1*vx1 + vx2*vx2 + vx3*vx3); + //////////////////////////////////////////////////////////////////////////////// + //concentration + real ConcD = + (f27_TNE + f27_BSW) + (f27_TSW + f27_BNE) + (f27_TSE + f27_BNW) + (f27_TNW + f27_BSE) + + (f27_NE + f27_SW ) + (f27_NW + f27_SE ) + (f27_TE + f27_BW ) + (f27_BE + f27_TW ) + + (f27_TN + f27_BS ) + (f27_BN + f27_TS ) + + (f27_E + f27_W ) + (f27_N + f27_S ) + (f27_T + f27_B ) + f27_ZERO; + //////////////////////////////////////////////////////////////////////////////// + //calculate non-equilibrium + f27_ZERO -= c8o27* (ConcD-(ConcD+c1o1)*cusq); + f27_E -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cusq)); + f27_W -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cusq)); + f27_N -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cusq)); + f27_S -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cusq)); + f27_T -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx3)+c9o2*( vx3)*( vx3)-cusq)); + f27_B -= c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cusq)); + f27_NE -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cusq)); + f27_SW -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cusq)); + f27_SE -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cusq)); + f27_NW -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cusq)); + f27_TE -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cusq)); + f27_BW -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cusq)); + f27_BE -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cusq)); + f27_TW -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cusq)); + f27_TN -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cusq)); + f27_BS -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cusq)); + f27_BN -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cusq)); + f27_TS -= c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cusq)); + f27_TNE -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cusq)); + f27_BSW -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cusq)); + f27_BNE -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cusq)); + f27_TSW -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cusq)); + f27_TSE -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cusq)); + f27_BNW -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq)); + f27_BSE -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq)); + f27_TNW -= c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq)); + //////////////////////////////////////////////////////////////////////////////// + ConcD = c0o1; + //////////////////////////////////////////////////////////////////////////////// + //add BC equilibrium + f27_ZERO += c8o27* (ConcD-(ConcD+c1o1)*cusq); + f27_E += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cusq)); + f27_W += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cusq)); + f27_N += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cusq)); + f27_S += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cusq)); + f27_T += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( vx3)+c9o2*( vx3)*( vx3)-cusq)); + f27_B += c2o27* (ConcD+(ConcD+c1o1)*(c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cusq)); + f27_NE += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cusq)); + f27_SW += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cusq)); + f27_SE += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cusq)); + f27_NW += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cusq)); + f27_TE += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cusq)); + f27_BW += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cusq)); + f27_BE += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cusq)); + f27_TW += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cusq)); + f27_TN += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cusq)); + f27_BS += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cusq)); + f27_BN += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cusq)); + f27_TS += c1o54* (ConcD+(ConcD+c1o1)*(c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cusq)); + f27_TNE += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cusq)); + f27_BSW += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cusq)); + f27_BNE += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cusq)); + f27_TSW += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cusq)); + f27_TSE += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cusq)); + f27_BNW += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq)); + f27_BSE += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq)); + f27_TNW += c1o216*(ConcD+(ConcD+c1o1)*(c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq)); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + __syncthreads(); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Neighbors of BC Nodes + //////////////////////////////////////////////////////////////////////////////// + //index neighbor + unsigned int KNQK = k_N[k]; + unsigned int kNzero = KNQK; + unsigned int kNe = KNQK; + unsigned int kNw = neighborX[KNQK]; + unsigned int kNn = KNQK; + unsigned int kNs = neighborY[KNQK]; + unsigned int kNt = KNQK; + unsigned int kNb = neighborZ[KNQK]; + unsigned int kNsw = neighborY[kNw]; + unsigned int kNne = KNQK; + unsigned int kNse = kNs; + unsigned int kNnw = kNw; + unsigned int kNbw = neighborZ[kNw]; + unsigned int kNte = KNQK; + unsigned int kNbe = kNb; + unsigned int kNtw = kNw; + unsigned int kNbs = neighborZ[kNs]; + unsigned int kNtn = KNQK; + unsigned int kNbn = kNb; + unsigned int kNts = kNs; + unsigned int kNtse = kNs; + unsigned int kNbnw = kNbw; + unsigned int kNtnw = kNw; + unsigned int kNbse = kNbs; + unsigned int kNtsw = kNsw; + unsigned int kNbne = kNb; + unsigned int kNtne = KNQK; + unsigned int kNbsw = neighborZ[kNsw]; + //////////////////////////////////////////////////////////////////////////////// + //update distributions at neighbor nodes + (D27.f[DIR_P00 ])[kNe ] = f27_W ; + (D27.f[DIR_M00 ])[kNw ] = f27_E ; + (D27.f[DIR_0P0 ])[kNn ] = f27_S ; + (D27.f[DIR_0M0 ])[kNs ] = f27_N ; + (D27.f[DIR_00P ])[kNt ] = f27_B ; + (D27.f[DIR_00M ])[kNb ] = f27_T ; + (D27.f[DIR_PP0 ])[kNne ] = f27_SW ; + (D27.f[DIR_MM0 ])[kNsw ] = f27_NE ; + (D27.f[DIR_PM0 ])[kNse ] = f27_NW ; + (D27.f[DIR_MP0 ])[kNnw ] = f27_SE ; + (D27.f[DIR_P0P ])[kNte ] = f27_BW ; + (D27.f[DIR_M0M ])[kNbw ] = f27_TE ; + (D27.f[DIR_P0M ])[kNbe ] = f27_TW ; + (D27.f[DIR_M0P ])[kNtw ] = f27_BE ; + (D27.f[DIR_0PP ])[kNtn ] = f27_BS ; + (D27.f[DIR_0MM ])[kNbs ] = f27_TN ; + (D27.f[DIR_0PM ])[kNbn ] = f27_TS ; + (D27.f[DIR_0MP ])[kNts ] = f27_BN ; + (D27.f[DIR_000])[kNzero] = f27_ZERO; + (D27.f[DIR_PPP ])[kNtne ] = f27_BSW ; + (D27.f[DIR_MMP ])[kNtsw ] = f27_BNE ; + (D27.f[DIR_PMP ])[kNtse ] = f27_BNW ; + (D27.f[DIR_MPP ])[kNtnw ] = f27_BSE ; + (D27.f[DIR_PPM ])[kNbne ] = f27_TSW ; + (D27.f[DIR_MMM ])[kNbsw ] = f27_TNE ; + (D27.f[DIR_PMM ])[kNbse ] = f27_TNW ; + (D27.f[DIR_MPM ])[kNbnw ] = f27_TSE ; + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QADVel7( real* DD, + real* DD7, + real* temp, + real* velo, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + + Distributions7 D7; + if (isEvenTimestep==true) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + ////////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB;//, + + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + ////////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, + f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; + + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + /*real drho*/; + real vx1_Inflow = c0o1; + real vx2_Inflow = c0o1; + real vx3_Inflow = velo[k]; + real ux_sq_Inflow = vx1_Inflow * vx1_Inflow; + real uy_sq_Inflow = vx2_Inflow * vx2_Inflow; + real uz_sq_Inflow = vx3_Inflow * vx3_Inflow; + + + ////drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + //// f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + //// f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); + + //real vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + // (f_E - f_W); + + //real vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + // (f_N - f_S); + + //real vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + // (f_T - f_B); + + real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+ ((D.f[DIR_000])[kzero]); + real rho = rho0 + c1o1; + real OORho = c1o1/rho; + real vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + real vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + real vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + + //real cu_sq =1.5f*(vx1*vx1+vx2*vx2+vx3*vx3); + real ux_sq = vx1 * vx1; + real uy_sq = vx2 * vx2; + real uz_sq = vx3 * vx3; + real omegaD = c3o1 - sqrt(c3o1); + real Lam = -(c1o2-c1o1/omegaD); + real nue_d = Lam/c3o1; + //real ae = zero; + real ae = diffusivity/nue_d - c1o1; + + real f7_ZERO,f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; + real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; + real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; + real TempD = temp[k]; + + + f7_ZERO = (D7.f[0])[kzero]; + f7_W = (D7.f[1])[ke ]; + f7_E = (D7.f[2])[kw ]; + f7_S = (D7.f[3])[kn ]; + f7_N = (D7.f[4])[ks ]; + f7_B = (D7.f[5])[kt ]; + f7_T = (D7.f[6])[kb ]; + + real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; + + //feq7_ZERO = ConcD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); + feq7_E = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)+vx1*c1o2); + feq7_W = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)-vx1*c1o2); + feq7_N = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)+vx2*c1o2); + feq7_S = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)-vx2*c1o2); + feq7_T = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)+vx3*c1o2); + feq7_B = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)-vx3*c1o2); + + //feq7_ZERO = TempD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); + feqW7_E = TempD*(c1o6*(ae+c1o1)+c1o2*(ux_sq_Inflow)+vx1_Inflow*c1o2); + feqW7_W = TempD*(c1o6*(ae+c1o1)+c1o2*(ux_sq_Inflow)-vx1_Inflow*c1o2); + feqW7_N = TempD*(c1o6*(ae+c1o1)+c1o2*(uy_sq_Inflow)+vx2_Inflow*c1o2); + feqW7_S = TempD*(c1o6*(ae+c1o1)+c1o2*(uy_sq_Inflow)-vx2_Inflow*c1o2); + feqW7_T = TempD*(c1o6*(ae+c1o1)+c1o2*(uz_sq_Inflow)+vx3_Inflow*c1o2); + feqW7_B = TempD*(c1o6*(ae+c1o1)+c1o2*(uz_sq_Inflow)-vx3_Inflow*c1o2); + + ////////////////////////////////////////////////////////////////////////// + //pointertausch + if (isEvenTimestep==false) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Test + //(D.f[DIR_000])[k]=c1o10; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //(D7.f[1])[ke ] = f7_E - feq7_E + feqW7_W; //DIR_P00 + //(D7.f[2])[kw ] = f7_W - feq7_W + feqW7_E; //DIR_M00 + //(D7.f[3])[kn ] = f7_N - feq7_N + feqW7_S; //DIR_0P0 + //(D7.f[4])[ks ] = f7_S - feq7_S + feqW7_N; //DIR_0M0 + //(D7.f[5])[kt ] = f7_T - feq7_T + feqW7_B; //DIR_00P + //(D7.f[6])[kb ] = f7_B - feq7_B + feqW7_T; //DIR_00M + + ////////////////////////////////////////////////////////////////////////// + //mit Q's + real /*feq,*/ q; + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[2])[kw]=(c2o1*feqW7_W-(f7_E*(q*omegaD-c1o1)-omegaD*feq7_E*(q-c1o1))/(omegaD-c1o1)+f7_W*q)/(q+c1o1);//f7_W - feq7_W + feqW7_E; + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[1])[ke]=(c2o1*feqW7_E-(f7_W*(q*omegaD-c1o1)-omegaD*feq7_W*(q-c1o1))/(omegaD-c1o1)+f7_E*q)/(q+c1o1);//f7_E - feq7_E + feqW7_W; + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[4])[ks]=(c2o1*feqW7_S-(f7_N*(q*omegaD-c1o1)-omegaD*feq7_N*(q-c1o1))/(omegaD-c1o1)+f7_S*q)/(q+c1o1);//f7_S - feq7_S + feqW7_N; + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[3])[kn]=(c2o1*feqW7_N-(f7_S*(q*omegaD-c1o1)-omegaD*feq7_S*(q-c1o1))/(omegaD-c1o1)+f7_N*q)/(q+c1o1);//f7_N - feq7_N + feqW7_S; + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[6])[kb]=(c2o1*feqW7_B-(f7_T*(q*omegaD-c1o1)-omegaD*feq7_T*(q-c1o1))/(omegaD-c1o1)+f7_B*q)/(q+c1o1);//f7_B - feq7_B + feqW7_T; + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + //q=0.; + (D7.f[5])[kt]=(c2o1*feqW7_T-(f7_B*(q*omegaD-c1o1)-omegaD*feq7_B*(q-c1o1))/(omegaD-c1o1)+f7_T*q)/(q+c1o1);//f7_T - feq7_T + feqW7_B; + } + + //////////////////////////////////////////////////////////////////////////// + ////ohne Q's + //real /*feq,*/ q; + //q = q_dirE[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[2])[kw]=f7_W - feq7_W + feqW7_E; + //} + + //q = q_dirW[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[1])[ke]=f7_E - feq7_E + feqW7_W; + //} + + //q = q_dirN[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[4])[ks]=f7_S - feq7_S + feqW7_N; + //} + + //q = q_dirS[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[3])[kn]=f7_N - feq7_N + feqW7_S; + //} + + //q = q_dirT[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[6])[kb]=f7_B - feq7_B + feqW7_T; + //} + + //q = q_dirB[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[5])[kt]=f7_T - feq7_T + feqW7_B; + //} + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QADVel27(real* DD, + real* DD27, + real* temp, + real* velo, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + + Distributions27 D27; + if (isEvenTimestep==true) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + //////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, + *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + *q_dirBSE, *q_dirBNW; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + real f_W = (D.f[DIR_P00 ])[ke ]; + real f_E = (D.f[DIR_M00 ])[kw ]; + real f_S = (D.f[DIR_0P0 ])[kn ]; + real f_N = (D.f[DIR_0M0 ])[ks ]; + real f_B = (D.f[DIR_00P ])[kt ]; + real f_T = (D.f[DIR_00M ])[kb ]; + real f_SW = (D.f[DIR_PP0 ])[kne ]; + real f_NE = (D.f[DIR_MM0 ])[ksw ]; + real f_NW = (D.f[DIR_PM0 ])[kse ]; + real f_SE = (D.f[DIR_MP0 ])[knw ]; + real f_BW = (D.f[DIR_P0P ])[kte ]; + real f_TE = (D.f[DIR_M0M ])[kbw ]; + real f_TW = (D.f[DIR_P0M ])[kbe ]; + real f_BE = (D.f[DIR_M0P ])[ktw ]; + real f_BS = (D.f[DIR_0PP ])[ktn ]; + real f_TN = (D.f[DIR_0MM ])[kbs ]; + real f_TS = (D.f[DIR_0PM ])[kbn ]; + real f_BN = (D.f[DIR_0MP ])[kts ]; + real f_ZERO = (D.f[DIR_000])[kzero]; + real f_BSW = (D.f[DIR_PPP ])[ktne ]; + real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + real f_BNW = (D.f[DIR_PMP ])[ktse ]; + real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + real f_TSW = (D.f[DIR_PPM ])[kbne ]; + real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + real f_TNW = (D.f[DIR_PMM ])[kbse ]; + real f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real vx1, vx2, vx3, /*drho, feq,*/ q; + ////drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + //// f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + //// f_T + f_B + f_N + f_S + f_E + f_W + f_ZERO; + + //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + // (f_E - f_W); + + + //vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + // (f_N - f_S); + + //vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + // (f_T - f_B); + real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+ f_ZERO; + real rho = rho0 + c1o1; + real OORho = c1o1/rho; + vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + //////////////////////////////////////////////////////////////////////////////// + //real f27_W = (D27.f[DIR_P00 ])[ke ]; + //real f27_E = (D27.f[DIR_M00 ])[kw ]; + //real f27_S = (D27.f[DIR_0P0 ])[kn ]; + //real f27_N = (D27.f[DIR_0M0 ])[ks ]; + //real f27_B = (D27.f[DIR_00P ])[kt ]; + //real f27_T = (D27.f[DIR_00M ])[kb ]; + //real f27_SW = (D27.f[DIR_PP0 ])[kne ]; + //real f27_NE = (D27.f[DIR_MM0 ])[ksw ]; + //real f27_NW = (D27.f[DIR_PM0 ])[kse ]; + //real f27_SE = (D27.f[DIR_MP0 ])[knw ]; + //real f27_BW = (D27.f[DIR_P0P ])[kte ]; + //real f27_TE = (D27.f[DIR_M0M ])[kbw ]; + //real f27_TW = (D27.f[DIR_P0M ])[kbe ]; + //real f27_BE = (D27.f[DIR_M0P ])[ktw ]; + //real f27_BS = (D27.f[DIR_0PP ])[ktn ]; + //real f27_TN = (D27.f[DIR_0MM ])[kbs ]; + //real f27_TS = (D27.f[DIR_0PM ])[kbn ]; + //real f27_BN = (D27.f[DIR_0MP ])[kts ]; + //real f27_ZERO = (D27.f[DIR_000])[kzero]; + //real f27_BSW = (D27.f[DIR_PPP ])[ktne ]; + //real f27_BNE = (D27.f[DIR_MMP ])[ktsw ]; + //real f27_BNW = (D27.f[DIR_PMP ])[ktse ]; + //real f27_BSE = (D27.f[DIR_MPP ])[ktnw ]; + //real f27_TSW = (D27.f[DIR_PPM ])[kbne ]; + //real f27_TNE = (D27.f[DIR_MMM ])[kbsw ]; + //real f27_TNW = (D27.f[DIR_PMM ])[kbse ]; + //real f27_TSE = (D27.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); + //////////////////////////////////////////////////////////////////////////////// + //real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + + // f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + + // f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; + + //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); + //real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + //real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + //real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + //real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + //real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + //real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + //real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + //real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + //real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + //real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + //real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + //real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + //real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + //real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + //real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + //real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + //real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + //real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + //real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + //real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + //real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + //real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + //real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + //real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + //real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + //real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real TempD = temp[k]; + //real TempD = four; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // velocity inflow + //vx1 = velo[k]; //zero; + //vx2 = zero; //velo[k];//zero;//velo[k]; + //vx3 = zero; + + ////real feqW27_ZERO = c8over27* TempD*(one-cu_sq); + //real feqW27_E = c2over27* (TempD+(one+TempD)*(three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq)); + //real feqW27_W = c2over27* (TempD+(one+TempD)*(three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq)); + //real feqW27_N = c2over27* (TempD+(one+TempD)*(three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq)); + //real feqW27_S = c2over27* (TempD+(one+TempD)*(three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq)); + //real feqW27_T = c2over27* (TempD+(one+TempD)*(three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq)); + //real feqW27_B = c2over27* (TempD+(one+TempD)*(three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq)); + //real feqW27_NE = c1over54* (TempD+(one+TempD)*(three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + //real feqW27_SW = c1over54* (TempD+(one+TempD)*(three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + //real feqW27_SE = c1over54* (TempD+(one+TempD)*(three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + //real feqW27_NW = c1over54* (TempD+(one+TempD)*(three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + //real feqW27_TE = c1over54* (TempD+(one+TempD)*(three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + //real feqW27_BW = c1over54* (TempD+(one+TempD)*(three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + //real feqW27_BE = c1over54* (TempD+(one+TempD)*(three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + //real feqW27_TW = c1over54* (TempD+(one+TempD)*(three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + //real feqW27_TN = c1over54* (TempD+(one+TempD)*(three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + //real feqW27_BS = c1over54* (TempD+(one+TempD)*(three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + //real feqW27_BN = c1over54* (TempD+(one+TempD)*(three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + //real feqW27_TS = c1over54* (TempD+(one+TempD)*(three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + //real feqW27_TNE = c1over216*(TempD+(one+TempD)*(three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + //real feqW27_BSW = c1over216*(TempD+(one+TempD)*(three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + //real feqW27_BNE = c1over216*(TempD+(one+TempD)*(three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + //real feqW27_TSW = c1over216*(TempD+(one+TempD)*(three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + //real feqW27_TSE = c1over216*(TempD+(one+TempD)*(three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + //real feqW27_BNW = c1over216*(TempD+(one+TempD)*(three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + //real feqW27_BSE = c1over216*(TempD+(one+TempD)*(three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + //real feqW27_TNW = c1over216*(TempD+(one+TempD)*(three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + // + real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real omegaD = c3o1 - sqrt(c3o1); + //real Lam = -(c1o2-one/omegaD); + //real nue_d = Lam/three; + //real ae = zero; + //real ae = diffusivity/nue_d - one; + + + ////////////////////////////////////////////////////////////////////////// + if (isEvenTimestep==false) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Test + //(D.f[DIR_000])[k]=c1o10; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Test + //(D.f[DIR_000])[k]=c1o10; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //(D27.f[DIR_M00 ])[kw ]= four; + //(D27.f[DIR_P00 ])[ke ]= four; + //(D27.f[DIR_0M0 ])[ks ]= four; + //(D27.f[DIR_0P0 ])[kn ]= four; + //(D27.f[DIR_00M ])[kb ]= four; + //(D27.f[DIR_00P ])[kt ]= four; + //(D27.f[DIR_MM0 ])[ksw ]= four; + //(D27.f[DIR_PP0 ])[kne ]= four; + //(D27.f[DIR_MP0 ])[knw ]= four; + //(D27.f[DIR_PM0 ])[kse ]= four; + //(D27.f[DIR_M0M ])[kbw ]= four; + //(D27.f[DIR_P0P ])[kte ]= four; + //(D27.f[DIR_M0P ])[ktw ]= four; + //(D27.f[DIR_P0M ])[kbe ]= four; + //(D27.f[DIR_0MM ])[kbs ]= four; + //(D27.f[DIR_0PP ])[ktn ]= four; + //(D27.f[DIR_0MP ])[kts ]= four; + //(D27.f[DIR_0PM ])[kbn ]= four; + //(D27.f[DIR_MMM])[kbsw]= four; + //(D27.f[DIR_PPP])[ktne]= four; + //(D27.f[DIR_MMP])[ktsw]= four; + //(D27.f[DIR_PPM])[kbne]= four; + //(D27.f[DIR_MPM])[kbnw]= four; + //(D27.f[DIR_PMP])[ktse]= four; + //(D27.f[DIR_MPP])[ktnw]= four; + //(D27.f[DIR_PMM])[kbse]= four; + q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M00 ])[kw ]= -feqW27_W + c2o1 * c2o27 * TempD; + q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P00 ])[ke ]= -feqW27_E + c2o1 * c2o27 * TempD; + q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0M0 ])[ks ]= -feqW27_S + c2o1 * c2o27 * TempD; + q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0P0 ])[kn ]= -feqW27_N + c2o1 * c2o27 * TempD; + q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00M ])[kb ]= -feqW27_B + c2o1 * c2o27 * TempD; + q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00P ])[kt ]= -feqW27_T + c2o1 * c2o27 * TempD; + q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MM0 ])[ksw ]= -feqW27_SW + c2o1 * c1o54 * TempD; + q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PP0 ])[kne ]= -feqW27_NE + c2o1 * c1o54 * TempD; + q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MP0 ])[knw ]= -feqW27_NW + c2o1 * c1o54 * TempD; + q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PM0 ])[kse ]= -feqW27_SE + c2o1 * c1o54 * TempD; + q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0M ])[kbw ]= -feqW27_BW + c2o1 * c1o54 * TempD; + q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0P ])[kte ]= -feqW27_TE + c2o1 * c1o54 * TempD; + q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0P ])[ktw ]= -feqW27_TW + c2o1 * c1o54 * TempD; + q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0M ])[kbe ]= -feqW27_BE + c2o1 * c1o54 * TempD; + q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MM ])[kbs ]= -feqW27_BS + c2o1 * c1o54 * TempD; + q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PP ])[ktn ]= -feqW27_TN + c2o1 * c1o54 * TempD; + q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MP ])[kts ]= -feqW27_TS + c2o1 * c1o54 * TempD; + q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PM ])[kbn ]= -feqW27_BN + c2o1 * c1o54 * TempD; + q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMM])[kbsw]= -feqW27_BSW+ c2o1 * c1o216 * TempD; + q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPP])[ktne]= -feqW27_TNE+ c2o1 * c1o216 * TempD; + q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMP])[ktsw]= -feqW27_TSW+ c2o1 * c1o216 * TempD; + q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPM])[kbne]= -feqW27_BNE+ c2o1 * c1o216 * TempD; + q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPM])[kbnw]= -feqW27_BNW+ c2o1 * c1o216 * TempD; + q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMP])[ktse]= -feqW27_TSE+ c2o1 * c1o216 * TempD; + q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPP])[ktnw]= -feqW27_TNW+ c2o1 * c1o216 * TempD; + q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMM])[kbse]= -feqW27_BSE+ c2o1 * c1o216 * TempD; + //q = q_dirE[k]; if (q>=zero && q<=one) (D27.f[DIR_M00 ])[kw ]=(two*feqW27_W -(f27_E *(q*omegaD-one)-omegaD*feq27_E *(q-one))/(omegaD-one)+f27_W *q)/(q+one); + //q = q_dirW[k]; if (q>=zero && q<=one) (D27.f[DIR_P00 ])[ke ]=(two*feqW27_E -(f27_W *(q*omegaD-one)-omegaD*feq27_W *(q-one))/(omegaD-one)+f27_E *q)/(q+one); + //q = q_dirN[k]; if (q>=zero && q<=one) (D27.f[DIR_0M0 ])[ks ]=(two*feqW27_S -(f27_N *(q*omegaD-one)-omegaD*feq27_N *(q-one))/(omegaD-one)+f27_S *q)/(q+one); + //q = q_dirS[k]; if (q>=zero && q<=one) (D27.f[DIR_0P0 ])[kn ]=(two*feqW27_N -(f27_S *(q*omegaD-one)-omegaD*feq27_S *(q-one))/(omegaD-one)+f27_N *q)/(q+one); + //q = q_dirT[k]; if (q>=zero && q<=one) (D27.f[DIR_00M ])[kb ]=(two*feqW27_B -(f27_T *(q*omegaD-one)-omegaD*feq27_T *(q-one))/(omegaD-one)+f27_B *q)/(q+one); + //q = q_dirB[k]; if (q>=zero && q<=one) (D27.f[DIR_00P ])[kt ]=(two*feqW27_T -(f27_B *(q*omegaD-one)-omegaD*feq27_B *(q-one))/(omegaD-one)+f27_T *q)/(q+one); + //q = q_dirNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MM0 ])[ksw ]=(two*feqW27_SW -(f27_NE *(q*omegaD-one)-omegaD*feq27_NE *(q-one))/(omegaD-one)+f27_SW *q)/(q+one); + //q = q_dirSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PP0 ])[kne ]=(two*feqW27_NE -(f27_SW *(q*omegaD-one)-omegaD*feq27_SW *(q-one))/(omegaD-one)+f27_NE *q)/(q+one); + //q = q_dirSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MP0 ])[knw ]=(two*feqW27_NW -(f27_SE *(q*omegaD-one)-omegaD*feq27_SE *(q-one))/(omegaD-one)+f27_NW *q)/(q+one); + //q = q_dirNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PM0 ])[kse ]=(two*feqW27_SE -(f27_NW *(q*omegaD-one)-omegaD*feq27_NW *(q-one))/(omegaD-one)+f27_SE *q)/(q+one); + //q = q_dirTE[k]; if (q>=zero && q<=one) (D27.f[DIR_M0M ])[kbw ]=(two*feqW27_BW -(f27_TE *(q*omegaD-one)-omegaD*feq27_TE *(q-one))/(omegaD-one)+f27_BW *q)/(q+one); + //q = q_dirBW[k]; if (q>=zero && q<=one) (D27.f[DIR_P0P ])[kte ]=(two*feqW27_TE -(f27_BW *(q*omegaD-one)-omegaD*feq27_BW *(q-one))/(omegaD-one)+f27_TE *q)/(q+one); + //q = q_dirBE[k]; if (q>=zero && q<=one) (D27.f[DIR_M0P ])[ktw ]=(two*feqW27_TW -(f27_BE *(q*omegaD-one)-omegaD*feq27_BE *(q-one))/(omegaD-one)+f27_TW *q)/(q+one); + //q = q_dirTW[k]; if (q>=zero && q<=one) (D27.f[DIR_P0M ])[kbe ]=(two*feqW27_BE -(f27_TW *(q*omegaD-one)-omegaD*feq27_TW *(q-one))/(omegaD-one)+f27_BE *q)/(q+one); + //q = q_dirTN[k]; if (q>=zero && q<=one) (D27.f[DIR_0MM ])[kbs ]=(two*feqW27_BS -(f27_TN *(q*omegaD-one)-omegaD*feq27_TN *(q-one))/(omegaD-one)+f27_BS *q)/(q+one); + //q = q_dirBS[k]; if (q>=zero && q<=one) (D27.f[DIR_0PP ])[ktn ]=(two*feqW27_TN -(f27_BS *(q*omegaD-one)-omegaD*feq27_BS *(q-one))/(omegaD-one)+f27_TN *q)/(q+one); + //q = q_dirBN[k]; if (q>=zero && q<=one) (D27.f[DIR_0MP ])[kts ]=(two*feqW27_TS -(f27_BN *(q*omegaD-one)-omegaD*feq27_BN *(q-one))/(omegaD-one)+f27_TS *q)/(q+one); + //q = q_dirTS[k]; if (q>=zero && q<=one) (D27.f[DIR_0PM ])[kbn ]=(two*feqW27_BN -(f27_TS *(q*omegaD-one)-omegaD*feq27_TS *(q-one))/(omegaD-one)+f27_BN *q)/(q+one); + //q = q_dirTNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MMM])[kbsw]=(two*feqW27_BSW-(f27_TNE*(q*omegaD-one)-omegaD*feq27_TNE*(q-one))/(omegaD-one)+f27_BSW*q)/(q+one); + //q = q_dirBSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PPP])[ktne]=(two*feqW27_TNE-(f27_BSW*(q*omegaD-one)-omegaD*feq27_BSW*(q-one))/(omegaD-one)+f27_TNE*q)/(q+one); + //q = q_dirBNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MMP])[ktsw]=(two*feqW27_TSW-(f27_BNE*(q*omegaD-one)-omegaD*feq27_BNE*(q-one))/(omegaD-one)+f27_TSW*q)/(q+one); + //q = q_dirTSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PPM])[kbne]=(two*feqW27_BNE-(f27_TSW*(q*omegaD-one)-omegaD*feq27_TSW*(q-one))/(omegaD-one)+f27_BNE*q)/(q+one); + //q = q_dirTSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MPM])[kbnw]=(two*feqW27_BNW-(f27_TSE*(q*omegaD-one)-omegaD*feq27_TSE*(q-one))/(omegaD-one)+f27_BNW*q)/(q+one); + //q = q_dirBNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PMP])[ktse]=(two*feqW27_TSE-(f27_BNW*(q*omegaD-one)-omegaD*feq27_BNW*(q-one))/(omegaD-one)+f27_TSE*q)/(q+one); + //q = q_dirBSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MPP])[ktnw]=(two*feqW27_TNW-(f27_BSE*(q*omegaD-one)-omegaD*feq27_BSE*(q-one))/(omegaD-one)+f27_TNW*q)/(q+one); + //q = q_dirTNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PMM])[kbse]=(two*feqW27_BSE-(f27_TNW*(q*omegaD-one)-omegaD*feq27_TNW*(q-one))/(omegaD-one)+f27_BSE*q)/(q+one); + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QAD7( real* DD, + real* DD7, + real* temp, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + + Distributions7 D7; + if (isEvenTimestep==true) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + ////////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB;//, + // *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + // *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + // *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + // *q_dirBSE, *q_dirBNW; + + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + //q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + //q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + //q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + //q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + //q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + //q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + //q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + //q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + //q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + //q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + //q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + //q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + //q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + //q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + //q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + //q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + //q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + //q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + //q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + //q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + ////////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, + f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; + + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real vx1, vx2, vx3/*, drho*/; + //drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + // f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + // f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); + + //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + // (f_E - f_W); + + + //vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + // (f_N - f_S); + + //vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + // (f_T - f_B); + real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+ ((D.f[DIR_000])[kzero]); + real rho = rho0 + c1o1; + real OORho = c1o1/rho; + vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + + //real cu_sq =c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); + real ux_sq = vx1 * vx1; + real uy_sq = vx2 * vx2; + real uz_sq = vx3 * vx3; + real omegaD = c3o1 - sqrt(c3o1); + real Lam = -(c1o2-c1o1/omegaD); + real nue_d = Lam/c3o1; + //real ae = zero; + real ae = diffusivity/nue_d - c1o1; + + real f7_ZERO,f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; + real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; + real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; + real TempD = temp[k]; + + + f7_ZERO = (D7.f[0])[kzero]; + f7_W = (D7.f[1])[ke ]; + f7_E = (D7.f[2])[kw ]; + f7_S = (D7.f[3])[kn ]; + f7_N = (D7.f[4])[ks ]; + f7_B = (D7.f[5])[kt ]; + f7_T = (D7.f[6])[kb ]; + + real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; + + //feq7_ZERO = ConcD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); + feq7_E = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)+vx1*c1o2); + feq7_W = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)-vx1*c1o2); + feq7_N = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)+vx2*c1o2); + feq7_S = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)-vx2*c1o2); + feq7_T = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)+vx3*c1o2); + feq7_B = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)-vx3*c1o2); + + //feq7_ZERO = TempD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); + feqW7_E = TempD*(c1o6*(ae+c1o1));//+c1o2*(ux_sq)+vx1*c1o2); + feqW7_W = TempD*(c1o6*(ae+c1o1));//+c1o2*(ux_sq)-vx1*c1o2); + feqW7_N = TempD*(c1o6*(ae+c1o1));//+c1o2*(uy_sq)+vx2*c1o2); + feqW7_S = TempD*(c1o6*(ae+c1o1));//+c1o2*(uy_sq)-vx2*c1o2); + feqW7_T = TempD*(c1o6*(ae+c1o1));//+c1o2*(uz_sq)+vx3*c1o2); + feqW7_B = TempD*(c1o6*(ae+c1o1));//+c1o2*(uz_sq)-vx3*c1o2); + + ////////////////////////////////////////////////////////////////////////// + //pointertausch + if (isEvenTimestep==false) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Test + //(D.f[DIR_000])[k]=c1o10; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //(D7.f[1])[ke ] = f7_E - feq7_E + feqW7_W; //DIR_P00 + //(D7.f[2])[kw ] = f7_W - feq7_W + feqW7_E; //DIR_M00 + //(D7.f[3])[kn ] = f7_N - feq7_N + feqW7_S; //DIR_0P0 + //(D7.f[4])[ks ] = f7_S - feq7_S + feqW7_N; //DIR_0M0 + //(D7.f[5])[kt ] = f7_T - feq7_T + feqW7_B; //DIR_00P + //(D7.f[6])[kb ] = f7_B - feq7_B + feqW7_T; //DIR_00M + + //////////////////////////////////////////////////////////////////////////// + ////mit Q's + //real /*feq,*/ q; + //q = q_dirE[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[2])[kw]=(two*feqW7_W-(f7_E*(q*omegaD-one)-omegaD*feq7_E*(q-one))/(omegaD-one)+f7_W*q)/(q+one);//f7_W - feq7_W + feqW7_E; + //} + + //q = q_dirW[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[1])[ke]=(two*feqW7_E-(f7_W*(q*omegaD-one)-omegaD*feq7_W*(q-one))/(omegaD-one)+f7_E*q)/(q+one);//f7_E - feq7_E + feqW7_W; + //} + + //q = q_dirN[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[4])[ks]=(two*feqW7_S-(f7_N*(q*omegaD-one)-omegaD*feq7_N*(q-one))/(omegaD-one)+f7_S*q)/(q+one);//f7_S - feq7_S + feqW7_N; + //} + + //q = q_dirS[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[3])[kn]=(two*feqW7_N-(f7_S*(q*omegaD-one)-omegaD*feq7_S*(q-one))/(omegaD-one)+f7_N*q)/(q+one);//f7_N - feq7_N + feqW7_S; + //} + + //q = q_dirT[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[6])[kb]=(two*feqW7_B-(f7_T*(q*omegaD-one)-omegaD*feq7_T*(q-one))/(omegaD-one)+f7_B*q)/(q+one);//f7_B - feq7_B + feqW7_T; + //} + + //q = q_dirB[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[5])[kt]=(two*feqW7_T-(f7_B*(q*omegaD-one)-omegaD*feq7_B*(q-one))/(omegaD-one)+f7_T*q)/(q+one);//f7_T - feq7_T + feqW7_B; + //} + + ////////////////////////////////////////////////////////////////////////// + //ohne Q's + real /*feq,*/ q; + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[2])[kw]=f7_W - feq7_W + feqW7_E; + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[1])[ke]=f7_E - feq7_E + feqW7_W; + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[4])[ks]=f7_S - feq7_S + feqW7_N; + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[3])[kn]=f7_N - feq7_N + feqW7_S; + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[6])[kb]=f7_B - feq7_B + feqW7_T; + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[5])[kt]=f7_T - feq7_T + feqW7_B; + } + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QADDirichlet27( + real* DD, + real* DD27, + real* temp, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + + Distributions27 D27; + if (isEvenTimestep==true) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + //////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, + *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + *q_dirBSE, *q_dirBNW; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + real f_W = (D.f[DIR_P00 ])[ke ]; + real f_E = (D.f[DIR_M00 ])[kw ]; + real f_S = (D.f[DIR_0P0 ])[kn ]; + real f_N = (D.f[DIR_0M0 ])[ks ]; + real f_B = (D.f[DIR_00P ])[kt ]; + real f_T = (D.f[DIR_00M ])[kb ]; + real f_SW = (D.f[DIR_PP0 ])[kne ]; + real f_NE = (D.f[DIR_MM0 ])[ksw ]; + real f_NW = (D.f[DIR_PM0 ])[kse ]; + real f_SE = (D.f[DIR_MP0 ])[knw ]; + real f_BW = (D.f[DIR_P0P ])[kte ]; + real f_TE = (D.f[DIR_M0M ])[kbw ]; + real f_TW = (D.f[DIR_P0M ])[kbe ]; + real f_BE = (D.f[DIR_M0P ])[ktw ]; + real f_BS = (D.f[DIR_0PP ])[ktn ]; + real f_TN = (D.f[DIR_0MM ])[kbs ]; + real f_TS = (D.f[DIR_0PM ])[kbn ]; + real f_BN = (D.f[DIR_0MP ])[kts ]; + real f_ZERO = (D.f[DIR_000])[kzero]; + real f_BSW = (D.f[DIR_PPP ])[ktne ]; + real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + real f_BNW = (D.f[DIR_PMP ])[ktse ]; + real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + real f_TSW = (D.f[DIR_PPM ])[kbne ]; + real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + real f_TNW = (D.f[DIR_PMM ])[kbse ]; + real f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real vx1, vx2, vx3, /*drho, feq,*/ q; + ////drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + //// f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + //// f_T + f_B + f_N + f_S + f_E + f_W + f_ZERO; + + //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + // (f_E - f_W); + + + //vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + // (f_N - f_S); + + //vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + // (f_T - f_B); + real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+f_ZERO; + real rho = rho0 + c1o1; + real OORho = c1o1/rho; + vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + //////////////////////////////////////////////////////////////////////////////// + real f27_W = (D27.f[DIR_P00 ])[ke ]; + real f27_E = (D27.f[DIR_M00 ])[kw ]; + real f27_S = (D27.f[DIR_0P0 ])[kn ]; + real f27_N = (D27.f[DIR_0M0 ])[ks ]; + real f27_B = (D27.f[DIR_00P ])[kt ]; + real f27_T = (D27.f[DIR_00M ])[kb ]; + real f27_SW = (D27.f[DIR_PP0 ])[kne ]; + real f27_NE = (D27.f[DIR_MM0 ])[ksw ]; + real f27_NW = (D27.f[DIR_PM0 ])[kse ]; + real f27_SE = (D27.f[DIR_MP0 ])[knw ]; + real f27_BW = (D27.f[DIR_P0P ])[kte ]; + real f27_TE = (D27.f[DIR_M0M ])[kbw ]; + real f27_TW = (D27.f[DIR_P0M ])[kbe ]; + real f27_BE = (D27.f[DIR_M0P ])[ktw ]; + real f27_BS = (D27.f[DIR_0PP ])[ktn ]; + real f27_TN = (D27.f[DIR_0MM ])[kbs ]; + real f27_TS = (D27.f[DIR_0PM ])[kbn ]; + real f27_BN = (D27.f[DIR_0MP ])[kts ]; + real f27_ZERO = (D27.f[DIR_000])[kzero]; + real f27_BSW = (D27.f[DIR_PPP ])[ktne ]; + real f27_BNE = (D27.f[DIR_MMP ])[ktsw ]; + real f27_BNW = (D27.f[DIR_PMP ])[ktse ]; + real f27_BSE = (D27.f[DIR_MPP ])[ktnw ]; + real f27_TSW = (D27.f[DIR_PPM ])[kbne ]; + real f27_TNE = (D27.f[DIR_MMM ])[kbsw ]; + real f27_TNW = (D27.f[DIR_PMM ])[kbse ]; + real f27_TSE = (D27.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); + //////////////////////////////////////////////////////////////////////////////// + real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + + f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + + f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; + + //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); + real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real TempD = temp[k];//one;//temp[k]; + + //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); + real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real omegaD = c3o1 - sqrt(c3o1); + //real Lam = -(c1o2-one/omegaD); + //real nue_d = Lam/three; + //real ae = zero; + //real ae = diffusivity/nue_d - one; + + + ////////////////////////////////////////////////////////////////////////// + if (isEvenTimestep==false) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Test + //(D.f[DIR_000])[k]=0.1f; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + q = q_dirE[ ke ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M00 ])[kw ]=(c2o1*feqW27_W -(f27_E *(q*omegaD-c1o1)-omegaD*feq27_E *(q-c1o1))/(omegaD-c1o1)+f27_W *q)/(q+c1o1); + q = q_dirW[ kw ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P00 ])[ke ]=(c2o1*feqW27_E -(f27_W *(q*omegaD-c1o1)-omegaD*feq27_W *(q-c1o1))/(omegaD-c1o1)+f27_E *q)/(q+c1o1); + q = q_dirN[ kn ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0M0 ])[ks ]=(c2o1*feqW27_S -(f27_N *(q*omegaD-c1o1)-omegaD*feq27_N *(q-c1o1))/(omegaD-c1o1)+f27_S *q)/(q+c1o1); + q = q_dirS[ ks ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0P0 ])[kn ]=(c2o1*feqW27_N -(f27_S *(q*omegaD-c1o1)-omegaD*feq27_S *(q-c1o1))/(omegaD-c1o1)+f27_N *q)/(q+c1o1); + q = q_dirT[ kt ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00M ])[kb ]=(c2o1*feqW27_B -(f27_T *(q*omegaD-c1o1)-omegaD*feq27_T *(q-c1o1))/(omegaD-c1o1)+f27_B *q)/(q+c1o1); + q = q_dirB[ kb ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00P ])[kt ]=(c2o1*feqW27_T -(f27_B *(q*omegaD-c1o1)-omegaD*feq27_B *(q-c1o1))/(omegaD-c1o1)+f27_T *q)/(q+c1o1); + q = q_dirNE[ kne ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MM0 ])[ksw ]=(c2o1*feqW27_SW -(f27_NE *(q*omegaD-c1o1)-omegaD*feq27_NE *(q-c1o1))/(omegaD-c1o1)+f27_SW *q)/(q+c1o1); + q = q_dirSW[ ksw ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PP0 ])[kne ]=(c2o1*feqW27_NE -(f27_SW *(q*omegaD-c1o1)-omegaD*feq27_SW *(q-c1o1))/(omegaD-c1o1)+f27_NE *q)/(q+c1o1); + q = q_dirSE[ kse ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MP0 ])[knw ]=(c2o1*feqW27_NW -(f27_SE *(q*omegaD-c1o1)-omegaD*feq27_SE *(q-c1o1))/(omegaD-c1o1)+f27_NW *q)/(q+c1o1); + q = q_dirNW[ knw ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PM0 ])[kse ]=(c2o1*feqW27_SE -(f27_NW *(q*omegaD-c1o1)-omegaD*feq27_NW *(q-c1o1))/(omegaD-c1o1)+f27_SE *q)/(q+c1o1); + q = q_dirTE[ kte ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0M ])[kbw ]=(c2o1*feqW27_BW -(f27_TE *(q*omegaD-c1o1)-omegaD*feq27_TE *(q-c1o1))/(omegaD-c1o1)+f27_BW *q)/(q+c1o1); + q = q_dirBW[ kbw ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0P ])[kte ]=(c2o1*feqW27_TE -(f27_BW *(q*omegaD-c1o1)-omegaD*feq27_BW *(q-c1o1))/(omegaD-c1o1)+f27_TE *q)/(q+c1o1); + q = q_dirBE[ kbe ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0P ])[ktw ]=(c2o1*feqW27_TW -(f27_BE *(q*omegaD-c1o1)-omegaD*feq27_BE *(q-c1o1))/(omegaD-c1o1)+f27_TW *q)/(q+c1o1); + q = q_dirTW[ ktw ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0M ])[kbe ]=(c2o1*feqW27_BE -(f27_TW *(q*omegaD-c1o1)-omegaD*feq27_TW *(q-c1o1))/(omegaD-c1o1)+f27_BE *q)/(q+c1o1); + q = q_dirTN[ ktn ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MM ])[kbs ]=(c2o1*feqW27_BS -(f27_TN *(q*omegaD-c1o1)-omegaD*feq27_TN *(q-c1o1))/(omegaD-c1o1)+f27_BS *q)/(q+c1o1); + q = q_dirBS[ kbs ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PP ])[ktn ]=(c2o1*feqW27_TN -(f27_BS *(q*omegaD-c1o1)-omegaD*feq27_BS *(q-c1o1))/(omegaD-c1o1)+f27_TN *q)/(q+c1o1); + q = q_dirBN[ kbn ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MP ])[kts ]=(c2o1*feqW27_TS -(f27_BN *(q*omegaD-c1o1)-omegaD*feq27_BN *(q-c1o1))/(omegaD-c1o1)+f27_TS *q)/(q+c1o1); + q = q_dirTS[ kts ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PM ])[kbn ]=(c2o1*feqW27_BN -(f27_TS *(q*omegaD-c1o1)-omegaD*feq27_TS *(q-c1o1))/(omegaD-c1o1)+f27_BN *q)/(q+c1o1); + q = q_dirTNE[ktne ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMM])[kbsw]=(c2o1*feqW27_BSW-(f27_TNE*(q*omegaD-c1o1)-omegaD*feq27_TNE*(q-c1o1))/(omegaD-c1o1)+f27_BSW*q)/(q+c1o1); + q = q_dirBSW[kbsw ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPP])[ktne]=(c2o1*feqW27_TNE-(f27_BSW*(q*omegaD-c1o1)-omegaD*feq27_BSW*(q-c1o1))/(omegaD-c1o1)+f27_TNE*q)/(q+c1o1); + q = q_dirBNE[kbne ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMP])[ktsw]=(c2o1*feqW27_TSW-(f27_BNE*(q*omegaD-c1o1)-omegaD*feq27_BNE*(q-c1o1))/(omegaD-c1o1)+f27_TSW*q)/(q+c1o1); + q = q_dirTSW[ktsw ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPM])[kbne]=(c2o1*feqW27_BNE-(f27_TSW*(q*omegaD-c1o1)-omegaD*feq27_TSW*(q-c1o1))/(omegaD-c1o1)+f27_BNE*q)/(q+c1o1); + q = q_dirTSE[ktse ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPM])[kbnw]=(c2o1*feqW27_BNW-(f27_TSE*(q*omegaD-c1o1)-omegaD*feq27_TSE*(q-c1o1))/(omegaD-c1o1)+f27_BNW*q)/(q+c1o1); + q = q_dirBNW[kbnw ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMP])[ktse]=(c2o1*feqW27_TSE-(f27_BNW*(q*omegaD-c1o1)-omegaD*feq27_BNW*(q-c1o1))/(omegaD-c1o1)+f27_TSE*q)/(q+c1o1); + q = q_dirBSE[kbse ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPP])[ktnw]=(c2o1*feqW27_TNW-(f27_BSE*(q*omegaD-c1o1)-omegaD*feq27_BSE*(q-c1o1))/(omegaD-c1o1)+f27_TNW*q)/(q+c1o1); + q = q_dirTNW[ktnw ]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMM])[kbse]=(c2o1*feqW27_BSE-(f27_TNW*(q*omegaD-c1o1)-omegaD*feq27_TNW*(q-c1o1))/(omegaD-c1o1)+f27_BSE*q)/(q+c1o1); + //q = q_dirE[k]; if (q>=zero && q<=one) (D27.f[DIR_M00 ])[kw ]=(two*feqW27_W -(f27_E *(q*omegaD-one)-omegaD*feq27_E *(q-one))/(omegaD-one)+f27_W *q)/(q+one); + //q = q_dirW[k]; if (q>=zero && q<=one) (D27.f[DIR_P00 ])[ke ]=(two*feqW27_E -(f27_W *(q*omegaD-one)-omegaD*feq27_W *(q-one))/(omegaD-one)+f27_E *q)/(q+one); + //q = q_dirN[k]; if (q>=zero && q<=one) (D27.f[DIR_0M0 ])[ks ]=(two*feqW27_S -(f27_N *(q*omegaD-one)-omegaD*feq27_N *(q-one))/(omegaD-one)+f27_S *q)/(q+one); + //q = q_dirS[k]; if (q>=zero && q<=one) (D27.f[DIR_0P0 ])[kn ]=(two*feqW27_N -(f27_S *(q*omegaD-one)-omegaD*feq27_S *(q-one))/(omegaD-one)+f27_N *q)/(q+one); + //q = q_dirT[k]; if (q>=zero && q<=one) (D27.f[DIR_00M ])[kb ]=(two*feqW27_B -(f27_T *(q*omegaD-one)-omegaD*feq27_T *(q-one))/(omegaD-one)+f27_B *q)/(q+one); + //q = q_dirB[k]; if (q>=zero && q<=one) (D27.f[DIR_00P ])[kt ]=(two*feqW27_T -(f27_B *(q*omegaD-one)-omegaD*feq27_B *(q-one))/(omegaD-one)+f27_T *q)/(q+one); + //q = q_dirNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MM0 ])[ksw ]=(two*feqW27_SW -(f27_NE *(q*omegaD-one)-omegaD*feq27_NE *(q-one))/(omegaD-one)+f27_SW *q)/(q+one); + //q = q_dirSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PP0 ])[kne ]=(two*feqW27_NE -(f27_SW *(q*omegaD-one)-omegaD*feq27_SW *(q-one))/(omegaD-one)+f27_NE *q)/(q+one); + //q = q_dirSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MP0 ])[knw ]=(two*feqW27_NW -(f27_SE *(q*omegaD-one)-omegaD*feq27_SE *(q-one))/(omegaD-one)+f27_NW *q)/(q+one); + //q = q_dirNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PM0 ])[kse ]=(two*feqW27_SE -(f27_NW *(q*omegaD-one)-omegaD*feq27_NW *(q-one))/(omegaD-one)+f27_SE *q)/(q+one); + //q = q_dirTE[k]; if (q>=zero && q<=one) (D27.f[DIR_M0M ])[kbw ]=(two*feqW27_BW -(f27_TE *(q*omegaD-one)-omegaD*feq27_TE *(q-one))/(omegaD-one)+f27_BW *q)/(q+one); + //q = q_dirBW[k]; if (q>=zero && q<=one) (D27.f[DIR_P0P ])[kte ]=(two*feqW27_TE -(f27_BW *(q*omegaD-one)-omegaD*feq27_BW *(q-one))/(omegaD-one)+f27_TE *q)/(q+one); + //q = q_dirBE[k]; if (q>=zero && q<=one) (D27.f[DIR_M0P ])[ktw ]=(two*feqW27_TW -(f27_BE *(q*omegaD-one)-omegaD*feq27_BE *(q-one))/(omegaD-one)+f27_TW *q)/(q+one); + //q = q_dirTW[k]; if (q>=zero && q<=one) (D27.f[DIR_P0M ])[kbe ]=(two*feqW27_BE -(f27_TW *(q*omegaD-one)-omegaD*feq27_TW *(q-one))/(omegaD-one)+f27_BE *q)/(q+one); + //q = q_dirTN[k]; if (q>=zero && q<=one) (D27.f[DIR_0MM ])[kbs ]=(two*feqW27_BS -(f27_TN *(q*omegaD-one)-omegaD*feq27_TN *(q-one))/(omegaD-one)+f27_BS *q)/(q+one); + //q = q_dirBS[k]; if (q>=zero && q<=one) (D27.f[DIR_0PP ])[ktn ]=(two*feqW27_TN -(f27_BS *(q*omegaD-one)-omegaD*feq27_BS *(q-one))/(omegaD-one)+f27_TN *q)/(q+one); + //q = q_dirBN[k]; if (q>=zero && q<=one) (D27.f[DIR_0MP ])[kts ]=(two*feqW27_TS -(f27_BN *(q*omegaD-one)-omegaD*feq27_BN *(q-one))/(omegaD-one)+f27_TS *q)/(q+one); + //q = q_dirTS[k]; if (q>=zero && q<=one) (D27.f[DIR_0PM ])[kbn ]=(two*feqW27_BN -(f27_TS *(q*omegaD-one)-omegaD*feq27_TS *(q-one))/(omegaD-one)+f27_BN *q)/(q+one); + //q = q_dirTNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MMM])[kbsw]=(two*feqW27_BSW-(f27_TNE*(q*omegaD-one)-omegaD*feq27_TNE*(q-one))/(omegaD-one)+f27_BSW*q)/(q+one); + //q = q_dirBSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PPP])[ktne]=(two*feqW27_TNE-(f27_BSW*(q*omegaD-one)-omegaD*feq27_BSW*(q-one))/(omegaD-one)+f27_TNE*q)/(q+one); + //q = q_dirBNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MMP])[ktsw]=(two*feqW27_TSW-(f27_BNE*(q*omegaD-one)-omegaD*feq27_BNE*(q-one))/(omegaD-one)+f27_TSW*q)/(q+one); + //q = q_dirTSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PPM])[kbne]=(two*feqW27_BNE-(f27_TSW*(q*omegaD-one)-omegaD*feq27_TSW*(q-one))/(omegaD-one)+f27_BNE*q)/(q+one); + //q = q_dirTSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MPM])[kbnw]=(two*feqW27_BNW-(f27_TSE*(q*omegaD-one)-omegaD*feq27_TSE*(q-one))/(omegaD-one)+f27_BNW*q)/(q+one); + //q = q_dirBNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PMP])[ktse]=(two*feqW27_TSE-(f27_BNW*(q*omegaD-one)-omegaD*feq27_BNW*(q-one))/(omegaD-one)+f27_TSE*q)/(q+one); + //q = q_dirBSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MPP])[ktnw]=(two*feqW27_TNW-(f27_BSE*(q*omegaD-one)-omegaD*feq27_BSE*(q-one))/(omegaD-one)+f27_TNW*q)/(q+one); + //q = q_dirTNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PMM])[kbse]=(two*feqW27_BSE-(f27_TNW*(q*omegaD-one)-omegaD*feq27_TNW*(q-one))/(omegaD-one)+f27_BSE*q)/(q+one); + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QADBB27( real* DD, + real* DD27, + real* temp, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + //Distributions27 D; + //if (isEvenTimestep==true) + //{ + // D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + //} + //else + //{ + // D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + //} + + Distributions27 D27; + if (isEvenTimestep==true) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + //////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, + *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + *q_dirBSE, *q_dirBNW; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + //unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + //real f_W = (D.f[DIR_P00 ])[ke ]; + //real f_E = (D.f[DIR_M00 ])[kw ]; + //real f_S = (D.f[DIR_0P0 ])[kn ]; + //real f_N = (D.f[DIR_0M0 ])[ks ]; + //real f_B = (D.f[DIR_00P ])[kt ]; + //real f_T = (D.f[DIR_00M ])[kb ]; + //real f_SW = (D.f[DIR_PP0 ])[kne ]; + //real f_NE = (D.f[DIR_MM0 ])[ksw ]; + //real f_NW = (D.f[DIR_PM0 ])[kse ]; + //real f_SE = (D.f[DIR_MP0 ])[knw ]; + //real f_BW = (D.f[DIR_P0P ])[kte ]; + //real f_TE = (D.f[DIR_M0M ])[kbw ]; + //real f_TW = (D.f[DIR_P0M ])[kbe ]; + //real f_BE = (D.f[DIR_M0P ])[ktw ]; + //real f_BS = (D.f[DIR_0PP ])[ktn ]; + //real f_TN = (D.f[DIR_0MM ])[kbs ]; + //real f_TS = (D.f[DIR_0PM ])[kbn ]; + //real f_BN = (D.f[DIR_0MP ])[kts ]; + //real f_ZERO = (D.f[DIR_000])[kzero]; + //real f_BSW = (D.f[DIR_PPP ])[ktne ]; + //real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + //real f_BNW = (D.f[DIR_PMP ])[ktse ]; + //real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + //real f_TSW = (D.f[DIR_PPM ])[kbne ]; + //real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + //real f_TNW = (D.f[DIR_PMM ])[kbse ]; + //real f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + //real vx1, vx2, vx3, /*drho, feq,*/ q; + real q; + ////drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + //// f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + //// f_T + f_B + f_N + f_S + f_E + f_W + f_ZERO; + + //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + // (f_E - f_W); + + + //vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + // ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + // (f_N - f_S); + + //vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + // (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + // (f_T - f_B); + //real rho0 = (f_TNE+f_BSW)+(f_TSW+f_BNE)+(f_TSE+f_BNW)+(f_TNW+f_BSE)+(f_NE+f_SW)+(f_NW+f_SE)+(f_TE+f_BW)+(f_BE+f_TW)+(f_TN+f_BS)+(f_BN+f_TS)+(f_E+f_W)+(f_N+f_S)+(f_T+f_B)+f_ZERO; + //real rho = rho0 + c1o1; + //real OORho = c1o1/rho; + //vx1 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + //vx2 = OORho*((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + //vx3 = OORho*((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + //////////////////////////////////////////////////////////////////////////////// + real f27_W = (D27.f[DIR_P00 ])[ke ]; + real f27_E = (D27.f[DIR_M00 ])[kw ]; + real f27_S = (D27.f[DIR_0P0 ])[kn ]; + real f27_N = (D27.f[DIR_0M0 ])[ks ]; + real f27_B = (D27.f[DIR_00P ])[kt ]; + real f27_T = (D27.f[DIR_00M ])[kb ]; + real f27_SW = (D27.f[DIR_PP0 ])[kne ]; + real f27_NE = (D27.f[DIR_MM0 ])[ksw ]; + real f27_NW = (D27.f[DIR_PM0 ])[kse ]; + real f27_SE = (D27.f[DIR_MP0 ])[knw ]; + real f27_BW = (D27.f[DIR_P0P ])[kte ]; + real f27_TE = (D27.f[DIR_M0M ])[kbw ]; + real f27_TW = (D27.f[DIR_P0M ])[kbe ]; + real f27_BE = (D27.f[DIR_M0P ])[ktw ]; + real f27_BS = (D27.f[DIR_0PP ])[ktn ]; + real f27_TN = (D27.f[DIR_0MM ])[kbs ]; + real f27_TS = (D27.f[DIR_0PM ])[kbn ]; + real f27_BN = (D27.f[DIR_0MP ])[kts ]; + //real f27_ZERO = (D27.f[DIR_000])[kzero]; + real f27_BSW = (D27.f[DIR_PPP ])[ktne ]; + real f27_BNE = (D27.f[DIR_MMP ])[ktsw ]; + real f27_BNW = (D27.f[DIR_PMP ])[ktse ]; + real f27_BSE = (D27.f[DIR_MPP ])[ktnw ]; + real f27_TSW = (D27.f[DIR_PPM ])[kbne ]; + real f27_TNE = (D27.f[DIR_MMM ])[kbsw ]; + real f27_TNW = (D27.f[DIR_PMM ])[kbse ]; + real f27_TSE = (D27.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + //real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); + //////////////////////////////////////////////////////////////////////////////// + //real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + + // f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + + // f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; + + //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); + //real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + //real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + //real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + //real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + //real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + //real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + //real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + //real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + //real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + //real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + //real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + //real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + //real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + //real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + //real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + //real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + //real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + //real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + //real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + //real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + //real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + //real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + //real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + //real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + //real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + //real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //real TempD = temp[k]; + + //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); + //real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + //real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + //real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + //real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + //real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + //real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + //real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + //real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + //real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + //real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + //real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + //real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + //real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + //real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + //real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + //real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + //real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + //real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + //real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + //real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + //real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + //real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + //real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + //real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + //real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + //real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real omegaD = c3o1 - sqrt(c3o1); + //real Lam = -(c1o2-one/omegaD); + //real nue_d = Lam/three; + //real ae = zero; + //real ae = diffusivity/nue_d - one; + + + ////////////////////////////////////////////////////////////////////////// + if (isEvenTimestep==false) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Test + //(D.f[DIR_000])[k]=0.1f; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M00 ])[kw ]=f27_E ; + q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P00 ])[ke ]=f27_W ; + q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0M0 ])[ks ]=f27_N ; + q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0P0 ])[kn ]=f27_S ; + q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00M ])[kb ]=f27_T ; + q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00P ])[kt ]=f27_B ; + q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MM0 ])[ksw ]=f27_NE ; + q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PP0 ])[kne ]=f27_SW ; + q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MP0 ])[knw ]=f27_SE ; + q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PM0 ])[kse ]=f27_NW ; + q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0M ])[kbw ]=f27_TE ; + q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0P ])[kte ]=f27_BW ; + q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0P ])[ktw ]=f27_BE ; + q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0M ])[kbe ]=f27_TW ; + q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MM ])[kbs ]=f27_TN ; + q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PP ])[ktn ]=f27_BS ; + q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MP ])[kts ]=f27_BN ; + q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PM ])[kbn ]=f27_TS ; + q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMM])[kbsw]=f27_TNE; + q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPP])[ktne]=f27_BSW; + q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMP])[ktsw]=f27_BNE; + q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPM])[kbne]=f27_TSW; + q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPM])[kbnw]=f27_TSE; + q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMP])[ktse]=f27_BNW; + q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPP])[ktnw]=f27_BSE; + q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMM])[kbse]=f27_TNW; + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////// ////// +////// incomp ////// +////// ////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QNoSlipADincomp7( + real* DD, + real* DD7, + real* temp, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + //Distributions27 D; + //if (isEvenTimestep==true) + //{ + // D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + //} + //else + //{ + // D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + //} + + Distributions7 D7; + if (isEvenTimestep==true) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + ////////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB; + + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + ////////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + //unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + //unsigned int ksw = neighborY[kw]; + //unsigned int kne = KQK; + //unsigned int kse = ks; + //unsigned int knw = kw; + //unsigned int kbw = neighborZ[kw]; + //unsigned int kte = KQK; + //unsigned int kbe = kb; + //unsigned int ktw = kw; + //unsigned int kbs = neighborZ[ks]; + //unsigned int ktn = KQK; + //unsigned int kbn = kb; + //unsigned int kts = ks; + //unsigned int ktse = ks; + //unsigned int kbnw = kbw; + //unsigned int ktnw = kw; + //unsigned int kbse = kbs; + //unsigned int ktsw = ksw; + //unsigned int kbne = kb; + //unsigned int ktne = KQK; + //unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + //real f_W = (D.f[DIR_P00 ])[ke ]; + //real f_E = (D.f[DIR_M00 ])[kw ]; + //real f_S = (D.f[DIR_0P0 ])[kn ]; + //real f_N = (D.f[DIR_0M0 ])[ks ]; + //real f_B = (D.f[DIR_00P ])[kt ]; + //real f_T = (D.f[DIR_00M ])[kb ]; + //real f_SW = (D.f[DIR_PP0 ])[kne ]; + //real f_NE = (D.f[DIR_MM0 ])[ksw ]; + //real f_NW = (D.f[DIR_PM0 ])[kse ]; + //real f_SE = (D.f[DIR_MP0 ])[knw ]; + //real f_BW = (D.f[DIR_P0P ])[kte ]; + //real f_TE = (D.f[DIR_M0M ])[kbw ]; + //real f_TW = (D.f[DIR_P0M ])[kbe ]; + //real f_BE = (D.f[DIR_M0P ])[ktw ]; + //real f_BS = (D.f[DIR_0PP ])[ktn ]; + //real f_TN = (D.f[DIR_0MM ])[kbs ]; + //real f_TS = (D.f[DIR_0PM ])[kbn ]; + //real f_BN = (D.f[DIR_0MP ])[kts ]; + //real f_BSW = (D.f[DIR_PPP ])[ktne ]; + //real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + //real f_BNW = (D.f[DIR_PMP ])[ktse ]; + //real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + //real f_TSW = (D.f[DIR_PPM ])[kbne ]; + //real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + //real f_TNW = (D.f[DIR_PMM ])[kbse ]; + //real f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + //real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + //real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + //real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + ////d�rrrrrty !!!!!!!!!!!!! + // real vx1 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + // real vx2 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + // real vx3 = ten * ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + + //real cu_sq =c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); + //real ux_sq = vx1 * vx1; + //real uy_sq = vx2 * vx2; + //real uz_sq = vx3 * vx3; + //////////////////////////////////////////////////////////////////////////////// + //BGK + //real omegaD = three - sqrt(three); + //real Lam = -(c1o2-one/omegaD); + //real nue_d = Lam/three; + //real ae = diffusivity/nue_d - one; //zero; + + real f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; + //real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; + //real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; + real TempD = temp[k]; + + + //f7_ZERO = (D7.f[0])[kzero]; + f7_W = (D7.f[1])[ke ]; + f7_E = (D7.f[2])[kw ]; + f7_S = (D7.f[3])[kn ]; + f7_N = (D7.f[4])[ks ]; + f7_B = (D7.f[5])[kt ]; + f7_T = (D7.f[6])[kb ]; + + //real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; + + ////feq7_ZERO = ConcD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); + //feq7_E = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)+vx1*c1o2); + //feq7_W = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)-vx1*c1o2); + //feq7_N = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)+vx2*c1o2); + //feq7_S = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)-vx2*c1o2); + //feq7_T = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)+vx3*c1o2); + //feq7_B = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)-vx3*c1o2); + + ////feq7_ZERO = TempD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); + //feqW7_E = TempD*(c1o6*(ae+one));//+c1o2*(ux_sq)+vx1*c1o2); + //feqW7_W = TempD*(c1o6*(ae+one));//+c1o2*(ux_sq)-vx1*c1o2); + //feqW7_N = TempD*(c1o6*(ae+one));//+c1o2*(uy_sq)+vx2*c1o2); + //feqW7_S = TempD*(c1o6*(ae+one));//+c1o2*(uy_sq)-vx2*c1o2); + //feqW7_T = TempD*(c1o6*(ae+one));//+c1o2*(uz_sq)+vx3*c1o2); + //feqW7_B = TempD*(c1o6*(ae+one));//+c1o2*(uz_sq)-vx3*c1o2); + + //////////////////////////////////////////////////////////////////////////////// + //TRT + real cs2 = c1o4; + ////////////////////////////////////////////////////////////////////////// + //pointertausch + if (isEvenTimestep==false) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + //////////////////////////////////////////////////////////////////////////// + ////mit Q's + //real /*feq,*/ q; + //q = q_dirE[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[2])[kw]=(two*feqW7_W-(f7_E*(q*omegaD-one)-omegaD*feq7_E*(q-one))/(omegaD-one)+f7_W*q)/(q+one);//f7_W - feq7_W + feqW7_E; + //} + + //q = q_dirW[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[1])[ke]=(two*feqW7_E-(f7_W*(q*omegaD-one)-omegaD*feq7_W*(q-one))/(omegaD-one)+f7_E*q)/(q+one);//f7_E - feq7_E + feqW7_W; + //} + + //q = q_dirN[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[4])[ks]=(two*feqW7_S-(f7_N*(q*omegaD-one)-omegaD*feq7_N*(q-one))/(omegaD-one)+f7_S*q)/(q+one);//f7_S - feq7_S + feqW7_N; + //} + + //q = q_dirS[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[3])[kn]=(two*feqW7_N-(f7_S*(q*omegaD-one)-omegaD*feq7_S*(q-one))/(omegaD-one)+f7_N*q)/(q+one);//f7_N - feq7_N + feqW7_S; + //} + + //q = q_dirT[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[6])[kb]=(two*feqW7_B-(f7_T*(q*omegaD-one)-omegaD*feq7_T*(q-one))/(omegaD-one)+f7_B*q)/(q+one);//f7_B - feq7_B + feqW7_T; + //} + + //q = q_dirB[k]; + //if (q>=zero && q<=one) + //{ + // //q=zero; + // (D7.f[5])[kt]=(two*feqW7_T-(f7_B*(q*omegaD-one)-omegaD*feq7_B*(q-one))/(omegaD-one)+f7_T*q)/(q+one);//f7_T - feq7_T + feqW7_B; + //} + + //////////////////////////////////////////////////////////////////////////// + ////ohne Q's + //real /*feq,*/ q; + //q = q_dirE[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[2])[kw]=f7_W;// - feq7_W + feqW7_E; + //} + + //q = q_dirW[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[1])[ke]=f7_E;// - feq7_E + feqW7_W; + //} + + //q = q_dirN[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[4])[ks]=f7_S;// - feq7_S + feqW7_N; + //} + + //q = q_dirS[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[3])[kn]=f7_N;// - feq7_N + feqW7_S; + //} + + //q = q_dirT[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[6])[kb]=f7_B;// - feq7_B + feqW7_T; + //} + + //q = q_dirB[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[5])[kt]=f7_T;// - feq7_T + feqW7_B; + //} + + + ////////////////////////////////////////////////////////////////////////// + //ohne Q's aber mit TRT + real /*feq,*/ q; + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[2])[kw]= -f7_W + cs2 * TempD; + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[1])[ke]= -f7_E + cs2 * TempD; + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[4])[ks]= -f7_S + cs2 * TempD; + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[3])[kn]= -f7_N + cs2 * TempD; + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[6])[kb]= -f7_B + cs2 * TempD; + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[5])[kt]= -f7_T + cs2 * TempD; + } + + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QNoSlipADincomp27( + real* DD, + real* DD27, + real* temp, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + + Distributions27 D27; + if (isEvenTimestep==true) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + //////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, + *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + *q_dirBSE, *q_dirBNW; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + real f_W = (D.f[DIR_P00 ])[ke ]; + real f_E = (D.f[DIR_M00 ])[kw ]; + real f_S = (D.f[DIR_0P0 ])[kn ]; + real f_N = (D.f[DIR_0M0 ])[ks ]; + real f_B = (D.f[DIR_00P ])[kt ]; + real f_T = (D.f[DIR_00M ])[kb ]; + real f_SW = (D.f[DIR_PP0 ])[kne ]; + real f_NE = (D.f[DIR_MM0 ])[ksw ]; + real f_NW = (D.f[DIR_PM0 ])[kse ]; + real f_SE = (D.f[DIR_MP0 ])[knw ]; + real f_BW = (D.f[DIR_P0P ])[kte ]; + real f_TE = (D.f[DIR_M0M ])[kbw ]; + real f_TW = (D.f[DIR_P0M ])[kbe ]; + real f_BE = (D.f[DIR_M0P ])[ktw ]; + real f_BS = (D.f[DIR_0PP ])[ktn ]; + real f_TN = (D.f[DIR_0MM ])[kbs ]; + real f_TS = (D.f[DIR_0PM ])[kbn ]; + real f_BN = (D.f[DIR_0MP ])[kts ]; + //real f_ZERO = (D.f[DIR_000])[kzero]; + real f_BSW = (D.f[DIR_PPP ])[ktne ]; + real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + real f_BNW = (D.f[DIR_PMP ])[ktse ]; + real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + real f_TSW = (D.f[DIR_PPM ])[kbne ]; + real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + real f_TNW = (D.f[DIR_PMM ])[kbse ]; + real f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + //////////////////////////////////////////////////////////////////////////////// + real f27_W = (D27.f[DIR_P00 ])[ke ]; + real f27_E = (D27.f[DIR_M00 ])[kw ]; + real f27_S = (D27.f[DIR_0P0 ])[kn ]; + real f27_N = (D27.f[DIR_0M0 ])[ks ]; + real f27_B = (D27.f[DIR_00P ])[kt ]; + real f27_T = (D27.f[DIR_00M ])[kb ]; + real f27_SW = (D27.f[DIR_PP0 ])[kne ]; + real f27_NE = (D27.f[DIR_MM0 ])[ksw ]; + real f27_NW = (D27.f[DIR_PM0 ])[kse ]; + real f27_SE = (D27.f[DIR_MP0 ])[knw ]; + real f27_BW = (D27.f[DIR_P0P ])[kte ]; + real f27_TE = (D27.f[DIR_M0M ])[kbw ]; + real f27_TW = (D27.f[DIR_P0M ])[kbe ]; + real f27_BE = (D27.f[DIR_M0P ])[ktw ]; + real f27_BS = (D27.f[DIR_0PP ])[ktn ]; + real f27_TN = (D27.f[DIR_0MM ])[kbs ]; + real f27_TS = (D27.f[DIR_0PM ])[kbn ]; + real f27_BN = (D27.f[DIR_0MP ])[kts ]; + real f27_ZERO = (D27.f[DIR_000])[kzero]; + real f27_BSW = (D27.f[DIR_PPP ])[ktne ]; + real f27_BNE = (D27.f[DIR_MMP ])[ktsw ]; + real f27_BNW = (D27.f[DIR_PMP ])[ktse ]; + real f27_BSE = (D27.f[DIR_MPP ])[ktnw ]; + real f27_TSW = (D27.f[DIR_PPM ])[kbne ]; + real f27_TNE = (D27.f[DIR_MMM ])[kbsw ]; + real f27_TNW = (D27.f[DIR_PMM ])[kbse ]; + real f27_TSE = (D27.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); + //////////////////////////////////////////////////////////////////////////////// + real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + + f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + + f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; + + //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); + real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real TempD = temp[k]; + + //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); + real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real omegaD = c3o1 - sqrt(c3o1); + //real Lam = -(c1o2-one/omegaD); + //real nue_d = Lam/three; + //real ae = zero; + //real ae = diffusivity/nue_d - one; + + + ////////////////////////////////////////////////////////////////////////// + if (isEvenTimestep==false) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Test + //(D.f[DIR_000])[k]=0.1f; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real q; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M00 ])[kw ]=(c2o1*feqW27_W -(f27_E *(q*omegaD-c1o1)-omegaD*feq27_E *(q-c1o1))/(omegaD-c1o1)+f27_W *q)/(q+c1o1); + q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P00 ])[ke ]=(c2o1*feqW27_E -(f27_W *(q*omegaD-c1o1)-omegaD*feq27_W *(q-c1o1))/(omegaD-c1o1)+f27_E *q)/(q+c1o1); + q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0M0 ])[ks ]=(c2o1*feqW27_S -(f27_N *(q*omegaD-c1o1)-omegaD*feq27_N *(q-c1o1))/(omegaD-c1o1)+f27_S *q)/(q+c1o1); + q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0P0 ])[kn ]=(c2o1*feqW27_N -(f27_S *(q*omegaD-c1o1)-omegaD*feq27_S *(q-c1o1))/(omegaD-c1o1)+f27_N *q)/(q+c1o1); + q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00M ])[kb ]=(c2o1*feqW27_B -(f27_T *(q*omegaD-c1o1)-omegaD*feq27_T *(q-c1o1))/(omegaD-c1o1)+f27_B *q)/(q+c1o1); + q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00P ])[kt ]=(c2o1*feqW27_T -(f27_B *(q*omegaD-c1o1)-omegaD*feq27_B *(q-c1o1))/(omegaD-c1o1)+f27_T *q)/(q+c1o1); + q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MM0 ])[ksw ]=(c2o1*feqW27_SW -(f27_NE *(q*omegaD-c1o1)-omegaD*feq27_NE *(q-c1o1))/(omegaD-c1o1)+f27_SW *q)/(q+c1o1); + q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PP0 ])[kne ]=(c2o1*feqW27_NE -(f27_SW *(q*omegaD-c1o1)-omegaD*feq27_SW *(q-c1o1))/(omegaD-c1o1)+f27_NE *q)/(q+c1o1); + q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MP0 ])[knw ]=(c2o1*feqW27_NW -(f27_SE *(q*omegaD-c1o1)-omegaD*feq27_SE *(q-c1o1))/(omegaD-c1o1)+f27_NW *q)/(q+c1o1); + q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PM0 ])[kse ]=(c2o1*feqW27_SE -(f27_NW *(q*omegaD-c1o1)-omegaD*feq27_NW *(q-c1o1))/(omegaD-c1o1)+f27_SE *q)/(q+c1o1); + q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0M ])[kbw ]=(c2o1*feqW27_BW -(f27_TE *(q*omegaD-c1o1)-omegaD*feq27_TE *(q-c1o1))/(omegaD-c1o1)+f27_BW *q)/(q+c1o1); + q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0P ])[kte ]=(c2o1*feqW27_TE -(f27_BW *(q*omegaD-c1o1)-omegaD*feq27_BW *(q-c1o1))/(omegaD-c1o1)+f27_TE *q)/(q+c1o1); + q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0P ])[ktw ]=(c2o1*feqW27_TW -(f27_BE *(q*omegaD-c1o1)-omegaD*feq27_BE *(q-c1o1))/(omegaD-c1o1)+f27_TW *q)/(q+c1o1); + q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0M ])[kbe ]=(c2o1*feqW27_BE -(f27_TW *(q*omegaD-c1o1)-omegaD*feq27_TW *(q-c1o1))/(omegaD-c1o1)+f27_BE *q)/(q+c1o1); + q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MM ])[kbs ]=(c2o1*feqW27_BS -(f27_TN *(q*omegaD-c1o1)-omegaD*feq27_TN *(q-c1o1))/(omegaD-c1o1)+f27_BS *q)/(q+c1o1); + q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PP ])[ktn ]=(c2o1*feqW27_TN -(f27_BS *(q*omegaD-c1o1)-omegaD*feq27_BS *(q-c1o1))/(omegaD-c1o1)+f27_TN *q)/(q+c1o1); + q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MP ])[kts ]=(c2o1*feqW27_TS -(f27_BN *(q*omegaD-c1o1)-omegaD*feq27_BN *(q-c1o1))/(omegaD-c1o1)+f27_TS *q)/(q+c1o1); + q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PM ])[kbn ]=(c2o1*feqW27_BN -(f27_TS *(q*omegaD-c1o1)-omegaD*feq27_TS *(q-c1o1))/(omegaD-c1o1)+f27_BN *q)/(q+c1o1); + q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMM])[kbsw]=(c2o1*feqW27_BSW-(f27_TNE*(q*omegaD-c1o1)-omegaD*feq27_TNE*(q-c1o1))/(omegaD-c1o1)+f27_BSW*q)/(q+c1o1); + q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPP])[ktne]=(c2o1*feqW27_TNE-(f27_BSW*(q*omegaD-c1o1)-omegaD*feq27_BSW*(q-c1o1))/(omegaD-c1o1)+f27_TNE*q)/(q+c1o1); + q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMP])[ktsw]=(c2o1*feqW27_TSW-(f27_BNE*(q*omegaD-c1o1)-omegaD*feq27_BNE*(q-c1o1))/(omegaD-c1o1)+f27_TSW*q)/(q+c1o1); + q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPM])[kbne]=(c2o1*feqW27_BNE-(f27_TSW*(q*omegaD-c1o1)-omegaD*feq27_TSW*(q-c1o1))/(omegaD-c1o1)+f27_BNE*q)/(q+c1o1); + q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPM])[kbnw]=(c2o1*feqW27_BNW-(f27_TSE*(q*omegaD-c1o1)-omegaD*feq27_TSE*(q-c1o1))/(omegaD-c1o1)+f27_BNW*q)/(q+c1o1); + q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMP])[ktse]=(c2o1*feqW27_TSE-(f27_BNW*(q*omegaD-c1o1)-omegaD*feq27_BNW*(q-c1o1))/(omegaD-c1o1)+f27_TSE*q)/(q+c1o1); + q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPP])[ktnw]=(c2o1*feqW27_TNW-(f27_BSE*(q*omegaD-c1o1)-omegaD*feq27_BSE*(q-c1o1))/(omegaD-c1o1)+f27_TNW*q)/(q+c1o1); + q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMM])[kbse]=(c2o1*feqW27_BSE-(f27_TNW*(q*omegaD-c1o1)-omegaD*feq27_TNW*(q-c1o1))/(omegaD-c1o1)+f27_BSE*q)/(q+c1o1); + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QADVeloIncomp7( + real* DD, + real* DD7, + real* temp, + real* velo, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + //Distributions27 D; + //if (isEvenTimestep==true) + //{ + // D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + //} + //else + //{ + // D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + //} + + Distributions7 D7; + if (isEvenTimestep==true) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + ////////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB; + + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + ////////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + //unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + //unsigned int ksw = neighborY[kw]; + //unsigned int kne = KQK; + //unsigned int kse = ks; + //unsigned int knw = kw; + //unsigned int kbw = neighborZ[kw]; + //unsigned int kte = KQK; + //unsigned int kbe = kb; + //unsigned int ktw = kw; + //unsigned int kbs = neighborZ[ks]; + //unsigned int ktn = KQK; + //unsigned int kbn = kb; + //unsigned int kts = ks; + //unsigned int ktse = ks; + //unsigned int kbnw = kbw; + //unsigned int ktnw = kw; + //unsigned int kbse = kbs; + //unsigned int ktsw = ksw; + //unsigned int kbne = kb; + //unsigned int ktne = KQK; + //unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + //real f_W = (D.f[DIR_P00 ])[ke ]; + //real f_E = (D.f[DIR_M00 ])[kw ]; + //real f_S = (D.f[DIR_0P0 ])[kn ]; + //real f_N = (D.f[DIR_0M0 ])[ks ]; + //real f_B = (D.f[DIR_00P ])[kt ]; + //real f_T = (D.f[DIR_00M ])[kb ]; + //real f_SW = (D.f[DIR_PP0 ])[kne ]; + //real f_NE = (D.f[DIR_MM0 ])[ksw ]; + //real f_NW = (D.f[DIR_PM0 ])[kse ]; + //real f_SE = (D.f[DIR_MP0 ])[knw ]; + //real f_BW = (D.f[DIR_P0P ])[kte ]; + //real f_TE = (D.f[DIR_M0M ])[kbw ]; + //real f_TW = (D.f[DIR_P0M ])[kbe ]; + //real f_BE = (D.f[DIR_M0P ])[ktw ]; + //real f_BS = (D.f[DIR_0PP ])[ktn ]; + //real f_TN = (D.f[DIR_0MM ])[kbs ]; + //real f_TS = (D.f[DIR_0PM ])[kbn ]; + //real f_BN = (D.f[DIR_0MP ])[kts ]; + //real f_BSW = (D.f[DIR_PPP ])[ktne ]; + //real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + //real f_BNW = (D.f[DIR_PMP ])[ktse ]; + //real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + //real f_TSW = (D.f[DIR_PPM ])[kbne ]; + //real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + //real f_TNW = (D.f[DIR_PMM ])[kbse ]; + //real f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + //real vx1_Inflow = c0o1; + //real vx2_Inflow = velo[k]; + //real vx3_Inflow = c0o1; + //real ux_sq_Inflow = vx1_Inflow * vx1_Inflow; + //real uy_sq_Inflow = vx2_Inflow * vx2_Inflow; + //real uz_sq_Inflow = vx3_Inflow * vx3_Inflow; + //////////////////////////////////////////////////////////////////////////////// + //real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + //real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + //real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + ////d�rrrrrty !!!!!!!!!!!!! + // real vx1 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + // real vx2 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + // real vx3 = ten * ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + //////////////////////////////////////////////////////////////////////////////// + //real cu_sq =1.5f*(vx1*vx1+vx2*vx2+vx3*vx3); + //real ux_sq = vx1 * vx1; + //real uy_sq = vx2 * vx2; + //real uz_sq = vx3 * vx3; + + real f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; + //real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; + //real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; + real TempD = temp[k]; + + //f7_ZERO = (D7.f[0])[kzero]; + f7_W = (D7.f[1])[ke ]; + f7_E = (D7.f[2])[kw ]; + f7_S = (D7.f[3])[kn ]; + f7_N = (D7.f[4])[ks ]; + f7_B = (D7.f[5])[kt ]; + f7_T = (D7.f[6])[kb ]; + + //real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; + + //////////////////////////////////////////////////////////////////////////////// + //BGK + //real omegaD = three - sqrt(three); + //real Lam = -(c1o2-one/omegaD); + //real nue_d = Lam/three; + ////real ae = zero; + //real ae = diffusivity/nue_d - one; + + ////feq7_ZERO = ConcD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); + //feq7_E = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)+vx1*c1o2); + //feq7_W = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)-vx1*c1o2); + //feq7_N = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)+vx2*c1o2); + //feq7_S = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)-vx2*c1o2); + //feq7_T = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)+vx3*c1o2); + //feq7_B = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)-vx3*c1o2); + + ////feq7_ZERO = TempD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); + //feqW7_E = TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)+vx1_Inflow*c1o2); + //feqW7_W = TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)-vx1_Inflow*c1o2); + //feqW7_N = TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)+vx2_Inflow*c1o2); + //feqW7_S = TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)-vx2_Inflow*c1o2); + //feqW7_T = TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)+vx3_Inflow*c1o2); + //feqW7_B = TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)-vx3_Inflow*c1o2); + + // //////////////////////////////////////////////////////////////////////////////// + ////TRT Yoshida Kernel - based on Ying + real cs2 = c1o4; + // real Lam = diffusivity/(one)/cs2; + // real omegaD = - one / (Lam + c1o2); + // real ae = zero; + // //////////////////////////////////////////////////////////////////////////////// + //real Mom000 = f7_ZERO + f7_W + f7_E + f7_N + f7_S + f7_T + f7_B; //1 + // real Mom100 = f7_E - f7_W; + // real Mom010 = f7_N - f7_S; + // real Mom001 = f7_T - f7_B; + // real Mom222 = six*f7_ZERO - f7_W - f7_E - f7_N - f7_S - f7_T - f7_B; + // real Mom200 = two*f7_W + two*f7_E - f7_N - f7_S - f7_T - f7_B; + // real Mom022 = f7_N + f7_S - f7_T - f7_B; + + // real Meq000 = ConcD; + // real Meq100 = ConcD*vx1; + // real Meq010 = ConcD*vx2; + // real Meq001 = ConcD*vx3; + // real Meq222 = c3o4*ConcD; + // real Meq200 = zero; + // real Meq022 = zero; + + // // relaxation TRT Yoshida + + // // odd + // Mom100 = omegaD * (Mom100-Meq100); + // Mom010 = omegaD * (Mom010-Meq010); + // Mom001 = omegaD * (Mom001-Meq001); + // + // // even + // Mom000 = -one*(Mom000-Meq000); + // Mom222 = -one*(Mom222-Meq222); + // Mom200 = -one*(Mom200-Meq200); + // Mom022 = -one*(Mom022-Meq022); + // + // //Back transformation to distributions + // f7_ZERO = f7_ZERO + c1o7*Mom000 + c1o7*Mom222; //1 + // f7_E = f7_E + c1o7*Mom000 + c1o2*Mom100 - c1o6*c1o7*Mom222 + c1o6*Mom200; //2 + // f7_W = f7_W + c1o7*Mom000 - c1o2*Mom100 - c1o6*c1o7*Mom222 + c1o6*Mom200; //3 + // f7_N = f7_N + c1o7*Mom000 + c1o2*Mom010 - c1o6*c1o7*Mom222 - c1o12*Mom200 + c1o4 *Mom022; //4 + // f7_S = f7_S + c1o7*Mom000 - c1o2*Mom010 - c1o6*c1o7*Mom222 - c1o12*Mom200 + c1o4 *Mom022; //5 + // f7_T = f7_T + c1o7*Mom000 + c1o2*Mom001 - c1o6*c1o7*Mom222 - c1o12*Mom200 - c1o4 *Mom022; //6 + // f7_B = f7_B + c1o7*Mom000 - c1o2*Mom001 - c1o6*c1o7*Mom222 - c1o12*Mom200 - c1o4 *Mom022; //7 + + + + + + ////////////////////////////////////////////////////////////////////////// + //pointertausch + if (isEvenTimestep==false) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + //////////////////////////////////////////////////////////////////////////// + ////mit Q's + //real /*feq,*/ q; + //q = q_dirE[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[2])[kw]=(two*feqW7_W-(f7_E*(q*omegaD-one)-omegaD*feq7_E*(q-one))/(omegaD-one)+f7_W*q)/(q+one);//f7_W - feq7_W + feqW7_E; + //} + + //q = q_dirW[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[1])[ke]=(two*feqW7_E-(f7_W*(q*omegaD-one)-omegaD*feq7_W*(q-one))/(omegaD-one)+f7_E*q)/(q+one);//f7_E - feq7_E + feqW7_W; + //} + + //q = q_dirN[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[4])[ks]=(two*feqW7_S-(f7_N*(q*omegaD-one)-omegaD*feq7_N*(q-one))/(omegaD-one)+f7_S*q)/(q+one);//f7_S - feq7_S + feqW7_N; + //} + + //q = q_dirS[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[3])[kn]=(two*feqW7_N-(f7_S*(q*omegaD-one)-omegaD*feq7_S*(q-one))/(omegaD-one)+f7_N*q)/(q+one);//f7_N - feq7_N + feqW7_S; + //} + + //q = q_dirT[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[6])[kb]=(two*feqW7_B-(f7_T*(q*omegaD-one)-omegaD*feq7_T*(q-one))/(omegaD-one)+f7_B*q)/(q+one);//f7_B - feq7_B + feqW7_T; + //} + + //q = q_dirB[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[5])[kt]=(two*feqW7_T-(f7_B*(q*omegaD-one)-omegaD*feq7_B*(q-one))/(omegaD-one)+f7_T*q)/(q+one);//f7_T - feq7_T + feqW7_B; + //} + + //////////////////////////////////////////////////////////////////////////// + ////ohne Q's + //real /*feq,*/ q; + //q = q_dirE[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[2])[kw]=f7_W - feq7_W + feqW7_E; + //} + + //q = q_dirW[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[1])[ke]=f7_E - feq7_E + feqW7_W; + //} + + //q = q_dirN[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[4])[ks]=f7_S - feq7_S + feqW7_N; + //} + + //q = q_dirS[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[3])[kn]=f7_N - feq7_N + feqW7_S; + //} + + //q = q_dirT[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[6])[kb]=f7_B - feq7_B + feqW7_T; + //} + + //q = q_dirB[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[5])[kt]=f7_T - feq7_T + feqW7_B; + //} + + ////////////////////////////////////////////////////////////////////////// + //ohne Q's aber mit TRT + real /*feq,*/ q; + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[2])[kw]= -f7_W + cs2 * TempD; + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[1])[ke]= -f7_E + cs2 * TempD; + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[4])[ks]= -f7_S + cs2 * TempD; + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[3])[kn]= -f7_N + cs2 * TempD; + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[6])[kb]= -f7_B + cs2 * TempD; + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[5])[kt]= -f7_T + cs2 * TempD; + } + + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QADVeloIncomp27( + real* DD, + real* DD27, + real* temp, + real* velo, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + + Distributions27 D27; + if (isEvenTimestep==true) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + //////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, + *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + *q_dirBSE, *q_dirBNW; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + //unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + real f_W = (D.f[DIR_P00 ])[ke ]; + real f_E = (D.f[DIR_M00 ])[kw ]; + real f_S = (D.f[DIR_0P0 ])[kn ]; + real f_N = (D.f[DIR_0M0 ])[ks ]; + real f_B = (D.f[DIR_00P ])[kt ]; + real f_T = (D.f[DIR_00M ])[kb ]; + real f_SW = (D.f[DIR_PP0 ])[kne ]; + real f_NE = (D.f[DIR_MM0 ])[ksw ]; + real f_NW = (D.f[DIR_PM0 ])[kse ]; + real f_SE = (D.f[DIR_MP0 ])[knw ]; + real f_BW = (D.f[DIR_P0P ])[kte ]; + real f_TE = (D.f[DIR_M0M ])[kbw ]; + real f_TW = (D.f[DIR_P0M ])[kbe ]; + real f_BE = (D.f[DIR_M0P ])[ktw ]; + real f_BS = (D.f[DIR_0PP ])[ktn ]; + real f_TN = (D.f[DIR_0MM ])[kbs ]; + real f_TS = (D.f[DIR_0PM ])[kbn ]; + real f_BN = (D.f[DIR_0MP ])[kts ]; + //real f_ZERO = (D.f[DIR_000])[kzero]; + real f_BSW = (D.f[DIR_PPP ])[ktne ]; + real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + real f_BNW = (D.f[DIR_PMP ])[ktse ]; + real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + real f_TSW = (D.f[DIR_PPM ])[kbne ]; + real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + real f_TNW = (D.f[DIR_PMM ])[kbse ]; + real f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + //////////////////////////////////////////////////////////////////////////////// + //real f27_W = (D27.f[DIR_P00 ])[ke ]; + //real f27_E = (D27.f[DIR_M00 ])[kw ]; + //real f27_S = (D27.f[DIR_0P0 ])[kn ]; + //real f27_N = (D27.f[DIR_0M0 ])[ks ]; + //real f27_B = (D27.f[DIR_00P ])[kt ]; + //real f27_T = (D27.f[DIR_00M ])[kb ]; + //real f27_SW = (D27.f[DIR_PP0 ])[kne ]; + //real f27_NE = (D27.f[DIR_MM0 ])[ksw ]; + //real f27_NW = (D27.f[DIR_PM0 ])[kse ]; + //real f27_SE = (D27.f[DIR_MP0 ])[knw ]; + //real f27_BW = (D27.f[DIR_P0P ])[kte ]; + //real f27_TE = (D27.f[DIR_M0M ])[kbw ]; + //real f27_TW = (D27.f[DIR_P0M ])[kbe ]; + //real f27_BE = (D27.f[DIR_M0P ])[ktw ]; + //real f27_BS = (D27.f[DIR_0PP ])[ktn ]; + //real f27_TN = (D27.f[DIR_0MM ])[kbs ]; + //real f27_TS = (D27.f[DIR_0PM ])[kbn ]; + //real f27_BN = (D27.f[DIR_0MP ])[kts ]; + //real f27_ZERO = (D27.f[DIR_000])[kzero]; + //real f27_BSW = (D27.f[DIR_PPP ])[ktne ]; + //real f27_BNE = (D27.f[DIR_MMP ])[ktsw ]; + //real f27_BNW = (D27.f[DIR_PMP ])[ktse ]; + //real f27_BSE = (D27.f[DIR_MPP ])[ktnw ]; + //real f27_TSW = (D27.f[DIR_PPM ])[kbne ]; + //real f27_TNE = (D27.f[DIR_MMM ])[kbsw ]; + //real f27_TNW = (D27.f[DIR_PMM ])[kbse ]; + //real f27_TSE = (D27.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); + //////////////////////////////////////////////////////////////////////////////// + //real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + + // f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + + // f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; + + //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); + //real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + //real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + //real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + //real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + //real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + //real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + //real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + //real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + //real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + //real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + //real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + //real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + //real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + //real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + //real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + //real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + //real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + //real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + //real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + //real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + //real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + //real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + //real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + //real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + //real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + //real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real TempD = temp[k]; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // velocity inflow + vx1 = velo[k];//zero; + vx2 = c0o1;//velo[k]; + vx3 = c0o1; + + //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); + real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real omegaD = c3o1 - sqrt(c3o1); + //real Lam = -(c1o2-one/omegaD); + //real nue_d = Lam/three; + //real ae = zero; + //real ae = diffusivity/nue_d - one; + + + ////////////////////////////////////////////////////////////////////////// + if (isEvenTimestep==false) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Test + //(D.f[DIR_000])[k]=c1o10; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real q; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M00 ])[kw ]= -feqW27_W + c2o1 * c2o27 * TempD; + q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P00 ])[ke ]= -feqW27_E + c2o1 * c2o27 * TempD; + q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0M0 ])[ks ]= -feqW27_S + c2o1 * c2o27 * TempD; + q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0P0 ])[kn ]= -feqW27_N + c2o1 * c2o27 * TempD; + q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00M ])[kb ]= -feqW27_B + c2o1 * c2o27 * TempD; + q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00P ])[kt ]= -feqW27_T + c2o1 * c2o27 * TempD; + q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MM0 ])[ksw ]= -feqW27_SW + c2o1 * c1o54 * TempD; + q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PP0 ])[kne ]= -feqW27_NE + c2o1 * c1o54 * TempD; + q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MP0 ])[knw ]= -feqW27_NW + c2o1 * c1o54 * TempD; + q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PM0 ])[kse ]= -feqW27_SE + c2o1 * c1o54 * TempD; + q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0M ])[kbw ]= -feqW27_BW + c2o1 * c1o54 * TempD; + q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0P ])[kte ]= -feqW27_TE + c2o1 * c1o54 * TempD; + q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0P ])[ktw ]= -feqW27_TW + c2o1 * c1o54 * TempD; + q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0M ])[kbe ]= -feqW27_BE + c2o1 * c1o54 * TempD; + q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MM ])[kbs ]= -feqW27_BS + c2o1 * c1o54 * TempD; + q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PP ])[ktn ]= -feqW27_TN + c2o1 * c1o54 * TempD; + q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MP ])[kts ]= -feqW27_TS + c2o1 * c1o54 * TempD; + q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PM ])[kbn ]= -feqW27_BN + c2o1 * c1o54 * TempD; + q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMM])[kbsw]= -feqW27_BSW+ c2o1 * c1o216 * TempD; + q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPP])[ktne]= -feqW27_TNE+ c2o1 * c1o216 * TempD; + q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMP])[ktsw]= -feqW27_TSW+ c2o1 * c1o216 * TempD; + q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPM])[kbne]= -feqW27_BNE+ c2o1 * c1o216 * TempD; + q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPM])[kbnw]= -feqW27_BNW+ c2o1 * c1o216 * TempD; + q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMP])[ktse]= -feqW27_TSE+ c2o1 * c1o216 * TempD; + q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPP])[ktnw]= -feqW27_TNW+ c2o1 * c1o216 * TempD; + q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMM])[kbse]= -feqW27_BSE+ c2o1 * c1o216 * TempD; + //q = q_dirE[k]; if (q>=zero && q<=one) (D27.f[DIR_M00 ])[kw ]=(two*feqW27_W -(f27_E *(q*omegaD-one)-omegaD*feq27_E *(q-one))/(omegaD-one)+f27_W *q)/(q+one); + //q = q_dirW[k]; if (q>=zero && q<=one) (D27.f[DIR_P00 ])[ke ]=(two*feqW27_E -(f27_W *(q*omegaD-one)-omegaD*feq27_W *(q-one))/(omegaD-one)+f27_E *q)/(q+one); + //q = q_dirN[k]; if (q>=zero && q<=one) (D27.f[DIR_0M0 ])[ks ]=(two*feqW27_S -(f27_N *(q*omegaD-one)-omegaD*feq27_N *(q-one))/(omegaD-one)+f27_S *q)/(q+one); + //q = q_dirS[k]; if (q>=zero && q<=one) (D27.f[DIR_0P0 ])[kn ]=(two*feqW27_N -(f27_S *(q*omegaD-one)-omegaD*feq27_S *(q-one))/(omegaD-one)+f27_N *q)/(q+one); + //q = q_dirT[k]; if (q>=zero && q<=one) (D27.f[DIR_00M ])[kb ]=(two*feqW27_B -(f27_T *(q*omegaD-one)-omegaD*feq27_T *(q-one))/(omegaD-one)+f27_B *q)/(q+one); + //q = q_dirB[k]; if (q>=zero && q<=one) (D27.f[DIR_00P ])[kt ]=(two*feqW27_T -(f27_B *(q*omegaD-one)-omegaD*feq27_B *(q-one))/(omegaD-one)+f27_T *q)/(q+one); + //q = q_dirNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MM0 ])[ksw ]=(two*feqW27_SW -(f27_NE *(q*omegaD-one)-omegaD*feq27_NE *(q-one))/(omegaD-one)+f27_SW *q)/(q+one); + //q = q_dirSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PP0 ])[kne ]=(two*feqW27_NE -(f27_SW *(q*omegaD-one)-omegaD*feq27_SW *(q-one))/(omegaD-one)+f27_NE *q)/(q+one); + //q = q_dirSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MP0 ])[knw ]=(two*feqW27_NW -(f27_SE *(q*omegaD-one)-omegaD*feq27_SE *(q-one))/(omegaD-one)+f27_NW *q)/(q+one); + //q = q_dirNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PM0 ])[kse ]=(two*feqW27_SE -(f27_NW *(q*omegaD-one)-omegaD*feq27_NW *(q-one))/(omegaD-one)+f27_SE *q)/(q+one); + //q = q_dirTE[k]; if (q>=zero && q<=one) (D27.f[DIR_M0M ])[kbw ]=(two*feqW27_BW -(f27_TE *(q*omegaD-one)-omegaD*feq27_TE *(q-one))/(omegaD-one)+f27_BW *q)/(q+one); + //q = q_dirBW[k]; if (q>=zero && q<=one) (D27.f[DIR_P0P ])[kte ]=(two*feqW27_TE -(f27_BW *(q*omegaD-one)-omegaD*feq27_BW *(q-one))/(omegaD-one)+f27_TE *q)/(q+one); + //q = q_dirBE[k]; if (q>=zero && q<=one) (D27.f[DIR_M0P ])[ktw ]=(two*feqW27_TW -(f27_BE *(q*omegaD-one)-omegaD*feq27_BE *(q-one))/(omegaD-one)+f27_TW *q)/(q+one); + //q = q_dirTW[k]; if (q>=zero && q<=one) (D27.f[DIR_P0M ])[kbe ]=(two*feqW27_BE -(f27_TW *(q*omegaD-one)-omegaD*feq27_TW *(q-one))/(omegaD-one)+f27_BE *q)/(q+one); + //q = q_dirTN[k]; if (q>=zero && q<=one) (D27.f[DIR_0MM ])[kbs ]=(two*feqW27_BS -(f27_TN *(q*omegaD-one)-omegaD*feq27_TN *(q-one))/(omegaD-one)+f27_BS *q)/(q+one); + //q = q_dirBS[k]; if (q>=zero && q<=one) (D27.f[DIR_0PP ])[ktn ]=(two*feqW27_TN -(f27_BS *(q*omegaD-one)-omegaD*feq27_BS *(q-one))/(omegaD-one)+f27_TN *q)/(q+one); + //q = q_dirBN[k]; if (q>=zero && q<=one) (D27.f[DIR_0MP ])[kts ]=(two*feqW27_TS -(f27_BN *(q*omegaD-one)-omegaD*feq27_BN *(q-one))/(omegaD-one)+f27_TS *q)/(q+one); + //q = q_dirTS[k]; if (q>=zero && q<=one) (D27.f[DIR_0PM ])[kbn ]=(two*feqW27_BN -(f27_TS *(q*omegaD-one)-omegaD*feq27_TS *(q-one))/(omegaD-one)+f27_BN *q)/(q+one); + //q = q_dirTNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MMM])[kbsw]=(two*feqW27_BSW-(f27_TNE*(q*omegaD-one)-omegaD*feq27_TNE*(q-one))/(omegaD-one)+f27_BSW*q)/(q+one); + //q = q_dirBSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PPP])[ktne]=(two*feqW27_TNE-(f27_BSW*(q*omegaD-one)-omegaD*feq27_BSW*(q-one))/(omegaD-one)+f27_TNE*q)/(q+one); + //q = q_dirBNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MMP])[ktsw]=(two*feqW27_TSW-(f27_BNE*(q*omegaD-one)-omegaD*feq27_BNE*(q-one))/(omegaD-one)+f27_TSW*q)/(q+one); + //q = q_dirTSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PPM])[kbne]=(two*feqW27_BNE-(f27_TSW*(q*omegaD-one)-omegaD*feq27_TSW*(q-one))/(omegaD-one)+f27_BNE*q)/(q+one); + //q = q_dirTSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MPM])[kbnw]=(two*feqW27_BNW-(f27_TSE*(q*omegaD-one)-omegaD*feq27_TSE*(q-one))/(omegaD-one)+f27_BNW*q)/(q+one); + //q = q_dirBNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PMP])[ktse]=(two*feqW27_TSE-(f27_BNW*(q*omegaD-one)-omegaD*feq27_BNW*(q-one))/(omegaD-one)+f27_TSE*q)/(q+one); + //q = q_dirBSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MPP])[ktnw]=(two*feqW27_TNW-(f27_BSE*(q*omegaD-one)-omegaD*feq27_BSE*(q-one))/(omegaD-one)+f27_TNW*q)/(q+one); + //q = q_dirTNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PMM])[kbse]=(two*feqW27_BSE-(f27_TNW*(q*omegaD-one)-omegaD*feq27_TNW*(q-one))/(omegaD-one)+f27_BSE*q)/(q+one); + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QADPressIncomp7( real* DD, + real* DD7, + real* temp, + real* velo, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + /* Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + }*/ + + Distributions7 D7; + if (isEvenTimestep==true) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfBCnodes) + { + ////////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB; + + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + ////////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + //unsigned int ksw = neighborY[kw]; + //unsigned int kne = KQK; + //unsigned int kse = ks; + //unsigned int knw = kw; + //unsigned int kbw = neighborZ[kw]; + //unsigned int kte = KQK; + //unsigned int kbe = kb; + //unsigned int ktw = kw; + //unsigned int kbs = neighborZ[ks]; + //unsigned int ktn = KQK; + //unsigned int kbn = kb; + //unsigned int kts = ks; + //unsigned int ktse = ks; + //unsigned int kbnw = kbw; + //unsigned int ktnw = kw; + //unsigned int kbse = kbs; + //unsigned int ktsw = ksw; + //unsigned int kbne = kb; + //unsigned int ktne = KQK; + //unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + /* real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, + f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; + + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ];*/ + //////////////////////////////////////////////////////////////////////////////// + //real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + //real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + //real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + ////d�rrrrrty !!!!!!!!!!!!! + // real vx1 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + // real vx2 = ten * ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + // real vx3 = ten * ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + + //real cu_sq =1.5*(vx1*vx1+vx2*vx2+vx3*vx3); + //real ux_sq = vx1 * vx1; + //real uy_sq = vx2 * vx2; + //real uz_sq = vx3 * vx3; + ////////////////////////////////////////////////////////////////////////// + //BGK + //real omegaD = three - sqrt(three); + //real Lam = -(c1o2-one/omegaD); + //real nue_d = Lam/three; + ////real ae = zero; + //real ae = diffusivity/nue_d - one; + + real f7_ZERO,f7_E,f7_W,f7_N,f7_S,f7_T,f7_B; + //real /*feq7_ZERO,*/feq7_E,feq7_W,feq7_N,feq7_S,feq7_T,feq7_B; + //real /*feqW7_ZERO,*/feqW7_E,feqW7_W,feqW7_N,feqW7_S,feqW7_T,feqW7_B; + //real TempD = temp[k]; + + + f7_ZERO = (D7.f[0])[kzero]; + f7_W = (D7.f[1])[ke ]; + f7_E = (D7.f[2])[kw ]; + f7_S = (D7.f[3])[kn ]; + f7_N = (D7.f[4])[ks ]; + f7_B = (D7.f[5])[kt ]; + f7_T = (D7.f[6])[kb ]; + + real ConcD = f7_ZERO + f7_E + f7_W + f7_N + f7_S + f7_T + f7_B; + + ////feq7_ZERO = ConcD*(c1o3*(ae*(-3.0))-(ux_sq+uy_sq+uz_sq)); + //feq7_E = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)+vx1*c1o2); + //feq7_W = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)-vx1*c1o2); + //feq7_N = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)+vx2*c1o2); + //feq7_S = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)-vx2*c1o2); + //feq7_T = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)+vx3*c1o2); + //feq7_B = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)-vx3*c1o2); + + ////feq7_ZERO = TempD*(c1o3*(ae*(-3.0f))-(ux_sq+uy_sq+uz_sq)); + //feqW7_E = feq7_E;// TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)+vx1_Inflow*c1o2); + //feqW7_W = feq7_W;// TempD*(c1o6*(ae+one)+c1o2*(ux_sq_Inflow)-vx1_Inflow*c1o2); + //feqW7_N = feq7_N;// TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)+vx2_Inflow*c1o2); + //feqW7_S = feq7_S;// TempD*(c1o6*(ae+one)+c1o2*(uy_sq_Inflow)-vx2_Inflow*c1o2); + //feqW7_T = feq7_T;// TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)+vx3_Inflow*c1o2); + //feqW7_B = feq7_B;// TempD*(c1o6*(ae+one)+c1o2*(uz_sq_Inflow)-vx3_Inflow*c1o2); + + ////////////////////////////////////////////////////////////////////////// + //TRT Yoshida Kernel - based on Ying + real cs2 = c1o4; + real Lam = diffusivity/(c1o1)/cs2; + //real omegaD = - c1o1 / (Lam + c1o2); + real nue_d = Lam/c3o1; + + ////////////////////////////////////////////////////////////////////////// + //pointertausch + if (isEvenTimestep==false) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + + //////////////////////////////////////////////////////////////////////////// + ////mit Q's + //real /*feq,*/ q; + //q = q_dirE[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[2])[kw]=(two*feqW7_W-(f7_E*(q*omegaD-one)-omegaD*feq7_E*(q-one))/(omegaD-one)+f7_W*q)/(q+one);//f7_W - feq7_W + feqW7_E; + //} + + //q = q_dirW[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[1])[ke]=(two*feqW7_E-(f7_W*(q*omegaD-one)-omegaD*feq7_W*(q-one))/(omegaD-one)+f7_E*q)/(q+one);//f7_E - feq7_E + feqW7_W; + //} + + //q = q_dirN[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[4])[ks]=(two*feqW7_S-(f7_N*(q*omegaD-1.)-omegaD*feq7_N*(q-one))/(omegaD-one)+f7_S*q)/(q+one);//f7_S - feq7_S + feqW7_N; + //} + + //q = q_dirS[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[3])[kn]=(two*feqW7_N-(f7_S*(q*omegaD-one)-omegaD*feq7_S*(q-one))/(omegaD-one)+f7_N*q)/(q+one);//f7_N - feq7_N + feqW7_S; + //} + + //q = q_dirT[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[6])[kb]=(two*feqW7_B-(f7_T*(q*omegaD-1.)-omegaD*feq7_T*(q-one))/(omegaD-one)+f7_B*q)/(q+one);//f7_B - feq7_B + feqW7_T; + //} + + //q = q_dirB[k]; + //if (q>=zero && q<=one) + //{ + // //q=0.; + // (D7.f[5])[kt]=(two*feqW7_T-(f7_B*(q*omegaD-one)-omegaD*feq7_B*(q-one))/(omegaD-one)+f7_T*q)/(q+one);//f7_T - feq7_T + feqW7_B; + //} + + //////////////////////////////////////////////////////////////////////////// + ////ohne Q's + //real /*feq,*/ q; + //q = q_dirE[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[2])[kw]= 0.1;//test + // //(D7.f[2])[kw]=f7_W - feq7_W + feqW7_E; + //} + + //q = q_dirW[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[1])[ke]= 0.1;//test + // //(D7.f[1])[ke]=f7_E - feq7_E + feqW7_W; + //} + + //q = q_dirN[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[4])[ks]= 0.1;//test + // //(D7.f[4])[ks]=f7_S - feq7_S + feqW7_N; + //} + + //q = q_dirS[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[3])[kn]= 0.1;//test + // //(D7.f[3])[kn]=f7_N - feq7_N + feqW7_S; + //} + + //q = q_dirT[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[6])[kb]= 0.1;//test + // //(D7.f[6])[kb]=f7_B - feq7_B + feqW7_T; + //} + + //q = q_dirB[k]; + //if (q>=zero && q<=one) + //{ + // (D7.f[5])[kt]= 0.1;//test + // //(D7.f[5])[kt]=f7_T - feq7_T + feqW7_B; + //} + + + ////////////////////////////////////////////////////////////////////////// + //ohne Q's aber mit TRT + real /*feq,*/ q; + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[2])[kw]= f7_W + nue_d * ConcD; + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[1])[ke]= f7_E + nue_d * ConcD; + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[4])[ks]= f7_S + nue_d * ConcD; + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[3])[kn]= f7_N + nue_d * ConcD; + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[6])[kb]= f7_B + nue_d * ConcD; + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + (D7.f[5])[kt]= f7_T + nue_d * ConcD; + } + + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +////////////////////////////////////////////////////////////////////////////// +__global__ void QADPressIncomp27( + real* DD, + real* DD27, + real* temp, + real* velo, + real diffusivity, + int* k_Q, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + + Distributions27 D27; + if (isEvenTimestep==true) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k < numberOfBCnodes) + { + //////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, + *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + *q_dirBSE, *q_dirBNW; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + //unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + real f_W = (D.f[DIR_P00 ])[ke ]; + real f_E = (D.f[DIR_M00 ])[kw ]; + real f_S = (D.f[DIR_0P0 ])[kn ]; + real f_N = (D.f[DIR_0M0 ])[ks ]; + real f_B = (D.f[DIR_00P ])[kt ]; + real f_T = (D.f[DIR_00M ])[kb ]; + real f_SW = (D.f[DIR_PP0 ])[kne ]; + real f_NE = (D.f[DIR_MM0 ])[ksw ]; + real f_NW = (D.f[DIR_PM0 ])[kse ]; + real f_SE = (D.f[DIR_MP0 ])[knw ]; + real f_BW = (D.f[DIR_P0P ])[kte ]; + real f_TE = (D.f[DIR_M0M ])[kbw ]; + real f_TW = (D.f[DIR_P0M ])[kbe ]; + real f_BE = (D.f[DIR_M0P ])[ktw ]; + real f_BS = (D.f[DIR_0PP ])[ktn ]; + real f_TN = (D.f[DIR_0MM ])[kbs ]; + real f_TS = (D.f[DIR_0PM ])[kbn ]; + real f_BN = (D.f[DIR_0MP ])[kts ]; + //real f_ZERO = (D.f[DIR_000])[kzero]; + real f_BSW = (D.f[DIR_PPP ])[ktne ]; + real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + real f_BNW = (D.f[DIR_PMP ])[ktse ]; + real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + real f_TSW = (D.f[DIR_PPM ])[kbne ]; + real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + real f_TNW = (D.f[DIR_PMM ])[kbse ]; + real f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real vx1 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_TSE-f_BNW)+(f_BSE-f_TNW) +(f_NE-f_SW)+(f_SE-f_NW)+(f_TE-f_BW)+(f_BE-f_TW)+(f_E-f_W)); + real vx2 = ((f_TNE-f_BSW)+(f_BNE-f_TSW)+(f_BNW-f_TSE)+(f_TNW-f_BSE) +(f_NE-f_SW)+(f_NW-f_SE)+(f_TN-f_BS)+(f_BN-f_TS)+(f_N-f_S)); + real vx3 = ((f_TNE-f_BSW)+(f_TSW-f_BNE)+(f_TSE-f_BNW)+(f_TNW-f_BSE) +(f_TE-f_BW)+(f_TW-f_BE)+(f_TN-f_BS)+(f_TS-f_BN)+(f_T-f_B)); + //////////////////////////////////////////////////////////////////////////////// + //real f27_W = (D27.f[DIR_P00 ])[ke ]; + //real f27_E = (D27.f[DIR_M00 ])[kw ]; + //real f27_S = (D27.f[DIR_0P0 ])[kn ]; + //real f27_N = (D27.f[DIR_0M0 ])[ks ]; + //real f27_B = (D27.f[DIR_00P ])[kt ]; + //real f27_T = (D27.f[DIR_00M ])[kb ]; + //real f27_SW = (D27.f[DIR_PP0 ])[kne ]; + //real f27_NE = (D27.f[DIR_MM0 ])[ksw ]; + //real f27_NW = (D27.f[DIR_PM0 ])[kse ]; + //real f27_SE = (D27.f[DIR_MP0 ])[knw ]; + //real f27_BW = (D27.f[DIR_P0P ])[kte ]; + //real f27_TE = (D27.f[DIR_M0M ])[kbw ]; + //real f27_TW = (D27.f[DIR_P0M ])[kbe ]; + //real f27_BE = (D27.f[DIR_M0P ])[ktw ]; + //real f27_BS = (D27.f[DIR_0PP ])[ktn ]; + //real f27_TN = (D27.f[DIR_0MM ])[kbs ]; + //real f27_TS = (D27.f[DIR_0PM ])[kbn ]; + //real f27_BN = (D27.f[DIR_0MP ])[kts ]; + //real f27_ZERO = (D27.f[DIR_000])[kzero]; + //real f27_BSW = (D27.f[DIR_PPP ])[ktne ]; + //real f27_BNE = (D27.f[DIR_MMP ])[ktsw ]; + //real f27_BNW = (D27.f[DIR_PMP ])[ktse ]; + //real f27_BSE = (D27.f[DIR_MPP ])[ktnw ]; + //real f27_TSW = (D27.f[DIR_PPM ])[kbne ]; + //real f27_TNE = (D27.f[DIR_MMM ])[kbsw ]; + //real f27_TNW = (D27.f[DIR_PMM ])[kbse ]; + //real f27_TSE = (D27.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// + real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); + //////////////////////////////////////////////////////////////////////////////// + //real ConcD = f27_TSE + f27_TNW + f27_TNE + f27_TSW + f27_BSE + f27_BNW + f27_BNE + f27_BSW + + //f27_BN + f27_TS + f27_TN + f27_BS + f27_BE + f27_TW + f27_TE + f27_BW + f27_SE + f27_NW + f27_NE + f27_SW + + //f27_T + f27_B + f27_N + f27_S + f27_E + f27_W + f27_ZERO; + + //real feq27_ZERO = c8over27* ConcD*(one-cu_sq); + /*real feq27_E = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + real feq27_W = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + real feq27_N = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + real feq27_S = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + real feq27_T = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + real feq27_B = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + real feq27_NE = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + real feq27_SW = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + real feq27_SE = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + real feq27_NW = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + real feq27_TE = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + real feq27_BW = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + real feq27_BE = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + real feq27_TW = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + real feq27_TN = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + real feq27_BS = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + real feq27_BN = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + real feq27_TS = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + real feq27_TNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + real feq27_BSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + real feq27_BNE = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + real feq27_TSW = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + real feq27_TSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + real feq27_BNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + real feq27_BSE = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + real feq27_TNW = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq);*/ + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real TempD = temp[k]; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // velocity inflow + //vx1 = zero; + //vx2 = zero; + //vx3 = velo[k]; + + //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); + real feqW27_E = c2o27* TempD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); //feq27_E ;// + real feqW27_W = c2o27* TempD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); //feq27_W ;// + real feqW27_N = c2o27* TempD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); //feq27_N ;// + real feqW27_S = c2o27* TempD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); //feq27_S ;// + real feqW27_T = c2o27* TempD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); //feq27_T ;// + real feqW27_B = c2o27* TempD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); //feq27_B ;// + real feqW27_NE = c1o54* TempD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); //feq27_NE ;// + real feqW27_SW = c1o54* TempD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); //feq27_SW ;// + real feqW27_SE = c1o54* TempD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); //feq27_SE ;// + real feqW27_NW = c1o54* TempD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); //feq27_NW ;// + real feqW27_TE = c1o54* TempD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); //feq27_TE ;// + real feqW27_BW = c1o54* TempD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); //feq27_BW ;// + real feqW27_BE = c1o54* TempD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); //feq27_BE ;// + real feqW27_TW = c1o54* TempD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); //feq27_TW ;// + real feqW27_TN = c1o54* TempD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); //feq27_TN ;// + real feqW27_BS = c1o54* TempD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); //feq27_BS ;// + real feqW27_BN = c1o54* TempD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); //feq27_BN ;// + real feqW27_TS = c1o54* TempD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); //feq27_TS ;// + real feqW27_TNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); //feq27_TNE;// + real feqW27_BSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); //feq27_BSW;// + real feqW27_BNE = c1o216*TempD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); //feq27_BNE;// + real feqW27_TSW = c1o216*TempD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); //feq27_TSW;// + real feqW27_TSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); //feq27_TSE;// + real feqW27_BNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); //feq27_BNW;// + real feqW27_BSE = c1o216*TempD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); //feq27_BSE;// + real feqW27_TNW = c1o216*TempD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); //feq27_TNW;// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real omegaD = c3o1 - sqrt(c3o1); + //real Lam = -(c1o2-one/omegaD); + //real nue_d = Lam/three; + //real ae = zero; + //real ae = diffusivity/nue_d - one; + + + ////////////////////////////////////////////////////////////////////////// + if (isEvenTimestep==false) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Test + //(D.f[DIR_000])[k]=c1o10; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real q; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M00 ])[kw ]= -feqW27_W + c2o1 * c2o27 * TempD; + q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P00 ])[ke ]= -feqW27_E + c2o1 * c2o27 * TempD; + q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0M0 ])[ks ]= -feqW27_S + c2o1 * c2o27 * TempD; + q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0P0 ])[kn ]= -feqW27_N + c2o1 * c2o27 * TempD; + q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00M ])[kb ]= -feqW27_B + c2o1 * c2o27 * TempD; + q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_00P ])[kt ]= -feqW27_T + c2o1 * c2o27 * TempD; + q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MM0 ])[ksw ]= -feqW27_SW + c2o1 * c1o54 * TempD; + q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PP0 ])[kne ]= -feqW27_NE + c2o1 * c1o54 * TempD; + q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MP0 ])[knw ]= -feqW27_NW + c2o1 * c1o54 * TempD; + q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PM0 ])[kse ]= -feqW27_SE + c2o1 * c1o54 * TempD; + q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0M ])[kbw ]= -feqW27_BW + c2o1 * c1o54 * TempD; + q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0P ])[kte ]= -feqW27_TE + c2o1 * c1o54 * TempD; + q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_M0P ])[ktw ]= -feqW27_TW + c2o1 * c1o54 * TempD; + q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_P0M ])[kbe ]= -feqW27_BE + c2o1 * c1o54 * TempD; + q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MM ])[kbs ]= -feqW27_BS + c2o1 * c1o54 * TempD; + q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PP ])[ktn ]= -feqW27_TN + c2o1 * c1o54 * TempD; + q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0MP ])[kts ]= -feqW27_TS + c2o1 * c1o54 * TempD; + q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_0PM ])[kbn ]= -feqW27_BN + c2o1 * c1o54 * TempD; + q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMM])[kbsw]= -feqW27_BSW+ c2o1 * c1o216 * TempD; + q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPP])[ktne]= -feqW27_TNE+ c2o1 * c1o216 * TempD; + q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MMP])[ktsw]= -feqW27_TSW+ c2o1 * c1o216 * TempD; + q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PPM])[kbne]= -feqW27_BNE+ c2o1 * c1o216 * TempD; + q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPM])[kbnw]= -feqW27_BNW+ c2o1 * c1o216 * TempD; + q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMP])[ktse]= -feqW27_TSE+ c2o1 * c1o216 * TempD; + q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_MPP])[ktnw]= -feqW27_TNW+ c2o1 * c1o216 * TempD; + q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D27.f[DIR_PMM])[kbse]= -feqW27_BSE+ c2o1 * c1o216 * TempD; + //q = q_dirE[k]; if (q>=zero && q<=one) (D27.f[DIR_M00 ])[kw ]=(two*feqW27_W -(f27_E *(q*omegaD-one)-omegaD*feq27_E *(q-one))/(omegaD-one)+f27_W *q)/(q+one); + //q = q_dirW[k]; if (q>=zero && q<=one) (D27.f[DIR_P00 ])[ke ]=(two*feqW27_E -(f27_W *(q*omegaD-one)-omegaD*feq27_W *(q-one))/(omegaD-one)+f27_E *q)/(q+one); + //q = q_dirN[k]; if (q>=zero && q<=one) (D27.f[DIR_0M0 ])[ks ]=(two*feqW27_S -(f27_N *(q*omegaD-one)-omegaD*feq27_N *(q-one))/(omegaD-one)+f27_S *q)/(q+one); + //q = q_dirS[k]; if (q>=zero && q<=one) (D27.f[DIR_0P0 ])[kn ]=(two*feqW27_N -(f27_S *(q*omegaD-one)-omegaD*feq27_S *(q-one))/(omegaD-one)+f27_N *q)/(q+one); + //q = q_dirT[k]; if (q>=zero && q<=one) (D27.f[DIR_00M ])[kb ]=(two*feqW27_B -(f27_T *(q*omegaD-one)-omegaD*feq27_T *(q-one))/(omegaD-one)+f27_B *q)/(q+one); + //q = q_dirB[k]; if (q>=zero && q<=one) (D27.f[DIR_00P ])[kt ]=(two*feqW27_T -(f27_B *(q*omegaD-one)-omegaD*feq27_B *(q-one))/(omegaD-one)+f27_T *q)/(q+one); + //q = q_dirNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MM0 ])[ksw ]=(two*feqW27_SW -(f27_NE *(q*omegaD-one)-omegaD*feq27_NE *(q-one))/(omegaD-one)+f27_SW *q)/(q+one); + //q = q_dirSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PP0 ])[kne ]=(two*feqW27_NE -(f27_SW *(q*omegaD-one)-omegaD*feq27_SW *(q-one))/(omegaD-one)+f27_NE *q)/(q+one); + //q = q_dirSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MP0 ])[knw ]=(two*feqW27_NW -(f27_SE *(q*omegaD-one)-omegaD*feq27_SE *(q-one))/(omegaD-one)+f27_NW *q)/(q+one); + //q = q_dirNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PM0 ])[kse ]=(two*feqW27_SE -(f27_NW *(q*omegaD-one)-omegaD*feq27_NW *(q-one))/(omegaD-one)+f27_SE *q)/(q+one); + //q = q_dirTE[k]; if (q>=zero && q<=one) (D27.f[DIR_M0M ])[kbw ]=(two*feqW27_BW -(f27_TE *(q*omegaD-one)-omegaD*feq27_TE *(q-one))/(omegaD-one)+f27_BW *q)/(q+one); + //q = q_dirBW[k]; if (q>=zero && q<=one) (D27.f[DIR_P0P ])[kte ]=(two*feqW27_TE -(f27_BW *(q*omegaD-one)-omegaD*feq27_BW *(q-one))/(omegaD-one)+f27_TE *q)/(q+one); + //q = q_dirBE[k]; if (q>=zero && q<=one) (D27.f[DIR_M0P ])[ktw ]=(two*feqW27_TW -(f27_BE *(q*omegaD-one)-omegaD*feq27_BE *(q-one))/(omegaD-one)+f27_TW *q)/(q+one); + //q = q_dirTW[k]; if (q>=zero && q<=one) (D27.f[DIR_P0M ])[kbe ]=(two*feqW27_BE -(f27_TW *(q*omegaD-one)-omegaD*feq27_TW *(q-one))/(omegaD-one)+f27_BE *q)/(q+one); + //q = q_dirTN[k]; if (q>=zero && q<=one) (D27.f[DIR_0MM ])[kbs ]=(two*feqW27_BS -(f27_TN *(q*omegaD-one)-omegaD*feq27_TN *(q-one))/(omegaD-one)+f27_BS *q)/(q+one); + //q = q_dirBS[k]; if (q>=zero && q<=one) (D27.f[DIR_0PP ])[ktn ]=(two*feqW27_TN -(f27_BS *(q*omegaD-one)-omegaD*feq27_BS *(q-one))/(omegaD-one)+f27_TN *q)/(q+one); + //q = q_dirBN[k]; if (q>=zero && q<=one) (D27.f[DIR_0MP ])[kts ]=(two*feqW27_TS -(f27_BN *(q*omegaD-one)-omegaD*feq27_BN *(q-one))/(omegaD-one)+f27_TS *q)/(q+one); + //q = q_dirTS[k]; if (q>=zero && q<=one) (D27.f[DIR_0PM ])[kbn ]=(two*feqW27_BN -(f27_TS *(q*omegaD-one)-omegaD*feq27_TS *(q-one))/(omegaD-one)+f27_BN *q)/(q+one); + //q = q_dirTNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MMM])[kbsw]=(two*feqW27_BSW-(f27_TNE*(q*omegaD-one)-omegaD*feq27_TNE*(q-one))/(omegaD-one)+f27_BSW*q)/(q+one); + //q = q_dirBSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PPP])[ktne]=(two*feqW27_TNE-(f27_BSW*(q*omegaD-one)-omegaD*feq27_BSW*(q-one))/(omegaD-one)+f27_TNE*q)/(q+one); + //q = q_dirBNE[k]; if (q>=zero && q<=one) (D27.f[DIR_MMP])[ktsw]=(two*feqW27_TSW-(f27_BNE*(q*omegaD-one)-omegaD*feq27_BNE*(q-one))/(omegaD-one)+f27_TSW*q)/(q+one); + //q = q_dirTSW[k]; if (q>=zero && q<=one) (D27.f[DIR_PPM])[kbne]=(two*feqW27_BNE-(f27_TSW*(q*omegaD-one)-omegaD*feq27_TSW*(q-one))/(omegaD-one)+f27_BNE*q)/(q+one); + //q = q_dirTSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MPM])[kbnw]=(two*feqW27_BNW-(f27_TSE*(q*omegaD-one)-omegaD*feq27_TSE*(q-one))/(omegaD-one)+f27_BNW*q)/(q+one); + //q = q_dirBNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PMP])[ktse]=(two*feqW27_TSE-(f27_BNW*(q*omegaD-one)-omegaD*feq27_BNW*(q-one))/(omegaD-one)+f27_TSE*q)/(q+one); + //q = q_dirBSE[k]; if (q>=zero && q<=one) (D27.f[DIR_MPP])[ktnw]=(two*feqW27_TNW-(f27_BSE*(q*omegaD-one)-omegaD*feq27_BSE*(q-one))/(omegaD-one)+f27_TNW*q)/(q+one); + //q = q_dirTNW[k]; if (q>=zero && q<=one) (D27.f[DIR_PMM])[kbse]=(two*feqW27_BSE-(f27_TNW*(q*omegaD-one)-omegaD*feq27_TNW*(q-one))/(omegaD-one)+f27_BSE*q)/(q+one); + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////// +inline __device__ real calcDistributionBC_AD_interpol(real q, real weight, real v, real v_sq, real f, real finf, real omegaDiffusivity, real jTangential, real concentration) { + real feq = weight * concentration * (c1o1 + c3o1 * v + c9o2 * v * v * concentration - v_sq * concentration); + return (c1o1 - q) / (c1o1 + q) * ((f - feq * omegaDiffusivity) / (c1o1 - omegaDiffusivity)) + (q * (f + finf) - c6o1 * weight * (jTangential)) / (c1o1 + q); +} +//////////////////////////////////////////////////////////////////////////////// +inline __device__ real calcDistributionBC_AD(real q, real weight, real v, real v_sq, real f, real finf, real omegaDiffusivity, real jTangential, real concentration) { + return f - c6o1 * weight * jTangential; +} + + +// has to be excecuted before Fluid BCs +////////////////////////////////////////////////////////////////////////////// +__global__ void AD_SlipVelDeviceComp( + real *normalX, + real *normalY, + real *normalZ, + real *distributions, + real *distributionsAD, + int *QindexArray, + real *Qarrays, + uint numberOfBCnodes, + real omegaDiffusivity, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + uint size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep) + { + D.f[DIR_P00 ] = &distributions[DIR_P00 * size_Mat]; + D.f[DIR_M00 ] = &distributions[DIR_M00 * size_Mat]; + D.f[DIR_0P0 ] = &distributions[DIR_0P0 * size_Mat]; + D.f[DIR_0M0 ] = &distributions[DIR_0M0 * size_Mat]; + D.f[DIR_00P ] = &distributions[DIR_00P * size_Mat]; + D.f[DIR_00M ] = &distributions[DIR_00M * size_Mat]; + D.f[DIR_PP0 ] = &distributions[DIR_PP0 * size_Mat]; + D.f[DIR_MM0 ] = &distributions[DIR_MM0 * size_Mat]; + D.f[DIR_PM0 ] = &distributions[DIR_PM0 * size_Mat]; + D.f[DIR_MP0 ] = &distributions[DIR_MP0 * size_Mat]; + D.f[DIR_P0P ] = &distributions[DIR_P0P * size_Mat]; + D.f[DIR_M0M ] = &distributions[DIR_M0M * size_Mat]; + D.f[DIR_P0M ] = &distributions[DIR_P0M * size_Mat]; + D.f[DIR_M0P ] = &distributions[DIR_M0P * size_Mat]; + D.f[DIR_0PP ] = &distributions[DIR_0PP * size_Mat]; + D.f[DIR_0MM ] = &distributions[DIR_0MM * size_Mat]; + D.f[DIR_0PM ] = &distributions[DIR_0PM * size_Mat]; + D.f[DIR_0MP ] = &distributions[DIR_0MP * size_Mat]; + D.f[DIR_000] = &distributions[DIR_000 * size_Mat]; + D.f[DIR_PPP ] = &distributions[DIR_PPP * size_Mat]; + D.f[DIR_MMP ] = &distributions[DIR_MMP * size_Mat]; + D.f[DIR_PMP ] = &distributions[DIR_PMP * size_Mat]; + D.f[DIR_MPP ] = &distributions[DIR_MPP * size_Mat]; + D.f[DIR_PPM ] = &distributions[DIR_PPM * size_Mat]; + D.f[DIR_MMM ] = &distributions[DIR_MMM * size_Mat]; + D.f[DIR_PMM ] = &distributions[DIR_PMM * size_Mat]; + D.f[DIR_MPM ] = &distributions[DIR_MPM * size_Mat]; + } + else + { + D.f[DIR_M00 ] = &distributions[DIR_P00 * size_Mat]; + D.f[DIR_P00 ] = &distributions[DIR_M00 * size_Mat]; + D.f[DIR_0M0 ] = &distributions[DIR_0P0 * size_Mat]; + D.f[DIR_0P0 ] = &distributions[DIR_0M0 * size_Mat]; + D.f[DIR_00M ] = &distributions[DIR_00P * size_Mat]; + D.f[DIR_00P ] = &distributions[DIR_00M * size_Mat]; + D.f[DIR_MM0 ] = &distributions[DIR_PP0 * size_Mat]; + D.f[DIR_PP0 ] = &distributions[DIR_MM0 * size_Mat]; + D.f[DIR_MP0 ] = &distributions[DIR_PM0 * size_Mat]; + D.f[DIR_PM0 ] = &distributions[DIR_MP0 * size_Mat]; + D.f[DIR_M0M ] = &distributions[DIR_P0P * size_Mat]; + D.f[DIR_P0P ] = &distributions[DIR_M0M * size_Mat]; + D.f[DIR_M0P ] = &distributions[DIR_P0M * size_Mat]; + D.f[DIR_P0M ] = &distributions[DIR_M0P * size_Mat]; + D.f[DIR_0MM ] = &distributions[DIR_0PP * size_Mat]; + D.f[DIR_0PP ] = &distributions[DIR_0MM * size_Mat]; + D.f[DIR_0MP ] = &distributions[DIR_0PM * size_Mat]; + D.f[DIR_0PM ] = &distributions[DIR_0MP * size_Mat]; + D.f[DIR_000] = &distributions[DIR_000 * size_Mat]; + D.f[DIR_PPP ] = &distributions[DIR_MMM * size_Mat]; + D.f[DIR_MMP ] = &distributions[DIR_PPM * size_Mat]; + D.f[DIR_PMP ] = &distributions[DIR_MPM * size_Mat]; + D.f[DIR_MPP ] = &distributions[DIR_PMM * size_Mat]; + D.f[DIR_PPM ] = &distributions[DIR_MMP * size_Mat]; + D.f[DIR_MMM ] = &distributions[DIR_PPP * size_Mat]; + D.f[DIR_PMM ] = &distributions[DIR_MPP * size_Mat]; + D.f[DIR_MPM ] = &distributions[DIR_PMP * size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + Distributions27 DAD; + if (isEvenTimestep) + { + DAD.f[DIR_P00 ] = &distributionsAD[DIR_P00 * size_Mat]; + DAD.f[DIR_M00 ] = &distributionsAD[DIR_M00 * size_Mat]; + DAD.f[DIR_0P0 ] = &distributionsAD[DIR_0P0 * size_Mat]; + DAD.f[DIR_0M0 ] = &distributionsAD[DIR_0M0 * size_Mat]; + DAD.f[DIR_00P ] = &distributionsAD[DIR_00P * size_Mat]; + DAD.f[DIR_00M ] = &distributionsAD[DIR_00M * size_Mat]; + DAD.f[DIR_PP0 ] = &distributionsAD[DIR_PP0 * size_Mat]; + DAD.f[DIR_MM0 ] = &distributionsAD[DIR_MM0 * size_Mat]; + DAD.f[DIR_PM0 ] = &distributionsAD[DIR_PM0 * size_Mat]; + DAD.f[DIR_MP0 ] = &distributionsAD[DIR_MP0 * size_Mat]; + DAD.f[DIR_P0P ] = &distributionsAD[DIR_P0P * size_Mat]; + DAD.f[DIR_M0M ] = &distributionsAD[DIR_M0M * size_Mat]; + DAD.f[DIR_P0M ] = &distributionsAD[DIR_P0M * size_Mat]; + DAD.f[DIR_M0P ] = &distributionsAD[DIR_M0P * size_Mat]; + DAD.f[DIR_0PP ] = &distributionsAD[DIR_0PP * size_Mat]; + DAD.f[DIR_0MM ] = &distributionsAD[DIR_0MM * size_Mat]; + DAD.f[DIR_0PM ] = &distributionsAD[DIR_0PM * size_Mat]; + DAD.f[DIR_0MP ] = &distributionsAD[DIR_0MP * size_Mat]; + DAD.f[DIR_000] = &distributionsAD[DIR_000 * size_Mat]; + DAD.f[DIR_PPP ] = &distributionsAD[DIR_PPP * size_Mat]; + DAD.f[DIR_MMP ] = &distributionsAD[DIR_MMP * size_Mat]; + DAD.f[DIR_PMP ] = &distributionsAD[DIR_PMP * size_Mat]; + DAD.f[DIR_MPP ] = &distributionsAD[DIR_MPP * size_Mat]; + DAD.f[DIR_PPM ] = &distributionsAD[DIR_PPM * size_Mat]; + DAD.f[DIR_MMM ] = &distributionsAD[DIR_MMM * size_Mat]; + DAD.f[DIR_PMM ] = &distributionsAD[DIR_PMM * size_Mat]; + DAD.f[DIR_MPM ] = &distributionsAD[DIR_MPM * size_Mat]; + } + else + { + DAD.f[DIR_M00 ] = &distributionsAD[DIR_P00 * size_Mat]; + DAD.f[DIR_P00 ] = &distributionsAD[DIR_M00 * size_Mat]; + DAD.f[DIR_0M0 ] = &distributionsAD[DIR_0P0 * size_Mat]; + DAD.f[DIR_0P0 ] = &distributionsAD[DIR_0M0 * size_Mat]; + DAD.f[DIR_00M ] = &distributionsAD[DIR_00P * size_Mat]; + DAD.f[DIR_00P ] = &distributionsAD[DIR_00M * size_Mat]; + DAD.f[DIR_MM0 ] = &distributionsAD[DIR_PP0 * size_Mat]; + DAD.f[DIR_PP0 ] = &distributionsAD[DIR_MM0 * size_Mat]; + DAD.f[DIR_MP0 ] = &distributionsAD[DIR_PM0 * size_Mat]; + DAD.f[DIR_PM0 ] = &distributionsAD[DIR_MP0 * size_Mat]; + DAD.f[DIR_M0M ] = &distributionsAD[DIR_P0P * size_Mat]; + DAD.f[DIR_P0P ] = &distributionsAD[DIR_M0M * size_Mat]; + DAD.f[DIR_M0P ] = &distributionsAD[DIR_P0M * size_Mat]; + DAD.f[DIR_P0M ] = &distributionsAD[DIR_M0P * size_Mat]; + DAD.f[DIR_0MM ] = &distributionsAD[DIR_0PP * size_Mat]; + DAD.f[DIR_0PP ] = &distributionsAD[DIR_0MM * size_Mat]; + DAD.f[DIR_0MP ] = &distributionsAD[DIR_0PM * size_Mat]; + DAD.f[DIR_0PM ] = &distributionsAD[DIR_0MP * size_Mat]; + DAD.f[DIR_000] = &distributionsAD[DIR_000 * size_Mat]; + DAD.f[DIR_PPP ] = &distributionsAD[DIR_MMM * size_Mat]; + DAD.f[DIR_MMP ] = &distributionsAD[DIR_PPM * size_Mat]; + DAD.f[DIR_PMP ] = &distributionsAD[DIR_MPM * size_Mat]; + DAD.f[DIR_MPP ] = &distributionsAD[DIR_PMM * size_Mat]; + DAD.f[DIR_PPM ] = &distributionsAD[DIR_MMP * size_Mat]; + DAD.f[DIR_MMM ] = &distributionsAD[DIR_PPP * size_Mat]; + DAD.f[DIR_PMM ] = &distributionsAD[DIR_MPP * size_Mat]; + DAD.f[DIR_MPM ] = &distributionsAD[DIR_PMP * size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx * (ny * z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if (k < numberOfBCnodes) + { + //////////////////////////////////////////////////////////////////////////////// + real NormX = normalX[k]; + real NormY = normalY[k]; + real NormZ = normalZ[k]; + //////////////////////////////////////////////////////////////////////////////// + real* q_dirE, * q_dirW, * q_dirN, * q_dirS, * q_dirT, * q_dirB, + * q_dirNE, * q_dirSW, * q_dirSE, * q_dirNW, * q_dirTE, * q_dirBW, + * q_dirBE, * q_dirTW, * q_dirTN, * q_dirBS, * q_dirBN, * q_dirTS, + * q_dirTNE, * q_dirTSW, * q_dirTSE, * q_dirTNW, * q_dirBNE, * q_dirBSW, + * q_dirBSE, * q_dirBNW; + q_dirE = &Qarrays[DIR_P00 * numberOfBCnodes]; + q_dirW = &Qarrays[DIR_M00 * numberOfBCnodes]; + q_dirN = &Qarrays[DIR_0P0 * numberOfBCnodes]; + q_dirS = &Qarrays[DIR_0M0 * numberOfBCnodes]; + q_dirT = &Qarrays[DIR_00P * numberOfBCnodes]; + q_dirB = &Qarrays[DIR_00M * numberOfBCnodes]; + q_dirNE = &Qarrays[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &Qarrays[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &Qarrays[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &Qarrays[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &Qarrays[DIR_P0P * numberOfBCnodes]; + q_dirBW = &Qarrays[DIR_M0M * numberOfBCnodes]; + q_dirBE = &Qarrays[DIR_P0M * numberOfBCnodes]; + q_dirTW = &Qarrays[DIR_M0P * numberOfBCnodes]; + q_dirTN = &Qarrays[DIR_0PP * numberOfBCnodes]; + q_dirBS = &Qarrays[DIR_0MM * numberOfBCnodes]; + q_dirBN = &Qarrays[DIR_0PM * numberOfBCnodes]; + q_dirTS = &Qarrays[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &Qarrays[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &Qarrays[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &Qarrays[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &Qarrays[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &Qarrays[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &Qarrays[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &Qarrays[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &Qarrays[DIR_MPM * numberOfBCnodes]; + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = QindexArray[k]; + unsigned int kzero = KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, + f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; + + f_W = (D.f[DIR_P00])[ke]; + f_E = (D.f[DIR_M00])[kw]; + f_S = (D.f[DIR_0P0])[kn]; + f_N = (D.f[DIR_0M0])[ks]; + f_B = (D.f[DIR_00P])[kt]; + f_T = (D.f[DIR_00M])[kb]; + f_SW = (D.f[DIR_PP0])[kne]; + f_NE = (D.f[DIR_MM0])[ksw]; + f_NW = (D.f[DIR_PM0])[kse]; + f_SE = (D.f[DIR_MP0])[knw]; + f_BW = (D.f[DIR_P0P])[kte]; + f_TE = (D.f[DIR_M0M])[kbw]; + f_TW = (D.f[DIR_P0M])[kbe]; + f_BE = (D.f[DIR_M0P])[ktw]; + f_BS = (D.f[DIR_0PP])[ktn]; + f_TN = (D.f[DIR_0MM])[kbs]; + f_TS = (D.f[DIR_0PM])[kbn]; + f_BN = (D.f[DIR_0MP])[kts]; + f_BSW = (D.f[DIR_PPP])[ktne]; + f_BNE = (D.f[DIR_MMP])[ktsw]; + f_BNW = (D.f[DIR_PMP])[ktse]; + f_BSE = (D.f[DIR_MPP])[ktnw]; + f_TSW = (D.f[DIR_PPM])[kbne]; + f_TNE = (D.f[DIR_MMM])[kbsw]; + f_TNW = (D.f[DIR_PMM])[kbse]; + f_TSE = (D.f[DIR_MPM])[kbnw]; + //////////////////////////////////////////////////////////////////////////////// + real vx1, vx2, vx3, drho, q; + drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); + + vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) / (c1o1 + drho); + + + vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) / (c1o1 + drho); + + vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) / (c1o1 + drho); + + real cu_sq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3) * (c1o1 + drho); + + //////////////////////////////////////////////////////////////////////////////// + f_W = (DAD.f[DIR_P00])[ke]; + f_E = (DAD.f[DIR_M00])[kw]; + f_S = (DAD.f[DIR_0P0])[kn]; + f_N = (DAD.f[DIR_0M0])[ks]; + f_B = (DAD.f[DIR_00P])[kt]; + f_T = (DAD.f[DIR_00M])[kb]; + f_SW = (DAD.f[DIR_PP0])[kne]; + f_NE = (DAD.f[DIR_MM0])[ksw]; + f_NW = (DAD.f[DIR_PM0])[kse]; + f_SE = (DAD.f[DIR_MP0])[knw]; + f_BW = (DAD.f[DIR_P0P])[kte]; + f_TE = (DAD.f[DIR_M0M])[kbw]; + f_TW = (DAD.f[DIR_P0M])[kbe]; + f_BE = (DAD.f[DIR_M0P])[ktw]; + f_BS = (DAD.f[DIR_0PP])[ktn]; + f_TN = (DAD.f[DIR_0MM])[kbs]; + f_TS = (DAD.f[DIR_0PM])[kbn]; + f_BN = (DAD.f[DIR_0MP])[kts]; + f_BSW = (DAD.f[DIR_PPP])[ktne]; + f_BNE = (DAD.f[DIR_MMP])[ktsw]; + f_BNW = (DAD.f[DIR_PMP])[ktse]; + f_BSE = (DAD.f[DIR_MPP])[ktnw]; + f_TSW = (DAD.f[DIR_PPM])[kbne]; + f_TNE = (DAD.f[DIR_MMM])[kbsw]; + f_TNW = (DAD.f[DIR_PMM])[kbse]; + f_TSE = (DAD.f[DIR_MPM])[kbnw]; + ////////////////////////////////////////////////////////////////////////// + if (!isEvenTimestep) + { + DAD.f[DIR_P00 ] = &distributionsAD[DIR_P00 * size_Mat]; + DAD.f[DIR_M00 ] = &distributionsAD[DIR_M00 * size_Mat]; + DAD.f[DIR_0P0 ] = &distributionsAD[DIR_0P0 * size_Mat]; + DAD.f[DIR_0M0 ] = &distributionsAD[DIR_0M0 * size_Mat]; + DAD.f[DIR_00P ] = &distributionsAD[DIR_00P * size_Mat]; + DAD.f[DIR_00M ] = &distributionsAD[DIR_00M * size_Mat]; + DAD.f[DIR_PP0 ] = &distributionsAD[DIR_PP0 * size_Mat]; + DAD.f[DIR_MM0 ] = &distributionsAD[DIR_MM0 * size_Mat]; + DAD.f[DIR_PM0 ] = &distributionsAD[DIR_PM0 * size_Mat]; + DAD.f[DIR_MP0 ] = &distributionsAD[DIR_MP0 * size_Mat]; + DAD.f[DIR_P0P ] = &distributionsAD[DIR_P0P * size_Mat]; + DAD.f[DIR_M0M ] = &distributionsAD[DIR_M0M * size_Mat]; + DAD.f[DIR_P0M ] = &distributionsAD[DIR_P0M * size_Mat]; + DAD.f[DIR_M0P ] = &distributionsAD[DIR_M0P * size_Mat]; + DAD.f[DIR_0PP ] = &distributionsAD[DIR_0PP * size_Mat]; + DAD.f[DIR_0MM ] = &distributionsAD[DIR_0MM * size_Mat]; + DAD.f[DIR_0PM ] = &distributionsAD[DIR_0PM * size_Mat]; + DAD.f[DIR_0MP ] = &distributionsAD[DIR_0MP * size_Mat]; + DAD.f[DIR_000] = &distributionsAD[DIR_000 * size_Mat]; + DAD.f[DIR_PPP ] = &distributionsAD[DIR_PPP * size_Mat]; + DAD.f[DIR_MMP ] = &distributionsAD[DIR_MMP * size_Mat]; + DAD.f[DIR_PMP ] = &distributionsAD[DIR_PMP * size_Mat]; + DAD.f[DIR_MPP ] = &distributionsAD[DIR_MPP * size_Mat]; + DAD.f[DIR_PPM ] = &distributionsAD[DIR_PPM * size_Mat]; + DAD.f[DIR_MMM ] = &distributionsAD[DIR_MMM * size_Mat]; + DAD.f[DIR_PMM ] = &distributionsAD[DIR_PMM * size_Mat]; + DAD.f[DIR_MPM ] = &distributionsAD[DIR_MPM * size_Mat]; + } + else + { + DAD.f[DIR_M00 ] = &distributionsAD[DIR_P00 * size_Mat]; + DAD.f[DIR_P00 ] = &distributionsAD[DIR_M00 * size_Mat]; + DAD.f[DIR_0M0 ] = &distributionsAD[DIR_0P0 * size_Mat]; + DAD.f[DIR_0P0 ] = &distributionsAD[DIR_0M0 * size_Mat]; + DAD.f[DIR_00M ] = &distributionsAD[DIR_00P * size_Mat]; + DAD.f[DIR_00P ] = &distributionsAD[DIR_00M * size_Mat]; + DAD.f[DIR_MM0 ] = &distributionsAD[DIR_PP0 * size_Mat]; + DAD.f[DIR_PP0 ] = &distributionsAD[DIR_MM0 * size_Mat]; + DAD.f[DIR_MP0 ] = &distributionsAD[DIR_PM0 * size_Mat]; + DAD.f[DIR_PM0 ] = &distributionsAD[DIR_MP0 * size_Mat]; + DAD.f[DIR_M0M ] = &distributionsAD[DIR_P0P * size_Mat]; + DAD.f[DIR_P0P ] = &distributionsAD[DIR_M0M * size_Mat]; + DAD.f[DIR_M0P ] = &distributionsAD[DIR_P0M * size_Mat]; + DAD.f[DIR_P0M ] = &distributionsAD[DIR_M0P * size_Mat]; + DAD.f[DIR_0MM ] = &distributionsAD[DIR_0PP * size_Mat]; + DAD.f[DIR_0PP ] = &distributionsAD[DIR_0MM * size_Mat]; + DAD.f[DIR_0MP ] = &distributionsAD[DIR_0PM * size_Mat]; + DAD.f[DIR_0PM ] = &distributionsAD[DIR_0MP * size_Mat]; + DAD.f[DIR_000] = &distributionsAD[DIR_000 * size_Mat]; + DAD.f[DIR_PPP ] = &distributionsAD[DIR_MMM * size_Mat]; + DAD.f[DIR_MMP ] = &distributionsAD[DIR_PPM * size_Mat]; + DAD.f[DIR_PMP ] = &distributionsAD[DIR_MPM * size_Mat]; + DAD.f[DIR_MPP ] = &distributionsAD[DIR_PMM * size_Mat]; + DAD.f[DIR_PPM ] = &distributionsAD[DIR_MMP * size_Mat]; + DAD.f[DIR_MMM ] = &distributionsAD[DIR_PPP * size_Mat]; + DAD.f[DIR_PMM ] = &distributionsAD[DIR_MPP * size_Mat]; + DAD.f[DIR_MPM ] = &distributionsAD[DIR_PMP * size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real concentration = + f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); + + real jx1 = + (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) - (vx1 * concentration); + + real jx2 = + ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) - (vx2 * concentration); + + real jx3 = + (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) - (vx3 * concentration); + + //jx1 *= (c2o1 - omegaDiffusivity) / (c2o1 - c2o1 * omegaDiffusivity); + //jx2 *= (c2o1 - omegaDiffusivity) / (c2o1 - c2o1 * omegaDiffusivity); + //jx3 *= (c2o1 - omegaDiffusivity) / (c2o1 - c2o1 * omegaDiffusivity); + + real NormJ = jx1 * NormX + jx2 * NormY + jx3 * NormZ; + + real jTan1 = jx1 - NormJ * NormX; + real jTan2 = jx2 - NormJ * NormY; + real jTan3 = jx3 - NormJ * NormZ; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + q = q_dirE[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_M00 ])[kw ] = calcDistributionBC_AD(q, c2o27, vx1, cu_sq, f_E, f_W, omegaDiffusivity, jTan1, concentration); } + q = q_dirW[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_P00 ])[ke ] = calcDistributionBC_AD(q, c2o27, -vx1, cu_sq, f_W, f_E, omegaDiffusivity, -jTan1, concentration); } + q = q_dirN[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_0M0 ])[ks ] = calcDistributionBC_AD(q, c2o27, vx2, cu_sq, f_N, f_S, omegaDiffusivity, jTan2, concentration); } + q = q_dirS[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_0P0 ])[kn ] = calcDistributionBC_AD(q, c2o27, -vx2, cu_sq, f_S, f_N, omegaDiffusivity, -jTan2, concentration); } + q = q_dirT[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_00M ])[kb ] = calcDistributionBC_AD(q, c2o27, vx3, cu_sq, f_T, f_B, omegaDiffusivity, jTan3, concentration); } + q = q_dirB[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_00P ])[kt ] = calcDistributionBC_AD(q, c2o27, -vx3, cu_sq, f_B, f_T, omegaDiffusivity, -jTan3, concentration); } + q = q_dirNE[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_MM0 ])[ksw ] = calcDistributionBC_AD(q, c1o54, vx1+vx2, cu_sq, f_NE, f_SW, omegaDiffusivity, jTan1+jTan2, concentration); } + q = q_dirSW[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_PP0 ])[kne ] = calcDistributionBC_AD(q, c1o54, -vx1-vx2, cu_sq, f_SW, f_NE, omegaDiffusivity, -jTan1-jTan2, concentration); } + q = q_dirSE[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_MP0 ])[knw ] = calcDistributionBC_AD(q, c1o54, vx1-vx2, cu_sq, f_SE, f_NW, omegaDiffusivity, jTan1-jTan2, concentration); } + q = q_dirNW[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_PM0 ])[kse ] = calcDistributionBC_AD(q, c1o54, -vx1+vx2, cu_sq, f_NW, f_SE, omegaDiffusivity, -jTan1+jTan2, concentration); } + q = q_dirTE[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_M0M ])[kbw ] = calcDistributionBC_AD(q, c1o54, vx1 +vx3, cu_sq, f_TE, f_BW, omegaDiffusivity, jTan1 +jTan3, concentration); } + q = q_dirBW[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_P0P ])[kte ] = calcDistributionBC_AD(q, c1o54, -vx1 -vx3, cu_sq, f_BW, f_TE, omegaDiffusivity, -jTan1 -jTan3, concentration); } + q = q_dirBE[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_M0P ])[ktw ] = calcDistributionBC_AD(q, c1o54, vx1 -vx3, cu_sq, f_BE, f_TW, omegaDiffusivity, jTan1 -jTan3, concentration); } + q = q_dirTW[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_P0M ])[kbe ] = calcDistributionBC_AD(q, c1o54, -vx1 +vx3, cu_sq, f_TW, f_BE, omegaDiffusivity, -jTan1 +jTan3, concentration); } + q = q_dirTN[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_0MM ])[kbs ] = calcDistributionBC_AD(q, c1o54, vx2+vx3, cu_sq, f_TN, f_BS, omegaDiffusivity, jTan2+jTan3, concentration); } + q = q_dirBS[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_0PP ])[ktn ] = calcDistributionBC_AD(q, c1o54, -vx2-vx3, cu_sq, f_BS, f_TN, omegaDiffusivity, -jTan2-jTan3, concentration); } + q = q_dirBN[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_0MP ])[kts ] = calcDistributionBC_AD(q, c1o54, vx2-vx3, cu_sq, f_BN, f_TS, omegaDiffusivity, jTan2-jTan3, concentration); } + q = q_dirTS[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_0PM ])[kbn ] = calcDistributionBC_AD(q, c1o54, -vx2+vx3, cu_sq, f_TS, f_BN, omegaDiffusivity, -jTan2+jTan3, concentration); } + q = q_dirTNE[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_MMM])[kbsw] = calcDistributionBC_AD(q, c1o216, vx1+vx2+vx3, cu_sq, f_TNE, f_BSW, omegaDiffusivity, jTan1+jTan2+jTan3, concentration); } + q = q_dirBSW[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_PPP])[ktne] = calcDistributionBC_AD(q, c1o216, -vx1-vx2-vx3, cu_sq, f_BSW, f_TNE, omegaDiffusivity, -jTan1-jTan2-jTan3, concentration); } + q = q_dirBNE[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_MMP])[ktsw] = calcDistributionBC_AD(q, c1o216, vx1+vx2-vx3, cu_sq, f_BNE, f_TSW, omegaDiffusivity, jTan1+jTan2-jTan3, concentration); } + q = q_dirTSW[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_PPM])[kbne] = calcDistributionBC_AD(q, c1o216, -vx1-vx2+vx3, cu_sq, f_TSW, f_BNE, omegaDiffusivity, -jTan1-jTan2+jTan3, concentration); } + q = q_dirTSE[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_MPM])[kbnw] = calcDistributionBC_AD(q, c1o216, vx1-vx2+vx3, cu_sq, f_TSE, f_BNW, omegaDiffusivity, jTan1-jTan2+jTan3, concentration); } + q = q_dirBNW[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_PMP])[ktse] = calcDistributionBC_AD(q, c1o216, -vx1+vx2-vx3, cu_sq, f_BNW, f_TSE, omegaDiffusivity, -jTan1+jTan2-jTan3, concentration); } + q = q_dirBSE[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_MPP])[ktnw] = calcDistributionBC_AD(q, c1o216, vx1-vx2-vx3, cu_sq, f_BSE, f_TNW, omegaDiffusivity, jTan1-jTan2-jTan3, concentration); } + q = q_dirTNW[k]; if (q >= c0o1 && q <= c1o1) { (DAD.f[DIR_PMM])[kbse] = calcDistributionBC_AD(q, c1o216, -vx1+vx2+vx3, cu_sq, f_TNW, f_BSE, omegaDiffusivity, -jTan1+jTan2+jTan3, concentration); } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/GPU/CP27.cu b/src/gpu/VirtualFluids_GPU/GPU/CP27.cu index 289152f17d4d149837e1c592718b3385a7f79969..1ef111330c0d4293c14d66893847689ad8fac77f 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/CP27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/CP27.cu @@ -1,12 +1,13 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void CalcCP27(real* DD, +__global__ void CalcCP27(real* DD, int* cpIndex, int nonCp, double *cpPress, @@ -14,68 +15,68 @@ extern "C" __global__ void CalcCP27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -123,20 +124,20 @@ extern "C" __global__ void CalcCP27(real* DD, //////////////////////////////////////////////////////////////////////////////// double PressCP; - PressCP = (D.f[dirE ])[ke ]+ (D.f[dirW ])[kw ]+ - (D.f[dirN ])[kn ]+ (D.f[dirS ])[ks ]+ - (D.f[dirT ])[kt ]+ (D.f[dirB ])[kb ]+ - (D.f[dirNE ])[kne ]+ (D.f[dirSW ])[ksw ]+ - (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - (D.f[dirTE ])[kte ]+ (D.f[dirBW ])[kbw ]+ - (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - (D.f[dirTN ])[ktn ]+ (D.f[dirBS ])[kbs ]+ - (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ]+ - (D.f[dirZERO])[kzero]+ - (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]+ (D.f[dirBSW ])[kbsw]+ - (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw]; + PressCP = (D.f[DIR_P00 ])[ke ]+ (D.f[DIR_M00 ])[kw ]+ + (D.f[DIR_0P0 ])[kn ]+ (D.f[DIR_0M0 ])[ks ]+ + (D.f[DIR_00P ])[kt ]+ (D.f[DIR_00M ])[kb ]+ + (D.f[DIR_PP0 ])[kne ]+ (D.f[DIR_MM0 ])[ksw ]+ + (D.f[DIR_PM0 ])[kse ]+ (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_P0P ])[kte ]+ (D.f[DIR_M0M ])[kbw ]+ + (D.f[DIR_P0M ])[kbe ]+ (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_0PP ])[ktn ]+ (D.f[DIR_0MM ])[kbs ]+ + (D.f[DIR_0PM ])[kbn ]+ (D.f[DIR_0MP ])[kts ]+ + (D.f[DIR_000])[kzero]+ + (D.f[DIR_PPP ])[ktne]+ (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]+ (D.f[DIR_MMM ])[kbsw]+ + (D.f[DIR_PMM ])[kbse]+ (D.f[DIR_MPM ])[kbnw]; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// cpPress[k] = PressCP; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/GPU/Calc2ndMoments27.cu b/src/gpu/VirtualFluids_GPU/GPU/Calc2ndMoments27.cu index 337e518c70462fbfbc1fafcfe7a5c34186f74849..ce8fe68cd6a2e8f09f150cb0ccdec502a6278b50 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/Calc2ndMoments27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/Calc2ndMoments27.cu @@ -1,13 +1,13 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; - +using namespace vf::lbm::dir; //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalc2ndMomentsIncompSP27( real* kxyFromfcNEQ, +__global__ void LBCalc2ndMomentsIncompSP27( real* kxyFromfcNEQ, real* kyzFromfcNEQ, real* kxzFromfcNEQ, real* kxxMyyFromfcNEQ, @@ -18,68 +18,68 @@ extern "C" __global__ void LBCalc2ndMomentsIncompSP27( real* kxyFromfcNEQ, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -125,33 +125,33 @@ extern "C" __global__ void LBCalc2ndMomentsIncompSP27( real* kxyFromfcNEQ, unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////// real f_E,f_W,f_N,f_S,f_T,f_B,f_NE,f_SW,f_SE,f_NW,f_TE,f_BW,f_BE,f_TW,f_TN,f_BS,f_BN,f_TS,/*f_ZERO,*/f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_E = (D.f[dirE ])[ke ]; - f_W = (D.f[dirW ])[kw ]; - f_N = (D.f[dirN ])[kn ]; - f_S = (D.f[dirS ])[ks ]; - f_T = (D.f[dirT ])[kt ]; - f_B = (D.f[dirB ])[kb ]; - f_NE = (D.f[dirNE ])[kne ]; - f_SW = (D.f[dirSW ])[ksw ]; - f_SE = (D.f[dirSE ])[kse ]; - f_NW = (D.f[dirNW ])[knw ]; - f_TE = (D.f[dirTE ])[kte ]; - f_BW = (D.f[dirBW ])[kbw ]; - f_BE = (D.f[dirBE ])[kbe ]; - f_TW = (D.f[dirTW ])[ktw ]; - f_TN = (D.f[dirTN ])[ktn ]; - f_BS = (D.f[dirBS ])[kbs ]; - f_BN = (D.f[dirBN ])[kbn ]; - f_TS = (D.f[dirTS ])[kts ]; - //f_ZERO = (D.f[dirZERO])[kzero]; - f_TNE = (D.f[dirTNE ])[ktne ]; - f_TSW = (D.f[dirTSW ])[ktsw ]; - f_TSE = (D.f[dirTSE ])[ktse ]; - f_TNW = (D.f[dirTNW ])[ktnw ]; - f_BNE = (D.f[dirBNE ])[kbne ]; - f_BSW = (D.f[dirBSW ])[kbsw ]; - f_BSE = (D.f[dirBSE ])[kbse ]; - f_BNW = (D.f[dirBNW ])[kbnw ]; + f_E = (D.f[DIR_P00 ])[ke ]; + f_W = (D.f[DIR_M00 ])[kw ]; + f_N = (D.f[DIR_0P0 ])[kn ]; + f_S = (D.f[DIR_0M0 ])[ks ]; + f_T = (D.f[DIR_00P ])[kt ]; + f_B = (D.f[DIR_00M ])[kb ]; + f_NE = (D.f[DIR_PP0 ])[kne ]; + f_SW = (D.f[DIR_MM0 ])[ksw ]; + f_SE = (D.f[DIR_PM0 ])[kse ]; + f_NW = (D.f[DIR_MP0 ])[knw ]; + f_TE = (D.f[DIR_P0P ])[kte ]; + f_BW = (D.f[DIR_M0M ])[kbw ]; + f_BE = (D.f[DIR_P0M ])[kbe ]; + f_TW = (D.f[DIR_M0P ])[ktw ]; + f_TN = (D.f[DIR_0PP ])[ktn ]; + f_BS = (D.f[DIR_0MM ])[kbs ]; + f_BN = (D.f[DIR_0PM ])[kbn ]; + f_TS = (D.f[DIR_0MP ])[kts ]; + //f_ZERO = (D.f[DIR_000])[kzero]; + f_TNE = (D.f[DIR_PPP ])[ktne ]; + f_TSW = (D.f[DIR_MMP ])[ktsw ]; + f_TSE = (D.f[DIR_PMP ])[ktse ]; + f_TNW = (D.f[DIR_MPP ])[ktnw ]; + f_BNE = (D.f[DIR_PPM ])[kbne ]; + f_BSW = (D.f[DIR_MMM ])[kbsw ]; + f_BSE = (D.f[DIR_PMM ])[kbse ]; + f_BNW = (D.f[DIR_MPM ])[kbnw ]; ////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3; kxyFromfcNEQ[k] = c0o1; @@ -168,8 +168,8 @@ extern "C" __global__ void LBCalc2ndMomentsIncompSP27( real* kxyFromfcNEQ, kxyFromfcNEQ[k] = -c3o1 *(f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE-(vx1*vx2)); kyzFromfcNEQ[k] = -c3o1 *(f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW-(vx2*vx3)); kxzFromfcNEQ[k] = -c3o1 *(f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE-(vx1*vx3)); - kxxMyyFromfcNEQ[k] = -c3o2 * (f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE-(vx1*vx1-vx2*vx2)); //all E+W minus all N+S (no combinations of xy left) - kxxMzzFromfcNEQ[k] = -c3o2 * (f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE-(vx1*vx1-vx3*vx3)); //all E+W minus all T+B (no combinations of xz left) + kxxMyyFromfcNEQ[k] = -c3o2 * (f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE-(vx1*vx1-vx2*vx2)); //all DIR_P00+DIR_M00 minus all DIR_0P0+DIR_0M0 (no combinations of xy left) + kxxMzzFromfcNEQ[k] = -c3o2 * (f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE-(vx1*vx1-vx3*vx3)); //all DIR_P00+DIR_M00 minus all DIR_00P+DIR_00M (no combinations of xz left) } } } @@ -206,7 +206,7 @@ extern "C" __global__ void LBCalc2ndMomentsIncompSP27( real* kxyFromfcNEQ, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalc2ndMomentsCompSP27(real* kxyFromfcNEQ, +__global__ void LBCalc2ndMomentsCompSP27(real* kxyFromfcNEQ, real* kyzFromfcNEQ, real* kxzFromfcNEQ, real* kxxMyyFromfcNEQ, @@ -217,68 +217,68 @@ extern "C" __global__ void LBCalc2ndMomentsCompSP27(real* kxyFromfcNEQ, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -325,33 +325,33 @@ extern "C" __global__ void LBCalc2ndMomentsCompSP27(real* kxyFromfcNEQ, ////////////////////////////////////////////////////////////////////////// real f_ZERO; real f_E,f_W,f_N,f_S,f_T,f_B,f_NE,f_SW,f_SE,f_NW,f_TE,f_BW,f_BE,f_TW,f_TN,f_BS,f_BN,f_TS,f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_E = (D.f[dirE ])[ke ]; - f_W = (D.f[dirW ])[kw ]; - f_N = (D.f[dirN ])[kn ]; - f_S = (D.f[dirS ])[ks ]; - f_T = (D.f[dirT ])[kt ]; - f_B = (D.f[dirB ])[kb ]; - f_NE = (D.f[dirNE ])[kne ]; - f_SW = (D.f[dirSW ])[ksw ]; - f_SE = (D.f[dirSE ])[kse ]; - f_NW = (D.f[dirNW ])[knw ]; - f_TE = (D.f[dirTE ])[kte ]; - f_BW = (D.f[dirBW ])[kbw ]; - f_BE = (D.f[dirBE ])[kbe ]; - f_TW = (D.f[dirTW ])[ktw ]; - f_TN = (D.f[dirTN ])[ktn ]; - f_BS = (D.f[dirBS ])[kbs ]; - f_BN = (D.f[dirBN ])[kbn ]; - f_TS = (D.f[dirTS ])[kts ]; - f_ZERO = (D.f[dirZERO])[kzero]; - f_TNE = (D.f[dirTNE ])[ktne ]; - f_TSW = (D.f[dirTSW ])[ktsw ]; - f_TSE = (D.f[dirTSE ])[ktse ]; - f_TNW = (D.f[dirTNW ])[ktnw ]; - f_BNE = (D.f[dirBNE ])[kbne ]; - f_BSW = (D.f[dirBSW ])[kbsw ]; - f_BSE = (D.f[dirBSE ])[kbse ]; - f_BNW = (D.f[dirBNW ])[kbnw ]; + f_E = (D.f[DIR_P00 ])[ke ]; + f_W = (D.f[DIR_M00 ])[kw ]; + f_N = (D.f[DIR_0P0 ])[kn ]; + f_S = (D.f[DIR_0M0 ])[ks ]; + f_T = (D.f[DIR_00P ])[kt ]; + f_B = (D.f[DIR_00M ])[kb ]; + f_NE = (D.f[DIR_PP0 ])[kne ]; + f_SW = (D.f[DIR_MM0 ])[ksw ]; + f_SE = (D.f[DIR_PM0 ])[kse ]; + f_NW = (D.f[DIR_MP0 ])[knw ]; + f_TE = (D.f[DIR_P0P ])[kte ]; + f_BW = (D.f[DIR_M0M ])[kbw ]; + f_BE = (D.f[DIR_P0M ])[kbe ]; + f_TW = (D.f[DIR_M0P ])[ktw ]; + f_TN = (D.f[DIR_0PP ])[ktn ]; + f_BS = (D.f[DIR_0MM ])[kbs ]; + f_BN = (D.f[DIR_0PM ])[kbn ]; + f_TS = (D.f[DIR_0MP ])[kts ]; + f_ZERO = (D.f[DIR_000])[kzero]; + f_TNE = (D.f[DIR_PPP ])[ktne ]; + f_TSW = (D.f[DIR_MMP ])[ktsw ]; + f_TSE = (D.f[DIR_PMP ])[ktse ]; + f_TNW = (D.f[DIR_MPP ])[ktnw ]; + f_BNE = (D.f[DIR_PPM ])[kbne ]; + f_BSW = (D.f[DIR_MMM ])[kbsw ]; + f_BSE = (D.f[DIR_PMM ])[kbse ]; + f_BNW = (D.f[DIR_MPM ])[kbnw ]; ////////////////////////////////////////////////////////////////////////// real drho; real vx1, vx2, vx3, rho; @@ -373,8 +373,8 @@ extern "C" __global__ void LBCalc2ndMomentsCompSP27(real* kxyFromfcNEQ, kxyFromfcNEQ[k] = -c3o1 *(f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE-(vx1*vx2)); kyzFromfcNEQ[k] = -c3o1 *(f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW-(vx2*vx3)); kxzFromfcNEQ[k] = -c3o1 *(f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE-(vx1*vx3)); - kxxMyyFromfcNEQ[k] = -c3o2 * (f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE-(vx1*vx1-vx2*vx2)); //all E+W minus all N+S (no combinations of xy left) - kxxMzzFromfcNEQ[k] = -c3o2 * (f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE-(vx1*vx1-vx3*vx3)); //all E+W minus all T+B (no combinations of xz left) + kxxMyyFromfcNEQ[k] = -c3o2 * (f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE-(vx1*vx1-vx2*vx2)); //all DIR_P00+DIR_M00 minus all DIR_0P0+DIR_0M0 (no combinations of xy left) + kxxMzzFromfcNEQ[k] = -c3o2 * (f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE-(vx1*vx1-vx3*vx3)); //all DIR_P00+DIR_M00 minus all DIR_00P+DIR_00M (no combinations of xz left) } } } @@ -411,7 +411,7 @@ extern "C" __global__ void LBCalc2ndMomentsCompSP27(real* kxyFromfcNEQ, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalc3rdMomentsIncompSP27( real* CUMbbb, +__global__ void LBCalc3rdMomentsIncompSP27( real* CUMbbb, real* CUMabc, real* CUMbac, real* CUMbca, @@ -448,63 +448,63 @@ extern "C" __global__ void LBCalc3rdMomentsIncompSP27( real* CUMbbb, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -517,33 +517,33 @@ extern "C" __global__ void LBCalc3rdMomentsIncompSP27( real* CUMbbb, unsigned int kbs = neighborZ[ks]; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ]; - real mfaab = (D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ]; - real mfacb = (D.f[dirNW ])[kw ]; - real mfcbc = (D.f[dirTE ])[k ]; - real mfaba = (D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ]; - real mfabc = (D.f[dirTW ])[kw ]; - real mfbcc = (D.f[dirTN ])[k ]; - real mfbaa = (D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ]; - real mfbac = (D.f[dirTS ])[ks ]; - real mfbbb = (D.f[dirZERO])[k ]; - real mfccc = (D.f[dirTNE ])[k ]; - real mfaac = (D.f[dirTSW ])[ksw]; - real mfcac = (D.f[dirTSE ])[ks ]; - real mfacc = (D.f[dirTNW ])[kw ]; - real mfcca = (D.f[dirBNE ])[kb ]; - real mfaaa = (D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs]; - real mfaca = (D.f[dirBNW ])[kbw]; + real mfcbb = (D.f[DIR_P00 ])[k ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ]; + real mfaab = (D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ]; + real mfacb = (D.f[DIR_MP0 ])[kw ]; + real mfcbc = (D.f[DIR_P0P ])[k ]; + real mfaba = (D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ]; + real mfabc = (D.f[DIR_M0P ])[kw ]; + real mfbcc = (D.f[DIR_0PP ])[k ]; + real mfbaa = (D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ]; + real mfbac = (D.f[DIR_0MP ])[ks ]; + real mfbbb = (D.f[DIR_000])[k ]; + real mfccc = (D.f[DIR_PPP ])[k ]; + real mfaac = (D.f[DIR_MMP ])[ksw]; + real mfcac = (D.f[DIR_PMP ])[ks ]; + real mfacc = (D.f[DIR_MPP ])[kw ]; + real mfcca = (D.f[DIR_PPM ])[kb ]; + real mfaaa = (D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs]; + real mfaca = (D.f[DIR_MPM ])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real vvx =((((mfccc-mfaaa) + (mfcac-mfaca)) + ((mfcaa-mfacc) + (mfcca-mfaac))) + (((mfcba-mfabc) + (mfcbc-mfaba)) + ((mfcab-mfacb) + (mfccb-mfaab))) + @@ -845,7 +845,7 @@ extern "C" __global__ void LBCalc3rdMomentsIncompSP27( real* CUMbbb, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalc3rdMomentsCompSP27(real* CUMbbb, +__global__ void LBCalc3rdMomentsCompSP27(real* CUMbbb, real* CUMabc, real* CUMbac, real* CUMbca, @@ -882,63 +882,63 @@ extern "C" __global__ void LBCalc3rdMomentsCompSP27(real* CUMbbb, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -951,33 +951,33 @@ extern "C" __global__ void LBCalc3rdMomentsCompSP27(real* CUMbbb, unsigned int kbs = neighborZ[ks]; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ]; - real mfaab = (D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ]; - real mfacb = (D.f[dirNW ])[kw ]; - real mfcbc = (D.f[dirTE ])[k ]; - real mfaba = (D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ]; - real mfabc = (D.f[dirTW ])[kw ]; - real mfbcc = (D.f[dirTN ])[k ]; - real mfbaa = (D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ]; - real mfbac = (D.f[dirTS ])[ks ]; - real mfbbb = (D.f[dirZERO])[k ]; - real mfccc = (D.f[dirTNE ])[k ]; - real mfaac = (D.f[dirTSW ])[ksw]; - real mfcac = (D.f[dirTSE ])[ks ]; - real mfacc = (D.f[dirTNW ])[kw ]; - real mfcca = (D.f[dirBNE ])[kb ]; - real mfaaa = (D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs]; - real mfaca = (D.f[dirBNW ])[kbw]; + real mfcbb = (D.f[DIR_P00 ])[k ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ]; + real mfaab = (D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ]; + real mfacb = (D.f[DIR_MP0 ])[kw ]; + real mfcbc = (D.f[DIR_P0P ])[k ]; + real mfaba = (D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ]; + real mfabc = (D.f[DIR_M0P ])[kw ]; + real mfbcc = (D.f[DIR_0PP ])[k ]; + real mfbaa = (D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ]; + real mfbac = (D.f[DIR_0MP ])[ks ]; + real mfbbb = (D.f[DIR_000])[k ]; + real mfccc = (D.f[DIR_PPP ])[k ]; + real mfaac = (D.f[DIR_MMP ])[ksw]; + real mfcac = (D.f[DIR_PMP ])[ks ]; + real mfacc = (D.f[DIR_MPP ])[kw ]; + real mfcca = (D.f[DIR_PPM ])[kb ]; + real mfaaa = (D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs]; + real mfaca = (D.f[DIR_MPM ])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + (((mfbac+mfbca) + (mfbaa+mfbcc)) + ((mfabc+mfcba) + (mfaba+mfcbc)) + ((mfacb+mfcab) + (mfaab+mfccb))) + @@ -1283,7 +1283,7 @@ extern "C" __global__ void LBCalc3rdMomentsCompSP27(real* CUMbbb, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcHigherMomentsIncompSP27( real* CUMcbb, +__global__ void LBCalcHigherMomentsIncompSP27( real* CUMcbb, real* CUMbcb, real* CUMbbc, real* CUMcca, @@ -1323,63 +1323,63 @@ extern "C" __global__ void LBCalcHigherMomentsIncompSP27( real* CUMcbb, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -1392,33 +1392,33 @@ extern "C" __global__ void LBCalcHigherMomentsIncompSP27( real* CUMcbb, unsigned int kbs = neighborZ[ks]; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ]; - real mfaab = (D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ]; - real mfacb = (D.f[dirNW ])[kw ]; - real mfcbc = (D.f[dirTE ])[k ]; - real mfaba = (D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ]; - real mfabc = (D.f[dirTW ])[kw ]; - real mfbcc = (D.f[dirTN ])[k ]; - real mfbaa = (D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ]; - real mfbac = (D.f[dirTS ])[ks ]; - real mfbbb = (D.f[dirZERO])[k ]; - real mfccc = (D.f[dirTNE ])[k ]; - real mfaac = (D.f[dirTSW ])[ksw]; - real mfcac = (D.f[dirTSE ])[ks ]; - real mfacc = (D.f[dirTNW ])[kw ]; - real mfcca = (D.f[dirBNE ])[kb ]; - real mfaaa = (D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs]; - real mfaca = (D.f[dirBNW ])[kbw]; + real mfcbb = (D.f[DIR_P00 ])[k ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ]; + real mfaab = (D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ]; + real mfacb = (D.f[DIR_MP0 ])[kw ]; + real mfcbc = (D.f[DIR_P0P ])[k ]; + real mfaba = (D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ]; + real mfabc = (D.f[DIR_M0P ])[kw ]; + real mfbcc = (D.f[DIR_0PP ])[k ]; + real mfbaa = (D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ]; + real mfbac = (D.f[DIR_0MP ])[ks ]; + real mfbbb = (D.f[DIR_000])[k ]; + real mfccc = (D.f[DIR_PPP ])[k ]; + real mfaac = (D.f[DIR_MMP ])[ksw]; + real mfcac = (D.f[DIR_PMP ])[ks ]; + real mfacc = (D.f[DIR_MPP ])[kw ]; + real mfcca = (D.f[DIR_PPM ])[kb ]; + real mfaaa = (D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs]; + real mfaca = (D.f[DIR_MPM ])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real vvx =((((mfccc-mfaaa) + (mfcac-mfaca)) + ((mfcaa-mfacc) + (mfcca-mfaac))) + (((mfcba-mfabc) + (mfcbc-mfaba)) + ((mfcab-mfacb) + (mfccb-mfaab))) + @@ -1737,7 +1737,7 @@ extern "C" __global__ void LBCalcHigherMomentsIncompSP27( real* CUMcbb, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcHigherMomentsCompSP27( real* CUMcbb, +__global__ void LBCalcHigherMomentsCompSP27( real* CUMcbb, real* CUMbcb, real* CUMbbc, real* CUMcca, @@ -1777,63 +1777,63 @@ extern "C" __global__ void LBCalcHigherMomentsCompSP27( real* CUMcbb, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -1846,33 +1846,33 @@ extern "C" __global__ void LBCalcHigherMomentsCompSP27( real* CUMcbb, unsigned int kbs = neighborZ[ks]; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ]; - real mfaab = (D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ]; - real mfacb = (D.f[dirNW ])[kw ]; - real mfcbc = (D.f[dirTE ])[k ]; - real mfaba = (D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ]; - real mfabc = (D.f[dirTW ])[kw ]; - real mfbcc = (D.f[dirTN ])[k ]; - real mfbaa = (D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ]; - real mfbac = (D.f[dirTS ])[ks ]; - real mfbbb = (D.f[dirZERO])[k ]; - real mfccc = (D.f[dirTNE ])[k ]; - real mfaac = (D.f[dirTSW ])[ksw]; - real mfcac = (D.f[dirTSE ])[ks ]; - real mfacc = (D.f[dirTNW ])[kw ]; - real mfcca = (D.f[dirBNE ])[kb ]; - real mfaaa = (D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs]; - real mfaca = (D.f[dirBNW ])[kbw]; + real mfcbb = (D.f[DIR_P00 ])[k ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ]; + real mfaab = (D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ]; + real mfacb = (D.f[DIR_MP0 ])[kw ]; + real mfcbc = (D.f[DIR_P0P ])[k ]; + real mfaba = (D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ]; + real mfabc = (D.f[DIR_M0P ])[kw ]; + real mfbcc = (D.f[DIR_0PP ])[k ]; + real mfbaa = (D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ]; + real mfbac = (D.f[DIR_0MP ])[ks ]; + real mfbbb = (D.f[DIR_000])[k ]; + real mfccc = (D.f[DIR_PPP ])[k ]; + real mfaac = (D.f[DIR_MMP ])[ksw]; + real mfcac = (D.f[DIR_PMP ])[ks ]; + real mfacc = (D.f[DIR_MPP ])[kw ]; + real mfcca = (D.f[DIR_PPM ])[kb ]; + real mfaaa = (D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs]; + real mfaca = (D.f[DIR_MPM ])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + (((mfbac+mfbca) + (mfbaa+mfbcc)) + ((mfabc+mfcba) + (mfaba+mfcbc)) + ((mfacb+mfcab) + (mfaab+mfccb))) + @@ -2131,12 +2131,12 @@ extern "C" __global__ void LBCalcHigherMomentsCompSP27( real* CUMcbb, real OxxPyyPzz = c1o1; real omega = c1o1 / (c3o1*0.001 + c1o2); - real B = (c4o1 * omega * OxxPyyPzz * (c9o1 * omega - c16o1) - c4o1 * omega * omega - c2o1 * OxxPyyPzz * OxxPyyPzz * (c2o1 + c9o1 * omega * (omega - c2o1))) / + real DIR_00M = (c4o1 * omega * OxxPyyPzz * (c9o1 * omega - c16o1) - c4o1 * omega * omega - c2o1 * OxxPyyPzz * OxxPyyPzz * (c2o1 + c9o1 * omega * (omega - c2o1))) / (c3o1 * (omega - OxxPyyPzz) * (OxxPyyPzz * (c2o1 + c3o1 * omega) - c8o1 * omega)); - CUMbcc[k] = mfbcc - ((mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac)*(c1o1 + rho*c6o1*B / (c2o1 + c3o1 * B))) / rho; - CUMcbc[k] = mfcbc - ((mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc)*(c1o1 + rho*c6o1*B / (c2o1 + c3o1 * B))) / rho; - CUMccb[k] = mfccb - ((mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab)*(c1o1 + rho*c6o1*B / (c2o1 + c3o1 * B))) / rho; + CUMbcc[k] = mfbcc - ((mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac)*(c1o1 + rho*c6o1*DIR_00M / (c2o1 + c3o1 * DIR_00M))) / rho; + CUMcbc[k] = mfcbc - ((mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc)*(c1o1 + rho*c6o1*DIR_00M / (c2o1 + c3o1 * DIR_00M))) / rho; + CUMccb[k] = mfccb - ((mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab)*(c1o1 + rho*c6o1*DIR_00M / (c2o1 + c3o1 * DIR_00M))) / rho; //////////////////////////////////////////////////////////////////////////////////// // Cumulants diff --git a/src/gpu/VirtualFluids_GPU/GPU/CalcConc27.cu b/src/gpu/VirtualFluids_GPU/GPU/CalcConc27.cu new file mode 100644 index 0000000000000000000000000000000000000000..d246f39a030b6df0b249aee17f37b7d5258ff00d --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/CalcConc27.cu @@ -0,0 +1,712 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ \ +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file CalcConc27.cu +//! \ingroup GPU +//! \author Martin Schoenherr +//======================================================================================= +/* Device code */ +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" +#include <lbm/constants/NumericConstants.h> + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + +//////////////////////////////////////////////////////////////////////////////// +__global__ void CalcConc27( + real* concentration, + uint* typeOfGridNode, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + uint size_Mat, + real* distributionsAD, + bool isEvenTimestep) +{ + ////////////////////////////////////////////////////////////////////////// + //! The velocity boundary condition is executed in the following steps + //! + //////////////////////////////////////////////////////////////////////////////// + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // run for all indices in size_Mat and fluid nodes + if ((k < size_Mat) && (typeOfGridNode[k] == GEO_FLUID)) + { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 distAD; + if (isEvenTimestep) + { + distAD.f[DIR_P00 ] = &distributionsAD[DIR_P00 *size_Mat]; + distAD.f[DIR_M00 ] = &distributionsAD[DIR_M00 *size_Mat]; + distAD.f[DIR_0P0 ] = &distributionsAD[DIR_0P0 *size_Mat]; + distAD.f[DIR_0M0 ] = &distributionsAD[DIR_0M0 *size_Mat]; + distAD.f[DIR_00P ] = &distributionsAD[DIR_00P *size_Mat]; + distAD.f[DIR_00M ] = &distributionsAD[DIR_00M *size_Mat]; + distAD.f[DIR_PP0 ] = &distributionsAD[DIR_PP0 *size_Mat]; + distAD.f[DIR_MM0 ] = &distributionsAD[DIR_MM0 *size_Mat]; + distAD.f[DIR_PM0 ] = &distributionsAD[DIR_PM0 *size_Mat]; + distAD.f[DIR_MP0 ] = &distributionsAD[DIR_MP0 *size_Mat]; + distAD.f[DIR_P0P ] = &distributionsAD[DIR_P0P *size_Mat]; + distAD.f[DIR_M0M ] = &distributionsAD[DIR_M0M *size_Mat]; + distAD.f[DIR_P0M ] = &distributionsAD[DIR_P0M *size_Mat]; + distAD.f[DIR_M0P ] = &distributionsAD[DIR_M0P *size_Mat]; + distAD.f[DIR_0PP ] = &distributionsAD[DIR_0PP *size_Mat]; + distAD.f[DIR_0MM ] = &distributionsAD[DIR_0MM *size_Mat]; + distAD.f[DIR_0PM ] = &distributionsAD[DIR_0PM *size_Mat]; + distAD.f[DIR_0MP ] = &distributionsAD[DIR_0MP *size_Mat]; + distAD.f[DIR_000] = &distributionsAD[DIR_000*size_Mat]; + distAD.f[DIR_PPP ] = &distributionsAD[DIR_PPP *size_Mat]; + distAD.f[DIR_MMP ] = &distributionsAD[DIR_MMP *size_Mat]; + distAD.f[DIR_PMP ] = &distributionsAD[DIR_PMP *size_Mat]; + distAD.f[DIR_MPP ] = &distributionsAD[DIR_MPP *size_Mat]; + distAD.f[DIR_PPM ] = &distributionsAD[DIR_PPM *size_Mat]; + distAD.f[DIR_MMM ] = &distributionsAD[DIR_MMM *size_Mat]; + distAD.f[DIR_PMM ] = &distributionsAD[DIR_PMM *size_Mat]; + distAD.f[DIR_MPM ] = &distributionsAD[DIR_MPM *size_Mat]; + } + else + { + distAD.f[DIR_M00 ] = &distributionsAD[DIR_P00 *size_Mat]; + distAD.f[DIR_P00 ] = &distributionsAD[DIR_M00 *size_Mat]; + distAD.f[DIR_0M0 ] = &distributionsAD[DIR_0P0 *size_Mat]; + distAD.f[DIR_0P0 ] = &distributionsAD[DIR_0M0 *size_Mat]; + distAD.f[DIR_00M ] = &distributionsAD[DIR_00P *size_Mat]; + distAD.f[DIR_00P ] = &distributionsAD[DIR_00M *size_Mat]; + distAD.f[DIR_MM0 ] = &distributionsAD[DIR_PP0 *size_Mat]; + distAD.f[DIR_PP0 ] = &distributionsAD[DIR_MM0 *size_Mat]; + distAD.f[DIR_MP0 ] = &distributionsAD[DIR_PM0 *size_Mat]; + distAD.f[DIR_PM0 ] = &distributionsAD[DIR_MP0 *size_Mat]; + distAD.f[DIR_M0M ] = &distributionsAD[DIR_P0P *size_Mat]; + distAD.f[DIR_P0P ] = &distributionsAD[DIR_M0M *size_Mat]; + distAD.f[DIR_M0P ] = &distributionsAD[DIR_P0M *size_Mat]; + distAD.f[DIR_P0M ] = &distributionsAD[DIR_M0P *size_Mat]; + distAD.f[DIR_0MM ] = &distributionsAD[DIR_0PP *size_Mat]; + distAD.f[DIR_0PP ] = &distributionsAD[DIR_0MM *size_Mat]; + distAD.f[DIR_0MP ] = &distributionsAD[DIR_0PM *size_Mat]; + distAD.f[DIR_0PM ] = &distributionsAD[DIR_0MP *size_Mat]; + distAD.f[DIR_000] = &distributionsAD[DIR_000*size_Mat]; + distAD.f[DIR_PPP ] = &distributionsAD[DIR_MMM *size_Mat]; + distAD.f[DIR_MMP ] = &distributionsAD[DIR_PPM *size_Mat]; + distAD.f[DIR_PMP ] = &distributionsAD[DIR_MPM *size_Mat]; + distAD.f[DIR_MPP ] = &distributionsAD[DIR_PMM *size_Mat]; + distAD.f[DIR_PPM ] = &distributionsAD[DIR_MMP *size_Mat]; + distAD.f[DIR_MMM ] = &distributionsAD[DIR_PPP *size_Mat]; + distAD.f[DIR_PMM ] = &distributionsAD[DIR_MPP *size_Mat]; + distAD.f[DIR_MPM ] = &distributionsAD[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + //! - Set neighbor indices (necessary for indirect addressing) + //! + uint ke = k; + uint kw = neighborX[k]; + uint kn = k; + uint ks = neighborY[k]; + uint kt = k; + uint kb = neighborZ[k]; + uint ksw = neighborY[kw]; + uint kne = k; + uint kse = ks; + uint knw = kw; + uint kbw = neighborZ[kw]; + uint kte = k; + uint kbe = kb; + uint ktw = kw; + uint kbs = neighborZ[ks]; + uint ktn = k; + uint kbn = kb; + uint kts = ks; + uint ktse = ks; + uint kbnw = kbw; + uint ktnw = kw; + uint kbse = kbs; + uint ktsw = ksw; + uint kbne = kb; + uint ktne = k; + uint kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions + //! + real mfcbb = (distAD.f[DIR_P00 ])[ke ]; + real mfabb = (distAD.f[DIR_M00 ])[kw ]; + real mfbcb = (distAD.f[DIR_0P0 ])[kn ]; + real mfbab = (distAD.f[DIR_0M0 ])[ks ]; + real mfbbc = (distAD.f[DIR_00P ])[kt ]; + real mfbba = (distAD.f[DIR_00M ])[kb ]; + real mfccb = (distAD.f[DIR_PP0 ])[kne ]; + real mfaab = (distAD.f[DIR_MM0 ])[ksw ]; + real mfcab = (distAD.f[DIR_PM0 ])[kse ]; + real mfacb = (distAD.f[DIR_MP0 ])[knw ]; + real mfcbc = (distAD.f[DIR_P0P ])[kte ]; + real mfaba = (distAD.f[DIR_M0M ])[kbw ]; + real mfcba = (distAD.f[DIR_P0M ])[kbe ]; + real mfabc = (distAD.f[DIR_M0P ])[ktw ]; + real mfbcc = (distAD.f[DIR_0PP ])[ktn ]; + real mfbaa = (distAD.f[DIR_0MM ])[kbs ]; + real mfbca = (distAD.f[DIR_0PM ])[kbn ]; + real mfbac = (distAD.f[DIR_0MP ])[kts ]; + real mfbbb = (distAD.f[DIR_000])[k ]; + real mfccc = (distAD.f[DIR_PPP ])[ktne]; + real mfaac = (distAD.f[DIR_MMP ])[ktsw]; + real mfcac = (distAD.f[DIR_PMP ])[ktse]; + real mfacc = (distAD.f[DIR_MPP ])[ktnw]; + real mfcca = (distAD.f[DIR_PPM ])[kbne]; + real mfaaa = (distAD.f[DIR_MMM ])[kbsw]; + real mfcaa = (distAD.f[DIR_PMM ])[kbse]; + real mfaca = (distAD.f[DIR_MPM ])[kbnw]; + ////////////////////////////////////////////////////////////////////////// + //! - Calculate concentration using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + concentration[k] = + ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + + ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb; + + } +} + + + + + + + + + + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////// +__global__ void CalcConc7( real* Conc, + unsigned int* geoD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + real* DD7, + bool isEvenTimestep) +{ + Distributions7 D7; + if (isEvenTimestep==true) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<size_Mat) + { + ////////////////////////////////////////////////////////////////////////// + //index + unsigned int kzero= k; + unsigned int ke = k; + unsigned int kw = neighborX[k]; + unsigned int kn = k; + unsigned int ks = neighborY[k]; + unsigned int kt = k; + unsigned int kb = neighborZ[k]; + ////////////////////////////////////////////////////////////////////////// + Conc[k] = c0o1; + + if(geoD[k] == GEO_FLUID) + { + Conc[k] = (D7.f[1])[ke ]+ (D7.f[2])[kw ]+ + (D7.f[3])[kn ]+ (D7.f[4])[ks ]+ + (D7.f[5])[kt ]+ (D7.f[6])[kb ]+ + (D7.f[0])[kzero]; + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + +// DEPRECATED (2022) +////////////////////////////////////////////////////////////////////////////////// +// __global__ void LBCalcMacThS27(real* Conc, +// unsigned int* geoD, +// unsigned int* neighborX, +// unsigned int* neighborY, +// unsigned int* neighborZ, +// unsigned int size_Mat, +// real* DD27, +// bool isEvenTimestep) +// { +// Distributions27 D27; +// if (isEvenTimestep==true) +// { +// D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; +// D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; +// D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; +// D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; +// D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; +// D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; +// D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; +// D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; +// D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; +// D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; +// D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; +// D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; +// D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; +// D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; +// D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; +// D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; +// D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; +// D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; +// D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; +// D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; +// D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; +// D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; +// D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; +// D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; +// D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; +// D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; +// D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; +// } +// else +// { +// D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; +// D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; +// D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; +// D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; +// D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; +// D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; +// D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; +// D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; +// D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; +// D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; +// D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; +// D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; +// D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; +// D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; +// D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; +// D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; +// D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; +// D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; +// D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; +// D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; +// D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; +// D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; +// D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; +// D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; +// D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; +// D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; +// D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; +// } +// //////////////////////////////////////////////////////////////////////////////// +// const unsigned x = threadIdx.x; // Globaler x-Index +// const unsigned y = blockIdx.x; // Globaler y-Index +// const unsigned z = blockIdx.y; // Globaler z-Index + +// const unsigned nx = blockDim.x; +// const unsigned ny = gridDim.x; + +// const unsigned k = nx*(ny*z + y) + x; +// ////////////////////////////////////////////////////////////////////////// + +// if(k<size_Mat) +// { +// ////////////////////////////////////////////////////////////////////////// +// //index +// unsigned int kzero= k; +// unsigned int ke = k; +// unsigned int kw = neighborX[k]; +// unsigned int kn = k; +// unsigned int ks = neighborY[k]; +// unsigned int kt = k; +// unsigned int kb = neighborZ[k]; +// unsigned int ksw = neighborY[kw]; +// unsigned int kne = k; +// unsigned int kse = ks; +// unsigned int knw = kw; +// unsigned int kbw = neighborZ[kw]; +// unsigned int kte = k; +// unsigned int kbe = kb; +// unsigned int ktw = kw; +// unsigned int kbs = neighborZ[ks]; +// unsigned int ktn = k; +// unsigned int kbn = kb; +// unsigned int kts = ks; +// unsigned int ktse = ks; +// unsigned int kbnw = kbw; +// unsigned int ktnw = kw; +// unsigned int kbse = kbs; +// unsigned int ktsw = ksw; +// unsigned int kbne = kb; +// unsigned int ktne = k; +// unsigned int kbsw = neighborZ[ksw]; +// ////////////////////////////////////////////////////////////////////////// +// Conc[k] = c0o1; + +// if(geoD[k] == GEO_FLUID) +// { +// Conc[k] = (D27.f[DIR_P00 ])[ke ]+ (D27.f[DIR_M00 ])[kw ]+ +// (D27.f[DIR_0P0 ])[kn ]+ (D27.f[DIR_0M0 ])[ks ]+ +// (D27.f[DIR_00P ])[kt ]+ (D27.f[DIR_00M ])[kb ]+ +// (D27.f[DIR_PP0 ])[kne ]+ (D27.f[DIR_MM0 ])[ksw ]+ +// (D27.f[DIR_PM0 ])[kse ]+ (D27.f[DIR_MP0 ])[knw ]+ +// (D27.f[DIR_P0P ])[kte ]+ (D27.f[DIR_M0M ])[kbw ]+ +// (D27.f[DIR_P0M ])[kbe ]+ (D27.f[DIR_M0P ])[ktw ]+ +// (D27.f[DIR_0PP ])[ktn ]+ (D27.f[DIR_0MM ])[kbs ]+ +// (D27.f[DIR_0PM ])[kbn ]+ (D27.f[DIR_0MP ])[kts ]+ +// (D27.f[DIR_000])[kzero]+ +// (D27.f[DIR_PPP ])[ktne]+ (D27.f[DIR_MMP ])[ktsw]+ +// (D27.f[DIR_PMP ])[ktse]+ (D27.f[DIR_MPP ])[ktnw]+ +// (D27.f[DIR_PPM ])[kbne]+ (D27.f[DIR_MMM ])[kbsw]+ +// (D27.f[DIR_PMM ])[kbse]+ (D27.f[DIR_MPM ])[kbnw]; +// } +// } +// } + + + + + + + + + + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////// +__global__ void GetPlaneConc7(real* Conc, + int* kPC, + unsigned int numberOfPointskPC, + unsigned int* geoD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + real* DD7, + bool isEvenTimestep) +{ + Distributions7 D7; + if (isEvenTimestep==true) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfPointskPC) + { + ////////////////////////////////////////////////////////////////////////// + //index + unsigned int kzero= kPC[k]; + unsigned int ke = kzero; + unsigned int kw = neighborX[kzero]; + unsigned int kn = kzero; + unsigned int ks = neighborY[kzero]; + unsigned int kt = kzero; + unsigned int kb = neighborZ[kzero]; + ////////////////////////////////////////////////////////////////////////// + Conc[k] = c0o1; + + if(geoD[k] == GEO_FLUID) + { + Conc[k] = (D7.f[1])[ke ]+ (D7.f[2])[kw ]+ + (D7.f[3])[kn ]+ (D7.f[4])[ks ]+ + (D7.f[5])[kt ]+ (D7.f[6])[kb ]+ + (D7.f[0])[kzero]; + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////// +__global__ void GetPlaneConc27(real* Conc, + int* kPC, + unsigned int numberOfPointskPC, + unsigned int* geoD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + real* DD27, + bool isEvenTimestep) +{ + Distributions27 D27; + if (isEvenTimestep==true) + { + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; + } + else + { + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<numberOfPointskPC) + { + ////////////////////////////////////////////////////////////////////////// + //index + unsigned int kzero= kPC[k]; + unsigned int ke = kzero; + unsigned int kw = neighborX[kzero]; + unsigned int kn = kzero; + unsigned int ks = neighborY[kzero]; + unsigned int kt = kzero; + unsigned int kb = neighborZ[kzero]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = kzero; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = kzero; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = kzero; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = kzero; + unsigned int kbsw = neighborZ[ksw]; + ////////////////////////////////////////////////////////////////////////// + Conc[k] = c0o1; + + if(geoD[k] == GEO_FLUID) + { + Conc[k] = (D27.f[DIR_P00 ])[ke ]+ (D27.f[DIR_M00 ])[kw ]+ + (D27.f[DIR_0P0 ])[kn ]+ (D27.f[DIR_0M0 ])[ks ]+ + (D27.f[DIR_00P ])[kt ]+ (D27.f[DIR_00M ])[kb ]+ + (D27.f[DIR_PP0 ])[kne ]+ (D27.f[DIR_MM0 ])[ksw ]+ + (D27.f[DIR_PM0 ])[kse ]+ (D27.f[DIR_MP0 ])[knw ]+ + (D27.f[DIR_P0P ])[kte ]+ (D27.f[DIR_M0M ])[kbw ]+ + (D27.f[DIR_P0M ])[kbe ]+ (D27.f[DIR_M0P ])[ktw ]+ + (D27.f[DIR_0PP ])[ktn ]+ (D27.f[DIR_0MM ])[kbs ]+ + (D27.f[DIR_0PM ])[kbn ]+ (D27.f[DIR_0MP ])[kts ]+ + (D27.f[DIR_000])[kzero]+ + (D27.f[DIR_PPP ])[ktne]+ (D27.f[DIR_MMP ])[ktsw]+ + (D27.f[DIR_PMP ])[ktse]+ (D27.f[DIR_MPP ])[ktnw]+ + (D27.f[DIR_PPM ])[kbne]+ (D27.f[DIR_MMM ])[kbsw]+ + (D27.f[DIR_PMM ])[kbse]+ (D27.f[DIR_MPM ])[kbnw]; + } + } +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/GPU/CalcMac27.cu b/src/gpu/VirtualFluids_GPU/GPU/CalcMac27.cu index ce6e034d1c1eee57e062b736cfcea97e07306f3c..4792b8846b2612383c07a97419e0473b21ebd187 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/CalcMac27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/CalcMac27.cu @@ -7,10 +7,11 @@ ////////////////////////////////////////////////////////////////////////// /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" -#include <lbm/constants/NumericConstants.h> +#include "lbm/constants/D3Q27.h" +#include "lbm/constants/NumericConstants.h" using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "lbm/MacroscopicQuantities.h" @@ -18,7 +19,7 @@ using namespace vf::lbm::constant; //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcMac27( real* vxD, +__global__ void LBCalcMac27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -69,7 +70,7 @@ extern "C" __global__ void LBCalcMac27( real* vxD, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcMacSP27( real* vxD, +__global__ void LBCalcMacSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -80,68 +81,68 @@ extern "C" __global__ void LBCalcMacSP27( real* vxD, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -194,66 +195,66 @@ extern "C" __global__ void LBCalcMacSP27( real* vxD, if(geoD[k] == GEO_FLUID) { - rhoD[k] = (D.f[dirE ])[ke ]+ (D.f[dirW ])[kw ]+ - (D.f[dirN ])[kn ]+ (D.f[dirS ])[ks ]+ - (D.f[dirT ])[kt ]+ (D.f[dirB ])[kb ]+ - (D.f[dirNE ])[kne ]+ (D.f[dirSW ])[ksw ]+ - (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - (D.f[dirTE ])[kte ]+ (D.f[dirBW ])[kbw ]+ - (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - (D.f[dirTN ])[ktn ]+ (D.f[dirBS ])[kbs ]+ - (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ]+ - (D.f[dirZERO])[kzero]+ - (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]+ (D.f[dirBSW ])[kbsw]+ - (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw]; - - vxD[k] = (D.f[dirE ])[ke ]- (D.f[dirW ])[kw ]+ - (D.f[dirNE ])[kne ]- (D.f[dirSW ])[ksw ]+ - (D.f[dirSE ])[kse ]- (D.f[dirNW ])[knw ]+ - (D.f[dirTE ])[kte ]- (D.f[dirBW ])[kbw ]+ - (D.f[dirBE ])[kbe ]- (D.f[dirTW ])[ktw ]+ - (D.f[dirTNE ])[ktne]- (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]- (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]+ - (D.f[dirBSE ])[kbse]- (D.f[dirBNW ])[kbnw]; - - vyD[k] = (D.f[dirN ])[kn ]- (D.f[dirS ])[ks ]+ - (D.f[dirNE ])[kne ]- (D.f[dirSW ])[ksw ]- - (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - (D.f[dirTN ])[ktn ]- (D.f[dirBS ])[kbs ]+ - (D.f[dirBN ])[kbn ]- (D.f[dirTS ])[kts ]+ - (D.f[dirTNE ])[ktne]- (D.f[dirTSW ])[ktsw]- - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]- - (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw]; - - vzD[k] = (D.f[dirT ])[kt ]- (D.f[dirB ])[kb ]+ - (D.f[dirTE ])[kte ]- (D.f[dirBW ])[kbw ]- - (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - (D.f[dirTN ])[ktn ]- (D.f[dirBS ])[kbs ]- - (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ]+ - (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]- - (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]- - (D.f[dirBSE ])[kbse]- (D.f[dirBNW ])[kbnw]; - - pressD[k] = ((D.f[dirE ])[ke ]+ (D.f[dirW ])[kw ]+ - (D.f[dirN ])[kn ]+ (D.f[dirS ])[ks ]+ - (D.f[dirT ])[kt ]+ (D.f[dirB ])[kb ]+ + rhoD[k] = (D.f[DIR_P00 ])[ke ]+ (D.f[DIR_M00 ])[kw ]+ + (D.f[DIR_0P0 ])[kn ]+ (D.f[DIR_0M0 ])[ks ]+ + (D.f[DIR_00P ])[kt ]+ (D.f[DIR_00M ])[kb ]+ + (D.f[DIR_PP0 ])[kne ]+ (D.f[DIR_MM0 ])[ksw ]+ + (D.f[DIR_PM0 ])[kse ]+ (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_P0P ])[kte ]+ (D.f[DIR_M0M ])[kbw ]+ + (D.f[DIR_P0M ])[kbe ]+ (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_0PP ])[ktn ]+ (D.f[DIR_0MM ])[kbs ]+ + (D.f[DIR_0PM ])[kbn ]+ (D.f[DIR_0MP ])[kts ]+ + (D.f[DIR_000])[kzero]+ + (D.f[DIR_PPP ])[ktne]+ (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]+ (D.f[DIR_MMM ])[kbsw]+ + (D.f[DIR_PMM ])[kbse]+ (D.f[DIR_MPM ])[kbnw]; + + vxD[k] = (D.f[DIR_P00 ])[ke ]- (D.f[DIR_M00 ])[kw ]+ + (D.f[DIR_PP0 ])[kne ]- (D.f[DIR_MM0 ])[ksw ]+ + (D.f[DIR_PM0 ])[kse ]- (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_P0P ])[kte ]- (D.f[DIR_M0M ])[kbw ]+ + (D.f[DIR_P0M ])[kbe ]- (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_PPP ])[ktne]- (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]- (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]+ + (D.f[DIR_PMM ])[kbse]- (D.f[DIR_MPM ])[kbnw]; + + vyD[k] = (D.f[DIR_0P0 ])[kn ]- (D.f[DIR_0M0 ])[ks ]+ + (D.f[DIR_PP0 ])[kne ]- (D.f[DIR_MM0 ])[ksw ]- + (D.f[DIR_PM0 ])[kse ]+ (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_0PP ])[ktn ]- (D.f[DIR_0MM ])[kbs ]+ + (D.f[DIR_0PM ])[kbn ]- (D.f[DIR_0MP ])[kts ]+ + (D.f[DIR_PPP ])[ktne]- (D.f[DIR_MMP ])[ktsw]- + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]- + (D.f[DIR_PMM ])[kbse]+ (D.f[DIR_MPM ])[kbnw]; + + vzD[k] = (D.f[DIR_00P ])[kt ]- (D.f[DIR_00M ])[kb ]+ + (D.f[DIR_P0P ])[kte ]- (D.f[DIR_M0M ])[kbw ]- + (D.f[DIR_P0M ])[kbe ]+ (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_0PP ])[ktn ]- (D.f[DIR_0MM ])[kbs ]- + (D.f[DIR_0PM ])[kbn ]+ (D.f[DIR_0MP ])[kts ]+ + (D.f[DIR_PPP ])[ktne]+ (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]- + (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]- + (D.f[DIR_PMM ])[kbse]- (D.f[DIR_MPM ])[kbnw]; + + pressD[k] = ((D.f[DIR_P00 ])[ke ]+ (D.f[DIR_M00 ])[kw ]+ + (D.f[DIR_0P0 ])[kn ]+ (D.f[DIR_0M0 ])[ks ]+ + (D.f[DIR_00P ])[kt ]+ (D.f[DIR_00M ])[kb ]+ 2.f*( - (D.f[dirNE ])[kne ]+ (D.f[dirSW ])[ksw ]+ - (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - (D.f[dirTE ])[kte ]+ (D.f[dirBW ])[kbw ]+ - (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - (D.f[dirTN ])[ktn ]+ (D.f[dirBS ])[kbs ]+ - (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ])+ + (D.f[DIR_PP0 ])[kne ]+ (D.f[DIR_MM0 ])[ksw ]+ + (D.f[DIR_PM0 ])[kse ]+ (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_P0P ])[kte ]+ (D.f[DIR_M0M ])[kbw ]+ + (D.f[DIR_P0M ])[kbe ]+ (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_0PP ])[ktn ]+ (D.f[DIR_0MM ])[kbs ]+ + (D.f[DIR_0PM ])[kbn ]+ (D.f[DIR_0MP ])[kts ])+ 3.f*( - (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]+ (D.f[dirBSW ])[kbsw]+ - (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw])- + (D.f[DIR_PPP ])[ktne]+ (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]+ (D.f[DIR_MMM ])[kbsw]+ + (D.f[DIR_PMM ])[kbse]+ (D.f[DIR_MPM ])[kbnw])- rhoD[k]-(vxD[k] * vxD[k] + vyD[k] * vyD[k] + vzD[k] * vzD[k]) * (c1o1+c0o1*rhoD[k])) * c1o2+rhoD[k]; // times zero for incompressible case //achtung op hart gesetzt Annahme op = 1 ; ^^^^(1.0/op-0.5)=0.5 @@ -263,25 +264,34 @@ extern "C" __global__ void LBCalcMacSP27( real* vxD, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcMacCompSP27(real *vxD, real *vyD, real *vzD, real *rhoD, real *pressD, - unsigned int *geoD, unsigned int *neighborX, unsigned int *neighborY, - unsigned int *neighborZ, unsigned int size_Mat, real *distributions, - bool isEvenTimestep) +__global__ void LBCalcMacCompSP27( + real *vxD, + real *vyD, + real *vzD, + real *rhoD, + real *pressD, + unsigned int *geoD, + unsigned int *neighborX, + unsigned int *neighborY, + unsigned int *neighborZ, + unsigned int size_Mat, + real *distributions, + bool isEvenTimestep) { const unsigned k = vf::gpu::getNodeIndex(); if(k >= size_Mat) return; - if (!vf::gpu::isValidFluidNode(geoD[k])) - return; - pressD[k] = c0o1; rhoD[k] = c0o1; vxD[k] = c0o1; vyD[k] = c0o1; vzD[k] = c0o1; + if (!vf::gpu::isValidFluidNode(geoD[k])) + return; + vf::gpu::DistributionWrapper distr_wrapper(distributions, size_Mat, isEvenTimestep, k, neighborX, neighborY, neighborZ); const auto &distribution = distr_wrapper.distribution; @@ -293,341 +303,6 @@ extern "C" __global__ void LBCalcMacCompSP27(real *vxD, real *vyD, real *vzD, re pressD[k] = vf::lbm::getPressure(distribution.f, rhoD[k], vxD[k], vyD[k], vzD[k]); } -//////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcMacThS7( real* Conc, - unsigned int* geoD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - real* DD7, - bool evenOrOdd) -{ - Distributions7 D7; - if (evenOrOdd==true) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<size_Mat) - { - ////////////////////////////////////////////////////////////////////////// - //index - unsigned int kzero= k; - unsigned int ke = k; - unsigned int kw = neighborX[k]; - unsigned int kn = k; - unsigned int ks = neighborY[k]; - unsigned int kt = k; - unsigned int kb = neighborZ[k]; - ////////////////////////////////////////////////////////////////////////// - Conc[k] = c0o1; - - if(geoD[k] == GEO_FLUID) - { - Conc[k] = (D7.f[1])[ke ]+ (D7.f[2])[kw ]+ - (D7.f[3])[kn ]+ (D7.f[4])[ks ]+ - (D7.f[5])[kt ]+ (D7.f[6])[kb ]+ - (D7.f[0])[kzero]; - } - } -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void GetPlaneConcThS7(real* Conc, - int* kPC, - unsigned int numberOfPointskPC, - unsigned int* geoD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - real* DD7, - bool evenOrOdd) -{ - Distributions7 D7; - if (evenOrOdd==true) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<numberOfPointskPC) - { - ////////////////////////////////////////////////////////////////////////// - //index - unsigned int kzero= kPC[k]; - unsigned int ke = kzero; - unsigned int kw = neighborX[kzero]; - unsigned int kn = kzero; - unsigned int ks = neighborY[kzero]; - unsigned int kt = kzero; - unsigned int kb = neighborZ[kzero]; - ////////////////////////////////////////////////////////////////////////// - Conc[k] = c0o1; - - if(geoD[k] == GEO_FLUID) - { - Conc[k] = (D7.f[1])[ke ]+ (D7.f[2])[kw ]+ - (D7.f[3])[kn ]+ (D7.f[4])[ks ]+ - (D7.f[5])[kt ]+ (D7.f[6])[kb ]+ - (D7.f[0])[kzero]; - } - } -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void GetPlaneConcThS27(real* Conc, - int* kPC, - unsigned int numberOfPointskPC, - unsigned int* geoD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - real* DD27, - bool evenOrOdd) -{ - Distributions27 D27; - if (evenOrOdd==true) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<numberOfPointskPC) - { - ////////////////////////////////////////////////////////////////////////// - //index - unsigned int kzero= kPC[k]; - unsigned int ke = kzero; - unsigned int kw = neighborX[kzero]; - unsigned int kn = kzero; - unsigned int ks = neighborY[kzero]; - unsigned int kt = kzero; - unsigned int kb = neighborZ[kzero]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = kzero; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = kzero; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = kzero; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = kzero; - unsigned int kbsw = neighborZ[ksw]; - ////////////////////////////////////////////////////////////////////////// - Conc[k] = c0o1; - - if(geoD[k] == GEO_FLUID) - { - Conc[k] = (D27.f[dirE ])[ke ]+ (D27.f[dirW ])[kw ]+ - (D27.f[dirN ])[kn ]+ (D27.f[dirS ])[ks ]+ - (D27.f[dirT ])[kt ]+ (D27.f[dirB ])[kb ]+ - (D27.f[dirNE ])[kne ]+ (D27.f[dirSW ])[ksw ]+ - (D27.f[dirSE ])[kse ]+ (D27.f[dirNW ])[knw ]+ - (D27.f[dirTE ])[kte ]+ (D27.f[dirBW ])[kbw ]+ - (D27.f[dirBE ])[kbe ]+ (D27.f[dirTW ])[ktw ]+ - (D27.f[dirTN ])[ktn ]+ (D27.f[dirBS ])[kbs ]+ - (D27.f[dirBN ])[kbn ]+ (D27.f[dirTS ])[kts ]+ - (D27.f[dirZERO])[kzero]+ - (D27.f[dirTNE ])[ktne]+ (D27.f[dirTSW ])[ktsw]+ - (D27.f[dirTSE ])[ktse]+ (D27.f[dirTNW ])[ktnw]+ - (D27.f[dirBNE ])[kbne]+ (D27.f[dirBSW ])[kbsw]+ - (D27.f[dirBSE ])[kbse]+ (D27.f[dirBNW ])[kbnw]; - } - } -} - @@ -664,162 +339,7 @@ extern "C" __global__ void GetPlaneConcThS27(real* Conc, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcMacThS27(real* Conc, - unsigned int* geoD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - real* DD27, - bool evenOrOdd) -{ - Distributions27 D27; - if (evenOrOdd==true) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<size_Mat) - { - ////////////////////////////////////////////////////////////////////////// - //index - unsigned int kzero= k; - unsigned int ke = k; - unsigned int kw = neighborX[k]; - unsigned int kn = k; - unsigned int ks = neighborY[k]; - unsigned int kt = k; - unsigned int kb = neighborZ[k]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = k; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = k; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = k; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = k; - unsigned int kbsw = neighborZ[ksw]; - ////////////////////////////////////////////////////////////////////////// - Conc[k] = c0o1; - - if(geoD[k] == GEO_FLUID) - { - Conc[k] = (D27.f[dirE ])[ke ]+ (D27.f[dirW ])[kw ]+ - (D27.f[dirN ])[kn ]+ (D27.f[dirS ])[ks ]+ - (D27.f[dirT ])[kt ]+ (D27.f[dirB ])[kb ]+ - (D27.f[dirNE ])[kne ]+ (D27.f[dirSW ])[ksw ]+ - (D27.f[dirSE ])[kse ]+ (D27.f[dirNW ])[knw ]+ - (D27.f[dirTE ])[kte ]+ (D27.f[dirBW ])[kbw ]+ - (D27.f[dirBE ])[kbe ]+ (D27.f[dirTW ])[ktw ]+ - (D27.f[dirTN ])[ktn ]+ (D27.f[dirBS ])[kbs ]+ - (D27.f[dirBN ])[kbn ]+ (D27.f[dirTS ])[kts ]+ - (D27.f[dirZERO])[kzero]+ - (D27.f[dirTNE ])[ktne]+ (D27.f[dirTSW ])[ktsw]+ - (D27.f[dirTSE ])[ktse]+ (D27.f[dirTNW ])[ktnw]+ - (D27.f[dirBNE ])[kbne]+ (D27.f[dirBSW ])[kbsw]+ - (D27.f[dirBSE ])[kbse]+ (D27.f[dirBNW ])[kbnw]; - } - } -} - - - - - - - - - - - - - - - - - - - - -//////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcMedSP27( real* vxD, +__global__ void LBCalcMedSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -830,68 +350,68 @@ extern "C" __global__ void LBCalcMedSP27( real* vxD, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -950,70 +470,70 @@ extern "C" __global__ void LBCalcMedSP27( real* vxD, if(geoD[k] == GEO_FLUID) { - rhoD[k] = (D.f[dirE ])[ke ]+ (D.f[dirW ])[kw ]+ - (D.f[dirN ])[kn ]+ (D.f[dirS ])[ks ]+ - (D.f[dirT ])[kt ]+ (D.f[dirB ])[kb ]+ - (D.f[dirNE ])[kne ]+ (D.f[dirSW ])[ksw ]+ - (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - (D.f[dirTE ])[kte ]+ (D.f[dirBW ])[kbw ]+ - (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - (D.f[dirTN ])[ktn ]+ (D.f[dirBS ])[kbs ]+ - (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ]+ - (D.f[dirZERO])[kzero]+ - (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]+ (D.f[dirBSW ])[kbsw]+ - (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw]+ + rhoD[k] = (D.f[DIR_P00 ])[ke ]+ (D.f[DIR_M00 ])[kw ]+ + (D.f[DIR_0P0 ])[kn ]+ (D.f[DIR_0M0 ])[ks ]+ + (D.f[DIR_00P ])[kt ]+ (D.f[DIR_00M ])[kb ]+ + (D.f[DIR_PP0 ])[kne ]+ (D.f[DIR_MM0 ])[ksw ]+ + (D.f[DIR_PM0 ])[kse ]+ (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_P0P ])[kte ]+ (D.f[DIR_M0M ])[kbw ]+ + (D.f[DIR_P0M ])[kbe ]+ (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_0PP ])[ktn ]+ (D.f[DIR_0MM ])[kbs ]+ + (D.f[DIR_0PM ])[kbn ]+ (D.f[DIR_0MP ])[kts ]+ + (D.f[DIR_000])[kzero]+ + (D.f[DIR_PPP ])[ktne]+ (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]+ (D.f[DIR_MMM ])[kbsw]+ + (D.f[DIR_PMM ])[kbse]+ (D.f[DIR_MPM ])[kbnw]+ RHO; - vxD[k] = (D.f[dirE ])[ke ]- (D.f[dirW ])[kw ]+ - (D.f[dirNE ])[kne ]- (D.f[dirSW ])[ksw ]+ - (D.f[dirSE ])[kse ]- (D.f[dirNW ])[knw ]+ - (D.f[dirTE ])[kte ]- (D.f[dirBW ])[kbw ]+ - (D.f[dirBE ])[kbe ]- (D.f[dirTW ])[ktw ]+ - (D.f[dirTNE ])[ktne]- (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]- (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]+ - (D.f[dirBSE ])[kbse]- (D.f[dirBNW ])[kbnw]+ + vxD[k] = (D.f[DIR_P00 ])[ke ]- (D.f[DIR_M00 ])[kw ]+ + (D.f[DIR_PP0 ])[kne ]- (D.f[DIR_MM0 ])[ksw ]+ + (D.f[DIR_PM0 ])[kse ]- (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_P0P ])[kte ]- (D.f[DIR_M0M ])[kbw ]+ + (D.f[DIR_P0M ])[kbe ]- (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_PPP ])[ktne]- (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]- (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]+ + (D.f[DIR_PMM ])[kbse]- (D.f[DIR_MPM ])[kbnw]+ VX; - vyD[k] = (D.f[dirN ])[kn ]- (D.f[dirS ])[ks ]+ - (D.f[dirNE ])[kne ]- (D.f[dirSW ])[ksw ]- - (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - (D.f[dirTN ])[ktn ]- (D.f[dirBS ])[kbs ]+ - (D.f[dirBN ])[kbn ]- (D.f[dirTS ])[kts ]+ - (D.f[dirTNE ])[ktne]- (D.f[dirTSW ])[ktsw]- - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]- - (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw]+ + vyD[k] = (D.f[DIR_0P0 ])[kn ]- (D.f[DIR_0M0 ])[ks ]+ + (D.f[DIR_PP0 ])[kne ]- (D.f[DIR_MM0 ])[ksw ]- + (D.f[DIR_PM0 ])[kse ]+ (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_0PP ])[ktn ]- (D.f[DIR_0MM ])[kbs ]+ + (D.f[DIR_0PM ])[kbn ]- (D.f[DIR_0MP ])[kts ]+ + (D.f[DIR_PPP ])[ktne]- (D.f[DIR_MMP ])[ktsw]- + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]- + (D.f[DIR_PMM ])[kbse]+ (D.f[DIR_MPM ])[kbnw]+ VY; - vzD[k] = (D.f[dirT ])[kt ]- (D.f[dirB ])[kb ]+ - (D.f[dirTE ])[kte ]- (D.f[dirBW ])[kbw ]- - (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - (D.f[dirTN ])[ktn ]- (D.f[dirBS ])[kbs ]- - (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ]+ - (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]- - (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]- - (D.f[dirBSE ])[kbse]- (D.f[dirBNW ])[kbnw]+ + vzD[k] = (D.f[DIR_00P ])[kt ]- (D.f[DIR_00M ])[kb ]+ + (D.f[DIR_P0P ])[kte ]- (D.f[DIR_M0M ])[kbw ]- + (D.f[DIR_P0M ])[kbe ]+ (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_0PP ])[ktn ]- (D.f[DIR_0MM ])[kbs ]- + (D.f[DIR_0PM ])[kbn ]+ (D.f[DIR_0MP ])[kts ]+ + (D.f[DIR_PPP ])[ktne]+ (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]- + (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]- + (D.f[DIR_PMM ])[kbse]- (D.f[DIR_MPM ])[kbnw]+ VZ; - pressD[k] = ((D.f[dirE ])[ke ]+ (D.f[dirW ])[kw ]+ - (D.f[dirN ])[kn ]+ (D.f[dirS ])[ks ]+ - (D.f[dirT ])[kt ]+ (D.f[dirB ])[kb ]+ + pressD[k] = ((D.f[DIR_P00 ])[ke ]+ (D.f[DIR_M00 ])[kw ]+ + (D.f[DIR_0P0 ])[kn ]+ (D.f[DIR_0M0 ])[ks ]+ + (D.f[DIR_00P ])[kt ]+ (D.f[DIR_00M ])[kb ]+ c2o1*( - (D.f[dirNE ])[kne ]+ (D.f[dirSW ])[ksw ]+ - (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - (D.f[dirTE ])[kte ]+ (D.f[dirBW ])[kbw ]+ - (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - (D.f[dirTN ])[ktn ]+ (D.f[dirBS ])[kbs ]+ - (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ])+ + (D.f[DIR_PP0 ])[kne ]+ (D.f[DIR_MM0 ])[ksw ]+ + (D.f[DIR_PM0 ])[kse ]+ (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_P0P ])[kte ]+ (D.f[DIR_M0M ])[kbw ]+ + (D.f[DIR_P0M ])[kbe ]+ (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_0PP ])[ktn ]+ (D.f[DIR_0MM ])[kbs ]+ + (D.f[DIR_0PM ])[kbn ]+ (D.f[DIR_0MP ])[kts ])+ c3o1*( - (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]+ (D.f[dirBSW ])[kbsw]+ - (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw])- + (D.f[DIR_PPP ])[ktne]+ (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]+ (D.f[DIR_MMM ])[kbsw]+ + (D.f[DIR_PMM ])[kbse]+ (D.f[DIR_MPM ])[kbnw])- rhoD[k]-(vxD[k] * vxD[k] + vyD[k] * vyD[k] + vzD[k] * vzD[k]) * (c1o1+rhoD[k])) * c1o2+rhoD[k]+ PRESS; //achtung op hart gesetzt Annahme op = 1 ; ^^^^(1.0/op-0.5)=0.5 @@ -1043,7 +563,7 @@ extern "C" __global__ void LBCalcMedSP27( real* vxD, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcMedCompSP27( real* vxD, +__global__ void LBCalcMedCompSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -1054,68 +574,68 @@ extern "C" __global__ void LBCalcMedCompSP27( real* vxD, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1174,33 +694,33 @@ extern "C" __global__ void LBCalcMedCompSP27( real* vxD, if(geoD[k] == GEO_FLUID) { - real mfcbb = (D.f[dirE])[k];//[ke ]; - real mfabb = (D.f[dirW])[kw];//[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ]; - real mfbab = (D.f[dirS])[ks];//[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ]; - real mfbba = (D.f[dirB])[kb];//[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ]; - real mfaab = (D.f[dirSW])[ksw];//[ksw ]; - real mfcab = (D.f[dirSE])[ks];//[kse ]; - real mfacb = (D.f[dirNW])[kw];//[knw ]; - real mfcbc = (D.f[dirTE])[k];//[kte ]; - real mfaba = (D.f[dirBW])[kbw];//[kbw ]; - real mfcba = (D.f[dirBE])[kb];//[kbe ]; - real mfabc = (D.f[dirTW])[kw];//[ktw ]; - real mfbcc = (D.f[dirTN])[k];//[ktn ]; - real mfbaa = (D.f[dirBS])[kbs];//[kbs ]; - real mfbca = (D.f[dirBN])[kb];//[kbn ]; - real mfbac = (D.f[dirTS])[ks];//[kts ]; - real mfbbb = (D.f[dirZERO])[k];//[kzero]; - real mfccc = (D.f[dirTNE])[k];//[ktne ]; - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ]; - real mfcac = (D.f[dirTSE])[ks];//[ktse ]; - real mfacc = (D.f[dirTNW])[kw];//[ktnw ]; - real mfcca = (D.f[dirBNE])[kb];//[kbne ]; - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ]; - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ]; + real mfcbb = (D.f[DIR_P00])[k];//[ke ]; + real mfabb = (D.f[DIR_M00])[kw];//[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ]; + real mfbab = (D.f[DIR_0M0])[ks];//[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ]; + real mfbba = (D.f[DIR_00M])[kb];//[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ]; + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ]; + real mfacb = (D.f[DIR_MP0])[kw];//[knw ]; + real mfcbc = (D.f[DIR_P0P])[k];//[kte ]; + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ]; + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ]; + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ]; + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ]; + real mfbac = (D.f[DIR_0MP])[ks];//[kts ]; + real mfbbb = (D.f[DIR_000])[k];//[kzero]; + real mfccc = (D.f[DIR_PPP])[k];//[ktne ]; + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ]; + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ]; + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ]; + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ]; + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ]; + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + @@ -1225,72 +745,72 @@ extern "C" __global__ void LBCalcMedCompSP27( real* vxD, (mfbbc - mfbba)) / rho) + VZ; //rhoD[k] = - // (D.f[dirE])[ke] + (D.f[dirW])[kw] + - // (D.f[dirN])[kn] + (D.f[dirS])[ks] + - // (D.f[dirT])[kt] + (D.f[dirB])[kb] + - // (D.f[dirNE])[kne] + (D.f[dirSW])[ksw] + - // (D.f[dirSE])[kse] + (D.f[dirNW])[knw] + - // (D.f[dirTE])[kte] + (D.f[dirBW])[kbw] + - // (D.f[dirBE])[kbe] + (D.f[dirTW])[ktw] + - // (D.f[dirTN])[ktn] + (D.f[dirBS])[kbs] + - // (D.f[dirBN])[kbn] + (D.f[dirTS])[kts] + - // (D.f[dirZERO])[kzero] + - // (D.f[dirTNE])[ktne] + (D.f[dirTSW])[ktsw] + - // (D.f[dirTSE])[ktse] + (D.f[dirTNW])[ktnw] + - // (D.f[dirBNE])[kbne] + (D.f[dirBSW])[kbsw] + - // (D.f[dirBSE])[kbse] + (D.f[dirBNW])[kbnw];// +RHO; + // (D.f[DIR_P00])[ke] + (D.f[DIR_M00])[kw] + + // (D.f[DIR_0P0])[kn] + (D.f[DIR_0M0])[ks] + + // (D.f[DIR_00P])[kt] + (D.f[DIR_00M])[kb] + + // (D.f[DIR_PP0])[kne] + (D.f[DIR_MM0])[ksw] + + // (D.f[DIR_PM0])[kse] + (D.f[DIR_MP0])[knw] + + // (D.f[DIR_P0P])[kte] + (D.f[DIR_M0M])[kbw] + + // (D.f[DIR_P0M])[kbe] + (D.f[DIR_M0P])[ktw] + + // (D.f[DIR_0PP])[ktn] + (D.f[DIR_0MM])[kbs] + + // (D.f[DIR_0PM])[kbn] + (D.f[DIR_0MP])[kts] + + // (D.f[DIR_000])[kzero] + + // (D.f[DIR_PPP])[ktne] + (D.f[DIR_MMP])[ktsw] + + // (D.f[DIR_PMP])[ktse] + (D.f[DIR_MPP])[ktnw] + + // (D.f[DIR_PPM])[kbne] + (D.f[DIR_MMM])[kbsw] + + // (D.f[DIR_PMM])[kbse] + (D.f[DIR_MPM])[kbnw];// +RHO; // vxD[k] = - //((D.f[dirE ])[ke ]- (D.f[dirW ])[kw ]+ - // (D.f[dirNE ])[kne ]- (D.f[dirSW ])[ksw ]+ - // (D.f[dirSE ])[kse ]- (D.f[dirNW ])[knw ]+ - // (D.f[dirTE ])[kte ]- (D.f[dirBW ])[kbw ]+ - // (D.f[dirBE ])[kbe ]- (D.f[dirTW ])[ktw ]+ - // (D.f[dirTNE ])[ktne]- (D.f[dirTSW ])[ktsw]+ - // (D.f[dirTSE ])[ktse]- (D.f[dirTNW ])[ktnw]+ - // (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]+ - // (D.f[dirBSE ])[kbse]- (D.f[dirBNW ])[kbnw]) / (one + rhoD[k])+ + //((D.f[DIR_P00 ])[ke ]- (D.f[DIR_M00 ])[kw ]+ + // (D.f[DIR_PP0 ])[kne ]- (D.f[DIR_MM0 ])[ksw ]+ + // (D.f[DIR_PM0 ])[kse ]- (D.f[DIR_MP0 ])[knw ]+ + // (D.f[DIR_P0P ])[kte ]- (D.f[DIR_M0M ])[kbw ]+ + // (D.f[DIR_P0M ])[kbe ]- (D.f[DIR_M0P ])[ktw ]+ + // (D.f[DIR_PPP ])[ktne]- (D.f[DIR_MMP ])[ktsw]+ + // (D.f[DIR_PMP ])[ktse]- (D.f[DIR_MPP ])[ktnw]+ + // (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]+ + // (D.f[DIR_PMM ])[kbse]- (D.f[DIR_MPM ])[kbnw]) / (one + rhoD[k])+ // VX; // vyD[k] = - //((D.f[dirN ])[kn ]- (D.f[dirS ])[ks ]+ - // (D.f[dirNE ])[kne ]- (D.f[dirSW ])[ksw ]- - // (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - // (D.f[dirTN ])[ktn ]- (D.f[dirBS ])[kbs ]+ - // (D.f[dirBN ])[kbn ]- (D.f[dirTS ])[kts ]+ - // (D.f[dirTNE ])[ktne]- (D.f[dirTSW ])[ktsw]- - // (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - // (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]- - // (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw]) / (one + rhoD[k])+ + //((D.f[DIR_0P0 ])[kn ]- (D.f[DIR_0M0 ])[ks ]+ + // (D.f[DIR_PP0 ])[kne ]- (D.f[DIR_MM0 ])[ksw ]- + // (D.f[DIR_PM0 ])[kse ]+ (D.f[DIR_MP0 ])[knw ]+ + // (D.f[DIR_0PP ])[ktn ]- (D.f[DIR_0MM ])[kbs ]+ + // (D.f[DIR_0PM ])[kbn ]- (D.f[DIR_0MP ])[kts ]+ + // (D.f[DIR_PPP ])[ktne]- (D.f[DIR_MMP ])[ktsw]- + // (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]+ + // (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]- + // (D.f[DIR_PMM ])[kbse]+ (D.f[DIR_MPM ])[kbnw]) / (one + rhoD[k])+ // VY; // vzD[k] = - //((D.f[dirT ])[kt ]- (D.f[dirB ])[kb ]+ - // (D.f[dirTE ])[kte ]- (D.f[dirBW ])[kbw ]- - // (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - // (D.f[dirTN ])[ktn ]- (D.f[dirBS ])[kbs ]- - // (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ]+ - // (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - // (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]- - // (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]- - // (D.f[dirBSE ])[kbse]- (D.f[dirBNW ])[kbnw]) / (one + rhoD[k])+ + //((D.f[DIR_00P ])[kt ]- (D.f[DIR_00M ])[kb ]+ + // (D.f[DIR_P0P ])[kte ]- (D.f[DIR_M0M ])[kbw ]- + // (D.f[DIR_P0M ])[kbe ]+ (D.f[DIR_M0P ])[ktw ]+ + // (D.f[DIR_0PP ])[ktn ]- (D.f[DIR_0MM ])[kbs ]- + // (D.f[DIR_0PM ])[kbn ]+ (D.f[DIR_0MP ])[kts ]+ + // (D.f[DIR_PPP ])[ktne]+ (D.f[DIR_MMP ])[ktsw]+ + // (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]- + // (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]- + // (D.f[DIR_PMM ])[kbse]- (D.f[DIR_MPM ])[kbnw]) / (one + rhoD[k])+ // VZ; - pressD[k] = ((D.f[dirE ])[ke ]+ (D.f[dirW ])[kw ]+ - (D.f[dirN ])[kn ]+ (D.f[dirS ])[ks ]+ - (D.f[dirT ])[kt ]+ (D.f[dirB ])[kb ]+ + pressD[k] = ((D.f[DIR_P00 ])[ke ]+ (D.f[DIR_M00 ])[kw ]+ + (D.f[DIR_0P0 ])[kn ]+ (D.f[DIR_0M0 ])[ks ]+ + (D.f[DIR_00P ])[kt ]+ (D.f[DIR_00M ])[kb ]+ c2o1*( - (D.f[dirNE ])[kne ]+ (D.f[dirSW ])[ksw ]+ - (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - (D.f[dirTE ])[kte ]+ (D.f[dirBW ])[kbw ]+ - (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - (D.f[dirTN ])[ktn ]+ (D.f[dirBS ])[kbs ]+ - (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ])+ + (D.f[DIR_PP0 ])[kne ]+ (D.f[DIR_MM0 ])[ksw ]+ + (D.f[DIR_PM0 ])[kse ]+ (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_P0P ])[kte ]+ (D.f[DIR_M0M ])[kbw ]+ + (D.f[DIR_P0M ])[kbe ]+ (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_0PP ])[ktn ]+ (D.f[DIR_0MM ])[kbs ]+ + (D.f[DIR_0PM ])[kbn ]+ (D.f[DIR_0MP ])[kts ])+ c3o1*( - (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]+ (D.f[dirBSW ])[kbsw]+ - (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw])- + (D.f[DIR_PPP ])[ktne]+ (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]+ (D.f[DIR_MMM ])[kbsw]+ + (D.f[DIR_PMM ])[kbse]+ (D.f[DIR_MPM ])[kbnw])- rhoD[k]-(vxD[k] * vxD[k] + vyD[k] * vyD[k] + vzD[k] * vzD[k]) * (c1o1+rhoD[k])) * c1o2+rhoD[k]+ PRESS; //achtung op hart gesetzt Annahme op = 1 ; ^^^^(1.0/op-0.5)=0.5 @@ -1320,7 +840,7 @@ extern "C" __global__ void LBCalcMedCompSP27( real* vxD, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcMedCompAD27( +__global__ void LBCalcMedCompAD27( real* vxD, real* vyD, real* vzD, @@ -1334,130 +854,130 @@ extern "C" __global__ void LBCalcMedCompAD27( unsigned int size_Mat, real* DD, real* DD_AD, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd == true) + if (isEvenTimestep == true) { - D.f[dirE] = &DD[dirE *size_Mat]; - D.f[dirW] = &DD[dirW *size_Mat]; - D.f[dirN] = &DD[dirN *size_Mat]; - D.f[dirS] = &DD[dirS *size_Mat]; - D.f[dirT] = &DD[dirT *size_Mat]; - D.f[dirB] = &DD[dirB *size_Mat]; - D.f[dirNE] = &DD[dirNE *size_Mat]; - D.f[dirSW] = &DD[dirSW *size_Mat]; - D.f[dirSE] = &DD[dirSE *size_Mat]; - D.f[dirNW] = &DD[dirNW *size_Mat]; - D.f[dirTE] = &DD[dirTE *size_Mat]; - D.f[dirBW] = &DD[dirBW *size_Mat]; - D.f[dirBE] = &DD[dirBE *size_Mat]; - D.f[dirTW] = &DD[dirTW *size_Mat]; - D.f[dirTN] = &DD[dirTN *size_Mat]; - D.f[dirBS] = &DD[dirBS *size_Mat]; - D.f[dirBN] = &DD[dirBN *size_Mat]; - D.f[dirTS] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE] = &DD[dirTNE *size_Mat]; - D.f[dirTSW] = &DD[dirTSW *size_Mat]; - D.f[dirTSE] = &DD[dirTSE *size_Mat]; - D.f[dirTNW] = &DD[dirTNW *size_Mat]; - D.f[dirBNE] = &DD[dirBNE *size_Mat]; - D.f[dirBSW] = &DD[dirBSW *size_Mat]; - D.f[dirBSE] = &DD[dirBSE *size_Mat]; - D.f[dirBNW] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DD[dirE *size_Mat]; - D.f[dirE] = &DD[dirW *size_Mat]; - D.f[dirS] = &DD[dirN *size_Mat]; - D.f[dirN] = &DD[dirS *size_Mat]; - D.f[dirB] = &DD[dirT *size_Mat]; - D.f[dirT] = &DD[dirB *size_Mat]; - D.f[dirSW] = &DD[dirNE *size_Mat]; - D.f[dirNE] = &DD[dirSW *size_Mat]; - D.f[dirNW] = &DD[dirSE *size_Mat]; - D.f[dirSE] = &DD[dirNW *size_Mat]; - D.f[dirBW] = &DD[dirTE *size_Mat]; - D.f[dirTE] = &DD[dirBW *size_Mat]; - D.f[dirTW] = &DD[dirBE *size_Mat]; - D.f[dirBE] = &DD[dirTW *size_Mat]; - D.f[dirBS] = &DD[dirTN *size_Mat]; - D.f[dirTN] = &DD[dirBS *size_Mat]; - D.f[dirTS] = &DD[dirBN *size_Mat]; - D.f[dirBN] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE] = &DD[dirBSW *size_Mat]; - D.f[dirTSW] = &DD[dirBNE *size_Mat]; - D.f[dirTSE] = &DD[dirBNW *size_Mat]; - D.f[dirTNW] = &DD[dirBSE *size_Mat]; - D.f[dirBNE] = &DD[dirTSW *size_Mat]; - D.f[dirBSW] = &DD[dirTNE *size_Mat]; - D.f[dirBSE] = &DD[dirTNW *size_Mat]; - D.f[dirBNW] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// Distributions27 Dad; - if (evenOrOdd == true) + if (isEvenTimestep == true) { - Dad.f[dirE] = &DD_AD[dirE *size_Mat]; - Dad.f[dirW] = &DD_AD[dirW *size_Mat]; - Dad.f[dirN] = &DD_AD[dirN *size_Mat]; - Dad.f[dirS] = &DD_AD[dirS *size_Mat]; - Dad.f[dirT] = &DD_AD[dirT *size_Mat]; - Dad.f[dirB] = &DD_AD[dirB *size_Mat]; - Dad.f[dirNE] = &DD_AD[dirNE *size_Mat]; - Dad.f[dirSW] = &DD_AD[dirSW *size_Mat]; - Dad.f[dirSE] = &DD_AD[dirSE *size_Mat]; - Dad.f[dirNW] = &DD_AD[dirNW *size_Mat]; - Dad.f[dirTE] = &DD_AD[dirTE *size_Mat]; - Dad.f[dirBW] = &DD_AD[dirBW *size_Mat]; - Dad.f[dirBE] = &DD_AD[dirBE *size_Mat]; - Dad.f[dirTW] = &DD_AD[dirTW *size_Mat]; - Dad.f[dirTN] = &DD_AD[dirTN *size_Mat]; - Dad.f[dirBS] = &DD_AD[dirBS *size_Mat]; - Dad.f[dirBN] = &DD_AD[dirBN *size_Mat]; - Dad.f[dirTS] = &DD_AD[dirTS *size_Mat]; - Dad.f[dirZERO] = &DD_AD[dirZERO*size_Mat]; - Dad.f[dirTNE] = &DD_AD[dirTNE *size_Mat]; - Dad.f[dirTSW] = &DD_AD[dirTSW *size_Mat]; - Dad.f[dirTSE] = &DD_AD[dirTSE *size_Mat]; - Dad.f[dirTNW] = &DD_AD[dirTNW *size_Mat]; - Dad.f[dirBNE] = &DD_AD[dirBNE *size_Mat]; - Dad.f[dirBSW] = &DD_AD[dirBSW *size_Mat]; - Dad.f[dirBSE] = &DD_AD[dirBSE *size_Mat]; - Dad.f[dirBNW] = &DD_AD[dirBNW *size_Mat]; + Dad.f[DIR_P00] = &DD_AD[DIR_P00 *size_Mat]; + Dad.f[DIR_M00] = &DD_AD[DIR_M00 *size_Mat]; + Dad.f[DIR_0P0] = &DD_AD[DIR_0P0 *size_Mat]; + Dad.f[DIR_0M0] = &DD_AD[DIR_0M0 *size_Mat]; + Dad.f[DIR_00P] = &DD_AD[DIR_00P *size_Mat]; + Dad.f[DIR_00M] = &DD_AD[DIR_00M *size_Mat]; + Dad.f[DIR_PP0] = &DD_AD[DIR_PP0 *size_Mat]; + Dad.f[DIR_MM0] = &DD_AD[DIR_MM0 *size_Mat]; + Dad.f[DIR_PM0] = &DD_AD[DIR_PM0 *size_Mat]; + Dad.f[DIR_MP0] = &DD_AD[DIR_MP0 *size_Mat]; + Dad.f[DIR_P0P] = &DD_AD[DIR_P0P *size_Mat]; + Dad.f[DIR_M0M] = &DD_AD[DIR_M0M *size_Mat]; + Dad.f[DIR_P0M] = &DD_AD[DIR_P0M *size_Mat]; + Dad.f[DIR_M0P] = &DD_AD[DIR_M0P *size_Mat]; + Dad.f[DIR_0PP] = &DD_AD[DIR_0PP *size_Mat]; + Dad.f[DIR_0MM] = &DD_AD[DIR_0MM *size_Mat]; + Dad.f[DIR_0PM] = &DD_AD[DIR_0PM *size_Mat]; + Dad.f[DIR_0MP] = &DD_AD[DIR_0MP *size_Mat]; + Dad.f[DIR_000] = &DD_AD[DIR_000*size_Mat]; + Dad.f[DIR_PPP] = &DD_AD[DIR_PPP *size_Mat]; + Dad.f[DIR_MMP] = &DD_AD[DIR_MMP *size_Mat]; + Dad.f[DIR_PMP] = &DD_AD[DIR_PMP *size_Mat]; + Dad.f[DIR_MPP] = &DD_AD[DIR_MPP *size_Mat]; + Dad.f[DIR_PPM] = &DD_AD[DIR_PPM *size_Mat]; + Dad.f[DIR_MMM] = &DD_AD[DIR_MMM *size_Mat]; + Dad.f[DIR_PMM] = &DD_AD[DIR_PMM *size_Mat]; + Dad.f[DIR_MPM] = &DD_AD[DIR_MPM *size_Mat]; } else { - Dad.f[dirW] = &DD_AD[dirE *size_Mat]; - Dad.f[dirE] = &DD_AD[dirW *size_Mat]; - Dad.f[dirS] = &DD_AD[dirN *size_Mat]; - Dad.f[dirN] = &DD_AD[dirS *size_Mat]; - Dad.f[dirB] = &DD_AD[dirT *size_Mat]; - Dad.f[dirT] = &DD_AD[dirB *size_Mat]; - Dad.f[dirSW] = &DD_AD[dirNE *size_Mat]; - Dad.f[dirNE] = &DD_AD[dirSW *size_Mat]; - Dad.f[dirNW] = &DD_AD[dirSE *size_Mat]; - Dad.f[dirSE] = &DD_AD[dirNW *size_Mat]; - Dad.f[dirBW] = &DD_AD[dirTE *size_Mat]; - Dad.f[dirTE] = &DD_AD[dirBW *size_Mat]; - Dad.f[dirTW] = &DD_AD[dirBE *size_Mat]; - Dad.f[dirBE] = &DD_AD[dirTW *size_Mat]; - Dad.f[dirBS] = &DD_AD[dirTN *size_Mat]; - Dad.f[dirTN] = &DD_AD[dirBS *size_Mat]; - Dad.f[dirTS] = &DD_AD[dirBN *size_Mat]; - Dad.f[dirBN] = &DD_AD[dirTS *size_Mat]; - Dad.f[dirZERO] = &DD_AD[dirZERO*size_Mat]; - Dad.f[dirTNE] = &DD_AD[dirBSW *size_Mat]; - Dad.f[dirTSW] = &DD_AD[dirBNE *size_Mat]; - Dad.f[dirTSE] = &DD_AD[dirBNW *size_Mat]; - Dad.f[dirTNW] = &DD_AD[dirBSE *size_Mat]; - Dad.f[dirBNE] = &DD_AD[dirTSW *size_Mat]; - Dad.f[dirBSW] = &DD_AD[dirTNE *size_Mat]; - Dad.f[dirBSE] = &DD_AD[dirTNW *size_Mat]; - Dad.f[dirBNW] = &DD_AD[dirTSE *size_Mat]; + Dad.f[DIR_M00] = &DD_AD[DIR_P00 *size_Mat]; + Dad.f[DIR_P00] = &DD_AD[DIR_M00 *size_Mat]; + Dad.f[DIR_0M0] = &DD_AD[DIR_0P0 *size_Mat]; + Dad.f[DIR_0P0] = &DD_AD[DIR_0M0 *size_Mat]; + Dad.f[DIR_00M] = &DD_AD[DIR_00P *size_Mat]; + Dad.f[DIR_00P] = &DD_AD[DIR_00M *size_Mat]; + Dad.f[DIR_MM0] = &DD_AD[DIR_PP0 *size_Mat]; + Dad.f[DIR_PP0] = &DD_AD[DIR_MM0 *size_Mat]; + Dad.f[DIR_MP0] = &DD_AD[DIR_PM0 *size_Mat]; + Dad.f[DIR_PM0] = &DD_AD[DIR_MP0 *size_Mat]; + Dad.f[DIR_M0M] = &DD_AD[DIR_P0P *size_Mat]; + Dad.f[DIR_P0P] = &DD_AD[DIR_M0M *size_Mat]; + Dad.f[DIR_M0P] = &DD_AD[DIR_P0M *size_Mat]; + Dad.f[DIR_P0M] = &DD_AD[DIR_M0P *size_Mat]; + Dad.f[DIR_0MM] = &DD_AD[DIR_0PP *size_Mat]; + Dad.f[DIR_0PP] = &DD_AD[DIR_0MM *size_Mat]; + Dad.f[DIR_0MP] = &DD_AD[DIR_0PM *size_Mat]; + Dad.f[DIR_0PM] = &DD_AD[DIR_0MP *size_Mat]; + Dad.f[DIR_000] = &DD_AD[DIR_000*size_Mat]; + Dad.f[DIR_PPP] = &DD_AD[DIR_MMM *size_Mat]; + Dad.f[DIR_MMP] = &DD_AD[DIR_PPM *size_Mat]; + Dad.f[DIR_PMP] = &DD_AD[DIR_MPM *size_Mat]; + Dad.f[DIR_MPP] = &DD_AD[DIR_PMM *size_Mat]; + Dad.f[DIR_PPM] = &DD_AD[DIR_MMP *size_Mat]; + Dad.f[DIR_MMM] = &DD_AD[DIR_PPP *size_Mat]; + Dad.f[DIR_PMM] = &DD_AD[DIR_MPP *size_Mat]; + Dad.f[DIR_MPM] = &DD_AD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1518,33 +1038,33 @@ extern "C" __global__ void LBCalcMedCompAD27( if (geoD[k] == GEO_FLUID) { - real mfcbb = (D.f[dirE])[k];//[ke ]; - real mfabb = (D.f[dirW])[kw];//[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ]; - real mfbab = (D.f[dirS])[ks];//[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ]; - real mfbba = (D.f[dirB])[kb];//[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ]; - real mfaab = (D.f[dirSW])[ksw];//[ksw ]; - real mfcab = (D.f[dirSE])[ks];//[kse ]; - real mfacb = (D.f[dirNW])[kw];//[knw ]; - real mfcbc = (D.f[dirTE])[k];//[kte ]; - real mfaba = (D.f[dirBW])[kbw];//[kbw ]; - real mfcba = (D.f[dirBE])[kb];//[kbe ]; - real mfabc = (D.f[dirTW])[kw];//[ktw ]; - real mfbcc = (D.f[dirTN])[k];//[ktn ]; - real mfbaa = (D.f[dirBS])[kbs];//[kbs ]; - real mfbca = (D.f[dirBN])[kb];//[kbn ]; - real mfbac = (D.f[dirTS])[ks];//[kts ]; - real mfbbb = (D.f[dirZERO])[k];//[kzero]; - real mfccc = (D.f[dirTNE])[k];//[ktne ]; - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ]; - real mfcac = (D.f[dirTSE])[ks];//[ktse ]; - real mfacc = (D.f[dirTNW])[kw];//[ktnw ]; - real mfcca = (D.f[dirBNE])[kb];//[kbne ]; - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ]; - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ]; + real mfcbb = (D.f[DIR_P00])[k];//[ke ]; + real mfabb = (D.f[DIR_M00])[kw];//[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ]; + real mfbab = (D.f[DIR_0M0])[ks];//[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ]; + real mfbba = (D.f[DIR_00M])[kb];//[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ]; + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ]; + real mfacb = (D.f[DIR_MP0])[kw];//[knw ]; + real mfcbc = (D.f[DIR_P0P])[k];//[kte ]; + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ]; + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ]; + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ]; + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ]; + real mfbac = (D.f[DIR_0MP])[ks];//[kts ]; + real mfbbb = (D.f[DIR_000])[k];//[kzero]; + real mfccc = (D.f[DIR_PPP])[k];//[ktne ]; + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ]; + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ]; + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ]; + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ]; + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ]; + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + @@ -1571,52 +1091,52 @@ extern "C" __global__ void LBCalcMedCompAD27( (mfbbc - mfbba)) / rho) + VZ; pressD[k] = - ((D.f[dirE])[ke] + (D.f[dirW])[kw] + - (D.f[dirN])[kn] + (D.f[dirS])[ks] + - (D.f[dirT])[kt] + (D.f[dirB])[kb] + + ((D.f[DIR_P00])[ke] + (D.f[DIR_M00])[kw] + + (D.f[DIR_0P0])[kn] + (D.f[DIR_0M0])[ks] + + (D.f[DIR_00P])[kt] + (D.f[DIR_00M])[kb] + c2o1*( - (D.f[dirNE])[kne] + (D.f[dirSW])[ksw] + - (D.f[dirSE])[kse] + (D.f[dirNW])[knw] + - (D.f[dirTE])[kte] + (D.f[dirBW])[kbw] + - (D.f[dirBE])[kbe] + (D.f[dirTW])[ktw] + - (D.f[dirTN])[ktn] + (D.f[dirBS])[kbs] + - (D.f[dirBN])[kbn] + (D.f[dirTS])[kts]) + + (D.f[DIR_PP0])[kne] + (D.f[DIR_MM0])[ksw] + + (D.f[DIR_PM0])[kse] + (D.f[DIR_MP0])[knw] + + (D.f[DIR_P0P])[kte] + (D.f[DIR_M0M])[kbw] + + (D.f[DIR_P0M])[kbe] + (D.f[DIR_M0P])[ktw] + + (D.f[DIR_0PP])[ktn] + (D.f[DIR_0MM])[kbs] + + (D.f[DIR_0PM])[kbn] + (D.f[DIR_0MP])[kts]) + c3o1*( - (D.f[dirTNE])[ktne] + (D.f[dirTSW])[ktsw] + - (D.f[dirTSE])[ktse] + (D.f[dirTNW])[ktnw] + - (D.f[dirBNE])[kbne] + (D.f[dirBSW])[kbsw] + - (D.f[dirBSE])[kbse] + (D.f[dirBNW])[kbnw]) - + (D.f[DIR_PPP])[ktne] + (D.f[DIR_MMP])[ktsw] + + (D.f[DIR_PMP])[ktse] + (D.f[DIR_MPP])[ktnw] + + (D.f[DIR_PPM])[kbne] + (D.f[DIR_MMM])[kbsw] + + (D.f[DIR_PMM])[kbse] + (D.f[DIR_MPM])[kbnw]) - rhoD[k] - (vxD[k] * vxD[k] + vyD[k] * vyD[k] + vzD[k] * vzD[k]) * (c1o1 + rhoD[k])) * c1o2 + rhoD[k] + PRESS; //achtung op hart gesetzt Annahme op = 1 ; ^^^^(1.0/op-0.5)=0.5 ////////////////////////////////////////////////////////////////////////// - mfcbb = (Dad.f[dirE ])[k ]; - mfabb = (Dad.f[dirW ])[kw ]; - mfbcb = (Dad.f[dirN ])[k ]; - mfbab = (Dad.f[dirS ])[ks ]; - mfbbc = (Dad.f[dirT ])[k ]; - mfbba = (Dad.f[dirB ])[kb ]; - mfccb = (Dad.f[dirNE ])[k ]; - mfaab = (Dad.f[dirSW ])[ksw ]; - mfcab = (Dad.f[dirSE ])[ks ]; - mfacb = (Dad.f[dirNW ])[kw ]; - mfcbc = (Dad.f[dirTE ])[k ]; - mfaba = (Dad.f[dirBW ])[kbw ]; - mfcba = (Dad.f[dirBE ])[kb ]; - mfabc = (Dad.f[dirTW ])[kw ]; - mfbcc = (Dad.f[dirTN ])[k ]; - mfbaa = (Dad.f[dirBS ])[kbs ]; - mfbca = (Dad.f[dirBN ])[kb ]; - mfbac = (Dad.f[dirTS ])[ks ]; - mfbbb = (Dad.f[dirZERO])[k ]; - mfccc = (Dad.f[dirTNE ])[k ]; - mfaac = (Dad.f[dirTSW ])[ksw ]; - mfcac = (Dad.f[dirTSE ])[ks ]; - mfacc = (Dad.f[dirTNW ])[kw ]; - mfcca = (Dad.f[dirBNE ])[kb ]; - mfaaa = (Dad.f[dirBSW ])[kbsw]; - mfcaa = (Dad.f[dirBSE ])[kbs ]; - mfaca = (Dad.f[dirBNW ])[kbw ]; + mfcbb = (Dad.f[DIR_P00 ])[k ]; + mfabb = (Dad.f[DIR_M00 ])[kw ]; + mfbcb = (Dad.f[DIR_0P0 ])[k ]; + mfbab = (Dad.f[DIR_0M0 ])[ks ]; + mfbbc = (Dad.f[DIR_00P ])[k ]; + mfbba = (Dad.f[DIR_00M ])[kb ]; + mfccb = (Dad.f[DIR_PP0 ])[k ]; + mfaab = (Dad.f[DIR_MM0 ])[ksw ]; + mfcab = (Dad.f[DIR_PM0 ])[ks ]; + mfacb = (Dad.f[DIR_MP0 ])[kw ]; + mfcbc = (Dad.f[DIR_P0P ])[k ]; + mfaba = (Dad.f[DIR_M0M ])[kbw ]; + mfcba = (Dad.f[DIR_P0M ])[kb ]; + mfabc = (Dad.f[DIR_M0P ])[kw ]; + mfbcc = (Dad.f[DIR_0PP ])[k ]; + mfbaa = (Dad.f[DIR_0MM ])[kbs ]; + mfbca = (Dad.f[DIR_0PM ])[kb ]; + mfbac = (Dad.f[DIR_0MP ])[ks ]; + mfbbb = (Dad.f[DIR_000])[k ]; + mfccc = (Dad.f[DIR_PPP ])[k ]; + mfaac = (Dad.f[DIR_MMP ])[ksw ]; + mfcac = (Dad.f[DIR_PMP ])[ks ]; + mfacc = (Dad.f[DIR_MPP ])[kw ]; + mfcca = (Dad.f[DIR_PPM ])[kb ]; + mfaaa = (Dad.f[DIR_MMM ])[kbsw]; + mfcaa = (Dad.f[DIR_PMM ])[kbs ]; + mfaca = (Dad.f[DIR_MPM ])[kbw ]; ////////////////////////////////////////////////////////////////////////// concD[k] = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + @@ -1648,7 +1168,7 @@ extern "C" __global__ void LBCalcMedCompAD27( //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcMacMedSP27( real* vxD, +__global__ void LBCalcMacMedSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -1659,7 +1179,7 @@ extern "C" __global__ void LBCalcMacMedSP27( real* vxD, unsigned int* neighborZ, unsigned int tdiff, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1720,14 +1240,14 @@ extern "C" __global__ void LBCalcMacMedSP27( real* vxD, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBResetMedianValuesSP27( +__global__ void LBResetMedianValuesSP27( real* vxD, real* vyD, real* vzD, real* rhoD, real* pressD, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1773,7 +1293,7 @@ extern "C" __global__ void LBResetMedianValuesSP27( //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBResetMedianValuesAD27( +__global__ void LBResetMedianValuesAD27( real* vxD, real* vyD, real* vzD, @@ -1781,7 +1301,7 @@ extern "C" __global__ void LBResetMedianValuesAD27( real* pressD, real* concD, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1828,7 +1348,7 @@ extern "C" __global__ void LBResetMedianValuesAD27( //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBCalcMeasurePoints( real* vxMP, +__global__ void LBCalcMeasurePoints( real* vxMP, real* vyMP, real* vzMP, real* rhoMP, @@ -1842,68 +1362,68 @@ extern "C" __global__ void LBCalcMeasurePoints( real* vxMP, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1953,50 +1473,50 @@ extern "C" __global__ void LBCalcMeasurePoints( real* vxMP, if(geoD[kzero] == GEO_FLUID) { - rhoMP[kMac]= (D.f[dirE ])[ke ]+ (D.f[dirW ])[kw ]+ - (D.f[dirN ])[kn ]+ (D.f[dirS ])[ks ]+ - (D.f[dirT ])[kt ]+ (D.f[dirB ])[kb ]+ - (D.f[dirNE ])[kne ]+ (D.f[dirSW ])[ksw ]+ - (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - (D.f[dirTE ])[kte ]+ (D.f[dirBW ])[kbw ]+ - (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - (D.f[dirTN ])[ktn ]+ (D.f[dirBS ])[kbs ]+ - (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ]+ - (D.f[dirZERO])[kzero]+ - (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]+ (D.f[dirBSW ])[kbsw]+ - (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw]; - - vxMP[kMac] = (D.f[dirE ])[ke ]- (D.f[dirW ])[kw ]+ - (D.f[dirNE ])[kne ]- (D.f[dirSW ])[ksw ]+ - (D.f[dirSE ])[kse ]- (D.f[dirNW ])[knw ]+ - (D.f[dirTE ])[kte ]- (D.f[dirBW ])[kbw ]+ - (D.f[dirBE ])[kbe ]- (D.f[dirTW ])[ktw ]+ - (D.f[dirTNE ])[ktne]- (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]- (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]+ - (D.f[dirBSE ])[kbse]- (D.f[dirBNW ])[kbnw]; - - vyMP[kMac] = (D.f[dirN ])[kn ]- (D.f[dirS ])[ks ]+ - (D.f[dirNE ])[kne ]- (D.f[dirSW ])[ksw ]- - (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - (D.f[dirTN ])[ktn ]- (D.f[dirBS ])[kbs ]+ - (D.f[dirBN ])[kbn ]- (D.f[dirTS ])[kts ]+ - (D.f[dirTNE ])[ktne]- (D.f[dirTSW ])[ktsw]- - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]- - (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw]; - - vzMP[kMac] = (D.f[dirT ])[kt ]- (D.f[dirB ])[kb ]+ - (D.f[dirTE ])[kte ]- (D.f[dirBW ])[kbw ]- - (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - (D.f[dirTN ])[ktn ]- (D.f[dirBS ])[kbs ]- - (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ]+ - (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]- - (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]- - (D.f[dirBSE ])[kbse]- (D.f[dirBNW ])[kbnw]; + rhoMP[kMac]= (D.f[DIR_P00 ])[ke ]+ (D.f[DIR_M00 ])[kw ]+ + (D.f[DIR_0P0 ])[kn ]+ (D.f[DIR_0M0 ])[ks ]+ + (D.f[DIR_00P ])[kt ]+ (D.f[DIR_00M ])[kb ]+ + (D.f[DIR_PP0 ])[kne ]+ (D.f[DIR_MM0 ])[ksw ]+ + (D.f[DIR_PM0 ])[kse ]+ (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_P0P ])[kte ]+ (D.f[DIR_M0M ])[kbw ]+ + (D.f[DIR_P0M ])[kbe ]+ (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_0PP ])[ktn ]+ (D.f[DIR_0MM ])[kbs ]+ + (D.f[DIR_0PM ])[kbn ]+ (D.f[DIR_0MP ])[kts ]+ + (D.f[DIR_000])[kzero]+ + (D.f[DIR_PPP ])[ktne]+ (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]+ (D.f[DIR_MMM ])[kbsw]+ + (D.f[DIR_PMM ])[kbse]+ (D.f[DIR_MPM ])[kbnw]; + + vxMP[kMac] = (D.f[DIR_P00 ])[ke ]- (D.f[DIR_M00 ])[kw ]+ + (D.f[DIR_PP0 ])[kne ]- (D.f[DIR_MM0 ])[ksw ]+ + (D.f[DIR_PM0 ])[kse ]- (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_P0P ])[kte ]- (D.f[DIR_M0M ])[kbw ]+ + (D.f[DIR_P0M ])[kbe ]- (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_PPP ])[ktne]- (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]- (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]+ + (D.f[DIR_PMM ])[kbse]- (D.f[DIR_MPM ])[kbnw]; + + vyMP[kMac] = (D.f[DIR_0P0 ])[kn ]- (D.f[DIR_0M0 ])[ks ]+ + (D.f[DIR_PP0 ])[kne ]- (D.f[DIR_MM0 ])[ksw ]- + (D.f[DIR_PM0 ])[kse ]+ (D.f[DIR_MP0 ])[knw ]+ + (D.f[DIR_0PP ])[ktn ]- (D.f[DIR_0MM ])[kbs ]+ + (D.f[DIR_0PM ])[kbn ]- (D.f[DIR_0MP ])[kts ]+ + (D.f[DIR_PPP ])[ktne]- (D.f[DIR_MMP ])[ktsw]- + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]+ + (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]- + (D.f[DIR_PMM ])[kbse]+ (D.f[DIR_MPM ])[kbnw]; + + vzMP[kMac] = (D.f[DIR_00P ])[kt ]- (D.f[DIR_00M ])[kb ]+ + (D.f[DIR_P0P ])[kte ]- (D.f[DIR_M0M ])[kbw ]- + (D.f[DIR_P0M ])[kbe ]+ (D.f[DIR_M0P ])[ktw ]+ + (D.f[DIR_0PP ])[ktn ]- (D.f[DIR_0MM ])[kbs ]- + (D.f[DIR_0PM ])[kbn ]+ (D.f[DIR_0MP ])[kts ]+ + (D.f[DIR_PPP ])[ktne]+ (D.f[DIR_MMP ])[ktsw]+ + (D.f[DIR_PMP ])[ktse]+ (D.f[DIR_MPP ])[ktnw]- + (D.f[DIR_PPM ])[kbne]- (D.f[DIR_MMM ])[kbsw]- + (D.f[DIR_PMM ])[kbse]- (D.f[DIR_MPM ])[kbnw]; } } } @@ -2039,7 +1559,7 @@ extern "C" __global__ void LBCalcMeasurePoints( real* vxMP, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBSetOutputWallVelocitySP27( real* vxD, +__global__ void LBSetOutputWallVelocitySP27( real* vxD, real* vyD, real* vzD, real* vxWall, @@ -2055,7 +1575,7 @@ extern "C" __global__ void LBSetOutputWallVelocitySP27( real* vxD, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index diff --git a/src/gpu/VirtualFluids_GPU/GPU/Cascade27.cu b/src/gpu/VirtualFluids_GPU/GPU/Cascade27.cu index 5c3a12551c2cffdd0b75ce283d9ee584a7c4b808..a79588421a624cae62ec32127739efb47bb7b2ef 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/Cascade27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/Cascade27.cu @@ -1,13 +1,15 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + #include "math.h" //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Cascade_SP_27( real omega, +__global__ void LB_Kernel_Cascade_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -38,63 +40,63 @@ extern "C" __global__ void LB_Kernel_Cascade_SP_27( real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -127,33 +129,33 @@ extern "C" __global__ void LB_Kernel_Cascade_SP_27( real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW ])[kw ];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS ])[ks ];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB ])[kb ];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW ])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW ])[kw ];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE ])[k ];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW ])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW ])[kw ];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN ])[k ];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS ])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS ])[ks ];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k ];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE ])[k ];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW ])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE ])[ks ];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW ])[kw ];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE ])[kb ];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW ])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW ])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00 ])[k ];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00 ])[kw ];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0 ])[ks ];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M ])[kb ];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0 ])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0 ])[kw ];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P ])[k ];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M ])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P ])[kw ];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP ])[k ];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM ])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP ])[ks ];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k ];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP ])[k ];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP ])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP ])[ks ];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP ])[kw ];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM ])[kb ];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM ])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM ])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// //slow //real oMdrho = one - ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + @@ -729,33 +731,33 @@ extern "C" __global__ void LB_Kernel_Cascade_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[ dirE ])[k ] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[ dirW ])[kw ] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[ dirN ])[k ] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[ dirS ])[ks ] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[ dirT ])[k ] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[ dirB ])[kb ] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[ dirNE ])[k ] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[ dirSW ])[ksw ] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[ dirSE ])[ks ] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[ dirNW ])[kw ] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[ dirTE ])[k ] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[ dirBW ])[kbw ] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[ dirBE ])[kb ] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[ dirTW ])[kw ] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[ dirTN ])[k ] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[ dirBS ])[kbs ] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[ dirBN ])[kb ] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[ dirTS ])[ks ] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[ dirZERO])[k ] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[ dirTNE ])[k ] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[ dirTSE ])[ks ] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[ dirBNE ])[kb ] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[ dirBSE ])[kbs ] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[ dirTNW ])[kw ] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[ dirTSW ])[ksw ] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[ dirBNW ])[kbw ] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[ dirBSW ])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[ DIR_P00 ])[k ] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[ DIR_M00 ])[kw ] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[ DIR_0P0 ])[k ] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[ DIR_0M0 ])[ks ] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[ DIR_00P ])[k ] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[ DIR_00M ])[kb ] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[ DIR_PP0 ])[k ] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[ DIR_MM0 ])[ksw ] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[ DIR_PM0 ])[ks ] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[ DIR_MP0 ])[kw ] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[ DIR_P0P ])[k ] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[ DIR_M0M ])[kbw ] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[ DIR_P0M ])[kb ] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[ DIR_M0P ])[kw ] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[ DIR_0PP ])[k ] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[ DIR_0MM ])[kbs ] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[ DIR_0PM ])[kb ] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[ DIR_0MP ])[ks ] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[ DIR_000])[k ] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[ DIR_PPP ])[k ] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[ DIR_PMP ])[ks ] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[ DIR_PPM ])[kb ] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[ DIR_PMM ])[kbs ] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[ DIR_MPP ])[kw ] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[ DIR_MMP ])[ksw ] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[ DIR_MPM ])[kbw ] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[ DIR_MMM ])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } @@ -834,7 +836,7 @@ extern "C" __global__ void LB_Kernel_Cascade_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Casc_Comp_SP_27( real omega, +__global__ void LB_Kernel_Casc_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -865,63 +867,63 @@ extern "C" __global__ void LB_Kernel_Casc_Comp_SP_27( real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -954,38 +956,38 @@ extern "C" __global__ void LB_Kernel_Casc_Comp_SP_27( real omega, unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real E = (D.f[dirE ])[ke ];// + c2over27 ; - real W = (D.f[dirW ])[kw ];// + c2over27 ; - real N = (D.f[dirN ])[kn ];// + c2over27 ; - real S = (D.f[dirS ])[ks ];// + c2over27 ; - real F = (D.f[dirT ])[kt ];// + c2over27 ; - real B = (D.f[dirB ])[kb ];// + c2over27 ; - real Ne = (D.f[dirNE ])[kne ];// + c1over54 ; - real Sw = (D.f[dirSW ])[ksw ];// + c1over54 ; - real Se = (D.f[dirSE ])[kse ];// + c1over54 ; - real Nw = (D.f[dirNW ])[knw ];// + c1over54 ; - real Ef = (D.f[dirTE ])[kte ];// + c1over54 ; - real Wb = (D.f[dirBW ])[kbw ];// + c1over54 ; - real Eb = (D.f[dirBE ])[kbe ];// + c1over54 ; - real Wf = (D.f[dirTW ])[ktw ];// + c1over54 ; - real Nf = (D.f[dirTN ])[ktn ];// + c1over54 ; - real Sb = (D.f[dirBS ])[kbs ];// + c1over54 ; - real Nb = (D.f[dirBN ])[kbn ];// + c1over54 ; - real Sf = (D.f[dirTS ])[kts ];// + c1over54 ; - real R = (D.f[dirZERO])[kzero];// + c8over27 ; - real Nef = (D.f[dirTNE ])[ktne ];// + c1over216; - real Swf = (D.f[dirTSW ])[ktsw ];// + c1over216; - real Sef = (D.f[dirTSE ])[ktse ];// + c1over216; - real Nwf = (D.f[dirTNW ])[ktnw ];// + c1over216; - real Neb = (D.f[dirBNE ])[kbne ];// + c1over216; - real Swb = (D.f[dirBSW ])[kbsw ];// + c1over216; - real Seb = (D.f[dirBSE ])[kbse ];// + c1over216; - real Nwb = (D.f[dirBNW ])[kbnw ];// + c1over216; + real f_E = (D.f[DIR_P00 ])[ke ];// + c2over27 ; + real f_W = (D.f[DIR_M00 ])[kw ];// + c2over27 ; + real f_N = (D.f[DIR_0P0 ])[kn ];// + c2over27 ; + real f_S = (D.f[DIR_0M0 ])[ks ];// + c2over27 ; + real f_F = (D.f[DIR_00P ])[kt ];// + c2over27 ; + real f_B = (D.f[DIR_00M ])[kb ];// + c2over27 ; + real f_NE = (D.f[DIR_PP0 ])[kne ];// + c1over54 ; + real f_SW = (D.f[DIR_MM0 ])[ksw ];// + c1over54 ; + real f_SE = (D.f[DIR_PM0 ])[kse ];// + c1over54 ; + real f_NW = (D.f[DIR_MP0 ])[knw ];// + c1over54 ; + real f_Ef = (D.f[DIR_P0P ])[kte ];// + c1over54 ; + real f_Wb = (D.f[DIR_M0M ])[kbw ];// + c1over54 ; + real f_Eb = (D.f[DIR_P0M ])[kbe ];// + c1over54 ; + real f_Wf = (D.f[DIR_M0P ])[ktw ];// + c1over54 ; + real f_Nf = (D.f[DIR_0PP ])[ktn ];// + c1over54 ; + real f_Sb = (D.f[DIR_0MM ])[kbs ];// + c1over54 ; + real f_Nb = (D.f[DIR_0PM ])[kbn ];// + c1over54 ; + real f_Sf = (D.f[DIR_0MP ])[kts ];// + c1over54 ; + real f_R = (D.f[DIR_000])[kzero];// + c8over27 ; + real f_Nef = (D.f[DIR_PPP ])[ktne ];// + c1over216; + real f_Swf = (D.f[DIR_MMP ])[ktsw ];// + c1over216; + real f_Sef = (D.f[DIR_PMP ])[ktse ];// + c1over216; + real f_Nwf = (D.f[DIR_MPP ])[ktnw ];// + c1over216; + real f_Neb = (D.f[DIR_PPM ])[kbne ];// + c1over216; + real f_Swb = (D.f[DIR_MMM ])[kbsw ];// + c1over216; + real f_Seb = (D.f[DIR_PMM ])[kbse ];// + c1over216; + real f_Nwb = (D.f[DIR_MPM ])[kbnw ];// + c1over216; //////////////////////////////////////////////////////////////////////////////////// - real rho=Nw+W+Sw+S+Se+E+Ne+N+R+Nf+Nb+Sf+Sb+Ef+Eb+Wf+Wb+Nwf+Nwb+Nef+Neb+Swf+Swb+Sef+Seb+F+B+c1o1;// ACHTUNG ne EINS !!!!!!!! - real pix=(Ne+E+Se+Ef+Eb-Nw-W-Sw-Wf-Wb+Nef+Neb+Sef+Seb-Nwf-Nwb-Swf-Swb); - real piy=(Ne+N+Nw+Nf+Nb-Se-S-Sw-Sf-Sb+Nef+Neb+Nwf+Nwb-Sef-Seb-Swf-Swb); - real piz=(Nf+Sf+Wf+Ef+F-Nb-Sb-Wb-Eb-B+Nef+Nwf+Sef+Swf-Neb-Nwb-Seb-Swb); + real rho=f_NW+f_W+f_SW+f_S+f_SE+f_E+f_NE+f_N+f_R+f_Nf+f_Nb+f_Sf+f_Sb+f_Ef+f_Eb+f_Wf+f_Wb+f_Nwf+f_Nwb+f_Nef+f_Neb+f_Swf+f_Swb+f_Sef+f_Seb+f_F+f_B+c1o1;// ACHTUNG ne EINS !!!!!!!! + real pix=(f_NE+f_E+f_SE+f_Ef+f_Eb-f_NW-f_W-f_SW-f_Wf-f_Wb+f_Nef+f_Neb+f_Sef+f_Seb-f_Nwf-f_Nwb-f_Swf-f_Swb); + real piy=(f_NE+f_N+f_NW+f_Nf+f_Nb-f_SE-f_S-f_SW-f_Sf-f_Sb+f_Nef+f_Neb+f_Nwf+f_Nwb-f_Sef-f_Seb-f_Swf-f_Swb); + real piz=(f_Nf+f_Sf+f_Wf+f_Ef+f_F-f_Nb-f_Sb-f_Wb-f_Eb-f_B+f_Nef+f_Nwf+f_Sef+f_Swf-f_Neb-f_Nwb-f_Seb-f_Swb); real vvx=pix/rho; real vvy=piy/rho; real vvz=piz/rho; @@ -993,33 +995,33 @@ extern "C" __global__ void LB_Kernel_Casc_Comp_SP_27( real omega, real vy2=vvy*vvy; real vz2=vvz*vvz; //////////////////////////////////////////////////////////////////////////////////// - real mfaaa = Swb; - real mfaab = Sw; - real mfaac = Swf; - real mfaba = Wb; - real mfabb = W; - real mfabc = Wf; - real mfbaa = Sb; - real mfbab = S; - real mfbac = Sf; - real mfbba = B; - real mfbbb = R; - real mfbbc = F; - real mfaca = Nwb; - real mfacb = Nw; - real mfacc = Nwf; - real mfcaa = Seb; - real mfcab = Se; - real mfcac = Sef; - real mfcca = Neb; - real mfccb = Ne; - real mfccc = Nef; - real mfbca = Nb; - real mfbcb = N; - real mfbcc = Nf; - real mfcba = Eb; - real mfcbb = E; - real mfcbc = Ef; + real mfaaa = f_Swb; + real mfaab = f_SW; + real mfaac = f_Swf; + real mfaba = f_Wb; + real mfabb = f_W; + real mfabc = f_Wf; + real mfbaa = f_Sb; + real mfbab = f_S; + real mfbac = f_Sf; + real mfbba = f_B; + real mfbbb = f_R; + real mfbbc = f_F; + real mfaca = f_Nwb; + real mfacb = f_NW; + real mfacc = f_Nwf; + real mfcaa = f_Seb; + real mfcab = f_SE; + real mfcac = f_Sef; + real mfcca = f_Neb; + real mfccb = f_NE; + real mfccc = f_Nef; + real mfbca = f_Nb; + real mfbcb = f_N; + real mfbcc = f_Nf; + real mfcba = f_Eb; + real mfcbb = f_E; + real mfcbc = f_Ef; real m0, m1, m2; //////////////////////////////////////////////////////////////////////////////////// //Hin @@ -1609,33 +1611,33 @@ extern "C" __global__ void LB_Kernel_Casc_Comp_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[ dirE ])[ke ] = mfabb;// - c2over27 ;// - (D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; - (D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; - (D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; - (D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; - (D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; - (D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; - (D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; - (D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; - (D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; - (D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; - (D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; - (D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; - (D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; - (D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; - (D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; - (D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; - (D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; - (D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; - (D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; - (D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; - (D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; - (D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; - (D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; - (D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; - (D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; - (D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; + (D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ;// + (D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; + (D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; + (D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; + (D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; + (D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; + (D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; + (D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; + (D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; + (D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; + (D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; + (D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; + (D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; + (D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; + (D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; + (D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; + (D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; + (D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; + (D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; + (D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; + (D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; + (D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; + (D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; + (D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; + (D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; + (D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; + (D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; //////////////////////////////////////////////////////////////////////////////////// } } @@ -1681,7 +1683,7 @@ extern "C" __global__ void LB_Kernel_Casc_Comp_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Casc_SP_MS_OHM_27( real omega, +__global__ void LB_Kernel_Casc_SP_MS_OHM_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -1712,63 +1714,63 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_OHM_27( real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -1801,33 +1803,33 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_OHM_27( real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real fE = (D.f[dirE ])[k ];//ke - real fW = (D.f[dirW ])[kw ]; - real fN = (D.f[dirN ])[k ];//kn - real fS = (D.f[dirS ])[ks ]; - real fT = (D.f[dirT ])[k ];//kt - real fB = (D.f[dirB ])[kb ]; - real fNE = (D.f[dirNE ])[k ];//kne - real fSW = (D.f[dirSW ])[ksw]; - real fSE = (D.f[dirSE ])[ks ];//kse - real fNW = (D.f[dirNW ])[kw ];//knw - real fTE = (D.f[dirTE ])[k ];//kte - real fBW = (D.f[dirBW ])[kbw]; - real fBE = (D.f[dirBE ])[kb ];//kbe - real fTW = (D.f[dirTW ])[kw ];//ktw - real fTN = (D.f[dirTN ])[k ];//ktn - real fBS = (D.f[dirBS ])[kbs]; - real fBN = (D.f[dirBN ])[kb ];//kbn - real fTS = (D.f[dirTS ])[ks ];//kts - real fZERO = (D.f[dirZERO])[k ];//kzero - real fTNE = (D.f[dirTNE ])[k ];//ktne - real fTSW = (D.f[dirTSW ])[ksw];//ktsw - real fTSE = (D.f[dirTSE ])[ks ];//ktse - real fTNW = (D.f[dirTNW ])[kw ];//ktnw - real fBNE = (D.f[dirBNE ])[kb ];//kbne - real fBSW = (D.f[dirBSW ])[kbsw]; - real fBSE = (D.f[dirBSE ])[kbs];//kbse - real fBNW = (D.f[dirBNW ])[kbw];//kbnw + real fE = (D.f[DIR_P00 ])[k ];//ke + real fW = (D.f[DIR_M00 ])[kw ]; + real fN = (D.f[DIR_0P0 ])[k ];//kn + real fS = (D.f[DIR_0M0 ])[ks ]; + real fT = (D.f[DIR_00P ])[k ];//kt + real fB = (D.f[DIR_00M ])[kb ]; + real fNE = (D.f[DIR_PP0 ])[k ];//kne + real fSW = (D.f[DIR_MM0 ])[ksw]; + real fSE = (D.f[DIR_PM0 ])[ks ];//kse + real fNW = (D.f[DIR_MP0 ])[kw ];//knw + real fTE = (D.f[DIR_P0P ])[k ];//kte + real fBW = (D.f[DIR_M0M ])[kbw]; + real fBE = (D.f[DIR_P0M ])[kb ];//kbe + real fTW = (D.f[DIR_M0P ])[kw ];//ktw + real fTN = (D.f[DIR_0PP ])[k ];//ktn + real fBS = (D.f[DIR_0MM ])[kbs]; + real fBN = (D.f[DIR_0PM ])[kb ];//kbn + real fTS = (D.f[DIR_0MP ])[ks ];//kts + real fZERO = (D.f[DIR_000])[k ];//kzero + real fTNE = (D.f[DIR_PPP ])[k ];//ktne + real fTSW = (D.f[DIR_MMP ])[ksw];//ktsw + real fTSE = (D.f[DIR_PMP ])[ks ];//ktse + real fTNW = (D.f[DIR_MPP ])[kw ];//ktnw + real fBNE = (D.f[DIR_PPM ])[kb ];//kbne + real fBSW = (D.f[DIR_MMM ])[kbsw]; + real fBSE = (D.f[DIR_PMM ])[kbs];//kbse + real fBNW = (D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////// real rho0 = (fTNE+fBSW)+(fTSW+fBNE)+(fTSE+fBNW)+(fTNW+fBSE)+(fNE+fSW)+(fNW+fSE)+(fTE+fBW)+(fBE+fTW)+(fTN+fBS)+(fBN+fTS)+(fE+fW)+(fN+fS)+(fT+fB)+fZERO; real rho = rho0 + c1o1; @@ -2183,92 +2185,92 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_OHM_27( real omega, c2o1*(/*vx2y*MzYZZ +*/ vx*MzXYYZZ + vz*MzXXYYZ /*+ vyz2*MzXXY + vx2z*MzYYZ + vxy2*MzXZZ + vxz2*MzXYY*/ + vy*MzXXYZZ/* + vy2z*MzXXZ*/);//+ //four*(/*vxy2z*MzXZ + vx2yz*MzYZ + vxyz2*MzXY +*/ vxy*MzXYZZ + vxz*MzXYYZ + vyz*MzXXYZ); - //(D.f[ dirE ])[k ] = c1o2*rho*( mu200 - mu220 + mu222 - mu202 + mu120 - mu122 + mu102 - vx ); //ke - //(D.f[ dirW ])[kw ] = c1o2*rho*( mu200 - mu220 + mu222 - mu202 - mu120 + mu122 - mu102 + vx ); - //(D.f[ dirN ])[k ] = c1o2*rho*( mu210 - mu220 + mu222 - mu212 + mu020 - mu022 + mu012 - vy ); //kn - //(D.f[ dirS ])[ks ] = c1o2*rho*(-mu210 - mu220 + mu222 + mu212 + mu020 - mu022 - mu012 + vy ); - //(D.f[ dirT ])[k ] = c1o2*rho*(-mu221 + mu222 + mu201 - mu202 + mu021 - mu022 + mu002 - vz ); //kt - //(D.f[ dirB ])[kb ] = c1o2*rho*( mu221 + mu222 - mu201 - mu202 - mu021 - mu022 + mu002 + vz ); - //(D.f[ dirNE ])[k ] = c1o4*rho*(-mu210 + mu220 - mu222 + mu212 + mu110 - mu120 + mu122 - mu112); //kne - //(D.f[ dirSW ])[ksw ] = c1o4*rho*( mu210 + mu220 - mu222 - mu212 + mu110 + mu120 - mu122 - mu112); - //(D.f[ dirSE ])[ks ] = c1o4*rho*( mu210 + mu220 - mu222 - mu212 - mu110 - mu120 + mu122 + mu112); //kse - //(D.f[ dirNW ])[kw ] = c1o4*rho*(-mu210 + mu220 - mu222 + mu212 - mu110 + mu120 - mu122 + mu112); //knw - //(D.f[ dirTE ])[k ] = c1o4*rho*( mu221 - mu222 - mu201 + mu202 - mu121 + mu122 + mu101 - mu102); //kte - //(D.f[ dirBW ])[kbw ] = c1o4*rho*(-mu221 - mu222 + mu201 + mu202 - mu121 - mu122 + mu101 + mu102); - //(D.f[ dirBE ])[kb ] = c1o4*rho*(-mu221 - mu222 + mu201 + mu202 + mu121 + mu122 - mu101 - mu102); //kbe - //(D.f[ dirTW ])[kw ] = c1o4*rho*( mu221 - mu222 - mu201 + mu202 + mu121 - mu122 - mu101 + mu102); //ktw - //(D.f[ dirTN ])[k ] = c1o4*rho*( mu221 - mu222 - mu211 + mu212 - mu021 + mu022 + mu011 - mu012); //ktn - //(D.f[ dirBS ])[kbs ] = c1o4*rho*(-mu221 - mu222 - mu211 - mu212 + mu021 + mu022 + mu011 + mu012); - //(D.f[ dirBN ])[kb ] = c1o4*rho*(-mu221 - mu222 + mu211 + mu212 + mu021 + mu022 - mu011 - mu012); //kbn - //(D.f[ dirTS ])[ks ] = c1o4*rho*( mu221 - mu222 + mu211 - mu212 - mu021 + mu022 - mu011 + mu012); //kts - //(D.f[ dirZERO])[k ] = rho*(-mu200 + mu220 - mu222 + mu202 - mu020 + mu022 - mu002 )+rho0; //kzero - //(D.f[ dirTNE ])[k ] = c1o8*rho*(-mu221 + mu222 + mu211 - mu212 + mu121 - mu122 - mu111 + mu112); //ktne - //(D.f[ dirTSE ])[ks ] = c1o8*rho*(-mu221 + mu222 - mu211 + mu212 + mu121 - mu122 + mu111 - mu112); //ktse - //(D.f[ dirBNE ])[kb ] = c1o8*rho*( mu221 + mu222 - mu211 - mu212 - mu121 - mu122 + mu111 + mu112); //kbne - //(D.f[ dirBSE ])[kbs ] = c1o8*rho*( mu221 + mu222 + mu211 + mu212 - mu121 - mu122 - mu111 - mu112); //kbse - //(D.f[ dirTNW ])[kw ] = c1o8*rho*(-mu221 + mu222 + mu211 - mu212 - mu121 + mu122 + mu111 - mu112); //ktnw - //(D.f[ dirTSW ])[ksw ] = c1o8*rho*(-mu221 + mu222 - mu211 + mu212 - mu121 + mu122 - mu111 + mu112); //ktsw - //(D.f[ dirBNW ])[kbw ] = c1o8*rho*( mu221 + mu222 - mu211 - mu212 + mu121 + mu122 - mu111 - mu112); //kbnw - //(D.f[ dirBSW ])[kbsw] = c1o8*rho*( mu221 + mu222 + mu211 + mu212 + mu121 + mu122 + mu111 + mu112); - (D.f[ dirE ])[k ] = c1o2*rho*(+ mu222 + ( - mu220 - mu202 ) + ( + mu200 ) + ( - mu122) + ( + mu102 + mu120) + ( - vx ) ); //ke - (D.f[ dirW ])[kw ] = c1o2*rho*(+ mu222 + ( - mu220 - mu202 ) + ( + mu200 ) + ( + mu122) + ( - mu102 - mu120) + ( + vx ) ); - (D.f[ dirN ])[k ] = c1o2*rho*(+ mu222 + ( - mu220 - mu022) + ( + mu020 ) + ( - mu212 ) + ( + mu012 + mu210 ) + ( - vy ) ); //kn - (D.f[ dirS ])[ks ] = c1o2*rho*(+ mu222 + ( - mu220 - mu022) + ( + mu020 ) + ( + mu212 ) + ( - mu012 - mu210 ) + ( + vy ) ); - (D.f[ dirT ])[k ] = c1o2*rho*(+ mu222 + ( - mu202 - mu022) + ( + mu002) + ( - mu221 ) + ( + mu201 + mu021 ) + ( - vz ) ); //kt - (D.f[ dirB ])[kb ] = c1o2*rho*(+ mu222 + ( - mu202 - mu022) + ( + mu002) + ( + mu221 ) + ( - mu201 - mu021 ) + ( + vz ) ); - (D.f[ dirNE ])[k ] = c1o4*rho*(- mu222 + ( - mu112 + mu220 ) + (+ mu110 ) + ( + mu212 + mu122) + ( - mu210 - mu120) ); //kne - (D.f[ dirSW ])[ksw ] = c1o4*rho*(- mu222 + ( - mu112 + mu220 ) + (+ mu110 ) + ( - mu212 - mu122) + ( + mu210 + mu120) ); - (D.f[ dirSE ])[ks ] = c1o4*rho*(- mu222 + ( + mu112 + mu220 ) + (- mu110 ) + ( - mu212 + mu122) + ( + mu210 - mu120) ); //kse - (D.f[ dirNW ])[kw ] = c1o4*rho*(- mu222 + ( + mu112 + mu220 ) + (- mu110 ) + ( + mu212 - mu122) + ( - mu210 + mu120) ); //knw - (D.f[ dirTE ])[k ] = c1o4*rho*(- mu222 + ( - mu121 + mu202 ) + ( + mu101 ) + ( + mu221 + mu122) + ( - mu201 - mu102 ) ); //kte - (D.f[ dirBW ])[kbw ] = c1o4*rho*(- mu222 + ( - mu121 + mu202 ) + ( + mu101 ) + ( - mu221 - mu122) + ( + mu201 + mu102 ) ); - (D.f[ dirBE ])[kb ] = c1o4*rho*(- mu222 + ( + mu121 + mu202 ) + ( - mu101 ) + ( - mu221 + mu122) + ( + mu201 - mu102 ) ); //kbe - (D.f[ dirTW ])[kw ] = c1o4*rho*(- mu222 + ( + mu121 + mu202 ) + ( - mu101 ) + ( + mu221 - mu122) + ( - mu201 + mu102 ) ); //ktw - (D.f[ dirTN ])[k ] = c1o4*rho*(- mu222 + (- mu211 + mu022) + ( + mu011 ) + ( + mu221 + mu212 ) + ( - mu021 - mu012 ) ); //ktn - (D.f[ dirBS ])[kbs ] = c1o4*rho*(- mu222 + (- mu211 + mu022) + ( + mu011 ) + ( - mu221 - mu212 ) + ( + mu021 + mu012 ) ); - (D.f[ dirBN ])[kb ] = c1o4*rho*(- mu222 + (+ mu211 + mu022) + ( - mu011 ) + ( - mu221 + mu212 ) + ( + mu021 - mu012 ) ); //kbn - (D.f[ dirTS ])[ks ] = c1o4*rho*(- mu222 + (+ mu211 + mu022) + ( - mu011 ) + ( + mu221 - mu212 ) + ( - mu021 + mu012 ) ); //kts - (D.f[ dirZERO])[k ] = rho*(- mu222 + ( + mu220 + mu202 + mu022) + ( - mu200 - mu020 - mu002) )+rho0; //kzero - (D.f[ dirTNE ])[k ] = c1o8*rho*(+ mu222 + (+ mu211 + mu121 + mu112 ) + ( - mu221 - mu212 - mu122) + ( - mu111 ) ); //ktne - (D.f[ dirTSE ])[ks ] = c1o8*rho*(+ mu222 + (- mu211 + mu121 - mu112 ) + ( - mu221 + mu212 - mu122) + ( + mu111 ) ); //ktse - (D.f[ dirBNE ])[kb ] = c1o8*rho*(+ mu222 + (- mu211 - mu121 + mu112 ) + ( + mu221 - mu212 - mu122) + ( + mu111 ) ); //kbne - (D.f[ dirBSE ])[kbs ] = c1o8*rho*(+ mu222 + (+ mu211 - mu121 - mu112 ) + ( + mu221 + mu212 - mu122) + ( - mu111 ) ); //kbse - (D.f[ dirTNW ])[kw ] = c1o8*rho*(+ mu222 + (+ mu211 - mu121 - mu112 ) + ( - mu221 - mu212 + mu122) + ( + mu111 ) ); //ktnw - (D.f[ dirTSW ])[ksw ] = c1o8*rho*(+ mu222 + (- mu211 - mu121 + mu112 ) + ( - mu221 + mu212 + mu122) + ( - mu111 ) ); //ktsw - (D.f[ dirBNW ])[kbw ] = c1o8*rho*(+ mu222 + (- mu211 + mu121 - mu112 ) + ( + mu221 - mu212 + mu122) + ( - mu111 ) ); //kbnw - (D.f[ dirBSW ])[kbsw] = c1o8*rho*(+ mu222 + (+ mu211 + mu121 + mu112 ) + ( + mu221 + mu212 + mu122) + ( + mu111 ) ); + //(D.f[ DIR_P00 ])[k ] = c1o2*rho*( mu200 - mu220 + mu222 - mu202 + mu120 - mu122 + mu102 - vx ); //ke + //(D.f[ DIR_M00 ])[kw ] = c1o2*rho*( mu200 - mu220 + mu222 - mu202 - mu120 + mu122 - mu102 + vx ); + //(D.f[ DIR_0P0 ])[k ] = c1o2*rho*( mu210 - mu220 + mu222 - mu212 + mu020 - mu022 + mu012 - vy ); //kn + //(D.f[ DIR_0M0 ])[ks ] = c1o2*rho*(-mu210 - mu220 + mu222 + mu212 + mu020 - mu022 - mu012 + vy ); + //(D.f[ DIR_00P ])[k ] = c1o2*rho*(-mu221 + mu222 + mu201 - mu202 + mu021 - mu022 + mu002 - vz ); //kt + //(D.f[ DIR_00M ])[kb ] = c1o2*rho*( mu221 + mu222 - mu201 - mu202 - mu021 - mu022 + mu002 + vz ); + //(D.f[ DIR_PP0 ])[k ] = c1o4*rho*(-mu210 + mu220 - mu222 + mu212 + mu110 - mu120 + mu122 - mu112); //kne + //(D.f[ DIR_MM0 ])[ksw ] = c1o4*rho*( mu210 + mu220 - mu222 - mu212 + mu110 + mu120 - mu122 - mu112); + //(D.f[ DIR_PM0 ])[ks ] = c1o4*rho*( mu210 + mu220 - mu222 - mu212 - mu110 - mu120 + mu122 + mu112); //kse + //(D.f[ DIR_MP0 ])[kw ] = c1o4*rho*(-mu210 + mu220 - mu222 + mu212 - mu110 + mu120 - mu122 + mu112); //knw + //(D.f[ DIR_P0P ])[k ] = c1o4*rho*( mu221 - mu222 - mu201 + mu202 - mu121 + mu122 + mu101 - mu102); //kte + //(D.f[ DIR_M0M ])[kbw ] = c1o4*rho*(-mu221 - mu222 + mu201 + mu202 - mu121 - mu122 + mu101 + mu102); + //(D.f[ DIR_P0M ])[kb ] = c1o4*rho*(-mu221 - mu222 + mu201 + mu202 + mu121 + mu122 - mu101 - mu102); //kbe + //(D.f[ DIR_M0P ])[kw ] = c1o4*rho*( mu221 - mu222 - mu201 + mu202 + mu121 - mu122 - mu101 + mu102); //ktw + //(D.f[ DIR_0PP ])[k ] = c1o4*rho*( mu221 - mu222 - mu211 + mu212 - mu021 + mu022 + mu011 - mu012); //ktn + //(D.f[ DIR_0MM ])[kbs ] = c1o4*rho*(-mu221 - mu222 - mu211 - mu212 + mu021 + mu022 + mu011 + mu012); + //(D.f[ DIR_0PM ])[kb ] = c1o4*rho*(-mu221 - mu222 + mu211 + mu212 + mu021 + mu022 - mu011 - mu012); //kbn + //(D.f[ DIR_0MP ])[ks ] = c1o4*rho*( mu221 - mu222 + mu211 - mu212 - mu021 + mu022 - mu011 + mu012); //kts + //(D.f[ DIR_000])[k ] = rho*(-mu200 + mu220 - mu222 + mu202 - mu020 + mu022 - mu002 )+rho0; //kzero + //(D.f[ DIR_PPP ])[k ] = c1o8*rho*(-mu221 + mu222 + mu211 - mu212 + mu121 - mu122 - mu111 + mu112); //ktne + //(D.f[ DIR_PMP ])[ks ] = c1o8*rho*(-mu221 + mu222 - mu211 + mu212 + mu121 - mu122 + mu111 - mu112); //ktse + //(D.f[ DIR_PPM ])[kb ] = c1o8*rho*( mu221 + mu222 - mu211 - mu212 - mu121 - mu122 + mu111 + mu112); //kbne + //(D.f[ DIR_PMM ])[kbs ] = c1o8*rho*( mu221 + mu222 + mu211 + mu212 - mu121 - mu122 - mu111 - mu112); //kbse + //(D.f[ DIR_MPP ])[kw ] = c1o8*rho*(-mu221 + mu222 + mu211 - mu212 - mu121 + mu122 + mu111 - mu112); //ktnw + //(D.f[ DIR_MMP ])[ksw ] = c1o8*rho*(-mu221 + mu222 - mu211 + mu212 - mu121 + mu122 - mu111 + mu112); //ktsw + //(D.f[ DIR_MPM ])[kbw ] = c1o8*rho*( mu221 + mu222 - mu211 - mu212 + mu121 + mu122 - mu111 - mu112); //kbnw + //(D.f[ DIR_MMM ])[kbsw] = c1o8*rho*( mu221 + mu222 + mu211 + mu212 + mu121 + mu122 + mu111 + mu112); + (D.f[ DIR_P00 ])[k ] = c1o2*rho*(+ mu222 + ( - mu220 - mu202 ) + ( + mu200 ) + ( - mu122) + ( + mu102 + mu120) + ( - vx ) ); //ke + (D.f[ DIR_M00 ])[kw ] = c1o2*rho*(+ mu222 + ( - mu220 - mu202 ) + ( + mu200 ) + ( + mu122) + ( - mu102 - mu120) + ( + vx ) ); + (D.f[ DIR_0P0 ])[k ] = c1o2*rho*(+ mu222 + ( - mu220 - mu022) + ( + mu020 ) + ( - mu212 ) + ( + mu012 + mu210 ) + ( - vy ) ); //kn + (D.f[ DIR_0M0 ])[ks ] = c1o2*rho*(+ mu222 + ( - mu220 - mu022) + ( + mu020 ) + ( + mu212 ) + ( - mu012 - mu210 ) + ( + vy ) ); + (D.f[ DIR_00P ])[k ] = c1o2*rho*(+ mu222 + ( - mu202 - mu022) + ( + mu002) + ( - mu221 ) + ( + mu201 + mu021 ) + ( - vz ) ); //kt + (D.f[ DIR_00M ])[kb ] = c1o2*rho*(+ mu222 + ( - mu202 - mu022) + ( + mu002) + ( + mu221 ) + ( - mu201 - mu021 ) + ( + vz ) ); + (D.f[ DIR_PP0 ])[k ] = c1o4*rho*(- mu222 + ( - mu112 + mu220 ) + (+ mu110 ) + ( + mu212 + mu122) + ( - mu210 - mu120) ); //kne + (D.f[ DIR_MM0 ])[ksw ] = c1o4*rho*(- mu222 + ( - mu112 + mu220 ) + (+ mu110 ) + ( - mu212 - mu122) + ( + mu210 + mu120) ); + (D.f[ DIR_PM0 ])[ks ] = c1o4*rho*(- mu222 + ( + mu112 + mu220 ) + (- mu110 ) + ( - mu212 + mu122) + ( + mu210 - mu120) ); //kse + (D.f[ DIR_MP0 ])[kw ] = c1o4*rho*(- mu222 + ( + mu112 + mu220 ) + (- mu110 ) + ( + mu212 - mu122) + ( - mu210 + mu120) ); //knw + (D.f[ DIR_P0P ])[k ] = c1o4*rho*(- mu222 + ( - mu121 + mu202 ) + ( + mu101 ) + ( + mu221 + mu122) + ( - mu201 - mu102 ) ); //kte + (D.f[ DIR_M0M ])[kbw ] = c1o4*rho*(- mu222 + ( - mu121 + mu202 ) + ( + mu101 ) + ( - mu221 - mu122) + ( + mu201 + mu102 ) ); + (D.f[ DIR_P0M ])[kb ] = c1o4*rho*(- mu222 + ( + mu121 + mu202 ) + ( - mu101 ) + ( - mu221 + mu122) + ( + mu201 - mu102 ) ); //kbe + (D.f[ DIR_M0P ])[kw ] = c1o4*rho*(- mu222 + ( + mu121 + mu202 ) + ( - mu101 ) + ( + mu221 - mu122) + ( - mu201 + mu102 ) ); //ktw + (D.f[ DIR_0PP ])[k ] = c1o4*rho*(- mu222 + (- mu211 + mu022) + ( + mu011 ) + ( + mu221 + mu212 ) + ( - mu021 - mu012 ) ); //ktn + (D.f[ DIR_0MM ])[kbs ] = c1o4*rho*(- mu222 + (- mu211 + mu022) + ( + mu011 ) + ( - mu221 - mu212 ) + ( + mu021 + mu012 ) ); + (D.f[ DIR_0PM ])[kb ] = c1o4*rho*(- mu222 + (+ mu211 + mu022) + ( - mu011 ) + ( - mu221 + mu212 ) + ( + mu021 - mu012 ) ); //kbn + (D.f[ DIR_0MP ])[ks ] = c1o4*rho*(- mu222 + (+ mu211 + mu022) + ( - mu011 ) + ( + mu221 - mu212 ) + ( - mu021 + mu012 ) ); //kts + (D.f[ DIR_000])[k ] = rho*(- mu222 + ( + mu220 + mu202 + mu022) + ( - mu200 - mu020 - mu002) )+rho0; //kzero + (D.f[ DIR_PPP ])[k ] = c1o8*rho*(+ mu222 + (+ mu211 + mu121 + mu112 ) + ( - mu221 - mu212 - mu122) + ( - mu111 ) ); //ktne + (D.f[ DIR_PMP ])[ks ] = c1o8*rho*(+ mu222 + (- mu211 + mu121 - mu112 ) + ( - mu221 + mu212 - mu122) + ( + mu111 ) ); //ktse + (D.f[ DIR_PPM ])[kb ] = c1o8*rho*(+ mu222 + (- mu211 - mu121 + mu112 ) + ( + mu221 - mu212 - mu122) + ( + mu111 ) ); //kbne + (D.f[ DIR_PMM ])[kbs ] = c1o8*rho*(+ mu222 + (+ mu211 - mu121 - mu112 ) + ( + mu221 + mu212 - mu122) + ( - mu111 ) ); //kbse + (D.f[ DIR_MPP ])[kw ] = c1o8*rho*(+ mu222 + (+ mu211 - mu121 - mu112 ) + ( - mu221 - mu212 + mu122) + ( + mu111 ) ); //ktnw + (D.f[ DIR_MMP ])[ksw ] = c1o8*rho*(+ mu222 + (- mu211 - mu121 + mu112 ) + ( - mu221 + mu212 + mu122) + ( - mu111 ) ); //ktsw + (D.f[ DIR_MPM ])[kbw ] = c1o8*rho*(+ mu222 + (- mu211 + mu121 - mu112 ) + ( + mu221 - mu212 + mu122) + ( - mu111 ) ); //kbnw + (D.f[ DIR_MMM ])[kbsw] = c1o8*rho*(+ mu222 + (+ mu211 + mu121 + mu112 ) + ( + mu221 + mu212 + mu122) + ( + mu111 ) ); ////////////////////////////////////////////////////////////////////////// //BGK ////////////////////////////////////////////////////////////////////////// - //(D.f[ dirE ])[k ] = fW ; - //(D.f[ dirW ])[kw ] = fE ; - //(D.f[ dirN ])[k ] = fS ; - //(D.f[ dirS ])[ks ] = fN ; - //(D.f[ dirT ])[k ] = fB ; - //(D.f[ dirB ])[kb ] = fT ; - //(D.f[ dirNE ])[k ] = fSW ; - //(D.f[ dirSW ])[ksw ] = fNE ; - //(D.f[ dirSE ])[ks ] = fNW ; - //(D.f[ dirNW ])[kw ] = fSE ; - //(D.f[ dirTE ])[k ] = fBW ; - //(D.f[ dirBW ])[kbw ] = fTE ; - //(D.f[ dirBE ])[kb ] = fTW ; - //(D.f[ dirTW ])[kw ] = fBE ; - //(D.f[ dirTN ])[k ] = fBS ; - //(D.f[ dirBS ])[kbs ] = fTN ; - //(D.f[ dirBN ])[kb ] = fTS ; - //(D.f[ dirTS ])[ks ] = fBN ; - //(D.f[ dirZERO])[k ] = fZERO ; - //(D.f[ dirTNE ])[k ] = fBSW ; - //(D.f[ dirTSE ])[ks ] = fBNW ; - //(D.f[ dirBNE ])[kb ] = fTSW ; - //(D.f[ dirBSE ])[kbs ] = fTNW ; - //(D.f[ dirTNW ])[kw ] = fBSE ; - //(D.f[ dirTSW ])[ksw ] = fBNE ; - //(D.f[ dirBNW ])[kbw ] = fTSE ; - //(D.f[ dirBSW ])[kbsw] = fTNE ; + //(D.f[ DIR_P00 ])[k ] = fW ; + //(D.f[ DIR_M00 ])[kw ] = fE ; + //(D.f[ DIR_0P0 ])[k ] = fS ; + //(D.f[ DIR_0M0 ])[ks ] = fN ; + //(D.f[ DIR_00P ])[k ] = fB ; + //(D.f[ DIR_00M ])[kb ] = fT ; + //(D.f[ DIR_PP0 ])[k ] = fSW ; + //(D.f[ DIR_MM0 ])[ksw ] = fNE ; + //(D.f[ DIR_PM0 ])[ks ] = fNW ; + //(D.f[ DIR_MP0 ])[kw ] = fSE ; + //(D.f[ DIR_P0P ])[k ] = fBW ; + //(D.f[ DIR_M0M ])[kbw ] = fTE ; + //(D.f[ DIR_P0M ])[kb ] = fTW ; + //(D.f[ DIR_M0P ])[kw ] = fBE ; + //(D.f[ DIR_0PP ])[k ] = fBS ; + //(D.f[ DIR_0MM ])[kbs ] = fTN ; + //(D.f[ DIR_0PM ])[kb ] = fTS ; + //(D.f[ DIR_0MP ])[ks ] = fBN ; + //(D.f[ DIR_000])[k ] = fZERO ; + //(D.f[ DIR_PPP ])[k ] = fBSW ; + //(D.f[ DIR_PMP ])[ks ] = fBNW ; + //(D.f[ DIR_PPM ])[kb ] = fTSW ; + //(D.f[ DIR_PMM ])[kbs ] = fTNW ; + //(D.f[ DIR_MPP ])[kw ] = fBSE ; + //(D.f[ DIR_MMP ])[ksw ] = fBNE ; + //(D.f[ DIR_MPM ])[kbw ] = fTSE ; + //(D.f[ DIR_MMM ])[kbsw] = fTNE ; } } } @@ -2313,7 +2315,7 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_OHM_27( real omega, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Casc_SP_MS_27( real omega, +__global__ void LB_Kernel_Casc_SP_MS_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -2344,63 +2346,63 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_27( real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -2433,33 +2435,33 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_27( real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real fE = (D.f[dirE ])[k ];//ke - real fW = (D.f[dirW ])[kw ]; - real fN = (D.f[dirN ])[k ];//kn - real fS = (D.f[dirS ])[ks ]; - real fT = (D.f[dirT ])[k ];//kt - real fB = (D.f[dirB ])[kb ]; - real fNE = (D.f[dirNE ])[k ];//kne - real fSW = (D.f[dirSW ])[ksw]; - real fSE = (D.f[dirSE ])[ks ];//kse - real fNW = (D.f[dirNW ])[kw ];//knw - real fTE = (D.f[dirTE ])[k ];//kte - real fBW = (D.f[dirBW ])[kbw]; - real fBE = (D.f[dirBE ])[kb ];//kbe - real fTW = (D.f[dirTW ])[kw ];//ktw - real fTN = (D.f[dirTN ])[k ];//ktn - real fBS = (D.f[dirBS ])[kbs]; - real fBN = (D.f[dirBN ])[kb ];//kbn - real fTS = (D.f[dirTS ])[ks ];//kts - real fZERO = (D.f[dirZERO])[k ];//kzero - real fTNE = (D.f[dirTNE ])[k ];//ktne - real fTSW = (D.f[dirTSW ])[ksw];//ktsw - real fTSE = (D.f[dirTSE ])[ks ];//ktse - real fTNW = (D.f[dirTNW ])[kw ];//ktnw - real fBNE = (D.f[dirBNE ])[kb ];//kbne - real fBSW = (D.f[dirBSW ])[kbsw]; - real fBSE = (D.f[dirBSE ])[kbs];//kbse - real fBNW = (D.f[dirBNW ])[kbw];//kbnw + real fE = (D.f[DIR_P00 ])[k ];//ke + real fW = (D.f[DIR_M00 ])[kw ]; + real fN = (D.f[DIR_0P0 ])[k ];//kn + real fS = (D.f[DIR_0M0 ])[ks ]; + real fT = (D.f[DIR_00P ])[k ];//kt + real fB = (D.f[DIR_00M ])[kb ]; + real fNE = (D.f[DIR_PP0 ])[k ];//kne + real fSW = (D.f[DIR_MM0 ])[ksw]; + real fSE = (D.f[DIR_PM0 ])[ks ];//kse + real fNW = (D.f[DIR_MP0 ])[kw ];//knw + real fTE = (D.f[DIR_P0P ])[k ];//kte + real fBW = (D.f[DIR_M0M ])[kbw]; + real fBE = (D.f[DIR_P0M ])[kb ];//kbe + real fTW = (D.f[DIR_M0P ])[kw ];//ktw + real fTN = (D.f[DIR_0PP ])[k ];//ktn + real fBS = (D.f[DIR_0MM ])[kbs]; + real fBN = (D.f[DIR_0PM ])[kb ];//kbn + real fTS = (D.f[DIR_0MP ])[ks ];//kts + real fZERO = (D.f[DIR_000])[k ];//kzero + real fTNE = (D.f[DIR_PPP ])[k ];//ktne + real fTSW = (D.f[DIR_MMP ])[ksw];//ktsw + real fTSE = (D.f[DIR_PMP ])[ks ];//ktse + real fTNW = (D.f[DIR_MPP ])[kw ];//ktnw + real fBNE = (D.f[DIR_PPM ])[kb ];//kbne + real fBSW = (D.f[DIR_MMM ])[kbsw]; + real fBSE = (D.f[DIR_PMM ])[kbs];//kbse + real fBNW = (D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////// real rho0 = fZERO+fE+fW+fN+fS+fT+fB+fNE+fSW+fSE+fNW+fTE+fBW+fBE+fTW+fTN+fBS+fBN+fTS+fTNE+fTSW+fTSE+fTNW+fBNE+fBSW+fBSE+fBNW; real rho = rho0 + c1o1; @@ -2735,65 +2737,65 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_27( real omega, c2o1*(vx2y*MzYZZ + vx*MzXYYZZ + vz*MzXXYYZ + vyz2*MzXXY + vx2z*MzYYZ + vxy2*MzXZZ + vxz2*MzXYY + vy*MzXXYZZ + vy2z*MzXXZ)+ c4o1*(vxy2z*MzXZ + vx2yz*MzYZ + vxyz2*MzXY + vxy*MzXYZZ + vxz*MzXYYZ + vyz*MzXXYZ); - (D.f[ dirE ])[k ] = c1o2*rho*( mu200 - mu220 + mu222 - mu202 + mu120 - mu122 + mu102 - vx ); //ke - (D.f[ dirW ])[kw ] = c1o2*rho*( mu200 - mu220 + mu222 - mu202 - mu120 + mu122 - mu102 + vx ); - (D.f[ dirN ])[k ] = c1o2*rho*( mu210 - mu220 + mu222 - mu212 + mu020 - mu022 + mu012 - vy ); //kn - (D.f[ dirS ])[ks ] = c1o2*rho*(-mu210 - mu220 + mu222 + mu212 + mu020 - mu022 - mu012 + vy ); - (D.f[ dirT ])[k ] = c1o2*rho*(-mu221 + mu222 + mu201 - mu202 + mu021 - mu022 + mu002 - vz ); //kt - (D.f[ dirB ])[kb ] = c1o2*rho*( mu221 + mu222 - mu201 - mu202 - mu021 - mu022 + mu002 + vz ); - (D.f[ dirNE ])[k ] = c1o4*rho*(-mu210 + mu220 - mu222 + mu212 + mu110 - mu120 + mu122 - mu112); //kne - (D.f[ dirSW ])[ksw ] = c1o4*rho*( mu210 + mu220 - mu222 - mu212 + mu110 + mu120 - mu122 - mu112); - (D.f[ dirSE ])[ks ] = c1o4*rho*( mu210 + mu220 - mu222 - mu212 - mu110 - mu120 + mu122 + mu112); //kse - (D.f[ dirNW ])[kw ] = c1o4*rho*(-mu210 + mu220 - mu222 + mu212 - mu110 + mu120 - mu122 + mu112); //knw - (D.f[ dirTE ])[k ] = c1o4*rho*( mu221 - mu222 - mu201 + mu202 - mu121 + mu122 + mu101 - mu102); //kte - (D.f[ dirBW ])[kbw ] = c1o4*rho*(-mu221 - mu222 + mu201 + mu202 - mu121 - mu122 + mu101 + mu102); - (D.f[ dirBE ])[kb ] = c1o4*rho*(-mu221 - mu222 + mu201 + mu202 + mu121 + mu122 - mu101 - mu102); //kbe - (D.f[ dirTW ])[kw ] = c1o4*rho*( mu221 - mu222 - mu201 + mu202 + mu121 - mu122 - mu101 + mu102); //ktw - (D.f[ dirTN ])[k ] = c1o4*rho*( mu221 - mu222 - mu211 + mu212 - mu021 + mu022 + mu011 - mu012); //ktn - (D.f[ dirBS ])[kbs ] = c1o4*rho*(-mu221 - mu222 - mu211 - mu212 + mu021 + mu022 + mu011 + mu012); - (D.f[ dirBN ])[kb ] = c1o4*rho*(-mu221 - mu222 + mu211 + mu212 + mu021 + mu022 - mu011 - mu012); //kbn - (D.f[ dirTS ])[ks ] = c1o4*rho*( mu221 - mu222 + mu211 - mu212 - mu021 + mu022 - mu011 + mu012); //kts - (D.f[ dirZERO])[k ] = rho*(-mu200 + mu220 - mu222 + mu202 - mu020 + mu022 - mu002 )+rho0; //kzero - (D.f[ dirTNE ])[k ] = c1o8*rho*(-mu221 + mu222 + mu211 - mu212 + mu121 - mu122 - mu111 + mu112); //ktne - (D.f[ dirTSE ])[ks ] = c1o8*rho*(-mu221 + mu222 - mu211 + mu212 + mu121 - mu122 + mu111 - mu112); //ktse - (D.f[ dirBNE ])[kb ] = c1o8*rho*( mu221 + mu222 - mu211 - mu212 - mu121 - mu122 + mu111 + mu112); //kbne - (D.f[ dirBSE ])[kbs ] = c1o8*rho*( mu221 + mu222 + mu211 + mu212 - mu121 - mu122 - mu111 - mu112); //kbse - (D.f[ dirTNW ])[kw ] = c1o8*rho*(-mu221 + mu222 + mu211 - mu212 - mu121 + mu122 + mu111 - mu112); //ktnw - (D.f[ dirTSW ])[ksw ] = c1o8*rho*(-mu221 + mu222 - mu211 + mu212 - mu121 + mu122 - mu111 + mu112); //ktsw - (D.f[ dirBNW ])[kbw ] = c1o8*rho*( mu221 + mu222 - mu211 - mu212 + mu121 + mu122 - mu111 - mu112); //kbnw - (D.f[ dirBSW ])[kbsw] = c1o8*rho*( mu221 + mu222 + mu211 + mu212 + mu121 + mu122 + mu111 + mu112); + (D.f[ DIR_P00 ])[k ] = c1o2*rho*( mu200 - mu220 + mu222 - mu202 + mu120 - mu122 + mu102 - vx ); //ke + (D.f[ DIR_M00 ])[kw ] = c1o2*rho*( mu200 - mu220 + mu222 - mu202 - mu120 + mu122 - mu102 + vx ); + (D.f[ DIR_0P0 ])[k ] = c1o2*rho*( mu210 - mu220 + mu222 - mu212 + mu020 - mu022 + mu012 - vy ); //kn + (D.f[ DIR_0M0 ])[ks ] = c1o2*rho*(-mu210 - mu220 + mu222 + mu212 + mu020 - mu022 - mu012 + vy ); + (D.f[ DIR_00P ])[k ] = c1o2*rho*(-mu221 + mu222 + mu201 - mu202 + mu021 - mu022 + mu002 - vz ); //kt + (D.f[ DIR_00M ])[kb ] = c1o2*rho*( mu221 + mu222 - mu201 - mu202 - mu021 - mu022 + mu002 + vz ); + (D.f[ DIR_PP0 ])[k ] = c1o4*rho*(-mu210 + mu220 - mu222 + mu212 + mu110 - mu120 + mu122 - mu112); //kne + (D.f[ DIR_MM0 ])[ksw ] = c1o4*rho*( mu210 + mu220 - mu222 - mu212 + mu110 + mu120 - mu122 - mu112); + (D.f[ DIR_PM0 ])[ks ] = c1o4*rho*( mu210 + mu220 - mu222 - mu212 - mu110 - mu120 + mu122 + mu112); //kse + (D.f[ DIR_MP0 ])[kw ] = c1o4*rho*(-mu210 + mu220 - mu222 + mu212 - mu110 + mu120 - mu122 + mu112); //knw + (D.f[ DIR_P0P ])[k ] = c1o4*rho*( mu221 - mu222 - mu201 + mu202 - mu121 + mu122 + mu101 - mu102); //kte + (D.f[ DIR_M0M ])[kbw ] = c1o4*rho*(-mu221 - mu222 + mu201 + mu202 - mu121 - mu122 + mu101 + mu102); + (D.f[ DIR_P0M ])[kb ] = c1o4*rho*(-mu221 - mu222 + mu201 + mu202 + mu121 + mu122 - mu101 - mu102); //kbe + (D.f[ DIR_M0P ])[kw ] = c1o4*rho*( mu221 - mu222 - mu201 + mu202 + mu121 - mu122 - mu101 + mu102); //ktw + (D.f[ DIR_0PP ])[k ] = c1o4*rho*( mu221 - mu222 - mu211 + mu212 - mu021 + mu022 + mu011 - mu012); //ktn + (D.f[ DIR_0MM ])[kbs ] = c1o4*rho*(-mu221 - mu222 - mu211 - mu212 + mu021 + mu022 + mu011 + mu012); + (D.f[ DIR_0PM ])[kb ] = c1o4*rho*(-mu221 - mu222 + mu211 + mu212 + mu021 + mu022 - mu011 - mu012); //kbn + (D.f[ DIR_0MP ])[ks ] = c1o4*rho*( mu221 - mu222 + mu211 - mu212 - mu021 + mu022 - mu011 + mu012); //kts + (D.f[ DIR_000])[k ] = rho*(-mu200 + mu220 - mu222 + mu202 - mu020 + mu022 - mu002 )+rho0; //kzero + (D.f[ DIR_PPP ])[k ] = c1o8*rho*(-mu221 + mu222 + mu211 - mu212 + mu121 - mu122 - mu111 + mu112); //ktne + (D.f[ DIR_PMP ])[ks ] = c1o8*rho*(-mu221 + mu222 - mu211 + mu212 + mu121 - mu122 + mu111 - mu112); //ktse + (D.f[ DIR_PPM ])[kb ] = c1o8*rho*( mu221 + mu222 - mu211 - mu212 - mu121 - mu122 + mu111 + mu112); //kbne + (D.f[ DIR_PMM ])[kbs ] = c1o8*rho*( mu221 + mu222 + mu211 + mu212 - mu121 - mu122 - mu111 - mu112); //kbse + (D.f[ DIR_MPP ])[kw ] = c1o8*rho*(-mu221 + mu222 + mu211 - mu212 - mu121 + mu122 + mu111 - mu112); //ktnw + (D.f[ DIR_MMP ])[ksw ] = c1o8*rho*(-mu221 + mu222 - mu211 + mu212 - mu121 + mu122 - mu111 + mu112); //ktsw + (D.f[ DIR_MPM ])[kbw ] = c1o8*rho*( mu221 + mu222 - mu211 - mu212 + mu121 + mu122 - mu111 - mu112); //kbnw + (D.f[ DIR_MMM ])[kbsw] = c1o8*rho*( mu221 + mu222 + mu211 + mu212 + mu121 + mu122 + mu111 + mu112); ////////////////////////////////////////////////////////////////////////// //BGK ////////////////////////////////////////////////////////////////////////// - //(D.f[ dirE ])[k ] = fW ; - //(D.f[ dirW ])[kw ] = fE ; - //(D.f[ dirN ])[k ] = fS ; - //(D.f[ dirS ])[ks ] = fN ; - //(D.f[ dirT ])[k ] = fB ; - //(D.f[ dirB ])[kb ] = fT ; - //(D.f[ dirNE ])[k ] = fSW ; - //(D.f[ dirSW ])[ksw ] = fNE ; - //(D.f[ dirSE ])[ks ] = fNW ; - //(D.f[ dirNW ])[kw ] = fSE ; - //(D.f[ dirTE ])[k ] = fBW ; - //(D.f[ dirBW ])[kbw ] = fTE ; - //(D.f[ dirBE ])[kb ] = fTW ; - //(D.f[ dirTW ])[kw ] = fBE ; - //(D.f[ dirTN ])[k ] = fBS ; - //(D.f[ dirBS ])[kbs ] = fTN ; - //(D.f[ dirBN ])[kb ] = fTS ; - //(D.f[ dirTS ])[ks ] = fBN ; - //(D.f[ dirZERO])[k ] = fZERO ; - //(D.f[ dirTNE ])[k ] = fBSW ; - //(D.f[ dirTSE ])[ks ] = fBNW ; - //(D.f[ dirBNE ])[kb ] = fTSW ; - //(D.f[ dirBSE ])[kbs ] = fTNW ; - //(D.f[ dirTNW ])[kw ] = fBSE ; - //(D.f[ dirTSW ])[ksw ] = fBNE ; - //(D.f[ dirBNW ])[kbw ] = fTSE ; - //(D.f[ dirBSW ])[kbsw] = fTNE ; + //(D.f[ DIR_P00 ])[k ] = fW ; + //(D.f[ DIR_M00 ])[kw ] = fE ; + //(D.f[ DIR_0P0 ])[k ] = fS ; + //(D.f[ DIR_0M0 ])[ks ] = fN ; + //(D.f[ DIR_00P ])[k ] = fB ; + //(D.f[ DIR_00M ])[kb ] = fT ; + //(D.f[ DIR_PP0 ])[k ] = fSW ; + //(D.f[ DIR_MM0 ])[ksw ] = fNE ; + //(D.f[ DIR_PM0 ])[ks ] = fNW ; + //(D.f[ DIR_MP0 ])[kw ] = fSE ; + //(D.f[ DIR_P0P ])[k ] = fBW ; + //(D.f[ DIR_M0M ])[kbw ] = fTE ; + //(D.f[ DIR_P0M ])[kb ] = fTW ; + //(D.f[ DIR_M0P ])[kw ] = fBE ; + //(D.f[ DIR_0PP ])[k ] = fBS ; + //(D.f[ DIR_0MM ])[kbs ] = fTN ; + //(D.f[ DIR_0PM ])[kb ] = fTS ; + //(D.f[ DIR_0MP ])[ks ] = fBN ; + //(D.f[ DIR_000])[k ] = fZERO ; + //(D.f[ DIR_PPP ])[k ] = fBSW ; + //(D.f[ DIR_PMP ])[ks ] = fBNW ; + //(D.f[ DIR_PPM ])[kb ] = fTSW ; + //(D.f[ DIR_PMM ])[kbs ] = fTNW ; + //(D.f[ DIR_MPP ])[kw ] = fBSE ; + //(D.f[ DIR_MMP ])[ksw ] = fBNE ; + //(D.f[ DIR_MPM ])[kbw ] = fTSE ; + //(D.f[ DIR_MMM ])[kbsw] = fTNE ; } } } @@ -2838,7 +2840,7 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_27( real omega, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Casc_SP_MS_Diff_27(real omega, +__global__ void LB_Kernel_Casc_SP_MS_Diff_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -2869,63 +2871,63 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_Diff_27(real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -2958,33 +2960,33 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_Diff_27(real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real fE = (D.f[dirE ])[k ];//ke - real fW = (D.f[dirW ])[kw ]; - real fN = (D.f[dirN ])[k ];//kn - real fS = (D.f[dirS ])[ks ]; - real fT = (D.f[dirT ])[k ];//kt - real fB = (D.f[dirB ])[kb ]; - real fNE = (D.f[dirNE ])[k ];//kne - real fSW = (D.f[dirSW ])[ksw]; - real fSE = (D.f[dirSE ])[ks ];//kse - real fNW = (D.f[dirNW ])[kw ];//knw - real fTE = (D.f[dirTE ])[k ];//kte - real fBW = (D.f[dirBW ])[kbw]; - real fBE = (D.f[dirBE ])[kb ];//kbe - real fTW = (D.f[dirTW ])[kw ];//ktw - real fTN = (D.f[dirTN ])[k ];//ktn - real fBS = (D.f[dirBS ])[kbs]; - real fBN = (D.f[dirBN ])[kb ];//kbn - real fTS = (D.f[dirTS ])[ks ];//kts - real fZERO = (D.f[dirZERO])[k ];//kzero - real fTNE = (D.f[dirTNE ])[k ];//ktne - real fTSW = (D.f[dirTSW ])[ksw];//ktsw - real fTSE = (D.f[dirTSE ])[ks ];//ktse - real fTNW = (D.f[dirTNW ])[kw ];//ktnw - real fBNE = (D.f[dirBNE ])[kb ];//kbne - real fBSW = (D.f[dirBSW ])[kbsw]; - real fBSE = (D.f[dirBSE ])[kbs];//kbse - real fBNW = (D.f[dirBNW ])[kbw];//kbnw + real fE = (D.f[DIR_P00 ])[k ];//ke + real fW = (D.f[DIR_M00 ])[kw ]; + real fN = (D.f[DIR_0P0 ])[k ];//kn + real fS = (D.f[DIR_0M0 ])[ks ]; + real fT = (D.f[DIR_00P ])[k ];//kt + real fB = (D.f[DIR_00M ])[kb ]; + real fNE = (D.f[DIR_PP0 ])[k ];//kne + real fSW = (D.f[DIR_MM0 ])[ksw]; + real fSE = (D.f[DIR_PM0 ])[ks ];//kse + real fNW = (D.f[DIR_MP0 ])[kw ];//knw + real fTE = (D.f[DIR_P0P ])[k ];//kte + real fBW = (D.f[DIR_M0M ])[kbw]; + real fBE = (D.f[DIR_P0M ])[kb ];//kbe + real fTW = (D.f[DIR_M0P ])[kw ];//ktw + real fTN = (D.f[DIR_0PP ])[k ];//ktn + real fBS = (D.f[DIR_0MM ])[kbs]; + real fBN = (D.f[DIR_0PM ])[kb ];//kbn + real fTS = (D.f[DIR_0MP ])[ks ];//kts + real fZERO = (D.f[DIR_000])[k ];//kzero + real fTNE = (D.f[DIR_PPP ])[k ];//ktne + real fTSW = (D.f[DIR_MMP ])[ksw];//ktsw + real fTSE = (D.f[DIR_PMP ])[ks ];//ktse + real fTNW = (D.f[DIR_MPP ])[kw ];//ktnw + real fBNE = (D.f[DIR_PPM ])[kb ];//kbne + real fBSW = (D.f[DIR_MMM ])[kbsw]; + real fBSE = (D.f[DIR_PMM ])[kbs];//kbse + real fBNW = (D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////// real rho0 = fZERO+fE+fW+fN+fS+fT+fB+fNE+fSW+fSE+fNW+fTE+fBW+fBE+fTW+fTN+fBS+fBN+fTS+fTNE+fTSW+fTSE+fTNW+fBNE+fBSW+fBSE+fBNW; real rho = rho0 + c1o1; @@ -3257,65 +3259,65 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_Diff_27(real omega, c2o1*(vx2y*MzYZZ + vx*MzXYYZZ + vz*MzXXYYZ + vyz2*MzXXY + vx2z*MzYYZ + vxy2*MzXZZ + vxz2*MzXYY + vy*MzXXYZZ + vy2z*MzXXZ)+ c4o1*(vxy2z*MzXZ + vx2yz*MzYZ + vxyz2*MzXY + vxy*MzXYZZ + vxz*MzXYYZ + vyz*MzXXYZ); - (D.f[ dirE ])[k ] = fW - c1o2*rho*( mu200 - mu220 + mu222 - mu202 + mu120 - mu122 + mu102 ); //ke - (D.f[ dirW ])[kw ] = fE - c1o2*rho*( mu200 - mu220 + mu222 - mu202 - mu120 + mu122 - mu102 ); - (D.f[ dirN ])[k ] = fS - c1o2*rho*( mu210 - mu220 + mu222 - mu212 + mu020 - mu022 + mu012 ); //kn - (D.f[ dirS ])[ks ] = fN - c1o2*rho*(-mu210 - mu220 + mu222 + mu212 + mu020 - mu022 - mu012 ); - (D.f[ dirT ])[k ] = fB - c1o2*rho*(-mu221 + mu222 + mu201 - mu202 + mu021 - mu022 + mu002 ); //kt - (D.f[ dirB ])[kb ] = fT - c1o2*rho*( mu221 + mu222 - mu201 - mu202 - mu021 - mu022 + mu002 ); - (D.f[ dirNE ])[k ] = fSW - c1o4*rho*(-mu210 + mu220 - mu222 + mu212 + mu110 - mu120 + mu122 - mu112); //kne - (D.f[ dirSW ])[ksw ] = fNE - c1o4*rho*( mu210 + mu220 - mu222 - mu212 + mu110 + mu120 - mu122 - mu112); - (D.f[ dirSE ])[ks ] = fNW - c1o4*rho*( mu210 + mu220 - mu222 - mu212 - mu110 - mu120 + mu122 + mu112); //kse - (D.f[ dirNW ])[kw ] = fSE - c1o4*rho*(-mu210 + mu220 - mu222 + mu212 - mu110 + mu120 - mu122 + mu112); //knw - (D.f[ dirTE ])[k ] = fBW - c1o4*rho*( mu221 - mu222 - mu201 + mu202 - mu121 + mu122 + mu101 - mu102); //kte - (D.f[ dirBW ])[kbw ] = fTE - c1o4*rho*(-mu221 - mu222 + mu201 + mu202 - mu121 - mu122 + mu101 + mu102); - (D.f[ dirBE ])[kb ] = fTW - c1o4*rho*(-mu221 - mu222 + mu201 + mu202 + mu121 + mu122 - mu101 - mu102); //kbe - (D.f[ dirTW ])[kw ] = fBE - c1o4*rho*( mu221 - mu222 - mu201 + mu202 + mu121 - mu122 - mu101 + mu102); //ktw - (D.f[ dirTN ])[k ] = fBS - c1o4*rho*( mu221 - mu222 - mu211 + mu212 - mu021 + mu022 + mu011 - mu012); //ktn - (D.f[ dirBS ])[kbs ] = fTN - c1o4*rho*(-mu221 - mu222 - mu211 - mu212 + mu021 + mu022 + mu011 + mu012); - (D.f[ dirBN ])[kb ] = fTS - c1o4*rho*(-mu221 - mu222 + mu211 + mu212 + mu021 + mu022 - mu011 - mu012); //kbn - (D.f[ dirTS ])[ks ] = fBN - c1o4*rho*( mu221 - mu222 + mu211 - mu212 - mu021 + mu022 - mu011 + mu012); //kts - (D.f[ dirZERO])[k ] = fZERO - rho*(-mu200 + mu220 - mu222 + mu202 - mu020 + mu022 - mu002 ); //kzero - (D.f[ dirTNE ])[k ] = fBSW - c1o8*rho*(-mu221 + mu222 + mu211 - mu212 + mu121 - mu122 - mu111 + mu112); //ktne - (D.f[ dirTSE ])[ks ] = fBNW - c1o8*rho*(-mu221 + mu222 - mu211 + mu212 + mu121 - mu122 + mu111 - mu112); //ktse - (D.f[ dirBNE ])[kb ] = fTSW - c1o8*rho*( mu221 + mu222 - mu211 - mu212 - mu121 - mu122 + mu111 + mu112); //kbne - (D.f[ dirBSE ])[kbs ] = fTNW - c1o8*rho*( mu221 + mu222 + mu211 + mu212 - mu121 - mu122 - mu111 - mu112); //kbse - (D.f[ dirTNW ])[kw ] = fBSE - c1o8*rho*(-mu221 + mu222 + mu211 - mu212 - mu121 + mu122 + mu111 - mu112); //ktnw - (D.f[ dirTSW ])[ksw ] = fBNE - c1o8*rho*(-mu221 + mu222 - mu211 + mu212 - mu121 + mu122 - mu111 + mu112); //ktsw - (D.f[ dirBNW ])[kbw ] = fTSE - c1o8*rho*( mu221 + mu222 - mu211 - mu212 + mu121 + mu122 - mu111 - mu112); //kbnw - (D.f[ dirBSW ])[kbsw] = fTNE - c1o8*rho*( mu221 + mu222 + mu211 + mu212 + mu121 + mu122 + mu111 + mu112); + (D.f[ DIR_P00 ])[k ] = fW - c1o2*rho*( mu200 - mu220 + mu222 - mu202 + mu120 - mu122 + mu102 ); //ke + (D.f[ DIR_M00 ])[kw ] = fE - c1o2*rho*( mu200 - mu220 + mu222 - mu202 - mu120 + mu122 - mu102 ); + (D.f[ DIR_0P0 ])[k ] = fS - c1o2*rho*( mu210 - mu220 + mu222 - mu212 + mu020 - mu022 + mu012 ); //kn + (D.f[ DIR_0M0 ])[ks ] = fN - c1o2*rho*(-mu210 - mu220 + mu222 + mu212 + mu020 - mu022 - mu012 ); + (D.f[ DIR_00P ])[k ] = fB - c1o2*rho*(-mu221 + mu222 + mu201 - mu202 + mu021 - mu022 + mu002 ); //kt + (D.f[ DIR_00M ])[kb ] = fT - c1o2*rho*( mu221 + mu222 - mu201 - mu202 - mu021 - mu022 + mu002 ); + (D.f[ DIR_PP0 ])[k ] = fSW - c1o4*rho*(-mu210 + mu220 - mu222 + mu212 + mu110 - mu120 + mu122 - mu112); //kne + (D.f[ DIR_MM0 ])[ksw ] = fNE - c1o4*rho*( mu210 + mu220 - mu222 - mu212 + mu110 + mu120 - mu122 - mu112); + (D.f[ DIR_PM0 ])[ks ] = fNW - c1o4*rho*( mu210 + mu220 - mu222 - mu212 - mu110 - mu120 + mu122 + mu112); //kse + (D.f[ DIR_MP0 ])[kw ] = fSE - c1o4*rho*(-mu210 + mu220 - mu222 + mu212 - mu110 + mu120 - mu122 + mu112); //knw + (D.f[ DIR_P0P ])[k ] = fBW - c1o4*rho*( mu221 - mu222 - mu201 + mu202 - mu121 + mu122 + mu101 - mu102); //kte + (D.f[ DIR_M0M ])[kbw ] = fTE - c1o4*rho*(-mu221 - mu222 + mu201 + mu202 - mu121 - mu122 + mu101 + mu102); + (D.f[ DIR_P0M ])[kb ] = fTW - c1o4*rho*(-mu221 - mu222 + mu201 + mu202 + mu121 + mu122 - mu101 - mu102); //kbe + (D.f[ DIR_M0P ])[kw ] = fBE - c1o4*rho*( mu221 - mu222 - mu201 + mu202 + mu121 - mu122 - mu101 + mu102); //ktw + (D.f[ DIR_0PP ])[k ] = fBS - c1o4*rho*( mu221 - mu222 - mu211 + mu212 - mu021 + mu022 + mu011 - mu012); //ktn + (D.f[ DIR_0MM ])[kbs ] = fTN - c1o4*rho*(-mu221 - mu222 - mu211 - mu212 + mu021 + mu022 + mu011 + mu012); + (D.f[ DIR_0PM ])[kb ] = fTS - c1o4*rho*(-mu221 - mu222 + mu211 + mu212 + mu021 + mu022 - mu011 - mu012); //kbn + (D.f[ DIR_0MP ])[ks ] = fBN - c1o4*rho*( mu221 - mu222 + mu211 - mu212 - mu021 + mu022 - mu011 + mu012); //kts + (D.f[ DIR_000])[k ] = fZERO - rho*(-mu200 + mu220 - mu222 + mu202 - mu020 + mu022 - mu002 ); //kzero + (D.f[ DIR_PPP ])[k ] = fBSW - c1o8*rho*(-mu221 + mu222 + mu211 - mu212 + mu121 - mu122 - mu111 + mu112); //ktne + (D.f[ DIR_PMP ])[ks ] = fBNW - c1o8*rho*(-mu221 + mu222 - mu211 + mu212 + mu121 - mu122 + mu111 - mu112); //ktse + (D.f[ DIR_PPM ])[kb ] = fTSW - c1o8*rho*( mu221 + mu222 - mu211 - mu212 - mu121 - mu122 + mu111 + mu112); //kbne + (D.f[ DIR_PMM ])[kbs ] = fTNW - c1o8*rho*( mu221 + mu222 + mu211 + mu212 - mu121 - mu122 - mu111 - mu112); //kbse + (D.f[ DIR_MPP ])[kw ] = fBSE - c1o8*rho*(-mu221 + mu222 + mu211 - mu212 - mu121 + mu122 + mu111 - mu112); //ktnw + (D.f[ DIR_MMP ])[ksw ] = fBNE - c1o8*rho*(-mu221 + mu222 - mu211 + mu212 - mu121 + mu122 - mu111 + mu112); //ktsw + (D.f[ DIR_MPM ])[kbw ] = fTSE - c1o8*rho*( mu221 + mu222 - mu211 - mu212 + mu121 + mu122 - mu111 - mu112); //kbnw + (D.f[ DIR_MMM ])[kbsw] = fTNE - c1o8*rho*( mu221 + mu222 + mu211 + mu212 + mu121 + mu122 + mu111 + mu112); ////////////////////////////////////////////////////////////////////////// //BGK ////////////////////////////////////////////////////////////////////////// - //(D.f[ dirE ])[k ] = fW ; - //(D.f[ dirW ])[kw ] = fE ; - //(D.f[ dirN ])[k ] = fS ; - //(D.f[ dirS ])[ks ] = fN ; - //(D.f[ dirT ])[k ] = fB ; - //(D.f[ dirB ])[kb ] = fT ; - //(D.f[ dirNE ])[k ] = fSW ; - //(D.f[ dirSW ])[ksw ] = fNE ; - //(D.f[ dirSE ])[ks ] = fNW ; - //(D.f[ dirNW ])[kw ] = fSE ; - //(D.f[ dirTE ])[k ] = fBW ; - //(D.f[ dirBW ])[kbw ] = fTE ; - //(D.f[ dirBE ])[kb ] = fTW ; - //(D.f[ dirTW ])[kw ] = fBE ; - //(D.f[ dirTN ])[k ] = fBS ; - //(D.f[ dirBS ])[kbs ] = fTN ; - //(D.f[ dirBN ])[kb ] = fTS ; - //(D.f[ dirTS ])[ks ] = fBN ; - //(D.f[ dirZERO])[k ] = fZERO ; - //(D.f[ dirTNE ])[k ] = fBSW ; - //(D.f[ dirTSE ])[ks ] = fBNW ; - //(D.f[ dirBNE ])[kb ] = fTSW ; - //(D.f[ dirBSE ])[kbs ] = fTNW ; - //(D.f[ dirTNW ])[kw ] = fBSE ; - //(D.f[ dirTSW ])[ksw ] = fBNE ; - //(D.f[ dirBNW ])[kbw ] = fTSE ; - //(D.f[ dirBSW ])[kbsw] = fTNE ; + //(D.f[ DIR_P00 ])[k ] = fW ; + //(D.f[ DIR_M00 ])[kw ] = fE ; + //(D.f[ DIR_0P0 ])[k ] = fS ; + //(D.f[ DIR_0M0 ])[ks ] = fN ; + //(D.f[ DIR_00P ])[k ] = fB ; + //(D.f[ DIR_00M ])[kb ] = fT ; + //(D.f[ DIR_PP0 ])[k ] = fSW ; + //(D.f[ DIR_MM0 ])[ksw ] = fNE ; + //(D.f[ DIR_PM0 ])[ks ] = fNW ; + //(D.f[ DIR_MP0 ])[kw ] = fSE ; + //(D.f[ DIR_P0P ])[k ] = fBW ; + //(D.f[ DIR_M0M ])[kbw ] = fTE ; + //(D.f[ DIR_P0M ])[kb ] = fTW ; + //(D.f[ DIR_M0P ])[kw ] = fBE ; + //(D.f[ DIR_0PP ])[k ] = fBS ; + //(D.f[ DIR_0MM ])[kbs ] = fTN ; + //(D.f[ DIR_0PM ])[kb ] = fTS ; + //(D.f[ DIR_0MP ])[ks ] = fBN ; + //(D.f[ DIR_000])[k ] = fZERO ; + //(D.f[ DIR_PPP ])[k ] = fBSW ; + //(D.f[ DIR_PMP ])[ks ] = fBNW ; + //(D.f[ DIR_PPM ])[kb ] = fTSW ; + //(D.f[ DIR_PMM ])[kbs ] = fTNW ; + //(D.f[ DIR_MPP ])[kw ] = fBSE ; + //(D.f[ DIR_MMP ])[ksw ] = fBNE ; + //(D.f[ DIR_MPM ])[kbw ] = fTSE ; + //(D.f[ DIR_MMM ])[kbsw] = fTNE ; } } } @@ -3360,7 +3362,7 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_Diff_27(real omega, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Casc_SP_27( real omega, +__global__ void LB_Kernel_Casc_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -3391,63 +3393,63 @@ extern "C" __global__ void LB_Kernel_Casc_SP_27( real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -3510,33 +3512,33 @@ extern "C" __global__ void LB_Kernel_Casc_SP_27( real omega, ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real f_E,f_W,f_N,f_S,f_T,f_B,f_NE,f_SW,f_SE,f_NW,f_TE,f_BW,f_BE,f_TW,f_TN,f_BS,f_BN,f_TS,f_ZERO, f_TNE,f_TNW,f_TSE,f_TSW, f_BNE,f_BNW,f_BSE,f_BSW; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - f_E = (D.f[dirE ])[ke]+c2o27; - f_W = (D.f[dirW ])[kw]+c2o27; - f_N = (D.f[dirN ])[kn]+c2o27; - f_S = (D.f[dirS ])[ks]+c2o27; - f_T = (D.f[dirT ])[kt]+c2o27; - f_B = (D.f[dirB ])[kb]+c2o27; - f_NE = (D.f[dirNE ])[kne]+c1o54; - f_SW = (D.f[dirSW ])[ksw]+c1o54; - f_SE = (D.f[dirSE ])[kse]+c1o54; - f_NW = (D.f[dirNW ])[knw]+c1o54; - f_TE = (D.f[dirTE ])[kte]+c1o54; - f_BW = (D.f[dirBW ])[kbw]+c1o54; - f_BE = (D.f[dirBE ])[kbe]+c1o54; - f_TW = (D.f[dirTW ])[ktw]+c1o54; - f_TN = (D.f[dirTN ])[ktn]+c1o54; - f_BS = (D.f[dirBS ])[kbs]+c1o54; - f_BN = (D.f[dirBN ])[kbn]+c1o54; - f_TS = (D.f[dirTS ])[kts]+c1o54; - f_ZERO = (D.f[dirZERO])[kzero]+c8o27; - f_TNE = (D.f[dirTNE ])[ktne]+c1o216; - f_TSW = (D.f[dirTSW ])[ktsw]+c1o216; - f_TSE = (D.f[dirTSE ])[ktse]+c1o216; - f_TNW = (D.f[dirTNW ])[ktnw]+c1o216; - f_BNE = (D.f[dirBNE ])[kbne]+c1o216; - f_BSW = (D.f[dirBSW ])[kbsw]+c1o216; - f_BSE = (D.f[dirBSE ])[kbse]+c1o216; - f_BNW = (D.f[dirBNW ])[kbnw]+c1o216; + f_E = (D.f[DIR_P00 ])[ke]+c2o27; + f_W = (D.f[DIR_M00 ])[kw]+c2o27; + f_N = (D.f[DIR_0P0 ])[kn]+c2o27; + f_S = (D.f[DIR_0M0 ])[ks]+c2o27; + f_T = (D.f[DIR_00P ])[kt]+c2o27; + f_B = (D.f[DIR_00M ])[kb]+c2o27; + f_NE = (D.f[DIR_PP0 ])[kne]+c1o54; + f_SW = (D.f[DIR_MM0 ])[ksw]+c1o54; + f_SE = (D.f[DIR_PM0 ])[kse]+c1o54; + f_NW = (D.f[DIR_MP0 ])[knw]+c1o54; + f_TE = (D.f[DIR_P0P ])[kte]+c1o54; + f_BW = (D.f[DIR_M0M ])[kbw]+c1o54; + f_BE = (D.f[DIR_P0M ])[kbe]+c1o54; + f_TW = (D.f[DIR_M0P ])[ktw]+c1o54; + f_TN = (D.f[DIR_0PP ])[ktn]+c1o54; + f_BS = (D.f[DIR_0MM ])[kbs]+c1o54; + f_BN = (D.f[DIR_0PM ])[kbn]+c1o54; + f_TS = (D.f[DIR_0MP ])[kts]+c1o54; + f_ZERO = (D.f[DIR_000])[kzero]+c8o27; + f_TNE = (D.f[DIR_PPP ])[ktne]+c1o216; + f_TSW = (D.f[DIR_MMP ])[ktsw]+c1o216; + f_TSE = (D.f[DIR_PMP ])[ktse]+c1o216; + f_TNW = (D.f[DIR_MPP ])[ktnw]+c1o216; + f_BNE = (D.f[DIR_PPM ])[kbne]+c1o216; + f_BSW = (D.f[DIR_MMM ])[kbsw]+c1o216; + f_BSE = (D.f[DIR_PMM ])[kbse]+c1o216; + f_BNW = (D.f[DIR_MPM ])[kbnw]+c1o216; //////////////////////////////////////////////////////////////////////////////// if( BC == GEO_FLUID || BC == GEO_VELO) @@ -3975,38 +3977,38 @@ extern "C" __global__ void LB_Kernel_Casc_SP_27( real omega, } } - (D.f[ dirE ])[ke ] = f_W-c2o27; - (D.f[ dirW ])[kw ] = f_E-c2o27; - - (D.f[ dirN ])[kn ] = f_S-c2o27; - (D.f[ dirS ])[ks ] = f_N-c2o27; - (D.f[ dirT ])[kt ] = f_B-c2o27; - (D.f[ dirB ])[kb ] = f_T-c2o27; - - (D.f[ dirNE ])[kne] = f_SW-c1o54; - (D.f[ dirSW ])[ksw] = f_NE-c1o54; - (D.f[ dirSE ])[kse] = f_NW-c1o54; - (D.f[ dirNW ])[knw] = f_SE-c1o54; - (D.f[ dirTE ])[kte] = f_BW-c1o54; - (D.f[ dirBW ])[kbw] = f_TE-c1o54; - (D.f[ dirBE ])[kbe] = f_TW-c1o54; - (D.f[ dirTW ])[ktw] = f_BE-c1o54; - - (D.f[ dirTN ])[ktn] = f_BS-c1o54; - (D.f[ dirBS ])[kbs] = f_TN-c1o54; - (D.f[ dirBN ])[kbn] = f_TS-c1o54; - (D.f[ dirTS ])[kts] = f_BN-c1o54; - - (D.f[ dirZERO])[k] = f_ZERO-c8o27; - - (D.f[ dirTNE ])[ktne] = f_BSW-c1o216; - (D.f[ dirTSE ])[ktse] = f_BNW-c1o216; - (D.f[ dirBNE ])[kbne] = f_TSW-c1o216; - (D.f[ dirBSE ])[kbse] = f_TNW-c1o216; - (D.f[ dirTNW ])[ktnw] = f_BSE-c1o216; - (D.f[ dirTSW ])[ktsw] = f_BNE-c1o216; - (D.f[ dirBNW ])[kbnw] = f_TSE-c1o216; - (D.f[ dirBSW ])[kbsw] = f_TNE-c1o216; + (D.f[ DIR_P00 ])[ke ] = f_W-c2o27; + (D.f[ DIR_M00 ])[kw ] = f_E-c2o27; + + (D.f[ DIR_0P0 ])[kn ] = f_S-c2o27; + (D.f[ DIR_0M0 ])[ks ] = f_N-c2o27; + (D.f[ DIR_00P ])[kt ] = f_B-c2o27; + (D.f[ DIR_00M ])[kb ] = f_T-c2o27; + + (D.f[ DIR_PP0 ])[kne] = f_SW-c1o54; + (D.f[ DIR_MM0 ])[ksw] = f_NE-c1o54; + (D.f[ DIR_PM0 ])[kse] = f_NW-c1o54; + (D.f[ DIR_MP0 ])[knw] = f_SE-c1o54; + (D.f[ DIR_P0P ])[kte] = f_BW-c1o54; + (D.f[ DIR_M0M ])[kbw] = f_TE-c1o54; + (D.f[ DIR_P0M ])[kbe] = f_TW-c1o54; + (D.f[ DIR_M0P ])[ktw] = f_BE-c1o54; + + (D.f[ DIR_0PP ])[ktn] = f_BS-c1o54; + (D.f[ DIR_0MM ])[kbs] = f_TN-c1o54; + (D.f[ DIR_0PM ])[kbn] = f_TS-c1o54; + (D.f[ DIR_0MP ])[kts] = f_BN-c1o54; + + (D.f[ DIR_000])[k] = f_ZERO-c8o27; + + (D.f[ DIR_PPP ])[ktne] = f_BSW-c1o216; + (D.f[ DIR_PMP ])[ktse] = f_BNW-c1o216; + (D.f[ DIR_PPM ])[kbne] = f_TSW-c1o216; + (D.f[ DIR_PMM ])[kbse] = f_TNW-c1o216; + (D.f[ DIR_MPP ])[ktnw] = f_BSE-c1o216; + (D.f[ DIR_MMP ])[ktsw] = f_BNE-c1o216; + (D.f[ DIR_MPM ])[kbnw] = f_TSE-c1o216; + (D.f[ DIR_MMM ])[kbsw] = f_TNE-c1o216; } __syncthreads(); } @@ -4052,7 +4054,7 @@ extern "C" __global__ void LB_Kernel_Casc_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Casc27(real omega, +__global__ void LB_Kernel_Casc27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -4087,63 +4089,63 @@ extern "C" __global__ void LB_Kernel_Casc27(real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -4206,33 +4208,33 @@ extern "C" __global__ void LB_Kernel_Casc27(real omega, ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real f_E,f_W,f_N,f_S,f_T,f_B,f_NE,f_SW,f_SE,f_NW,f_TE,f_BW,f_BE,f_TW,f_TN,f_BS,f_BN,f_TS,f_ZERO, f_TNE,f_TNW,f_TSE,f_TSW, f_BNE,f_BNW,f_BSE,f_BSW; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - f_E = (D.f[dirE ])[ke]+c2o27; - f_W = (D.f[dirW ])[kw]+c2o27; - f_N = (D.f[dirN ])[kn]+c2o27; - f_S = (D.f[dirS ])[ks]+c2o27; - f_T = (D.f[dirT ])[kt]+c2o27; - f_B = (D.f[dirB ])[kb]+c2o27; - f_NE = (D.f[dirNE ])[kne]+c1o54; - f_SW = (D.f[dirSW ])[ksw]+c1o54; - f_SE = (D.f[dirSE ])[kse]+c1o54; - f_NW = (D.f[dirNW ])[knw]+c1o54; - f_TE = (D.f[dirTE ])[kte]+c1o54; - f_BW = (D.f[dirBW ])[kbw]+c1o54; - f_BE = (D.f[dirBE ])[kbe]+c1o54; - f_TW = (D.f[dirTW ])[ktw]+c1o54; - f_TN = (D.f[dirTN ])[ktn]+c1o54; - f_BS = (D.f[dirBS ])[kbs]+c1o54; - f_BN = (D.f[dirBN ])[kbn]+c1o54; - f_TS = (D.f[dirTS ])[kts]+c1o54; - f_ZERO = (D.f[dirZERO])[kzero]+c8o27; - f_TNE = (D.f[dirTNE ])[ktne]+c1o216; - f_TSW = (D.f[dirTSW ])[ktsw]+c1o216; - f_TSE = (D.f[dirTSE ])[ktse]+c1o216; - f_TNW = (D.f[dirTNW ])[ktnw]+c1o216; - f_BNE = (D.f[dirBNE ])[kbne]+c1o216; - f_BSW = (D.f[dirBSW ])[kbsw]+c1o216; - f_BSE = (D.f[dirBSE ])[kbse]+c1o216; - f_BNW = (D.f[dirBNW ])[kbnw]+c1o216; + f_E = (D.f[DIR_P00 ])[ke]+c2o27; + f_W = (D.f[DIR_M00 ])[kw]+c2o27; + f_N = (D.f[DIR_0P0 ])[kn]+c2o27; + f_S = (D.f[DIR_0M0 ])[ks]+c2o27; + f_T = (D.f[DIR_00P ])[kt]+c2o27; + f_B = (D.f[DIR_00M ])[kb]+c2o27; + f_NE = (D.f[DIR_PP0 ])[kne]+c1o54; + f_SW = (D.f[DIR_MM0 ])[ksw]+c1o54; + f_SE = (D.f[DIR_PM0 ])[kse]+c1o54; + f_NW = (D.f[DIR_MP0 ])[knw]+c1o54; + f_TE = (D.f[DIR_P0P ])[kte]+c1o54; + f_BW = (D.f[DIR_M0M ])[kbw]+c1o54; + f_BE = (D.f[DIR_P0M ])[kbe]+c1o54; + f_TW = (D.f[DIR_M0P ])[ktw]+c1o54; + f_TN = (D.f[DIR_0PP ])[ktn]+c1o54; + f_BS = (D.f[DIR_0MM ])[kbs]+c1o54; + f_BN = (D.f[DIR_0PM ])[kbn]+c1o54; + f_TS = (D.f[DIR_0MP ])[kts]+c1o54; + f_ZERO = (D.f[DIR_000])[kzero]+c8o27; + f_TNE = (D.f[DIR_PPP ])[ktne]+c1o216; + f_TSW = (D.f[DIR_MMP ])[ktsw]+c1o216; + f_TSE = (D.f[DIR_PMP ])[ktse]+c1o216; + f_TNW = (D.f[DIR_MPP ])[ktnw]+c1o216; + f_BNE = (D.f[DIR_PPM ])[kbne]+c1o216; + f_BSW = (D.f[DIR_MMM ])[kbsw]+c1o216; + f_BSE = (D.f[DIR_PMM ])[kbse]+c1o216; + f_BNW = (D.f[DIR_MPM ])[kbnw]+c1o216; //////////////////////////////////////////////////////////////////////////////// if( BC == GEO_FLUID || BC == GEO_VELO) @@ -4671,38 +4673,38 @@ extern "C" __global__ void LB_Kernel_Casc27(real omega, } } - (D.f[ dirE ])[ke ] = f_W-c2o27; - (D.f[ dirW ])[kw ] = f_E-c2o27; - - (D.f[ dirN ])[kn ] = f_S-c2o27; - (D.f[ dirS ])[ks ] = f_N-c2o27; - (D.f[ dirT ])[kt ] = f_B-c2o27; - (D.f[ dirB ])[kb ] = f_T-c2o27; - - (D.f[ dirNE ])[kne] = f_SW-c1o54; - (D.f[ dirSW ])[ksw] = f_NE-c1o54; - (D.f[ dirSE ])[kse] = f_NW-c1o54; - (D.f[ dirNW ])[knw] = f_SE-c1o54; - (D.f[ dirTE ])[kte] = f_BW-c1o54; - (D.f[ dirBW ])[kbw] = f_TE-c1o54; - (D.f[ dirBE ])[kbe] = f_TW-c1o54; - (D.f[ dirTW ])[ktw] = f_BE-c1o54; - - (D.f[ dirTN ])[ktn] = f_BS-c1o54; - (D.f[ dirBS ])[kbs] = f_TN-c1o54; - (D.f[ dirBN ])[kbn] = f_TS-c1o54; - (D.f[ dirTS ])[kts] = f_BN-c1o54; - - (D.f[ dirZERO])[k] = f_ZERO-c8o27; - - (D.f[ dirTNE ])[ktne] = f_BSW-c1o216; - (D.f[ dirTSE ])[ktse] = f_BNW-c1o216; - (D.f[ dirBNE ])[kbne] = f_TSW-c1o216; - (D.f[ dirBSE ])[kbse] = f_TNW-c1o216; - (D.f[ dirTNW ])[ktnw] = f_BSE-c1o216; - (D.f[ dirTSW ])[ktsw] = f_BNE-c1o216; - (D.f[ dirBNW ])[kbnw] = f_TSE-c1o216; - (D.f[ dirBSW ])[kbsw] = f_TNE-c1o216; + (D.f[ DIR_P00 ])[ke ] = f_W-c2o27; + (D.f[ DIR_M00 ])[kw ] = f_E-c2o27; + + (D.f[ DIR_0P0 ])[kn ] = f_S-c2o27; + (D.f[ DIR_0M0 ])[ks ] = f_N-c2o27; + (D.f[ DIR_00P ])[kt ] = f_B-c2o27; + (D.f[ DIR_00M ])[kb ] = f_T-c2o27; + + (D.f[ DIR_PP0 ])[kne] = f_SW-c1o54; + (D.f[ DIR_MM0 ])[ksw] = f_NE-c1o54; + (D.f[ DIR_PM0 ])[kse] = f_NW-c1o54; + (D.f[ DIR_MP0 ])[knw] = f_SE-c1o54; + (D.f[ DIR_P0P ])[kte] = f_BW-c1o54; + (D.f[ DIR_M0M ])[kbw] = f_TE-c1o54; + (D.f[ DIR_P0M ])[kbe] = f_TW-c1o54; + (D.f[ DIR_M0P ])[ktw] = f_BE-c1o54; + + (D.f[ DIR_0PP ])[ktn] = f_BS-c1o54; + (D.f[ DIR_0MM ])[kbs] = f_TN-c1o54; + (D.f[ DIR_0PM ])[kbn] = f_TS-c1o54; + (D.f[ DIR_0MP ])[kts] = f_BN-c1o54; + + (D.f[ DIR_000])[k] = f_ZERO-c8o27; + + (D.f[ DIR_PPP ])[ktne] = f_BSW-c1o216; + (D.f[ DIR_PMP ])[ktse] = f_BNW-c1o216; + (D.f[ DIR_PPM ])[kbne] = f_TSW-c1o216; + (D.f[ DIR_PMM ])[kbse] = f_TNW-c1o216; + (D.f[ DIR_MPP ])[ktnw] = f_BSE-c1o216; + (D.f[ DIR_MMP ])[ktsw] = f_BNE-c1o216; + (D.f[ DIR_MPM ])[kbnw] = f_TSE-c1o216; + (D.f[ DIR_MMM ])[kbsw] = f_TNE-c1o216; } __syncthreads(); } diff --git a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp index 7074a222b7f90003d4db62dcded33fb582b5d2bb..22192216927f91c33fafc23c54c3fae334abdd34 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp +++ b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp @@ -5,12 +5,13 @@ #include <math.h> #include <Parameter/Parameter.h> -#include <PreCollisionInteractor/ActuatorLine.h> -#include <PreCollisionInteractor/Probes/Probe.h> +#include "Parameter/CudaStreamManager.h" +#include "PreCollisionInteractor/ActuatorLine.h" +#include "PreCollisionInteractor/Probes/Probe.h" #include "Calculation/PorousMedia.h" -#include <lbm/constants/NumericConstants.h> +#include "lbm/constants/NumericConstants.h" void CudaMemoryManager::cudaAllocFull(int lev) { @@ -24,11 +25,23 @@ void CudaMemoryManager::cudaFreeFull(int lev) } void CudaMemoryManager::cudaCopyPrint(int lev) { - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vx_SP , parameter->getParD(lev)->vx_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vy_SP , parameter->getParD(lev)->vy_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vz_SP , parameter->getParD(lev)->vz_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->rho_SP , parameter->getParD(lev)->rho_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->press_SP, parameter->getParD(lev)->press_SP, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->velocityX , parameter->getParD(lev)->velocityX , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->velocityY , parameter->getParD(lev)->velocityY , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->velocityZ , parameter->getParD(lev)->velocityZ , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->rho , parameter->getParD(lev)->rho , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->pressure, parameter->getParD(lev)->pressure, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + + if(parameter->getIsBodyForce()) + { + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->forceX_SP , parameter->getParD(lev)->forceX_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->forceY_SP , parameter->getParD(lev)->forceY_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->forceZ_SP , parameter->getParD(lev)->forceZ_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + } + + if(parameter->getUseTurbulentViscosity()) + { + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->turbViscosity , parameter->getParD(lev)->turbViscosity , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + } } void CudaMemoryManager::cudaCopyMedianPrint(int lev) { @@ -41,13 +54,13 @@ void CudaMemoryManager::cudaCopyMedianPrint(int lev) void CudaMemoryManager::cudaAllocCoord(int lev) { //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->coordX_SP ), parameter->getParH(lev)->mem_size_real_SP )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->coordY_SP ), parameter->getParH(lev)->mem_size_real_SP )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->coordZ_SP ), parameter->getParH(lev)->mem_size_real_SP )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->coordinateX ), parameter->getParH(lev)->mem_size_real_SP )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->coordinateY ), parameter->getParH(lev)->mem_size_real_SP )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->coordinateZ ), parameter->getParH(lev)->mem_size_real_SP )); //Device (spinning ship + uppsala) - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->coordX_SP ), parameter->getParH(lev)->mem_size_real_SP )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->coordY_SP ), parameter->getParH(lev)->mem_size_real_SP )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->coordZ_SP ), parameter->getParH(lev)->mem_size_real_SP )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->coordinateX ), parameter->getParH(lev)->mem_size_real_SP )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->coordinateY ), parameter->getParH(lev)->mem_size_real_SP )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->coordinateZ ), parameter->getParH(lev)->mem_size_real_SP )); ////////////////////////////////////////////////////////////////////////// double tmp = 3. * (double)parameter->getParH(lev)->mem_size_real_SP; setMemsizeGPU(tmp, false); @@ -55,17 +68,17 @@ void CudaMemoryManager::cudaAllocCoord(int lev) void CudaMemoryManager::cudaCopyCoord(int lev) { //copy host to device - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->coordX_SP, parameter->getParH(lev)->coordX_SP, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->coordY_SP, parameter->getParH(lev)->coordY_SP, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->coordZ_SP, parameter->getParH(lev)->coordZ_SP, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->coordinateX, parameter->getParH(lev)->coordinateX, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->coordinateY, parameter->getParH(lev)->coordinateY, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->coordinateZ, parameter->getParH(lev)->coordinateZ, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeCoord(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->coordX_SP )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->coordY_SP )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->coordZ_SP )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->coordinateX )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->coordinateY )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->coordinateZ )); } -void CudaMemoryManager::cudaAllocBodyForce(int lev) +void CudaMemoryManager::cudaAllocBodyForce(int lev) { //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->forceX_SP ), parameter->getParH(lev)->mem_size_real_SP )); @@ -80,7 +93,7 @@ void CudaMemoryManager::cudaAllocBodyForce(int lev) setMemsizeGPU(tmp, false); } -void CudaMemoryManager::cudaCopyBodyForce(int lev) +void CudaMemoryManager::cudaCopyBodyForce(int lev) { //copy host to device checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->forceX_SP, parameter->getParH(lev)->forceX_SP, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); @@ -88,7 +101,7 @@ void CudaMemoryManager::cudaCopyBodyForce(int lev) checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->forceZ_SP, parameter->getParH(lev)->forceZ_SP, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); } -void CudaMemoryManager::cudaFreeBodyForce(int lev) +void CudaMemoryManager::cudaFreeBodyForce(int lev) { checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->forceX_SP )); checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->forceY_SP )); @@ -98,36 +111,36 @@ void CudaMemoryManager::cudaFreeBodyForce(int lev) //print void CudaMemoryManager::cudaCopyDataToHost(int lev) { - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vx_SP , parameter->getParD(lev)->vx_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vy_SP , parameter->getParD(lev)->vy_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vz_SP , parameter->getParD(lev)->vz_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->rho_SP , parameter->getParD(lev)->rho_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->press_SP, parameter->getParD(lev)->press_SP, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->velocityX , parameter->getParD(lev)->velocityX , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->velocityY , parameter->getParD(lev)->velocityY , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->velocityZ , parameter->getParD(lev)->velocityZ , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->rho , parameter->getParD(lev)->rho , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->pressure, parameter->getParD(lev)->pressure, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); } //sparse void CudaMemoryManager::cudaAllocSP(int lev) { //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geoSP ), parameter->getParH(lev)->mem_size_int_SP )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->neighborX_SP ), parameter->getParH(lev)->mem_size_int_SP )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->neighborY_SP ), parameter->getParH(lev)->mem_size_int_SP )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->neighborZ_SP ), parameter->getParH(lev)->mem_size_int_SP )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->rho_SP ), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vx_SP ), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vy_SP ), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vz_SP ), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->press_SP ), parameter->getParH(lev)->mem_size_real_SP)); - //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geoSP ), parameter->getParD(lev)->mem_size_int_SP )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->neighborX_SP ), parameter->getParD(lev)->mem_size_int_SP )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->neighborY_SP ), parameter->getParD(lev)->mem_size_int_SP )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->neighborZ_SP ), parameter->getParD(lev)->mem_size_int_SP )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->rho_SP ), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vx_SP ), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vy_SP ), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vz_SP ), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->press_SP ), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->d0SP.f[0] ), (unsigned long long)parameter->getD3Qxx()*(unsigned long long)parameter->getParD(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->typeOfGridNode ), parameter->getParH(lev)->mem_size_int_SP )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->neighborX ), parameter->getParH(lev)->mem_size_int_SP )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->neighborY ), parameter->getParH(lev)->mem_size_int_SP )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->neighborZ ), parameter->getParH(lev)->mem_size_int_SP )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->rho ), parameter->getParH(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->velocityX ), parameter->getParH(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->velocityY ), parameter->getParH(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->velocityZ ), parameter->getParH(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->pressure ), parameter->getParH(lev)->mem_size_real_SP)); + //Device + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->typeOfGridNode ), parameter->getParD(lev)->mem_size_int_SP )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->neighborX ), parameter->getParD(lev)->mem_size_int_SP )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->neighborY ), parameter->getParD(lev)->mem_size_int_SP )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->neighborZ ), parameter->getParD(lev)->mem_size_int_SP )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->rho ), parameter->getParD(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->velocityX ), parameter->getParD(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->velocityY ), parameter->getParD(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->velocityZ ), parameter->getParD(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->pressure ), parameter->getParD(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->distributions.f[0] ), (unsigned long long)parameter->getD3Qxx()*(unsigned long long)parameter->getParD(lev)->mem_size_real_SP)); ////////////////////////////////////////////////////////////////////////// double tmp = 4. * (double)parameter->getParH(lev)->mem_size_int_SP + 5. * (double)parameter->getParH(lev)->mem_size_real_SP + (double)parameter->getD3Qxx() * (double)parameter->getParH(lev)->mem_size_real_SP; setMemsizeGPU(tmp, false); @@ -135,27 +148,27 @@ void CudaMemoryManager::cudaAllocSP(int lev) void CudaMemoryManager::cudaCopySP(int lev) { //copy host to device - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geoSP , parameter->getParH(lev)->geoSP , parameter->getParH(lev)->mem_size_int_SP , cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->neighborX_SP, parameter->getParH(lev)->neighborX_SP, parameter->getParH(lev)->mem_size_int_SP , cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->neighborY_SP, parameter->getParH(lev)->neighborY_SP, parameter->getParH(lev)->mem_size_int_SP , cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->neighborZ_SP, parameter->getParH(lev)->neighborZ_SP, parameter->getParH(lev)->mem_size_int_SP , cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->rho_SP , parameter->getParH(lev)->rho_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vx_SP , parameter->getParH(lev)->vx_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vy_SP , parameter->getParH(lev)->vy_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vz_SP , parameter->getParH(lev)->vz_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->press_SP , parameter->getParH(lev)->press_SP , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->typeOfGridNode , parameter->getParH(lev)->typeOfGridNode , parameter->getParH(lev)->mem_size_int_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->neighborX, parameter->getParH(lev)->neighborX, parameter->getParH(lev)->mem_size_int_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->neighborY, parameter->getParH(lev)->neighborY, parameter->getParH(lev)->mem_size_int_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->neighborZ, parameter->getParH(lev)->neighborZ, parameter->getParH(lev)->mem_size_int_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->rho , parameter->getParH(lev)->rho , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->velocityX , parameter->getParH(lev)->velocityX , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->velocityY , parameter->getParH(lev)->velocityY , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->velocityZ , parameter->getParH(lev)->velocityZ , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->pressure , parameter->getParH(lev)->pressure , parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeSP(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geoSP )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vx_SP )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vy_SP )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vz_SP )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->rho_SP )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->press_SP )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->neighborX_SP)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->neighborY_SP)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->neighborZ_SP)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->typeOfGridNode )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->velocityX )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->velocityY )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->velocityZ )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->rho )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->pressure )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->neighborX)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->neighborY)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->neighborZ)); } void CudaMemoryManager::cudaAllocF3SP(int lev) { @@ -189,25 +202,25 @@ void CudaMemoryManager::cudaAllocF3SP(int lev) //Velo void CudaMemoryManager::cudaAllocVeloBC(int lev) { - unsigned int mem_size_inflow_Q_k = sizeof(int)*parameter->getParH(lev)->Qinflow.kQ; - unsigned int mem_size_inflow_Q_q = sizeof(real)*parameter->getParH(lev)->Qinflow.kQ; + unsigned int mem_size_inflow_Q_k = sizeof(int)*parameter->getParH(lev)->velocityBC.numberOfBCnodes; + unsigned int mem_size_inflow_Q_q = sizeof(real)*parameter->getParH(lev)->velocityBC.numberOfBCnodes; //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Qinflow.q27[0]), parameter->getD3Qxx()*mem_size_inflow_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Qinflow.k), mem_size_inflow_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Qinflow.Vx), mem_size_inflow_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Qinflow.Vy), mem_size_inflow_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Qinflow.Vz), mem_size_inflow_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Qinflow.deltaVz), mem_size_inflow_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Qinflow.RhoBC), mem_size_inflow_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->velocityBC.q27[0]), parameter->getD3Qxx()*mem_size_inflow_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->velocityBC.k), mem_size_inflow_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->velocityBC.Vx), mem_size_inflow_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->velocityBC.Vy), mem_size_inflow_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->velocityBC.Vz), mem_size_inflow_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->velocityBC.deltaVz), mem_size_inflow_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->velocityBC.RhoBC), mem_size_inflow_Q_q )); //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->Qinflow.q27[0]), parameter->getD3Qxx()*mem_size_inflow_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->Qinflow.k), mem_size_inflow_Q_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->Qinflow.Vx), mem_size_inflow_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->Qinflow.Vy), mem_size_inflow_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->Qinflow.Vz), mem_size_inflow_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->Qinflow.deltaVz), mem_size_inflow_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->velocityBC.q27[0]), parameter->getD3Qxx()*mem_size_inflow_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->velocityBC.k), mem_size_inflow_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->velocityBC.Vx), mem_size_inflow_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->velocityBC.Vy), mem_size_inflow_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->velocityBC.Vz), mem_size_inflow_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->velocityBC.deltaVz), mem_size_inflow_Q_q )); ////////////////////////////////////////////////////////////////////////// double tmp = (double)mem_size_inflow_Q_k + 4. * (double)mem_size_inflow_Q_q + (double)parameter->getD3Qxx() * (double)mem_size_inflow_Q_q; @@ -215,43 +228,43 @@ void CudaMemoryManager::cudaAllocVeloBC(int lev) } void CudaMemoryManager::cudaCopyVeloBC(int lev) { - unsigned int mem_size_inflow_Q_k = sizeof(int)*parameter->getParH(lev)->Qinflow.kQ; - unsigned int mem_size_inflow_Q_q = sizeof(real)*parameter->getParH(lev)->Qinflow.kQ; + unsigned int mem_size_inflow_Q_k = sizeof(int)*parameter->getParH(lev)->velocityBC.numberOfBCnodes; + unsigned int mem_size_inflow_Q_q = sizeof(real)*parameter->getParH(lev)->velocityBC.numberOfBCnodes; - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Qinflow.q27[0], parameter->getParH(lev)->Qinflow.q27[0], parameter->getD3Qxx()* mem_size_inflow_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Qinflow.k, parameter->getParH(lev)->Qinflow.k, mem_size_inflow_Q_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Qinflow.Vx, parameter->getParH(lev)->Qinflow.Vx, mem_size_inflow_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Qinflow.Vy, parameter->getParH(lev)->Qinflow.Vy, mem_size_inflow_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Qinflow.Vz, parameter->getParH(lev)->Qinflow.Vz, mem_size_inflow_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Qinflow.deltaVz, parameter->getParH(lev)->Qinflow.deltaVz, mem_size_inflow_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->velocityBC.q27[0], parameter->getParH(lev)->velocityBC.q27[0], parameter->getD3Qxx()* mem_size_inflow_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->velocityBC.k, parameter->getParH(lev)->velocityBC.k, mem_size_inflow_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->velocityBC.Vx, parameter->getParH(lev)->velocityBC.Vx, mem_size_inflow_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->velocityBC.Vy, parameter->getParH(lev)->velocityBC.Vy, mem_size_inflow_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->velocityBC.Vz, parameter->getParH(lev)->velocityBC.Vz, mem_size_inflow_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->velocityBC.deltaVz, parameter->getParH(lev)->velocityBC.deltaVz, mem_size_inflow_Q_q, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeVeloBC(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->Qinflow.q27[0] )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->Qinflow.k )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->Qinflow.Vx )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->Qinflow.Vy )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->Qinflow.Vz )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->Qinflow.deltaVz)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->velocityBC.q27[0] )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->velocityBC.k )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->velocityBC.Vx )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->velocityBC.Vy )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->velocityBC.Vz )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->velocityBC.deltaVz)); } //Press void CudaMemoryManager::cudaAllocOutflowBC(int lev) { - unsigned int mem_size_outflow_Q_k = sizeof(int)*parameter->getParH(lev)->Qoutflow.kQ; - unsigned int mem_size_outflow_Q_q = sizeof(real)*parameter->getParH(lev)->Qoutflow.kQ; + unsigned int mem_size_outflow_Q_k = sizeof(int)*parameter->getParH(lev)->outflowBC.numberOfBCnodes; + unsigned int mem_size_outflow_Q_q = sizeof(real)*parameter->getParH(lev)->outflowBC.numberOfBCnodes; //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Qoutflow.q27[0]), parameter->getD3Qxx()*mem_size_outflow_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Qoutflow.k), mem_size_outflow_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Qoutflow.kN), mem_size_outflow_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Qoutflow.RhoBC), mem_size_outflow_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->outflowBC.q27[0]), parameter->getD3Qxx()*mem_size_outflow_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->outflowBC.k), mem_size_outflow_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->outflowBC.kN), mem_size_outflow_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->outflowBC.RhoBC), mem_size_outflow_Q_q )); //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->Qoutflow.q27[0]), parameter->getD3Qxx()* mem_size_outflow_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->Qoutflow.k), mem_size_outflow_Q_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->Qoutflow.kN), mem_size_outflow_Q_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->Qoutflow.RhoBC), mem_size_outflow_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->outflowBC.q27[0]), parameter->getD3Qxx()* mem_size_outflow_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->outflowBC.k), mem_size_outflow_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->outflowBC.kN), mem_size_outflow_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->outflowBC.RhoBC), mem_size_outflow_Q_q )); ////////////////////////////////////////////////////////////////////////// double tmp = (double)mem_size_outflow_Q_q + 2. * (double)mem_size_outflow_Q_k + (double)parameter->getD3Qxx()*(double)mem_size_outflow_Q_q; @@ -259,71 +272,71 @@ void CudaMemoryManager::cudaAllocOutflowBC(int lev) } void CudaMemoryManager::cudaCopyOutflowBC(int lev) { - unsigned int mem_size_outflow_Q_k = sizeof(int)*parameter->getParH(lev)->Qoutflow.kQ; - unsigned int mem_size_outflow_Q_q = sizeof(real)*parameter->getParH(lev)->Qoutflow.kQ; + unsigned int mem_size_outflow_Q_k = sizeof(int)*parameter->getParH(lev)->outflowBC.numberOfBCnodes; + unsigned int mem_size_outflow_Q_q = sizeof(real)*parameter->getParH(lev)->outflowBC.numberOfBCnodes; - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Qoutflow.q27[0], parameter->getParH(lev)->Qoutflow.q27[0], parameter->getD3Qxx()* mem_size_outflow_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Qoutflow.k, parameter->getParH(lev)->Qoutflow.k, mem_size_outflow_Q_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Qoutflow.kN, parameter->getParH(lev)->Qoutflow.kN, mem_size_outflow_Q_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Qoutflow.RhoBC, parameter->getParH(lev)->Qoutflow.RhoBC, mem_size_outflow_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->outflowBC.q27[0], parameter->getParH(lev)->outflowBC.q27[0], parameter->getD3Qxx()* mem_size_outflow_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->outflowBC.k, parameter->getParH(lev)->outflowBC.k, mem_size_outflow_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->outflowBC.kN, parameter->getParH(lev)->outflowBC.kN, mem_size_outflow_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->outflowBC.RhoBC, parameter->getParH(lev)->outflowBC.RhoBC, mem_size_outflow_Q_q, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeOutflowBC(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->Qoutflow.q27[0] )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->Qoutflow.k )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->Qoutflow.kN )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->Qoutflow.RhoBC )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->outflowBC.q27[0] )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->outflowBC.k )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->outflowBC.kN )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->outflowBC.RhoBC )); } -//Wall -void CudaMemoryManager::cudaAllocWallBC(int lev) +//No-Slip +void CudaMemoryManager::cudaAllocNoSlipBC(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QWall.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QWall.kQ; - unsigned int mem_size_Q_value = sizeof(long long)*parameter->getParH(lev)->QWall.kQ; //Geller - unsigned int mem_size_Q_q_read = sizeof(real)*parameter->getParH(lev)->kQread; //Geller + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->noSlipBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->noSlipBC.numberOfBCnodes; + unsigned int mem_size_Q_value = sizeof(long long)*parameter->getParH(lev)->noSlipBC.numberOfBCnodes; //Geller + unsigned int mem_size_Q_q_read = sizeof(real)*parameter->getParH(lev)->numberOfNoSlipBCnodesRead; //Geller //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QWall.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QWall.k), mem_size_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QWall.qread), mem_size_Q_q_read ));//Geller - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QWall.valueQ), mem_size_Q_value ));//Geller + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->noSlipBC.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->noSlipBC.k), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->noSlipBC.qread), mem_size_Q_q_read ));//Geller + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->noSlipBC.valueQ), mem_size_Q_value ));//Geller //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QWall.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QWall.k), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->noSlipBC.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->noSlipBC.k), mem_size_Q_k )); ////////////////////////////////////////////////////////////////////////// double tmp = (double)mem_size_Q_k + (double)parameter->getD3Qxx()*(double)mem_size_Q_q; setMemsizeGPU(tmp, false); } -void CudaMemoryManager::cudaCopyWallBC(int lev) +void CudaMemoryManager::cudaCopyNoSlipBC(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QWall.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QWall.kQ; + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->noSlipBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->noSlipBC.numberOfBCnodes; - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QWall.q27[0], parameter->getParH(lev)->QWall.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QWall.k, parameter->getParH(lev)->QWall.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->noSlipBC.q27[0], parameter->getParH(lev)->noSlipBC.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->noSlipBC.k, parameter->getParH(lev)->noSlipBC.k, mem_size_Q_k, cudaMemcpyHostToDevice)); } -void CudaMemoryManager::cudaFreeWallBC(int lev) +void CudaMemoryManager::cudaFreeNoSlipBC(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QWall.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QWall.k)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QWall.valueQ)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QWall.qread)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->noSlipBC.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->noSlipBC.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->noSlipBC.valueQ)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->noSlipBC.qread)); } //Geometrie void CudaMemoryManager::cudaAllocGeomBC(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QGeom.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QGeom.kQ; + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->geometryBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->geometryBC.numberOfBCnodes; //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QGeom.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QGeom.k), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geometryBC.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geometryBC.k), mem_size_Q_k )); //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QGeom.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QGeom.k), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geometryBC.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geometryBC.k), mem_size_Q_k )); ////////////////////////////////////////////////////////////////////////// double tmp = (double)mem_size_Q_k + (double)parameter->getD3Qxx()*(double)mem_size_Q_q; @@ -331,34 +344,34 @@ void CudaMemoryManager::cudaAllocGeomBC(int lev) } void CudaMemoryManager::cudaCopyGeomBC(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QGeom.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QGeom.kQ; + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->geometryBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->geometryBC.numberOfBCnodes; - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QGeom.q27[0], parameter->getParH(lev)->QGeom.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QGeom.k, parameter->getParH(lev)->QGeom.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geometryBC.q27[0], parameter->getParH(lev)->geometryBC.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geometryBC.k, parameter->getParH(lev)->geometryBC.k, mem_size_Q_k, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeGeomBC(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QGeom.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QGeom.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geometryBC.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geometryBC.k)); } //Press void CudaMemoryManager::cudaAllocPress(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QPress.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QPress.kQ; + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->pressureBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->pressureBC.numberOfBCnodes; //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QPress.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QPress.k), mem_size_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QPress.kN), mem_size_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QPress.RhoBC), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->pressureBC.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->pressureBC.k), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->pressureBC.kN), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->pressureBC.RhoBC), mem_size_Q_q )); //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QPress.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QPress.k), mem_size_Q_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QPress.kN), mem_size_Q_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QPress.RhoBC), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->pressureBC.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->pressureBC.k), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->pressureBC.kN), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->pressureBC.RhoBC), mem_size_Q_q )); ////////////////////////////////////////////////////////////////////////// double tmp = 2. * (double)mem_size_Q_k + (double)mem_size_Q_q + (double)parameter->getD3Qxx()*(double)mem_size_Q_q; @@ -366,20 +379,20 @@ void CudaMemoryManager::cudaAllocPress(int lev) } void CudaMemoryManager::cudaCopyPress(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QPress.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QPress.kQ; + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->pressureBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->pressureBC.numberOfBCnodes; - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QPress.q27[0], parameter->getParH(lev)->QPress.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QPress.k, parameter->getParH(lev)->QPress.k, mem_size_Q_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QPress.kN, parameter->getParH(lev)->QPress.kN, mem_size_Q_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QPress.RhoBC, parameter->getParH(lev)->QPress.RhoBC, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->pressureBC.q27[0], parameter->getParH(lev)->pressureBC.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->pressureBC.k, parameter->getParH(lev)->pressureBC.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->pressureBC.kN, parameter->getParH(lev)->pressureBC.kN, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->pressureBC.RhoBC, parameter->getParH(lev)->pressureBC.RhoBC, mem_size_Q_q, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreePress(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QPress.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QPress.k)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QPress.kN)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QPress.RhoBC)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->pressureBC.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->pressureBC.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->pressureBC.kN)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->pressureBC.RhoBC)); } //Forcing void CudaMemoryManager::cudaAllocForcing() @@ -492,7 +505,7 @@ void CudaMemoryManager::cudaAllocProcessNeighborX(int lev, unsigned int processN checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborX[processNeighbor].f[0] ), parameter->getD3Qxx() * parameter->getParD(lev)->recvProcessNeighborX[processNeighbor].memsizeFs )); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - double tmp = (double)parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].memsizeIndex + (double)parameter->getD3Qxx()*(double)parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].memsizeFs + + double tmp = (double)parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].memsizeIndex + (double)parameter->getD3Qxx()*(double)parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].memsizeFs + (double)parameter->getParH(lev)->recvProcessNeighborX[processNeighbor].memsizeIndex + (double)parameter->getD3Qxx()*(double)parameter->getParH(lev)->recvProcessNeighborX[processNeighbor].memsizeFs; setMemsizeGPU(tmp, false); //printf("memsize GPU for neighbors %f \n",tmp/1000000.0); @@ -500,29 +513,45 @@ void CudaMemoryManager::cudaAllocProcessNeighborX(int lev, unsigned int processN void CudaMemoryManager::cudaCopyProcessNeighborXIndex(int lev, unsigned int processNeighbor) { //copy send Index - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->sendProcessNeighborX[processNeighbor].index, - parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].index, - parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].memsizeIndex, + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->sendProcessNeighborX[processNeighbor].index, + parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].index, + parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].memsizeIndex, cudaMemcpyHostToDevice)); //copy recv Index - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborX[processNeighbor].index, - parameter->getParH(lev)->recvProcessNeighborX[processNeighbor].index, - parameter->getParH(lev)->recvProcessNeighborX[processNeighbor].memsizeIndex, + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborX[processNeighbor].index, + parameter->getParH(lev)->recvProcessNeighborX[processNeighbor].index, + parameter->getParH(lev)->recvProcessNeighborX[processNeighbor].memsizeIndex, cudaMemcpyHostToDevice)); } -void CudaMemoryManager::cudaCopyProcessNeighborXFsHD(int lev, unsigned int processNeighbor) -{ - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborX[processNeighbor].f[0], - parameter->getParH(lev)->recvProcessNeighborX[processNeighbor].f[0], - parameter->getD3Qxx() * parameter->getParD(lev)->recvProcessNeighborX[processNeighbor].memsizeFs, - cudaMemcpyHostToDevice)); -} -void CudaMemoryManager::cudaCopyProcessNeighborXFsDH(int lev, unsigned int processNeighbor) -{ - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].f[0], - parameter->getParD(lev)->sendProcessNeighborX[processNeighbor].f[0], - parameter->getD3Qxx() * parameter->getParD(lev)->sendProcessNeighborX[processNeighbor].memsizeFs, - cudaMemcpyDeviceToHost)); +void CudaMemoryManager::cudaCopyProcessNeighborXFsHD(int lev, unsigned int processNeighbor, + const unsigned int &memsizeFsRecv, int streamIndex) +{ + if (streamIndex == -1) + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborX[processNeighbor].f[0], + parameter->getParH(lev)->recvProcessNeighborX[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsRecv, + cudaMemcpyHostToDevice)); + else + checkCudaErrors( cudaMemcpyAsync(parameter->getParD(lev)->recvProcessNeighborX[processNeighbor].f[0], + parameter->getParH(lev)->recvProcessNeighborX[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsRecv, + cudaMemcpyHostToDevice, + parameter->getStreamManager()->getStream(streamIndex))); +} +void CudaMemoryManager::cudaCopyProcessNeighborXFsDH(int lev, unsigned int processNeighbor, + const unsigned int &memsizeFsSend, int streamIndex) +{ + if (streamIndex == -1) + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].f[0], + parameter->getParD(lev)->sendProcessNeighborX[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsSend, + cudaMemcpyDeviceToHost)); + else + checkCudaErrors( cudaMemcpyAsync(parameter->getParH(lev)->sendProcessNeighborX[processNeighbor].f[0], + parameter->getParD(lev)->sendProcessNeighborX[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsSend, + cudaMemcpyDeviceToHost, + parameter->getStreamManager()->getStream(streamIndex))); } void CudaMemoryManager::cudaFreeProcessNeighborX(int lev, unsigned int processNeighbor) { @@ -547,7 +576,7 @@ void CudaMemoryManager::cudaAllocProcessNeighborY(int lev, unsigned int processN checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborY[processNeighbor].f[0] ), parameter->getD3Qxx() * parameter->getParD(lev)->recvProcessNeighborY[processNeighbor].memsizeFs )); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - double tmp = (double)parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].memsizeIndex + (double)parameter->getD3Qxx()*(double)parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].memsizeFs + + double tmp = (double)parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].memsizeIndex + (double)parameter->getD3Qxx()*(double)parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].memsizeFs + (double)parameter->getParH(lev)->recvProcessNeighborY[processNeighbor].memsizeIndex + (double)parameter->getD3Qxx()*(double)parameter->getParH(lev)->recvProcessNeighborY[processNeighbor].memsizeFs; setMemsizeGPU(tmp, false); //printf("memsize GPU for neighbors %f \n",tmp/1000000.0); @@ -555,29 +584,45 @@ void CudaMemoryManager::cudaAllocProcessNeighborY(int lev, unsigned int processN void CudaMemoryManager::cudaCopyProcessNeighborYIndex(int lev, unsigned int processNeighbor) { //copy send Index - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->sendProcessNeighborY[processNeighbor].index, - parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].index, - parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].memsizeIndex, + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->sendProcessNeighborY[processNeighbor].index, + parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].index, + parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].memsizeIndex, cudaMemcpyHostToDevice)); //copy recv Index - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborY[processNeighbor].index, - parameter->getParH(lev)->recvProcessNeighborY[processNeighbor].index, - parameter->getParH(lev)->recvProcessNeighborY[processNeighbor].memsizeIndex, + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborY[processNeighbor].index, + parameter->getParH(lev)->recvProcessNeighborY[processNeighbor].index, + parameter->getParH(lev)->recvProcessNeighborY[processNeighbor].memsizeIndex, cudaMemcpyHostToDevice)); } -void CudaMemoryManager::cudaCopyProcessNeighborYFsHD(int lev, unsigned int processNeighbor) -{ - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborY[processNeighbor].f[0], - parameter->getParH(lev)->recvProcessNeighborY[processNeighbor].f[0], - parameter->getD3Qxx() * parameter->getParD(lev)->recvProcessNeighborY[processNeighbor].memsizeFs, - cudaMemcpyHostToDevice)); -} -void CudaMemoryManager::cudaCopyProcessNeighborYFsDH(int lev, unsigned int processNeighbor) -{ - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].f[0], - parameter->getParD(lev)->sendProcessNeighborY[processNeighbor].f[0], - parameter->getD3Qxx() * parameter->getParD(lev)->sendProcessNeighborY[processNeighbor].memsizeFs, - cudaMemcpyDeviceToHost)); +void CudaMemoryManager::cudaCopyProcessNeighborYFsHD(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsRecv, + int streamIndex) +{ + if (streamIndex == -1) + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborY[processNeighbor].f[0], + parameter->getParH(lev)->recvProcessNeighborY[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsRecv, + cudaMemcpyHostToDevice)); + else + checkCudaErrors(cudaMemcpyAsync(parameter->getParD(lev)->recvProcessNeighborY[processNeighbor].f[0], + parameter->getParH(lev)->recvProcessNeighborY[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsRecv, + cudaMemcpyHostToDevice, + parameter->getStreamManager()->getStream(streamIndex))); +} +void CudaMemoryManager::cudaCopyProcessNeighborYFsDH(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsSend, + int streamIndex) +{ + if (streamIndex == -1) + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].f[0], + parameter->getParD(lev)->sendProcessNeighborY[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsSend, + cudaMemcpyDeviceToHost)); + else + checkCudaErrors( + cudaMemcpyAsync(parameter->getParH(lev)->sendProcessNeighborY[processNeighbor].f[0], + parameter->getParD(lev)->sendProcessNeighborY[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsSend, + cudaMemcpyDeviceToHost, parameter->getStreamManager()->getStream(streamIndex))); } void CudaMemoryManager::cudaFreeProcessNeighborY(int lev, unsigned int processNeighbor) { @@ -602,7 +647,7 @@ void CudaMemoryManager::cudaAllocProcessNeighborZ(int lev, unsigned int processN checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborZ[processNeighbor].f[0] ), parameter->getD3Qxx() * parameter->getParD(lev)->recvProcessNeighborZ[processNeighbor].memsizeFs )); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - double tmp = (double)parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].memsizeIndex + (double)parameter->getD3Qxx()*(double)parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].memsizeFs + + double tmp = (double)parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].memsizeIndex + (double)parameter->getD3Qxx()*(double)parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].memsizeFs + (double)parameter->getParH(lev)->recvProcessNeighborZ[processNeighbor].memsizeIndex + (double)parameter->getD3Qxx()*(double)parameter->getParH(lev)->recvProcessNeighborZ[processNeighbor].memsizeFs; setMemsizeGPU(tmp, false); //printf("memsize GPU for neighbors %f \n",tmp/1000000.0); @@ -610,29 +655,45 @@ void CudaMemoryManager::cudaAllocProcessNeighborZ(int lev, unsigned int processN void CudaMemoryManager::cudaCopyProcessNeighborZIndex(int lev, unsigned int processNeighbor) { //copy send Index - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->sendProcessNeighborZ[processNeighbor].index, - parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].index, - parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].memsizeIndex, + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->sendProcessNeighborZ[processNeighbor].index, + parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].index, + parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].memsizeIndex, cudaMemcpyHostToDevice)); //copy recv Index - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborZ[processNeighbor].index, - parameter->getParH(lev)->recvProcessNeighborZ[processNeighbor].index, - parameter->getParH(lev)->recvProcessNeighborZ[processNeighbor].memsizeIndex, - cudaMemcpyHostToDevice)); -} -void CudaMemoryManager::cudaCopyProcessNeighborZFsHD(int lev, unsigned int processNeighbor) -{ - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborZ[processNeighbor].f[0], - parameter->getParH(lev)->recvProcessNeighborZ[processNeighbor].f[0], - parameter->getD3Qxx() * parameter->getParD(lev)->recvProcessNeighborZ[processNeighbor].memsizeFs, + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborZ[processNeighbor].index, + parameter->getParH(lev)->recvProcessNeighborZ[processNeighbor].index, + parameter->getParH(lev)->recvProcessNeighborZ[processNeighbor].memsizeIndex, cudaMemcpyHostToDevice)); } -void CudaMemoryManager::cudaCopyProcessNeighborZFsDH(int lev, unsigned int processNeighbor) -{ - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].f[0], - parameter->getParD(lev)->sendProcessNeighborZ[processNeighbor].f[0], - parameter->getD3Qxx() * parameter->getParD(lev)->sendProcessNeighborZ[processNeighbor].memsizeFs, - cudaMemcpyDeviceToHost)); +void CudaMemoryManager::cudaCopyProcessNeighborZFsHD(int lev, unsigned int processNeighbor, + const unsigned int &memsizeFsRecv, int streamIndex) +{ + if (streamIndex == -1) + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->recvProcessNeighborZ[processNeighbor].f[0], + parameter->getParH(lev)->recvProcessNeighborZ[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsRecv, + cudaMemcpyHostToDevice)); + else + checkCudaErrors( cudaMemcpyAsync(parameter->getParD(lev)->recvProcessNeighborZ[processNeighbor].f[0], + parameter->getParH(lev)->recvProcessNeighborZ[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsRecv, + cudaMemcpyHostToDevice, + parameter->getStreamManager()->getStream(streamIndex))); +} +void CudaMemoryManager::cudaCopyProcessNeighborZFsDH(int lev, unsigned int processNeighbor, + const unsigned int &memsizeFsSend, int streamIndex) +{ + if (streamIndex == -1) + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].f[0], + parameter->getParD(lev)->sendProcessNeighborZ[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsSend, + cudaMemcpyDeviceToHost)); + else + checkCudaErrors( cudaMemcpyAsync(parameter->getParH(lev)->sendProcessNeighborZ[processNeighbor].f[0], + parameter->getParD(lev)->sendProcessNeighborZ[processNeighbor].f[0], + parameter->getD3Qxx() * memsizeFsSend, + cudaMemcpyDeviceToHost, + parameter->getStreamManager()->getStream(streamIndex))); } void CudaMemoryManager::cudaFreeProcessNeighborZ(int lev, unsigned int processNeighbor) { @@ -660,7 +721,7 @@ void CudaMemoryManager::cudaAllocProcessNeighborF3X(int lev, unsigned int proces checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborF3X[processNeighbor].g[0]), parameter->getParD(lev)->recvProcessNeighborF3X[processNeighbor].memsizeGs)); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - double tmp = + double tmp = (double)parameter->getParH(lev)->sendProcessNeighborF3X[processNeighbor].memsizeIndex + (double)parameter->getParH(lev)->sendProcessNeighborF3X[processNeighbor].memsizeGs + (double)parameter->getParH(lev)->recvProcessNeighborF3X[processNeighbor].memsizeIndex + (double)parameter->getParH(lev)->recvProcessNeighborF3X[processNeighbor].memsizeGs; setMemsizeGPU(tmp, false); @@ -719,7 +780,7 @@ void CudaMemoryManager::cudaAllocProcessNeighborF3Y(int lev, unsigned int proces checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborF3Y[processNeighbor].g[0]), parameter->getParD(lev)->recvProcessNeighborF3Y[processNeighbor].memsizeGs)); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - double tmp = + double tmp = (double)parameter->getParH(lev)->sendProcessNeighborF3Y[processNeighbor].memsizeIndex + (double)parameter->getParH(lev)->sendProcessNeighborF3Y[processNeighbor].memsizeGs + (double)parameter->getParH(lev)->recvProcessNeighborF3Y[processNeighbor].memsizeIndex + (double)parameter->getParH(lev)->recvProcessNeighborF3Y[processNeighbor].memsizeGs; setMemsizeGPU(tmp, false); @@ -778,7 +839,7 @@ void CudaMemoryManager::cudaAllocProcessNeighborF3Z(int lev, unsigned int proces checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborF3Z[processNeighbor].g[0]), parameter->getParD(lev)->recvProcessNeighborF3Z[processNeighbor].memsizeGs)); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - double tmp = + double tmp = (double)parameter->getParH(lev)->sendProcessNeighborF3Z[processNeighbor].memsizeIndex + (double)parameter->getParH(lev)->sendProcessNeighborF3Z[processNeighbor].memsizeGs + (double)parameter->getParH(lev)->recvProcessNeighborF3Z[processNeighbor].memsizeIndex + (double)parameter->getParH(lev)->recvProcessNeighborF3Z[processNeighbor].memsizeGs; setMemsizeGPU(tmp, false); @@ -826,9 +887,9 @@ void CudaMemoryManager::cudaFreeProcessNeighborF3Z(int lev, unsigned int process void CudaMemoryManager::cudaAllocNeighborWSB(int lev) { //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->neighborWSB_SP ), parameter->getParH(lev)->mem_size_int_SP )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->neighborInverse ), parameter->getParH(lev)->mem_size_int_SP )); //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->neighborWSB_SP ), parameter->getParD(lev)->mem_size_int_SP )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->neighborInverse ), parameter->getParD(lev)->mem_size_int_SP )); ////////////////////////////////////////////////////////////////////////// double tmp = (double)parameter->getParH(lev)->mem_size_int_SP; setMemsizeGPU(tmp, false); @@ -836,11 +897,11 @@ void CudaMemoryManager::cudaAllocNeighborWSB(int lev) void CudaMemoryManager::cudaCopyNeighborWSB(int lev) { //copy host to device - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->neighborWSB_SP, parameter->getParH(lev)->neighborWSB_SP, parameter->getParH(lev)->mem_size_int_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->neighborInverse, parameter->getParH(lev)->neighborInverse, parameter->getParH(lev)->mem_size_int_SP , cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeNeighborWSB(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->neighborWSB_SP)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->neighborInverse)); } //turbulent viscosity void CudaMemoryManager::cudaAllocTurbulentViscosity(int lev) @@ -848,34 +909,35 @@ void CudaMemoryManager::cudaAllocTurbulentViscosity(int lev) //Host checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->turbViscosity), parameter->getParH(lev)->mem_size_real_SP)); //Debug - checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gSij ), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gSDij), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDxvx), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDyvx), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDzvx), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDxvy), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDyvy), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDzvy), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDxvz), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDyvz), parameter->getParH(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDzvz), parameter->getParH(lev)->mem_size_real_SP)); - + // checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gSij ), parameter->getParH(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gSDij), parameter->getParH(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDxvx), parameter->getParH(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDyvx), parameter->getParH(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDzvx), parameter->getParH(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDxvy), parameter->getParH(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDyvy), parameter->getParH(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDzvy), parameter->getParH(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDxvz), parameter->getParH(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDyvz), parameter->getParH(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMallocHost((void**) &(parameter->getParH(lev)->gDzvz), parameter->getParH(lev)->mem_size_real_SP)); + //Device checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->turbViscosity), parameter->getParD(lev)->mem_size_real_SP)); //Debug - checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gSij ), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gSDij), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDxvx), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDyvx), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDzvx), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDxvy), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDyvy), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDzvy), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDxvz), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDyvz), parameter->getParD(lev)->mem_size_real_SP)); - checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDzvz), parameter->getParD(lev)->mem_size_real_SP)); - ////////////////////////////////////////////////////////////////////////// - double tmp = (double)parameter->getParH(lev)->mem_size_real_SP * 12.0; + // checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gSij ), parameter->getParD(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gSDij), parameter->getParD(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDxvx), parameter->getParD(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDyvx), parameter->getParD(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDzvx), parameter->getParD(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDxvy), parameter->getParD(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDyvy), parameter->getParD(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDzvy), parameter->getParD(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDxvz), parameter->getParD(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDyvz), parameter->getParD(lev)->mem_size_real_SP)); + // checkCudaErrors(cudaMalloc((void**) &(parameter->getParD(lev)->gDzvz), parameter->getParD(lev)->mem_size_real_SP)); + // ////////////////////////////////////////////////////////////////////////// + // double tmp = (double)parameter->getParH(lev)->mem_size_real_SP * 12.0; + double tmp = (double)parameter->getParH(lev)->mem_size_real_SP; setMemsizeGPU(tmp, false); } void CudaMemoryManager::cudaCopyTurbulentViscosityHD(int lev) @@ -883,50 +945,118 @@ void CudaMemoryManager::cudaCopyTurbulentViscosityHD(int lev) //copy host to device checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->turbViscosity, parameter->getParH(lev)->turbViscosity, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); //Debug - checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gSij , parameter->getParH(lev)->gSij , parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); - checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gSDij, parameter->getParH(lev)->gSDij, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); - checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDxvx, parameter->getParH(lev)->gDxvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); - checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDyvx, parameter->getParH(lev)->gDyvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); - checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDzvx, parameter->getParH(lev)->gDzvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); - checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDxvy, parameter->getParH(lev)->gDxvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); - checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDyvy, parameter->getParH(lev)->gDyvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); - checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDzvy, parameter->getParH(lev)->gDzvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); - checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDxvz, parameter->getParH(lev)->gDxvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); - checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDyvz, parameter->getParH(lev)->gDyvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); - checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDzvz, parameter->getParH(lev)->gDzvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); + // checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gSij , parameter->getParH(lev)->gSij , parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); + // checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gSDij, parameter->getParH(lev)->gSDij, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); + // checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDxvx, parameter->getParH(lev)->gDxvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); + // checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDyvx, parameter->getParH(lev)->gDyvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); + // checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDzvx, parameter->getParH(lev)->gDzvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); + // checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDxvy, parameter->getParH(lev)->gDxvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); + // checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDyvy, parameter->getParH(lev)->gDyvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); + // checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDzvy, parameter->getParH(lev)->gDzvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); + // checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDxvz, parameter->getParH(lev)->gDxvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); + // checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDyvz, parameter->getParH(lev)->gDyvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); + // checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->gDzvz, parameter->getParH(lev)->gDzvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaCopyTurbulentViscosityDH(int lev) { //copy device to host checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->turbViscosity, parameter->getParD(lev)->turbViscosity, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); //Debug - checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gSij , parameter->getParD(lev)->gSij , parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); - checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gSDij, parameter->getParD(lev)->gSDij, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); - checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDxvx, parameter->getParD(lev)->gDxvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); - checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDyvx, parameter->getParD(lev)->gDyvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); - checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDzvx, parameter->getParD(lev)->gDzvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); - checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDxvy, parameter->getParD(lev)->gDxvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); - checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDyvy, parameter->getParD(lev)->gDyvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); - checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDzvy, parameter->getParD(lev)->gDzvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); - checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDxvz, parameter->getParD(lev)->gDxvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); - checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDyvz, parameter->getParD(lev)->gDyvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); - checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDzvz, parameter->getParD(lev)->gDzvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); + // checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gSij , parameter->getParD(lev)->gSij , parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); + // checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gSDij, parameter->getParD(lev)->gSDij, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); + // checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDxvx, parameter->getParD(lev)->gDxvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); + // checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDyvx, parameter->getParD(lev)->gDyvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); + // checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDzvx, parameter->getParD(lev)->gDzvx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); + // checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDxvy, parameter->getParD(lev)->gDxvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); + // checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDyvy, parameter->getParD(lev)->gDyvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); + // checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDzvy, parameter->getParD(lev)->gDzvy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); + // checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDxvz, parameter->getParD(lev)->gDxvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); + // checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDyvz, parameter->getParD(lev)->gDyvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); + // checkCudaErrors(cudaMemcpy(parameter->getParH(lev)->gDzvz, parameter->getParD(lev)->gDzvz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyDeviceToHost)); } void CudaMemoryManager::cudaFreeTurbulentViscosity(int lev) { checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->turbViscosity)); //Debug - checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gSij )); - checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gSDij)); - checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDxvx)); - checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDyvx)); - checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDzvx)); - checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDxvy)); - checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDyvy)); - checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDzvy)); - checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDxvz)); - checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDyvz)); - checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDzvz)); + // checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gSij )); + // checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gSDij)); + // checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDxvx)); + // checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDyvx)); + // checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDzvx)); + // checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDxvy)); + // checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDyvy)); + // checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDzvy)); + // checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDxvz)); + // checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDyvz)); + // checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->gDzvz)); +} +//turbulence intensity +void CudaMemoryManager::cudaAllocTurbulenceIntensity(int lev, uint size) +{ + uint mem_size = sizeof(real) * size; + // Host + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vxx ), mem_size)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vyy ), mem_size)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vzz ), mem_size)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vxy ), mem_size)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vxz ), mem_size)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vyz ), mem_size)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vx_mean ), mem_size)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vy_mean ), mem_size)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->vz_mean ), mem_size)); + //Device + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vxx ), mem_size)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vyy ), mem_size)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vzz ), mem_size)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vxy ), mem_size)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vxz ), mem_size)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vyz ), mem_size)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vx_mean ), mem_size)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vy_mean ), mem_size)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->vz_mean ), mem_size)); + ////////////////////////////////////////////////////////////////////////// + double tmp = 9. * (double)mem_size; + setMemsizeGPU(tmp, false); +} +void CudaMemoryManager::cudaCopyTurbulenceIntensityHD(int lev, uint size) +{ + uint mem_size = sizeof(real) * size; + //copy host to device + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vxx , parameter->getParH(lev)->vxx , mem_size , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vyy , parameter->getParH(lev)->vyy , mem_size , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vzz , parameter->getParH(lev)->vzz , mem_size , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vxy , parameter->getParH(lev)->vxy , mem_size , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vxz , parameter->getParH(lev)->vxz , mem_size , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vyz , parameter->getParH(lev)->vyz , mem_size , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vx_mean, parameter->getParH(lev)->vx_mean, mem_size , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vy_mean, parameter->getParH(lev)->vy_mean, mem_size , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->vz_mean, parameter->getParH(lev)->vz_mean, mem_size , cudaMemcpyHostToDevice)); +} +void CudaMemoryManager::cudaCopyTurbulenceIntensityDH(int lev, uint size) +{ + uint mem_size = sizeof(real) * size; + //copy device to host + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vxx , parameter->getParD(lev)->vxx , mem_size , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vyy , parameter->getParD(lev)->vyy , mem_size , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vzz , parameter->getParD(lev)->vzz , mem_size , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vxy , parameter->getParD(lev)->vxy , mem_size , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vxz , parameter->getParD(lev)->vxz , mem_size , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vyz , parameter->getParD(lev)->vyz , mem_size , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vx_mean, parameter->getParD(lev)->vx_mean, mem_size , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vy_mean, parameter->getParD(lev)->vy_mean, mem_size , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->vz_mean, parameter->getParD(lev)->vz_mean, mem_size , cudaMemcpyDeviceToHost)); +} +void CudaMemoryManager::cudaFreeTurbulenceIntensity(int lev) +{ + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vxx )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vyy )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vzz )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vxy )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vxz )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vyz )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vx_mean )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vy_mean )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->vz_mean )); } //median void CudaMemoryManager::cudaAllocMedianSP(int lev) @@ -1022,6 +1152,14 @@ void CudaMemoryManager::cudaCopyInterfaceFC(int lev) checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->intFC.ICellFCF, parameter->getParH(lev)->intFC.ICellFCF, parameter->getParH(lev)->mem_size_kFC, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->intFC.ICellFCC, parameter->getParH(lev)->intFC.ICellFCC, parameter->getParH(lev)->mem_size_kFC, cudaMemcpyHostToDevice)); } +void CudaMemoryManager::cudaCheckInterfaceFCBulk(int lev) +{ + // only use for testing! + size_t memsize = sizeof(uint) * parameter->getParH(lev)->intFCBulk.kFC; + checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->intFCBulk.ICellFCC, parameter->getParH(lev)->intFCBulk.ICellFCC, memsize, cudaMemcpyDeviceToDevice)); + for (uint i = 0; i < parameter->getParH(lev)->intFCBulk.kFC; i++) + printf("%d %d\n", i, parameter->getParH(lev)->intFCBulk.ICellFCC[i]); +} void CudaMemoryManager::cudaFreeInterfaceFC(int lev) { checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->intFC.ICellFCF)); @@ -1091,30 +1229,30 @@ void CudaMemoryManager::cudaFreeInterfaceOffFC(int lev) //Inlet void CudaMemoryManager::cudaAllocInlet(int lev) { - unsigned int mem_size_inlet_Q_k = sizeof(int)*parameter->getParH(lev)->QInlet.kQ; - unsigned int mem_size_inlet_Q_q = sizeof(real)*parameter->getParH(lev)->QInlet.kQ; - + unsigned int mem_size_inlet_Q_k = sizeof(int)*parameter->getParH(lev)->QInlet.numberOfBCnodes; + unsigned int mem_size_inlet_Q_q = sizeof(real)*parameter->getParH(lev)->QInlet.numberOfBCnodes; + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QInlet.q27[0]), parameter->getD3Qxx()*mem_size_inlet_Q_q )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QInlet.k), mem_size_inlet_Q_k )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QInlet.kN), mem_size_inlet_Q_k )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QInlet.RhoBC), mem_size_inlet_Q_q )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QInlet.q27[0]), parameter->getD3Qxx()* mem_size_inlet_Q_q )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QInlet.k), mem_size_inlet_Q_k )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QInlet.kN), mem_size_inlet_Q_k )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QInlet.RhoBC), mem_size_inlet_Q_q )); - + ////////////////////////////////////////////////////////////////////////// double tmp = 2. * (double)mem_size_inlet_Q_k + (double)mem_size_inlet_Q_q + (double)parameter->getD3Qxx()*(double)mem_size_inlet_Q_q; setMemsizeGPU(tmp, false); } void CudaMemoryManager::cudaCopyInlet(int lev) { - unsigned int mem_size_inlet_Q_k = sizeof(int)*parameter->getParH(lev)->QInlet.kQ; - unsigned int mem_size_inlet_Q_q = sizeof(real)*parameter->getParH(lev)->QInlet.kQ; - + unsigned int mem_size_inlet_Q_k = sizeof(int)*parameter->getParH(lev)->QInlet.numberOfBCnodes; + unsigned int mem_size_inlet_Q_q = sizeof(real)*parameter->getParH(lev)->QInlet.numberOfBCnodes; + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QInlet.q27[0], parameter->getParH(lev)->QInlet.q27[0], parameter->getD3Qxx()* mem_size_inlet_Q_q, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QInlet.k, parameter->getParH(lev)->QInlet.k, mem_size_inlet_Q_k, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QInlet.kN, parameter->getParH(lev)->QInlet.kN, mem_size_inlet_Q_k, cudaMemcpyHostToDevice)); @@ -1130,30 +1268,30 @@ void CudaMemoryManager::cudaFreeInlet(int lev) //Outlet void CudaMemoryManager::cudaAllocOutlet(int lev) { - unsigned int mem_size_outlet_Q_k = sizeof(int)*parameter->getParH(lev)->QOutlet.kQ; - unsigned int mem_size_outlet_Q_q = sizeof(real)*parameter->getParH(lev)->QOutlet.kQ; - + unsigned int mem_size_outlet_Q_k = sizeof(int)*parameter->getParH(lev)->QOutlet.numberOfBCnodes; + unsigned int mem_size_outlet_Q_q = sizeof(real)*parameter->getParH(lev)->QOutlet.numberOfBCnodes; + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QOutlet.q27[0]), parameter->getD3Qxx()*mem_size_outlet_Q_q )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QOutlet.k), mem_size_outlet_Q_k )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QOutlet.kN), mem_size_outlet_Q_k )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QOutlet.RhoBC), mem_size_outlet_Q_q )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QOutlet.q27[0]), parameter->getD3Qxx()* mem_size_outlet_Q_q )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QOutlet.k), mem_size_outlet_Q_k )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QOutlet.kN), mem_size_outlet_Q_k )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QOutlet.RhoBC), mem_size_outlet_Q_q )); - + ////////////////////////////////////////////////////////////////////////// double tmp = 2. * (double)mem_size_outlet_Q_k + (double)mem_size_outlet_Q_q + (double)parameter->getD3Qxx()*(double)mem_size_outlet_Q_q; setMemsizeGPU(tmp, false); } void CudaMemoryManager::cudaCopyOutlet(int lev) { - unsigned int mem_size_outlet_Q_k = sizeof(int)*parameter->getParH(lev)->QOutlet.kQ; - unsigned int mem_size_outlet_Q_q = sizeof(real)*parameter->getParH(lev)->QOutlet.kQ; - + unsigned int mem_size_outlet_Q_k = sizeof(int)*parameter->getParH(lev)->QOutlet.numberOfBCnodes; + unsigned int mem_size_outlet_Q_q = sizeof(real)*parameter->getParH(lev)->QOutlet.numberOfBCnodes; + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QOutlet.q27[0], parameter->getParH(lev)->QOutlet.q27[0], parameter->getD3Qxx()* mem_size_outlet_Q_q, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QOutlet.k, parameter->getParH(lev)->QOutlet.k, mem_size_outlet_Q_k, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QOutlet.kN, parameter->getParH(lev)->QOutlet.kN, mem_size_outlet_Q_k, cudaMemcpyHostToDevice)); @@ -1172,213 +1310,349 @@ void CudaMemoryManager::cudaFreeOutlet(int lev) //Geometrie inkl. Values void CudaMemoryManager::cudaAllocGeomValuesBC(int lev) { - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QGeom.kQ; - + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->geometryBC.numberOfBCnodes; + //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QGeom.Vx), mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QGeom.Vy), mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QGeom.Vz), mem_size_Q_q )); - + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geometryBC.Vx), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geometryBC.Vy), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geometryBC.Vz), mem_size_Q_q )); + //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QGeom.Vx), mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QGeom.Vy), mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QGeom.Vz), mem_size_Q_q )); - + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geometryBC.Vx), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geometryBC.Vy), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geometryBC.Vz), mem_size_Q_q )); + ////////////////////////////////////////////////////////////////////////// double tmp = 3. * (double)mem_size_Q_q; setMemsizeGPU(tmp, false); } void CudaMemoryManager::cudaCopyGeomValuesBC(int lev) { - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QGeom.kQ; - - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QGeom.Vx, parameter->getParH(lev)->QGeom.Vx, mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QGeom.Vy, parameter->getParH(lev)->QGeom.Vy, mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QGeom.Vz, parameter->getParH(lev)->QGeom.Vz, mem_size_Q_q, cudaMemcpyHostToDevice)); + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->geometryBC.numberOfBCnodes; + + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geometryBC.Vx, parameter->getParH(lev)->geometryBC.Vx, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geometryBC.Vy, parameter->getParH(lev)->geometryBC.Vy, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geometryBC.Vz, parameter->getParH(lev)->geometryBC.Vz, mem_size_Q_q, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeGeomValuesBC(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QGeom.Vx)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QGeom.Vy)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QGeom.Vz)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geometryBC.Vx)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geometryBC.Vy)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geometryBC.Vz)); } //Geometrie inkl. Normale f¸r Slip void CudaMemoryManager::cudaAllocGeomNormals(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QGeomNormalX.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QGeomNormalX.kQ; - + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->geometryBCnormalX.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->geometryBCnormalX.numberOfBCnodes; + //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QGeomNormalX.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QGeomNormalX.k), mem_size_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QGeomNormalY.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QGeomNormalY.k), mem_size_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QGeomNormalZ.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QGeomNormalZ.k), mem_size_Q_k )); - + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geometryBCnormalX.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geometryBCnormalX.k), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geometryBCnormalY.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geometryBCnormalY.k), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geometryBCnormalZ.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->geometryBCnormalZ.k), mem_size_Q_k )); + //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QGeomNormalX.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QGeomNormalX.k), mem_size_Q_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QGeomNormalY.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QGeomNormalY.k), mem_size_Q_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QGeomNormalZ.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QGeomNormalZ.k), mem_size_Q_k )); - + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geometryBCnormalX.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geometryBCnormalX.k), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geometryBCnormalY.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geometryBCnormalY.k), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geometryBCnormalZ.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->geometryBCnormalZ.k), mem_size_Q_k )); + ////////////////////////////////////////////////////////////////////////// double tmp = 3.0 * (double)mem_size_Q_k + 3.0 * (double)parameter->getD3Qxx()*(double)mem_size_Q_q; setMemsizeGPU(tmp, false); } void CudaMemoryManager::cudaCopyGeomNormals(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QGeomNormalX.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QGeomNormalX.kQ; - - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QGeomNormalX.q27[0], parameter->getParH(lev)->QGeomNormalX.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QGeomNormalX.k, parameter->getParH(lev)->QGeomNormalX.k, mem_size_Q_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QGeomNormalY.q27[0], parameter->getParH(lev)->QGeomNormalY.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QGeomNormalY.k, parameter->getParH(lev)->QGeomNormalY.k, mem_size_Q_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QGeomNormalZ.q27[0], parameter->getParH(lev)->QGeomNormalZ.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QGeomNormalZ.k, parameter->getParH(lev)->QGeomNormalZ.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->geometryBCnormalX.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->geometryBCnormalX.numberOfBCnodes; + + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geometryBCnormalX.q27[0], parameter->getParH(lev)->geometryBCnormalX.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geometryBCnormalX.k, parameter->getParH(lev)->geometryBCnormalX.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geometryBCnormalY.q27[0], parameter->getParH(lev)->geometryBCnormalY.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geometryBCnormalY.k, parameter->getParH(lev)->geometryBCnormalY.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geometryBCnormalZ.q27[0], parameter->getParH(lev)->geometryBCnormalZ.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->geometryBCnormalZ.k, parameter->getParH(lev)->geometryBCnormalZ.k, mem_size_Q_k, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeGeomNormals(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QGeomNormalX.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QGeomNormalX.k)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QGeomNormalY.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QGeomNormalY.k)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QGeomNormalZ.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QGeomNormalZ.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geometryBCnormalX.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geometryBCnormalX.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geometryBCnormalY.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geometryBCnormalY.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geometryBCnormalZ.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->geometryBCnormalZ.k)); } //Geometrie inkl. Normale f¸r Inflow void CudaMemoryManager::cudaAllocInflowNormals(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QInflowNormalX.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QInflowNormalX.kQ; - + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->inflowBCnormalX.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->inflowBCnormalX.numberOfBCnodes; + //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QInflowNormalX.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QInflowNormalX.k), mem_size_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QInflowNormalY.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QInflowNormalY.k), mem_size_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QInflowNormalZ.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QInflowNormalZ.k), mem_size_Q_k )); - + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->inflowBCnormalX.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->inflowBCnormalX.k), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->inflowBCnormalY.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->inflowBCnormalY.k), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->inflowBCnormalZ.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->inflowBCnormalZ.k), mem_size_Q_k )); + //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QInflowNormalX.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QInflowNormalX.k), mem_size_Q_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QInflowNormalY.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QInflowNormalY.k), mem_size_Q_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QInflowNormalZ.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QInflowNormalZ.k), mem_size_Q_k )); - + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->inflowBCnormalX.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->inflowBCnormalX.k), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->inflowBCnormalY.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->inflowBCnormalY.k), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->inflowBCnormalZ.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->inflowBCnormalZ.k), mem_size_Q_k )); + ////////////////////////////////////////////////////////////////////////// double tmp = 3.0 * (double)mem_size_Q_k + 3.0 * (double)parameter->getD3Qxx()*(double)mem_size_Q_q; setMemsizeGPU(tmp, false); } void CudaMemoryManager::cudaCopyInflowNormals(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QInflowNormalX.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QInflowNormalX.kQ; - - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QInflowNormalX.q27[0], parameter->getParH(lev)->QInflowNormalX.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QInflowNormalX.k, parameter->getParH(lev)->QInflowNormalX.k, mem_size_Q_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QInflowNormalY.q27[0], parameter->getParH(lev)->QInflowNormalY.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QInflowNormalY.k, parameter->getParH(lev)->QInflowNormalY.k, mem_size_Q_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QInflowNormalZ.q27[0], parameter->getParH(lev)->QInflowNormalZ.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QInflowNormalZ.k, parameter->getParH(lev)->QInflowNormalZ.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->inflowBCnormalX.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->inflowBCnormalX.numberOfBCnodes; + + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->inflowBCnormalX.q27[0], parameter->getParH(lev)->inflowBCnormalX.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->inflowBCnormalX.k, parameter->getParH(lev)->inflowBCnormalX.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->inflowBCnormalY.q27[0], parameter->getParH(lev)->inflowBCnormalY.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->inflowBCnormalY.k, parameter->getParH(lev)->inflowBCnormalY.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->inflowBCnormalZ.q27[0], parameter->getParH(lev)->inflowBCnormalZ.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->inflowBCnormalZ.k, parameter->getParH(lev)->inflowBCnormalZ.k, mem_size_Q_k, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeInflowNormals(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QInflowNormalX.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QInflowNormalX.k)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QInflowNormalY.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QInflowNormalY.k)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QInflowNormalZ.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QInflowNormalZ.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->inflowBCnormalX.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->inflowBCnormalX.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->inflowBCnormalY.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->inflowBCnormalY.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->inflowBCnormalZ.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->inflowBCnormalZ.k)); } //Geometrie inkl. Normale f¸r Outflow void CudaMemoryManager::cudaAllocOutflowNormals(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QOutflowNormalX.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QOutflowNormalX.kQ; - + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->outflowBCnormalX.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->outflowBCnormalX.numberOfBCnodes; + //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QOutflowNormalX.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QOutflowNormalX.k), mem_size_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QOutflowNormalY.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QOutflowNormalY.k), mem_size_Q_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QOutflowNormalZ.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QOutflowNormalZ.k), mem_size_Q_k )); - + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->outflowBCnormalX.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->outflowBCnormalX.k), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->outflowBCnormalY.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->outflowBCnormalY.k), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->outflowBCnormalZ.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->outflowBCnormalZ.k), mem_size_Q_k )); + //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QOutflowNormalX.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QOutflowNormalX.k), mem_size_Q_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QOutflowNormalY.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QOutflowNormalY.k), mem_size_Q_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QOutflowNormalZ.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QOutflowNormalZ.k), mem_size_Q_k )); - + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->outflowBCnormalX.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->outflowBCnormalX.k), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->outflowBCnormalY.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->outflowBCnormalY.k), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->outflowBCnormalZ.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->outflowBCnormalZ.k), mem_size_Q_k )); + ////////////////////////////////////////////////////////////////////////// double tmp = 3.0 * (double)mem_size_Q_k + 3.0 * (double)parameter->getD3Qxx()*(double)mem_size_Q_q; setMemsizeGPU(tmp, false); } void CudaMemoryManager::cudaCopyOutflowNormals(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QOutflowNormalX.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QOutflowNormalX.kQ; - - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QOutflowNormalX.q27[0], parameter->getParH(lev)->QOutflowNormalX.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QOutflowNormalX.k, parameter->getParH(lev)->QOutflowNormalX.k, mem_size_Q_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QOutflowNormalY.q27[0], parameter->getParH(lev)->QOutflowNormalY.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QOutflowNormalY.k, parameter->getParH(lev)->QOutflowNormalY.k, mem_size_Q_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QOutflowNormalZ.q27[0], parameter->getParH(lev)->QOutflowNormalZ.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QOutflowNormalZ.k, parameter->getParH(lev)->QOutflowNormalZ.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->outflowBCnormalX.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->outflowBCnormalX.numberOfBCnodes; + + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->outflowBCnormalX.q27[0], parameter->getParH(lev)->outflowBCnormalX.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->outflowBCnormalX.k, parameter->getParH(lev)->outflowBCnormalX.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->outflowBCnormalY.q27[0], parameter->getParH(lev)->outflowBCnormalY.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->outflowBCnormalY.k, parameter->getParH(lev)->outflowBCnormalY.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->outflowBCnormalZ.q27[0], parameter->getParH(lev)->outflowBCnormalZ.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->outflowBCnormalZ.k, parameter->getParH(lev)->outflowBCnormalZ.k, mem_size_Q_k, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeOutflowNormals(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QOutflowNormalX.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QOutflowNormalX.k)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QOutflowNormalY.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QOutflowNormalY.k)); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QOutflowNormalZ.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QOutflowNormalZ.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->outflowBCnormalX.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->outflowBCnormalX.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->outflowBCnormalY.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->outflowBCnormalY.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->outflowBCnormalZ.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->outflowBCnormalZ.k)); } //Slip void CudaMemoryManager::cudaAllocSlipBC(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QSlip.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QSlip.kQ; - //unsigned int mem_size_Q_value = sizeof(long long)*parameter->getParH(lev)->QSlip.kQ; //Geller - //unsigned int mem_size_Q_q_read = sizeof(real)*parameter->getParH(lev)->kSlipQread; //Geller - + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->slipBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->slipBC.numberOfBCnodes; //Host - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QSlip.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QSlip.k), mem_size_Q_k )); - //checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QSlip.qread), mem_size_Q_q_read ));//Geller - //checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QSlip.valueQ), mem_size_Q_value ));//Geller - + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->slipBC.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->slipBC.k), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->slipBC.normalX), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->slipBC.normalY), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->slipBC.normalZ), mem_size_Q_q )); + //Device - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QSlip.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QSlip.k), mem_size_Q_k )); - + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->slipBC.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->slipBC.k), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->slipBC.normalX), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->slipBC.normalY), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->slipBC.normalZ), mem_size_Q_q )); + ////////////////////////////////////////////////////////////////////////// - double tmp = (double)mem_size_Q_k + (double)parameter->getD3Qxx()*(double)mem_size_Q_q; + double tmp = (double)mem_size_Q_k + (double)parameter->getD3Qxx()*(double)mem_size_Q_q + 3.0*(double)mem_size_Q_q;; setMemsizeGPU(tmp, false); } void CudaMemoryManager::cudaCopySlipBC(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QSlip.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QSlip.kQ; - - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QSlip.q27[0], parameter->getParH(lev)->QSlip.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QSlip.k, parameter->getParH(lev)->QSlip.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->slipBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->slipBC.numberOfBCnodes; + + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->slipBC.q27[0], parameter->getParH(lev)->slipBC.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->slipBC.k, parameter->getParH(lev)->slipBC.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->slipBC.normalX, parameter->getParH(lev)->slipBC.normalX, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->slipBC.normalY, parameter->getParH(lev)->slipBC.normalY, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->slipBC.normalZ, parameter->getParH(lev)->slipBC.normalZ, mem_size_Q_q, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeSlipBC(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QSlip.q27[0])); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QSlip.k)); - //checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QSlip.valueQ)); - //checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QSlip.qread)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->slipBC.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->slipBC.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->slipBC.normalX)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->slipBC.normalY)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->slipBC.normalZ)); +} +//Stress +void CudaMemoryManager::cudaAllocStressBC(int lev) +{ + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->stressBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->stressBC.numberOfBCnodes; + + //Host + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.k), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.kN), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.normalX), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.normalY), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.normalZ), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.Vx), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.Vy), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.Vz), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.Vx1), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.Vy1), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->stressBC.Vz1), mem_size_Q_q )); + + //Device + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.k), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.kN), mem_size_Q_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.normalX), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.normalY), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.normalZ), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.Vx), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.Vy), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.Vz), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.Vx1), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.Vy1), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->stressBC.Vz1), mem_size_Q_q )); + + ////////////////////////////////////////////////////////////////////////// + double tmp = 2*(double)mem_size_Q_k + (double)parameter->getD3Qxx()*(double)mem_size_Q_q + 9.0*(double)mem_size_Q_q; + setMemsizeGPU(tmp, false); +} +void CudaMemoryManager::cudaCopyStressBC(int lev) +{ + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->stressBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->stressBC.numberOfBCnodes; + + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.q27[0], parameter->getParH(lev)->stressBC.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.k, parameter->getParH(lev)->stressBC.k, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.kN, parameter->getParH(lev)->stressBC.kN, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.normalX, parameter->getParH(lev)->stressBC.normalX, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.normalY, parameter->getParH(lev)->stressBC.normalY, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.normalZ, parameter->getParH(lev)->stressBC.normalZ, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.Vx, parameter->getParH(lev)->stressBC.Vx, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.Vy, parameter->getParH(lev)->stressBC.Vy, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.Vz, parameter->getParH(lev)->stressBC.Vz, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.Vx1, parameter->getParH(lev)->stressBC.Vx1, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.Vy1, parameter->getParH(lev)->stressBC.Vy1, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->stressBC.Vz1, parameter->getParH(lev)->stressBC.Vz1, mem_size_Q_q, cudaMemcpyHostToDevice)); + +} +void CudaMemoryManager::cudaFreeStressBC(int lev) +{ + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.q27[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.k)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.kN)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.normalX)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.normalY)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.normalZ)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.Vx)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.Vy)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.Vz)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.Vx1)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.Vy1)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->stressBC.Vz1)); +} +// Wall model +void CudaMemoryManager::cudaAllocWallModel(int lev, bool hasWallModelMonitor) +{ + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->stressBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->stressBC.numberOfBCnodes; + + //Host + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->wallModel.samplingOffset), mem_size_Q_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->wallModel.z0), mem_size_Q_q )); + if(hasWallModelMonitor) + { + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->wallModel.u_star), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->wallModel.Fx), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->wallModel.Fy), mem_size_Q_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->wallModel.Fz), mem_size_Q_q )); + } + + //Device + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->wallModel.samplingOffset), mem_size_Q_k)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->wallModel.z0), mem_size_Q_q)); + if(hasWallModelMonitor) + { + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->wallModel.u_star), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->wallModel.Fx), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->wallModel.Fy), mem_size_Q_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->wallModel.Fz), mem_size_Q_q )); + } + + ////////////////////////////////////////////////////////////////////////// + double tmp = (double)mem_size_Q_k + (double)mem_size_Q_q; + setMemsizeGPU(tmp, false); +} +void CudaMemoryManager::cudaCopyWallModel(int lev, bool hasWallModelMonitor) +{ + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->stressBC.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->stressBC.numberOfBCnodes; + + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->wallModel.samplingOffset, parameter->getParH(lev)->wallModel.samplingOffset, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->wallModel.z0, parameter->getParH(lev)->wallModel.z0, mem_size_Q_q, cudaMemcpyHostToDevice)); + if(hasWallModelMonitor) + { + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->wallModel.u_star, parameter->getParH(lev)->wallModel.u_star, mem_size_Q_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->wallModel.Fx, parameter->getParH(lev)->wallModel.Fx, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->wallModel.Fy, parameter->getParH(lev)->wallModel.Fy, mem_size_Q_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->wallModel.Fz, parameter->getParH(lev)->wallModel.Fz, mem_size_Q_q, cudaMemcpyHostToDevice)); + } +} +void CudaMemoryManager::cudaFreeWallModel(int lev, bool hasWallModelMonitor) +{ + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->wallModel.samplingOffset)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->wallModel.z0)); + if(hasWallModelMonitor) + { + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->wallModel.u_star)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->wallModel.Fx)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->wallModel.Fy)); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->wallModel.Fz)); + } } //Test roundoff error @@ -1410,9 +1684,9 @@ void CudaMemoryManager::cudaFreeTestRE(int lev) //PressX0 = X-inflow void CudaMemoryManager::cudaAllocPressX0(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QpressX0.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QpressX0.kQ; - + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QpressX0.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QpressX0.numberOfBCnodes; + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QpressX0.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QpressX0.k), mem_size_Q_k )); @@ -1422,7 +1696,7 @@ void CudaMemoryManager::cudaAllocPressX0(int lev) checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QpressX0.Vz), mem_size_Q_q )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QpressX0.RhoBC), mem_size_Q_q )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QpressX0.deltaVz), mem_size_Q_q )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QpressX0.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QpressX0.k), mem_size_Q_k )); @@ -1432,16 +1706,16 @@ void CudaMemoryManager::cudaAllocPressX0(int lev) checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QpressX0.Vz), mem_size_Q_q )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QpressX0.RhoBC), mem_size_Q_q )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QpressX0.deltaVz), mem_size_Q_q )); - + ////////////////////////////////////////////////////////////////////////// double tmp = 2. * (double)mem_size_Q_k + 5. * (double)mem_size_Q_q + (double)parameter->getD3Qxx()*(double)mem_size_Q_q; setMemsizeGPU(tmp, false); } void CudaMemoryManager::cudaCopyPressX0(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QpressX0.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QpressX0.kQ; - + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QpressX0.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QpressX0.numberOfBCnodes; + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QpressX0.q27[0], parameter->getParH(lev)->QpressX0.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QpressX0.k, parameter->getParH(lev)->QpressX0.k, mem_size_Q_k, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QpressX0.kN, parameter->getParH(lev)->QpressX0.kN, mem_size_Q_k, cudaMemcpyHostToDevice)); @@ -1465,9 +1739,9 @@ void CudaMemoryManager::cudaFreePressX0(int lev) //PressX1 = X-outflow void CudaMemoryManager::cudaAllocPressX1(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QpressX1.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QpressX1.kQ; - + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QpressX1.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QpressX1.numberOfBCnodes; + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QpressX1.q27[0]), parameter->getD3Qxx()*mem_size_Q_q )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QpressX1.k), mem_size_Q_k )); @@ -1477,7 +1751,7 @@ void CudaMemoryManager::cudaAllocPressX1(int lev) checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QpressX1.Vz), mem_size_Q_q )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QpressX1.RhoBC), mem_size_Q_q )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QpressX1.deltaVz), mem_size_Q_q )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QpressX1.q27[0]), parameter->getD3Qxx()* mem_size_Q_q )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QpressX1.k), mem_size_Q_k )); @@ -1487,16 +1761,16 @@ void CudaMemoryManager::cudaAllocPressX1(int lev) checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QpressX1.Vz), mem_size_Q_q )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QpressX1.RhoBC), mem_size_Q_q )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QpressX1.deltaVz), mem_size_Q_q )); - + ////////////////////////////////////////////////////////////////////////// double tmp = 2. * (double)mem_size_Q_k + 5. * (double)mem_size_Q_q + (double)parameter->getD3Qxx()*(double)mem_size_Q_q; setMemsizeGPU(tmp, false); } void CudaMemoryManager::cudaCopyPressX1(int lev) { - unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QpressX1.kQ; - unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QpressX1.kQ; - + unsigned int mem_size_Q_k = sizeof(int)*parameter->getParH(lev)->QpressX1.numberOfBCnodes; + unsigned int mem_size_Q_q = sizeof(real)*parameter->getParH(lev)->QpressX1.numberOfBCnodes; + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QpressX1.q27[0], parameter->getParH(lev)->QpressX1.q27[0], parameter->getD3Qxx()* mem_size_Q_q, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QpressX1.k, parameter->getParH(lev)->QpressX1.k, mem_size_Q_k, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QpressX1.kN, parameter->getParH(lev)->QpressX1.kN, mem_size_Q_k, cudaMemcpyHostToDevice)); @@ -1520,49 +1794,49 @@ void CudaMemoryManager::cudaFreePressX1(int lev) //Propeller Velocity void CudaMemoryManager::cudaAllocVeloPropeller(int lev) { - unsigned int mem_size_Propeller_k = sizeof(int)*parameter->getParH(lev)->QPropeller.kQ; - unsigned int mem_size_Propeller_q = sizeof(real)*parameter->getParH(lev)->QPropeller.kQ; - + unsigned int mem_size_Propeller_k = sizeof(int)*parameter->getParH(lev)->propellerBC.numberOfBCnodes; + unsigned int mem_size_Propeller_q = sizeof(real)*parameter->getParH(lev)->propellerBC.numberOfBCnodes; + //Host - //checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QPropeller.q27[0]), parameter->getD3Qxx()*mem_size_Propeller_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QPropeller.k), mem_size_Propeller_k )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QPropeller.Vx), mem_size_Propeller_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QPropeller.Vy), mem_size_Propeller_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QPropeller.Vz), mem_size_Propeller_q )); - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->QPropeller.RhoBC), mem_size_Propeller_q )); - + //checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->propellerBC.q27[0]), parameter->getD3Qxx()*mem_size_Propeller_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->propellerBC.k), mem_size_Propeller_k )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->propellerBC.Vx), mem_size_Propeller_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->propellerBC.Vy), mem_size_Propeller_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->propellerBC.Vz), mem_size_Propeller_q )); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->propellerBC.RhoBC), mem_size_Propeller_q )); + //Device - //checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QPropeller.q27[0]), parameter->getD3Qxx()*mem_size_Propeller_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QPropeller.k), mem_size_Propeller_k )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QPropeller.Vx), mem_size_Propeller_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QPropeller.Vy), mem_size_Propeller_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QPropeller.Vz), mem_size_Propeller_q )); - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->QPropeller.RhoBC), mem_size_Propeller_q )); - + //checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->propellerBC.q27[0]), parameter->getD3Qxx()*mem_size_Propeller_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->propellerBC.k), mem_size_Propeller_k )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->propellerBC.Vx), mem_size_Propeller_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->propellerBC.Vy), mem_size_Propeller_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->propellerBC.Vz), mem_size_Propeller_q )); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->propellerBC.RhoBC), mem_size_Propeller_q )); + ////////////////////////////////////////////////////////////////////////// double tmp = (double)mem_size_Propeller_k + 4. * (double)mem_size_Propeller_q; setMemsizeGPU(tmp, false); } void CudaMemoryManager::cudaCopyVeloPropeller(int lev) { - unsigned int mem_size_Propeller_k = sizeof(int)*parameter->getParH(lev)->QPropeller.kQ; - unsigned int mem_size_Propeller_q = sizeof(real)*parameter->getParH(lev)->QPropeller.kQ; - - //checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QPropeller.q27[0], parameter->getParH(lev)->QPropeller.q27[0], parameter->getD3Qxx()* mem_size_Propeller_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QPropeller.k, parameter->getParH(lev)->QPropeller.k, mem_size_Propeller_k, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QPropeller.Vx, parameter->getParH(lev)->QPropeller.Vx, mem_size_Propeller_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QPropeller.Vy, parameter->getParH(lev)->QPropeller.Vy, mem_size_Propeller_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QPropeller.Vz, parameter->getParH(lev)->QPropeller.Vz, mem_size_Propeller_q, cudaMemcpyHostToDevice)); - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->QPropeller.RhoBC, parameter->getParH(lev)->QPropeller.RhoBC, mem_size_Propeller_q, cudaMemcpyHostToDevice)); + unsigned int mem_size_Propeller_k = sizeof(int)*parameter->getParH(lev)->propellerBC.numberOfBCnodes; + unsigned int mem_size_Propeller_q = sizeof(real)*parameter->getParH(lev)->propellerBC.numberOfBCnodes; + + //checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->propellerBC.q27[0], parameter->getParH(lev)->propellerBC.q27[0], parameter->getD3Qxx()* mem_size_Propeller_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->propellerBC.k, parameter->getParH(lev)->propellerBC.k, mem_size_Propeller_k, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->propellerBC.Vx, parameter->getParH(lev)->propellerBC.Vx, mem_size_Propeller_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->propellerBC.Vy, parameter->getParH(lev)->propellerBC.Vy, mem_size_Propeller_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->propellerBC.Vz, parameter->getParH(lev)->propellerBC.Vz, mem_size_Propeller_q, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->propellerBC.RhoBC, parameter->getParH(lev)->propellerBC.RhoBC, mem_size_Propeller_q, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeVeloPropeller(int lev) { - //checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QPropeller.q27[0] )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QPropeller.k )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QPropeller.Vx )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QPropeller.Vy )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QPropeller.Vz )); - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->QPropeller.RhoBC )); + //checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->propellerBC.q27[0] )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->propellerBC.k )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->propellerBC.Vx )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->propellerBC.Vy )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->propellerBC.Vz )); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->propellerBC.RhoBC )); } //Measure Points //void CudaMemoryManager::cudaAllocMeasurePoints(int lev, int i) @@ -1601,14 +1875,14 @@ void CudaMemoryManager::cudaAllocMeasurePointsIndex(int lev) checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->VyMP), parameter->getParH(lev)->memSizerealkMP )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->VzMP), parameter->getParH(lev)->memSizerealkMP )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->RhoMP), parameter->getParH(lev)->memSizerealkMP )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->kMP), parameter->getParD(lev)->memSizeIntkMP )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->VxMP), parameter->getParD(lev)->memSizerealkMP )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->VyMP), parameter->getParD(lev)->memSizerealkMP )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->VzMP), parameter->getParD(lev)->memSizerealkMP )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->RhoMP), parameter->getParD(lev)->memSizerealkMP )); - + ////////////////////////////////////////////////////////////////////////// double tmp = (double)parameter->getParH(lev)->memSizeIntkMP + 4. * (double)parameter->getParH(lev)->memSizerealkMP; setMemsizeGPU(tmp, false); @@ -1639,25 +1913,25 @@ void CudaMemoryManager::cudaFreeMeasurePointsIndex(int lev) } void CudaMemoryManager::cudaAllocFsForCheckPointAndRestart(int lev) { - checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->d0SP.f[0] ), (unsigned long long)parameter->getD3Qxx()*(unsigned long long)parameter->getParH(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->distributions.f[0] ), (unsigned long long)parameter->getD3Qxx()*(unsigned long long)parameter->getParH(lev)->mem_size_real_SP)); } void CudaMemoryManager::cudaCopyFsForRestart(int lev) { - checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->d0SP.f[0], parameter->getParH(lev)->d0SP.f[0], (unsigned long long)parameter->getD3Qxx()*(unsigned long long)parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->distributions.f[0], parameter->getParH(lev)->distributions.f[0], (unsigned long long)parameter->getD3Qxx()*(unsigned long long)parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaCopyFsForCheckPoint(int lev) { - checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->d0SP.f[0], parameter->getParD(lev)->d0SP.f[0], (unsigned long long)parameter->getD3Qxx()*(unsigned long long)parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->distributions.f[0], parameter->getParD(lev)->distributions.f[0], (unsigned long long)parameter->getD3Qxx()*(unsigned long long)parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); } void CudaMemoryManager::cudaFreeFsForCheckPointAndRestart(int lev) { - checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->d0SP.f[0])); + checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->distributions.f[0])); } //DragLift void CudaMemoryManager::cudaAllocDragLift(int lev, int numofelem) { unsigned int mem_size = sizeof(double)*numofelem; - + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->DragPreX), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->DragPreY), mem_size )); @@ -1665,7 +1939,7 @@ void CudaMemoryManager::cudaAllocDragLift(int lev, int numofelem) checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->DragPostX), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->DragPostY), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->DragPostZ), mem_size )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->DragPreX), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->DragPreY), mem_size )); @@ -1673,7 +1947,7 @@ void CudaMemoryManager::cudaAllocDragLift(int lev, int numofelem) checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->DragPostX), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->DragPostY), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->DragPostZ), mem_size )); - + ////////////////////////////////////////////////////////////////////////// double tmp = 6. * (double)mem_size; setMemsizeGPU(tmp, false); @@ -1681,7 +1955,7 @@ void CudaMemoryManager::cudaAllocDragLift(int lev, int numofelem) void CudaMemoryManager::cudaCopyDragLift(int lev, int numofelem) { unsigned int mem_size = sizeof(double)*numofelem; - + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->DragPreX, parameter->getParD(lev)->DragPreX, mem_size, cudaMemcpyDeviceToHost)); checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->DragPreY, parameter->getParD(lev)->DragPreY, mem_size, cudaMemcpyDeviceToHost)); checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->DragPreZ, parameter->getParD(lev)->DragPreZ, mem_size, cudaMemcpyDeviceToHost)); @@ -1702,21 +1976,21 @@ void CudaMemoryManager::cudaFreeDragLift(int lev) void CudaMemoryManager::cudaAlloc2ndMoments(int lev, int numofelem) { unsigned int mem_size = sizeof(real)*numofelem; - + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->kxyFromfcNEQ ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->kyzFromfcNEQ ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->kxzFromfcNEQ ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->kxxMyyFromfcNEQ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->kxxMzzFromfcNEQ), mem_size )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->kxyFromfcNEQ ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->kyzFromfcNEQ ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->kxzFromfcNEQ ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->kxxMyyFromfcNEQ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->kxxMzzFromfcNEQ), mem_size )); - + ////////////////////////////////////////////////////////////////////////// double tmp = 5. * (double)mem_size; setMemsizeGPU(tmp, false); @@ -1724,7 +1998,7 @@ void CudaMemoryManager::cudaAlloc2ndMoments(int lev, int numofelem) void CudaMemoryManager::cudaCopy2ndMoments(int lev, int numofelem) { unsigned int mem_size = sizeof(real)*numofelem; - + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->kxyFromfcNEQ , parameter->getParD(lev)->kxyFromfcNEQ , mem_size, cudaMemcpyDeviceToHost)); checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->kyzFromfcNEQ , parameter->getParD(lev)->kyzFromfcNEQ , mem_size, cudaMemcpyDeviceToHost)); checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->kxzFromfcNEQ , parameter->getParD(lev)->kxzFromfcNEQ , mem_size, cudaMemcpyDeviceToHost)); @@ -1743,7 +2017,7 @@ void CudaMemoryManager::cudaFree2ndMoments(int lev) void CudaMemoryManager::cudaAlloc3rdMoments(int lev, int numofelem) { unsigned int mem_size = sizeof(real)*numofelem; - + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->CUMbbb ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->CUMabc ), mem_size )); @@ -1752,7 +2026,7 @@ void CudaMemoryManager::cudaAlloc3rdMoments(int lev, int numofelem) checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->CUMcba ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->CUMacb ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->CUMcab ), mem_size )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->CUMbbb ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->CUMabc ), mem_size )); @@ -1761,7 +2035,7 @@ void CudaMemoryManager::cudaAlloc3rdMoments(int lev, int numofelem) checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->CUMcba ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->CUMacb ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->CUMcab ), mem_size )); - + ////////////////////////////////////////////////////////////////////////// double tmp = 7. * (double)mem_size; setMemsizeGPU(tmp, false); @@ -1769,7 +2043,7 @@ void CudaMemoryManager::cudaAlloc3rdMoments(int lev, int numofelem) void CudaMemoryManager::cudaCopy3rdMoments(int lev, int numofelem) { unsigned int mem_size = sizeof(real)*numofelem; - + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->CUMbbb, parameter->getParD(lev)->CUMbbb, mem_size, cudaMemcpyDeviceToHost)); checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->CUMabc, parameter->getParD(lev)->CUMabc, mem_size, cudaMemcpyDeviceToHost)); checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->CUMbac, parameter->getParD(lev)->CUMbac, mem_size, cudaMemcpyDeviceToHost)); @@ -1792,7 +2066,7 @@ void CudaMemoryManager::cudaFree3rdMoments(int lev) void CudaMemoryManager::cudaAllocHigherMoments(int lev, int numofelem) { unsigned int mem_size = sizeof(real)*numofelem; - + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->CUMcbb ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->CUMbcb ), mem_size )); @@ -1804,7 +2078,7 @@ void CudaMemoryManager::cudaAllocHigherMoments(int lev, int numofelem) checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->CUMcbc ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->CUMccb ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->CUMccc ), mem_size )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->CUMcbb ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->CUMbcb ), mem_size )); @@ -1816,7 +2090,7 @@ void CudaMemoryManager::cudaAllocHigherMoments(int lev, int numofelem) checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->CUMcbc ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->CUMccb ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->CUMccc ), mem_size )); - + ////////////////////////////////////////////////////////////////////////// double tmp = 10. * (double)mem_size; setMemsizeGPU(tmp, false); @@ -1824,7 +2098,7 @@ void CudaMemoryManager::cudaAllocHigherMoments(int lev, int numofelem) void CudaMemoryManager::cudaCopyHigherMoments(int lev, int numofelem) { unsigned int mem_size = sizeof(real)*numofelem; - + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->CUMcbb, parameter->getParD(lev)->CUMcbb, mem_size, cudaMemcpyDeviceToHost)); checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->CUMbcb, parameter->getParD(lev)->CUMbcb, mem_size, cudaMemcpyDeviceToHost)); checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->CUMbbc, parameter->getParD(lev)->CUMbbc, mem_size, cudaMemcpyDeviceToHost)); @@ -1853,17 +2127,17 @@ void CudaMemoryManager::cudaFreeHigherMoments(int lev) void CudaMemoryManager::cudaAllocForceVelo(int lev, int numofelem) { unsigned int mem_size = sizeof(real)*numofelem; - + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->VxForce ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->VyForce ), mem_size )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->VzForce ), mem_size )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->VxForce ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->VyForce ), mem_size )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->VzForce ), mem_size )); - + ////////////////////////////////////////////////////////////////////////// double tmp = 3. * (double)mem_size; setMemsizeGPU(tmp, false); @@ -1871,7 +2145,7 @@ void CudaMemoryManager::cudaAllocForceVelo(int lev, int numofelem) void CudaMemoryManager::cudaCopyForceVelo(int lev, int numofelem) { unsigned int mem_size = sizeof(real)*numofelem; - + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->VxForce , parameter->getParD(lev)->VxForce , mem_size, cudaMemcpyDeviceToHost)); checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->VyForce , parameter->getParD(lev)->VyForce , mem_size, cudaMemcpyDeviceToHost)); checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->VzForce , parameter->getParD(lev)->VzForce , mem_size, cudaMemcpyDeviceToHost)); @@ -1887,15 +2161,15 @@ void CudaMemoryManager::cudaAllocCpTop(int lev) { unsigned int mem_size_double = sizeof(double) * parameter->getParH(lev)->numberOfPointsCpTop; unsigned int mem_size_int = sizeof(unsigned int) * parameter->getParH(lev)->numberOfPointsCpTop; - + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->cpPressTop), mem_size_double )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->cpTopIndex), mem_size_int )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->cpPressTop), mem_size_double )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->cpTopIndex), mem_size_int )); - + ////////////////////////////////////////////////////////////////////////// double tmp = (double)mem_size_double + (double)mem_size_int; setMemsizeGPU(tmp, false); @@ -1904,7 +2178,7 @@ void CudaMemoryManager::cudaCopyCpTopInit(int lev) { unsigned int mem_size_double = sizeof(double) * parameter->getParH(lev)->numberOfPointsCpTop; unsigned int mem_size_int = sizeof(unsigned int) * parameter->getParH(lev)->numberOfPointsCpTop; - + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->cpPressTop, parameter->getParH(lev)->cpPressTop, mem_size_double, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->cpTopIndex, parameter->getParH(lev)->cpTopIndex, mem_size_int, cudaMemcpyHostToDevice)); } @@ -1912,7 +2186,7 @@ void CudaMemoryManager::cudaCopyCpTop(int lev) { unsigned int mem_size_double = sizeof(double) * parameter->getParH(lev)->numberOfPointsCpTop; //unsigned int mem_size_int = sizeof(unsigned int) * parameter->getParH(lev)->numberOfPointsCpTop; - + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->cpPressTop, parameter->getParD(lev)->cpPressTop, mem_size_double, cudaMemcpyDeviceToHost)); //checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->cpTopIndex, parameter->getParD(lev)->cpTopIndex, mem_size_int, cudaMemcpyDeviceToHost)); } @@ -1926,15 +2200,15 @@ void CudaMemoryManager::cudaAllocCpBottom(int lev) { unsigned int mem_size_double = sizeof(double) * parameter->getParH(lev)->numberOfPointsCpBottom; unsigned int mem_size_int = sizeof(unsigned int) * parameter->getParH(lev)->numberOfPointsCpBottom; - + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->cpPressBottom), mem_size_double )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->cpBottomIndex), mem_size_int )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->cpPressBottom), mem_size_double )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->cpBottomIndex), mem_size_int )); - + ////////////////////////////////////////////////////////////////////////// double tmp = (double)mem_size_double + (double)mem_size_int; setMemsizeGPU(tmp, false); @@ -1943,7 +2217,7 @@ void CudaMemoryManager::cudaCopyCpBottomInit(int lev) { unsigned int mem_size_double = sizeof(double) * parameter->getParH(lev)->numberOfPointsCpBottom; unsigned int mem_size_int = sizeof(unsigned int) * parameter->getParH(lev)->numberOfPointsCpBottom; - + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->cpPressBottom, parameter->getParH(lev)->cpPressBottom, mem_size_double, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->cpBottomIndex, parameter->getParH(lev)->cpBottomIndex, mem_size_int, cudaMemcpyHostToDevice)); } @@ -1951,7 +2225,7 @@ void CudaMemoryManager::cudaCopyCpBottom(int lev) { unsigned int mem_size_double = sizeof(double) * parameter->getParH(lev)->numberOfPointsCpBottom; //unsigned int mem_size_int = sizeof(unsigned int) * parameter->getParH(lev)->numberOfPointsCpBottom; - + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->cpPressBottom, parameter->getParD(lev)->cpPressBottom, mem_size_double, cudaMemcpyDeviceToHost)); //checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->cpBottomIndex, parameter->getParD(lev)->cpBottomIndex, mem_size_int, cudaMemcpyDeviceToHost)); } @@ -1965,15 +2239,15 @@ void CudaMemoryManager::cudaAllocCpBottom2(int lev) { unsigned int mem_size_double = sizeof(double) * parameter->getParH(lev)->numberOfPointsCpBottom2; unsigned int mem_size_int = sizeof(unsigned int) * parameter->getParH(lev)->numberOfPointsCpBottom2; - + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->cpPressBottom2), mem_size_double )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->cpBottom2Index), mem_size_int )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->cpPressBottom2), mem_size_double )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->cpBottom2Index), mem_size_int )); - + ////////////////////////////////////////////////////////////////////////// double tmp = (double)mem_size_double + (double)mem_size_int; setMemsizeGPU(tmp, false); @@ -1982,14 +2256,14 @@ void CudaMemoryManager::cudaCopyCpBottom2Init(int lev) { unsigned int mem_size_double = sizeof(double) * parameter->getParH(lev)->numberOfPointsCpBottom2; unsigned int mem_size_int = sizeof(unsigned int) * parameter->getParH(lev)->numberOfPointsCpBottom2; - + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->cpPressBottom2, parameter->getParH(lev)->cpPressBottom2, mem_size_double, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->cpBottom2Index, parameter->getParH(lev)->cpBottom2Index, mem_size_int, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaCopyCpBottom2(int lev) { unsigned int mem_size_double = sizeof(double) * parameter->getParH(lev)->numberOfPointsCpBottom2; - + checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->cpPressBottom2, parameter->getParD(lev)->cpPressBottom2, mem_size_double, cudaMemcpyDeviceToHost)); } void CudaMemoryManager::cudaFreeCpBottom2(int lev) @@ -2017,7 +2291,7 @@ void CudaMemoryManager::cudaAllocParticles(int lev) checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->plp.timestep), parameter->getParH(lev)->plp.memSizeTimestep )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->plp.stuck), parameter->getParH(lev)->plp.memSizeBool )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->plp.hot), parameter->getParH(lev)->plp.memSizeBoolBC )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->plp.coordXlocal), parameter->getParD(lev)->plp.memSizerealAll )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->plp.coordYlocal), parameter->getParD(lev)->plp.memSizerealAll )); @@ -2034,13 +2308,13 @@ void CudaMemoryManager::cudaAllocParticles(int lev) checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->plp.timestep), parameter->getParD(lev)->plp.memSizeTimestep )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->plp.stuck), parameter->getParD(lev)->plp.memSizeBool )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->plp.hot), parameter->getParD(lev)->plp.memSizeBoolBC )); - + ////////////////////////////////////////////////////////////////////////// - double tmp = - (double)parameter->getParD(lev)->plp.memSizerealAll * (double)9.0 + - (double)parameter->getParD(lev)->plp.memSizeID * (double)2.0 + - (double)parameter->getParD(lev)->plp.memSizeTimestep + - (double)parameter->getParD(lev)->plp.memSizeBool + + double tmp = + (double)parameter->getParD(lev)->plp.memSizerealAll * (double)9.0 + + (double)parameter->getParD(lev)->plp.memSizeID * (double)2.0 + + (double)parameter->getParD(lev)->plp.memSizeTimestep + + (double)parameter->getParD(lev)->plp.memSizeBool + (double)parameter->getParD(lev)->plp.memSizeBoolBC; setMemsizeGPU(tmp, false); } @@ -2094,11 +2368,11 @@ void CudaMemoryManager::cudaAllocPorousMedia(PorousMedia* pm, int lev) //std::cout << "cudaMallocHost" << endl; //Host checkCudaErrors(cudaMallocHost((void**) &(tmpIDHost), mem_size_IDsPM)); - + //std::cout << "cudaMalloc" << endl; //Device checkCudaErrors(cudaMalloc((void**) &(tmpIDDevice), mem_size_IDsPM)); - + //std::cout << "set Host and Device arrays PM" << endl; ////////////////////////////////////////////////////////////////////////// pm->setHostNodeIDsPM(tmpIDHost); @@ -2123,7 +2397,7 @@ void CudaMemoryManager::cudaFreePorousMedia(PorousMedia* pm, int lev) } ////////////////////////////////////////////////////////////////////////// //advection diffusion -void CudaMemoryManager::cudaAllocConc(int lev) +void CudaMemoryManager::cudaAllocConcentration(int lev) { //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->Conc), parameter->getParH(lev)->mem_size_real_SP)); @@ -2133,15 +2407,15 @@ void CudaMemoryManager::cudaAllocConc(int lev) double tmp = (double)parameter->getParH(lev)->mem_size_real_SP; setMemsizeGPU(tmp, false); } -void CudaMemoryManager::cudaCopyConcDH(int lev) +void CudaMemoryManager::cudaCopyConcentrationDeviceToHost(int lev) { checkCudaErrors( cudaMemcpy(parameter->getParH(lev)->Conc, parameter->getParD(lev)->Conc, parameter->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost)); } -void CudaMemoryManager::cudaCopyConcHD(int lev) +void CudaMemoryManager::cudaCopyConcentrationHostToDevice(int lev) { checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Conc, parameter->getParH(lev)->Conc, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); } -void CudaMemoryManager::cudaFreeConc(int lev) +void CudaMemoryManager::cudaFreeConcentration(int lev) { checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->Conc)); } @@ -2151,11 +2425,11 @@ void CudaMemoryManager::cudaAllocTempFs(int lev) //Device if (parameter->getDiffMod() == 7) { - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->d7.f[0]), parameter->getDiffMod()*parameter->getParH(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->distributionsAD7.f[0]), parameter->getDiffMod()*parameter->getParH(lev)->mem_size_real_SP)); } else if (parameter->getDiffMod() == 27) { - checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->d27.f[0]), parameter->getDiffMod()*parameter->getParH(lev)->mem_size_real_SP)); + checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->distributionsAD27.f[0]), parameter->getDiffMod()*parameter->getParH(lev)->mem_size_real_SP)); } ////////////////////////////////////////////////////////////////////////// double tmp = (double)(parameter->getDiffMod() * parameter->getParH(lev)->mem_size_real_SP); @@ -2166,12 +2440,12 @@ void CudaMemoryManager::cudaAllocTempPressBC(int lev) { unsigned int mem_size_TempPress_k = sizeof(int)*parameter->getParH(lev)->TempPress.kTemp; unsigned int mem_size_TempPress_q = sizeof(real)*parameter->getParH(lev)->TempPress.kTemp; - + // Host Memory checkCudaErrors( cudaMallocHost((void**) ¶meter->getParH(lev)->TempPress.temp, mem_size_TempPress_q )); checkCudaErrors( cudaMallocHost((void**) ¶meter->getParH(lev)->TempPress.velo, mem_size_TempPress_q )); checkCudaErrors( cudaMallocHost((void**) ¶meter->getParH(lev)->TempPress.k, mem_size_TempPress_k )); - + // Device Memory checkCudaErrors( cudaMalloc((void**) ¶meter->getParD(lev)->TempPress.temp, mem_size_TempPress_q)); checkCudaErrors( cudaMalloc((void**) ¶meter->getParD(lev)->TempPress.velo, mem_size_TempPress_q)); @@ -2184,7 +2458,7 @@ void CudaMemoryManager::cudaCopyTempPressBCHD(int lev) { unsigned int mem_size_TempPress_k = sizeof(int)*parameter->getParH(lev)->TempPress.kTemp; unsigned int mem_size_TempPress_q = sizeof(real)*parameter->getParH(lev)->TempPress.kTemp; - + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->TempPress.temp, parameter->getParH(lev)->TempPress.temp, mem_size_TempPress_q, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->TempPress.velo, parameter->getParH(lev)->TempPress.velo, mem_size_TempPress_q, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->TempPress.k, parameter->getParH(lev)->TempPress.k, mem_size_TempPress_k, cudaMemcpyHostToDevice)); @@ -2200,14 +2474,14 @@ void CudaMemoryManager::cudaAllocTempVeloBC(int lev) { unsigned int mem_size_TempVel_k = sizeof(int)*parameter->getParH(lev)->TempVel.kTemp; unsigned int mem_size_TempVel_q = sizeof(real)*parameter->getParH(lev)->TempVel.kTemp; - + printf("mem_size_TempVel_k = %d, mem_size_TempVel_q = %d \n", mem_size_TempVel_k, mem_size_TempVel_q); // Host Memory checkCudaErrors( cudaMallocHost((void**) ¶meter->getParH(lev)->TempVel.temp, mem_size_TempVel_q )); checkCudaErrors( cudaMallocHost((void**) ¶meter->getParH(lev)->TempVel.tempPulse, mem_size_TempVel_q )); checkCudaErrors( cudaMallocHost((void**) ¶meter->getParH(lev)->TempVel.velo, mem_size_TempVel_q )); checkCudaErrors( cudaMallocHost((void**) ¶meter->getParH(lev)->TempVel.k, mem_size_TempVel_k )); - + // Device Memory checkCudaErrors( cudaMalloc((void**) ¶meter->getParD(lev)->TempVel.temp, mem_size_TempVel_q)); checkCudaErrors( cudaMalloc((void**) ¶meter->getParD(lev)->TempVel.tempPulse, mem_size_TempVel_q)); @@ -2221,7 +2495,7 @@ void CudaMemoryManager::cudaCopyTempVeloBCHD(int lev) { unsigned int mem_size_TempVel_k = sizeof(int)*parameter->getParH(lev)->TempVel.kTemp; unsigned int mem_size_TempVel_q = sizeof(real)*parameter->getParH(lev)->TempVel.kTemp; - + printf("mem_size_TempVel_k = %d, mem_size_TempVel_q = %d \n", mem_size_TempVel_k, mem_size_TempVel_q); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->TempVel.temp, parameter->getParH(lev)->TempVel.temp, mem_size_TempVel_q, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->TempVel.tempPulse, parameter->getParH(lev)->TempVel.tempPulse, mem_size_TempVel_q, cudaMemcpyHostToDevice)); @@ -2240,11 +2514,11 @@ void CudaMemoryManager::cudaAllocTempNoSlipBC(int lev) { unsigned int mem_size_Temp_k = sizeof(int)*parameter->getParH(lev)->Temp.kTemp; unsigned int mem_size_Temp_q = sizeof(real)*parameter->getParH(lev)->Temp.kTemp; - + // Host Memory checkCudaErrors( cudaMallocHost((void**) ¶meter->getParH(lev)->Temp.temp, mem_size_Temp_q )); checkCudaErrors( cudaMallocHost((void**) ¶meter->getParH(lev)->Temp.k, mem_size_Temp_k )); - + // Device Memory checkCudaErrors( cudaMalloc((void**) ¶meter->getParD(lev)->Temp.temp, mem_size_Temp_q)); checkCudaErrors( cudaMalloc((void**) ¶meter->getParD(lev)->Temp.k, mem_size_Temp_k)); @@ -2256,7 +2530,7 @@ void CudaMemoryManager::cudaCopyTempNoSlipBCHD(int lev) { unsigned int mem_size_Temp_k = sizeof(int)*parameter->getParH(lev)->Temp.kTemp; unsigned int mem_size_Temp_q = sizeof(real)*parameter->getParH(lev)->Temp.kTemp; - + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Temp.temp, parameter->getParH(lev)->Temp.temp, mem_size_Temp_q, cudaMemcpyHostToDevice)); checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->Temp.k, parameter->getParH(lev)->Temp.k, mem_size_Temp_k, cudaMemcpyHostToDevice)); } @@ -2307,7 +2581,7 @@ void CudaMemoryManager::cudaAllocPlaneConcOut2(int lev, int numofelem) checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->ConcPlaneOut2), mem_size )); //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->ConcPlaneOut2), mem_size )); - + ////////////////////////////////////////////////////////////////////////// double tmp = (double)mem_size; setMemsizeGPU(tmp, false); @@ -2328,13 +2602,13 @@ void CudaMemoryManager::cudaFreePlaneConc(int lev) void CudaMemoryManager::cudaAllocConcFile(int lev) { unsigned int mem_size_int = sizeof(unsigned int) * parameter->getParH(lev)->numberOfPointsConc; - + //Host checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->concIndex), mem_size_int )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->concIndex), mem_size_int )); - + ////////////////////////////////////////////////////////////////////////// double tmp = (double)mem_size_int; setMemsizeGPU(tmp, false); @@ -2342,7 +2616,7 @@ void CudaMemoryManager::cudaAllocConcFile(int lev) void CudaMemoryManager::cudaCopyConcFile(int lev) { unsigned int mem_size_int = sizeof(unsigned int) * parameter->getParH(lev)->numberOfPointsConc; - + checkCudaErrors( cudaMemcpy(parameter->getParD(lev)->concIndex, parameter->getParH(lev)->concIndex, mem_size_int, cudaMemcpyHostToDevice)); } void CudaMemoryManager::cudaFreeConcFile(int lev) @@ -2381,18 +2655,18 @@ void CudaMemoryManager::cudaAllocProcessNeighbor(int lev, unsigned int processNe checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->sendProcessNeighbor[processNeighbor].f[0] ), parameter->getD3Qxx() * parameter->getParH(lev)->sendProcessNeighbor[processNeighbor].memsizeFs )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->recvProcessNeighbor[processNeighbor].index ), parameter->getParH(lev)->recvProcessNeighbor[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->recvProcessNeighbor[processNeighbor].f[0] ), parameter->getD3Qxx() * parameter->getParH(lev)->recvProcessNeighbor[processNeighbor].memsizeFs )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->sendProcessNeighbor[processNeighbor].index ), parameter->getParD(lev)->sendProcessNeighbor[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->sendProcessNeighbor[processNeighbor].f[0] ), parameter->getD3Qxx() * parameter->getParD(lev)->sendProcessNeighbor[processNeighbor].memsizeFs )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighbor[processNeighbor].index ), parameter->getParD(lev)->recvProcessNeighbor[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighbor[processNeighbor].f[0] ), parameter->getD3Qxx() * parameter->getParD(lev)->recvProcessNeighbor[processNeighbor].memsizeFs )); - + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - double tmp = - (double)parameter->getParH(lev)->sendProcessNeighbor[processNeighbor].memsizeIndex + + double tmp = + (double)parameter->getParH(lev)->sendProcessNeighbor[processNeighbor].memsizeIndex + (double)parameter->getD3Qxx()*(double)parameter->getParH(lev)->sendProcessNeighbor[processNeighbor].memsizeFs + - (double)parameter->getParH(lev)->recvProcessNeighbor[processNeighbor].memsizeIndex + + (double)parameter->getParH(lev)->recvProcessNeighbor[processNeighbor].memsizeIndex + (double)parameter->getD3Qxx()*(double)parameter->getParH(lev)->recvProcessNeighbor[processNeighbor].memsizeFs; setMemsizeGPU(tmp, false); //printf("memsize GPU for neighbors %f \n",tmp/1000000.0); @@ -2442,18 +2716,18 @@ void CudaMemoryManager::cudaAllocProcessNeighborADX(int lev, unsigned int proces checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->sendProcessNeighborADX[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParH(lev)->sendProcessNeighborADX[processNeighbor].memsizeFs )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->recvProcessNeighborADX[processNeighbor].index ), parameter->getParH(lev)->recvProcessNeighborADX[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->recvProcessNeighborADX[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParH(lev)->recvProcessNeighborADX[processNeighbor].memsizeFs )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->sendProcessNeighborADX[processNeighbor].index ), parameter->getParD(lev)->sendProcessNeighborADX[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->sendProcessNeighborADX[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParD(lev)->sendProcessNeighborADX[processNeighbor].memsizeFs )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborADX[processNeighbor].index ), parameter->getParD(lev)->recvProcessNeighborADX[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborADX[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParD(lev)->recvProcessNeighborADX[processNeighbor].memsizeFs )); - + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - double tmp = - (double)parameter->getParH(lev)->sendProcessNeighborADX[processNeighbor].memsizeIndex + + double tmp = + (double)parameter->getParH(lev)->sendProcessNeighborADX[processNeighbor].memsizeIndex + (double)parameter->getDiffMod()*(double)parameter->getParH(lev)->sendProcessNeighborADX[processNeighbor].memsizeFs + - (double)parameter->getParH(lev)->recvProcessNeighborADX[processNeighbor].memsizeIndex + + (double)parameter->getParH(lev)->recvProcessNeighborADX[processNeighbor].memsizeIndex + (double)parameter->getDiffMod()*(double)parameter->getParH(lev)->recvProcessNeighborADX[processNeighbor].memsizeFs; setMemsizeGPU(tmp, false); //printf("memsize GPU for neighbors %f \n",tmp/1000000.0); @@ -2500,18 +2774,18 @@ void CudaMemoryManager::cudaAllocProcessNeighborADY(int lev, unsigned int proces checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->sendProcessNeighborADY[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParH(lev)->sendProcessNeighborADY[processNeighbor].memsizeFs )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->recvProcessNeighborADY[processNeighbor].index ), parameter->getParH(lev)->recvProcessNeighborADY[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->recvProcessNeighborADY[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParH(lev)->recvProcessNeighborADY[processNeighbor].memsizeFs )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->sendProcessNeighborADY[processNeighbor].index ), parameter->getParD(lev)->sendProcessNeighborADY[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->sendProcessNeighborADY[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParD(lev)->sendProcessNeighborADY[processNeighbor].memsizeFs )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborADY[processNeighbor].index ), parameter->getParD(lev)->recvProcessNeighborADY[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborADY[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParD(lev)->recvProcessNeighborADY[processNeighbor].memsizeFs )); - + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - double tmp = - (double)parameter->getParH(lev)->sendProcessNeighborADY[processNeighbor].memsizeIndex + + double tmp = + (double)parameter->getParH(lev)->sendProcessNeighborADY[processNeighbor].memsizeIndex + (double)parameter->getDiffMod()*(double)parameter->getParH(lev)->sendProcessNeighborADY[processNeighbor].memsizeFs + - (double)parameter->getParH(lev)->recvProcessNeighborADY[processNeighbor].memsizeIndex + + (double)parameter->getParH(lev)->recvProcessNeighborADY[processNeighbor].memsizeIndex + (double)parameter->getDiffMod()*(double)parameter->getParH(lev)->recvProcessNeighborADY[processNeighbor].memsizeFs; setMemsizeGPU(tmp, false); //printf("memsize GPU for neighbors %f \n",tmp/1000000.0); @@ -2558,18 +2832,18 @@ void CudaMemoryManager::cudaAllocProcessNeighborADZ(int lev, unsigned int proces checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->sendProcessNeighborADZ[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParH(lev)->sendProcessNeighborADZ[processNeighbor].memsizeFs )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->recvProcessNeighborADZ[processNeighbor].index ), parameter->getParH(lev)->recvProcessNeighborADZ[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMallocHost((void**) &(parameter->getParH(lev)->recvProcessNeighborADZ[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParH(lev)->recvProcessNeighborADZ[processNeighbor].memsizeFs )); - + //Device checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->sendProcessNeighborADZ[processNeighbor].index ), parameter->getParD(lev)->sendProcessNeighborADZ[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->sendProcessNeighborADZ[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParD(lev)->sendProcessNeighborADZ[processNeighbor].memsizeFs )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborADZ[processNeighbor].index ), parameter->getParD(lev)->recvProcessNeighborADZ[processNeighbor].memsizeIndex )); checkCudaErrors( cudaMalloc((void**) &(parameter->getParD(lev)->recvProcessNeighborADZ[processNeighbor].f[0] ), parameter->getDiffMod() * parameter->getParD(lev)->recvProcessNeighborADZ[processNeighbor].memsizeFs )); - + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - double tmp = - (double)parameter->getParH(lev)->sendProcessNeighborADZ[processNeighbor].memsizeIndex + + double tmp = + (double)parameter->getParH(lev)->sendProcessNeighborADZ[processNeighbor].memsizeIndex + (double)parameter->getDiffMod()*(double)parameter->getParH(lev)->sendProcessNeighborADZ[processNeighbor].memsizeFs + - (double)parameter->getParH(lev)->recvProcessNeighborADZ[processNeighbor].memsizeIndex + + (double)parameter->getParH(lev)->recvProcessNeighborADZ[processNeighbor].memsizeIndex + (double)parameter->getDiffMod()*(double)parameter->getParH(lev)->recvProcessNeighborADZ[processNeighbor].memsizeFs; setMemsizeGPU(tmp, false); //printf("memsize GPU for neighbors %f \n",tmp/1000000.0); @@ -2608,6 +2882,7 @@ void CudaMemoryManager::cudaFreeProcessNeighborADZ(int lev, unsigned int process checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->recvProcessNeighborADZ[processNeighbor].index )); checkCudaErrors( cudaFreeHost(parameter->getParH(lev)->recvProcessNeighborADZ[processNeighbor].f[0] )); } + void CudaMemoryManager::cudaAlloc2ndOrderDerivitivesIsoTest(int lev) { //Host @@ -2636,15 +2911,60 @@ void CudaMemoryManager::cudaCopy2ndOrderDerivitivesIsoTestHD(int lev) checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->dxxUx, parameter->getParH(lev)->dxxUx, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->dyyUy, parameter->getParH(lev)->dyyUy, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->dzzUz, parameter->getParH(lev)->dzzUz, parameter->getParH(lev)->mem_size_real_SP, cudaMemcpyHostToDevice)); - + } void CudaMemoryManager::cudaFree2ndOrderDerivitivesIsoTest(int lev) { checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->dxxUx)); checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->dyyUy)); checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->dzzUz)); - + +} + +void CudaMemoryManager::cudaAllocFluidNodeIndices(int lev) { + uint mem_size_geo_fluid_nodes = sizeof(uint) * parameter->getParH(lev)->numberOfFluidNodes; + // Host + checkCudaErrors(cudaMallocHost((void **)&(parameter->getParH(lev)->fluidNodeIndices), mem_size_geo_fluid_nodes)); + // Device + checkCudaErrors(cudaMalloc((void **)&(parameter->getParD(lev)->fluidNodeIndices), mem_size_geo_fluid_nodes)); + ////////////////////////////////////////////////////////////////////////// + setMemsizeGPU((double)mem_size_geo_fluid_nodes, false); +} + +void CudaMemoryManager::cudaCopyFluidNodeIndices(int lev) { + uint mem_size_geo_fluid_nodes = sizeof(uint) * parameter->getParH(lev)->numberOfFluidNodes; + checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->fluidNodeIndices, + parameter->getParH(lev)->fluidNodeIndices, + mem_size_geo_fluid_nodes, cudaMemcpyHostToDevice)); +} + +void CudaMemoryManager::cudaFreeFluidNodeIndices(int lev) { + checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->fluidNodeIndices)); } + +void CudaMemoryManager::cudaAllocFluidNodeIndicesBorder(int lev) { + uint mem_size_fluid_nodes_border = sizeof(uint) * parameter->getParH(lev)->numberOfFluidNodesBorder; + // Host + checkCudaErrors( + cudaMallocHost((void **)&(parameter->getParH(lev)->fluidNodeIndicesBorder), mem_size_fluid_nodes_border)); + // Device + checkCudaErrors( + cudaMalloc((void **)&(parameter->getParD(lev)->fluidNodeIndicesBorder), mem_size_fluid_nodes_border)); + ////////////////////////////////////////////////////////////////////////// + setMemsizeGPU((double)mem_size_fluid_nodes_border, false); +} + +void CudaMemoryManager::cudaCopyFluidNodeIndicesBorder(int lev) { + uint mem_size_fluid_nodes_border = sizeof(uint) * parameter->getParH(lev)->numberOfFluidNodesBorder; + checkCudaErrors(cudaMemcpy(parameter->getParD(lev)->fluidNodeIndicesBorder, + parameter->getParH(lev)->fluidNodeIndicesBorder, + mem_size_fluid_nodes_border, cudaMemcpyHostToDevice)); +} + +void CudaMemoryManager::cudaFreeFluidNodeIndicesBorder(int lev) { + checkCudaErrors(cudaFreeHost(parameter->getParH(lev)->fluidNodeIndicesBorder)); +} + //////////////////////////////////////////////////////////////////////////////////// // ActuatorLine /////////////////////////////////////////////////////////////////////////////// @@ -2671,35 +2991,35 @@ void CudaMemoryManager::cudaCopyBladeRadiiDtoH(ActuatorLine* actuatorLine) void CudaMemoryManager::cudaFreeBladeRadii(ActuatorLine* actuatorLine) { checkCudaErrors( cudaFree(actuatorLine->bladeRadiiD) ); - + checkCudaErrors( cudaFreeHost(actuatorLine->bladeRadiiH) ); } void CudaMemoryManager::cudaAllocBladeCoords(ActuatorLine* actuatorLine) { - checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeCoordsXH, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeCoordsYH, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeCoordsZH, sizeof(real)*actuatorLine->getNumberOfNodes()) ); + checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeCoordsXH, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeCoordsYH, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeCoordsZH, sizeof(real)*actuatorLine->getNNodes()) ); - checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeCoordsXD, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeCoordsYD, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeCoordsZD, sizeof(real)*actuatorLine->getNumberOfNodes()) ); + checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeCoordsXD, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeCoordsYD, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeCoordsZD, sizeof(real)*actuatorLine->getNNodes()) ); - setMemsizeGPU(3.f*actuatorLine->getNumberOfNodes(), false); + setMemsizeGPU(3.f*actuatorLine->getNNodes(), false); } void CudaMemoryManager::cudaCopyBladeCoordsHtoD(ActuatorLine* actuatorLine) { - checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsXD, actuatorLine->bladeCoordsXH, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyHostToDevice) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsYD, actuatorLine->bladeCoordsYH, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyHostToDevice) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsZD, actuatorLine->bladeCoordsZH, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsXD, actuatorLine->bladeCoordsXH, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsYD, actuatorLine->bladeCoordsYH, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsZD, actuatorLine->bladeCoordsZH, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyHostToDevice) ); } void CudaMemoryManager::cudaCopyBladeCoordsDtoH(ActuatorLine* actuatorLine) { - checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsXH, actuatorLine->bladeCoordsXD, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyDeviceToHost) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsYH, actuatorLine->bladeCoordsYD, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyDeviceToHost) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsZH, actuatorLine->bladeCoordsZD, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsXH, actuatorLine->bladeCoordsXD, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsYH, actuatorLine->bladeCoordsYD, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeCoordsZH, actuatorLine->bladeCoordsZD, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyDeviceToHost) ); } void CudaMemoryManager::cudaFreeBladeCoords(ActuatorLine* actuatorLine) @@ -2715,16 +3035,16 @@ void CudaMemoryManager::cudaFreeBladeCoords(ActuatorLine* actuatorLine) void CudaMemoryManager::cudaAllocBladeIndices(ActuatorLine* actuatorLine) { - checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeIndicesH, sizeof(uint)*actuatorLine->getNumberOfNodes()) ); + checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeIndicesH, sizeof(uint)*actuatorLine->getNNodes()) ); - checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeIndicesD, sizeof(uint)*actuatorLine->getNumberOfNodes()) ); + checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeIndicesD, sizeof(uint)*actuatorLine->getNNodes()) ); - setMemsizeGPU(sizeof(uint)*actuatorLine->getNumberOfNodes(), false); + setMemsizeGPU(sizeof(uint)*actuatorLine->getNNodes(), false); } void CudaMemoryManager::cudaCopyBladeIndicesHtoD(ActuatorLine* actuatorLine) { - checkCudaErrors( cudaMemcpy(actuatorLine->bladeIndicesD, actuatorLine->bladeIndicesH, sizeof(uint)*actuatorLine->getNumberOfNodes(), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeIndicesD, actuatorLine->bladeIndicesH, sizeof(uint)*actuatorLine->getNNodes(), cudaMemcpyHostToDevice) ); } void CudaMemoryManager::cudaFreeBladeIndices(ActuatorLine* actuatorLine) @@ -2736,29 +3056,29 @@ void CudaMemoryManager::cudaFreeBladeIndices(ActuatorLine* actuatorLine) void CudaMemoryManager::cudaAllocBladeVelocities(ActuatorLine* actuatorLine) { - checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeVelocitiesXH, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeVelocitiesYH, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeVelocitiesZH, sizeof(real)*actuatorLine->getNumberOfNodes()) ); + checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeVelocitiesXH, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeVelocitiesYH, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeVelocitiesZH, sizeof(real)*actuatorLine->getNNodes()) ); - checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeVelocitiesXD, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeVelocitiesYD, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeVelocitiesZD, sizeof(real)*actuatorLine->getNumberOfNodes()) ); + checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeVelocitiesXD, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeVelocitiesYD, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeVelocitiesZD, sizeof(real)*actuatorLine->getNNodes()) ); - setMemsizeGPU(3.*sizeof(real)*actuatorLine->getNumberOfNodes(), false); + setMemsizeGPU(3.*sizeof(real)*actuatorLine->getNNodes(), false); } void CudaMemoryManager::cudaCopyBladeVelocitiesHtoD(ActuatorLine* actuatorLine) { - checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesXD, actuatorLine->bladeVelocitiesXH, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyHostToDevice) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesYD, actuatorLine->bladeVelocitiesYH, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyHostToDevice) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesZD, actuatorLine->bladeVelocitiesZH, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesXD, actuatorLine->bladeVelocitiesXH, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesYD, actuatorLine->bladeVelocitiesYH, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesZD, actuatorLine->bladeVelocitiesZH, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyHostToDevice) ); } void CudaMemoryManager::cudaCopyBladeVelocitiesDtoH(ActuatorLine* actuatorLine) { - checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesXH, actuatorLine->bladeVelocitiesXD, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyDeviceToHost) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesYH, actuatorLine->bladeVelocitiesYD, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyDeviceToHost) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesZH, actuatorLine->bladeVelocitiesZD, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesXH, actuatorLine->bladeVelocitiesXD, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesYH, actuatorLine->bladeVelocitiesYD, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeVelocitiesZH, actuatorLine->bladeVelocitiesZD, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyDeviceToHost) ); } void CudaMemoryManager::cudaFreeBladeVelocities(ActuatorLine* actuatorLine) @@ -2773,30 +3093,30 @@ void CudaMemoryManager::cudaFreeBladeVelocities(ActuatorLine* actuatorLine) } void CudaMemoryManager::cudaAllocBladeForces(ActuatorLine* actuatorLine) -{ - checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeForcesXH, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeForcesYH, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeForcesZH, sizeof(real)*actuatorLine->getNumberOfNodes()) ); +{ + checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeForcesXH, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeForcesYH, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMallocHost((void**) &actuatorLine->bladeForcesZH, sizeof(real)*actuatorLine->getNNodes()) ); - checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeForcesXD, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeForcesYD, sizeof(real)*actuatorLine->getNumberOfNodes()) ); - checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeForcesZD, sizeof(real)*actuatorLine->getNumberOfNodes()) ); + checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeForcesXD, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeForcesYD, sizeof(real)*actuatorLine->getNNodes()) ); + checkCudaErrors( cudaMalloc((void**) &actuatorLine->bladeForcesZD, sizeof(real)*actuatorLine->getNNodes()) ); - setMemsizeGPU(3.*sizeof(real)*actuatorLine->getNumberOfNodes(), false); + setMemsizeGPU(3.*sizeof(real)*actuatorLine->getNNodes(), false); } void CudaMemoryManager::cudaCopyBladeForcesHtoD(ActuatorLine* actuatorLine) { - checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesXD, actuatorLine->bladeForcesXH, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyHostToDevice) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesYD, actuatorLine->bladeForcesYH, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyHostToDevice) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesZD, actuatorLine->bladeForcesZH, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesXD, actuatorLine->bladeForcesXH, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesYD, actuatorLine->bladeForcesYH, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesZD, actuatorLine->bladeForcesZH, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyHostToDevice) ); } void CudaMemoryManager::cudaCopyBladeForcesDtoH(ActuatorLine* actuatorLine) { - checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesXH, actuatorLine->bladeForcesXD, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyDeviceToHost) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesYH, actuatorLine->bladeForcesYD, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyDeviceToHost) ); - checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesZH, actuatorLine->bladeForcesZD, sizeof(real)*actuatorLine->getNumberOfNodes(), cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesXH, actuatorLine->bladeForcesXD, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesYH, actuatorLine->bladeForcesYD, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(actuatorLine->bladeForcesZH, actuatorLine->bladeForcesZD, sizeof(real)*actuatorLine->getNNodes(), cudaMemcpyDeviceToHost) ); } void CudaMemoryManager::cudaFreeBladeForces(ActuatorLine* actuatorLine) @@ -2811,15 +3131,15 @@ void CudaMemoryManager::cudaFreeBladeForces(ActuatorLine* actuatorLine) } void CudaMemoryManager::cudaAllocSphereIndices(ActuatorLine* actuatorLine) -{ - checkCudaErrors( cudaMallocHost((void**) &(actuatorLine->boundingSphereIndicesH), sizeof(int)*actuatorLine->getNumberOfIndices())); - checkCudaErrors( cudaMalloc((void**) &(actuatorLine->boundingSphereIndicesD), sizeof(int)*actuatorLine->getNumberOfIndices())); - setMemsizeGPU(sizeof(int)*actuatorLine->getNumberOfIndices(), false); +{ + checkCudaErrors( cudaMallocHost((void**) &(actuatorLine->boundingSphereIndicesH), sizeof(int)*actuatorLine->getNIndices())); + checkCudaErrors( cudaMalloc((void**) &(actuatorLine->boundingSphereIndicesD), sizeof(int)*actuatorLine->getNIndices())); + setMemsizeGPU(sizeof(int)*actuatorLine->getNIndices(), false); } void CudaMemoryManager::cudaCopySphereIndicesHtoD(ActuatorLine* actuatorLine) { - checkCudaErrors( cudaMemcpy(actuatorLine->boundingSphereIndicesD, actuatorLine->boundingSphereIndicesH, sizeof(int)*actuatorLine->getNumberOfIndices(), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(actuatorLine->boundingSphereIndicesD, actuatorLine->boundingSphereIndicesH, sizeof(int)*actuatorLine->getNIndices(), cudaMemcpyHostToDevice) ); } void CudaMemoryManager::cudaFreeSphereIndices(ActuatorLine* actuatorLine) @@ -2874,18 +3194,18 @@ void CudaMemoryManager::cudaFreeProbeDistances(Probe* probe, int level) void CudaMemoryManager::cudaAllocProbeIndices(Probe* probe, int level) { - size_t tmp = sizeof(int)*probe->getProbeStruct(level)->nPoints; + size_t tmp = sizeof(int)*probe->getProbeStruct(level)->nIndices; checkCudaErrors( cudaMallocHost((void**) &probe->getProbeStruct(level)->pointIndicesH, tmp) ); checkCudaErrors( cudaMalloc ((void**) &probe->getProbeStruct(level)->pointIndicesD, tmp) ); setMemsizeGPU(1.f*tmp, false); } void CudaMemoryManager::cudaCopyProbeIndicesHtoD(Probe* probe, int level) { - checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->pointIndicesD, probe->getProbeStruct(level)->pointIndicesH, sizeof(int)*probe->getProbeStruct(level)->nPoints, cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->pointIndicesD, probe->getProbeStruct(level)->pointIndicesH, sizeof(int)*probe->getProbeStruct(level)->nIndices, cudaMemcpyHostToDevice) ); } void CudaMemoryManager::cudaCopyProbeIndicesDtoH(Probe* probe, int level) { - checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->pointIndicesH, probe->getProbeStruct(level)->pointIndicesD, sizeof(int)*probe->getProbeStruct(level)->nPoints, cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->pointIndicesH, probe->getProbeStruct(level)->pointIndicesD, sizeof(int)*probe->getProbeStruct(level)->nIndices, cudaMemcpyDeviceToHost) ); } void CudaMemoryManager::cudaFreeProbeIndices(Probe* probe, int level) { @@ -2898,8 +3218,11 @@ void CudaMemoryManager::cudaAllocProbeQuantityArray(Probe* probe, int level) size_t tmp = sizeof(real)*probe->getProbeStruct(level)->nArrays*probe->getProbeStruct(level)->nPoints; checkCudaErrors( cudaMallocHost((void**) &probe->getProbeStruct(level)->quantitiesArrayH, tmp) ); - checkCudaErrors( cudaMalloc ((void**) &probe->getProbeStruct(level)->quantitiesArrayD, tmp) ); - setMemsizeGPU(1.f*tmp, false); + if(probe->getHasDeviceQuantityArray()) + { + checkCudaErrors( cudaMalloc ((void**) &probe->getProbeStruct(level)->quantitiesArrayD, tmp) ); + setMemsizeGPU(1.f*tmp, false); + } } void CudaMemoryManager::cudaCopyProbeQuantityArrayHtoD(Probe* probe, int level) @@ -2913,30 +3236,31 @@ void CudaMemoryManager::cudaCopyProbeQuantityArrayDtoH(Probe* probe, int level) void CudaMemoryManager::cudaFreeProbeQuantityArray(Probe* probe, int level) { checkCudaErrors( cudaFreeHost(probe->getProbeStruct(level)->quantitiesArrayH) ); - checkCudaErrors( cudaFree (probe->getProbeStruct(level)->quantitiesArrayD) ); + if(probe->getHasDeviceQuantityArray()) + checkCudaErrors( cudaFree (probe->getProbeStruct(level)->quantitiesArrayD) ); } void CudaMemoryManager::cudaAllocProbeQuantitiesAndOffsets(Probe* probe, int level) { - size_t tmpA = int(PostProcessingVariable::LAST)*sizeof(int); - size_t tmpQ = int(PostProcessingVariable::LAST)*sizeof(bool); - checkCudaErrors( cudaMallocHost((void**) &probe->getProbeStruct(level)->quantitiesH, tmpQ) ); + size_t tmpA = int(Statistic::LAST)*sizeof(int); + size_t tmpQ = int(Statistic::LAST)*sizeof(bool); + checkCudaErrors( cudaMallocHost((void**) &probe->getProbeStruct(level)->quantitiesH, tmpQ) ); checkCudaErrors( cudaMalloc ((void**) &probe->getProbeStruct(level)->quantitiesD, tmpQ) ); - checkCudaErrors( cudaMallocHost((void**) &probe->getProbeStruct(level)->arrayOffsetsH, tmpA) ); + checkCudaErrors( cudaMallocHost((void**) &probe->getProbeStruct(level)->arrayOffsetsH, tmpA) ); checkCudaErrors( cudaMalloc ((void**) &probe->getProbeStruct(level)->arrayOffsetsD, tmpA) ); setMemsizeGPU(tmpA+tmpQ, false); } void CudaMemoryManager::cudaCopyProbeQuantitiesAndOffsetsHtoD(Probe* probe, int level) -{ - checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->quantitiesD, probe->getProbeStruct(level)->quantitiesH, int(PostProcessingVariable::LAST)*sizeof(bool), cudaMemcpyHostToDevice) ); - checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->arrayOffsetsD, probe->getProbeStruct(level)->arrayOffsetsH, int(PostProcessingVariable::LAST)*sizeof(int), cudaMemcpyHostToDevice) ); +{ + checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->quantitiesD, probe->getProbeStruct(level)->quantitiesH, int(Statistic::LAST)*sizeof(bool), cudaMemcpyHostToDevice) ); + checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->arrayOffsetsD, probe->getProbeStruct(level)->arrayOffsetsH, int(Statistic::LAST)*sizeof(int), cudaMemcpyHostToDevice) ); } void CudaMemoryManager::cudaCopyProbeQuantitiesAndOffsetsDtoH(Probe* probe, int level) { - checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->quantitiesH, probe->getProbeStruct(level)->quantitiesD, int(PostProcessingVariable::LAST)*sizeof(bool), cudaMemcpyDeviceToHost) ); - checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->arrayOffsetsH, probe->getProbeStruct(level)->arrayOffsetsD, int(PostProcessingVariable::LAST)*sizeof(int), cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->quantitiesH, probe->getProbeStruct(level)->quantitiesD, int(Statistic::LAST)*sizeof(bool), cudaMemcpyDeviceToHost) ); + checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->arrayOffsetsH, probe->getProbeStruct(level)->arrayOffsetsD, int(Statistic::LAST)*sizeof(int), cudaMemcpyDeviceToHost) ); } void CudaMemoryManager::cudaFreeProbeQuantitiesAndOffsets(Probe* probe, int level) { @@ -2965,11 +3289,12 @@ void CudaMemoryManager::cudaFreeProbeQuantitiesAndOffsets(Probe* probe, int leve -std::shared_ptr<CudaMemoryManager> CudaMemoryManager::make(std::shared_ptr<Parameter> parameter) +CudaMemoryManager::CudaMemoryManager(std::shared_ptr<Parameter> parameter) : parameter(parameter) { - return std::shared_ptr<CudaMemoryManager>(new CudaMemoryManager(parameter)); + } + void CudaMemoryManager::setMemsizeGPU(double admem, bool reset) { if (reset == true) @@ -2984,15 +3309,5 @@ void CudaMemoryManager::setMemsizeGPU(double admem, bool reset) double CudaMemoryManager::getMemsizeGPU() { - return memsizeGPU; -} - -CudaMemoryManager::CudaMemoryManager(std::shared_ptr<Parameter> parameter) -{ - this->parameter = parameter; -} - -CudaMemoryManager::CudaMemoryManager(const CudaMemoryManager&) -{ - + return this->memsizeGPU; } diff --git a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h index 1d1311bf18da4538b323a99a0c8a4c341dda5e62..d410340d2de7797cf23a781a64d11f592d62a6fb 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h +++ b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h @@ -8,7 +8,7 @@ #include "VirtualFluids_GPU_export.h" #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <cuda_runtime.h> #include <helper_cuda.h> @@ -24,275 +24,297 @@ class Probe; class VIRTUALFLUIDS_GPU_EXPORT CudaMemoryManager { public: - static std::shared_ptr<CudaMemoryManager> make(std::shared_ptr<Parameter> parameter); - - void setMemsizeGPU(double admem, bool reset); - double getMemsizeGPU(); + CudaMemoryManager(std::shared_ptr<Parameter> parameter); + virtual ~CudaMemoryManager() = default; + + void setMemsizeGPU(double admem, bool reset); + double getMemsizeGPU(); void cudaAllocFull(int lev); void cudaFreeFull(int lev); - + void cudaCopyPrint(int lev); void cudaCopyMedianPrint(int lev); - - void cudaAllocCoord(int lev); - void cudaCopyCoord(int lev); - void cudaFreeCoord(int lev); - void cudaAllocBodyForce(int lev); + void cudaAllocCoord(int lev); + void cudaCopyCoord(int lev); + void cudaFreeCoord(int lev); + + void cudaAllocBodyForce(int lev); void cudaCopyBodyForce(int lev); void cudaFreeBodyForce(int lev); void cudaCopyDataToHost(int lev); - void cudaAllocSP(int lev); - void cudaCopySP(int lev); - void cudaFreeSP(int lev); - + void cudaAllocSP(int lev); + void cudaCopySP(int lev); + void cudaFreeSP(int lev); + void cudaAllocF3SP(int lev); - void cudaAllocNeighborWSB(int lev); - void cudaCopyNeighborWSB(int lev); - void cudaFreeNeighborWSB(int lev); - - void cudaAllocVeloBC(int lev); - void cudaCopyVeloBC(int lev); - void cudaFreeVeloBC(int lev); - - void cudaAllocOutflowBC(int lev); - void cudaCopyOutflowBC(int lev); - void cudaFreeOutflowBC(int lev); - - void cudaAllocWallBC(int lev); - void cudaCopyWallBC(int lev); - void cudaFreeWallBC(int lev); - - void cudaAllocGeomBC(int lev); - void cudaCopyGeomBC(int lev); - void cudaFreeGeomBC(int lev); - - void cudaAllocPress(int lev); - void cudaCopyPress(int lev); - void cudaFreePress(int lev); - - void cudaAllocForcing(); - void cudaCopyForcingToDevice(); - void cudaCopyForcingToHost(); - void cudaFreeForcing(); + void cudaAllocNeighborWSB(int lev); + void cudaCopyNeighborWSB(int lev); + void cudaFreeNeighborWSB(int lev); + + void cudaAllocVeloBC(int lev); + void cudaCopyVeloBC(int lev); + void cudaFreeVeloBC(int lev); + + void cudaAllocOutflowBC(int lev); + void cudaCopyOutflowBC(int lev); + void cudaFreeOutflowBC(int lev); + + void cudaAllocNoSlipBC(int lev); + void cudaCopyNoSlipBC(int lev); + void cudaFreeNoSlipBC(int lev); + + void cudaAllocGeomBC(int lev); + void cudaCopyGeomBC(int lev); + void cudaFreeGeomBC(int lev); + + void cudaAllocPress(int lev); + void cudaCopyPress(int lev); + void cudaFreePress(int lev); + + void cudaAllocForcing(); + void cudaCopyForcingToDevice(); + void cudaCopyForcingToHost(); + void cudaFreeForcing(); void cudaAllocLevelForcing(int level); - void cudaCopyLevelForcingToDevice(int level); - void cudaFreeLevelForcing(int level); - - void cudaAllocQuadricLimiters(); - void cudaCopyQuadricLimitersToDevice(); - void cudaFreeQuadricLimiters(); - - ////////////////////////////////////////////////////////////////////////// - //3D domain decomposition - void cudaAllocProcessNeighborX(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborXFsHD(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborXFsDH(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborXIndex(int lev, unsigned int processNeighbor); - void cudaFreeProcessNeighborX(int lev, unsigned int processNeighbor); - // - void cudaAllocProcessNeighborY(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborYFsHD(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborYFsDH(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborYIndex(int lev, unsigned int processNeighbor); - void cudaFreeProcessNeighborY(int lev, unsigned int processNeighbor); - // - void cudaAllocProcessNeighborZ(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborZFsHD(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborZFsDH(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborZIndex(int lev, unsigned int processNeighbor); - void cudaFreeProcessNeighborZ(int lev, unsigned int processNeighbor); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - //3D domain decomposition F3 - void cudaAllocProcessNeighborF3X(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborF3XFsHD(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborF3XFsDH(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborF3XIndex(int lev, unsigned int processNeighbor); - void cudaFreeProcessNeighborF3X(int lev, unsigned int processNeighbor); - // - void cudaAllocProcessNeighborF3Y(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborF3YFsHD(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborF3YFsDH(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborF3YIndex(int lev, unsigned int processNeighbor); - void cudaFreeProcessNeighborF3Y(int lev, unsigned int processNeighbor); - // - void cudaAllocProcessNeighborF3Z(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborF3ZFsHD(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborF3ZFsDH(int lev, unsigned int processNeighbor); - void cudaCopyProcessNeighborF3ZIndex(int lev, unsigned int processNeighbor); - void cudaFreeProcessNeighborF3Z(int lev, unsigned int processNeighbor); - ////////////////////////////////////////////////////////////////////////// - - void cudaAllocTurbulentViscosity(int lev); + void cudaCopyLevelForcingToDevice(int level); + void cudaFreeLevelForcing(int level); + + void cudaAllocQuadricLimiters(); + void cudaCopyQuadricLimitersToDevice(); + void cudaFreeQuadricLimiters(); + + ////////////////////////////////////////////////////////////////////////// + //3D domain decomposition + virtual void cudaAllocProcessNeighborX(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborXFsHD(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsRecv, + int streamIndex); + void cudaCopyProcessNeighborXFsDH(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsSend, + int streamIndex); + virtual void cudaCopyProcessNeighborXIndex(int lev, unsigned int processNeighbor); + void cudaFreeProcessNeighborX(int lev, unsigned int processNeighbor); + // + virtual void cudaAllocProcessNeighborY(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborYFsHD(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsRecv, + int streamIndex); + void cudaCopyProcessNeighborYFsDH(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsSend, + int streamIndex); + virtual void cudaCopyProcessNeighborYIndex(int lev, unsigned int processNeighbor); + void cudaFreeProcessNeighborY(int lev, unsigned int processNeighbor); + // + virtual void cudaAllocProcessNeighborZ(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborZFsHD(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsRecv, + int streamIndex); + void cudaCopyProcessNeighborZFsDH(int lev, unsigned int processNeighbor, const unsigned int &memsizeFsSend, + int streamIndex); + virtual void cudaCopyProcessNeighborZIndex(int lev, unsigned int processNeighbor); + void cudaFreeProcessNeighborZ(int lev, unsigned int processNeighbor); + + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + //3D domain decomposition F3 + void cudaAllocProcessNeighborF3X(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborF3XFsHD(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborF3XFsDH(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborF3XIndex(int lev, unsigned int processNeighbor); + void cudaFreeProcessNeighborF3X(int lev, unsigned int processNeighbor); + // + void cudaAllocProcessNeighborF3Y(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborF3YFsHD(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborF3YFsDH(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborF3YIndex(int lev, unsigned int processNeighbor); + void cudaFreeProcessNeighborF3Y(int lev, unsigned int processNeighbor); + // + void cudaAllocProcessNeighborF3Z(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborF3ZFsHD(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborF3ZFsDH(int lev, unsigned int processNeighbor); + void cudaCopyProcessNeighborF3ZIndex(int lev, unsigned int processNeighbor); + void cudaFreeProcessNeighborF3Z(int lev, unsigned int processNeighbor); + ////////////////////////////////////////////////////////////////////////// + + void cudaAllocTurbulentViscosity(int lev); void cudaCopyTurbulentViscosityHD(int lev); void cudaCopyTurbulentViscosityDH(int lev); void cudaFreeTurbulentViscosity(int lev); - + + void cudaAllocTurbulenceIntensity(int lev, uint size); + void cudaCopyTurbulenceIntensityHD(int lev, uint size); + void cudaCopyTurbulenceIntensityDH(int lev, uint size); + void cudaFreeTurbulenceIntensity(int lev); + void cudaAllocMedianSP(int lev); void cudaCopyMedianSP(int lev); void cudaFreeMedianSP(int lev); - + void cudaAllocMedianOut(int lev); void cudaFreeMedianOut(int lev); void cudaAllocMedianOutAD(int lev); void cudaFreeMedianOutAD(int lev); - + void cudaAllocInterfaceCF(int lev); void cudaCopyInterfaceCF(int lev); void cudaFreeInterfaceCF(int lev); - + void cudaAllocInterfaceFC(int lev); void cudaCopyInterfaceFC(int lev); + void cudaCheckInterfaceFCBulk(int lev); void cudaFreeInterfaceFC(int lev); - + void cudaAllocInterfaceOffCF(int lev); void cudaCopyInterfaceOffCF(int lev); void cudaFreeInterfaceOffCF(int lev); - + void cudaAllocInterfaceOffFC(int lev); void cudaCopyInterfaceOffFC(int lev); void cudaFreeInterfaceOffFC(int lev); - + void cudaAllocSlipBC(int lev); void cudaCopySlipBC(int lev); void cudaFreeSlipBC(int lev); - + + void cudaAllocStressBC(int lev); + void cudaCopyStressBC(int lev); + void cudaFreeStressBC(int lev); + + void cudaAllocWallModel(int lev, bool hasWallModelMonitor); + void cudaCopyWallModel(int lev, bool hasWallModelMonitor); + void cudaFreeWallModel(int lev, bool hasWallModelMonitor); + void cudaAllocGeomValuesBC(int lev); void cudaCopyGeomValuesBC(int lev); void cudaFreeGeomValuesBC(int lev); - + void cudaAllocGeomNormals(int lev); void cudaCopyGeomNormals(int lev); void cudaFreeGeomNormals(int lev); - + void cudaAllocInflowNormals(int lev); void cudaCopyInflowNormals(int lev); void cudaFreeInflowNormals(int lev); - + void cudaAllocOutflowNormals(int lev); void cudaCopyOutflowNormals(int lev); void cudaFreeOutflowNormals(int lev); - + void cudaAllocTestRE(int lev, unsigned int size); void cudaCopyTestREtoDevice(int lev, unsigned int size); void cudaCopyTestREtoHost(int lev, unsigned int size); void cudaFreeTestRE(int lev); - + void cudaAllocCpTop(int lev); void cudaCopyCpTopInit(int lev); void cudaCopyCpTop(int lev); void cudaFreeCpTop(int lev); - + void cudaAllocCpBottom(int lev); void cudaCopyCpBottomInit(int lev); void cudaCopyCpBottom(int lev); void cudaFreeCpBottom(int lev); - + void cudaAllocCpBottom2(int lev); void cudaCopyCpBottom2Init(int lev); void cudaCopyCpBottom2(int lev); void cudaFreeCpBottom2(int lev); - + void cudaAllocConcFile(int lev); void cudaCopyConcFile(int lev); void cudaFreeConcFile(int lev); - + void cudaAllocInlet(int lev); void cudaCopyInlet(int lev); void cudaFreeInlet(int lev); void cudaAllocOutlet(int lev); void cudaCopyOutlet(int lev); void cudaFreeOutlet(int lev); - - + + void cudaAllocPressX0(int lev); void cudaCopyPressX0(int lev); void cudaFreePressX0(int lev); void cudaAllocPressX1(int lev); void cudaCopyPressX1(int lev); void cudaFreePressX1(int lev); - + void cudaAllocVeloPropeller(int lev); void cudaCopyVeloPropeller(int lev); void cudaFreeVeloPropeller(int lev); - + void cudaAllocMeasurePoints(int lev, int i); void cudaCopyMeasurePoints(int lev, int i); void cudaFreeMeasurePoints(int lev, int i); - + void cudaAllocMeasurePointsIndex(int lev); void cudaCopyMeasurePointsIndex(int lev); void cudaCopyMeasurePointsToHost(int lev); void cudaFreeMeasurePointsIndex(int lev); - + void cudaAllocFsForCheckPointAndRestart(int lev); void cudaCopyFsForRestart(int lev); void cudaCopyFsForCheckPoint(int lev); void cudaFreeFsForCheckPointAndRestart(int lev); - + void cudaAllocDragLift(int lev, int numofelem); void cudaCopyDragLift(int lev, int numofelem); void cudaFreeDragLift(int lev); - + void cudaAlloc2ndMoments(int lev, int numofelem); void cudaCopy2ndMoments(int lev, int numofelem); void cudaFree2ndMoments(int lev); - + void cudaAlloc3rdMoments(int lev, int numofelem); void cudaCopy3rdMoments(int lev, int numofelem); void cudaFree3rdMoments(int lev); - + void cudaAllocHigherMoments(int lev, int numofelem); void cudaCopyHigherMoments(int lev, int numofelem); void cudaFreeHigherMoments(int lev); - + void cudaAllocForceVelo(int lev, int numofelem); void cudaCopyForceVelo(int lev, int numofelem); void cudaFreeForceVelo(int lev); - + void cudaAlloc2ndOrderDerivitivesIsoTest(int lev); void cudaCopy2ndOrderDerivitivesIsoTestDH(int lev); void cudaCopy2ndOrderDerivitivesIsoTestHD(int lev); void cudaFree2ndOrderDerivitivesIsoTest(int lev); - - + + void cudaAllocParticles(int lev); void cudaCopyParticles(int lev); void cudaFreeParticles(int lev); - + void cudaAllocRandomValues(); - + void cudaAllocPorousMedia(PorousMedia* pm, int lev); void cudaCopyPorousMedia(PorousMedia* pm, int lev); void cudaFreePorousMedia(PorousMedia* pm, int lev); - - void cudaAllocConc(int lev); - void cudaCopyConcDH(int lev); - void cudaCopyConcHD(int lev); - void cudaFreeConc(int lev); - + + void cudaAllocConcentration(int lev); + void cudaCopyConcentrationDeviceToHost(int lev); + void cudaCopyConcentrationHostToDevice(int lev); + void cudaFreeConcentration(int lev); + void cudaAllocTempFs(int lev); - + void cudaAllocTempPressBC(int lev); void cudaCopyTempPressBCHD(int lev); void cudaFreeTempPressBC(int lev); - + void cudaAllocTempVeloBC(int lev); void cudaCopyTempVeloBCHD(int lev); void cudaFreeTempVeloBC(int lev); - + void cudaAllocTempNoSlipBC(int lev); void cudaCopyTempNoSlipBCHD(int lev); void cudaFreeTempNoSlipBC(int lev); - + void cudaAllocPlaneConcIn(int lev, int numofelem); void cudaCopyPlaneConcIn(int lev, int numofelem); void cudaAllocPlaneConcOut1(int lev, int numofelem); @@ -300,19 +322,19 @@ public: void cudaAllocPlaneConcOut2(int lev, int numofelem); void cudaCopyPlaneConcOut2(int lev, int numofelem); void cudaFreePlaneConc(int lev); - + void cudaAllocProcessNeighbor(int lev, unsigned int processNeighbor); void cudaCopyProcessNeighborFsHD(int lev, unsigned int processNeighbor); void cudaCopyProcessNeighborFsDH(int lev, unsigned int processNeighbor); void cudaCopyProcessNeighborIndex(int lev, unsigned int processNeighbor); void cudaFreeProcessNeighbor(int lev, unsigned int processNeighbor); - + void cudaAllocProcessNeighborADX(int lev, unsigned int processNeighbor); void cudaCopyProcessNeighborADXFsHD(int lev, unsigned int processNeighbor); void cudaCopyProcessNeighborADXFsDH(int lev, unsigned int processNeighbor); void cudaCopyProcessNeighborADXIndex(int lev, unsigned int processNeighbor); void cudaFreeProcessNeighborADX(int lev, unsigned int processNeighbor); - + void cudaAllocProcessNeighborADY(int lev, unsigned int processNeighbor); void cudaCopyProcessNeighborADYFsHD(int lev, unsigned int processNeighbor); void cudaCopyProcessNeighborADYFsDH(int lev, unsigned int processNeighbor); @@ -324,6 +346,14 @@ public: void cudaCopyProcessNeighborADZIndex(int lev, unsigned int processNeighbor); void cudaFreeProcessNeighborADZ(int lev, unsigned int processNeighbor); + void cudaAllocFluidNodeIndices(int lev); + void cudaCopyFluidNodeIndices(int lev); + void cudaFreeFluidNodeIndices(int lev); + void cudaAllocFluidNodeIndicesBorder(int lev); + void cudaCopyFluidNodeIndicesBorder(int lev); + void cudaFreeFluidNodeIndicesBorder(int lev); + + // Actuator Line void cudaAllocBladeRadii(ActuatorLine* actuatorLine); void cudaCopyBladeRadiiHtoD(ActuatorLine* actuatorLine); void cudaCopyBladeRadiiDtoH(ActuatorLine* actuatorLine); @@ -366,18 +396,15 @@ public: void cudaCopyProbeQuantityArrayHtoD(Probe* probe, int level); void cudaCopyProbeQuantityArrayDtoH(Probe* probe, int level); void cudaFreeProbeQuantityArray(Probe* probe, int level); - + void cudaAllocProbeQuantitiesAndOffsets(Probe* probe, int level); void cudaCopyProbeQuantitiesAndOffsetsHtoD(Probe* probe, int level); void cudaCopyProbeQuantitiesAndOffsetsDtoH(Probe* probe, int level); void cudaFreeProbeQuantitiesAndOffsets(Probe* probe, int level); private: - CudaMemoryManager(std::shared_ptr<Parameter> parameter); - CudaMemoryManager(const CudaMemoryManager&); - std::shared_ptr<Parameter> parameter; - double memsizeGPU; + double memsizeGPU = 0.0; }; #endif diff --git a/src/gpu/VirtualFluids_GPU/GPU/Cumulant27.cu b/src/gpu/VirtualFluids_GPU/GPU/Cumulant27.cu index 14c9b77ed2236ea517062944e37297747c5c3718..bbce8181d814fc8b9dbb086764becb73a86c0eda 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/Cumulant27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/Cumulant27.cu @@ -7,14 +7,15 @@ ////////////////////////////////////////////////////////////////////////// /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" -#include <lbm/constants/NumericConstants.h> +#include "lbm/constants/NumericConstants.h" +#include "lbm/constants/D3Q27.h" + using namespace vf::lbm::constant; -#include "math.h" +using namespace vf::lbm::dir; //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, +__global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -47,63 +48,63 @@ extern "C" __global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -136,33 +137,33 @@ extern "C" __global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW ])[kw ];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS ])[ks ];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB ])[kb ];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW ])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW ])[kw ];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE ])[k ];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW ])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW ])[kw ];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN ])[k ];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS ])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS ])[ks ];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k ];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE ])[k ];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW ])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE ])[ks ];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW ])[kw ];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE ])[kb ];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW ])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW ])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00 ])[k ];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00 ])[kw ];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0 ])[ks ];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M ])[kb ];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0 ])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0 ])[kw ];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P ])[k ];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M ])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P ])[kw ];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP ])[k ];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM ])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP ])[ks ];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k ];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP ])[k ];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP ])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP ])[ks ];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP ])[kw ];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM ])[kb ];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM ])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM ])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + (((mfbac+mfbca) + (mfbaa+mfbcc)) + ((mfabc+mfcba) + (mfaba+mfcbc)) + ((mfacb+mfcab) + (mfaab+mfccb))) + @@ -603,9 +604,9 @@ extern "C" __global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, //4. ////////////////////////////////////////////////////////////////////////// //mit limiter - real A = ( c4o1 * omega * omega + c2o1 * omega * OxxPyyPzz * ( omega - c6o1 ) + OxxPyyPzz * OxxPyyPzz * ( omega * ( c10o1 - c3o1 * omega ) - c4o1 )) / + real factorA = ( c4o1 * omega * omega + c2o1 * omega * OxxPyyPzz * ( omega - c6o1 ) + OxxPyyPzz * OxxPyyPzz * ( omega * ( c10o1 - c3o1 * omega ) - c4o1 )) / ( ( omega - OxxPyyPzz ) * ( OxxPyyPzz * ( c2o1 + c3o1 * omega ) - c8o1 * omega ) ); - real B = ( c4o1 * omega * OxxPyyPzz * ( c9o1 * omega - c16o1 ) - c4o1 * omega * omega - c2o1 * OxxPyyPzz * OxxPyyPzz * ( c2o1 + c9o1 * omega * ( omega - c2o1 ))) / + real factorB = ( c4o1 * omega * OxxPyyPzz * ( c9o1 * omega - c16o1 ) - c4o1 * omega * omega - c2o1 * OxxPyyPzz * OxxPyyPzz * ( c2o1 + c9o1 * omega * ( omega - c2o1 ))) / ( c3o1 * ( omega - OxxPyyPzz ) * ( OxxPyyPzz * ( c2o1 + c3o1 * omega ) - c8o1 * omega ) ); ////////////////////////////////////////////////////////////////////////// //ohne limiter @@ -623,12 +624,12 @@ extern "C" __global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, //CUMbcb = -O4*(one/omega-c1o2)*Dxz*c1o3 *(four+twentyeight*omega-fourteen*omega*omega)/(six-twentyone*omega+fiveteen*omega*omega)+(one-O4) * (CUMbcb); //CUMcbb = -O4*(one/omega-c1o2)*Dyz*c1o3 *(four+twentyeight*omega-fourteen*omega*omega)/(six-twentyone*omega+fiveteen*omega*omega)+(one-O4) * (CUMcbb); //with bulk viscosity - CUMacc = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMacc); - CUMcac = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMcac); - CUMcca = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * A + (c1o1 - O4) * (CUMcca); - CUMbbc = -O4 * (c1o1 / omega - c1o2) * Dxy * c1o3 * B + (c1o1 - O4) * (CUMbbc); - CUMbcb = -O4 * (c1o1 / omega - c1o2) * Dxz * c1o3 * B + (c1o1 - O4) * (CUMbcb); - CUMcbb = -O4 * (c1o1 / omega - c1o2) * Dyz * c1o3 * B + (c1o1 - O4) * (CUMcbb); + CUMacc = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMacc); + CUMcac = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMcac); + CUMcca = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * factorA + (c1o1 - O4) * (CUMcca); + CUMbbc = -O4 * (c1o1 / omega - c1o2) * Dxy * c1o3 * factorB + (c1o1 - O4) * (CUMbbc); + CUMbcb = -O4 * (c1o1 / omega - c1o2) * Dxz * c1o3 * factorB + (c1o1 - O4) * (CUMbcb); + CUMcbb = -O4 * (c1o1 / omega - c1o2) * Dyz * c1o3 * factorB + (c1o1 - O4) * (CUMcbb); ////////////////////////////////////////////////////////////////////////// @@ -893,33 +894,33 @@ extern "C" __global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[ dirE ])[k ] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[ dirW ])[kw ] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[ dirN ])[k ] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[ dirS ])[ks ] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[ dirT ])[k ] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[ dirB ])[kb ] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[ dirNE ])[k ] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[ dirSW ])[ksw ] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[ dirSE ])[ks ] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[ dirNW ])[kw ] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[ dirTE ])[k ] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[ dirBW ])[kbw ] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[ dirBE ])[kb ] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[ dirTW ])[kw ] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[ dirTN ])[k ] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[ dirBS ])[kbs ] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[ dirBN ])[kb ] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[ dirTS ])[ks ] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[ dirZERO])[k ] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[ dirTNE ])[k ] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[ dirTSE ])[ks ] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[ dirBNE ])[kb ] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[ dirBSE ])[kbs ] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[ dirTNW ])[kw ] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[ dirTSW ])[ksw ] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[ dirBNW ])[kbw ] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[ dirBSW ])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[ DIR_P00 ])[k ] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[ DIR_M00 ])[kw ] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[ DIR_0P0 ])[k ] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[ DIR_0M0 ])[ks ] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[ DIR_00P ])[k ] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[ DIR_00M ])[kb ] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[ DIR_PP0 ])[k ] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[ DIR_MM0 ])[ksw ] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[ DIR_PM0 ])[ks ] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[ DIR_MP0 ])[kw ] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[ DIR_P0P ])[k ] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[ DIR_M0M ])[kbw ] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[ DIR_P0M ])[kb ] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[ DIR_M0P ])[kw ] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[ DIR_0PP ])[k ] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[ DIR_0MM ])[kbs ] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[ DIR_0PM ])[kb ] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[ DIR_0MP ])[ks ] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[ DIR_000])[k ] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[ DIR_PPP ])[k ] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[ DIR_PMP ])[ks ] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[ DIR_PPM ])[kb ] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[ DIR_PMM ])[kbs ] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[ DIR_MPP ])[kw ] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[ DIR_MMP ])[ksw ] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[ DIR_MPM ])[kbw ] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[ DIR_MMM ])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } @@ -965,7 +966,7 @@ extern "C" __global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Kum_IsoTest_SP_27( real omega, +__global__ void LB_Kernel_Kum_IsoTest_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -999,63 +1000,63 @@ extern "C" __global__ void LB_Kernel_Kum_IsoTest_SP_27( real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -1088,33 +1089,33 @@ extern "C" __global__ void LB_Kernel_Kum_IsoTest_SP_27( real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW ])[kw ];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS ])[ks ];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB ])[kb ];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW ])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW ])[kw ];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE ])[k ];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW ])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW ])[kw ];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN ])[k ];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS ])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS ])[ks ];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k ];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE ])[k ];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW ])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE ])[ks ];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW ])[kw ];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE ])[kb ];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW ])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW ])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00 ])[k ];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00 ])[kw ];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0 ])[ks ];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M ])[kb ];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0 ])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0 ])[kw ];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P ])[k ];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M ])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P ])[kw ];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP ])[k ];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM ])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP ])[ks ];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k ];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP ])[k ];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP ])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP ])[ks ];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP ])[kw ];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM ])[kb ];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM ])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM ])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// //slow //real oMdrho = one - ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + @@ -1932,33 +1933,33 @@ extern "C" __global__ void LB_Kernel_Kum_IsoTest_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[ dirE ])[k ] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[ dirW ])[kw ] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[ dirN ])[k ] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[ dirS ])[ks ] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[ dirT ])[k ] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[ dirB ])[kb ] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[ dirNE ])[k ] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[ dirSW ])[ksw ] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[ dirSE ])[ks ] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[ dirNW ])[kw ] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[ dirTE ])[k ] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[ dirBW ])[kbw ] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[ dirBE ])[kb ] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[ dirTW ])[kw ] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[ dirTN ])[k ] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[ dirBS ])[kbs ] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[ dirBN ])[kb ] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[ dirTS ])[ks ] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[ dirZERO])[k ] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[ dirTNE ])[k ] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[ dirTSE ])[ks ] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[ dirBNE ])[kb ] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[ dirBSE ])[kbs ] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[ dirTNW ])[kw ] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[ dirTSW ])[ksw ] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[ dirBNW ])[kbw ] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[ dirBSW ])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[ DIR_P00 ])[k ] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[ DIR_M00 ])[kw ] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[ DIR_0P0 ])[k ] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[ DIR_0M0 ])[ks ] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[ DIR_00P ])[k ] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[ DIR_00M ])[kb ] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[ DIR_PP0 ])[k ] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[ DIR_MM0 ])[ksw ] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[ DIR_PM0 ])[ks ] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[ DIR_MP0 ])[kw ] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[ DIR_P0P ])[k ] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[ DIR_M0M ])[kbw ] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[ DIR_P0M ])[kb ] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[ DIR_M0P ])[kw ] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[ DIR_0PP ])[k ] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[ DIR_0MM ])[kbs ] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[ DIR_0PM ])[kb ] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[ DIR_0MP ])[ks ] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[ DIR_000])[k ] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[ DIR_PPP ])[k ] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[ DIR_PMP ])[ks ] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[ DIR_PPM ])[kb ] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[ DIR_PMM ])[kbs ] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[ DIR_MPP ])[kw ] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[ DIR_MMP ])[ksw ] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[ DIR_MPM ])[kbw ] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[ DIR_MMM ])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } @@ -2004,7 +2005,7 @@ extern "C" __global__ void LB_Kernel_Kum_IsoTest_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Kum_1h_SP_27( real omega, +__global__ void LB_Kernel_Kum_1h_SP_27( real omega, real deltaPhi, real angularVelocity, unsigned int* bcMatD, @@ -2040,63 +2041,63 @@ extern "C" __global__ void LB_Kernel_Kum_1h_SP_27( real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -2157,33 +2158,33 @@ extern "C" __global__ void LB_Kernel_Kum_1h_SP_27( real omega, //unsigned int ktne = k; //unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW ])[kw ];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS ])[ks ];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB ])[kb ];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW ])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW ])[kw ];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE ])[k ];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW ])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW ])[kw ];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN ])[k ];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS ])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS ])[ks ];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k ];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE ])[k ];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW ])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE ])[ks ];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW ])[kw ];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE ])[kb ];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW ])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW ])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00 ])[k ];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00 ])[kw ];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0 ])[ks ];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M ])[kb ];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0 ])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0 ])[kw ];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P ])[k ];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M ])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P ])[kw ];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP ])[k ];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM ])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP ])[ks ];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k ];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP ])[k ];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP ])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP ])[ks ];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP ])[kw ];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM ])[kb ];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM ])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM ])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// //Ship real coord0X = 281.125f;//7.5f; @@ -3159,33 +3160,33 @@ extern "C" __global__ void LB_Kernel_Kum_1h_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[ dirE ])[k ] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[ dirW ])[kw ] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[ dirN ])[k ] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[ dirS ])[ks ] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[ dirT ])[k ] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[ dirB ])[kb ] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[ dirNE ])[k ] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[ dirSW ])[ksw ] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[ dirSE ])[ks ] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[ dirNW ])[kw ] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[ dirTE ])[k ] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[ dirBW ])[kbw ] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[ dirBE ])[kb ] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[ dirTW ])[kw ] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[ dirTN ])[k ] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[ dirBS ])[kbs ] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[ dirBN ])[kb ] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[ dirTS ])[ks ] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[ dirZERO])[k ] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[ dirTNE ])[k ] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[ dirTSE ])[ks ] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[ dirBNE ])[kb ] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[ dirBSE ])[kbs ] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[ dirTNW ])[kw ] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[ dirTSW ])[ksw ] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[ dirBNW ])[kbw ] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[ dirBSW ])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[ DIR_P00 ])[k ] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[ DIR_M00 ])[kw ] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[ DIR_0P0 ])[k ] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[ DIR_0M0 ])[ks ] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[ DIR_00P ])[k ] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[ DIR_00M ])[kb ] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[ DIR_PP0 ])[k ] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[ DIR_MM0 ])[ksw ] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[ DIR_PM0 ])[ks ] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[ DIR_MP0 ])[kw ] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[ DIR_P0P ])[k ] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[ DIR_M0M ])[kbw ] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[ DIR_P0M ])[kb ] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[ DIR_M0P ])[kw ] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[ DIR_0PP ])[k ] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[ DIR_0MM ])[kbs ] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[ DIR_0PM ])[kb ] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[ DIR_0MP ])[ks ] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[ DIR_000])[k ] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[ DIR_PPP ])[k ] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[ DIR_PMP ])[ks ] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[ DIR_PPM ])[kb ] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[ DIR_PMM ])[kbs ] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[ DIR_MPP ])[kw ] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[ DIR_MMP ])[ksw ] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[ DIR_MPM ])[kbw ] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[ DIR_MMM ])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } @@ -3231,7 +3232,7 @@ extern "C" __global__ void LB_Kernel_Kum_1h_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Kum_New_SP_27( real omega, +__global__ void LB_Kernel_Kum_New_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -3262,63 +3263,63 @@ extern "C" __global__ void LB_Kernel_Kum_New_SP_27( real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -3379,33 +3380,33 @@ extern "C" __global__ void LB_Kernel_Kum_New_SP_27( real omega, //unsigned int ktne = k; //unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW ])[kw ];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS ])[ks ];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB ])[kb ];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW ])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW ])[kw ];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE ])[k ];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW ])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW ])[kw ];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN ])[k ];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS ])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS ])[ks ];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k ];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE ])[k ];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW ])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE ])[ks ];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW ])[kw ];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE ])[kb ];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW ])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW ])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00 ])[k ];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00 ])[kw ];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0 ])[ks ];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M ])[kb ];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0 ])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0 ])[kw ];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P ])[k ];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M ])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P ])[kw ];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP ])[k ];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM ])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP ])[ks ];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k ];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP ])[k ];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP ])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP ])[ks ];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP ])[kw ];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM ])[kb ];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM ])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM ])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// //slow //real oMdrho = one - ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + @@ -4431,33 +4432,33 @@ extern "C" __global__ void LB_Kernel_Kum_New_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[ dirE ])[k ] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[ dirW ])[kw ] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[ dirN ])[k ] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[ dirS ])[ks ] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[ dirT ])[k ] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[ dirB ])[kb ] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[ dirNE ])[k ] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[ dirSW ])[ksw ] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[ dirSE ])[ks ] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[ dirNW ])[kw ] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[ dirTE ])[k ] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[ dirBW ])[kbw ] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[ dirBE ])[kb ] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[ dirTW ])[kw ] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[ dirTN ])[k ] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[ dirBS ])[kbs ] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[ dirBN ])[kb ] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[ dirTS ])[ks ] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[ dirZERO])[k ] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[ dirTNE ])[k ] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[ dirTSE ])[ks ] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[ dirBNE ])[kb ] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[ dirBSE ])[kbs ] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[ dirTNW ])[kw ] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[ dirTSW ])[ksw ] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[ dirBNW ])[kbw ] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[ dirBSW ])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[ DIR_P00 ])[k ] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[ DIR_M00 ])[kw ] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[ DIR_0P0 ])[k ] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[ DIR_0M0 ])[ks ] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[ DIR_00P ])[k ] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[ DIR_00M ])[kb ] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[ DIR_PP0 ])[k ] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[ DIR_MM0 ])[ksw ] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[ DIR_PM0 ])[ks ] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[ DIR_MP0 ])[kw ] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[ DIR_P0P ])[k ] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[ DIR_M0M ])[kbw ] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[ DIR_P0M ])[kb ] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[ DIR_M0P ])[kw ] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[ DIR_0PP ])[k ] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[ DIR_0MM ])[kbs ] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[ DIR_0PM ])[kb ] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[ DIR_0MP ])[ks ] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[ DIR_000])[k ] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[ DIR_PPP ])[k ] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[ DIR_PMP ])[ks ] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[ DIR_PPM ])[kb ] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[ DIR_PMM ])[kbs ] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[ DIR_MPP ])[kw ] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[ DIR_MMP ])[ksw ] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[ DIR_MPM ])[kbw ] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[ DIR_MMM ])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } @@ -4503,7 +4504,7 @@ extern "C" __global__ void LB_Kernel_Kum_New_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Kum_Comp_SP_27( real omega, +__global__ void LB_Kernel_Kum_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -4534,63 +4535,63 @@ extern "C" __global__ void LB_Kernel_Kum_Comp_SP_27( real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -4623,42 +4624,42 @@ extern "C" __global__ void LB_Kernel_Kum_Comp_SP_27( real omega, unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real E = (D.f[dirE ])[ke ];// + c2over27 ; - real W = (D.f[dirW ])[kw ];// + c2over27 ; - real N = (D.f[dirN ])[kn ];// + c2over27 ; - real S = (D.f[dirS ])[ks ];// + c2over27 ; - real F = (D.f[dirT ])[kt ];// + c2over27 ; - real B = (D.f[dirB ])[kb ];// + c2over27 ; - real Ne = (D.f[dirNE ])[kne ];// + c1over54 ; - real Sw = (D.f[dirSW ])[ksw ];// + c1over54 ; - real Se = (D.f[dirSE ])[kse ];// + c1over54 ; - real Nw = (D.f[dirNW ])[knw ];// + c1over54 ; - real Ef = (D.f[dirTE ])[kte ];// + c1over54 ; - real Wb = (D.f[dirBW ])[kbw ];// + c1over54 ; - real Eb = (D.f[dirBE ])[kbe ];// + c1over54 ; - real Wf = (D.f[dirTW ])[ktw ];// + c1over54 ; - real Nf = (D.f[dirTN ])[ktn ];// + c1over54 ; - real Sb = (D.f[dirBS ])[kbs ];// + c1over54 ; - real Nb = (D.f[dirBN ])[kbn ];// + c1over54 ; - real Sf = (D.f[dirTS ])[kts ];// + c1over54 ; - real R = (D.f[dirZERO])[kzero];// + c8over27 ; - real Nef = (D.f[dirTNE ])[ktne ];// + c1over216; - real Swf = (D.f[dirTSW ])[ktsw ];// + c1over216; - real Sef = (D.f[dirTSE ])[ktse ];// + c1over216; - real Nwf = (D.f[dirTNW ])[ktnw ];// + c1over216; - real Neb = (D.f[dirBNE ])[kbne ];// + c1over216; - real Swb = (D.f[dirBSW ])[kbsw ];// + c1over216; - real Seb = (D.f[dirBSE ])[kbse ];// + c1over216; - real Nwb = (D.f[dirBNW ])[kbnw ];// + c1over216; + real f_E = (D.f[DIR_P00 ])[ke ];// + c2over27 ; + real f_W = (D.f[DIR_M00 ])[kw ];// + c2over27 ; + real f_N = (D.f[DIR_0P0 ])[kn ];// + c2over27 ; + real f_S = (D.f[DIR_0M0 ])[ks ];// + c2over27 ; + real f_T = (D.f[DIR_00P ])[kt ];// + c2over27 ; + real f_B = (D.f[DIR_00M ])[kb ];// + c2over27 ; + real f_NE = (D.f[DIR_PP0 ])[kne ];// + c1over54 ; + real f_SW = (D.f[DIR_MM0 ])[ksw ];// + c1over54 ; + real f_SE = (D.f[DIR_PM0 ])[kse ];// + c1over54 ; + real f_NW = (D.f[DIR_MP0 ])[knw ];// + c1over54 ; + real f_TE = (D.f[DIR_P0P ])[kte ];// + c1over54 ; + real f_BW = (D.f[DIR_M0M ])[kbw ];// + c1over54 ; + real f_BE = (D.f[DIR_P0M ])[kbe ];// + c1over54 ; + real f_TW = (D.f[DIR_M0P ])[ktw ];// + c1over54 ; + real f_TN = (D.f[DIR_0PP ])[ktn ];// + c1over54 ; + real f_BS = (D.f[DIR_0MM ])[kbs ];// + c1over54 ; + real f_BN = (D.f[DIR_0PM ])[kbn ];// + c1over54 ; + real f_TS = (D.f[DIR_0MP ])[kts ];// + c1over54 ; + real f_R = (D.f[DIR_000])[kzero];// + c8over27 ; + real f_TNE = (D.f[DIR_PPP ])[ktne ];// + c1over216; + real f_TSW = (D.f[DIR_MMP ])[ktsw ];// + c1over216; + real f_TSE = (D.f[DIR_PMP ])[ktse ];// + c1over216; + real f_TNW = (D.f[DIR_MPP ])[ktnw ];// + c1over216; + real f_BNE = (D.f[DIR_PPM ])[kbne ];// + c1over216; + real f_BSW = (D.f[DIR_MMM ])[kbsw ];// + c1over216; + real f_BSE = (D.f[DIR_PMM ])[kbse ];// + c1over216; + real f_BNW = (D.f[DIR_MPM ])[kbnw ];// + c1over216; //////////////////////////////////////////////////////////////////////////////////// real fx = c0o1; real fy = c0o1; real fz = c0o1; //////////////////////////////////////////////////////////////////////////////////// - real rho=Nw+W+Sw+S+Se+E+Ne+N+R+Nf+Nb+Sf+Sb+Ef+Eb+Wf+Wb+Nwf+Nwb+Nef+Neb+Swf+Swb+Sef+Seb+F+B+c1o1;// ACHTUNG ne EINS !!!!!!!! - real pix=(Ne+E+Se+Ef+Eb-Nw-W-Sw-Wf-Wb+Nef+Neb+Sef+Seb-Nwf-Nwb-Swf-Swb); - real piy=(Ne+N+Nw+Nf+Nb-Se-S-Sw-Sf-Sb+Nef+Neb+Nwf+Nwb-Sef-Seb-Swf-Swb); - real piz=(Nf+Sf+Wf+Ef+F-Nb-Sb-Wb-Eb-B+Nef+Nwf+Sef+Swf-Neb-Nwb-Seb-Swb); + real rho=f_NW+f_W+f_SW+f_S+f_SE+f_E+f_NE+f_N+f_R+f_TN+f_BN+f_TS+f_BS+f_TE+f_BE+f_TW+f_BW+f_TNW+f_BNW+f_TNE+f_BNE+f_TSW+f_BSW+f_TSE+f_BSE+f_T+f_B+c1o1;// ACHTUNG ne EINS !!!!!!!! + real pix=(f_NE+f_E+f_SE+f_TE+f_BE-f_NW-f_W-f_SW-f_TW-f_BW+f_TNE+f_BNE+f_TSE+f_BSE-f_TNW-f_BNW-f_TSW-f_BSW); + real piy=(f_NE+f_N+f_NW+f_TN+f_BN-f_SE-f_S-f_SW-f_TS-f_BS+f_TNE+f_BNE+f_TNW+f_BNW-f_TSE-f_BSE-f_TSW-f_BSW); + real piz=(f_TN+f_TS+f_TW+f_TE+f_T-f_BN-f_BS-f_BW-f_BE-f_B+f_TNE+f_TNW+f_TSE+f_TSW-f_BNE-f_BNW-f_BSE-f_BSW); real vvx=pix/rho + fx; real vvy=piy/rho + fy; real vvz=piz/rho + fz; @@ -4666,33 +4667,33 @@ extern "C" __global__ void LB_Kernel_Kum_Comp_SP_27( real omega, real vy2=vvy*vvy; real vz2=vvz*vvz; //////////////////////////////////////////////////////////////////////////////////// - real mfaaa = Swb; - real mfaab = Sw; - real mfaac = Swf; - real mfaba = Wb; - real mfabb = W; - real mfabc = Wf; - real mfbaa = Sb; - real mfbab = S; - real mfbac = Sf; - real mfbba = B; - real mfbbb = R; - real mfbbc = F; - real mfaca = Nwb; - real mfacb = Nw; - real mfacc = Nwf; - real mfcaa = Seb; - real mfcab = Se; - real mfcac = Sef; - real mfcca = Neb; - real mfccb = Ne; - real mfccc = Nef; - real mfbca = Nb; - real mfbcb = N; - real mfbcc = Nf; - real mfcba = Eb; - real mfcbb = E; - real mfcbc = Ef; + real mfaaa = f_BSW; + real mfaab = f_SW; + real mfaac = f_TSW; + real mfaba = f_BW; + real mfabb = f_W; + real mfabc = f_TW; + real mfbaa = f_BS; + real mfbab = f_S; + real mfbac = f_TS; + real mfbba = f_B; + real mfbbb = f_R; + real mfbbc = f_T; + real mfaca = f_BNW; + real mfacb = f_NW; + real mfacc = f_TNW; + real mfcaa = f_BSE; + real mfcab = f_SE; + real mfcac = f_TSE; + real mfcca = f_BNE; + real mfccb = f_NE; + real mfccc = f_TNE; + real mfbca = f_BN; + real mfbcb = f_N; + real mfbcc = f_TN; + real mfcba = f_BE; + real mfcbb = f_E; + real mfcbc = f_TE; real m0, m1, m2; real wadjust; real qudricLimit = c1o100; @@ -5371,33 +5372,33 @@ extern "C" __global__ void LB_Kernel_Kum_Comp_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[ dirE ])[ke ] = mfabb;// - c2over27 ;// - (D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; - (D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; - (D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; - (D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; - (D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; - (D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; - (D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; - (D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; - (D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; - (D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; - (D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; - (D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; - (D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; - (D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; - (D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; - (D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; - (D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; - (D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; - (D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; - (D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; - (D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; - (D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; - (D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; - (D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; - (D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; - (D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; + (D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ;// + (D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; + (D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; + (D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; + (D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; + (D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; + (D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; + (D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; + (D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; + (D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; + (D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; + (D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; + (D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; + (D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; + (D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; + (D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; + (D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; + (D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; + (D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; + (D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; + (D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; + (D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; + (D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; + (D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; + (D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; + (D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; + (D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; //////////////////////////////////////////////////////////////////////////////////// } } @@ -5443,7 +5444,7 @@ extern "C" __global__ void LB_Kernel_Kum_Comp_SP_27( real omega, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_Kum_New_Comp_SRT_SP_27( +__global__ void LB_Kernel_Kum_New_Comp_SRT_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -5477,63 +5478,63 @@ extern "C" __global__ void LB_Kernel_Kum_New_Comp_SRT_SP_27( Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -5567,33 +5568,33 @@ extern "C" __global__ void LB_Kernel_Kum_New_Comp_SRT_SP_27( unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ]; - real mfaab = (D.f[dirSW ])[ksw ]; - real mfcab = (D.f[dirSE ])[ks ]; - real mfacb = (D.f[dirNW ])[kw ]; - real mfcbc = (D.f[dirTE ])[k ]; - real mfaba = (D.f[dirBW ])[kbw ]; - real mfcba = (D.f[dirBE ])[kb ]; - real mfabc = (D.f[dirTW ])[kw ]; - real mfbcc = (D.f[dirTN ])[k ]; - real mfbaa = (D.f[dirBS ])[kbs ]; - real mfbca = (D.f[dirBN ])[kb ]; - real mfbac = (D.f[dirTS ])[ks ]; - real mfbbb = (D.f[dirZERO])[k ]; - real mfccc = (D.f[dirTNE ])[k ]; - real mfaac = (D.f[dirTSW ])[ksw ]; - real mfcac = (D.f[dirTSE ])[ks ]; - real mfacc = (D.f[dirTNW ])[kw ]; - real mfcca = (D.f[dirBNE ])[kb ]; - real mfaaa = (D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs ]; - real mfaca = (D.f[dirBNW ])[kbw ]; + real mfcbb = (D.f[DIR_P00 ])[k ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ]; + real mfaab = (D.f[DIR_MM0 ])[ksw ]; + real mfcab = (D.f[DIR_PM0 ])[ks ]; + real mfacb = (D.f[DIR_MP0 ])[kw ]; + real mfcbc = (D.f[DIR_P0P ])[k ]; + real mfaba = (D.f[DIR_M0M ])[kbw ]; + real mfcba = (D.f[DIR_P0M ])[kb ]; + real mfabc = (D.f[DIR_M0P ])[kw ]; + real mfbcc = (D.f[DIR_0PP ])[k ]; + real mfbaa = (D.f[DIR_0MM ])[kbs ]; + real mfbca = (D.f[DIR_0PM ])[kb ]; + real mfbac = (D.f[DIR_0MP ])[ks ]; + real mfbbb = (D.f[DIR_000])[k ]; + real mfccc = (D.f[DIR_PPP ])[k ]; + real mfaac = (D.f[DIR_MMP ])[ksw ]; + real mfcac = (D.f[DIR_PMP ])[ks ]; + real mfacc = (D.f[DIR_MPP ])[kw ]; + real mfcca = (D.f[DIR_PPM ])[kb ]; + real mfaaa = (D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs ]; + real mfaca = (D.f[DIR_MPM ])[kbw ]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -6348,33 +6349,33 @@ extern "C" __global__ void LB_Kernel_Kum_New_Comp_SRT_SP_27( ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb; mfbbb += drho - drhoPost; //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE ])[k ] = mfabb; - (D.f[dirW ])[kw ] = mfcbb; - (D.f[dirN ])[k ] = mfbab; - (D.f[dirS ])[ks ] = mfbcb; - (D.f[dirT ])[k ] = mfbba; - (D.f[dirB ])[kb ] = mfbbc; - (D.f[dirNE ])[k ] = mfaab; - (D.f[dirSW ])[ksw ] = mfccb; - (D.f[dirSE ])[ks ] = mfacb; - (D.f[dirNW ])[kw ] = mfcab; - (D.f[dirTE ])[k ] = mfaba; - (D.f[dirBW ])[kbw ] = mfcbc; - (D.f[dirBE ])[kb ] = mfabc; - (D.f[dirTW ])[kw ] = mfcba; - (D.f[dirTN ])[k ] = mfbaa; - (D.f[dirBS ])[kbs ] = mfbcc; - (D.f[dirBN ])[kb ] = mfbac; - (D.f[dirTS ])[ks ] = mfbca; - (D.f[dirZERO])[k ] = mfbbb; - (D.f[dirTNE ])[k ] = mfaaa; - (D.f[dirTSE ])[ks ] = mfaca; - (D.f[dirBNE ])[kb ] = mfaac; - (D.f[dirBSE ])[kbs ] = mfacc; - (D.f[dirTNW ])[kw ] = mfcaa; - (D.f[dirTSW ])[ksw ] = mfcca; - (D.f[dirBNW ])[kbw ] = mfcac; - (D.f[dirBSW ])[kbsw] = mfccc; + (D.f[DIR_P00 ])[k ] = mfabb; + (D.f[DIR_M00 ])[kw ] = mfcbb; + (D.f[DIR_0P0 ])[k ] = mfbab; + (D.f[DIR_0M0 ])[ks ] = mfbcb; + (D.f[DIR_00P ])[k ] = mfbba; + (D.f[DIR_00M ])[kb ] = mfbbc; + (D.f[DIR_PP0 ])[k ] = mfaab; + (D.f[DIR_MM0 ])[ksw ] = mfccb; + (D.f[DIR_PM0 ])[ks ] = mfacb; + (D.f[DIR_MP0 ])[kw ] = mfcab; + (D.f[DIR_P0P ])[k ] = mfaba; + (D.f[DIR_M0M ])[kbw ] = mfcbc; + (D.f[DIR_P0M ])[kb ] = mfabc; + (D.f[DIR_M0P ])[kw ] = mfcba; + (D.f[DIR_0PP ])[k ] = mfbaa; + (D.f[DIR_0MM ])[kbs ] = mfbcc; + (D.f[DIR_0PM ])[kb ] = mfbac; + (D.f[DIR_0MP ])[ks ] = mfbca; + (D.f[DIR_000])[k ] = mfbbb; + (D.f[DIR_PPP ])[k ] = mfaaa; + (D.f[DIR_PMP ])[ks ] = mfaca; + (D.f[DIR_PPM ])[kb ] = mfaac; + (D.f[DIR_PMM ])[kbs ] = mfacc; + (D.f[DIR_MPP ])[kw ] = mfcaa; + (D.f[DIR_MMP ])[ksw ] = mfcca; + (D.f[DIR_MPM ])[kbw ] = mfcac; + (D.f[DIR_MMM ])[kbsw] = mfccc; } } } diff --git a/src/gpu/VirtualFluids_GPU/GPU/Cumulant27chim.cu b/src/gpu/VirtualFluids_GPU/GPU/Cumulant27chim.cu index 9dc75cfa6019a29350263f9a554aa9a489566cfa..97c1aff4d26cb85deaf1dd0d145245f28affc2e3 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/Cumulant27chim.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/Cumulant27chim.cu @@ -32,17 +32,19 @@ //======================================================================================= /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + #include "math.h" -#include <lbm/Chimera.h> +#include "lbm/Chimera.h" //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void Cumulant_One_preconditioned_errorDiffusion_chim_Comp_SP_27( +__global__ void Cumulant_One_preconditioned_errorDiffusion_chim_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -76,63 +78,63 @@ extern "C" __global__ void Cumulant_One_preconditioned_errorDiffusion_chim_Comp_ Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -168,33 +170,33 @@ extern "C" __global__ void Cumulant_One_preconditioned_errorDiffusion_chim_Comp_ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -884,33 +886,33 @@ extern "C" __global__ void Cumulant_One_preconditioned_errorDiffusion_chim_Comp_ // ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb; //mfbbb += drho - drhoPost; //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } @@ -957,7 +959,7 @@ extern "C" __global__ void Cumulant_One_preconditioned_errorDiffusion_chim_Comp_ //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void Cumulant_One_preconditioned_chim_Comp_SP_27( +__global__ void Cumulant_One_preconditioned_chim_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -991,63 +993,63 @@ extern "C" __global__ void Cumulant_One_preconditioned_chim_Comp_SP_27( Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -1083,33 +1085,33 @@ extern "C" __global__ void Cumulant_One_preconditioned_chim_Comp_SP_27( ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -1680,33 +1682,33 @@ extern "C" __global__ void Cumulant_One_preconditioned_chim_Comp_SP_27( ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb; mfbbb += drho - drhoPost; //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } @@ -1753,7 +1755,7 @@ extern "C" __global__ void Cumulant_One_preconditioned_chim_Comp_SP_27( //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void Cumulant_One_chim_Comp_SP_27( +__global__ void Cumulant_One_chim_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -1787,63 +1789,63 @@ extern "C" __global__ void Cumulant_One_chim_Comp_SP_27( Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// //index @@ -1855,33 +1857,33 @@ extern "C" __global__ void Cumulant_One_chim_Comp_SP_27( unsigned int kbs = neighborZ[ks]; unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ]; - real mfaab = (D.f[dirSW ])[ksw ]; - real mfcab = (D.f[dirSE ])[ks ]; - real mfacb = (D.f[dirNW ])[kw ]; - real mfcbc = (D.f[dirTE ])[k ]; - real mfaba = (D.f[dirBW ])[kbw ]; - real mfcba = (D.f[dirBE ])[kb ]; - real mfabc = (D.f[dirTW ])[kw ]; - real mfbcc = (D.f[dirTN ])[k ]; - real mfbaa = (D.f[dirBS ])[kbs ]; - real mfbca = (D.f[dirBN ])[kb ]; - real mfbac = (D.f[dirTS ])[ks ]; - real mfbbb = (D.f[dirZERO])[k ]; - real mfccc = (D.f[dirTNE ])[k ]; - real mfaac = (D.f[dirTSW ])[ksw ]; - real mfcac = (D.f[dirTSE ])[ks ]; - real mfacc = (D.f[dirTNW ])[kw ]; - real mfcca = (D.f[dirBNE ])[kb ]; - real mfaaa = (D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs ]; - real mfaca = (D.f[dirBNW ])[kbw ]; + real mfcbb = (D.f[DIR_P00 ])[k ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ]; + real mfaab = (D.f[DIR_MM0 ])[ksw ]; + real mfcab = (D.f[DIR_PM0 ])[ks ]; + real mfacb = (D.f[DIR_MP0 ])[kw ]; + real mfcbc = (D.f[DIR_P0P ])[k ]; + real mfaba = (D.f[DIR_M0M ])[kbw ]; + real mfcba = (D.f[DIR_P0M ])[kb ]; + real mfabc = (D.f[DIR_M0P ])[kw ]; + real mfbcc = (D.f[DIR_0PP ])[k ]; + real mfbaa = (D.f[DIR_0MM ])[kbs ]; + real mfbca = (D.f[DIR_0PM ])[kb ]; + real mfbac = (D.f[DIR_0MP ])[ks ]; + real mfbbb = (D.f[DIR_000])[k ]; + real mfccc = (D.f[DIR_PPP ])[k ]; + real mfaac = (D.f[DIR_MMP ])[ksw ]; + real mfcac = (D.f[DIR_PMP ])[ks ]; + real mfacc = (D.f[DIR_MPP ])[kw ]; + real mfcca = (D.f[DIR_PPM ])[kb ]; + real mfaaa = (D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs ]; + real mfaca = (D.f[DIR_MPM ])[kbw ]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -2202,33 +2204,33 @@ extern "C" __global__ void Cumulant_One_chim_Comp_SP_27( ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb; mfbbb += drho - drhoPost; //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE ])[k ] = mfabb; - (D.f[dirW ])[kw ] = mfcbb; - (D.f[dirN ])[k ] = mfbab; - (D.f[dirS ])[ks ] = mfbcb; - (D.f[dirT ])[k ] = mfbba; - (D.f[dirB ])[kb ] = mfbbc; - (D.f[dirNE ])[k ] = mfaab; - (D.f[dirSW ])[ksw ] = mfccb; - (D.f[dirSE ])[ks ] = mfacb; - (D.f[dirNW ])[kw ] = mfcab; - (D.f[dirTE ])[k ] = mfaba; - (D.f[dirBW ])[kbw ] = mfcbc; - (D.f[dirBE ])[kb ] = mfabc; - (D.f[dirTW ])[kw ] = mfcba; - (D.f[dirTN ])[k ] = mfbaa; - (D.f[dirBS ])[kbs ] = mfbcc; - (D.f[dirBN ])[kb ] = mfbac; - (D.f[dirTS ])[ks ] = mfbca; - (D.f[dirZERO])[k ] = mfbbb; - (D.f[dirTNE ])[k ] = mfaaa; - (D.f[dirTSE ])[ks ] = mfaca; - (D.f[dirBNE ])[kb ] = mfaac; - (D.f[dirBSE ])[kbs ] = mfacc; - (D.f[dirTNW ])[kw ] = mfcaa; - (D.f[dirTSW ])[ksw ] = mfcca; - (D.f[dirBNW ])[kbw ] = mfcac; - (D.f[dirBSW ])[kbsw] = mfccc; + (D.f[DIR_P00 ])[k ] = mfabb; + (D.f[DIR_M00 ])[kw ] = mfcbb; + (D.f[DIR_0P0 ])[k ] = mfbab; + (D.f[DIR_0M0 ])[ks ] = mfbcb; + (D.f[DIR_00P ])[k ] = mfbba; + (D.f[DIR_00M ])[kb ] = mfbbc; + (D.f[DIR_PP0 ])[k ] = mfaab; + (D.f[DIR_MM0 ])[ksw ] = mfccb; + (D.f[DIR_PM0 ])[ks ] = mfacb; + (D.f[DIR_MP0 ])[kw ] = mfcab; + (D.f[DIR_P0P ])[k ] = mfaba; + (D.f[DIR_M0M ])[kbw ] = mfcbc; + (D.f[DIR_P0M ])[kb ] = mfabc; + (D.f[DIR_M0P ])[kw ] = mfcba; + (D.f[DIR_0PP ])[k ] = mfbaa; + (D.f[DIR_0MM ])[kbs ] = mfbcc; + (D.f[DIR_0PM ])[kb ] = mfbac; + (D.f[DIR_0MP ])[ks ] = mfbca; + (D.f[DIR_000])[k ] = mfbbb; + (D.f[DIR_PPP ])[k ] = mfaaa; + (D.f[DIR_PMP ])[ks ] = mfaca; + (D.f[DIR_PPM ])[kb ] = mfaac; + (D.f[DIR_PMM ])[kbs ] = mfacc; + (D.f[DIR_MPP ])[kw ] = mfcaa; + (D.f[DIR_MMP ])[ksw ] = mfcca; + (D.f[DIR_MPM ])[kbw ] = mfcac; + (D.f[DIR_MMM ])[kbsw] = mfccc; } } } diff --git a/src/gpu/VirtualFluids_GPU/GPU/Cumulant_F3_27.cu b/src/gpu/VirtualFluids_GPU/GPU/Cumulant_F3_27.cu index 8763482321aaa1c1dc5f21794192a5227a8f377b..7adfd40da157d825d83c63b084bf1f855ea6dca2 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/Cumulant_F3_27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/Cumulant_F3_27.cu @@ -7,14 +7,16 @@ ////////////////////////////////////////////////////////////////////////// /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + #include "math.h" ///////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, +__global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -52,83 +54,83 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } Distributions6 G; if (EvenOrOdd == true) { - G.g[dirE] = &G6[dirE *size_Mat]; - G.g[dirW] = &G6[dirW *size_Mat]; - G.g[dirN] = &G6[dirN *size_Mat]; - G.g[dirS] = &G6[dirS *size_Mat]; - G.g[dirT] = &G6[dirT *size_Mat]; - G.g[dirB] = &G6[dirB *size_Mat]; + G.g[DIR_P00] = &G6[DIR_P00 *size_Mat]; + G.g[DIR_M00] = &G6[DIR_M00 *size_Mat]; + G.g[DIR_0P0] = &G6[DIR_0P0 *size_Mat]; + G.g[DIR_0M0] = &G6[DIR_0M0 *size_Mat]; + G.g[DIR_00P] = &G6[DIR_00P *size_Mat]; + G.g[DIR_00M] = &G6[DIR_00M *size_Mat]; } else { - G.g[dirW] = &G6[dirE *size_Mat]; - G.g[dirE] = &G6[dirW *size_Mat]; - G.g[dirS] = &G6[dirN *size_Mat]; - G.g[dirN] = &G6[dirS *size_Mat]; - G.g[dirB] = &G6[dirT *size_Mat]; - G.g[dirT] = &G6[dirB *size_Mat]; + G.g[DIR_M00] = &G6[DIR_P00 *size_Mat]; + G.g[DIR_P00] = &G6[DIR_M00 *size_Mat]; + G.g[DIR_0M0] = &G6[DIR_0P0 *size_Mat]; + G.g[DIR_0P0] = &G6[DIR_0M0 *size_Mat]; + G.g[DIR_00M] = &G6[DIR_00P *size_Mat]; + G.g[DIR_00P] = &G6[DIR_00M *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -161,43 +163,43 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mgcbb = (G.g[dirE])[k]; - real mgabb = (G.g[dirW])[kw]; - real mgbcb = (G.g[dirN])[k]; - real mgbab = (G.g[dirS])[ks]; - real mgbbc = (G.g[dirT])[k]; - real mgbba = (G.g[dirB])[kb]; + real mgcbb = (G.g[DIR_P00])[k]; + real mgabb = (G.g[DIR_M00])[kw]; + real mgbcb = (G.g[DIR_0P0])[k]; + real mgbab = (G.g[DIR_0M0])[ks]; + real mgbbc = (G.g[DIR_00P])[k]; + real mgbba = (G.g[DIR_00M])[kb]; real dxuxdxux = c1o2 * (-mgcbb + mgabb); real dyuydyuy = c1o2 * (-mgbcb + mgbab); real dzuzdzuz = c1o2 * (-mgbbc + mgbba); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k]; - real mfabb = (D.f[dirW])[kw]; - real mfbcb = (D.f[dirN])[k]; - real mfbab = (D.f[dirS])[ks]; - real mfbbc = (D.f[dirT])[k]; - real mfbba = (D.f[dirB])[kb]; - real mfccb = (D.f[dirNE])[k]; - real mfaab = (D.f[dirSW])[ksw]; - real mfcab = (D.f[dirSE])[ks]; - real mfacb = (D.f[dirNW])[kw]; - real mfcbc = (D.f[dirTE])[k]; - real mfaba = (D.f[dirBW])[kbw]; - real mfcba = (D.f[dirBE])[kb]; - real mfabc = (D.f[dirTW])[kw]; - real mfbcc = (D.f[dirTN])[k]; - real mfbaa = (D.f[dirBS])[kbs]; - real mfbca = (D.f[dirBN])[kb]; - real mfbac = (D.f[dirTS])[ks]; - real mfbbb = (D.f[dirZERO])[k]; - real mfccc = (D.f[dirTNE])[k]; - real mfaac = (D.f[dirTSW])[ksw]; - real mfcac = (D.f[dirTSE])[ks]; - real mfacc = (D.f[dirTNW])[kw]; - real mfcca = (D.f[dirBNE])[kb]; - real mfaaa = (D.f[dirBSW])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs]; - real mfaca = (D.f[dirBNW])[kbw]; + real mfcbb = (D.f[DIR_P00])[k]; + real mfabb = (D.f[DIR_M00])[kw]; + real mfbcb = (D.f[DIR_0P0])[k]; + real mfbab = (D.f[DIR_0M0])[ks]; + real mfbbc = (D.f[DIR_00P])[k]; + real mfbba = (D.f[DIR_00M])[kb]; + real mfccb = (D.f[DIR_PP0])[k]; + real mfaab = (D.f[DIR_MM0])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks]; + real mfacb = (D.f[DIR_MP0])[kw]; + real mfcbc = (D.f[DIR_P0P])[k]; + real mfaba = (D.f[DIR_M0M])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb]; + real mfabc = (D.f[DIR_M0P])[kw]; + real mfbcc = (D.f[DIR_0PP])[k]; + real mfbaa = (D.f[DIR_0MM])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb]; + real mfbac = (D.f[DIR_0MP])[ks]; + real mfbbb = (D.f[DIR_000])[k]; + real mfccc = (D.f[DIR_PPP])[k]; + real mfaac = (D.f[DIR_MMP])[ksw]; + real mfcac = (D.f[DIR_PMP])[ks]; + real mfacc = (D.f[DIR_MPP])[kw]; + real mfcca = (D.f[DIR_PPM])[kb]; + real mfaaa = (D.f[DIR_MMM])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs]; + real mfaca = (D.f[DIR_MPM])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -911,41 +913,41 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - //(D.f[dirE])[k] = mfabb; - //(D.f[dirW])[kw] = mfcbb; - //(D.f[dirN])[k] = mfbab; - //(D.f[dirS])[ks] = mfbcb; - //(D.f[dirT])[k] = mfbba; - //(D.f[dirB])[kb] = mfbbc; - //(D.f[dirNE])[k] = mfaab; - //(D.f[dirSW])[ksw] = mfccb; - //(D.f[dirSE])[ks] = mfacb; - //(D.f[dirNW])[kw] = mfcab; - //(D.f[dirTE])[k] = mfaba; - //(D.f[dirBW])[kbw] = mfcbc; - //(D.f[dirBE])[kb] = mfabc; - //(D.f[dirTW])[kw] = mfcba; - //(D.f[dirTN])[k] = mfbaa; - //(D.f[dirBS])[kbs] = mfbcc; - //(D.f[dirBN])[kb] = mfbac; - //(D.f[dirTS])[ks] = mfbca; - //(D.f[dirZERO])[k] = mfbbb; - //(D.f[dirTNE])[k] = mfaaa; - //(D.f[dirTSE])[ks] = mfaca; - //(D.f[dirBNE])[kb] = mfaac; - //(D.f[dirBSE])[kbs] = mfacc; - //(D.f[dirTNW])[kw] = mfcaa; - //(D.f[dirTSW])[ksw] = mfcca; - //(D.f[dirBNW])[kbw] = mfcac; - //(D.f[dirBSW])[kbsw] = mfccc; + //(D.f[DIR_P00])[k] = mfabb; + //(D.f[DIR_M00])[kw] = mfcbb; + //(D.f[DIR_0P0])[k] = mfbab; + //(D.f[DIR_0M0])[ks] = mfbcb; + //(D.f[DIR_00P])[k] = mfbba; + //(D.f[DIR_00M])[kb] = mfbbc; + //(D.f[DIR_PP0])[k] = mfaab; + //(D.f[DIR_MM0])[ksw] = mfccb; + //(D.f[DIR_PM0])[ks] = mfacb; + //(D.f[DIR_MP0])[kw] = mfcab; + //(D.f[DIR_P0P])[k] = mfaba; + //(D.f[DIR_M0M])[kbw] = mfcbc; + //(D.f[DIR_P0M])[kb] = mfabc; + //(D.f[DIR_M0P])[kw] = mfcba; + //(D.f[DIR_0PP])[k] = mfbaa; + //(D.f[DIR_0MM])[kbs] = mfbcc; + //(D.f[DIR_0PM])[kb] = mfbac; + //(D.f[DIR_0MP])[ks] = mfbca; + //(D.f[DIR_000])[k] = mfbbb; + //(D.f[DIR_PPP])[k] = mfaaa; + //(D.f[DIR_PMP])[ks] = mfaca; + //(D.f[DIR_PPM])[kb] = mfaac; + //(D.f[DIR_PMM])[kbs] = mfacc; + //(D.f[DIR_MPP])[kw] = mfcaa; + //(D.f[DIR_MMP])[ksw] = mfcca; + //(D.f[DIR_MPM])[kbw] = mfcac; + //(D.f[DIR_MMM])[kbsw] = mfccc; ////////////////////////////////////////////////////////////////////////////////////// - //(G.g[dirE])[k] = mgabb; - //(G.g[dirW])[kw] = mgcbb; - //(G.g[dirN])[k] = mgbab; - //(G.g[dirS])[ks] = mgbcb; - //(G.g[dirT])[k] = mgbba; - //(G.g[dirB])[kb] = mgbbc; + //(G.g[DIR_P00])[k] = mgabb; + //(G.g[DIR_M00])[kw] = mgcbb; + //(G.g[DIR_0P0])[k] = mgbab; + //(G.g[DIR_0M0])[ks] = mgbcb; + //(G.g[DIR_00P])[k] = mgbba; + //(G.g[DIR_00M])[kb] = mgbbc; } } } @@ -990,7 +992,7 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, /////////////////////////////////////////////////////////////////////////////////// -//extern "C" __global__ void LB_Kernel_Cumulant_D3Q27F3_2018( real omega, +//__global__ void LB_Kernel_Cumulant_D3Q27F3_2018( real omega, // unsigned int* bcMatD, // unsigned int* neighborX, // unsigned int* neighborY, @@ -1024,83 +1026,83 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, // Distributions27 D; // if (EvenOrOdd == true) // { -// D.f[dirE] = &DDStart[dirE *size_Mat]; -// D.f[dirW] = &DDStart[dirW *size_Mat]; -// D.f[dirN] = &DDStart[dirN *size_Mat]; -// D.f[dirS] = &DDStart[dirS *size_Mat]; -// D.f[dirT] = &DDStart[dirT *size_Mat]; -// D.f[dirB] = &DDStart[dirB *size_Mat]; -// D.f[dirNE] = &DDStart[dirNE *size_Mat]; -// D.f[dirSW] = &DDStart[dirSW *size_Mat]; -// D.f[dirSE] = &DDStart[dirSE *size_Mat]; -// D.f[dirNW] = &DDStart[dirNW *size_Mat]; -// D.f[dirTE] = &DDStart[dirTE *size_Mat]; -// D.f[dirBW] = &DDStart[dirBW *size_Mat]; -// D.f[dirBE] = &DDStart[dirBE *size_Mat]; -// D.f[dirTW] = &DDStart[dirTW *size_Mat]; -// D.f[dirTN] = &DDStart[dirTN *size_Mat]; -// D.f[dirBS] = &DDStart[dirBS *size_Mat]; -// D.f[dirBN] = &DDStart[dirBN *size_Mat]; -// D.f[dirTS] = &DDStart[dirTS *size_Mat]; -// D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; -// D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; -// D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; -// D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; -// D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; -// D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; -// D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; -// D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; -// D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; +// D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; +// D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; +// D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; +// D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; +// D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; +// D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; +// D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; +// D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; +// D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; +// D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; +// D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; +// D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; +// D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; +// D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; +// D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; +// D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; +// D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; +// D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; +// D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; +// D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; +// D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; +// D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; +// D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; +// D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; +// D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; +// D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; +// D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; // } // else // { -// D.f[dirW] = &DDStart[dirE *size_Mat]; -// D.f[dirE] = &DDStart[dirW *size_Mat]; -// D.f[dirS] = &DDStart[dirN *size_Mat]; -// D.f[dirN] = &DDStart[dirS *size_Mat]; -// D.f[dirB] = &DDStart[dirT *size_Mat]; -// D.f[dirT] = &DDStart[dirB *size_Mat]; -// D.f[dirSW] = &DDStart[dirNE *size_Mat]; -// D.f[dirNE] = &DDStart[dirSW *size_Mat]; -// D.f[dirNW] = &DDStart[dirSE *size_Mat]; -// D.f[dirSE] = &DDStart[dirNW *size_Mat]; -// D.f[dirBW] = &DDStart[dirTE *size_Mat]; -// D.f[dirTE] = &DDStart[dirBW *size_Mat]; -// D.f[dirTW] = &DDStart[dirBE *size_Mat]; -// D.f[dirBE] = &DDStart[dirTW *size_Mat]; -// D.f[dirBS] = &DDStart[dirTN *size_Mat]; -// D.f[dirTN] = &DDStart[dirBS *size_Mat]; -// D.f[dirTS] = &DDStart[dirBN *size_Mat]; -// D.f[dirBN] = &DDStart[dirTS *size_Mat]; -// D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; -// D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; -// D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; -// D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; -// D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; -// D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; -// D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; -// D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; -// D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; +// D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; +// D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; +// D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; +// D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; +// D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; +// D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; +// D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; +// D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; +// D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; +// D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; +// D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; +// D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; +// D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; +// D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; +// D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; +// D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; +// D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; +// D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; +// D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; +// D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; +// D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; +// D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; +// D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; +// D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; +// D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; +// D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; +// D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; // } // // Distributions6 G; // if (EvenOrOdd == true) // { -// G.g[dirE] = &G6[dirE *size_Mat]; -// G.g[dirW] = &G6[dirW *size_Mat]; -// G.g[dirN] = &G6[dirN *size_Mat]; -// G.g[dirS] = &G6[dirS *size_Mat]; -// G.g[dirT] = &G6[dirT *size_Mat]; -// G.g[dirB] = &G6[dirB *size_Mat]; +// G.g[DIR_P00] = &G6[DIR_P00 *size_Mat]; +// G.g[DIR_M00] = &G6[DIR_M00 *size_Mat]; +// G.g[DIR_0P0] = &G6[DIR_0P0 *size_Mat]; +// G.g[DIR_0M0] = &G6[DIR_0M0 *size_Mat]; +// G.g[DIR_00P] = &G6[DIR_00P *size_Mat]; +// G.g[DIR_00M] = &G6[DIR_00M *size_Mat]; // } // else // { -// G.g[dirW] = &G6[dirE *size_Mat]; -// G.g[dirE] = &G6[dirW *size_Mat]; -// G.g[dirS] = &G6[dirN *size_Mat]; -// G.g[dirN] = &G6[dirS *size_Mat]; -// G.g[dirB] = &G6[dirT *size_Mat]; -// G.g[dirT] = &G6[dirB *size_Mat]; +// G.g[DIR_M00] = &G6[DIR_P00 *size_Mat]; +// G.g[DIR_P00] = &G6[DIR_M00 *size_Mat]; +// G.g[DIR_0M0] = &G6[DIR_0P0 *size_Mat]; +// G.g[DIR_0P0] = &G6[DIR_0M0 *size_Mat]; +// G.g[DIR_00M] = &G6[DIR_00P *size_Mat]; +// G.g[DIR_00P] = &G6[DIR_00M *size_Mat]; // } // // //////////////////////////////////////////////////////////////////////////////// @@ -1133,43 +1135,43 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, // //unsigned int ktne = k; // unsigned int kbsw = neighborZ[ksw]; // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// real mgcbb = (G.g[dirE])[k]; -// real mgabb = (G.g[dirW])[kw]; -// real mgbcb = (G.g[dirN])[k]; -// real mgbab = (G.g[dirS])[ks]; -// real mgbbc = (G.g[dirT])[k]; -// real mgbba = (G.g[dirB])[kb]; +// real mgcbb = (G.g[DIR_P00])[k]; +// real mgabb = (G.g[DIR_M00])[kw]; +// real mgbcb = (G.g[DIR_0P0])[k]; +// real mgbab = (G.g[DIR_0M0])[ks]; +// real mgbbc = (G.g[DIR_00P])[k]; +// real mgbba = (G.g[DIR_00M])[kb]; // real dxuxdxux = c1o2 * (-mgcbb + mgabb); // real dyuydyuy = c1o2 * (-mgbcb + mgbab); // real dzuzdzuz = c1o2 * (-mgbbc + mgbba); // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// real mfcbb = (D.f[dirE])[k]; -// real mfabb = (D.f[dirW])[kw]; -// real mfbcb = (D.f[dirN])[k]; -// real mfbab = (D.f[dirS])[ks]; -// real mfbbc = (D.f[dirT])[k]; -// real mfbba = (D.f[dirB])[kb]; -// real mfccb = (D.f[dirNE])[k]; -// real mfaab = (D.f[dirSW])[ksw]; -// real mfcab = (D.f[dirSE])[ks]; -// real mfacb = (D.f[dirNW])[kw]; -// real mfcbc = (D.f[dirTE])[k]; -// real mfaba = (D.f[dirBW])[kbw]; -// real mfcba = (D.f[dirBE])[kb]; -// real mfabc = (D.f[dirTW])[kw]; -// real mfbcc = (D.f[dirTN])[k]; -// real mfbaa = (D.f[dirBS])[kbs]; -// real mfbca = (D.f[dirBN])[kb]; -// real mfbac = (D.f[dirTS])[ks]; -// real mfbbb = (D.f[dirZERO])[k]; -// real mfccc = (D.f[dirTNE])[k]; -// real mfaac = (D.f[dirTSW])[ksw]; -// real mfcac = (D.f[dirTSE])[ks]; -// real mfacc = (D.f[dirTNW])[kw]; -// real mfcca = (D.f[dirBNE])[kb]; -// real mfaaa = (D.f[dirBSW])[kbsw]; -// real mfcaa = (D.f[dirBSE])[kbs]; -// real mfaca = (D.f[dirBNW])[kbw]; +// real mfcbb = (D.f[DIR_P00])[k]; +// real mfabb = (D.f[DIR_M00])[kw]; +// real mfbcb = (D.f[DIR_0P0])[k]; +// real mfbab = (D.f[DIR_0M0])[ks]; +// real mfbbc = (D.f[DIR_00P])[k]; +// real mfbba = (D.f[DIR_00M])[kb]; +// real mfccb = (D.f[DIR_PP0])[k]; +// real mfaab = (D.f[DIR_MM0])[ksw]; +// real mfcab = (D.f[DIR_PM0])[ks]; +// real mfacb = (D.f[DIR_MP0])[kw]; +// real mfcbc = (D.f[DIR_P0P])[k]; +// real mfaba = (D.f[DIR_M0M])[kbw]; +// real mfcba = (D.f[DIR_P0M])[kb]; +// real mfabc = (D.f[DIR_M0P])[kw]; +// real mfbcc = (D.f[DIR_0PP])[k]; +// real mfbaa = (D.f[DIR_0MM])[kbs]; +// real mfbca = (D.f[DIR_0PM])[kb]; +// real mfbac = (D.f[DIR_0MP])[ks]; +// real mfbbb = (D.f[DIR_000])[k]; +// real mfccc = (D.f[DIR_PPP])[k]; +// real mfaac = (D.f[DIR_MMP])[ksw]; +// real mfcac = (D.f[DIR_PMP])[ks]; +// real mfacc = (D.f[DIR_MPP])[kw]; +// real mfcca = (D.f[DIR_PPM])[kb]; +// real mfaaa = (D.f[DIR_MMM])[kbsw]; +// real mfcaa = (D.f[DIR_PMM])[kbs]; +// real mfaca = (D.f[DIR_MPM])[kbw]; // //////////////////////////////////////////////////////////////////////////////////// // real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + // (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -1891,41 +1893,41 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, // //////////////////////////////////////////////////////////////////////////////////// // // //////////////////////////////////////////////////////////////////////////////////// -// (D.f[dirE])[k] = mfabb; -// (D.f[dirW])[kw] = mfcbb; -// (D.f[dirN])[k] = mfbab; -// (D.f[dirS])[ks] = mfbcb; -// (D.f[dirT])[k] = mfbba; -// (D.f[dirB])[kb] = mfbbc; -// (D.f[dirNE])[k] = mfaab; -// (D.f[dirSW])[ksw] = mfccb; -// (D.f[dirSE])[ks] = mfacb; -// (D.f[dirNW])[kw] = mfcab; -// (D.f[dirTE])[k] = mfaba; -// (D.f[dirBW])[kbw] = mfcbc; -// (D.f[dirBE])[kb] = mfabc; -// (D.f[dirTW])[kw] = mfcba; -// (D.f[dirTN])[k] = mfbaa; -// (D.f[dirBS])[kbs] = mfbcc; -// (D.f[dirBN])[kb] = mfbac; -// (D.f[dirTS])[ks] = mfbca; -// (D.f[dirZERO])[k] = mfbbb; -// (D.f[dirTNE])[k] = mfaaa; -// (D.f[dirTSE])[ks] = mfaca; -// (D.f[dirBNE])[kb] = mfaac; -// (D.f[dirBSE])[kbs] = mfacc; -// (D.f[dirTNW])[kw] = mfcaa; -// (D.f[dirTSW])[ksw] = mfcca; -// (D.f[dirBNW])[kbw] = mfcac; -// (D.f[dirBSW])[kbsw] = mfccc; -// //////////////////////////////////////////////////////////////////////////////////// -// -// (G.g[dirE])[k] = mgabb; -// (G.g[dirW])[kw] = mgcbb; -// (G.g[dirN])[k] = mgbab; -// (G.g[dirS])[ks] = mgbcb; -// (G.g[dirT])[k] = mgbba; -// (G.g[dirB])[kb] = mgbbc; +// (D.f[DIR_P00])[k] = mfabb; +// (D.f[DIR_M00])[kw] = mfcbb; +// (D.f[DIR_0P0])[k] = mfbab; +// (D.f[DIR_0M0])[ks] = mfbcb; +// (D.f[DIR_00P])[k] = mfbba; +// (D.f[DIR_00M])[kb] = mfbbc; +// (D.f[DIR_PP0])[k] = mfaab; +// (D.f[DIR_MM0])[ksw] = mfccb; +// (D.f[DIR_PM0])[ks] = mfacb; +// (D.f[DIR_MP0])[kw] = mfcab; +// (D.f[DIR_P0P])[k] = mfaba; +// (D.f[DIR_M0M])[kbw] = mfcbc; +// (D.f[DIR_P0M])[kb] = mfabc; +// (D.f[DIR_M0P])[kw] = mfcba; +// (D.f[DIR_0PP])[k] = mfbaa; +// (D.f[DIR_0MM])[kbs] = mfbcc; +// (D.f[DIR_0PM])[kb] = mfbac; +// (D.f[DIR_0MP])[ks] = mfbca; +// (D.f[DIR_000])[k] = mfbbb; +// (D.f[DIR_PPP])[k] = mfaaa; +// (D.f[DIR_PMP])[ks] = mfaca; +// (D.f[DIR_PPM])[kb] = mfaac; +// (D.f[DIR_PMM])[kbs] = mfacc; +// (D.f[DIR_MPP])[kw] = mfcaa; +// (D.f[DIR_MMP])[ksw] = mfcca; +// (D.f[DIR_MPM])[kbw] = mfcac; +// (D.f[DIR_MMM])[kbsw] = mfccc; +// //////////////////////////////////////////////////////////////////////////////////// +// +// (G.g[DIR_P00])[k] = mgabb; +// (G.g[DIR_M00])[kw] = mgcbb; +// (G.g[DIR_0P0])[k] = mgbab; +// (G.g[DIR_0M0])[ks] = mgbcb; +// (G.g[DIR_00P])[k] = mgbba; +// (G.g[DIR_00M])[kb] = mgbbc; // } // } //} @@ -1970,7 +1972,7 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, ///////////////////////////////////////////////////////////////////////////////// -//extern "C" __global__ void LB_Kernel_Cumulant_D3Q27F3( real omega, +//__global__ void LB_Kernel_Cumulant_D3Q27F3( real omega, // unsigned int* bcMatD, // unsigned int* neighborX, // unsigned int* neighborY, @@ -2004,83 +2006,83 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, // Distributions27 D; // if (EvenOrOdd == true) // { -// D.f[dirE] = &DDStart[dirE *size_Mat]; -// D.f[dirW] = &DDStart[dirW *size_Mat]; -// D.f[dirN] = &DDStart[dirN *size_Mat]; -// D.f[dirS] = &DDStart[dirS *size_Mat]; -// D.f[dirT] = &DDStart[dirT *size_Mat]; -// D.f[dirB] = &DDStart[dirB *size_Mat]; -// D.f[dirNE] = &DDStart[dirNE *size_Mat]; -// D.f[dirSW] = &DDStart[dirSW *size_Mat]; -// D.f[dirSE] = &DDStart[dirSE *size_Mat]; -// D.f[dirNW] = &DDStart[dirNW *size_Mat]; -// D.f[dirTE] = &DDStart[dirTE *size_Mat]; -// D.f[dirBW] = &DDStart[dirBW *size_Mat]; -// D.f[dirBE] = &DDStart[dirBE *size_Mat]; -// D.f[dirTW] = &DDStart[dirTW *size_Mat]; -// D.f[dirTN] = &DDStart[dirTN *size_Mat]; -// D.f[dirBS] = &DDStart[dirBS *size_Mat]; -// D.f[dirBN] = &DDStart[dirBN *size_Mat]; -// D.f[dirTS] = &DDStart[dirTS *size_Mat]; -// D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; -// D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; -// D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; -// D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; -// D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; -// D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; -// D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; -// D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; -// D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; +// D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; +// D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; +// D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; +// D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; +// D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; +// D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; +// D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; +// D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; +// D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; +// D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; +// D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; +// D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; +// D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; +// D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; +// D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; +// D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; +// D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; +// D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; +// D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; +// D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; +// D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; +// D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; +// D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; +// D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; +// D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; +// D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; +// D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; // } // else // { -// D.f[dirW] = &DDStart[dirE *size_Mat]; -// D.f[dirE] = &DDStart[dirW *size_Mat]; -// D.f[dirS] = &DDStart[dirN *size_Mat]; -// D.f[dirN] = &DDStart[dirS *size_Mat]; -// D.f[dirB] = &DDStart[dirT *size_Mat]; -// D.f[dirT] = &DDStart[dirB *size_Mat]; -// D.f[dirSW] = &DDStart[dirNE *size_Mat]; -// D.f[dirNE] = &DDStart[dirSW *size_Mat]; -// D.f[dirNW] = &DDStart[dirSE *size_Mat]; -// D.f[dirSE] = &DDStart[dirNW *size_Mat]; -// D.f[dirBW] = &DDStart[dirTE *size_Mat]; -// D.f[dirTE] = &DDStart[dirBW *size_Mat]; -// D.f[dirTW] = &DDStart[dirBE *size_Mat]; -// D.f[dirBE] = &DDStart[dirTW *size_Mat]; -// D.f[dirBS] = &DDStart[dirTN *size_Mat]; -// D.f[dirTN] = &DDStart[dirBS *size_Mat]; -// D.f[dirTS] = &DDStart[dirBN *size_Mat]; -// D.f[dirBN] = &DDStart[dirTS *size_Mat]; -// D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; -// D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; -// D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; -// D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; -// D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; -// D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; -// D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; -// D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; -// D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; +// D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; +// D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; +// D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; +// D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; +// D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; +// D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; +// D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; +// D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; +// D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; +// D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; +// D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; +// D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; +// D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; +// D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; +// D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; +// D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; +// D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; +// D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; +// D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; +// D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; +// D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; +// D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; +// D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; +// D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; +// D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; +// D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; +// D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; // } // // Distributions6 G; // if (EvenOrOdd == true) // { -// G.g[dirE] = &G6[dirE *size_Mat]; -// G.g[dirW] = &G6[dirW *size_Mat]; -// G.g[dirN] = &G6[dirN *size_Mat]; -// G.g[dirS] = &G6[dirS *size_Mat]; -// G.g[dirT] = &G6[dirT *size_Mat]; -// G.g[dirB] = &G6[dirB *size_Mat]; +// G.g[DIR_P00] = &G6[DIR_P00 *size_Mat]; +// G.g[DIR_M00] = &G6[DIR_M00 *size_Mat]; +// G.g[DIR_0P0] = &G6[DIR_0P0 *size_Mat]; +// G.g[DIR_0M0] = &G6[DIR_0M0 *size_Mat]; +// G.g[DIR_00P] = &G6[DIR_00P *size_Mat]; +// G.g[DIR_00M] = &G6[DIR_00M *size_Mat]; // } // else // { -// G.g[dirW] = &G6[dirE *size_Mat]; -// G.g[dirE] = &G6[dirW *size_Mat]; -// G.g[dirS] = &G6[dirN *size_Mat]; -// G.g[dirN] = &G6[dirS *size_Mat]; -// G.g[dirB] = &G6[dirT *size_Mat]; -// G.g[dirT] = &G6[dirB *size_Mat]; +// G.g[DIR_M00] = &G6[DIR_P00 *size_Mat]; +// G.g[DIR_P00] = &G6[DIR_M00 *size_Mat]; +// G.g[DIR_0M0] = &G6[DIR_0P0 *size_Mat]; +// G.g[DIR_0P0] = &G6[DIR_0M0 *size_Mat]; +// G.g[DIR_00M] = &G6[DIR_00P *size_Mat]; +// G.g[DIR_00P] = &G6[DIR_00M *size_Mat]; // } // // //////////////////////////////////////////////////////////////////////////////// @@ -2141,43 +2143,43 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, // //unsigned int ktne = k; // //unsigned int kbsw = neighborZ[ksw]; // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// real mgcbb = (G.g[dirE])[k]; -// real mgabb = (G.g[dirW])[kw]; -// real mgbcb = (G.g[dirN])[k]; -// real mgbab = (G.g[dirS])[ks]; -// real mgbbc = (G.g[dirT])[k]; -// real mgbba = (G.g[dirB])[kb]; +// real mgcbb = (G.g[DIR_P00])[k]; +// real mgabb = (G.g[DIR_M00])[kw]; +// real mgbcb = (G.g[DIR_0P0])[k]; +// real mgbab = (G.g[DIR_0M0])[ks]; +// real mgbbc = (G.g[DIR_00P])[k]; +// real mgbba = (G.g[DIR_00M])[kb]; // real dxxux = c1o2 * (-mgcbb + mgabb); // real dyyuy = c1o2 * (-mgbcb + mgbab); // real dzzuz = c1o2 * (-mgbbc + mgbba); // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke -// real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; -// real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn -// real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; -// real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt -// real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; -// real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne -// real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; -// real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse -// real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw -// real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte -// real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; -// real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe -// real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw -// real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn -// real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; -// real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn -// real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts -// real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero -// real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne -// real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw -// real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse -// real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw -// real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne -// real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; -// real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse -// real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw +// real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke +// real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; +// real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn +// real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; +// real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt +// real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; +// real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne +// real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; +// real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse +// real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw +// real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte +// real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; +// real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe +// real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw +// real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn +// real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; +// real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn +// real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts +// real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero +// real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne +// real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw +// real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse +// real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw +// real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne +// real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; +// real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse +// real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw // //////////////////////////////////////////////////////////////////////////////////// // real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + // (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -3011,41 +3013,41 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg(real omega, // //////////////////////////////////////////////////////////////////////////////////// // // //////////////////////////////////////////////////////////////////////////////////// -// (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] -// (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] -// (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] -// (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] -// (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] -// (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] -// (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] -// (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] -// (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] -// (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] -// (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] -// (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] -// (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] -// (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] -// (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] -// (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] -// (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] -// (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] -// (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] -// (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] -// (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] -// (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] -// (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] -// (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] -// (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] -// (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] -// (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] -// //////////////////////////////////////////////////////////////////////////////////// -// -// (G.g[dirE])[k] = mgabb; -// (G.g[dirW])[kw] = mgcbb; -// (G.g[dirN])[k] = mgbab; -// (G.g[dirS])[ks] = mgbcb; -// (G.g[dirT])[k] = mgbba; -// (G.g[dirB])[kb] = mgbbc; +// (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] +// (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] +// (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] +// (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] +// (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] +// (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] +// (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] +// (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] +// (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] +// (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] +// (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] +// (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] +// (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] +// (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] +// (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] +// (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] +// (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] +// (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] +// (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] +// (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] +// (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] +// (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] +// (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] +// (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] +// (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] +// (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] +// (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] +// //////////////////////////////////////////////////////////////////////////////////// +// +// (G.g[DIR_P00])[k] = mgabb; +// (G.g[DIR_M00])[kw] = mgcbb; +// (G.g[DIR_0P0])[k] = mgbab; +// (G.g[DIR_0M0])[ks] = mgbcb; +// (G.g[DIR_00P])[k] = mgbba; +// (G.g[DIR_00M])[kb] = mgbbc; // } // } //} diff --git a/src/gpu/VirtualFluids_GPU/GPU/DragLift27.cu b/src/gpu/VirtualFluids_GPU/GPU/DragLift27.cu index 7fb12d17784fb13c2e11dd7dedb7521444be11c2..5146242fed374a919b6dcc02774db1d8ce4f864a 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/DragLift27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/DragLift27.cu @@ -1,15 +1,16 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void DragLiftPost27( real* DD, +__global__ void DragLiftPost27( real* DD, int* k_Q, real* QQ, - int kQ, + int numberOfBCnodes, double *DragX, double *DragY, double *DragZ, @@ -17,68 +18,68 @@ extern "C" __global__ void DragLiftPost27( real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -91,41 +92,40 @@ extern "C" __global__ void DragLiftPost27( real* DD, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { - unsigned int sizeQ = kQ; //////////////////////////////////////////////////////////////////////////////// real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -160,32 +160,32 @@ extern "C" __global__ void DragLiftPost27( real* DD, real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// double OnE = c0o1, OnW = c0o1, OnN = c0o1, OnS = c0o1, OnT = c0o1, OnB = c0o1, OnNE = c0o1, OnSW = c0o1, OnSE = c0o1, OnNW = c0o1, @@ -272,10 +272,10 @@ extern "C" __global__ void DragLiftPost27( real* DD, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void DragLiftPre27( real* DD, +__global__ void DragLiftPre27( real* DD, int* k_Q, real* QQ, - int kQ, + int numberOfBCnodes, double *DragX, double *DragY, double *DragZ, @@ -283,68 +283,68 @@ extern "C" __global__ void DragLiftPre27( real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -357,41 +357,40 @@ extern "C" __global__ void DragLiftPre27( real* DD, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { - unsigned int sizeQ = kQ; //////////////////////////////////////////////////////////////////////////////// real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -426,32 +425,32 @@ extern "C" __global__ void DragLiftPre27( real* DD, real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_E = (D.f[dirE ])[ke ]; - f_W = (D.f[dirW ])[kw ]; - f_N = (D.f[dirN ])[kn ]; - f_S = (D.f[dirS ])[ks ]; - f_T = (D.f[dirT ])[kt ]; - f_B = (D.f[dirB ])[kb ]; - f_NE = (D.f[dirNE ])[kne ]; - f_SW = (D.f[dirSW ])[ksw ]; - f_SE = (D.f[dirSE ])[kse ]; - f_NW = (D.f[dirNW ])[knw ]; - f_TE = (D.f[dirTE ])[kte ]; - f_BW = (D.f[dirBW ])[kbw ]; - f_BE = (D.f[dirBE ])[kbe ]; - f_TW = (D.f[dirTW ])[ktw ]; - f_TN = (D.f[dirTN ])[ktn ]; - f_BS = (D.f[dirBS ])[kbs ]; - f_BN = (D.f[dirBN ])[kbn ]; - f_TS = (D.f[dirTS ])[kts ]; - f_TNE = (D.f[dirTNE ])[ktne ]; - f_TSW = (D.f[dirTSW ])[ktsw ]; - f_TSE = (D.f[dirTSE ])[ktse ]; - f_TNW = (D.f[dirTNW ])[ktnw ]; - f_BNE = (D.f[dirBNE ])[kbne ]; - f_BSW = (D.f[dirBSW ])[kbsw ]; - f_BSE = (D.f[dirBSE ])[kbse ]; - f_BNW = (D.f[dirBNW ])[kbnw ]; + f_E = (D.f[DIR_P00 ])[ke ]; + f_W = (D.f[DIR_M00 ])[kw ]; + f_N = (D.f[DIR_0P0 ])[kn ]; + f_S = (D.f[DIR_0M0 ])[ks ]; + f_T = (D.f[DIR_00P ])[kt ]; + f_B = (D.f[DIR_00M ])[kb ]; + f_NE = (D.f[DIR_PP0 ])[kne ]; + f_SW = (D.f[DIR_MM0 ])[ksw ]; + f_SE = (D.f[DIR_PM0 ])[kse ]; + f_NW = (D.f[DIR_MP0 ])[knw ]; + f_TE = (D.f[DIR_P0P ])[kte ]; + f_BW = (D.f[DIR_M0M ])[kbw ]; + f_BE = (D.f[DIR_P0M ])[kbe ]; + f_TW = (D.f[DIR_M0P ])[ktw ]; + f_TN = (D.f[DIR_0PP ])[ktn ]; + f_BS = (D.f[DIR_0MM ])[kbs ]; + f_BN = (D.f[DIR_0PM ])[kbn ]; + f_TS = (D.f[DIR_0MP ])[kts ]; + f_TNE = (D.f[DIR_PPP ])[ktne ]; + f_TSW = (D.f[DIR_MMP ])[ktsw ]; + f_TSE = (D.f[DIR_PMP ])[ktse ]; + f_TNW = (D.f[DIR_MPP ])[ktnw ]; + f_BNE = (D.f[DIR_PPM ])[kbne ]; + f_BSW = (D.f[DIR_MMM ])[kbsw ]; + f_BSE = (D.f[DIR_PMM ])[kbse ]; + f_BNW = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// double OnE = c0o1, OnW = c0o1, OnN = c0o1, OnS = c0o1, OnT = c0o1, OnB = c0o1, OnNE = c0o1, OnSW = c0o1, OnSE = c0o1, OnNW = c0o1, diff --git a/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu b/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu index a020d3dfd904b0425296b48e867c07e7bad4dd58..acd62b46c5666fc5f621c3772438e42b7ebef5c6 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu @@ -33,7 +33,7 @@ bool EnstrophyAnalyzer::run(uint iter) if( iter % this->analyzeIter != 0 ) return false; int lev = 0; - int size_Mat = this->para->getParD(lev)->size_Mat_SP; + int size_Mat = this->para->getParD(lev)->numberOfNodes; thrust::device_vector<real> enstrophy( size_Mat, c0o1 ); thrust::device_vector<uint> isFluid ( size_Mat, 0); @@ -54,30 +54,30 @@ bool EnstrophyAnalyzer::run(uint iter) dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - LBCalcMacCompSP27<<< grid, threads >>> (para->getParD(lev)->vx_SP, - para->getParD(lev)->vy_SP, - para->getParD(lev)->vz_SP, - para->getParD(lev)->rho_SP, - para->getParD(lev)->press_SP, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->d0SP.f[0], - para->getParD(lev)->evenOrOdd); + LBCalcMacCompSP27<<< grid, threads >>> (para->getParD(lev)->velocityX, + para->getParD(lev)->velocityY, + para->getParD(lev)->velocityZ, + para->getParD(lev)->rho, + para->getParD(lev)->pressure, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, + para->getParD(lev)->distributions.f[0], + para->getParD(lev)->isEvenTimestep); //cudaDeviceSynchronize(); getLastCudaError("LBCalcMacSP27 execution failed"); - enstrophyKernel <<< grid, threads >>> ( para->getParD(lev)->vx_SP, - para->getParD(lev)->vy_SP, - para->getParD(lev)->vz_SP, - para->getParD(lev)->rho_SP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->neighborWSB_SP, - para->getParD(lev)->geoSP, + enstrophyKernel <<< grid, threads >>> ( para->getParD(lev)->velocityX, + para->getParD(lev)->velocityY, + para->getParD(lev)->velocityZ, + para->getParD(lev)->rho, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->neighborInverse, + para->getParD(lev)->typeOfGridNode, enstrophy.data().get(), isFluid.data().get(), size_Mat); diff --git a/src/gpu/VirtualFluids_GPU/GPU/ExchangeData27.cu b/src/gpu/VirtualFluids_GPU/GPU/ExchangeData27.cu index 980b39042c8d1bf4d47e22af94494480d32db60c..5470da46342c85e57370227313c8c82674a17e6e 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/ExchangeData27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/ExchangeData27.cu @@ -1,12 +1,13 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void getSendFsPost27(real* DD, +__global__ void getSendFsPost27(real* DD, real* bufferFs, int* sendIndex, int buffmax, @@ -14,7 +15,7 @@ extern "C" __global__ void getSendFsPost27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -62,152 +63,152 @@ extern "C" __global__ void getSendFsPost27(real* DD, //////////////////////////////////////////////////////////////////////////////// //set Pointer for Fs Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //set Pointer for Buffer Fs Distributions27 Dbuff; - Dbuff.f[dirE ] = &bufferFs[dirE *buffmax]; - Dbuff.f[dirW ] = &bufferFs[dirW *buffmax]; - Dbuff.f[dirN ] = &bufferFs[dirN *buffmax]; - Dbuff.f[dirS ] = &bufferFs[dirS *buffmax]; - Dbuff.f[dirT ] = &bufferFs[dirT *buffmax]; - Dbuff.f[dirB ] = &bufferFs[dirB *buffmax]; - Dbuff.f[dirNE ] = &bufferFs[dirNE *buffmax]; - Dbuff.f[dirSW ] = &bufferFs[dirSW *buffmax]; - Dbuff.f[dirSE ] = &bufferFs[dirSE *buffmax]; - Dbuff.f[dirNW ] = &bufferFs[dirNW *buffmax]; - Dbuff.f[dirTE ] = &bufferFs[dirTE *buffmax]; - Dbuff.f[dirBW ] = &bufferFs[dirBW *buffmax]; - Dbuff.f[dirBE ] = &bufferFs[dirBE *buffmax]; - Dbuff.f[dirTW ] = &bufferFs[dirTW *buffmax]; - Dbuff.f[dirTN ] = &bufferFs[dirTN *buffmax]; - Dbuff.f[dirBS ] = &bufferFs[dirBS *buffmax]; - Dbuff.f[dirBN ] = &bufferFs[dirBN *buffmax]; - Dbuff.f[dirTS ] = &bufferFs[dirTS *buffmax]; - Dbuff.f[dirZERO] = &bufferFs[dirZERO*buffmax]; - Dbuff.f[dirTNE ] = &bufferFs[dirTNE *buffmax]; - Dbuff.f[dirTSW ] = &bufferFs[dirTSW *buffmax]; - Dbuff.f[dirTSE ] = &bufferFs[dirTSE *buffmax]; - Dbuff.f[dirTNW ] = &bufferFs[dirTNW *buffmax]; - Dbuff.f[dirBNE ] = &bufferFs[dirBNE *buffmax]; - Dbuff.f[dirBSW ] = &bufferFs[dirBSW *buffmax]; - Dbuff.f[dirBSE ] = &bufferFs[dirBSE *buffmax]; - Dbuff.f[dirBNW ] = &bufferFs[dirBNW *buffmax]; + Dbuff.f[DIR_P00 ] = &bufferFs[DIR_P00 *buffmax]; + Dbuff.f[DIR_M00 ] = &bufferFs[DIR_M00 *buffmax]; + Dbuff.f[DIR_0P0 ] = &bufferFs[DIR_0P0 *buffmax]; + Dbuff.f[DIR_0M0 ] = &bufferFs[DIR_0M0 *buffmax]; + Dbuff.f[DIR_00P ] = &bufferFs[DIR_00P *buffmax]; + Dbuff.f[DIR_00M ] = &bufferFs[DIR_00M *buffmax]; + Dbuff.f[DIR_PP0 ] = &bufferFs[DIR_PP0 *buffmax]; + Dbuff.f[DIR_MM0 ] = &bufferFs[DIR_MM0 *buffmax]; + Dbuff.f[DIR_PM0 ] = &bufferFs[DIR_PM0 *buffmax]; + Dbuff.f[DIR_MP0 ] = &bufferFs[DIR_MP0 *buffmax]; + Dbuff.f[DIR_P0P ] = &bufferFs[DIR_P0P *buffmax]; + Dbuff.f[DIR_M0M ] = &bufferFs[DIR_M0M *buffmax]; + Dbuff.f[DIR_P0M ] = &bufferFs[DIR_P0M *buffmax]; + Dbuff.f[DIR_M0P ] = &bufferFs[DIR_M0P *buffmax]; + Dbuff.f[DIR_0PP ] = &bufferFs[DIR_0PP *buffmax]; + Dbuff.f[DIR_0MM ] = &bufferFs[DIR_0MM *buffmax]; + Dbuff.f[DIR_0PM ] = &bufferFs[DIR_0PM *buffmax]; + Dbuff.f[DIR_0MP ] = &bufferFs[DIR_0MP *buffmax]; + Dbuff.f[DIR_000] = &bufferFs[DIR_000*buffmax]; + Dbuff.f[DIR_PPP ] = &bufferFs[DIR_PPP *buffmax]; + Dbuff.f[DIR_MMP ] = &bufferFs[DIR_MMP *buffmax]; + Dbuff.f[DIR_PMP ] = &bufferFs[DIR_PMP *buffmax]; + Dbuff.f[DIR_MPP ] = &bufferFs[DIR_MPP *buffmax]; + Dbuff.f[DIR_PPM ] = &bufferFs[DIR_PPM *buffmax]; + Dbuff.f[DIR_MMM ] = &bufferFs[DIR_MMM *buffmax]; + Dbuff.f[DIR_PMM ] = &bufferFs[DIR_PMM *buffmax]; + Dbuff.f[DIR_MPM ] = &bufferFs[DIR_MPM *buffmax]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy to buffer - //(Dbuff.f[dirE ])[k] = (D.f[dirE ])[ke ]; - //(Dbuff.f[dirW ])[k] = (D.f[dirW ])[kw ]; - //(Dbuff.f[dirN ])[k] = (D.f[dirN ])[kn ]; - //(Dbuff.f[dirS ])[k] = (D.f[dirS ])[ks ]; - //(Dbuff.f[dirT ])[k] = (D.f[dirT ])[kt ]; - //(Dbuff.f[dirB ])[k] = (D.f[dirB ])[kb ]; - //(Dbuff.f[dirNE ])[k] = (D.f[dirNE ])[kne ]; - //(Dbuff.f[dirSW ])[k] = (D.f[dirSW ])[ksw ]; - //(Dbuff.f[dirSE ])[k] = (D.f[dirSE ])[kse ]; - //(Dbuff.f[dirNW ])[k] = (D.f[dirNW ])[knw ]; - //(Dbuff.f[dirTE ])[k] = (D.f[dirTE ])[kte ]; - //(Dbuff.f[dirBW ])[k] = (D.f[dirBW ])[kbw ]; - //(Dbuff.f[dirBE ])[k] = (D.f[dirBE ])[kbe ]; - //(Dbuff.f[dirTW ])[k] = (D.f[dirTW ])[ktw ]; - //(Dbuff.f[dirTN ])[k] = (D.f[dirTN ])[ktn ]; - //(Dbuff.f[dirBS ])[k] = (D.f[dirBS ])[kbs ]; - //(Dbuff.f[dirBN ])[k] = (D.f[dirBN ])[kbn ]; - //(Dbuff.f[dirTS ])[k] = (D.f[dirTS ])[kts ]; - //(Dbuff.f[dirZERO])[k] = (D.f[dirZERO])[kzero]; - //(Dbuff.f[dirTNE ])[k] = (D.f[dirTNE ])[ktne ]; - //(Dbuff.f[dirTSW ])[k] = (D.f[dirTSW ])[ktsw ]; - //(Dbuff.f[dirTSE ])[k] = (D.f[dirTSE ])[ktse ]; - //(Dbuff.f[dirTNW ])[k] = (D.f[dirTNW ])[ktnw ]; - //(Dbuff.f[dirBNE ])[k] = (D.f[dirBNE ])[kbne ]; - //(Dbuff.f[dirBSW ])[k] = (D.f[dirBSW ])[kbsw ]; - //(Dbuff.f[dirBSE ])[k] = (D.f[dirBSE ])[kbse ]; - //(Dbuff.f[dirBNW ])[k] = (D.f[dirBNW ])[kbnw ]; - (Dbuff.f[dirE ])[k] = (D.f[dirW ])[kw ]; - (Dbuff.f[dirW ])[k] = (D.f[dirE ])[ke ]; - (Dbuff.f[dirN ])[k] = (D.f[dirS ])[ks ]; - (Dbuff.f[dirS ])[k] = (D.f[dirN ])[kn ]; - (Dbuff.f[dirT ])[k] = (D.f[dirB ])[kb ]; - (Dbuff.f[dirB ])[k] = (D.f[dirT ])[kt ]; - (Dbuff.f[dirNE ])[k] = (D.f[dirSW ])[ksw ]; - (Dbuff.f[dirSW ])[k] = (D.f[dirNE ])[kne ]; - (Dbuff.f[dirSE ])[k] = (D.f[dirNW ])[knw ]; - (Dbuff.f[dirNW ])[k] = (D.f[dirSE ])[kse ]; - (Dbuff.f[dirTE ])[k] = (D.f[dirBW ])[kbw ]; - (Dbuff.f[dirBW ])[k] = (D.f[dirTE ])[kte ]; - (Dbuff.f[dirBE ])[k] = (D.f[dirTW ])[ktw ]; - (Dbuff.f[dirTW ])[k] = (D.f[dirBE ])[kbe ]; - (Dbuff.f[dirTN ])[k] = (D.f[dirBS ])[kbs ]; - (Dbuff.f[dirBS ])[k] = (D.f[dirTN ])[ktn ]; - (Dbuff.f[dirBN ])[k] = (D.f[dirTS ])[kts ]; - (Dbuff.f[dirTS ])[k] = (D.f[dirBN ])[kbn ]; - (Dbuff.f[dirZERO])[k] = (D.f[dirZERO])[kzero]; - (Dbuff.f[dirTNE ])[k] = (D.f[dirBSW ])[kbsw ]; - (Dbuff.f[dirTSW ])[k] = (D.f[dirBNE ])[kbne ]; - (Dbuff.f[dirTSE ])[k] = (D.f[dirBNW ])[kbnw ]; - (Dbuff.f[dirTNW ])[k] = (D.f[dirBSE ])[kbse ]; - (Dbuff.f[dirBNE ])[k] = (D.f[dirTSW ])[ktsw ]; - (Dbuff.f[dirBSW ])[k] = (D.f[dirTNE ])[ktne ]; - (Dbuff.f[dirBSE ])[k] = (D.f[dirTNW ])[ktnw ]; - (Dbuff.f[dirBNW ])[k] = (D.f[dirTSE ])[ktse ]; + //(Dbuff.f[DIR_P00 ])[k] = (D.f[DIR_P00 ])[ke ]; + //(Dbuff.f[DIR_M00 ])[k] = (D.f[DIR_M00 ])[kw ]; + //(Dbuff.f[DIR_0P0 ])[k] = (D.f[DIR_0P0 ])[kn ]; + //(Dbuff.f[DIR_0M0 ])[k] = (D.f[DIR_0M0 ])[ks ]; + //(Dbuff.f[DIR_00P ])[k] = (D.f[DIR_00P ])[kt ]; + //(Dbuff.f[DIR_00M ])[k] = (D.f[DIR_00M ])[kb ]; + //(Dbuff.f[DIR_PP0 ])[k] = (D.f[DIR_PP0 ])[kne ]; + //(Dbuff.f[DIR_MM0 ])[k] = (D.f[DIR_MM0 ])[ksw ]; + //(Dbuff.f[DIR_PM0 ])[k] = (D.f[DIR_PM0 ])[kse ]; + //(Dbuff.f[DIR_MP0 ])[k] = (D.f[DIR_MP0 ])[knw ]; + //(Dbuff.f[DIR_P0P ])[k] = (D.f[DIR_P0P ])[kte ]; + //(Dbuff.f[DIR_M0M ])[k] = (D.f[DIR_M0M ])[kbw ]; + //(Dbuff.f[DIR_P0M ])[k] = (D.f[DIR_P0M ])[kbe ]; + //(Dbuff.f[DIR_M0P ])[k] = (D.f[DIR_M0P ])[ktw ]; + //(Dbuff.f[DIR_0PP ])[k] = (D.f[DIR_0PP ])[ktn ]; + //(Dbuff.f[DIR_0MM ])[k] = (D.f[DIR_0MM ])[kbs ]; + //(Dbuff.f[DIR_0PM ])[k] = (D.f[DIR_0PM ])[kbn ]; + //(Dbuff.f[DIR_0MP ])[k] = (D.f[DIR_0MP ])[kts ]; + //(Dbuff.f[DIR_000])[k] = (D.f[DIR_000])[kzero]; + //(Dbuff.f[DIR_PPP ])[k] = (D.f[DIR_PPP ])[ktne ]; + //(Dbuff.f[DIR_MMP ])[k] = (D.f[DIR_MMP ])[ktsw ]; + //(Dbuff.f[DIR_PMP ])[k] = (D.f[DIR_PMP ])[ktse ]; + //(Dbuff.f[DIR_MPP ])[k] = (D.f[DIR_MPP ])[ktnw ]; + //(Dbuff.f[DIR_PPM ])[k] = (D.f[DIR_PPM ])[kbne ]; + //(Dbuff.f[DIR_MMM ])[k] = (D.f[DIR_MMM ])[kbsw ]; + //(Dbuff.f[DIR_PMM ])[k] = (D.f[DIR_PMM ])[kbse ]; + //(Dbuff.f[DIR_MPM ])[k] = (D.f[DIR_MPM ])[kbnw ]; + (Dbuff.f[DIR_P00 ])[k] = (D.f[DIR_M00 ])[kw ]; + (Dbuff.f[DIR_M00 ])[k] = (D.f[DIR_P00 ])[ke ]; + (Dbuff.f[DIR_0P0 ])[k] = (D.f[DIR_0M0 ])[ks ]; + (Dbuff.f[DIR_0M0 ])[k] = (D.f[DIR_0P0 ])[kn ]; + (Dbuff.f[DIR_00P ])[k] = (D.f[DIR_00M ])[kb ]; + (Dbuff.f[DIR_00M ])[k] = (D.f[DIR_00P ])[kt ]; + (Dbuff.f[DIR_PP0 ])[k] = (D.f[DIR_MM0 ])[ksw ]; + (Dbuff.f[DIR_MM0 ])[k] = (D.f[DIR_PP0 ])[kne ]; + (Dbuff.f[DIR_PM0 ])[k] = (D.f[DIR_MP0 ])[knw ]; + (Dbuff.f[DIR_MP0 ])[k] = (D.f[DIR_PM0 ])[kse ]; + (Dbuff.f[DIR_P0P ])[k] = (D.f[DIR_M0M ])[kbw ]; + (Dbuff.f[DIR_M0M ])[k] = (D.f[DIR_P0P ])[kte ]; + (Dbuff.f[DIR_P0M ])[k] = (D.f[DIR_M0P ])[ktw ]; + (Dbuff.f[DIR_M0P ])[k] = (D.f[DIR_P0M ])[kbe ]; + (Dbuff.f[DIR_0PP ])[k] = (D.f[DIR_0MM ])[kbs ]; + (Dbuff.f[DIR_0MM ])[k] = (D.f[DIR_0PP ])[ktn ]; + (Dbuff.f[DIR_0PM ])[k] = (D.f[DIR_0MP ])[kts ]; + (Dbuff.f[DIR_0MP ])[k] = (D.f[DIR_0PM ])[kbn ]; + (Dbuff.f[DIR_000])[k] = (D.f[DIR_000])[kzero]; + (Dbuff.f[DIR_PPP ])[k] = (D.f[DIR_MMM ])[kbsw ]; + (Dbuff.f[DIR_MMP ])[k] = (D.f[DIR_PPM ])[kbne ]; + (Dbuff.f[DIR_PMP ])[k] = (D.f[DIR_MPM ])[kbnw ]; + (Dbuff.f[DIR_MPP ])[k] = (D.f[DIR_PMM ])[kbse ]; + (Dbuff.f[DIR_PPM ])[k] = (D.f[DIR_MMP ])[ktsw ]; + (Dbuff.f[DIR_MMM ])[k] = (D.f[DIR_PPP ])[ktne ]; + (Dbuff.f[DIR_PMM ])[k] = (D.f[DIR_MPP ])[ktnw ]; + (Dbuff.f[DIR_MPM ])[k] = (D.f[DIR_PMP ])[ktse ]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -242,7 +243,7 @@ extern "C" __global__ void getSendFsPost27(real* DD, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void setRecvFsPost27(real* DD, +__global__ void setRecvFsPost27(real* DD, real* bufferFs, int* recvIndex, int buffmax, @@ -250,7 +251,7 @@ extern "C" __global__ void setRecvFsPost27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -298,152 +299,152 @@ extern "C" __global__ void setRecvFsPost27(real* DD, //////////////////////////////////////////////////////////////////////////////// //set Pointer for Fs Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //set Pointer for Buffer Fs Distributions27 Dbuff; - Dbuff.f[dirE ] = &bufferFs[dirE *buffmax]; - Dbuff.f[dirW ] = &bufferFs[dirW *buffmax]; - Dbuff.f[dirN ] = &bufferFs[dirN *buffmax]; - Dbuff.f[dirS ] = &bufferFs[dirS *buffmax]; - Dbuff.f[dirT ] = &bufferFs[dirT *buffmax]; - Dbuff.f[dirB ] = &bufferFs[dirB *buffmax]; - Dbuff.f[dirNE ] = &bufferFs[dirNE *buffmax]; - Dbuff.f[dirSW ] = &bufferFs[dirSW *buffmax]; - Dbuff.f[dirSE ] = &bufferFs[dirSE *buffmax]; - Dbuff.f[dirNW ] = &bufferFs[dirNW *buffmax]; - Dbuff.f[dirTE ] = &bufferFs[dirTE *buffmax]; - Dbuff.f[dirBW ] = &bufferFs[dirBW *buffmax]; - Dbuff.f[dirBE ] = &bufferFs[dirBE *buffmax]; - Dbuff.f[dirTW ] = &bufferFs[dirTW *buffmax]; - Dbuff.f[dirTN ] = &bufferFs[dirTN *buffmax]; - Dbuff.f[dirBS ] = &bufferFs[dirBS *buffmax]; - Dbuff.f[dirBN ] = &bufferFs[dirBN *buffmax]; - Dbuff.f[dirTS ] = &bufferFs[dirTS *buffmax]; - Dbuff.f[dirZERO] = &bufferFs[dirZERO*buffmax]; - Dbuff.f[dirTNE ] = &bufferFs[dirTNE *buffmax]; - Dbuff.f[dirTSW ] = &bufferFs[dirTSW *buffmax]; - Dbuff.f[dirTSE ] = &bufferFs[dirTSE *buffmax]; - Dbuff.f[dirTNW ] = &bufferFs[dirTNW *buffmax]; - Dbuff.f[dirBNE ] = &bufferFs[dirBNE *buffmax]; - Dbuff.f[dirBSW ] = &bufferFs[dirBSW *buffmax]; - Dbuff.f[dirBSE ] = &bufferFs[dirBSE *buffmax]; - Dbuff.f[dirBNW ] = &bufferFs[dirBNW *buffmax]; + Dbuff.f[DIR_P00 ] = &bufferFs[DIR_P00 *buffmax]; + Dbuff.f[DIR_M00 ] = &bufferFs[DIR_M00 *buffmax]; + Dbuff.f[DIR_0P0 ] = &bufferFs[DIR_0P0 *buffmax]; + Dbuff.f[DIR_0M0 ] = &bufferFs[DIR_0M0 *buffmax]; + Dbuff.f[DIR_00P ] = &bufferFs[DIR_00P *buffmax]; + Dbuff.f[DIR_00M ] = &bufferFs[DIR_00M *buffmax]; + Dbuff.f[DIR_PP0 ] = &bufferFs[DIR_PP0 *buffmax]; + Dbuff.f[DIR_MM0 ] = &bufferFs[DIR_MM0 *buffmax]; + Dbuff.f[DIR_PM0 ] = &bufferFs[DIR_PM0 *buffmax]; + Dbuff.f[DIR_MP0 ] = &bufferFs[DIR_MP0 *buffmax]; + Dbuff.f[DIR_P0P ] = &bufferFs[DIR_P0P *buffmax]; + Dbuff.f[DIR_M0M ] = &bufferFs[DIR_M0M *buffmax]; + Dbuff.f[DIR_P0M ] = &bufferFs[DIR_P0M *buffmax]; + Dbuff.f[DIR_M0P ] = &bufferFs[DIR_M0P *buffmax]; + Dbuff.f[DIR_0PP ] = &bufferFs[DIR_0PP *buffmax]; + Dbuff.f[DIR_0MM ] = &bufferFs[DIR_0MM *buffmax]; + Dbuff.f[DIR_0PM ] = &bufferFs[DIR_0PM *buffmax]; + Dbuff.f[DIR_0MP ] = &bufferFs[DIR_0MP *buffmax]; + Dbuff.f[DIR_000] = &bufferFs[DIR_000*buffmax]; + Dbuff.f[DIR_PPP ] = &bufferFs[DIR_PPP *buffmax]; + Dbuff.f[DIR_MMP ] = &bufferFs[DIR_MMP *buffmax]; + Dbuff.f[DIR_PMP ] = &bufferFs[DIR_PMP *buffmax]; + Dbuff.f[DIR_MPP ] = &bufferFs[DIR_MPP *buffmax]; + Dbuff.f[DIR_PPM ] = &bufferFs[DIR_PPM *buffmax]; + Dbuff.f[DIR_MMM ] = &bufferFs[DIR_MMM *buffmax]; + Dbuff.f[DIR_PMM ] = &bufferFs[DIR_PMM *buffmax]; + Dbuff.f[DIR_MPM ] = &bufferFs[DIR_MPM *buffmax]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy from buffer - //(D.f[dirE ])[ke ] = (Dbuff.f[dirE ])[k]; - //(D.f[dirW ])[kw ] = (Dbuff.f[dirW ])[k]; - //(D.f[dirN ])[kn ] = (Dbuff.f[dirN ])[k]; - //(D.f[dirS ])[ks ] = (Dbuff.f[dirS ])[k]; - //(D.f[dirT ])[kt ] = (Dbuff.f[dirT ])[k]; - //(D.f[dirB ])[kb ] = (Dbuff.f[dirB ])[k]; - //(D.f[dirNE ])[kne ] = (Dbuff.f[dirNE ])[k]; - //(D.f[dirSW ])[ksw ] = (Dbuff.f[dirSW ])[k]; - //(D.f[dirSE ])[kse ] = (Dbuff.f[dirSE ])[k]; - //(D.f[dirNW ])[knw ] = (Dbuff.f[dirNW ])[k]; - //(D.f[dirTE ])[kte ] = (Dbuff.f[dirTE ])[k]; - //(D.f[dirBW ])[kbw ] = (Dbuff.f[dirBW ])[k]; - //(D.f[dirBE ])[kbe ] = (Dbuff.f[dirBE ])[k]; - //(D.f[dirTW ])[ktw ] = (Dbuff.f[dirTW ])[k]; - //(D.f[dirTN ])[ktn ] = (Dbuff.f[dirTN ])[k]; - //(D.f[dirBS ])[kbs ] = (Dbuff.f[dirBS ])[k]; - //(D.f[dirBN ])[kbn ] = (Dbuff.f[dirBN ])[k]; - //(D.f[dirTS ])[kts ] = (Dbuff.f[dirTS ])[k]; - //(D.f[dirZERO])[kzero] = (Dbuff.f[dirZERO])[k]; - //(D.f[dirTNE ])[ktne ] = (Dbuff.f[dirTNE ])[k]; - //(D.f[dirTSW ])[ktsw ] = (Dbuff.f[dirTSW ])[k]; - //(D.f[dirTSE ])[ktse ] = (Dbuff.f[dirTSE ])[k]; - //(D.f[dirTNW ])[ktnw ] = (Dbuff.f[dirTNW ])[k]; - //(D.f[dirBNE ])[kbne ] = (Dbuff.f[dirBNE ])[k]; - //(D.f[dirBSW ])[kbsw ] = (Dbuff.f[dirBSW ])[k]; - //(D.f[dirBSE ])[kbse ] = (Dbuff.f[dirBSE ])[k]; - //(D.f[dirBNW ])[kbnw ] = (Dbuff.f[dirBNW ])[k]; - (D.f[dirW ])[kw ] = (Dbuff.f[dirE ])[k]; - (D.f[dirE ])[ke ] = (Dbuff.f[dirW ])[k]; - (D.f[dirS ])[ks ] = (Dbuff.f[dirN ])[k]; - (D.f[dirN ])[kn ] = (Dbuff.f[dirS ])[k]; - (D.f[dirB ])[kb ] = (Dbuff.f[dirT ])[k]; - (D.f[dirT ])[kt ] = (Dbuff.f[dirB ])[k]; - (D.f[dirSW ])[ksw ] = (Dbuff.f[dirNE ])[k]; - (D.f[dirNE ])[kne ] = (Dbuff.f[dirSW ])[k]; - (D.f[dirNW ])[knw ] = (Dbuff.f[dirSE ])[k]; - (D.f[dirSE ])[kse ] = (Dbuff.f[dirNW ])[k]; - (D.f[dirBW ])[kbw ] = (Dbuff.f[dirTE ])[k]; - (D.f[dirTE ])[kte ] = (Dbuff.f[dirBW ])[k]; - (D.f[dirTW ])[ktw ] = (Dbuff.f[dirBE ])[k]; - (D.f[dirBE ])[kbe ] = (Dbuff.f[dirTW ])[k]; - (D.f[dirBS ])[kbs ] = (Dbuff.f[dirTN ])[k]; - (D.f[dirTN ])[ktn ] = (Dbuff.f[dirBS ])[k]; - (D.f[dirTS ])[kts ] = (Dbuff.f[dirBN ])[k]; - (D.f[dirBN ])[kbn ] = (Dbuff.f[dirTS ])[k]; - (D.f[dirZERO])[kzero] = (Dbuff.f[dirZERO])[k]; - (D.f[dirBSW ])[kbsw ] = (Dbuff.f[dirTNE ])[k]; - (D.f[dirBNE ])[kbne ] = (Dbuff.f[dirTSW ])[k]; - (D.f[dirBNW ])[kbnw ] = (Dbuff.f[dirTSE ])[k]; - (D.f[dirBSE ])[kbse ] = (Dbuff.f[dirTNW ])[k]; - (D.f[dirTSW ])[ktsw ] = (Dbuff.f[dirBNE ])[k]; - (D.f[dirTNE ])[ktne ] = (Dbuff.f[dirBSW ])[k]; - (D.f[dirTNW ])[ktnw ] = (Dbuff.f[dirBSE ])[k]; - (D.f[dirTSE ])[ktse ] = (Dbuff.f[dirBNW ])[k]; + //(D.f[DIR_P00 ])[ke ] = (Dbuff.f[DIR_P00 ])[k]; + //(D.f[DIR_M00 ])[kw ] = (Dbuff.f[DIR_M00 ])[k]; + //(D.f[DIR_0P0 ])[kn ] = (Dbuff.f[DIR_0P0 ])[k]; + //(D.f[DIR_0M0 ])[ks ] = (Dbuff.f[DIR_0M0 ])[k]; + //(D.f[DIR_00P ])[kt ] = (Dbuff.f[DIR_00P ])[k]; + //(D.f[DIR_00M ])[kb ] = (Dbuff.f[DIR_00M ])[k]; + //(D.f[DIR_PP0 ])[kne ] = (Dbuff.f[DIR_PP0 ])[k]; + //(D.f[DIR_MM0 ])[ksw ] = (Dbuff.f[DIR_MM0 ])[k]; + //(D.f[DIR_PM0 ])[kse ] = (Dbuff.f[DIR_PM0 ])[k]; + //(D.f[DIR_MP0 ])[knw ] = (Dbuff.f[DIR_MP0 ])[k]; + //(D.f[DIR_P0P ])[kte ] = (Dbuff.f[DIR_P0P ])[k]; + //(D.f[DIR_M0M ])[kbw ] = (Dbuff.f[DIR_M0M ])[k]; + //(D.f[DIR_P0M ])[kbe ] = (Dbuff.f[DIR_P0M ])[k]; + //(D.f[DIR_M0P ])[ktw ] = (Dbuff.f[DIR_M0P ])[k]; + //(D.f[DIR_0PP ])[ktn ] = (Dbuff.f[DIR_0PP ])[k]; + //(D.f[DIR_0MM ])[kbs ] = (Dbuff.f[DIR_0MM ])[k]; + //(D.f[DIR_0PM ])[kbn ] = (Dbuff.f[DIR_0PM ])[k]; + //(D.f[DIR_0MP ])[kts ] = (Dbuff.f[DIR_0MP ])[k]; + //(D.f[DIR_000])[kzero] = (Dbuff.f[DIR_000])[k]; + //(D.f[DIR_PPP ])[ktne ] = (Dbuff.f[DIR_PPP ])[k]; + //(D.f[DIR_MMP ])[ktsw ] = (Dbuff.f[DIR_MMP ])[k]; + //(D.f[DIR_PMP ])[ktse ] = (Dbuff.f[DIR_PMP ])[k]; + //(D.f[DIR_MPP ])[ktnw ] = (Dbuff.f[DIR_MPP ])[k]; + //(D.f[DIR_PPM ])[kbne ] = (Dbuff.f[DIR_PPM ])[k]; + //(D.f[DIR_MMM ])[kbsw ] = (Dbuff.f[DIR_MMM ])[k]; + //(D.f[DIR_PMM ])[kbse ] = (Dbuff.f[DIR_PMM ])[k]; + //(D.f[DIR_MPM ])[kbnw ] = (Dbuff.f[DIR_MPM ])[k]; + (D.f[DIR_M00 ])[kw ] = (Dbuff.f[DIR_P00 ])[k]; + (D.f[DIR_P00 ])[ke ] = (Dbuff.f[DIR_M00 ])[k]; + (D.f[DIR_0M0 ])[ks ] = (Dbuff.f[DIR_0P0 ])[k]; + (D.f[DIR_0P0 ])[kn ] = (Dbuff.f[DIR_0M0 ])[k]; + (D.f[DIR_00M ])[kb ] = (Dbuff.f[DIR_00P ])[k]; + (D.f[DIR_00P ])[kt ] = (Dbuff.f[DIR_00M ])[k]; + (D.f[DIR_MM0 ])[ksw ] = (Dbuff.f[DIR_PP0 ])[k]; + (D.f[DIR_PP0 ])[kne ] = (Dbuff.f[DIR_MM0 ])[k]; + (D.f[DIR_MP0 ])[knw ] = (Dbuff.f[DIR_PM0 ])[k]; + (D.f[DIR_PM0 ])[kse ] = (Dbuff.f[DIR_MP0 ])[k]; + (D.f[DIR_M0M ])[kbw ] = (Dbuff.f[DIR_P0P ])[k]; + (D.f[DIR_P0P ])[kte ] = (Dbuff.f[DIR_M0M ])[k]; + (D.f[DIR_M0P ])[ktw ] = (Dbuff.f[DIR_P0M ])[k]; + (D.f[DIR_P0M ])[kbe ] = (Dbuff.f[DIR_M0P ])[k]; + (D.f[DIR_0MM ])[kbs ] = (Dbuff.f[DIR_0PP ])[k]; + (D.f[DIR_0PP ])[ktn ] = (Dbuff.f[DIR_0MM ])[k]; + (D.f[DIR_0MP ])[kts ] = (Dbuff.f[DIR_0PM ])[k]; + (D.f[DIR_0PM ])[kbn ] = (Dbuff.f[DIR_0MP ])[k]; + (D.f[DIR_000])[kzero] = (Dbuff.f[DIR_000])[k]; + (D.f[DIR_MMM ])[kbsw ] = (Dbuff.f[DIR_PPP ])[k]; + (D.f[DIR_PPM ])[kbne ] = (Dbuff.f[DIR_MMP ])[k]; + (D.f[DIR_MPM ])[kbnw ] = (Dbuff.f[DIR_PMP ])[k]; + (D.f[DIR_PMM ])[kbse ] = (Dbuff.f[DIR_MPP ])[k]; + (D.f[DIR_MMP ])[ktsw ] = (Dbuff.f[DIR_PPM ])[k]; + (D.f[DIR_PPP ])[ktne ] = (Dbuff.f[DIR_MMM ])[k]; + (D.f[DIR_MPP ])[ktnw ] = (Dbuff.f[DIR_PMM ])[k]; + (D.f[DIR_PMP ])[ktse ] = (Dbuff.f[DIR_MPM ])[k]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -477,7 +478,7 @@ extern "C" __global__ void setRecvFsPost27(real* DD, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void getSendFsPre27(real* DD, +__global__ void getSendFsPre27(real* DD, real* bufferFs, int* sendIndex, int buffmax, @@ -485,7 +486,7 @@ extern "C" __global__ void getSendFsPre27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -533,125 +534,125 @@ extern "C" __global__ void getSendFsPre27(real* DD, //////////////////////////////////////////////////////////////////////////////// //set Pointer for Fs Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //set Pointer for Buffer Fs Distributions27 Dbuff; - Dbuff.f[dirE ] = &bufferFs[dirE *buffmax]; - Dbuff.f[dirW ] = &bufferFs[dirW *buffmax]; - Dbuff.f[dirN ] = &bufferFs[dirN *buffmax]; - Dbuff.f[dirS ] = &bufferFs[dirS *buffmax]; - Dbuff.f[dirT ] = &bufferFs[dirT *buffmax]; - Dbuff.f[dirB ] = &bufferFs[dirB *buffmax]; - Dbuff.f[dirNE ] = &bufferFs[dirNE *buffmax]; - Dbuff.f[dirSW ] = &bufferFs[dirSW *buffmax]; - Dbuff.f[dirSE ] = &bufferFs[dirSE *buffmax]; - Dbuff.f[dirNW ] = &bufferFs[dirNW *buffmax]; - Dbuff.f[dirTE ] = &bufferFs[dirTE *buffmax]; - Dbuff.f[dirBW ] = &bufferFs[dirBW *buffmax]; - Dbuff.f[dirBE ] = &bufferFs[dirBE *buffmax]; - Dbuff.f[dirTW ] = &bufferFs[dirTW *buffmax]; - Dbuff.f[dirTN ] = &bufferFs[dirTN *buffmax]; - Dbuff.f[dirBS ] = &bufferFs[dirBS *buffmax]; - Dbuff.f[dirBN ] = &bufferFs[dirBN *buffmax]; - Dbuff.f[dirTS ] = &bufferFs[dirTS *buffmax]; - Dbuff.f[dirZERO] = &bufferFs[dirZERO*buffmax]; - Dbuff.f[dirTNE ] = &bufferFs[dirTNE *buffmax]; - Dbuff.f[dirTSW ] = &bufferFs[dirTSW *buffmax]; - Dbuff.f[dirTSE ] = &bufferFs[dirTSE *buffmax]; - Dbuff.f[dirTNW ] = &bufferFs[dirTNW *buffmax]; - Dbuff.f[dirBNE ] = &bufferFs[dirBNE *buffmax]; - Dbuff.f[dirBSW ] = &bufferFs[dirBSW *buffmax]; - Dbuff.f[dirBSE ] = &bufferFs[dirBSE *buffmax]; - Dbuff.f[dirBNW ] = &bufferFs[dirBNW *buffmax]; + Dbuff.f[DIR_P00 ] = &bufferFs[DIR_P00 *buffmax]; + Dbuff.f[DIR_M00 ] = &bufferFs[DIR_M00 *buffmax]; + Dbuff.f[DIR_0P0 ] = &bufferFs[DIR_0P0 *buffmax]; + Dbuff.f[DIR_0M0 ] = &bufferFs[DIR_0M0 *buffmax]; + Dbuff.f[DIR_00P ] = &bufferFs[DIR_00P *buffmax]; + Dbuff.f[DIR_00M ] = &bufferFs[DIR_00M *buffmax]; + Dbuff.f[DIR_PP0 ] = &bufferFs[DIR_PP0 *buffmax]; + Dbuff.f[DIR_MM0 ] = &bufferFs[DIR_MM0 *buffmax]; + Dbuff.f[DIR_PM0 ] = &bufferFs[DIR_PM0 *buffmax]; + Dbuff.f[DIR_MP0 ] = &bufferFs[DIR_MP0 *buffmax]; + Dbuff.f[DIR_P0P ] = &bufferFs[DIR_P0P *buffmax]; + Dbuff.f[DIR_M0M ] = &bufferFs[DIR_M0M *buffmax]; + Dbuff.f[DIR_P0M ] = &bufferFs[DIR_P0M *buffmax]; + Dbuff.f[DIR_M0P ] = &bufferFs[DIR_M0P *buffmax]; + Dbuff.f[DIR_0PP ] = &bufferFs[DIR_0PP *buffmax]; + Dbuff.f[DIR_0MM ] = &bufferFs[DIR_0MM *buffmax]; + Dbuff.f[DIR_0PM ] = &bufferFs[DIR_0PM *buffmax]; + Dbuff.f[DIR_0MP ] = &bufferFs[DIR_0MP *buffmax]; + Dbuff.f[DIR_000] = &bufferFs[DIR_000*buffmax]; + Dbuff.f[DIR_PPP ] = &bufferFs[DIR_PPP *buffmax]; + Dbuff.f[DIR_MMP ] = &bufferFs[DIR_MMP *buffmax]; + Dbuff.f[DIR_PMP ] = &bufferFs[DIR_PMP *buffmax]; + Dbuff.f[DIR_MPP ] = &bufferFs[DIR_MPP *buffmax]; + Dbuff.f[DIR_PPM ] = &bufferFs[DIR_PPM *buffmax]; + Dbuff.f[DIR_MMM ] = &bufferFs[DIR_MMM *buffmax]; + Dbuff.f[DIR_PMM ] = &bufferFs[DIR_PMM *buffmax]; + Dbuff.f[DIR_MPM ] = &bufferFs[DIR_MPM *buffmax]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy to buffer - (Dbuff.f[dirE ])[k] = (D.f[dirE ])[ke ]; - (Dbuff.f[dirW ])[k] = (D.f[dirW ])[kw ]; - (Dbuff.f[dirN ])[k] = (D.f[dirN ])[kn ]; - (Dbuff.f[dirS ])[k] = (D.f[dirS ])[ks ]; - (Dbuff.f[dirT ])[k] = (D.f[dirT ])[kt ]; - (Dbuff.f[dirB ])[k] = (D.f[dirB ])[kb ]; - (Dbuff.f[dirNE ])[k] = (D.f[dirNE ])[kne ]; - (Dbuff.f[dirSW ])[k] = (D.f[dirSW ])[ksw ]; - (Dbuff.f[dirSE ])[k] = (D.f[dirSE ])[kse ]; - (Dbuff.f[dirNW ])[k] = (D.f[dirNW ])[knw ]; - (Dbuff.f[dirTE ])[k] = (D.f[dirTE ])[kte ]; - (Dbuff.f[dirBW ])[k] = (D.f[dirBW ])[kbw ]; - (Dbuff.f[dirBE ])[k] = (D.f[dirBE ])[kbe ]; - (Dbuff.f[dirTW ])[k] = (D.f[dirTW ])[ktw ]; - (Dbuff.f[dirTN ])[k] = (D.f[dirTN ])[ktn ]; - (Dbuff.f[dirBS ])[k] = (D.f[dirBS ])[kbs ]; - (Dbuff.f[dirBN ])[k] = (D.f[dirBN ])[kbn ]; - (Dbuff.f[dirTS ])[k] = (D.f[dirTS ])[kts ]; - (Dbuff.f[dirZERO])[k] = (D.f[dirZERO])[kzero]; - (Dbuff.f[dirTNE ])[k] = (D.f[dirTNE ])[ktne ]; - (Dbuff.f[dirTSW ])[k] = (D.f[dirTSW ])[ktsw ]; - (Dbuff.f[dirTSE ])[k] = (D.f[dirTSE ])[ktse ]; - (Dbuff.f[dirTNW ])[k] = (D.f[dirTNW ])[ktnw ]; - (Dbuff.f[dirBNE ])[k] = (D.f[dirBNE ])[kbne ]; - (Dbuff.f[dirBSW ])[k] = (D.f[dirBSW ])[kbsw ]; - (Dbuff.f[dirBSE ])[k] = (D.f[dirBSE ])[kbse ]; - (Dbuff.f[dirBNW ])[k] = (D.f[dirBNW ])[kbnw ]; + (Dbuff.f[DIR_P00 ])[k] = (D.f[DIR_P00 ])[ke ]; + (Dbuff.f[DIR_M00 ])[k] = (D.f[DIR_M00 ])[kw ]; + (Dbuff.f[DIR_0P0 ])[k] = (D.f[DIR_0P0 ])[kn ]; + (Dbuff.f[DIR_0M0 ])[k] = (D.f[DIR_0M0 ])[ks ]; + (Dbuff.f[DIR_00P ])[k] = (D.f[DIR_00P ])[kt ]; + (Dbuff.f[DIR_00M ])[k] = (D.f[DIR_00M ])[kb ]; + (Dbuff.f[DIR_PP0 ])[k] = (D.f[DIR_PP0 ])[kne ]; + (Dbuff.f[DIR_MM0 ])[k] = (D.f[DIR_MM0 ])[ksw ]; + (Dbuff.f[DIR_PM0 ])[k] = (D.f[DIR_PM0 ])[kse ]; + (Dbuff.f[DIR_MP0 ])[k] = (D.f[DIR_MP0 ])[knw ]; + (Dbuff.f[DIR_P0P ])[k] = (D.f[DIR_P0P ])[kte ]; + (Dbuff.f[DIR_M0M ])[k] = (D.f[DIR_M0M ])[kbw ]; + (Dbuff.f[DIR_P0M ])[k] = (D.f[DIR_P0M ])[kbe ]; + (Dbuff.f[DIR_M0P ])[k] = (D.f[DIR_M0P ])[ktw ]; + (Dbuff.f[DIR_0PP ])[k] = (D.f[DIR_0PP ])[ktn ]; + (Dbuff.f[DIR_0MM ])[k] = (D.f[DIR_0MM ])[kbs ]; + (Dbuff.f[DIR_0PM ])[k] = (D.f[DIR_0PM ])[kbn ]; + (Dbuff.f[DIR_0MP ])[k] = (D.f[DIR_0MP ])[kts ]; + (Dbuff.f[DIR_000])[k] = (D.f[DIR_000])[kzero]; + (Dbuff.f[DIR_PPP ])[k] = (D.f[DIR_PPP ])[ktne ]; + (Dbuff.f[DIR_MMP ])[k] = (D.f[DIR_MMP ])[ktsw ]; + (Dbuff.f[DIR_PMP ])[k] = (D.f[DIR_PMP ])[ktse ]; + (Dbuff.f[DIR_MPP ])[k] = (D.f[DIR_MPP ])[ktnw ]; + (Dbuff.f[DIR_PPM ])[k] = (D.f[DIR_PPM ])[kbne ]; + (Dbuff.f[DIR_MMM ])[k] = (D.f[DIR_MMM ])[kbsw ]; + (Dbuff.f[DIR_PMM ])[k] = (D.f[DIR_PMM ])[kbse ]; + (Dbuff.f[DIR_MPM ])[k] = (D.f[DIR_MPM ])[kbnw ]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -686,7 +687,7 @@ extern "C" __global__ void getSendFsPre27(real* DD, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void setRecvFsPre27(real* DD, +__global__ void setRecvFsPre27(real* DD, real* bufferFs, int* recvIndex, int buffmax, @@ -694,7 +695,7 @@ extern "C" __global__ void setRecvFsPre27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -742,125 +743,125 @@ extern "C" __global__ void setRecvFsPre27(real* DD, //////////////////////////////////////////////////////////////////////////////// //set Pointer for Fs Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //set Pointer for Buffer Fs Distributions27 Dbuff; - Dbuff.f[dirE ] = &bufferFs[dirE *buffmax]; - Dbuff.f[dirW ] = &bufferFs[dirW *buffmax]; - Dbuff.f[dirN ] = &bufferFs[dirN *buffmax]; - Dbuff.f[dirS ] = &bufferFs[dirS *buffmax]; - Dbuff.f[dirT ] = &bufferFs[dirT *buffmax]; - Dbuff.f[dirB ] = &bufferFs[dirB *buffmax]; - Dbuff.f[dirNE ] = &bufferFs[dirNE *buffmax]; - Dbuff.f[dirSW ] = &bufferFs[dirSW *buffmax]; - Dbuff.f[dirSE ] = &bufferFs[dirSE *buffmax]; - Dbuff.f[dirNW ] = &bufferFs[dirNW *buffmax]; - Dbuff.f[dirTE ] = &bufferFs[dirTE *buffmax]; - Dbuff.f[dirBW ] = &bufferFs[dirBW *buffmax]; - Dbuff.f[dirBE ] = &bufferFs[dirBE *buffmax]; - Dbuff.f[dirTW ] = &bufferFs[dirTW *buffmax]; - Dbuff.f[dirTN ] = &bufferFs[dirTN *buffmax]; - Dbuff.f[dirBS ] = &bufferFs[dirBS *buffmax]; - Dbuff.f[dirBN ] = &bufferFs[dirBN *buffmax]; - Dbuff.f[dirTS ] = &bufferFs[dirTS *buffmax]; - Dbuff.f[dirZERO] = &bufferFs[dirZERO*buffmax]; - Dbuff.f[dirTNE ] = &bufferFs[dirTNE *buffmax]; - Dbuff.f[dirTSW ] = &bufferFs[dirTSW *buffmax]; - Dbuff.f[dirTSE ] = &bufferFs[dirTSE *buffmax]; - Dbuff.f[dirTNW ] = &bufferFs[dirTNW *buffmax]; - Dbuff.f[dirBNE ] = &bufferFs[dirBNE *buffmax]; - Dbuff.f[dirBSW ] = &bufferFs[dirBSW *buffmax]; - Dbuff.f[dirBSE ] = &bufferFs[dirBSE *buffmax]; - Dbuff.f[dirBNW ] = &bufferFs[dirBNW *buffmax]; + Dbuff.f[DIR_P00 ] = &bufferFs[DIR_P00 *buffmax]; + Dbuff.f[DIR_M00 ] = &bufferFs[DIR_M00 *buffmax]; + Dbuff.f[DIR_0P0 ] = &bufferFs[DIR_0P0 *buffmax]; + Dbuff.f[DIR_0M0 ] = &bufferFs[DIR_0M0 *buffmax]; + Dbuff.f[DIR_00P ] = &bufferFs[DIR_00P *buffmax]; + Dbuff.f[DIR_00M ] = &bufferFs[DIR_00M *buffmax]; + Dbuff.f[DIR_PP0 ] = &bufferFs[DIR_PP0 *buffmax]; + Dbuff.f[DIR_MM0 ] = &bufferFs[DIR_MM0 *buffmax]; + Dbuff.f[DIR_PM0 ] = &bufferFs[DIR_PM0 *buffmax]; + Dbuff.f[DIR_MP0 ] = &bufferFs[DIR_MP0 *buffmax]; + Dbuff.f[DIR_P0P ] = &bufferFs[DIR_P0P *buffmax]; + Dbuff.f[DIR_M0M ] = &bufferFs[DIR_M0M *buffmax]; + Dbuff.f[DIR_P0M ] = &bufferFs[DIR_P0M *buffmax]; + Dbuff.f[DIR_M0P ] = &bufferFs[DIR_M0P *buffmax]; + Dbuff.f[DIR_0PP ] = &bufferFs[DIR_0PP *buffmax]; + Dbuff.f[DIR_0MM ] = &bufferFs[DIR_0MM *buffmax]; + Dbuff.f[DIR_0PM ] = &bufferFs[DIR_0PM *buffmax]; + Dbuff.f[DIR_0MP ] = &bufferFs[DIR_0MP *buffmax]; + Dbuff.f[DIR_000] = &bufferFs[DIR_000*buffmax]; + Dbuff.f[DIR_PPP ] = &bufferFs[DIR_PPP *buffmax]; + Dbuff.f[DIR_MMP ] = &bufferFs[DIR_MMP *buffmax]; + Dbuff.f[DIR_PMP ] = &bufferFs[DIR_PMP *buffmax]; + Dbuff.f[DIR_MPP ] = &bufferFs[DIR_MPP *buffmax]; + Dbuff.f[DIR_PPM ] = &bufferFs[DIR_PPM *buffmax]; + Dbuff.f[DIR_MMM ] = &bufferFs[DIR_MMM *buffmax]; + Dbuff.f[DIR_PMM ] = &bufferFs[DIR_PMM *buffmax]; + Dbuff.f[DIR_MPM ] = &bufferFs[DIR_MPM *buffmax]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy from buffer - (D.f[dirE ])[ke ] = (Dbuff.f[dirE ])[k]; - (D.f[dirW ])[kw ] = (Dbuff.f[dirW ])[k]; - (D.f[dirN ])[kn ] = (Dbuff.f[dirN ])[k]; - (D.f[dirS ])[ks ] = (Dbuff.f[dirS ])[k]; - (D.f[dirT ])[kt ] = (Dbuff.f[dirT ])[k]; - (D.f[dirB ])[kb ] = (Dbuff.f[dirB ])[k]; - (D.f[dirNE ])[kne ] = (Dbuff.f[dirNE ])[k]; - (D.f[dirSW ])[ksw ] = (Dbuff.f[dirSW ])[k]; - (D.f[dirSE ])[kse ] = (Dbuff.f[dirSE ])[k]; - (D.f[dirNW ])[knw ] = (Dbuff.f[dirNW ])[k]; - (D.f[dirTE ])[kte ] = (Dbuff.f[dirTE ])[k]; - (D.f[dirBW ])[kbw ] = (Dbuff.f[dirBW ])[k]; - (D.f[dirBE ])[kbe ] = (Dbuff.f[dirBE ])[k]; - (D.f[dirTW ])[ktw ] = (Dbuff.f[dirTW ])[k]; - (D.f[dirTN ])[ktn ] = (Dbuff.f[dirTN ])[k]; - (D.f[dirBS ])[kbs ] = (Dbuff.f[dirBS ])[k]; - (D.f[dirBN ])[kbn ] = (Dbuff.f[dirBN ])[k]; - (D.f[dirTS ])[kts ] = (Dbuff.f[dirTS ])[k]; - (D.f[dirZERO])[kzero] = (Dbuff.f[dirZERO])[k]; - (D.f[dirTNE ])[ktne ] = (Dbuff.f[dirTNE ])[k]; - (D.f[dirTSW ])[ktsw ] = (Dbuff.f[dirTSW ])[k]; - (D.f[dirTSE ])[ktse ] = (Dbuff.f[dirTSE ])[k]; - (D.f[dirTNW ])[ktnw ] = (Dbuff.f[dirTNW ])[k]; - (D.f[dirBNE ])[kbne ] = (Dbuff.f[dirBNE ])[k]; - (D.f[dirBSW ])[kbsw ] = (Dbuff.f[dirBSW ])[k]; - (D.f[dirBSE ])[kbse ] = (Dbuff.f[dirBSE ])[k]; - (D.f[dirBNW ])[kbnw ] = (Dbuff.f[dirBNW ])[k]; + (D.f[DIR_P00 ])[ke ] = (Dbuff.f[DIR_P00 ])[k]; + (D.f[DIR_M00 ])[kw ] = (Dbuff.f[DIR_M00 ])[k]; + (D.f[DIR_0P0 ])[kn ] = (Dbuff.f[DIR_0P0 ])[k]; + (D.f[DIR_0M0 ])[ks ] = (Dbuff.f[DIR_0M0 ])[k]; + (D.f[DIR_00P ])[kt ] = (Dbuff.f[DIR_00P ])[k]; + (D.f[DIR_00M ])[kb ] = (Dbuff.f[DIR_00M ])[k]; + (D.f[DIR_PP0 ])[kne ] = (Dbuff.f[DIR_PP0 ])[k]; + (D.f[DIR_MM0 ])[ksw ] = (Dbuff.f[DIR_MM0 ])[k]; + (D.f[DIR_PM0 ])[kse ] = (Dbuff.f[DIR_PM0 ])[k]; + (D.f[DIR_MP0 ])[knw ] = (Dbuff.f[DIR_MP0 ])[k]; + (D.f[DIR_P0P ])[kte ] = (Dbuff.f[DIR_P0P ])[k]; + (D.f[DIR_M0M ])[kbw ] = (Dbuff.f[DIR_M0M ])[k]; + (D.f[DIR_P0M ])[kbe ] = (Dbuff.f[DIR_P0M ])[k]; + (D.f[DIR_M0P ])[ktw ] = (Dbuff.f[DIR_M0P ])[k]; + (D.f[DIR_0PP ])[ktn ] = (Dbuff.f[DIR_0PP ])[k]; + (D.f[DIR_0MM ])[kbs ] = (Dbuff.f[DIR_0MM ])[k]; + (D.f[DIR_0PM ])[kbn ] = (Dbuff.f[DIR_0PM ])[k]; + (D.f[DIR_0MP ])[kts ] = (Dbuff.f[DIR_0MP ])[k]; + (D.f[DIR_000])[kzero] = (Dbuff.f[DIR_000])[k]; + (D.f[DIR_PPP ])[ktne ] = (Dbuff.f[DIR_PPP ])[k]; + (D.f[DIR_MMP ])[ktsw ] = (Dbuff.f[DIR_MMP ])[k]; + (D.f[DIR_PMP ])[ktse ] = (Dbuff.f[DIR_PMP ])[k]; + (D.f[DIR_MPP ])[ktnw ] = (Dbuff.f[DIR_MPP ])[k]; + (D.f[DIR_PPM ])[kbne ] = (Dbuff.f[DIR_PPM ])[k]; + (D.f[DIR_MMM ])[kbsw ] = (Dbuff.f[DIR_MMM ])[k]; + (D.f[DIR_PMM ])[kbse ] = (Dbuff.f[DIR_PMM ])[k]; + (D.f[DIR_MPM ])[kbnw ] = (Dbuff.f[DIR_MPM ])[k]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -894,7 +895,7 @@ extern "C" __global__ void setRecvFsPre27(real* DD, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void getSendGsF3( +__global__ void getSendGsF3( real* G6, real* bufferGs, int* sendIndex, @@ -903,7 +904,7 @@ extern "C" __global__ void getSendGsF3( unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -928,41 +929,41 @@ extern "C" __global__ void getSendGsF3( //////////////////////////////////////////////////////////////////////////////// //set Pointer for Gs Distributions6 G; - if (evenOrOdd) + if (isEvenTimestep) { - G.g[dirE] = &G6[dirE *size_Mat]; - G.g[dirW] = &G6[dirW *size_Mat]; - G.g[dirN] = &G6[dirN *size_Mat]; - G.g[dirS] = &G6[dirS *size_Mat]; - G.g[dirT] = &G6[dirT *size_Mat]; - G.g[dirB] = &G6[dirB *size_Mat]; + G.g[DIR_P00] = &G6[DIR_P00 *size_Mat]; + G.g[DIR_M00] = &G6[DIR_M00 *size_Mat]; + G.g[DIR_0P0] = &G6[DIR_0P0 *size_Mat]; + G.g[DIR_0M0] = &G6[DIR_0M0 *size_Mat]; + G.g[DIR_00P] = &G6[DIR_00P *size_Mat]; + G.g[DIR_00M] = &G6[DIR_00M *size_Mat]; } else { - G.g[dirW] = &G6[dirE *size_Mat]; - G.g[dirE] = &G6[dirW *size_Mat]; - G.g[dirS] = &G6[dirN *size_Mat]; - G.g[dirN] = &G6[dirS *size_Mat]; - G.g[dirB] = &G6[dirT *size_Mat]; - G.g[dirT] = &G6[dirB *size_Mat]; + G.g[DIR_M00] = &G6[DIR_P00 *size_Mat]; + G.g[DIR_P00] = &G6[DIR_M00 *size_Mat]; + G.g[DIR_0M0] = &G6[DIR_0P0 *size_Mat]; + G.g[DIR_0P0] = &G6[DIR_0M0 *size_Mat]; + G.g[DIR_00M] = &G6[DIR_00P *size_Mat]; + G.g[DIR_00P] = &G6[DIR_00M *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //set Pointer for Buffer Gs Distributions6 Dbuff; - Dbuff.g[dirE] = &bufferGs[dirE *buffmax]; - Dbuff.g[dirW] = &bufferGs[dirW *buffmax]; - Dbuff.g[dirN] = &bufferGs[dirN *buffmax]; - Dbuff.g[dirS] = &bufferGs[dirS *buffmax]; - Dbuff.g[dirT] = &bufferGs[dirT *buffmax]; - Dbuff.g[dirB] = &bufferGs[dirB *buffmax]; + Dbuff.g[DIR_P00] = &bufferGs[DIR_P00 *buffmax]; + Dbuff.g[DIR_M00] = &bufferGs[DIR_M00 *buffmax]; + Dbuff.g[DIR_0P0] = &bufferGs[DIR_0P0 *buffmax]; + Dbuff.g[DIR_0M0] = &bufferGs[DIR_0M0 *buffmax]; + Dbuff.g[DIR_00P] = &bufferGs[DIR_00P *buffmax]; + Dbuff.g[DIR_00M] = &bufferGs[DIR_00M *buffmax]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //write Gs to buffer - (Dbuff.g[dirE])[k] = (G.g[dirW])[kw]; - (Dbuff.g[dirW])[k] = (G.g[dirE])[kr]; - (Dbuff.g[dirN])[k] = (G.g[dirS])[ks]; - (Dbuff.g[dirS])[k] = (G.g[dirN])[kr]; - (Dbuff.g[dirT])[k] = (G.g[dirB])[kb]; - (Dbuff.g[dirB])[k] = (G.g[dirT])[kr]; + (Dbuff.g[DIR_P00])[k] = (G.g[DIR_M00])[kw]; + (Dbuff.g[DIR_M00])[k] = (G.g[DIR_P00])[kr]; + (Dbuff.g[DIR_0P0])[k] = (G.g[DIR_0M0])[ks]; + (Dbuff.g[DIR_0M0])[k] = (G.g[DIR_0P0])[kr]; + (Dbuff.g[DIR_00P])[k] = (G.g[DIR_00M])[kb]; + (Dbuff.g[DIR_00M])[k] = (G.g[DIR_00P])[kr]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -997,7 +998,7 @@ extern "C" __global__ void getSendGsF3( //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void setRecvGsF3( +__global__ void setRecvGsF3( real* G6, real* bufferGs, int* recvIndex, @@ -1006,7 +1007,7 @@ extern "C" __global__ void setRecvGsF3( unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1031,41 +1032,41 @@ extern "C" __global__ void setRecvGsF3( //////////////////////////////////////////////////////////////////////////////// //set Pointer for Gs Distributions6 G; - if (evenOrOdd) + if (isEvenTimestep) { - G.g[dirE] = &G6[dirE *size_Mat]; - G.g[dirW] = &G6[dirW *size_Mat]; - G.g[dirN] = &G6[dirN *size_Mat]; - G.g[dirS] = &G6[dirS *size_Mat]; - G.g[dirT] = &G6[dirT *size_Mat]; - G.g[dirB] = &G6[dirB *size_Mat]; + G.g[DIR_P00] = &G6[DIR_P00 *size_Mat]; + G.g[DIR_M00] = &G6[DIR_M00 *size_Mat]; + G.g[DIR_0P0] = &G6[DIR_0P0 *size_Mat]; + G.g[DIR_0M0] = &G6[DIR_0M0 *size_Mat]; + G.g[DIR_00P] = &G6[DIR_00P *size_Mat]; + G.g[DIR_00M] = &G6[DIR_00M *size_Mat]; } else { - G.g[dirW] = &G6[dirE *size_Mat]; - G.g[dirE] = &G6[dirW *size_Mat]; - G.g[dirS] = &G6[dirN *size_Mat]; - G.g[dirN] = &G6[dirS *size_Mat]; - G.g[dirB] = &G6[dirT *size_Mat]; - G.g[dirT] = &G6[dirB *size_Mat]; + G.g[DIR_M00] = &G6[DIR_P00 *size_Mat]; + G.g[DIR_P00] = &G6[DIR_M00 *size_Mat]; + G.g[DIR_0M0] = &G6[DIR_0P0 *size_Mat]; + G.g[DIR_0P0] = &G6[DIR_0M0 *size_Mat]; + G.g[DIR_00M] = &G6[DIR_00P *size_Mat]; + G.g[DIR_00P] = &G6[DIR_00M *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //set Pointer for Buffer Gs Distributions6 Dbuff; - Dbuff.g[dirE] = &bufferGs[dirE *buffmax]; - Dbuff.g[dirW] = &bufferGs[dirW *buffmax]; - Dbuff.g[dirN] = &bufferGs[dirN *buffmax]; - Dbuff.g[dirS] = &bufferGs[dirS *buffmax]; - Dbuff.g[dirT] = &bufferGs[dirT *buffmax]; - Dbuff.g[dirB] = &bufferGs[dirB *buffmax]; + Dbuff.g[DIR_P00] = &bufferGs[DIR_P00 *buffmax]; + Dbuff.g[DIR_M00] = &bufferGs[DIR_M00 *buffmax]; + Dbuff.g[DIR_0P0] = &bufferGs[DIR_0P0 *buffmax]; + Dbuff.g[DIR_0M0] = &bufferGs[DIR_0M0 *buffmax]; + Dbuff.g[DIR_00P] = &bufferGs[DIR_00P *buffmax]; + Dbuff.g[DIR_00M] = &bufferGs[DIR_00M *buffmax]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //write buffer to Gs - (G.g[dirW])[kw] = (Dbuff.g[dirE])[k]; - (G.g[dirE])[kr] = (Dbuff.g[dirW])[k]; - (G.g[dirS])[ks] = (Dbuff.g[dirN])[k]; - (G.g[dirN])[kr] = (Dbuff.g[dirS])[k]; - (G.g[dirB])[kb] = (Dbuff.g[dirT])[k]; - (G.g[dirT])[kr] = (Dbuff.g[dirB])[k]; + (G.g[DIR_M00])[kw] = (Dbuff.g[DIR_P00])[k]; + (G.g[DIR_P00])[kr] = (Dbuff.g[DIR_M00])[k]; + (G.g[DIR_0M0])[ks] = (Dbuff.g[DIR_0P0])[k]; + (G.g[DIR_0P0])[kr] = (Dbuff.g[DIR_0M0])[k]; + (G.g[DIR_00M])[kb] = (Dbuff.g[DIR_00P])[k]; + (G.g[DIR_00P])[kr] = (Dbuff.g[DIR_00M])[k]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/GPU/GPU_Interface.h b/src/gpu/VirtualFluids_GPU/GPU/GPU_Interface.h index dfdbac44d197e55e3e78eb794692fd9443cb7ab6..ee987ae23402ef304220349db77084cc341ccd5a 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/GPU_Interface.h +++ b/src/gpu/VirtualFluids_GPU/GPU/GPU_Interface.h @@ -5,18 +5,22 @@ // |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ \____/_/ \_____/ // ////////////////////////////////////////////////////////////////////////// -//random numbers -#include <curand.h> -#include <curand_kernel.h> +#ifndef GPU_INTERFACE_H +#define GPU_INTERFACE_H -#include <DataTypes.h> #include "LBM/LB.h" +#include <cuda_runtime.h> +#include <curand.h> +#include <curand_kernel.h> + +struct LBMSimulationParameter; +class Parameter; ////////////////////////////////////////////////////////////////////////// //Kernel ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelCas27(unsigned int grid_nx, +void KernelCas27(unsigned int grid_nx, unsigned int grid_ny, unsigned int grid_nz, real s9, @@ -28,7 +32,7 @@ extern "C" void KernelCas27(unsigned int grid_nx, int size_Mat, bool EvenOrOdd); -extern "C" void KernelCasSP27(unsigned int numberOfThreads, +void KernelCasSP27(unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -38,7 +42,7 @@ extern "C" void KernelCasSP27(unsigned int numberOfThreads, int size_Mat, bool EvenOrOdd); -extern "C" void KernelCasSPMS27(unsigned int numberOfThreads, +void KernelCasSPMS27(unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -48,7 +52,7 @@ extern "C" void KernelCasSPMS27(unsigned int numberOfThreads, int size_Mat, bool EvenOrOdd); -extern "C" void KernelCasSPMSOHM27( unsigned int numberOfThreads, +void KernelCasSPMSOHM27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -58,7 +62,7 @@ extern "C" void KernelCasSPMSOHM27( unsigned int numberOfThreads, int size_Mat, bool EvenOrOdd); -extern "C" void KernelKumCompSRTSP27( +void KernelKumCompSRTSP27( unsigned int numberOfThreads, real omega, unsigned int* bcMatD, @@ -71,7 +75,7 @@ extern "C" void KernelKumCompSRTSP27( real* forces, bool EvenOrOdd); -extern "C" void KernelCumulantD3Q27All4(unsigned int numberOfThreads, +void KernelCumulantD3Q27All4(unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -83,7 +87,7 @@ extern "C" void KernelCumulantD3Q27All4(unsigned int numberOfThreads, real* forces, bool EvenOrOdd); -extern "C" void KernelKumAA2016CompBulkSP27(unsigned int numberOfThreads, +void KernelKumAA2016CompBulkSP27(unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -96,7 +100,7 @@ extern "C" void KernelKumAA2016CompBulkSP27(unsigned int numberOfThreads, real* forces, bool EvenOrOdd); -extern "C" void KernelKum1hSP27( unsigned int numberOfThreads, +void KernelKum1hSP27( unsigned int numberOfThreads, real omega, real deltaPhi, real angularVelocity, @@ -111,7 +115,7 @@ extern "C" void KernelKum1hSP27( unsigned int numberOfThreads, int size_Mat, bool EvenOrOdd); -extern "C" void KernelCascadeSP27(unsigned int numberOfThreads, +void KernelCascadeSP27(unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -121,7 +125,7 @@ extern "C" void KernelCascadeSP27(unsigned int numberOfThreads, int size_Mat, bool EvenOrOdd); -extern "C" void KernelKumNewSP27( unsigned int numberOfThreads, +void KernelKumNewSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -132,7 +136,7 @@ extern "C" void KernelKumNewSP27( unsigned int numberOfThreads, bool EvenOrOdd); -extern "C" void CumulantOnePreconditionedErrorDiffusionChimCompSP27( +void CumulantOnePreconditionedErrorDiffusionChimCompSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, @@ -146,7 +150,7 @@ extern "C" void CumulantOnePreconditionedErrorDiffusionChimCompSP27( real* forces, bool EvenOrOdd); -extern "C" void CumulantOnePreconditionedChimCompSP27( +void CumulantOnePreconditionedChimCompSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, @@ -160,7 +164,7 @@ extern "C" void CumulantOnePreconditionedChimCompSP27( real* forces, bool EvenOrOdd); -extern "C" void CumulantOneChimCompSP27( +void CumulantOneChimCompSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, @@ -175,7 +179,7 @@ extern "C" void CumulantOneChimCompSP27( bool EvenOrOdd); -extern "C" void KernelKumIsoTestSP27(unsigned int numberOfThreads, +void KernelKumIsoTestSP27(unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -188,7 +192,7 @@ extern "C" void KernelKumIsoTestSP27(unsigned int numberOfThreads, int size_Mat, bool EvenOrOdd); -extern "C" void KernelKumCompSP27( unsigned int numberOfThreads, +void KernelKumCompSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -198,7 +202,7 @@ extern "C" void KernelKumCompSP27( unsigned int numberOfThreads, int size_Mat, bool EvenOrOdd); -extern "C" void KernelWaleBySoniMalavCumAA2016CompSP27( +void KernelWaleBySoniMalavCumAA2016CompSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, @@ -217,7 +221,7 @@ extern "C" void KernelWaleBySoniMalavCumAA2016CompSP27( real* forces, bool EvenOrOdd); -extern "C" void KernelPMCumOneCompSP27(unsigned int numberOfThreads, +void KernelPMCumOneCompSP27(unsigned int numberOfThreads, real omega, unsigned int* neighborX, unsigned int* neighborY, @@ -233,7 +237,7 @@ extern "C" void KernelPMCumOneCompSP27(unsigned int numberOfThreads, unsigned int* nodeIdsPorousMedia, bool EvenOrOdd); -extern "C" void KernelADincomp7( unsigned int numberOfThreads, +void KernelADincomp7( unsigned int numberOfThreads, real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, @@ -244,7 +248,7 @@ extern "C" void KernelADincomp7( unsigned int numberOfThreads, int size_Mat, bool EvenOrOdd); -extern "C" void KernelADincomp27( unsigned int numberOfThreads, +void KernelADincomp27( unsigned int numberOfThreads, real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, @@ -255,7 +259,7 @@ extern "C" void KernelADincomp27( unsigned int numberOfThreads, int size_Mat, bool EvenOrOdd); -extern "C" void Init27(int myid, +void Init27(int myid, int numprocs, real u0, unsigned int* geoD, @@ -271,7 +275,7 @@ extern "C" void Init27(int myid, int level, int maxlevel); -extern "C" void InitNonEqPartSP27(unsigned int numberOfThreads, +void InitNonEqPartSP27(unsigned int numberOfThreads, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, @@ -287,7 +291,7 @@ extern "C" void InitNonEqPartSP27(unsigned int numberOfThreads, bool EvenOrOdd); -extern "C" void InitThS7( unsigned int numberOfThreads, +void InitThS7( unsigned int numberOfThreads, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, @@ -300,7 +304,7 @@ extern "C" void InitThS7( unsigned int numberOfThreads, real* DD7, bool EvenOrOdd); -extern "C" void InitThS27( unsigned int numberOfThreads, +void InitADDev27( unsigned int numberOfThreads, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, @@ -313,7 +317,7 @@ extern "C" void InitThS27( unsigned int numberOfThreads, real* DD27, bool EvenOrOdd); -extern "C" void PostProcessorF3_2018Fehlberg( +void PostProcessorF3_2018Fehlberg( unsigned int numberOfThreads, real omega, unsigned int* bcMatD, @@ -331,7 +335,7 @@ extern "C" void PostProcessorF3_2018Fehlberg( real* forces, bool EvenOrOdd); -extern "C" void CalcMac27( real* vxD, +void CalcMac27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -344,9 +348,9 @@ extern "C" void CalcMac27( real* vxD, unsigned int grid_ny, unsigned int grid_nz, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void CalcMacSP27(real* vxD, +void CalcMacSP27(real* vxD, real* vyD, real* vzD, real* rhoD, @@ -358,9 +362,9 @@ extern "C" void CalcMacSP27(real* vxD, unsigned int size_Mat, unsigned int numberOfThreads, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void CalcMacCompSP27(real* vxD, +void CalcMacCompSP27(real* vxD, real* vyD, real* vzD, real* rhoD, @@ -372,9 +376,9 @@ extern "C" void CalcMacCompSP27(real* vxD, unsigned int size_Mat, unsigned int numberOfThreads, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void CalcMacThS7( real* Conc, +void CalcMacThS7( real* Conc, unsigned int* geoD, unsigned int* neighborX, unsigned int* neighborY, @@ -382,9 +386,9 @@ extern "C" void CalcMacThS7( real* Conc, unsigned int size_Mat, unsigned int numberOfThreads, real* DD7, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void PlaneConcThS7(real* Conc, +void PlaneConcThS7(real* Conc, int* kPC, unsigned int numberOfPointskPC, unsigned int* geoD, @@ -394,9 +398,9 @@ extern "C" void PlaneConcThS7(real* Conc, unsigned int size_Mat, unsigned int numberOfThreads, real* DD7, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void PlaneConcThS27(real* Conc, +void PlaneConcThS27(real* Conc, int* kPC, unsigned int numberOfPointskPC, unsigned int* geoD, @@ -406,19 +410,19 @@ extern "C" void PlaneConcThS27(real* Conc, unsigned int size_Mat, unsigned int numberOfThreads, real* DD27, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void CalcMacThS27( real* Conc, - unsigned int* geoD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - unsigned int numberOfThreads, - real* DD27, - bool evenOrOdd); +void CalcConcentration27( unsigned int numberOfThreads, + real* Conc, + unsigned int* geoD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + real* DD27, + bool isEvenTimestep); -extern "C" void CalcMedSP27( real* vxD, +void CalcMedSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -430,9 +434,9 @@ extern "C" void CalcMedSP27( real* vxD, unsigned int size_Mat, unsigned int numberOfThreads, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void CalcMedCompSP27(real* vxD, +void CalcMedCompSP27(real* vxD, real* vyD, real* vzD, real* rhoD, @@ -444,9 +448,9 @@ extern "C" void CalcMedCompSP27(real* vxD, unsigned int size_Mat, unsigned int numberOfThreads, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void CalcMedCompAD27( +void CalcMedCompAD27( real* vxD, real* vyD, real* vzD, @@ -461,9 +465,9 @@ extern "C" void CalcMedCompAD27( unsigned int numberOfThreads, real* DD, real* DD_AD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void CalcMacMedSP27( real* vxD, +void CalcMacMedSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -475,9 +479,9 @@ extern "C" void CalcMacMedSP27( real* vxD, unsigned int tdiff, unsigned int size_Mat, unsigned int numberOfThreads, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void ResetMedianValuesSP27( +void ResetMedianValuesSP27( real* vxD, real* vyD, real* vzD, @@ -485,9 +489,9 @@ extern "C" void ResetMedianValuesSP27( real* pressD, unsigned int size_Mat, unsigned int numberOfThreads, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void ResetMedianValuesAD27( +void ResetMedianValuesAD27( real* vxD, real* vyD, real* vzD, @@ -496,9 +500,9 @@ extern "C" void ResetMedianValuesAD27( real* concD, unsigned int size_Mat, unsigned int numberOfThreads, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void Calc2ndMomentsIncompSP27(real* kxyFromfcNEQ, +void Calc2ndMomentsIncompSP27(real* kxyFromfcNEQ, real* kyzFromfcNEQ, real* kxzFromfcNEQ, real* kxxMyyFromfcNEQ, @@ -510,9 +514,9 @@ extern "C" void Calc2ndMomentsIncompSP27(real* kxyFromfcNEQ, unsigned int size_Mat, unsigned int numberOfThreads, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void Calc2ndMomentsCompSP27(real* kxyFromfcNEQ, +void Calc2ndMomentsCompSP27(real* kxyFromfcNEQ, real* kyzFromfcNEQ, real* kxzFromfcNEQ, real* kxxMyyFromfcNEQ, @@ -524,9 +528,9 @@ extern "C" void Calc2ndMomentsCompSP27(real* kxyFromfcNEQ, unsigned int size_Mat, unsigned int numberOfThreads, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void Calc3rdMomentsIncompSP27(real* CUMbbb, +void Calc3rdMomentsIncompSP27(real* CUMbbb, real* CUMabc, real* CUMbac, real* CUMbca, @@ -540,9 +544,9 @@ extern "C" void Calc3rdMomentsIncompSP27(real* CUMbbb, unsigned int size_Mat, unsigned int numberOfThreads, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void Calc3rdMomentsCompSP27(real* CUMbbb, +void Calc3rdMomentsCompSP27(real* CUMbbb, real* CUMabc, real* CUMbac, real* CUMbca, @@ -556,9 +560,9 @@ extern "C" void Calc3rdMomentsCompSP27(real* CUMbbb, unsigned int size_Mat, unsigned int numberOfThreads, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void CalcHigherMomentsIncompSP27(real* CUMcbb, +void CalcHigherMomentsIncompSP27(real* CUMcbb, real* CUMbcb, real* CUMbbc, real* CUMcca, @@ -575,9 +579,9 @@ extern "C" void CalcHigherMomentsIncompSP27(real* CUMcbb, unsigned int size_Mat, unsigned int numberOfThreads, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void CalcHigherMomentsCompSP27(real* CUMcbb, +void CalcHigherMomentsCompSP27(real* CUMcbb, real* CUMbcb, real* CUMbbc, real* CUMcca, @@ -594,9 +598,9 @@ extern "C" void CalcHigherMomentsCompSP27(real* CUMcbb, unsigned int size_Mat, unsigned int numberOfThreads, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void LBCalcMeasurePoints27(real* vxMP, +void LBCalcMeasurePoints27(real* vxMP, real* vyMP, real* vzMP, real* rhoMP, @@ -611,9 +615,9 @@ extern "C" void LBCalcMeasurePoints27(real* vxMP, unsigned int size_Mat, real* DD, unsigned int numberOfThreads, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void BcPress27(int nx, +void BcPress27(int nx, int ny, int tz, unsigned int grid_nx, @@ -624,9 +628,9 @@ extern "C" void BcPress27(int nx, unsigned int* neighborZ, real* DD, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void BcVel27(int nx, +void BcVel27(int nx, int ny, int nz, int itz, @@ -638,46 +642,19 @@ extern "C" void BcVel27(int nx, unsigned int* neighborZ, real* DD, unsigned int size_Mat, - bool evenOrOdd, + bool isEvenTimestep, real u0x, real om); -extern "C" void QDev27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" void QDevComp27(unsigned int numberOfThreads, - int nx, - int ny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" void QDevCompThinWalls27(unsigned int numberOfThreads, +void QDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); + +void QDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); + +void QDevCompThinWalls27(unsigned int numberOfThreads, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* geom, unsigned int* neighborX, @@ -685,86 +662,52 @@ extern "C" void QDevCompThinWalls27(unsigned int numberOfThreads, unsigned int* neighborZ, unsigned int* neighborWSB, unsigned int size_Mat, - bool evenOrOdd); - -extern "C" void QDev3rdMomentsComp27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QDevIncompHighNu27( unsigned int numberOfThreads, - int nx, - int ny, +void QDev3rdMomentsComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); + +void QDevIncompHighNu27( unsigned int numberOfThreads, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QDevCompHighNu27(unsigned int numberOfThreads, - int nx, - int ny, +void QDevCompHighNu27(unsigned int numberOfThreads, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QVelDevicePlainBB27(unsigned int numberOfThreads, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); +void QVelDevicePlainBB27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); -extern "C" void QVelDeviceCouhette27(unsigned int numberOfThreads, +void QVelDeviceCouette27(unsigned int numberOfThreads, real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QVelDevice1h27( unsigned int numberOfThreads, +void QVelDevice1h27( unsigned int numberOfThreads, int nx, int ny, real* vx, @@ -773,8 +716,7 @@ extern "C" void QVelDevice1h27( unsigned int numberOfThreads, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, real Phi, real angularVelocity, @@ -785,71 +727,35 @@ extern "C" void QVelDevice1h27( unsigned int numberOfThreads, real* coordY, real* coordZ, unsigned int size_Mat, - bool evenOrOdd); - -extern "C" void QVelDev27(unsigned int numberOfThreads, - int nx, - int ny, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); + +void QVelDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); -extern "C" void QVelDevCompPlusSlip27(unsigned int numberOfThreads, - int nx, - int ny, +void QVelDevCompPlusSlip27(unsigned int numberOfThreads, real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QVelDevComp27(unsigned int numberOfThreads, - int nx, - int ny, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); +void QVelDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); -extern "C" void QVelDevCompThinWalls27(unsigned int numberOfThreads, +void QVelDevCompThinWalls27(unsigned int numberOfThreads, real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* geom, unsigned int* neighborX, @@ -857,77 +763,55 @@ extern "C" void QVelDevCompThinWalls27(unsigned int numberOfThreads, unsigned int* neighborZ, unsigned int* neighborWSB, unsigned int size_Mat, - bool evenOrOdd); - -extern "C" void QVelDevCompZeroPress27(unsigned int numberOfThreads, - int nx, - int ny, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kArray, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); + +void QVelDevCompZeroPress27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); -extern "C" void QVelDevIncompHighNu27( unsigned int numberOfThreads, - int nx, - int ny, +void QVelDevIncompHighNu27( unsigned int numberOfThreads, real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QVelDevCompHighNu27(unsigned int numberOfThreads, - int nx, - int ny, +void QVelDevCompHighNu27(unsigned int numberOfThreads, real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QVeloDevEQ27(unsigned int numberOfThreads, +void QVeloDevEQ27(unsigned int numberOfThreads, real* VeloX, real* VeloY, real* VeloZ, real* DD, int* k_Q, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QVeloStreetDevEQ27( +void QVeloStreetDevEQ27( uint numberOfThreads, real* veloXfraction, real* veloYfraction, @@ -940,37 +824,23 @@ extern "C" void QVeloStreetDevEQ27( uint* neighborY, uint* neighborZ, uint size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QSlipDev27( unsigned int numberOfThreads, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" void QSlipDevComp27(unsigned int numberOfThreads, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); +void QSlipDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); -extern "C" void QSlipGeomDevComp27( unsigned int numberOfThreads, +void QSlipDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); + +void BBSlipDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); + +void QSlipDevCompTurbulentViscosity27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); + +void QSlipPressureDevCompTurbulentViscosity27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); + +void QSlipGeomDevComp27( unsigned int numberOfThreads, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, + unsigned int numberOfBCnodes, real om1, real* NormalX, real* NormalY, @@ -979,13 +849,13 @@ extern "C" void QSlipGeomDevComp27( unsigned int numberOfThreads, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QSlipNormDevComp27(unsigned int numberOfThreads, +void QSlipNormDevComp27(unsigned int numberOfThreads, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, + unsigned int numberOfBCnodes, real om1, real* NormalX, real* NormalY, @@ -994,180 +864,102 @@ extern "C" void QSlipNormDevComp27(unsigned int numberOfThreads, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QPressDev27(unsigned int numberOfThreads, - int nx, - int ny, - real* rhoBC, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); +void QStressDevComp27(Parameter *para, QforBoundaryConditions* boundaryCondition, const int level); + +void BBStressDev27(Parameter *para, QforBoundaryConditions* boundaryCondition, const int level); -extern "C" void QPressDevFixBackflow27(unsigned int numberOfThreads, +void BBStressPressureDev27(Parameter *para, QforBoundaryConditions* boundaryCondition, const int level); + +void QPressDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); + +void QPressDevFixBackflow27(unsigned int numberOfThreads, real* rhoBC, real* DD, int* k_Q, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QPressDevDirDepBot27(unsigned int numberOfThreads, +void QPressDevDirDepBot27(unsigned int numberOfThreads, real* rhoBC, real* DD, int* k_Q, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QPressNoRhoDev27( unsigned int numberOfThreads, - real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" void QInflowScaleByPressDev27(unsigned int numberOfThreads, - real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); +void QPressNoRhoDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); -extern "C" void QPressDevOld27(unsigned int numberOfThreads, +void QInflowScaleByPressDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); + +void QPressDevOld27(unsigned int numberOfThreads, real* rhoBC, real* DD, int* k_Q, int* k_N, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QPressDevIncompNEQ27(unsigned int numberOfThreads, - real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" void QPressDevNEQ27(unsigned int numberOfThreads, - real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" void QPressDevEQZ27(unsigned int numberOfThreads, - real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - real* kTestRE, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); +void QPressDevIncompNEQ27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); -extern "C" void QPressDevZero27(unsigned int numberOfThreads, +void QPressDevNEQ27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); + +void QPressDevEQZ27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); + +void QPressDevZero27(unsigned int numberOfThreads, real* DD, int* k_Q, - unsigned int kQ, + unsigned int numberOfBCnodes, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QPressDevFake27( unsigned int numberOfThreads, +void QPressDevFake27( unsigned int numberOfThreads, real* rhoBC, real* DD, int* k_Q, int* k_N, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void BBDev27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); +void BBDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition); -extern "C" void QPressDev27_IntBB( unsigned int numberOfThreads, +void QPressDev27_IntBB( unsigned int numberOfThreads, real* rho, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QPressDevAntiBB27( unsigned int numberOfThreads, +void QPressDevAntiBB27( unsigned int numberOfThreads, real* rhoBC, real* vx, real* vy, @@ -1175,15 +967,15 @@ extern "C" void QPressDevAntiBB27( unsigned int numberOfThreads, real* DD, int* k_Q, real* QQ, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void PressSchlaffer27(unsigned int numberOfThreads, +void PressSchlaffer27(unsigned int numberOfThreads, real* rhoBC, real* DD, real* vx0, @@ -1192,87 +984,109 @@ extern "C" void PressSchlaffer27(unsigned int numberOfThreads, real* deltaVz0, int* k_Q, int* k_N, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void VelSchlaffer27( unsigned int numberOfThreads, +void VelSchlaffer27( unsigned int numberOfThreads, int t, real* DD, real* vz0, real* deltaVz0, int* k_Q, int* k_N, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QADDev7(unsigned int numberOfThreads, - int nx, - int ny, +void QADDev7(unsigned int numberOfThreads, real* DD, real* DD7, real* temp, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); +////////////////////////////////////////////////////////////////////////// +//! \brief Advection Diffusion kernel +void FactorizedCentralMomentsAdvectionDiffusionDeviceKernel( + uint numberOfThreads, + real omegaDiffusivity, + uint* typeOfGridNode, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + real* distributions, + real* distributionsAD, + int size_Mat, + real* forces, + bool isEvenTimestep); -extern "C" void QADDirichletDev27( unsigned int numberOfThreads, - int nx, - int ny, +////////////////////////////////////////////////////////////////////////// +//! \brief defines the behavior of a slip-AD boundary condition +void ADSlipVelDevComp( + uint numberOfThreads, + real * normalX, + real * normalY, + real * normalZ, + real * distributions, + real * distributionsAD, + int* QindexArray, + real * Qarrays, + uint numberOfBCnodes, + real omegaDiffusivity, + uint * neighborX, + uint * neighborY, + uint * neighborZ, + uint size_Mat, + bool isEvenTimestep); + +void QADDirichletDev27( unsigned int numberOfThreads, real* DD, real* DD27, real* temp, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QADBBDev27( unsigned int numberOfThreads, - int nx, - int ny, +void QADBBDev27( unsigned int numberOfThreads, real* DD, real* DD27, real* temp, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QADVelDev7(unsigned int numberOfThreads, - int nx, - int ny, +void QADVelDev7(unsigned int numberOfThreads, real* DD, real* DD7, real* temp, @@ -1280,19 +1094,16 @@ extern "C" void QADVelDev7(unsigned int numberOfThreads, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QADVelDev27( unsigned int numberOfThreads, - int nx, - int ny, +void QADVelDev27( unsigned int numberOfThreads, real* DD, real* DD27, real* temp, @@ -1300,18 +1111,15 @@ extern "C" void QADVelDev27( unsigned int numberOfThreads, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QADPressDev7( unsigned int numberOfThreads, - int nx, - int ny, +void QADPressDev7( unsigned int numberOfThreads, real* DD, real* DD7, real* temp, @@ -1319,18 +1127,15 @@ extern "C" void QADPressDev7( unsigned int numberOfThreads, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QADPressDev27(unsigned int numberOfThreads, - int nx, - int ny, +void QADPressDev27(unsigned int numberOfThreads, real* DD, real* DD27, real* temp, @@ -1338,68 +1143,59 @@ extern "C" void QADPressDev27(unsigned int numberOfThreads, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QADPressNEQNeighborDev27( +void QADPressNEQNeighborDev27( unsigned int numberOfThreads, real* DD, real* DD27, int* k_Q, int* k_N, - int kQ, + int numberOfBCnodes, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd + bool isEvenTimestep ); -extern "C" void QNoSlipADincompDev7(unsigned int numberOfThreads, - int nx, - int ny, +void QNoSlipADincompDev7(unsigned int numberOfThreads, real* DD, real* DD7, real* temp, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QNoSlipADincompDev27(unsigned int numberOfThreads, - int nx, - int ny, +void QNoSlipADincompDev27(unsigned int numberOfThreads, real* DD, real* DD27, real* temp, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QADVeloIncompDev7( unsigned int numberOfThreads, - int nx, - int ny, +void QADVeloIncompDev7( unsigned int numberOfThreads, real* DD, real* DD7, real* temp, @@ -1407,19 +1203,16 @@ extern "C" void QADVeloIncompDev7( unsigned int numberOfThreads, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QADVeloIncompDev27( unsigned int numberOfThreads, - int nx, - int ny, +void QADVeloIncompDev27( unsigned int numberOfThreads, real* DD, real* DD27, real* temp, @@ -1427,18 +1220,15 @@ extern "C" void QADVeloIncompDev27( unsigned int numberOfThreads, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QADPressIncompDev7( unsigned int numberOfThreads, - int nx, - int ny, +void QADPressIncompDev7( unsigned int numberOfThreads, real* DD, real* DD7, real* temp, @@ -1446,18 +1236,15 @@ extern "C" void QADPressIncompDev7( unsigned int numberOfThreads, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void QADPressIncompDev27( unsigned int numberOfThreads, - int nx, - int ny, +void QADPressIncompDev27( unsigned int numberOfThreads, real* DD, real* DD27, real* temp, @@ -1465,16 +1252,15 @@ extern "C" void QADPressIncompDev27( unsigned int numberOfThreads, real diffusivity, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void PropVelo( unsigned int numberOfThreads, +void PropVelo( unsigned int numberOfThreads, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, @@ -1489,7 +1275,7 @@ extern "C" void PropVelo( unsigned int numberOfThreads, real* DD, bool EvenOrOdd); -extern "C" void ScaleCF27( real* DC, +void ScaleCF27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1499,7 +1285,7 @@ extern "C" void ScaleCF27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1512,7 +1298,7 @@ extern "C" void ScaleCF27( real* DC, unsigned int nyF, unsigned int numberOfThreads); -extern "C" void ScaleFC27( real* DC, +void ScaleFC27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1522,7 +1308,7 @@ extern "C" void ScaleFC27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -1535,7 +1321,7 @@ extern "C" void ScaleFC27( real* DC, unsigned int nyF, unsigned int numberOfThreads); -extern "C" void ScaleCFEff27(real* DC, +void ScaleCFEff27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1545,7 +1331,7 @@ extern "C" void ScaleCFEff27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1559,7 +1345,7 @@ extern "C" void ScaleCFEff27(real* DC, unsigned int numberOfThreads, OffCF offCF); -extern "C" void ScaleFCEff27(real* DC, +void ScaleFCEff27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1569,7 +1355,7 @@ extern "C" void ScaleFCEff27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -1583,7 +1369,7 @@ extern "C" void ScaleFCEff27(real* DC, unsigned int numberOfThreads, OffFC offFC); -extern "C" void ScaleCFLast27(real* DC, +void ScaleCFLast27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1593,7 +1379,7 @@ extern "C" void ScaleCFLast27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1607,7 +1393,7 @@ extern "C" void ScaleCFLast27(real* DC, unsigned int numberOfThreads, OffCF offCF); -extern "C" void ScaleFCLast27(real* DC, +void ScaleFCLast27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1617,7 +1403,7 @@ extern "C" void ScaleFCLast27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -1631,7 +1417,7 @@ extern "C" void ScaleFCLast27(real* DC, unsigned int numberOfThreads, OffFC offFC); -extern "C" void ScaleCFpress27(real* DC, +void ScaleCFpress27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1641,7 +1427,7 @@ extern "C" void ScaleCFpress27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1655,7 +1441,7 @@ extern "C" void ScaleCFpress27(real* DC, unsigned int numberOfThreads, OffCF offCF); -extern "C" void ScaleFCpress27( real* DC, +void ScaleFCpress27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1665,7 +1451,7 @@ extern "C" void ScaleFCpress27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -1679,7 +1465,7 @@ extern "C" void ScaleFCpress27( real* DC, unsigned int numberOfThreads, OffFC offFC); -extern "C" void ScaleCF_Fix_27(real* DC, +void ScaleCF_Fix_27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1689,7 +1475,7 @@ extern "C" void ScaleCF_Fix_27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1703,7 +1489,7 @@ extern "C" void ScaleCF_Fix_27(real* DC, unsigned int numberOfThreads, OffCF offCF); -extern "C" void ScaleCF_Fix_comp_27( real* DC, +void ScaleCF_Fix_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1713,7 +1499,7 @@ extern "C" void ScaleCF_Fix_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1727,7 +1513,7 @@ extern "C" void ScaleCF_Fix_comp_27( real* DC, unsigned int numberOfThreads, OffCF offCF); -extern "C" void ScaleCF_0817_comp_27( real* DC, +void ScaleCF_0817_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1737,7 +1523,7 @@ extern "C" void ScaleCF_0817_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1749,9 +1535,10 @@ extern "C" void ScaleCF_0817_comp_27( real* DC, unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffCF offCF); + OffCF offCF, + CUstream_st* stream); -extern "C" void ScaleCF_comp_D3Q27F3_2018( real* DC, +void ScaleCF_comp_D3Q27F3_2018( real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -1762,7 +1549,7 @@ extern "C" void ScaleCF_comp_D3Q27F3_2018( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1776,7 +1563,7 @@ extern "C" void ScaleCF_comp_D3Q27F3_2018( real* DC, unsigned int numberOfThreads, OffCF offCF); -extern "C" void ScaleCF_comp_D3Q27F3(real* DC, +void ScaleCF_comp_D3Q27F3(real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -1787,7 +1574,7 @@ extern "C" void ScaleCF_comp_D3Q27F3(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1799,9 +1586,10 @@ extern "C" void ScaleCF_comp_D3Q27F3(real* DC, unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffCF offCF); + OffCF offCF, + CUstream_st *stream); -extern "C" void ScaleCF_staggered_time_comp_27( real* DC, +void ScaleCF_staggered_time_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1811,7 +1599,7 @@ extern "C" void ScaleCF_staggered_time_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1825,31 +1613,10 @@ extern "C" void ScaleCF_staggered_time_comp_27( real* DC, unsigned int numberOfThreads, OffCF offCF); -extern "C" void ScaleCF_RhoSq_comp_27( real* DC, - real* DF, - unsigned int* neighborCX, - unsigned int* neighborCY, - unsigned int* neighborCZ, - unsigned int* neighborFX, - unsigned int* neighborFY, - unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, - unsigned int nyF, - unsigned int numberOfThreads, - OffCF offCF); +void ScaleCF_RhoSq_comp_27(LBMSimulationParameter * parameterDeviceC, LBMSimulationParameter* parameterDeviceF, ICellCF * icellCF, OffCF &offsetCF, CUstream_st *stream); +void ScaleCF_compressible(LBMSimulationParameter * parameterDeviceC, LBMSimulationParameter* parameterDeviceF, ICellCF * icellCF, OffCF &offsetCF, CUstream_st *stream); -extern "C" void ScaleCF_RhoSq_3rdMom_comp_27( real* DC, +void ScaleCF_RhoSq_3rdMom_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1859,7 +1626,7 @@ extern "C" void ScaleCF_RhoSq_3rdMom_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1871,9 +1638,10 @@ extern "C" void ScaleCF_RhoSq_3rdMom_comp_27( real* DC, unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffCF offCF); + OffCF offCF, + CUstream_st *stream); -extern "C" void ScaleCF_AA2016_comp_27( real* DC, +void ScaleCF_AA2016_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1883,7 +1651,7 @@ extern "C" void ScaleCF_AA2016_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1895,9 +1663,10 @@ extern "C" void ScaleCF_AA2016_comp_27( real* DC, unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffCF offCF); + OffCF offCF, + CUstream_st *stream); -extern "C" void ScaleCF_NSPress_27(real* DC, +void ScaleCF_NSPress_27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1907,7 +1676,7 @@ extern "C" void ScaleCF_NSPress_27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -1921,7 +1690,7 @@ extern "C" void ScaleCF_NSPress_27(real* DC, unsigned int numberOfThreads, OffCF offCF); -extern "C" void ScaleFC_Fix_27( real* DC, +void ScaleFC_Fix_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1931,7 +1700,7 @@ extern "C" void ScaleFC_Fix_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -1945,7 +1714,7 @@ extern "C" void ScaleFC_Fix_27( real* DC, unsigned int numberOfThreads, OffFC offFC); -extern "C" void ScaleFC_Fix_comp_27( real* DC, +void ScaleFC_Fix_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1955,7 +1724,7 @@ extern "C" void ScaleFC_Fix_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -1969,7 +1738,7 @@ extern "C" void ScaleFC_Fix_comp_27( real* DC, unsigned int numberOfThreads, OffFC offFC); -extern "C" void ScaleFC_0817_comp_27( real* DC, +void ScaleFC_0817_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1979,7 +1748,7 @@ extern "C" void ScaleFC_0817_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -1991,9 +1760,10 @@ extern "C" void ScaleFC_0817_comp_27( real* DC, unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffFC offFC); + OffFC offFC, + CUstream_st *stream); -extern "C" void ScaleFC_comp_D3Q27F3_2018(real* DC, +void ScaleFC_comp_D3Q27F3_2018(real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -2004,7 +1774,7 @@ extern "C" void ScaleFC_comp_D3Q27F3_2018(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -2018,7 +1788,7 @@ extern "C" void ScaleFC_comp_D3Q27F3_2018(real* DC, unsigned int numberOfThreads, OffFC offFC); -extern "C" void ScaleFC_comp_D3Q27F3( real* DC, +void ScaleFC_comp_D3Q27F3( real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -2029,7 +1799,7 @@ extern "C" void ScaleFC_comp_D3Q27F3( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -2041,9 +1811,10 @@ extern "C" void ScaleFC_comp_D3Q27F3( real* DC, unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffFC offFC); + OffFC offFC, + CUstream_st *stream); -extern "C" void ScaleFC_staggered_time_comp_27( real* DC, +void ScaleFC_staggered_time_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -2053,7 +1824,7 @@ extern "C" void ScaleFC_staggered_time_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -2067,31 +1838,10 @@ extern "C" void ScaleFC_staggered_time_comp_27( real* DC, unsigned int numberOfThreads, OffFC offFC); -extern "C" void ScaleFC_RhoSq_comp_27( real* DC, - real* DF, - unsigned int* neighborCX, - unsigned int* neighborCY, - unsigned int* neighborCZ, - unsigned int* neighborFX, - unsigned int* neighborFY, - unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, - unsigned int nyF, - unsigned int numberOfThreads, - OffFC offFC); +void ScaleFC_RhoSq_comp_27(LBMSimulationParameter * parameterDeviceC, LBMSimulationParameter* parameterDeviceF, ICellFC * icellFC, OffFC& offsetFC, CUstream_st *stream); +void ScaleFC_compressible(LBMSimulationParameter * parameterDeviceC, LBMSimulationParameter* parameterDeviceF, ICellFC * icellFC, OffFC& offsetFC, CUstream_st *stream); -extern "C" void ScaleFC_RhoSq_3rdMom_comp_27( real* DC, +void ScaleFC_RhoSq_3rdMom_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -2101,7 +1851,7 @@ extern "C" void ScaleFC_RhoSq_3rdMom_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -2113,9 +1863,10 @@ extern "C" void ScaleFC_RhoSq_3rdMom_comp_27( real* DC, unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffFC offFC); + OffFC offFC, + CUstream_st *stream); -extern "C" void ScaleFC_AA2016_comp_27( real* DC, +void ScaleFC_AA2016_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -2125,7 +1876,7 @@ extern "C" void ScaleFC_AA2016_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -2137,9 +1888,10 @@ extern "C" void ScaleFC_AA2016_comp_27( real* DC, unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffFC offFC); + OffFC offFC, + CUstream_st *stream); -extern "C" void ScaleFC_NSPress_27( real* DC, +void ScaleFC_NSPress_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -2149,7 +1901,7 @@ extern "C" void ScaleFC_NSPress_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -2163,7 +1915,7 @@ extern "C" void ScaleFC_NSPress_27( real* DC, unsigned int numberOfThreads, OffFC offFC); -extern "C" void ScaleCFThS7( real* DC, +void ScaleCFThS7( real* DC, real* DF, real* DD7C, real* DD7F, @@ -2175,7 +1927,7 @@ extern "C" void ScaleCFThS7( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -2183,7 +1935,7 @@ extern "C" void ScaleCFThS7( real* DC, real diffusivity_fine, unsigned int numberOfThreads); -extern "C" void ScaleFCThS7( real* DC, +void ScaleFCThS7( real* DC, real* DF, real* DD7C, real* DD7F, @@ -2195,7 +1947,7 @@ extern "C" void ScaleFCThS7( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -2203,7 +1955,7 @@ extern "C" void ScaleFCThS7( real* DC, real diffusivity_coarse, unsigned int numberOfThreads); -extern "C" void ScaleCFThSMG7( real* DC, +void ScaleCFThSMG7( real* DC, real* DF, real* DD7C, real* DD7F, @@ -2215,7 +1967,7 @@ extern "C" void ScaleCFThSMG7( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -2224,7 +1976,7 @@ extern "C" void ScaleCFThSMG7( real* DC, unsigned int numberOfThreads, OffCF offCF); -extern "C" void ScaleFCThSMG7(real* DC, +void ScaleFCThSMG7(real* DC, real* DF, real* DD7C, real* DD7F, @@ -2236,7 +1988,7 @@ extern "C" void ScaleFCThSMG7(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -2245,7 +1997,7 @@ extern "C" void ScaleFCThSMG7(real* DC, unsigned int numberOfThreads, OffFC offFC); -extern "C" void ScaleCFThS27( real* DC, +void ScaleCFThS27( real* DC, real* DF, real* DD27C, real* DD27F, @@ -2257,7 +2009,7 @@ extern "C" void ScaleCFThS27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -2266,7 +2018,7 @@ extern "C" void ScaleCFThS27( real* DC, unsigned int numberOfThreads, OffCF offCF); -extern "C" void ScaleFCThS27( real* DC, +void ScaleFCThS27( real* DC, real* DF, real* DD27C, real* DD27F, @@ -2278,7 +2030,7 @@ extern "C" void ScaleFCThS27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -2287,10 +2039,10 @@ extern "C" void ScaleFCThS27( real* DC, unsigned int numberOfThreads, OffFC offFC); -extern "C" void DragLiftPostD27(real* DD, +void DragLiftPostD27(real* DD, int* k_Q, real* QQ, - int kQ, + int numberOfBCnodes, double *DragX, double *DragY, double *DragZ, @@ -2298,13 +2050,13 @@ extern "C" void DragLiftPostD27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, + bool isEvenTimestep, unsigned int numberOfThreads); -extern "C" void DragLiftPreD27( real* DD, +void DragLiftPreD27( real* DD, int* k_Q, real* QQ, - int kQ, + int numberOfBCnodes, double *DragX, double *DragY, double *DragZ, @@ -2312,10 +2064,10 @@ extern "C" void DragLiftPreD27( real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, + bool isEvenTimestep, unsigned int numberOfThreads); -extern "C" void CalcCPtop27(real* DD, +void CalcCPtop27(real* DD, int* cpIndex, int nonCp, double *cpPress, @@ -2323,10 +2075,10 @@ extern "C" void CalcCPtop27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, + bool isEvenTimestep, unsigned int numberOfThreads); -extern "C" void CalcCPbottom27(real* DD, +void CalcCPbottom27(real* DD, int* cpIndex, int nonCp, double *cpPress, @@ -2334,10 +2086,10 @@ extern "C" void CalcCPbottom27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, + bool isEvenTimestep, unsigned int numberOfThreads); -extern "C" void GetSendFsPreDev27(real* DD, +void GetSendFsPreDev27(real* DD, real* bufferFs, int* sendIndex, int buffmax, @@ -2345,10 +2097,11 @@ extern "C" void GetSendFsPreDev27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, - unsigned int numberOfThreads); + bool isEvenTimestep, + unsigned int numberOfThreads, + cudaStream_t stream = CU_STREAM_LEGACY); -extern "C" void GetSendFsPostDev27(real* DD, +void GetSendFsPostDev27(real* DD, real* bufferFs, int* sendIndex, int buffmax, @@ -2356,10 +2109,11 @@ extern "C" void GetSendFsPostDev27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, - unsigned int numberOfThreads); + bool isEvenTimestep, + unsigned int numberOfThreads, + cudaStream_t stream = CU_STREAM_LEGACY); -extern "C" void SetRecvFsPreDev27(real* DD, +void SetRecvFsPreDev27(real* DD, real* bufferFs, int* recvIndex, int buffmax, @@ -2367,10 +2121,10 @@ extern "C" void SetRecvFsPreDev27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, - unsigned int numberOfThreads); + bool isEvenTimestep, unsigned int numberOfThreads, + cudaStream_t stream = CU_STREAM_LEGACY); -extern "C" void SetRecvFsPostDev27(real* DD, +void SetRecvFsPostDev27(real* DD, real* bufferFs, int* recvIndex, int buffmax, @@ -2378,10 +2132,11 @@ extern "C" void SetRecvFsPostDev27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, - unsigned int numberOfThreads); + bool isEvenTimestep, + unsigned int numberOfThreads, + cudaStream_t stream = CU_STREAM_LEGACY); -extern "C" void getSendGsDevF3( +void getSendGsDevF3( real* G6, real* bufferGs, int* sendIndex, @@ -2390,10 +2145,10 @@ extern "C" void getSendGsDevF3( unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, + bool isEvenTimestep, unsigned int numberOfThreads); -extern "C" void setRecvGsDevF3( +void setRecvGsDevF3( real* G6, real* bufferGs, int* recvIndex, @@ -2402,28 +2157,25 @@ extern "C" void setRecvGsDevF3( unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, + bool isEvenTimestep, unsigned int numberOfThreads); -extern "C" void WallFuncDev27(unsigned int numberOfThreads, - int nx, - int ny, +void WallFuncDev27(unsigned int numberOfThreads, real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void SetOutputWallVelocitySP27(unsigned int numberOfThreads, +void SetOutputWallVelocitySP27(unsigned int numberOfThreads, real* vxD, real* vyD, real* vzD, @@ -2440,9 +2192,9 @@ extern "C" void SetOutputWallVelocitySP27(unsigned int numberOfThreads, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void GetVelotoForce27(unsigned int numberOfThreads, +void GetVelotoForce27(unsigned int numberOfThreads, real* DD, int* bcIndex, int nonAtBC, @@ -2453,9 +2205,9 @@ extern "C" void GetVelotoForce27(unsigned int numberOfThreads, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void InitParticlesDevice(real* coordX, +void InitParticlesDevice(real* coordX, real* coordY, real* coordZ, real* coordParticleXlocal, @@ -2480,7 +2232,7 @@ extern "C" void InitParticlesDevice(real* coordX, unsigned int size_Mat, unsigned int numberOfThreads); -extern "C" void MoveParticlesDevice(real* coordX, +void MoveParticlesDevice(real* coordX, real* coordY, real* coordZ, real* coordParticleXlocal, @@ -2507,14 +2259,34 @@ extern "C" void MoveParticlesDevice(real* coordX, unsigned int numberOfParticles, unsigned int size_Mat, unsigned int numberOfThreads, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" void initRandomDevice(curandState* state, +void initRandomDevice(curandState* state, unsigned int size_Mat, unsigned int numberOfThreads); -extern "C" void generateRandomValuesDevice(curandState* state, +void generateRandomValuesDevice(curandState* state, unsigned int size_Mat, real* randArray, unsigned int numberOfThreads); +void CalcTurbulenceIntensityDevice( + real* vxx, + real* vyy, + real* vzz, + real* vxy, + real* vxz, + real* vyz, + real* vx_mean, + real* vy_mean, + real* vz_mean, + real* DD, + uint *typeOfGridNode, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep, + uint numberOfThreads); + +#endif diff --git a/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh b/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh index 288db43e7bcd36dc4d187982b86178d345601094..94b9704b7ca57df4cd985f5aff9521b8a087b97f 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh +++ b/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh @@ -1,7 +1,7 @@ // _ ___ __ __________ _ __ ______________ __ // | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ / ___/ __ / / / / // | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ / /___/ /_/ / / / / -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) / /_) / ____/ /__/ / +// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) / /_) / ____/ /__/ / // |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ \____/_/ \_____/ // ////////////////////////////////////////////////////////////////////////// @@ -11,19 +11,21 @@ //random numbers #include <curand.h> #include <curand_kernel.h> +#include <cuda.h> +#include <cuda_runtime.h> #include "LBM/LB.h" -extern "C" __global__ void LB_Kernel_Casc27(real s9, +__global__ void LB_Kernel_Casc27(real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, real* DDStart, int size_Mat, - bool EvenOrOdd); + bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_Casc_SP_27( real s9, +__global__ void LB_Kernel_Casc_SP_27( real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -32,7 +34,7 @@ extern "C" __global__ void LB_Kernel_Casc_SP_27( real s9, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_Casc_SP_MS_27( real s9, +__global__ void LB_Kernel_Casc_SP_MS_27( real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -41,7 +43,7 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_27( real s9, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_Casc_SP_MS_OHM_27( real s9, +__global__ void LB_Kernel_Casc_SP_MS_OHM_27( real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -50,7 +52,7 @@ extern "C" __global__ void LB_Kernel_Casc_SP_MS_OHM_27( real s9, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_Kum_New_Comp_SRT_SP_27( +__global__ void LB_Kernel_Kum_New_Comp_SRT_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -62,7 +64,7 @@ extern "C" __global__ void LB_Kernel_Kum_New_Comp_SRT_SP_27( real* forces, bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_Cumulant_D3Q27All4(real omega, +__global__ void LB_Kernel_Cumulant_D3Q27All4(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -73,8 +75,8 @@ extern "C" __global__ void LB_Kernel_Cumulant_D3Q27All4(real omega, real* forces, bool EvenOrOdd); - -extern "C" __global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, + +__global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -87,7 +89,7 @@ extern "C" __global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, -extern "C" __global__ void LB_Kernel_Kum_1h_SP_27( real omega, +__global__ void LB_Kernel_Kum_1h_SP_27( real omega, real deltaPhi, real angularVelocity, unsigned int* bcMatD, @@ -101,7 +103,7 @@ extern "C" __global__ void LB_Kernel_Kum_1h_SP_27( real omega, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_Cascade_SP_27( real s9, +__global__ void LB_Kernel_Cascade_SP_27( real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -110,7 +112,7 @@ extern "C" __global__ void LB_Kernel_Cascade_SP_27( real s9, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_Kum_New_SP_27( real s9, +__global__ void LB_Kernel_Kum_New_SP_27( real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -119,7 +121,7 @@ extern "C" __global__ void LB_Kernel_Kum_New_SP_27( real s9, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_Kum_IsoTest_SP_27( real omega, +__global__ void LB_Kernel_Kum_IsoTest_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -131,7 +133,7 @@ extern "C" __global__ void LB_Kernel_Kum_IsoTest_SP_27( real omega, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_Kum_Comp_SP_27(real s9, +__global__ void LB_Kernel_Kum_Comp_SP_27(real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -140,7 +142,7 @@ extern "C" __global__ void LB_Kernel_Kum_Comp_SP_27(real s9, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void Cumulant_One_preconditioned_errorDiffusion_chim_Comp_SP_27( +__global__ void Cumulant_One_preconditioned_errorDiffusion_chim_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -152,7 +154,7 @@ extern "C" __global__ void Cumulant_One_preconditioned_errorDiffusion_chim_Comp_ real* forces, bool EvenOrOdd); -extern "C" __global__ void Cumulant_One_preconditioned_chim_Comp_SP_27( +__global__ void Cumulant_One_preconditioned_chim_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -163,8 +165,8 @@ extern "C" __global__ void Cumulant_One_preconditioned_chim_Comp_SP_27( int level, real* forces, bool EvenOrOdd); - -extern "C" __global__ void Cumulant_One_chim_Comp_SP_27( + +__global__ void Cumulant_One_chim_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -186,7 +188,7 @@ inline __device__ void backwardChimeraWithK(real &mfa, real &mfb, real &mfc, rea -extern "C" __global__ void LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27( +__global__ void LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27( real omega_in, unsigned int* bcMatD, unsigned int* neighborX, @@ -204,7 +206,7 @@ extern "C" __global__ void LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27( bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_PM_Cum_One_Comp_SP_27( real omega, +__global__ void LB_Kernel_PM_Cum_One_Comp_SP_27( real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, @@ -219,7 +221,7 @@ extern "C" __global__ void LB_Kernel_PM_Cum_One_Comp_SP_27( real omega, unsigned int* nodeIdsPorousMedia, bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_AD_Incomp_7( real diffusivity, +__global__ void LB_Kernel_AD_Incomp_7( real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -229,7 +231,7 @@ extern "C" __global__ void LB_Kernel_AD_Incomp_7( real diffusivity, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LB_Kernel_AD_Incomp_27( real diffusivity, +__global__ void LB_Kernel_AD_Incomp_27( real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -239,7 +241,7 @@ extern "C" __global__ void LB_Kernel_AD_Incomp_27( real diffusivity, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LBInit27( int myid, +__global__ void LBInit27( int myid, int numprocs, real u0, unsigned int* geoD, @@ -248,14 +250,14 @@ extern "C" __global__ void LBInit27( int myid, unsigned int* neighborZ, real* vParabel, unsigned int size_Mat, - unsigned int grid_nx, - unsigned int grid_ny, - unsigned int grid_nz, + unsigned int grid_nx, + unsigned int grid_ny, + unsigned int grid_nz, real* DD, int lev, int maxlev); -extern "C" __global__ void LBInitNonEqPartSP27(unsigned int* neighborX, +__global__ void LBInitNonEqPartSP27(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* neighborWSB, @@ -269,7 +271,7 @@ extern "C" __global__ void LBInitNonEqPartSP27(unsigned int* neighborX, real omega, bool EvenOrOdd); -extern "C" __global__ void LBInitThS7( unsigned int* neighborX, +__global__ void InitAD7( unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, @@ -281,7 +283,7 @@ extern "C" __global__ void LBInitThS7( unsigned int* neighborX, real* DD7, bool EvenOrOdd); -extern "C" __global__ void LBInitThS27(unsigned int* neighborX, +__global__ void InitAD27(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, @@ -293,7 +295,7 @@ extern "C" __global__ void LBInitThS27(unsigned int* neighborX, real* DD27, bool EvenOrOdd); -extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg( +__global__ void LB_PostProcessor_F3_2018_Fehlberg( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -310,7 +312,7 @@ extern "C" __global__ void LB_PostProcessor_F3_2018_Fehlberg( real* forces, bool EvenOrOdd); -extern "C" __global__ void LBCalcMac27( real* vxD, +__global__ void LBCalcMac27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -320,9 +322,9 @@ extern "C" __global__ void LBCalcMac27( real* vxD, unsigned int* geoD, unsigned int size_Mat, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBCalcMacSP27( real* vxD, +__global__ void LBCalcMacSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -333,9 +335,9 @@ extern "C" __global__ void LBCalcMacSP27( real* vxD, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBCalcMacCompSP27( real* vxD, +__global__ void LBCalcMacCompSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -346,18 +348,18 @@ extern "C" __global__ void LBCalcMacCompSP27( real* vxD, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBCalcMacThS7( real* Conc, +__global__ void CalcConc7( real* Conc, unsigned int* geoD, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, real* DD7, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void GetPlaneConcThS7(real* Conc, +__global__ void GetPlaneConc7(real* Conc, int* kPC, unsigned int numberOfPointskPC, unsigned int* geoD, @@ -366,9 +368,9 @@ extern "C" __global__ void GetPlaneConcThS7(real* Conc, unsigned int* neighborZ, unsigned int size_Mat, real* DD7, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void GetPlaneConcThS27(real* Conc, +__global__ void GetPlaneConc27(real* Conc, int* kPC, unsigned int numberOfPointskPC, unsigned int* geoD, @@ -377,18 +379,18 @@ extern "C" __global__ void GetPlaneConcThS27(real* Conc, unsigned int* neighborZ, unsigned int size_Mat, real* DD27, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBCalcMacThS27(real* Conc, +__global__ void CalcConc27(real* Conc, unsigned int* geoD, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, real* DD27, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBCalcMedSP27( real* vxD, +__global__ void LBCalcMedSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -399,9 +401,9 @@ extern "C" __global__ void LBCalcMedSP27( real* vxD, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBCalcMedCompSP27( real* vxD, +__global__ void LBCalcMedCompSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -412,9 +414,9 @@ extern "C" __global__ void LBCalcMedCompSP27( real* vxD, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBCalcMedCompAD27( +__global__ void LBCalcMedCompAD27( real* vxD, real* vyD, real* vzD, @@ -428,9 +430,9 @@ extern "C" __global__ void LBCalcMedCompAD27( unsigned int size_Mat, real* DD, real* DD_AD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBCalcMacMedSP27( real* vxD, +__global__ void LBCalcMacMedSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -441,18 +443,18 @@ extern "C" __global__ void LBCalcMacMedSP27( real* vxD, unsigned int* neighborZ, unsigned int tdiff, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBResetMedianValuesSP27( +__global__ void LBResetMedianValuesSP27( real* vxD, real* vyD, real* vzD, real* rhoD, real* pressD, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBResetMedianValuesAD27( +__global__ void LBResetMedianValuesAD27( real* vxD, real* vyD, real* vzD, @@ -460,9 +462,9 @@ extern "C" __global__ void LBResetMedianValuesAD27( real* pressD, real* concD, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBCalc2ndMomentsIncompSP27( real* kxyFromfcNEQ, +__global__ void LBCalc2ndMomentsIncompSP27( real* kxyFromfcNEQ, real* kyzFromfcNEQ, real* kxzFromfcNEQ, real* kxxMyyFromfcNEQ, @@ -473,9 +475,9 @@ extern "C" __global__ void LBCalc2ndMomentsIncompSP27( real* kxyFromfcNEQ, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBCalc2ndMomentsCompSP27(real* kxyFromfcNEQ, +__global__ void LBCalc2ndMomentsCompSP27(real* kxyFromfcNEQ, real* kyzFromfcNEQ, real* kxzFromfcNEQ, real* kxxMyyFromfcNEQ, @@ -486,9 +488,9 @@ extern "C" __global__ void LBCalc2ndMomentsCompSP27(real* kxyFromfcNEQ, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LBCalc3rdMomentsIncompSP27( real* CUMbbb, +__global__ void LBCalc3rdMomentsIncompSP27( real* CUMbbb, real* CUMabc, real* CUMbac, real* CUMbca, @@ -503,7 +505,7 @@ extern "C" __global__ void LBCalc3rdMomentsIncompSP27( real* CUMbbb, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LBCalc3rdMomentsCompSP27(real* CUMbbb, +__global__ void LBCalc3rdMomentsCompSP27(real* CUMbbb, real* CUMabc, real* CUMbac, real* CUMbca, @@ -518,7 +520,7 @@ extern "C" __global__ void LBCalc3rdMomentsCompSP27(real* CUMbbb, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LBCalcHigherMomentsIncompSP27( real* CUMcbb, +__global__ void LBCalcHigherMomentsIncompSP27( real* CUMcbb, real* CUMbcb, real* CUMbbc, real* CUMcca, @@ -536,7 +538,7 @@ extern "C" __global__ void LBCalcHigherMomentsIncompSP27( real* CUMcbb, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LBCalcHigherMomentsCompSP27( real* CUMcbb, +__global__ void LBCalcHigherMomentsCompSP27( real* CUMcbb, real* CUMbcb, real* CUMbbc, real* CUMcca, @@ -554,7 +556,7 @@ extern "C" __global__ void LBCalcHigherMomentsCompSP27( real* CUMcbb, int size_Mat, bool EvenOrOdd); -extern "C" __global__ void LBCalcMeasurePoints(real* vxMP, +__global__ void LBCalcMeasurePoints(real* vxMP, real* vyMP, real* vzMP, real* rhoMP, @@ -568,159 +570,141 @@ extern "C" __global__ void LBCalcMeasurePoints(real* vxMP, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void LB_BC_Press_East27( int nx, - int ny, - int tz, - unsigned int* bcMatD, +__global__ void LB_BC_Press_East27( int nx, + int ny, + int tz, + unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - real* DD, - unsigned int size_Mat, - bool evenOrOdd) ; - -extern "C" __global__ void LB_BC_Vel_West_27( int nx, - int ny, - int nz, - int itz, - unsigned int* bcMatD, + real* DD, + unsigned int size_Mat, + bool isEvenTimestep) ; + +__global__ void LB_BC_Vel_West_27( int nx, + int ny, + int nz, + int itz, + unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - real* DD, - unsigned int size_Mat, - bool evenOrOdd, - real u0x, - unsigned int grid_nx, - unsigned int grid_ny, - real om); + real* DD, + unsigned int size_Mat, + bool isEvenTimestep, + real u0x, + unsigned int grid_nx, + unsigned int grid_ny, + real om); //no Slip BCs -extern "C" __global__ void QDevice27(int inx, - int iny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real minusomega, +__global__ void QDevice27(real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QDeviceComp27(int inx, - int iny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real minusomega, + unsigned int numberOfLBnodes, + bool isEvenTimestep); + +__global__ void QDeviceComp27( + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int numberOfLBnodes, + bool isEvenTimestep); -extern "C" __global__ void QDeviceCompThinWallsPartOne27(real* DD, - int* k_Q, +__global__ void QDeviceCompThinWallsPartOne27(real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QDevice3rdMomentsComp27( int inx, - int iny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real minusomega, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QDevice3rdMomentsComp27( real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int numberOfLBnodes, + bool isEvenTimestep); -extern "C" __global__ void QDeviceIncompHighNu27(int inx, - int iny, - real* DD, - int* k_Q, +__global__ void QDeviceIncompHighNu27(real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int numberOfLBnodes, + bool isEvenTimestep); -extern "C" __global__ void QDeviceCompHighNu27( int inx, - int iny, - real* DD, - int* k_Q, +__global__ void QDeviceCompHighNu27( real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); //Velocity BCs -extern "C" __global__ void QVelDevPlainBB27(real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QVelDevCouhette27(real* vx, +__global__ void QVelDevPlainBB27( + real* velocityX, + real* velocityY, + real* velocityZ, + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + uint numberOfBCnodes, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + uint numberOfLBnodes, + bool isEvenTimestep); + +__global__ void QVelDevCouette27(real* vx, real* vy, real* vz, real* DD, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QVelDev1h27( int inx, +__global__ void QVelDev1h27( int inx, int iny, real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, real Phi, real angularVelocity, @@ -730,156 +714,138 @@ extern "C" __global__ void QVelDev1h27( int inx, real* coordX, real* coordY, real* coordZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QVelDevice27(int inx, +__global__ void QVelDevice27(int inx, int iny, real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QVelDeviceCompPlusSlip27(int inx, - int iny, - real* vx, +__global__ void QVelDeviceCompPlusSlip27(real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QVelDeviceComp27(int inx, - int iny, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QVelDeviceComp27(real* velocityX, + real* velocityY, + real* velocityZ, + real* distribution, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int numberOfLBnodes, + bool isEvenTimestep); - -extern "C" __global__ void QVelDeviceCompThinWallsPartOne27( +__global__ void QVelDeviceCompThinWallsPartOne27( real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - uint sizeQ, - int kQ, + uint numberOfBCnodes, real om1, uint* neighborX, uint* neighborY, uint* neighborZ, uint size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void QThinWallsPartTwo27( +__global__ void QThinWallsPartTwo27( real* DD, int* k_Q, real* QQ, - uint sizeQ, - int kQ, + uint numberOfBCnodes, uint* geom, uint* neighborX, uint* neighborY, uint* neighborZ, uint* neighborWSB, uint size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QVelDeviceCompZeroPress27( int inx, - int iny, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - //int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); + +__global__ void QVelDeviceCompZeroPress27( + real* velocityX, + real* velocityY, + real* velocityZ, + real* distribution, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int numberOfLBnodes, + bool isEvenTimestep); -extern "C" __global__ void QVelDeviceIncompHighNu27(int inx, - int iny, - real* vx, +__global__ void QVelDeviceIncompHighNu27(real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QVelDeviceCompHighNu27( int inx, - int iny, - real* vx, +__global__ void QVelDeviceCompHighNu27( real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QVeloDeviceEQ27(real* VeloX, +__global__ void QVeloDeviceEQ27(real* VeloX, real* VeloY, real* VeloZ, - real* DD, - int* k_Q, - int kQ, - real om1, + real* DD, + int* k_Q, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QVeloStreetDeviceEQ27( +__global__ void QVeloStreetDeviceEQ27( real* veloXfraction, real* veloYfraction, int* naschVelo, @@ -891,516 +857,622 @@ extern "C" __global__ void QVeloStreetDeviceEQ27( uint* neighborY, uint* neighborZ, uint size_Mat, - bool evenOrOdd); + bool isEvenTimestep); //Slip BCs -extern "C" __global__ void QSlipDevice27(real* DD, - int* k_Q, +__global__ void QSlipDevice27(real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QSlipDeviceComp27(real* DD, - int* k_Q, +__global__ void QSlipDeviceComp27(real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QSlipDeviceComp27TurbViscosity( + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* turbViscosity, + unsigned int numberOfLBnodes, + bool isEvenTimestep); + +__global__ void QSlipPressureDeviceComp27TurbViscosity( + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* turbViscosity, + unsigned int numberOfLBnodes, + bool isEvenTimestep); -extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, - int* k_Q, +__global__ void QSlipGeomDeviceComp27(real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - real om1, + unsigned int numberOfBCnodes, + real om1, real* NormalX, real* NormalY, real* NormalZ, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QSlipNormDeviceComp27(real* DD, - int* k_Q, +__global__ void QSlipNormDeviceComp27(real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - real om1, + unsigned int numberOfBCnodes, + real om1, real* NormalX, real* NormalY, real* NormalZ, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); + +// Stress BCs (wall model) +__global__ void QStressDeviceComp27(real* DD, + int* k_Q, + int* k_N, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + real* turbViscosity, + real* vx, + real* vy, + real* vz, + real* normalX, + real* normalY, + real* normalZ, + real* vx_bc, + real* vy_bc, + real* vz_bc, + real* vx1, + real* vy1, + real* vz1, + int* samplingOffset, + real* z0, + bool hasWallModelMonitor, + real* u_star_monitor, + real* Fx_monitor, + real* Fy_monitor, + real* Fz_monitor, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void BBStressDevice27( real* DD, + int* k_Q, + int* k_N, + real* QQ, + unsigned int numberOfBCnodes, + real* vx, + real* vy, + real* vz, + real* normalX, + real* normalY, + real* normalZ, + real* vx_bc, + real* vy_bc, + real* vz_bc, + real* vx1, + real* vy1, + real* vz1, + int* samplingOffset, + real* z0, + bool hasWallModelMonitor, + real* u_star_monitor, + real* Fx_monitor, + real* Fy_monitor, + real* Fz_monitor, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void BBStressPressureDevice27( real* DD, + int* k_Q, + int* k_N, + real* QQ, + unsigned int numberOfBCnodes, + real* vx, + real* vy, + real* vz, + real* normalX, + real* normalY, + real* normalZ, + real* vx_el, + real* vy_el, + real* vz_el, + real* vx_w_mean, + real* vy_w_mean, + real* vz_w_mean, + int* samplingOffset, + real* z0, + bool hasWallModelMonitor, + real* u_star_monitor, + real* Fx_monitor, + real* Fy_monitor, + real* Fz_monitor, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep); //Pressure BCs -extern "C" __global__ void QPressDevice27(int inx, - int iny, - real* rhoBC, - real* DD, - int* k_Q, +__global__ void QPressDevice27( real* rhoBC, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QPressDeviceAntiBB27( real* rhoBC, +__global__ void QPressDeviceAntiBB27( real* rhoBC, real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - int kQ, - real om1, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QPressDeviceFixBackflow27( real* rhoBC, - real* DD, - int* k_Q, - int kQ, - real om1, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QPressDeviceFixBackflow27( real* rhoBC, + real* DD, + int* k_Q, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QPressDeviceDirDepBot27( real* rhoBC, - real* DD, - int* k_Q, - int kQ, - real om1, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QPressDeviceDirDepBot27( real* rhoBC, + real* DD, + int* k_Q, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QPressNoRhoDevice27( real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - int kQ, - real om1, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QPressNoRhoDevice27( real* rhoBC, + real* DD, + int* k_Q, + int* k_N, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QInflowScaleByPressDevice27( real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - int kQ, - real om1, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QInflowScaleByPressDevice27( real* rhoBC, + real* DD, + int* k_Q, + int* k_N, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QPressDeviceOld27(real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - int kQ, - real om1, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QPressDeviceOld27(real* rhoBC, + real* DD, + int* k_Q, + int* k_N, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QPressDeviceIncompNEQ27( real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - int kQ, - real om1, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QPressDeviceIncompNEQ27( real* rhoBC, + real* DD, + int* k_Q, + int* k_N, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QPressDeviceNEQ27(real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - int kQ, - real om1, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QPressDeviceNEQ27(real* rhoBC, + real* distribution, + int* bcNodeIndices, + int* bcNeighborIndices, + int numberOfBCnodes, + real omega1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QPressDeviceEQZ27(real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - real* kTestRE, - int kQ, - real om1, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QPressDeviceEQZ27(real* rhoBC, + real* DD, + int* k_Q, + int* k_N, + real* kTestRE, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QPressDeviceZero27( real* DD, - int* k_Q, - unsigned int kQ, +__global__ void QPressDeviceZero27( real* DD, + int* k_Q, + unsigned int numberOfBCnodes, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QPressDeviceFake27(real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - int kQ, - real om1, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QPressDeviceFake27(real* rhoBC, + real* DD, + int* k_Q, + int* k_N, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void BBDevice27(int inx, - int iny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void BBDevice27(real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int numberOfLBnodes, + bool isEvenTimestep); -extern "C" __global__ void QPressDevice27_IntBB(real* rho, - real* DD, - int* k_Q, +__global__ void QPressDevice27_IntBB(real* rho, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); +// TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 //Schlaffer BCs -extern "C" __global__ void PressSchlaff27(real* rhoBC, +__global__ void PressSchlaff27(real* rhoBC, real* DD, real* vx0, real* vy0, real* vz0, real* deltaVz0, - int* k_Q, - int* k_N, - int kQ, - real om1, + int* k_Q, + int* k_N, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void VelSchlaff27( int t, +// TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 +__global__ void VelSchlaff27( int t, real* DD, real* vz0, real* deltaVz0, - int* k_Q, - int* k_N, - int kQ, - real om1, + int* k_Q, + int* k_N, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); //Advection / Diffusion BCs -extern "C" __global__ void QAD7( int inx, - int iny, - real* DD, - real* DD7, +__global__ void QAD7( real* DD, + real* DD7, real* temp, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QADDirichlet27( int inx, - int iny, - real* DD, - real* DD27, - real* temp, + unsigned int size_Mat, + bool isEvenTimestep); + +////////////////////////////////////////////////////////////////////////// +//! \brief \ref Advection_Diffusion_Device_Kernel : Factorized central moments for Advection Diffusion Equation +__global__ void Factorized_Central_Moments_Advection_Diffusion_Device_Kernel( + real omegaDiffusivity, + uint* typeOfGridNode, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + real* distributions, + real* distributionsAD, + int size_Mat, + real* forces, + bool isEvenTimestep); + +////////////////////////////////////////////////////////////////////////// +//! \brief \ref AD_SlipVelDeviceComp : device function for the slip-AD boundary condition +__global__ void AD_SlipVelDeviceComp( + real * normalX, + real * normalY, + real * normalZ, + real * distributions, + real * distributionsAD, + int* QindexArray, + real * Qarrays, + uint numberOfBCnodes, + real omegaDiffusivity, + uint * neighborX, + uint * neighborY, + uint * neighborZ, + uint size_Mat, + bool isEvenTimestep); + +__global__ void QADDirichlet27( real* DD, + real* DD27, + real* temp, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QADBB27( int inx, - int iny, - real* DD, - real* DD27, - real* temp, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QADBB27( real* DD, + real* DD27, + real* temp, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QADVel7( int inx, - int iny, - real* DD, - real* DD7, +__global__ void QADVel7( real* DD, + real* DD7, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QADVel27(int inx, - int iny, - real* DD, - real* DD27, - real* temp, - real* velo, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QADVel27(real* DD, + real* DD27, + real* temp, + real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QADPress7( int inx, - int iny, - real* DD, - real* DD7, +__global__ void QADPress7( real* DD, + real* DD7, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QADPress27( int inx, - int iny, - real* DD, - real* DD27, - real* temp, - real* velo, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QADPress27( real* DD, + real* DD27, + real* temp, + real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QADPressNEQNeighbor27( +__global__ void QADPressNEQNeighbor27( real* DD, real* DD27, int* k_Q, int* k_N, - int kQ, + int numberOfBCnodes, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd + bool isEvenTimestep ); -extern "C" __global__ void QNoSlipADincomp7( int inx, - int iny, - real* DD, - real* DD7, +__global__ void QNoSlipADincomp7( real* DD, + real* DD7, real* temp, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QNoSlipADincomp27(int inx, - int iny, - real* DD, - real* DD27, - real* temp, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QNoSlipADincomp27( real* DD, + real* DD27, + real* temp, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QADVeloIncomp7( int inx, - int iny, - real* DD, - real* DD7, +__global__ void QADVeloIncomp7( real* DD, + real* DD7, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QADVeloIncomp27( int inx, - int iny, - real* DD, - real* DD27, - real* temp, - real* velo, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QADVeloIncomp27( real* DD, + real* DD27, + real* temp, + real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void QADPressIncomp7(int inx, - int iny, - real* DD, - real* DD7, +__global__ void QADPressIncomp7(real* DD, + real* DD7, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); - -extern "C" __global__ void QADPressIncomp27( int inx, - int iny, - real* DD, - real* DD27, - real* temp, - real* velo, + unsigned int size_Mat, + bool isEvenTimestep); + +__global__ void QADPressIncomp27( real* DD, + real* DD27, + real* temp, + real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); //Propeller BC -extern "C" __global__ void PropellerBC(unsigned int* neighborX, +__global__ void PropellerBC(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, real* rho, real* ux, real* uy, real* uz, - int* k_Q, + int* k_Q, unsigned int size_Prop, unsigned int size_Mat, unsigned int* bcMatD, @@ -1410,167 +1482,167 @@ extern "C" __global__ void PropellerBC(unsigned int* neighborX, //coarse to fine -extern "C" __global__ void scaleCF27(real* DC, - real* DF, +__global__ void scaleCF27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF); -extern "C" __global__ void scaleCFEff27(real* DC, - real* DF, +__global__ void scaleCFEff27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCFLast27( real* DC, - real* DF, +__global__ void scaleCFLast27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCFpress27(real* DC, - real* DF, +__global__ void scaleCFpress27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCF_Fix_27(real* DC, - real* DF, +__global__ void scaleCF_Fix_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCF_Fix_comp_27( real* DC, - real* DF, +__global__ void scaleCF_Fix_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCF_0817_comp_27( real* DC, - real* DF, +__global__ void scaleCF_0817_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCF_comp_D3Q27F3_2018( real* DC, +__global__ void scaleCF_comp_D3Q27F3_2018( real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -1579,22 +1651,22 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018( real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, +__global__ void scaleCF_comp_D3Q27F3( real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -1603,358 +1675,377 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCF_staggered_time_comp_27(real* DC, - real* DF, +__global__ void scaleCF_staggered_time_comp_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCF_RhoSq_comp_27( real* DC, - real* DF, +__global__ void scaleCF_RhoSq_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCF_RhoSq_3rdMom_comp_27(real* DC, - real* DF, +__global__ void scaleCF_compressible( + real* distributionsCoarse, + real* distributionsFine, + unsigned int* neighborXcoarse, + unsigned int* neighborYcoarse, + unsigned int* neighborZcoarse, + unsigned int* neighborXfine, + unsigned int* neighborYfine, + unsigned int* neighborZfine, + unsigned int numberOfLBnodesCoarse, + unsigned int numberOfLBnodesFine, + bool isEvenTimestep, + unsigned int* indicesCoarseMMM, + unsigned int* indicesFineMMM, + unsigned int numberOfInterfaceNodes, + real omegaCoarse, + real omegaFine, + OffCF offsetCF); + +__global__ void scaleCF_RhoSq_3rdMom_comp_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCF_AA2016_comp_27(real* DC, - real* DF, +__global__ void scaleCF_AA2016_comp_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCF_NSPress_27(real* DC, - real* DF, +__global__ void scaleCF_NSPress_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffCF offCF); -extern "C" __global__ void scaleCFThSMG7( real* DC, +__global__ void scaleCFThSMG7( real* DC, real* DF, - real* DD7C, - real* DD7F, + real* DD7C, + real* DD7F, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, real nu, real diffusivity_fine, OffCF offCF); -extern "C" __global__ void scaleCFThS7(real* DC, +__global__ void scaleCFThS7(real* DC, real* DF, - real* DD7C, - real* DD7F, + real* DD7C, + real* DD7F, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, real nu, real diffusivity_fine); -extern "C" __global__ void scaleCFThS27(real* DC, +__global__ void scaleCFThS27(real* DC, real* DF, - real* DD27C, - real* DD27F, + real* DD27C, + real* DD27F, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, real nu, real diffusivity_fine, OffCF offCF); -//fine to coarse -extern "C" __global__ void scaleFC27(real* DC, - real* DF, +//fine to coarse +__global__ void scaleFC27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF); -extern "C" __global__ void scaleFCEff27(real* DC, - real* DF, +__global__ void scaleFCEff27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFCLast27( real* DC, - real* DF, +__global__ void scaleFCLast27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFCpress27( real* DC, - real* DF, +__global__ void scaleFCpress27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFC_Fix_27( real* DC, - real* DF, +__global__ void scaleFC_Fix_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFC_Fix_comp_27( real* DC, - real* DF, +__global__ void scaleFC_Fix_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFC_0817_comp_27( real* DC, - real* DF, +__global__ void scaleFC_0817_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFC_comp_D3Q27F3_2018( real* DC, +__global__ void scaleFC_comp_D3Q27F3_2018( real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -1963,22 +2054,22 @@ extern "C" __global__ void scaleFC_comp_D3Q27F3_2018( real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFC_comp_D3Q27F3( real* DC, +__global__ void scaleFC_comp_D3Q27F3( real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -1987,273 +2078,292 @@ extern "C" __global__ void scaleFC_comp_D3Q27F3( real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFC_staggered_time_comp_27(real* DC, - real* DF, +__global__ void scaleFC_staggered_time_comp_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFC_RhoSq_comp_27( real* DC, - real* DF, +__global__ void scaleFC_RhoSq_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFC_RhoSq_3rdMom_comp_27(real* DC, - real* DF, +__global__ void scaleFC_compressible( + real *distributionsCoarse, + real *distributionsFine, + unsigned int *neighborXcoarse, + unsigned int *neighborYcoarse, + unsigned int *neighborZcoarse, + unsigned int *neighborXfine, + unsigned int *neighborYfine, + unsigned int *neighborZfine, + unsigned int numberOfLBnodesCoarse, + unsigned int numberOfLBnodesFine, + bool isEvenTimestep, + unsigned int *indicesCoarse000, + unsigned int *indicesFineMMM, + unsigned int numberOfInterfaceNodes, + real omegaCoarse, + real omegaFine, + OffFC offsetFC); + +__global__ void scaleFC_RhoSq_3rdMom_comp_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFC_AA2016_comp_27(real* DC, - real* DF, +__global__ void scaleFC_AA2016_comp_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFC_NSPress_27(real* DC, - real* DF, +__global__ void scaleFC_NSPress_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC); -extern "C" __global__ void scaleFCThSMG7( real* DC, - real* DF, - real* DD7C, - real* DD7F, +__global__ void scaleFCThSMG7( real* DC, + real* DF, + real* DD7C, + real* DD7F, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, real nu, real diffusivity_coarse, OffFC offFC); -extern "C" __global__ void scaleFCThS7(real* DC, - real* DF, - real* DD7C, - real* DD7F, +__global__ void scaleFCThS7(real* DC, + real* DF, + real* DD7C, + real* DD7F, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, real nu, real diffusivity_coarse); -extern "C" __global__ void scaleFCThS27( real* DC, - real* DF, - real* DD27C, - real* DD27F, +__global__ void scaleFCThS27( real* DC, + real* DF, + real* DD27C, + real* DD27F, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, real nu, real diffusivity_coarse, OffFC offFC); -extern "C" __global__ void DragLiftPost27( real* DD, - int* k_Q, +__global__ void DragLiftPost27( real* DD, + int* k_Q, real* QQ, - int kQ, + int numberOfBCnodes, double *DragX, double *DragY, double *DragZ, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void DragLiftPre27( real* DD, - int* k_Q, +__global__ void DragLiftPre27( real* DD, + int* k_Q, real* QQ, - int kQ, + int numberOfBCnodes, double *DragX, double *DragY, double *DragZ, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void CalcCP27(real* DD, - int* cpIndex, - int nonCp, +__global__ void CalcCP27(real* DD, + int* cpIndex, + int nonCp, double *cpPress, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void getSendFsPre27(real* DD, +__global__ void getSendFsPre27(real* DD, real* bufferFs, int* sendIndex, int buffmax, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void getSendFsPost27(real* DD, +__global__ void getSendFsPost27(real* DD, real* bufferFs, int* sendIndex, int buffmax, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void setRecvFsPre27(real* DD, +__global__ void setRecvFsPre27(real* DD, real* bufferFs, int* recvIndex, int buffmax, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void setRecvFsPost27(real* DD, +__global__ void setRecvFsPost27(real* DD, real* bufferFs, int* recvIndex, int buffmax, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void getSendGsF3( +__global__ void getSendGsF3( real* G6, real* bufferGs, int* sendIndex, @@ -2262,9 +2372,9 @@ extern "C" __global__ void getSendGsF3( unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void setRecvGsF3( +__global__ void setRecvGsF3( real* G6, real* bufferGs, int* recvIndex, @@ -2273,33 +2383,30 @@ extern "C" __global__ void setRecvGsF3( unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void WallFunction27( int inx, - int iny, - real* vx, +__global__ void WallFunction27( real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void LBSetOutputWallVelocitySP27( real* vxD, +__global__ void LBSetOutputWallVelocitySP27( real* vxD, real* vyD, real* vzD, real* vxWall, real* vyWall, real* vzWall, - int numberOfWallNodes, - int* kWallNodes, + int numberOfWallNodes, + int* kWallNodes, real* rhoD, real* pressD, unsigned int* geoD, @@ -2308,26 +2415,26 @@ extern "C" __global__ void LBSetOutputWallVelocitySP27( real* vxD, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void GetVeloforForcing27( real* DD, - int* bcIndex, - int nonAtBC, +__global__ void GetVeloforForcing27( real* DD, + int* bcIndex, + int nonAtBC, real* Vx, real* Vy, real* Vz, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd); + unsigned int size_Mat, + bool isEvenTimestep); -extern "C" __global__ void InitParticles( real* coordX, +__global__ void InitParticles( real* coordX, real* coordY, - real* coordZ, + real* coordZ, real* coordParticleXlocal, real* coordParticleYlocal, - real* coordParticleZlocal, + real* coordParticleZlocal, real* coordParticleXglobal, real* coordParticleYglobal, real* coordParticleZglobal, @@ -2343,12 +2450,12 @@ extern "C" __global__ void InitParticles( real* coordX, unsigned int* neighborZ, unsigned int* neighborWSB, int level, - unsigned int numberOfParticles, + unsigned int numberOfParticles, unsigned int size_Mat); -extern "C" __global__ void MoveParticles( real* coordX, +__global__ void MoveParticles( real* coordX, real* coordY, - real* coordZ, + real* coordZ, real* coordParticleXlocal, real* coordParticleYlocal, real* coordParticleZlocal, @@ -2368,15 +2475,15 @@ extern "C" __global__ void MoveParticles( real* coordX, unsigned int* neighborZ, unsigned int* neighborWSB, int level, - unsigned int timestep, - unsigned int numberOfTimesteps, - unsigned int numberOfParticles, + unsigned int timestep, + unsigned int numberOfTimesteps, + unsigned int numberOfParticles, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void MoveParticlesWithoutBCs( real* coordX, +__global__ void MoveParticlesWithoutBCs( real* coordX, real* coordY, - real* coordZ, + real* coordZ, real* coordParticleXlocal, real* coordParticleYlocal, real* coordParticleZlocal, @@ -2396,17 +2503,33 @@ extern "C" __global__ void MoveParticlesWithoutBCs( real* coordX, unsigned int* neighborZ, unsigned int* neighborWSB, int level, - unsigned int timestep, - unsigned int numberOfTimesteps, - unsigned int numberOfParticles, + unsigned int timestep, + unsigned int numberOfTimesteps, + unsigned int numberOfParticles, unsigned int size_Mat, - bool evenOrOdd); + bool isEvenTimestep); -extern "C" __global__ void initRandom(curandState* state); +__global__ void initRandom(curandState* state); -extern "C" __global__ void generateRandomValues(curandState* state, +__global__ void generateRandomValues(curandState* state, real* randArray); +__global__ void CalcTurbulenceIntensity( + real* vxx, + real* vyy, + real* vzz, + real* vxy, + real* vxz, + real* vyz, + real* vx_mean, + real* vy_mean, + real* vz_mean, + real* DD, + uint *typeOfGridNode, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep); #endif - \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/GPU/GeometryUtils.h b/src/gpu/VirtualFluids_GPU/GPU/GeometryUtils.h index da438ab0fdb04c8a83bd37700b4e4735970bcd7d..4dbf525e173c4acb00ff53e70f7485852bf956ac 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/GeometryUtils.h +++ b/src/gpu/VirtualFluids_GPU/GPU/GeometryUtils.h @@ -1,7 +1,7 @@ #ifndef _GEOMETRYUTILS_H #define _GEOMETRYUTILS_H -__inline__ __host__ __device__ void getNeighborIndicesOfBSW( uint k, //index of BSW node +__inline__ __host__ __device__ void getNeighborIndicesOfBSW( uint k, //index of DIR_MMM node uint &ke, uint &kn, uint &kt, uint &kne, uint &kte,uint &ktn, uint &ktne, uint* neighborX, uint* neighborY, uint* neighborZ) { diff --git a/src/gpu/VirtualFluids_GPU/GPU/ScaleCF27.cu b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleCF27.cu similarity index 96% rename from src/gpu/VirtualFluids_GPU/GPU/ScaleCF27.cu rename to src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleCF27.cu index 8be2edf3eecb512623572f925b20d0dd8682585d..619d68c87d7a707e70be4c56d434191994144148 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/ScaleCF27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleCF27.cu @@ -7,13 +7,14 @@ ////////////////////////////////////////////////////////////////////////// /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCF_0817_comp_27( real* DC, +__global__ void scaleCF_0817_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -23,7 +24,7 @@ extern "C" __global__ void scaleCF_0817_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -42,98 +43,98 @@ extern "C" __global__ void scaleCF_0817_comp_27( real* DC, *f000dest, *fMMMdest, *fMMPdest, *fMPPdest, *fMPMdest, *fPPMdest, *fPPPdest, *fPMPdest, *fPMMdest; - fP00dest = &DF[dirE *size_MatF]; - fM00dest = &DF[dirW *size_MatF]; - f0P0dest = &DF[dirN *size_MatF]; - f0M0dest = &DF[dirS *size_MatF]; - f00Pdest = &DF[dirT *size_MatF]; - f00Mdest = &DF[dirB *size_MatF]; - fPP0dest = &DF[dirNE *size_MatF]; - fMM0dest = &DF[dirSW *size_MatF]; - fPM0dest = &DF[dirSE *size_MatF]; - fMP0dest = &DF[dirNW *size_MatF]; - fP0Pdest = &DF[dirTE *size_MatF]; - fM0Mdest = &DF[dirBW *size_MatF]; - fP0Mdest = &DF[dirBE *size_MatF]; - fM0Pdest = &DF[dirTW *size_MatF]; - f0PPdest = &DF[dirTN *size_MatF]; - f0MMdest = &DF[dirBS *size_MatF]; - f0PMdest = &DF[dirBN *size_MatF]; - f0MPdest = &DF[dirTS *size_MatF]; - f000dest = &DF[dirZERO*size_MatF]; - fMMMdest = &DF[dirBSW *size_MatF]; - fMMPdest = &DF[dirTSW *size_MatF]; - fMPPdest = &DF[dirTNW *size_MatF]; - fMPMdest = &DF[dirBNW *size_MatF]; - fPPMdest = &DF[dirBNE *size_MatF]; - fPPPdest = &DF[dirTNE *size_MatF]; - fPMPdest = &DF[dirTSE *size_MatF]; - fPMMdest = &DF[dirBSE *size_MatF]; + fP00dest = &DF[DIR_P00 *size_MatF]; + fM00dest = &DF[DIR_M00 *size_MatF]; + f0P0dest = &DF[DIR_0P0 *size_MatF]; + f0M0dest = &DF[DIR_0M0 *size_MatF]; + f00Pdest = &DF[DIR_00P *size_MatF]; + f00Mdest = &DF[DIR_00M *size_MatF]; + fPP0dest = &DF[DIR_PP0 *size_MatF]; + fMM0dest = &DF[DIR_MM0 *size_MatF]; + fPM0dest = &DF[DIR_PM0 *size_MatF]; + fMP0dest = &DF[DIR_MP0 *size_MatF]; + fP0Pdest = &DF[DIR_P0P *size_MatF]; + fM0Mdest = &DF[DIR_M0M *size_MatF]; + fP0Mdest = &DF[DIR_P0M *size_MatF]; + fM0Pdest = &DF[DIR_M0P *size_MatF]; + f0PPdest = &DF[DIR_0PP *size_MatF]; + f0MMdest = &DF[DIR_0MM *size_MatF]; + f0PMdest = &DF[DIR_0PM *size_MatF]; + f0MPdest = &DF[DIR_0MP *size_MatF]; + f000dest = &DF[DIR_000*size_MatF]; + fMMMdest = &DF[DIR_MMM *size_MatF]; + fMMPdest = &DF[DIR_MMP *size_MatF]; + fMPPdest = &DF[DIR_MPP *size_MatF]; + fMPMdest = &DF[DIR_MPM *size_MatF]; + fPPMdest = &DF[DIR_PPM *size_MatF]; + fPPPdest = &DF[DIR_PPP *size_MatF]; + fPMPdest = &DF[DIR_PMP *size_MatF]; + fPMMdest = &DF[DIR_PMM *size_MatF]; real *fP00source, *fM00source, *f0P0source, *f0M0source, *f00Psource, *f00Msource, *fPP0source, *fMM0source, *fPM0source, *fMP0source, *fP0Psource, *fM0Msource, *fP0Msource, *fM0Psource, *f0PPsource, *f0MMsource, *f0PMsource, *f0MPsource, *f000source, *fMMMsource, *fMMPsource, *fMPPsource, *fMPMsource, *fPPMsource, *fPPPsource, *fPMPsource, *fPMMsource; - if (evenOrOdd == true) + if (isEvenTimestep == true) { - fP00source = &DC[dirE *size_MatC]; - fM00source = &DC[dirW *size_MatC]; - f0P0source = &DC[dirN *size_MatC]; - f0M0source = &DC[dirS *size_MatC]; - f00Psource = &DC[dirT *size_MatC]; - f00Msource = &DC[dirB *size_MatC]; - fPP0source = &DC[dirNE *size_MatC]; - fMM0source = &DC[dirSW *size_MatC]; - fPM0source = &DC[dirSE *size_MatC]; - fMP0source = &DC[dirNW *size_MatC]; - fP0Psource = &DC[dirTE *size_MatC]; - fM0Msource = &DC[dirBW *size_MatC]; - fP0Msource = &DC[dirBE *size_MatC]; - fM0Psource = &DC[dirTW *size_MatC]; - f0PPsource = &DC[dirTN *size_MatC]; - f0MMsource = &DC[dirBS *size_MatC]; - f0PMsource = &DC[dirBN *size_MatC]; - f0MPsource = &DC[dirTS *size_MatC]; - f000source = &DC[dirZERO*size_MatC]; - fMMMsource = &DC[dirBSW *size_MatC]; - fMMPsource = &DC[dirTSW *size_MatC]; - fMPPsource = &DC[dirTNW *size_MatC]; - fMPMsource = &DC[dirBNW *size_MatC]; - fPPMsource = &DC[dirBNE *size_MatC]; - fPPPsource = &DC[dirTNE *size_MatC]; - fPMPsource = &DC[dirTSE *size_MatC]; - fPMMsource = &DC[dirBSE *size_MatC]; + fP00source = &DC[DIR_P00 *size_MatC]; + fM00source = &DC[DIR_M00 *size_MatC]; + f0P0source = &DC[DIR_0P0 *size_MatC]; + f0M0source = &DC[DIR_0M0 *size_MatC]; + f00Psource = &DC[DIR_00P *size_MatC]; + f00Msource = &DC[DIR_00M *size_MatC]; + fPP0source = &DC[DIR_PP0 *size_MatC]; + fMM0source = &DC[DIR_MM0 *size_MatC]; + fPM0source = &DC[DIR_PM0 *size_MatC]; + fMP0source = &DC[DIR_MP0 *size_MatC]; + fP0Psource = &DC[DIR_P0P *size_MatC]; + fM0Msource = &DC[DIR_M0M *size_MatC]; + fP0Msource = &DC[DIR_P0M *size_MatC]; + fM0Psource = &DC[DIR_M0P *size_MatC]; + f0PPsource = &DC[DIR_0PP *size_MatC]; + f0MMsource = &DC[DIR_0MM *size_MatC]; + f0PMsource = &DC[DIR_0PM *size_MatC]; + f0MPsource = &DC[DIR_0MP *size_MatC]; + f000source = &DC[DIR_000*size_MatC]; + fMMMsource = &DC[DIR_MMM *size_MatC]; + fMMPsource = &DC[DIR_MMP *size_MatC]; + fMPPsource = &DC[DIR_MPP *size_MatC]; + fMPMsource = &DC[DIR_MPM *size_MatC]; + fPPMsource = &DC[DIR_PPM *size_MatC]; + fPPPsource = &DC[DIR_PPP *size_MatC]; + fPMPsource = &DC[DIR_PMP *size_MatC]; + fPMMsource = &DC[DIR_PMM *size_MatC]; } else { - fP00source = &DC[dirW *size_MatC]; - fM00source = &DC[dirE *size_MatC]; - f0P0source = &DC[dirS *size_MatC]; - f0M0source = &DC[dirN *size_MatC]; - f00Psource = &DC[dirB *size_MatC]; - f00Msource = &DC[dirT *size_MatC]; - fPP0source = &DC[dirSW *size_MatC]; - fMM0source = &DC[dirNE *size_MatC]; - fPM0source = &DC[dirNW *size_MatC]; - fMP0source = &DC[dirSE *size_MatC]; - fP0Psource = &DC[dirBW *size_MatC]; - fM0Msource = &DC[dirTE *size_MatC]; - fP0Msource = &DC[dirTW *size_MatC]; - fM0Psource = &DC[dirBE *size_MatC]; - f0PPsource = &DC[dirBS *size_MatC]; - f0MMsource = &DC[dirTN *size_MatC]; - f0PMsource = &DC[dirTS *size_MatC]; - f0MPsource = &DC[dirBN *size_MatC]; - f000source = &DC[dirZERO*size_MatC]; - fMMMsource = &DC[dirTNE *size_MatC]; - fMMPsource = &DC[dirBNE *size_MatC]; - fMPPsource = &DC[dirBSE *size_MatC]; - fMPMsource = &DC[dirTSE *size_MatC]; - fPPMsource = &DC[dirTSW *size_MatC]; - fPPPsource = &DC[dirBSW *size_MatC]; - fPMPsource = &DC[dirBNW *size_MatC]; - fPMMsource = &DC[dirTNW *size_MatC]; + fP00source = &DC[DIR_M00 *size_MatC]; + fM00source = &DC[DIR_P00 *size_MatC]; + f0P0source = &DC[DIR_0M0 *size_MatC]; + f0M0source = &DC[DIR_0P0 *size_MatC]; + f00Psource = &DC[DIR_00M *size_MatC]; + f00Msource = &DC[DIR_00P *size_MatC]; + fPP0source = &DC[DIR_MM0 *size_MatC]; + fMM0source = &DC[DIR_PP0 *size_MatC]; + fPM0source = &DC[DIR_MP0 *size_MatC]; + fMP0source = &DC[DIR_PM0 *size_MatC]; + fP0Psource = &DC[DIR_M0M *size_MatC]; + fM0Msource = &DC[DIR_P0P *size_MatC]; + fP0Msource = &DC[DIR_M0P *size_MatC]; + fM0Psource = &DC[DIR_P0M *size_MatC]; + f0PPsource = &DC[DIR_0MM *size_MatC]; + f0MMsource = &DC[DIR_0PP *size_MatC]; + f0PMsource = &DC[DIR_0MP *size_MatC]; + f0MPsource = &DC[DIR_0PM *size_MatC]; + f000source = &DC[DIR_000*size_MatC]; + fMMMsource = &DC[DIR_PPP *size_MatC]; + fMMPsource = &DC[DIR_PPM *size_MatC]; + fMPPsource = &DC[DIR_PMM *size_MatC]; + fMPMsource = &DC[DIR_PMP *size_MatC]; + fPPMsource = &DC[DIR_MMP *size_MatC]; + fPPPsource = &DC[DIR_MMM *size_MatC]; + fPMPsource = &DC[DIR_MPM *size_MatC]; + fPMMsource = &DC[DIR_MPP *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -4082,7 +4083,7 @@ extern "C" __global__ void scaleCF_0817_comp_27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCF_AA2016_comp_27(real* DC, +__global__ void scaleCF_AA2016_comp_27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -4092,7 +4093,7 @@ extern "C" __global__ void scaleCF_AA2016_comp_27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -4108,96 +4109,96 @@ extern "C" __global__ void scaleCF_AA2016_comp_27(real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -10965,7 +10966,7 @@ extern "C" __global__ void scaleCF_AA2016_comp_27(real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCF_RhoSq_3rdMom_comp_27(real* DC, +__global__ void scaleCF_RhoSq_3rdMom_comp_27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -10975,7 +10976,7 @@ extern "C" __global__ void scaleCF_RhoSq_3rdMom_comp_27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -10991,96 +10992,96 @@ extern "C" __global__ void scaleCF_RhoSq_3rdMom_comp_27(real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -17840,7 +17841,7 @@ extern "C" __global__ void scaleCF_RhoSq_3rdMom_comp_27(real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, +__global__ void scaleCF_RhoSq_comp_27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -17850,7 +17851,7 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -17866,96 +17867,96 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -18064,7 +18065,11 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; - drho_SWB = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; + drho_SWB = ((((f_TNE + f_BSW) + (f_TSE + f_BNW)) + ((f_TNW + f_BSE) + (f_TSW + f_BNE))) + + (((f_TS + f_BN) + (f_BS + f_TN)) + ((f_TW + f_BE) + (f_TE + f_BW)) + + ((f_NW + f_SE) + (f_NE + f_SW))) + + ((f_W + f_E) + (f_S + f_N) + (f_B + f_T))) + + f_ZERO; vx1_SWB = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_SWB); vx2_SWB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_SWB); vx3_SWB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_SWB); @@ -18116,7 +18121,11 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; - drho_SWT = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; + drho_SWT = ((((f_TNE + f_BSW) + (f_TSE + f_BNW)) + ((f_TNW + f_BSE) + (f_TSW + f_BNE))) + + (((f_TS + f_BN) + (f_BS + f_TN)) + ((f_TW + f_BE) + (f_TE + f_BW)) + + ((f_NW + f_SE) + (f_NE + f_SW))) + + ((f_W + f_E) + (f_S + f_N) + (f_B + f_T))) + + f_ZERO; vx1_SWT = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_SWT); vx2_SWT = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_SWT); vx3_SWT = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_SWT); @@ -18168,7 +18177,11 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; - drho_SET = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; + drho_SET = ((((f_TNE + f_BSW) + (f_TSE + f_BNW)) + ((f_TNW + f_BSE) + (f_TSW + f_BNE))) + + (((f_TS + f_BN) + (f_BS + f_TN)) + ((f_TW + f_BE) + (f_TE + f_BW)) + + ((f_NW + f_SE) + (f_NE + f_SW))) + + ((f_W + f_E) + (f_S + f_N) + (f_B + f_T))) + + f_ZERO; vx1_SET = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_SET); vx2_SET = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_SET); vx3_SET = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_SET); @@ -18220,7 +18233,11 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; - drho_SEB = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; + drho_SEB = ((((f_TNE + f_BSW) + (f_TSE + f_BNW)) + ((f_TNW + f_BSE) + (f_TSW + f_BNE))) + + (((f_TS + f_BN) + (f_BS + f_TN)) + ((f_TW + f_BE) + (f_TE + f_BW)) + + ((f_NW + f_SE) + (f_NE + f_SW))) + + ((f_W + f_E) + (f_S + f_N) + (f_B + f_T))) + + f_ZERO; vx1_SEB = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_SEB); vx2_SEB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_SEB); vx3_SEB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_SEB); @@ -18282,7 +18299,11 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; - drho_NWB = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; + drho_NWB = ((((f_TNE + f_BSW) + (f_TSE + f_BNW)) + ((f_TNW + f_BSE) + (f_TSW + f_BNE))) + + (((f_TS + f_BN) + (f_BS + f_TN)) + ((f_TW + f_BE) + (f_TE + f_BW)) + + ((f_NW + f_SE) + (f_NE + f_SW))) + + ((f_W + f_E) + (f_S + f_N) + (f_B + f_T))) + + f_ZERO; vx1_NWB = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_NWB); vx2_NWB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_NWB); vx3_NWB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_NWB); @@ -18334,7 +18355,11 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; - drho_NWT = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; + drho_NWT = ((((f_TNE + f_BSW) + (f_TSE + f_BNW)) + ((f_TNW + f_BSE) + (f_TSW + f_BNE))) + + (((f_TS + f_BN) + (f_BS + f_TN)) + ((f_TW + f_BE) + (f_TE + f_BW)) + + ((f_NW + f_SE) + (f_NE + f_SW))) + + ((f_W + f_E) + (f_S + f_N) + (f_B + f_T))) + + f_ZERO; vx1_NWT = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_NWT); vx2_NWT = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_NWT); vx3_NWT = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_NWT); @@ -18386,7 +18411,11 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; - drho_NET = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; + drho_NET = ((((f_TNE + f_BSW) + (f_TSE + f_BNW)) + ((f_TNW + f_BSE) + (f_TSW + f_BNE))) + + (((f_TS + f_BN) + (f_BS + f_TN)) + ((f_TW + f_BE) + (f_TE + f_BW)) + + ((f_NW + f_SE) + (f_NE + f_SW))) + + ((f_W + f_E) + (f_S + f_N) + (f_B + f_T))) + + f_ZERO; vx1_NET = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_NET); vx2_NET = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_NET); vx3_NET = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_NET); @@ -18438,7 +18467,11 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; - drho_NEB = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; + drho_NEB = ((((f_TNE + f_BSW) + (f_TSE + f_BNW)) + ((f_TNW + f_BSE) + (f_TSW + f_BNE))) + + (((f_TS + f_BN) + (f_BS + f_TN)) + ((f_TW + f_BE) + (f_TE + f_BW)) + + ((f_NW + f_SE) + (f_NE + f_SW))) + + ((f_W + f_E) + (f_S + f_N) + (f_B + f_T))) + + f_ZERO; vx1_NEB = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_NEB); vx2_NEB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_NEB); vx3_NEB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_NEB); @@ -18852,11 +18885,15 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, //mfbab = -c1o3 * (az + cx + axz*x + two*cxx*x + ayz*y + cxy*y + axyz*x*y + two*azz*z + cxz*z + cxyz*y*z)*eps_new/o; //mfbba = -c1o3 * (ay + bx + axy*x + two*bxx*x + two*ayy*y + bxy*y + ayz*z + bxz*z + axyz*x*z + bxyz*y*z)*eps_new/o; - mxxMyy = -c2o3*(ax - by + kxxMyyAverage + c2o1*axx*x - bxy*x + axy*y - c2o1*byy*y + axz*z - byz*z - bxyz*x*z + axyz*y*z)*eps_new/o * (c1o1 + press); - mxxMzz = -c2o3*(ax - cz + kxxMzzAverage + c2o1*axx*x - cxz*x + axy*y - cyz*y - cxyz*x*y + axz*z - c2o1*czz*z + axyz*y*z)*eps_new/o * (c1o1 + press); + mxxMyy = -c2o3*(ax - by + kxxMyyAverage + c2o1*axx*x - bxy*x + axy*y + - c2o1*byy*y + axz*z - byz*z - bxyz*x*z + axyz*y*z)*eps_new/o * (c1o1 + press); + mxxMzz = -c2o3*(ax - cz + kxxMzzAverage + c2o1*axx*x - cxz*x + axy*y + - cyz*y - cxyz*x*y + axz*z - c2o1*czz*z + axyz*y*z)*eps_new/o * (c1o1 + press); - mfabb = -c1o3 * (bz + cy + kyzAverage + bxz*x + cxy*x + byz*y + c2o1*cyy*y + bxyz*x*y + c2o1*bzz*z + cyz*z + cxyz*x*z)*eps_new/o * (c1o1 + press); - mfbab = -c1o3 * (az + cx + kxzAverage + axz*x + c2o1*cxx*x + ayz*y + cxy*y + axyz*x*y + c2o1*azz*z + cxz*z + cxyz*y*z)*eps_new/o * (c1o1 + press); + mfabb = -c1o3 * (bz + cy + kyzAverage + bxz*x + cxy*x + byz*y + c2o1*cyy*y + + bxyz*x*y + c2o1*bzz*z + cyz*z + cxyz*x*z)*eps_new/o * (c1o1 + press); + mfbab = -c1o3 * (az + cx + kxzAverage + axz*x + c2o1*cxx*x + ayz*y + cxy*y + + axyz*x*y + c2o1*azz*z + cxz*z + cxyz*y*z)*eps_new/o * (c1o1 + press); mfbba = -c1o3 * (ay + bx + kxyAverage + axy*x + c2o1*bxx*x + c2o1*ayy*y + bxy*y + ayz*z + bxz*z + axyz*x*z + bxyz*y*z)*eps_new/o * (c1o1 + press); // linear combinations back @@ -22088,7 +22125,7 @@ extern "C" __global__ void scaleCF_RhoSq_comp_27(real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCF_staggered_time_comp_27( real* DC, +__global__ void scaleCF_staggered_time_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -22098,7 +22135,7 @@ extern "C" __global__ void scaleCF_staggered_time_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -22114,96 +22151,96 @@ extern "C" __global__ void scaleCF_staggered_time_comp_27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -26324,7 +26361,7 @@ extern "C" __global__ void scaleCF_staggered_time_comp_27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCF_Fix_comp_27( real* DC, +__global__ void scaleCF_Fix_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -26334,7 +26371,7 @@ extern "C" __global__ void scaleCF_Fix_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -26350,96 +26387,96 @@ extern "C" __global__ void scaleCF_Fix_comp_27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -31091,7 +31128,7 @@ extern "C" __global__ void scaleCF_Fix_comp_27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCF_NSPress_27( real* DC, +__global__ void scaleCF_NSPress_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -31101,7 +31138,7 @@ extern "C" __global__ void scaleCF_NSPress_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -31117,96 +31154,96 @@ extern "C" __global__ void scaleCF_NSPress_27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -35035,7 +35072,7 @@ extern "C" __global__ void scaleCF_NSPress_27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCF_Fix_27( real* DC, +__global__ void scaleCF_Fix_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -35045,7 +35082,7 @@ extern "C" __global__ void scaleCF_Fix_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -35061,96 +35098,96 @@ extern "C" __global__ void scaleCF_Fix_27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -39293,7 +39330,7 @@ extern "C" __global__ void scaleCF_Fix_27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCFpress27( real* DC, +__global__ void scaleCFpress27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -39303,7 +39340,7 @@ extern "C" __global__ void scaleCFpress27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -39319,96 +39356,96 @@ extern "C" __global__ void scaleCFpress27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -40967,7 +41004,7 @@ extern "C" __global__ void scaleCFpress27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCFLast27( real* DC, +__global__ void scaleCFLast27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -40977,7 +41014,7 @@ extern "C" __global__ void scaleCFLast27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -40993,96 +41030,96 @@ extern "C" __global__ void scaleCFLast27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -43202,7 +43239,7 @@ extern "C" __global__ void scaleCFLast27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCFThSMG7( real* DC, +__global__ void scaleCFThSMG7( real* DC, real* DF, real* DD7C, real* DD7F, @@ -43214,7 +43251,7 @@ extern "C" __global__ void scaleCFThSMG7( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -43224,96 +43261,96 @@ extern "C" __global__ void scaleCFThSMG7( real* DC, { real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, /**fzeroF,*/ *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - //fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + //fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, //*fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } @@ -43327,7 +43364,7 @@ extern "C" __global__ void scaleCFThSMG7( real* DC, D7F.f[6] = &DD7F[6*size_MatF]; Distributions7 D7C; - if (evenOrOdd==true) + if (isEvenTimestep==true) { D7C.f[0] = &DD7C[0*size_MatC]; D7C.f[1] = &DD7C[1*size_MatC]; @@ -44429,7 +44466,7 @@ extern "C" __global__ void scaleCFThSMG7( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCFThS7( real* DC, +__global__ void scaleCFThS7( real* DC, real* DF, real* DD7C, real* DD7F, @@ -44441,7 +44478,7 @@ extern "C" __global__ void scaleCFThS7( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -44450,96 +44487,96 @@ extern "C" __global__ void scaleCFThS7( real* DC, { real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, /**fzeroF,*/ *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - //fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + //fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, //*fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } @@ -44553,7 +44590,7 @@ extern "C" __global__ void scaleCFThS7( real* DC, D7F.f[6] = &DD7F[6*size_MatF]; Distributions7 D7C; - if (evenOrOdd==true) + if (isEvenTimestep==true) { D7C.f[0] = &DD7C[0*size_MatC]; D7C.f[1] = &DD7C[1*size_MatC]; @@ -45552,7 +45589,7 @@ extern "C" __global__ void scaleCFThS7( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCFThS27( real* DC, +__global__ void scaleCFThS27( real* DC, real* DF, real* DD27C, real* DD27F, @@ -45564,7 +45601,7 @@ extern "C" __global__ void scaleCFThS27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -45574,188 +45611,188 @@ extern "C" __global__ void scaleCFThS27( real* DC, { real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, /**fzeroF,*/ *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - //fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + //fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, //*fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } Distributions27 D27F; - D27F.f[dirE ] = &DD27F[dirE *size_MatF]; - D27F.f[dirW ] = &DD27F[dirW *size_MatF]; - D27F.f[dirN ] = &DD27F[dirN *size_MatF]; - D27F.f[dirS ] = &DD27F[dirS *size_MatF]; - D27F.f[dirT ] = &DD27F[dirT *size_MatF]; - D27F.f[dirB ] = &DD27F[dirB *size_MatF]; - D27F.f[dirNE ] = &DD27F[dirNE *size_MatF]; - D27F.f[dirSW ] = &DD27F[dirSW *size_MatF]; - D27F.f[dirSE ] = &DD27F[dirSE *size_MatF]; - D27F.f[dirNW ] = &DD27F[dirNW *size_MatF]; - D27F.f[dirTE ] = &DD27F[dirTE *size_MatF]; - D27F.f[dirBW ] = &DD27F[dirBW *size_MatF]; - D27F.f[dirBE ] = &DD27F[dirBE *size_MatF]; - D27F.f[dirTW ] = &DD27F[dirTW *size_MatF]; - D27F.f[dirTN ] = &DD27F[dirTN *size_MatF]; - D27F.f[dirBS ] = &DD27F[dirBS *size_MatF]; - D27F.f[dirBN ] = &DD27F[dirBN *size_MatF]; - D27F.f[dirTS ] = &DD27F[dirTS *size_MatF]; - D27F.f[dirZERO] = &DD27F[dirZERO*size_MatF]; - D27F.f[dirTNE ] = &DD27F[dirTNE *size_MatF]; - D27F.f[dirTSW ] = &DD27F[dirTSW *size_MatF]; - D27F.f[dirTSE ] = &DD27F[dirTSE *size_MatF]; - D27F.f[dirTNW ] = &DD27F[dirTNW *size_MatF]; - D27F.f[dirBNE ] = &DD27F[dirBNE *size_MatF]; - D27F.f[dirBSW ] = &DD27F[dirBSW *size_MatF]; - D27F.f[dirBSE ] = &DD27F[dirBSE *size_MatF]; - D27F.f[dirBNW ] = &DD27F[dirBNW *size_MatF]; + D27F.f[DIR_P00 ] = &DD27F[DIR_P00 *size_MatF]; + D27F.f[DIR_M00 ] = &DD27F[DIR_M00 *size_MatF]; + D27F.f[DIR_0P0 ] = &DD27F[DIR_0P0 *size_MatF]; + D27F.f[DIR_0M0 ] = &DD27F[DIR_0M0 *size_MatF]; + D27F.f[DIR_00P ] = &DD27F[DIR_00P *size_MatF]; + D27F.f[DIR_00M ] = &DD27F[DIR_00M *size_MatF]; + D27F.f[DIR_PP0 ] = &DD27F[DIR_PP0 *size_MatF]; + D27F.f[DIR_MM0 ] = &DD27F[DIR_MM0 *size_MatF]; + D27F.f[DIR_PM0 ] = &DD27F[DIR_PM0 *size_MatF]; + D27F.f[DIR_MP0 ] = &DD27F[DIR_MP0 *size_MatF]; + D27F.f[DIR_P0P ] = &DD27F[DIR_P0P *size_MatF]; + D27F.f[DIR_M0M ] = &DD27F[DIR_M0M *size_MatF]; + D27F.f[DIR_P0M ] = &DD27F[DIR_P0M *size_MatF]; + D27F.f[DIR_M0P ] = &DD27F[DIR_M0P *size_MatF]; + D27F.f[DIR_0PP ] = &DD27F[DIR_0PP *size_MatF]; + D27F.f[DIR_0MM ] = &DD27F[DIR_0MM *size_MatF]; + D27F.f[DIR_0PM ] = &DD27F[DIR_0PM *size_MatF]; + D27F.f[DIR_0MP ] = &DD27F[DIR_0MP *size_MatF]; + D27F.f[DIR_000] = &DD27F[DIR_000*size_MatF]; + D27F.f[DIR_PPP ] = &DD27F[DIR_PPP *size_MatF]; + D27F.f[DIR_MMP ] = &DD27F[DIR_MMP *size_MatF]; + D27F.f[DIR_PMP ] = &DD27F[DIR_PMP *size_MatF]; + D27F.f[DIR_MPP ] = &DD27F[DIR_MPP *size_MatF]; + D27F.f[DIR_PPM ] = &DD27F[DIR_PPM *size_MatF]; + D27F.f[DIR_MMM ] = &DD27F[DIR_MMM *size_MatF]; + D27F.f[DIR_PMM ] = &DD27F[DIR_PMM *size_MatF]; + D27F.f[DIR_MPM ] = &DD27F[DIR_MPM *size_MatF]; Distributions27 D27C; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D27C.f[dirE ] = &DD27C[dirE *size_MatC]; - D27C.f[dirW ] = &DD27C[dirW *size_MatC]; - D27C.f[dirN ] = &DD27C[dirN *size_MatC]; - D27C.f[dirS ] = &DD27C[dirS *size_MatC]; - D27C.f[dirT ] = &DD27C[dirT *size_MatC]; - D27C.f[dirB ] = &DD27C[dirB *size_MatC]; - D27C.f[dirNE ] = &DD27C[dirNE *size_MatC]; - D27C.f[dirSW ] = &DD27C[dirSW *size_MatC]; - D27C.f[dirSE ] = &DD27C[dirSE *size_MatC]; - D27C.f[dirNW ] = &DD27C[dirNW *size_MatC]; - D27C.f[dirTE ] = &DD27C[dirTE *size_MatC]; - D27C.f[dirBW ] = &DD27C[dirBW *size_MatC]; - D27C.f[dirBE ] = &DD27C[dirBE *size_MatC]; - D27C.f[dirTW ] = &DD27C[dirTW *size_MatC]; - D27C.f[dirTN ] = &DD27C[dirTN *size_MatC]; - D27C.f[dirBS ] = &DD27C[dirBS *size_MatC]; - D27C.f[dirBN ] = &DD27C[dirBN *size_MatC]; - D27C.f[dirTS ] = &DD27C[dirTS *size_MatC]; - D27C.f[dirZERO] = &DD27C[dirZERO*size_MatC]; - D27C.f[dirTNE ] = &DD27C[dirTNE *size_MatC]; - D27C.f[dirTSW ] = &DD27C[dirTSW *size_MatC]; - D27C.f[dirTSE ] = &DD27C[dirTSE *size_MatC]; - D27C.f[dirTNW ] = &DD27C[dirTNW *size_MatC]; - D27C.f[dirBNE ] = &DD27C[dirBNE *size_MatC]; - D27C.f[dirBSW ] = &DD27C[dirBSW *size_MatC]; - D27C.f[dirBSE ] = &DD27C[dirBSE *size_MatC]; - D27C.f[dirBNW ] = &DD27C[dirBNW *size_MatC]; + D27C.f[DIR_P00 ] = &DD27C[DIR_P00 *size_MatC]; + D27C.f[DIR_M00 ] = &DD27C[DIR_M00 *size_MatC]; + D27C.f[DIR_0P0 ] = &DD27C[DIR_0P0 *size_MatC]; + D27C.f[DIR_0M0 ] = &DD27C[DIR_0M0 *size_MatC]; + D27C.f[DIR_00P ] = &DD27C[DIR_00P *size_MatC]; + D27C.f[DIR_00M ] = &DD27C[DIR_00M *size_MatC]; + D27C.f[DIR_PP0 ] = &DD27C[DIR_PP0 *size_MatC]; + D27C.f[DIR_MM0 ] = &DD27C[DIR_MM0 *size_MatC]; + D27C.f[DIR_PM0 ] = &DD27C[DIR_PM0 *size_MatC]; + D27C.f[DIR_MP0 ] = &DD27C[DIR_MP0 *size_MatC]; + D27C.f[DIR_P0P ] = &DD27C[DIR_P0P *size_MatC]; + D27C.f[DIR_M0M ] = &DD27C[DIR_M0M *size_MatC]; + D27C.f[DIR_P0M ] = &DD27C[DIR_P0M *size_MatC]; + D27C.f[DIR_M0P ] = &DD27C[DIR_M0P *size_MatC]; + D27C.f[DIR_0PP ] = &DD27C[DIR_0PP *size_MatC]; + D27C.f[DIR_0MM ] = &DD27C[DIR_0MM *size_MatC]; + D27C.f[DIR_0PM ] = &DD27C[DIR_0PM *size_MatC]; + D27C.f[DIR_0MP ] = &DD27C[DIR_0MP *size_MatC]; + D27C.f[DIR_000] = &DD27C[DIR_000*size_MatC]; + D27C.f[DIR_PPP ] = &DD27C[DIR_PPP *size_MatC]; + D27C.f[DIR_MMP ] = &DD27C[DIR_MMP *size_MatC]; + D27C.f[DIR_PMP ] = &DD27C[DIR_PMP *size_MatC]; + D27C.f[DIR_MPP ] = &DD27C[DIR_MPP *size_MatC]; + D27C.f[DIR_PPM ] = &DD27C[DIR_PPM *size_MatC]; + D27C.f[DIR_MMM ] = &DD27C[DIR_MMM *size_MatC]; + D27C.f[DIR_PMM ] = &DD27C[DIR_PMM *size_MatC]; + D27C.f[DIR_MPM ] = &DD27C[DIR_MPM *size_MatC]; } else { - D27C.f[dirW ] = &DD27C[dirE *size_MatC]; - D27C.f[dirE ] = &DD27C[dirW *size_MatC]; - D27C.f[dirS ] = &DD27C[dirN *size_MatC]; - D27C.f[dirN ] = &DD27C[dirS *size_MatC]; - D27C.f[dirB ] = &DD27C[dirT *size_MatC]; - D27C.f[dirT ] = &DD27C[dirB *size_MatC]; - D27C.f[dirSW ] = &DD27C[dirNE *size_MatC]; - D27C.f[dirNE ] = &DD27C[dirSW *size_MatC]; - D27C.f[dirNW ] = &DD27C[dirSE *size_MatC]; - D27C.f[dirSE ] = &DD27C[dirNW *size_MatC]; - D27C.f[dirBW ] = &DD27C[dirTE *size_MatC]; - D27C.f[dirTE ] = &DD27C[dirBW *size_MatC]; - D27C.f[dirTW ] = &DD27C[dirBE *size_MatC]; - D27C.f[dirBE ] = &DD27C[dirTW *size_MatC]; - D27C.f[dirBS ] = &DD27C[dirTN *size_MatC]; - D27C.f[dirTN ] = &DD27C[dirBS *size_MatC]; - D27C.f[dirTS ] = &DD27C[dirBN *size_MatC]; - D27C.f[dirBN ] = &DD27C[dirTS *size_MatC]; - D27C.f[dirZERO] = &DD27C[dirZERO*size_MatC]; - D27C.f[dirBSW ] = &DD27C[dirTNE *size_MatC]; - D27C.f[dirBNE ] = &DD27C[dirTSW *size_MatC]; - D27C.f[dirBNW ] = &DD27C[dirTSE *size_MatC]; - D27C.f[dirBSE ] = &DD27C[dirTNW *size_MatC]; - D27C.f[dirTSW ] = &DD27C[dirBNE *size_MatC]; - D27C.f[dirTNE ] = &DD27C[dirBSW *size_MatC]; - D27C.f[dirTNW ] = &DD27C[dirBSE *size_MatC]; - D27C.f[dirTSE ] = &DD27C[dirBNW *size_MatC]; + D27C.f[DIR_M00 ] = &DD27C[DIR_P00 *size_MatC]; + D27C.f[DIR_P00 ] = &DD27C[DIR_M00 *size_MatC]; + D27C.f[DIR_0M0 ] = &DD27C[DIR_0P0 *size_MatC]; + D27C.f[DIR_0P0 ] = &DD27C[DIR_0M0 *size_MatC]; + D27C.f[DIR_00M ] = &DD27C[DIR_00P *size_MatC]; + D27C.f[DIR_00P ] = &DD27C[DIR_00M *size_MatC]; + D27C.f[DIR_MM0 ] = &DD27C[DIR_PP0 *size_MatC]; + D27C.f[DIR_PP0 ] = &DD27C[DIR_MM0 *size_MatC]; + D27C.f[DIR_MP0 ] = &DD27C[DIR_PM0 *size_MatC]; + D27C.f[DIR_PM0 ] = &DD27C[DIR_MP0 *size_MatC]; + D27C.f[DIR_M0M ] = &DD27C[DIR_P0P *size_MatC]; + D27C.f[DIR_P0P ] = &DD27C[DIR_M0M *size_MatC]; + D27C.f[DIR_M0P ] = &DD27C[DIR_P0M *size_MatC]; + D27C.f[DIR_P0M ] = &DD27C[DIR_M0P *size_MatC]; + D27C.f[DIR_0MM ] = &DD27C[DIR_0PP *size_MatC]; + D27C.f[DIR_0PP ] = &DD27C[DIR_0MM *size_MatC]; + D27C.f[DIR_0MP ] = &DD27C[DIR_0PM *size_MatC]; + D27C.f[DIR_0PM ] = &DD27C[DIR_0MP *size_MatC]; + D27C.f[DIR_000] = &DD27C[DIR_000*size_MatC]; + D27C.f[DIR_MMM ] = &DD27C[DIR_PPP *size_MatC]; + D27C.f[DIR_PPM ] = &DD27C[DIR_MMP *size_MatC]; + D27C.f[DIR_MPM ] = &DD27C[DIR_PMP *size_MatC]; + D27C.f[DIR_PMM ] = &DD27C[DIR_MPP *size_MatC]; + D27C.f[DIR_MMP ] = &DD27C[DIR_PPM *size_MatC]; + D27C.f[DIR_PPP ] = &DD27C[DIR_MMM *size_MatC]; + D27C.f[DIR_MPP ] = &DD27C[DIR_PMM *size_MatC]; + D27C.f[DIR_PMP ] = &DD27C[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -45855,33 +45892,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27C.f[dirE ])[kzero];//ke - f27W = (D27C.f[dirW ])[kw ]; - f27N = (D27C.f[dirN ])[kzero];//kn - f27S = (D27C.f[dirS ])[ks ]; - f27T = (D27C.f[dirT ])[kzero];//kt - f27B = (D27C.f[dirB ])[kb ]; - f27NE = (D27C.f[dirNE ])[kzero];//kne - f27SW = (D27C.f[dirSW ])[ksw ]; - f27SE = (D27C.f[dirSE ])[ks ];//kse - f27NW = (D27C.f[dirNW ])[kw ];//knw - f27TE = (D27C.f[dirTE ])[kzero];//kte - f27BW = (D27C.f[dirBW ])[kbw ]; - f27BE = (D27C.f[dirBE ])[kb ];//kbe - f27TW = (D27C.f[dirTW ])[kw ];//ktw - f27TN = (D27C.f[dirTN ])[kzero];//ktn - f27BS = (D27C.f[dirBS ])[kbs ]; - f27BN = (D27C.f[dirBN ])[kb ];//kbn - f27TS = (D27C.f[dirTS ])[ks ];//kts - f27ZERO = (D27C.f[dirZERO])[kzero];//kzero - f27TNE = (D27C.f[dirTNE ])[kzero];//ktne - f27TSW = (D27C.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27C.f[dirTSE ])[ks ];//ktse - f27TNW = (D27C.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27C.f[dirBNE ])[kb ];//kbne - f27BSW = (D27C.f[dirBSW ])[kbsw ]; - f27BSE = (D27C.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27C.f[dirBNW ])[kbw ];//kbnw + f27E = (D27C.f[DIR_P00 ])[kzero];//ke + f27W = (D27C.f[DIR_M00 ])[kw ]; + f27N = (D27C.f[DIR_0P0 ])[kzero];//kn + f27S = (D27C.f[DIR_0M0 ])[ks ]; + f27T = (D27C.f[DIR_00P ])[kzero];//kt + f27B = (D27C.f[DIR_00M ])[kb ]; + f27NE = (D27C.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27C.f[DIR_MM0 ])[ksw ]; + f27SE = (D27C.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27C.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27C.f[DIR_P0P ])[kzero];//kte + f27BW = (D27C.f[DIR_M0M ])[kbw ]; + f27BE = (D27C.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27C.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27C.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27C.f[DIR_0MM ])[kbs ]; + f27BN = (D27C.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27C.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27C.f[DIR_000])[kzero];//kzero + f27TNE = (D27C.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27C.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27C.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27C.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27C.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27C.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27C.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27C.f[DIR_MPM ])[kbw ];//kbnw Conc_C_SWB = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -45942,33 +45979,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27C.f[dirE ])[kzero];//ke - f27W = (D27C.f[dirW ])[kw ]; - f27N = (D27C.f[dirN ])[kzero];//kn - f27S = (D27C.f[dirS ])[ks ]; - f27T = (D27C.f[dirT ])[kzero];//kt - f27B = (D27C.f[dirB ])[kb ]; - f27NE = (D27C.f[dirNE ])[kzero];//kne - f27SW = (D27C.f[dirSW ])[ksw ]; - f27SE = (D27C.f[dirSE ])[ks ];//kse - f27NW = (D27C.f[dirNW ])[kw ];//knw - f27TE = (D27C.f[dirTE ])[kzero];//kte - f27BW = (D27C.f[dirBW ])[kbw ]; - f27BE = (D27C.f[dirBE ])[kb ];//kbe - f27TW = (D27C.f[dirTW ])[kw ];//ktw - f27TN = (D27C.f[dirTN ])[kzero];//ktn - f27BS = (D27C.f[dirBS ])[kbs ]; - f27BN = (D27C.f[dirBN ])[kb ];//kbn - f27TS = (D27C.f[dirTS ])[ks ];//kts - f27ZERO = (D27C.f[dirZERO])[kzero];//kzero - f27TNE = (D27C.f[dirTNE ])[kzero];//ktne - f27TSW = (D27C.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27C.f[dirTSE ])[ks ];//ktse - f27TNW = (D27C.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27C.f[dirBNE ])[kb ];//kbne - f27BSW = (D27C.f[dirBSW ])[kbsw ]; - f27BSE = (D27C.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27C.f[dirBNW ])[kbw ];//kbnw + f27E = (D27C.f[DIR_P00 ])[kzero];//ke + f27W = (D27C.f[DIR_M00 ])[kw ]; + f27N = (D27C.f[DIR_0P0 ])[kzero];//kn + f27S = (D27C.f[DIR_0M0 ])[ks ]; + f27T = (D27C.f[DIR_00P ])[kzero];//kt + f27B = (D27C.f[DIR_00M ])[kb ]; + f27NE = (D27C.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27C.f[DIR_MM0 ])[ksw ]; + f27SE = (D27C.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27C.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27C.f[DIR_P0P ])[kzero];//kte + f27BW = (D27C.f[DIR_M0M ])[kbw ]; + f27BE = (D27C.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27C.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27C.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27C.f[DIR_0MM ])[kbs ]; + f27BN = (D27C.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27C.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27C.f[DIR_000])[kzero];//kzero + f27TNE = (D27C.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27C.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27C.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27C.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27C.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27C.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27C.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27C.f[DIR_MPM ])[kbw ];//kbnw Conc_C_SWT = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -46029,33 +46066,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27C.f[dirE ])[kzero];//ke - f27W = (D27C.f[dirW ])[kw ]; - f27N = (D27C.f[dirN ])[kzero];//kn - f27S = (D27C.f[dirS ])[ks ]; - f27T = (D27C.f[dirT ])[kzero];//kt - f27B = (D27C.f[dirB ])[kb ]; - f27NE = (D27C.f[dirNE ])[kzero];//kne - f27SW = (D27C.f[dirSW ])[ksw ]; - f27SE = (D27C.f[dirSE ])[ks ];//kse - f27NW = (D27C.f[dirNW ])[kw ];//knw - f27TE = (D27C.f[dirTE ])[kzero];//kte - f27BW = (D27C.f[dirBW ])[kbw ]; - f27BE = (D27C.f[dirBE ])[kb ];//kbe - f27TW = (D27C.f[dirTW ])[kw ];//ktw - f27TN = (D27C.f[dirTN ])[kzero];//ktn - f27BS = (D27C.f[dirBS ])[kbs ]; - f27BN = (D27C.f[dirBN ])[kb ];//kbn - f27TS = (D27C.f[dirTS ])[ks ];//kts - f27ZERO = (D27C.f[dirZERO])[kzero];//kzero - f27TNE = (D27C.f[dirTNE ])[kzero];//ktne - f27TSW = (D27C.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27C.f[dirTSE ])[ks ];//ktse - f27TNW = (D27C.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27C.f[dirBNE ])[kb ];//kbne - f27BSW = (D27C.f[dirBSW ])[kbsw ]; - f27BSE = (D27C.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27C.f[dirBNW ])[kbw ];//kbnw + f27E = (D27C.f[DIR_P00 ])[kzero];//ke + f27W = (D27C.f[DIR_M00 ])[kw ]; + f27N = (D27C.f[DIR_0P0 ])[kzero];//kn + f27S = (D27C.f[DIR_0M0 ])[ks ]; + f27T = (D27C.f[DIR_00P ])[kzero];//kt + f27B = (D27C.f[DIR_00M ])[kb ]; + f27NE = (D27C.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27C.f[DIR_MM0 ])[ksw ]; + f27SE = (D27C.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27C.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27C.f[DIR_P0P ])[kzero];//kte + f27BW = (D27C.f[DIR_M0M ])[kbw ]; + f27BE = (D27C.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27C.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27C.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27C.f[DIR_0MM ])[kbs ]; + f27BN = (D27C.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27C.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27C.f[DIR_000])[kzero];//kzero + f27TNE = (D27C.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27C.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27C.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27C.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27C.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27C.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27C.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27C.f[DIR_MPM ])[kbw ];//kbnw Conc_C_SET = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -46116,33 +46153,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27C.f[dirE ])[kzero];//ke - f27W = (D27C.f[dirW ])[kw ]; - f27N = (D27C.f[dirN ])[kzero];//kn - f27S = (D27C.f[dirS ])[ks ]; - f27T = (D27C.f[dirT ])[kzero];//kt - f27B = (D27C.f[dirB ])[kb ]; - f27NE = (D27C.f[dirNE ])[kzero];//kne - f27SW = (D27C.f[dirSW ])[ksw ]; - f27SE = (D27C.f[dirSE ])[ks ];//kse - f27NW = (D27C.f[dirNW ])[kw ];//knw - f27TE = (D27C.f[dirTE ])[kzero];//kte - f27BW = (D27C.f[dirBW ])[kbw ]; - f27BE = (D27C.f[dirBE ])[kb ];//kbe - f27TW = (D27C.f[dirTW ])[kw ];//ktw - f27TN = (D27C.f[dirTN ])[kzero];//ktn - f27BS = (D27C.f[dirBS ])[kbs ]; - f27BN = (D27C.f[dirBN ])[kb ];//kbn - f27TS = (D27C.f[dirTS ])[ks ];//kts - f27ZERO = (D27C.f[dirZERO])[kzero];//kzero - f27TNE = (D27C.f[dirTNE ])[kzero];//ktne - f27TSW = (D27C.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27C.f[dirTSE ])[ks ];//ktse - f27TNW = (D27C.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27C.f[dirBNE ])[kb ];//kbne - f27BSW = (D27C.f[dirBSW ])[kbsw ]; - f27BSE = (D27C.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27C.f[dirBNW ])[kbw ];//kbnw + f27E = (D27C.f[DIR_P00 ])[kzero];//ke + f27W = (D27C.f[DIR_M00 ])[kw ]; + f27N = (D27C.f[DIR_0P0 ])[kzero];//kn + f27S = (D27C.f[DIR_0M0 ])[ks ]; + f27T = (D27C.f[DIR_00P ])[kzero];//kt + f27B = (D27C.f[DIR_00M ])[kb ]; + f27NE = (D27C.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27C.f[DIR_MM0 ])[ksw ]; + f27SE = (D27C.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27C.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27C.f[DIR_P0P ])[kzero];//kte + f27BW = (D27C.f[DIR_M0M ])[kbw ]; + f27BE = (D27C.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27C.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27C.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27C.f[DIR_0MM ])[kbs ]; + f27BN = (D27C.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27C.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27C.f[DIR_000])[kzero];//kzero + f27TNE = (D27C.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27C.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27C.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27C.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27C.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27C.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27C.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27C.f[DIR_MPM ])[kbw ];//kbnw Conc_C_SEB = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -46213,33 +46250,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27C.f[dirE ])[kzero];//ke - f27W = (D27C.f[dirW ])[kw ]; - f27N = (D27C.f[dirN ])[kzero];//kn - f27S = (D27C.f[dirS ])[ks ]; - f27T = (D27C.f[dirT ])[kzero];//kt - f27B = (D27C.f[dirB ])[kb ]; - f27NE = (D27C.f[dirNE ])[kzero];//kne - f27SW = (D27C.f[dirSW ])[ksw ]; - f27SE = (D27C.f[dirSE ])[ks ];//kse - f27NW = (D27C.f[dirNW ])[kw ];//knw - f27TE = (D27C.f[dirTE ])[kzero];//kte - f27BW = (D27C.f[dirBW ])[kbw ]; - f27BE = (D27C.f[dirBE ])[kb ];//kbe - f27TW = (D27C.f[dirTW ])[kw ];//ktw - f27TN = (D27C.f[dirTN ])[kzero];//ktn - f27BS = (D27C.f[dirBS ])[kbs ]; - f27BN = (D27C.f[dirBN ])[kb ];//kbn - f27TS = (D27C.f[dirTS ])[ks ];//kts - f27ZERO = (D27C.f[dirZERO])[kzero];//kzero - f27TNE = (D27C.f[dirTNE ])[kzero];//ktne - f27TSW = (D27C.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27C.f[dirTSE ])[ks ];//ktse - f27TNW = (D27C.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27C.f[dirBNE ])[kb ];//kbne - f27BSW = (D27C.f[dirBSW ])[kbsw ]; - f27BSE = (D27C.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27C.f[dirBNW ])[kbw ];//kbnw + f27E = (D27C.f[DIR_P00 ])[kzero];//ke + f27W = (D27C.f[DIR_M00 ])[kw ]; + f27N = (D27C.f[DIR_0P0 ])[kzero];//kn + f27S = (D27C.f[DIR_0M0 ])[ks ]; + f27T = (D27C.f[DIR_00P ])[kzero];//kt + f27B = (D27C.f[DIR_00M ])[kb ]; + f27NE = (D27C.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27C.f[DIR_MM0 ])[ksw ]; + f27SE = (D27C.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27C.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27C.f[DIR_P0P ])[kzero];//kte + f27BW = (D27C.f[DIR_M0M ])[kbw ]; + f27BE = (D27C.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27C.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27C.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27C.f[DIR_0MM ])[kbs ]; + f27BN = (D27C.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27C.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27C.f[DIR_000])[kzero];//kzero + f27TNE = (D27C.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27C.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27C.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27C.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27C.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27C.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27C.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27C.f[DIR_MPM ])[kbw ];//kbnw Conc_C_NWB = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -46300,33 +46337,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27C.f[dirE ])[kzero];//ke - f27W = (D27C.f[dirW ])[kw ]; - f27N = (D27C.f[dirN ])[kzero];//kn - f27S = (D27C.f[dirS ])[ks ]; - f27T = (D27C.f[dirT ])[kzero];//kt - f27B = (D27C.f[dirB ])[kb ]; - f27NE = (D27C.f[dirNE ])[kzero];//kne - f27SW = (D27C.f[dirSW ])[ksw ]; - f27SE = (D27C.f[dirSE ])[ks ];//kse - f27NW = (D27C.f[dirNW ])[kw ];//knw - f27TE = (D27C.f[dirTE ])[kzero];//kte - f27BW = (D27C.f[dirBW ])[kbw ]; - f27BE = (D27C.f[dirBE ])[kb ];//kbe - f27TW = (D27C.f[dirTW ])[kw ];//ktw - f27TN = (D27C.f[dirTN ])[kzero];//ktn - f27BS = (D27C.f[dirBS ])[kbs ]; - f27BN = (D27C.f[dirBN ])[kb ];//kbn - f27TS = (D27C.f[dirTS ])[ks ];//kts - f27ZERO = (D27C.f[dirZERO])[kzero];//kzero - f27TNE = (D27C.f[dirTNE ])[kzero];//ktne - f27TSW = (D27C.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27C.f[dirTSE ])[ks ];//ktse - f27TNW = (D27C.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27C.f[dirBNE ])[kb ];//kbne - f27BSW = (D27C.f[dirBSW ])[kbsw ]; - f27BSE = (D27C.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27C.f[dirBNW ])[kbw ];//kbnw + f27E = (D27C.f[DIR_P00 ])[kzero];//ke + f27W = (D27C.f[DIR_M00 ])[kw ]; + f27N = (D27C.f[DIR_0P0 ])[kzero];//kn + f27S = (D27C.f[DIR_0M0 ])[ks ]; + f27T = (D27C.f[DIR_00P ])[kzero];//kt + f27B = (D27C.f[DIR_00M ])[kb ]; + f27NE = (D27C.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27C.f[DIR_MM0 ])[ksw ]; + f27SE = (D27C.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27C.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27C.f[DIR_P0P ])[kzero];//kte + f27BW = (D27C.f[DIR_M0M ])[kbw ]; + f27BE = (D27C.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27C.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27C.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27C.f[DIR_0MM ])[kbs ]; + f27BN = (D27C.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27C.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27C.f[DIR_000])[kzero];//kzero + f27TNE = (D27C.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27C.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27C.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27C.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27C.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27C.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27C.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27C.f[DIR_MPM ])[kbw ];//kbnw Conc_C_NWT = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -46387,33 +46424,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27C.f[dirE ])[kzero];//ke - f27W = (D27C.f[dirW ])[kw ]; - f27N = (D27C.f[dirN ])[kzero];//kn - f27S = (D27C.f[dirS ])[ks ]; - f27T = (D27C.f[dirT ])[kzero];//kt - f27B = (D27C.f[dirB ])[kb ]; - f27NE = (D27C.f[dirNE ])[kzero];//kne - f27SW = (D27C.f[dirSW ])[ksw ]; - f27SE = (D27C.f[dirSE ])[ks ];//kse - f27NW = (D27C.f[dirNW ])[kw ];//knw - f27TE = (D27C.f[dirTE ])[kzero];//kte - f27BW = (D27C.f[dirBW ])[kbw ]; - f27BE = (D27C.f[dirBE ])[kb ];//kbe - f27TW = (D27C.f[dirTW ])[kw ];//ktw - f27TN = (D27C.f[dirTN ])[kzero];//ktn - f27BS = (D27C.f[dirBS ])[kbs ]; - f27BN = (D27C.f[dirBN ])[kb ];//kbn - f27TS = (D27C.f[dirTS ])[ks ];//kts - f27ZERO = (D27C.f[dirZERO])[kzero];//kzero - f27TNE = (D27C.f[dirTNE ])[kzero];//ktne - f27TSW = (D27C.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27C.f[dirTSE ])[ks ];//ktse - f27TNW = (D27C.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27C.f[dirBNE ])[kb ];//kbne - f27BSW = (D27C.f[dirBSW ])[kbsw ]; - f27BSE = (D27C.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27C.f[dirBNW ])[kbw ];//kbnw + f27E = (D27C.f[DIR_P00 ])[kzero];//ke + f27W = (D27C.f[DIR_M00 ])[kw ]; + f27N = (D27C.f[DIR_0P0 ])[kzero];//kn + f27S = (D27C.f[DIR_0M0 ])[ks ]; + f27T = (D27C.f[DIR_00P ])[kzero];//kt + f27B = (D27C.f[DIR_00M ])[kb ]; + f27NE = (D27C.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27C.f[DIR_MM0 ])[ksw ]; + f27SE = (D27C.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27C.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27C.f[DIR_P0P ])[kzero];//kte + f27BW = (D27C.f[DIR_M0M ])[kbw ]; + f27BE = (D27C.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27C.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27C.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27C.f[DIR_0MM ])[kbs ]; + f27BN = (D27C.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27C.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27C.f[DIR_000])[kzero];//kzero + f27TNE = (D27C.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27C.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27C.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27C.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27C.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27C.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27C.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27C.f[DIR_MPM ])[kbw ];//kbnw Conc_C_NET = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -46474,33 +46511,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, f_BSE = fbseC[kbs]; f_BNW = fbnwC[kbw]; //////////////////////////////////////////////////////////////////////////////// - f27E = (D27C.f[dirE ])[kzero];//ke - f27W = (D27C.f[dirW ])[kw ]; - f27N = (D27C.f[dirN ])[kzero];//kn - f27S = (D27C.f[dirS ])[ks ]; - f27T = (D27C.f[dirT ])[kzero];//kt - f27B = (D27C.f[dirB ])[kb ]; - f27NE = (D27C.f[dirNE ])[kzero];//kne - f27SW = (D27C.f[dirSW ])[ksw ]; - f27SE = (D27C.f[dirSE ])[ks ];//kse - f27NW = (D27C.f[dirNW ])[kw ];//knw - f27TE = (D27C.f[dirTE ])[kzero];//kte - f27BW = (D27C.f[dirBW ])[kbw ]; - f27BE = (D27C.f[dirBE ])[kb ];//kbe - f27TW = (D27C.f[dirTW ])[kw ];//ktw - f27TN = (D27C.f[dirTN ])[kzero];//ktn - f27BS = (D27C.f[dirBS ])[kbs ]; - f27BN = (D27C.f[dirBN ])[kb ];//kbn - f27TS = (D27C.f[dirTS ])[ks ];//kts - f27ZERO = (D27C.f[dirZERO])[kzero];//kzero - f27TNE = (D27C.f[dirTNE ])[kzero];//ktne - f27TSW = (D27C.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27C.f[dirTSE ])[ks ];//ktse - f27TNW = (D27C.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27C.f[dirBNE ])[kb ];//kbne - f27BSW = (D27C.f[dirBSW ])[kbsw ]; - f27BSE = (D27C.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27C.f[dirBNW ])[kbw ];//kbnw + f27E = (D27C.f[DIR_P00 ])[kzero];//ke + f27W = (D27C.f[DIR_M00 ])[kw ]; + f27N = (D27C.f[DIR_0P0 ])[kzero];//kn + f27S = (D27C.f[DIR_0M0 ])[ks ]; + f27T = (D27C.f[DIR_00P ])[kzero];//kt + f27B = (D27C.f[DIR_00M ])[kb ]; + f27NE = (D27C.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27C.f[DIR_MM0 ])[ksw ]; + f27SE = (D27C.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27C.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27C.f[DIR_P0P ])[kzero];//kte + f27BW = (D27C.f[DIR_M0M ])[kbw ]; + f27BE = (D27C.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27C.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27C.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27C.f[DIR_0MM ])[kbs ]; + f27BN = (D27C.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27C.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27C.f[DIR_000])[kzero];//kzero + f27TNE = (D27C.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27C.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27C.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27C.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27C.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27C.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27C.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27C.f[DIR_MPM ])[kbw ];//kbnw Conc_C_NEB = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -46618,33 +46655,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D27F.f[dirZERO])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); - (D27F.f[dirE ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); - (D27F.f[dirW ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - (D27F.f[dirN ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); - (D27F.f[dirS ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); - (D27F.f[dirT ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); - (D27F.f[dirB ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); - (D27F.f[dirNE ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - (D27F.f[dirSW ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - (D27F.f[dirSE ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - (D27F.f[dirNW ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - (D27F.f[dirTE ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - (D27F.f[dirBW ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - (D27F.f[dirBE ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - (D27F.f[dirTW ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - (D27F.f[dirTN ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - (D27F.f[dirBS ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - (D27F.f[dirBN ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - (D27F.f[dirTS ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - (D27F.f[dirTNE ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - (D27F.f[dirBSW ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirBNE ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirTSW ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirTSE ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirBNW ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirBSE ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirTNW ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_000])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); + (D27F.f[DIR_P00 ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); + (D27F.f[DIR_M00 ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); + (D27F.f[DIR_0P0 ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); + (D27F.f[DIR_0M0 ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); + (D27F.f[DIR_00P ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); + (D27F.f[DIR_00M ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); + (D27F.f[DIR_PP0 ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + (D27F.f[DIR_MM0 ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + (D27F.f[DIR_PM0 ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + (D27F.f[DIR_MP0 ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + (D27F.f[DIR_P0P ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + (D27F.f[DIR_M0M ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + (D27F.f[DIR_P0M ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + (D27F.f[DIR_M0P ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + (D27F.f[DIR_0PP ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + (D27F.f[DIR_0MM ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + (D27F.f[DIR_0PM ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + (D27F.f[DIR_0MP ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + (D27F.f[DIR_PPP ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_MMM ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_PPM ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_MMP ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_PMP ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_MPM ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_PMM ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_MPP ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); @@ -46696,33 +46733,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D27F.f[dirZERO])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); - (D27F.f[dirE ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); - (D27F.f[dirW ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - (D27F.f[dirN ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); - (D27F.f[dirS ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); - (D27F.f[dirT ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); - (D27F.f[dirB ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); - (D27F.f[dirNE ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - (D27F.f[dirSW ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - (D27F.f[dirSE ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - (D27F.f[dirNW ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - (D27F.f[dirTE ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - (D27F.f[dirBW ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - (D27F.f[dirBE ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - (D27F.f[dirTW ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - (D27F.f[dirTN ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - (D27F.f[dirBS ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - (D27F.f[dirBN ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - (D27F.f[dirTS ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - (D27F.f[dirTNE ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - (D27F.f[dirBSW ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirBNE ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirTSW ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirTSE ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirBNW ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirBSE ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirTNW ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_000])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); + (D27F.f[DIR_P00 ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); + (D27F.f[DIR_M00 ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); + (D27F.f[DIR_0P0 ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); + (D27F.f[DIR_0M0 ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); + (D27F.f[DIR_00P ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); + (D27F.f[DIR_00M ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); + (D27F.f[DIR_PP0 ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + (D27F.f[DIR_MM0 ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + (D27F.f[DIR_PM0 ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + (D27F.f[DIR_MP0 ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + (D27F.f[DIR_P0P ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + (D27F.f[DIR_M0M ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + (D27F.f[DIR_P0M ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + (D27F.f[DIR_M0P ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + (D27F.f[DIR_0PP ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + (D27F.f[DIR_0MM ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + (D27F.f[DIR_0PM ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + (D27F.f[DIR_0MP ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + (D27F.f[DIR_PPP ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_MMM ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_PPM ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_MMP ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_PMP ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_MPM ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_PMM ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_MPP ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); @@ -46774,33 +46811,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D27F.f[dirZERO])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); - (D27F.f[dirE ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); - (D27F.f[dirW ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - (D27F.f[dirN ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); - (D27F.f[dirS ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); - (D27F.f[dirT ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); - (D27F.f[dirB ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); - (D27F.f[dirNE ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - (D27F.f[dirSW ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - (D27F.f[dirSE ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - (D27F.f[dirNW ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - (D27F.f[dirTE ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - (D27F.f[dirBW ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - (D27F.f[dirBE ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - (D27F.f[dirTW ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - (D27F.f[dirTN ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - (D27F.f[dirBS ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - (D27F.f[dirBN ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - (D27F.f[dirTS ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - (D27F.f[dirTNE ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - (D27F.f[dirBSW ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirBNE ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirTSW ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirTSE ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirBNW ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirBSE ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirTNW ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_000])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); + (D27F.f[DIR_P00 ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); + (D27F.f[DIR_M00 ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); + (D27F.f[DIR_0P0 ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); + (D27F.f[DIR_0M0 ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); + (D27F.f[DIR_00P ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); + (D27F.f[DIR_00M ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); + (D27F.f[DIR_PP0 ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + (D27F.f[DIR_MM0 ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + (D27F.f[DIR_PM0 ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + (D27F.f[DIR_MP0 ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + (D27F.f[DIR_P0P ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + (D27F.f[DIR_M0M ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + (D27F.f[DIR_P0M ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + (D27F.f[DIR_M0P ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + (D27F.f[DIR_0PP ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + (D27F.f[DIR_0MM ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + (D27F.f[DIR_0PM ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + (D27F.f[DIR_0MP ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + (D27F.f[DIR_PPP ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_MMM ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_PPM ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_MMP ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_PMP ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_MPM ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_PMM ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_MPP ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); @@ -46852,33 +46889,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D27F.f[dirZERO])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); - (D27F.f[dirE ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); - (D27F.f[dirW ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - (D27F.f[dirN ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); - (D27F.f[dirS ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); - (D27F.f[dirT ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); - (D27F.f[dirB ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); - (D27F.f[dirNE ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - (D27F.f[dirSW ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - (D27F.f[dirSE ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - (D27F.f[dirNW ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - (D27F.f[dirTE ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - (D27F.f[dirBW ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - (D27F.f[dirBE ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - (D27F.f[dirTW ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - (D27F.f[dirTN ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - (D27F.f[dirBS ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - (D27F.f[dirBN ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - (D27F.f[dirTS ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - (D27F.f[dirTNE ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - (D27F.f[dirBSW ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirBNE ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirTSW ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirTSE ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirBNW ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirBSE ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirTNW ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_000])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); + (D27F.f[DIR_P00 ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); + (D27F.f[DIR_M00 ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); + (D27F.f[DIR_0P0 ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); + (D27F.f[DIR_0M0 ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); + (D27F.f[DIR_00P ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); + (D27F.f[DIR_00M ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); + (D27F.f[DIR_PP0 ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + (D27F.f[DIR_MM0 ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + (D27F.f[DIR_PM0 ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + (D27F.f[DIR_MP0 ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + (D27F.f[DIR_P0P ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + (D27F.f[DIR_M0M ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + (D27F.f[DIR_P0M ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + (D27F.f[DIR_M0P ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + (D27F.f[DIR_0PP ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + (D27F.f[DIR_0MM ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + (D27F.f[DIR_0PM ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + (D27F.f[DIR_0MP ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + (D27F.f[DIR_PPP ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_MMM ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_PPM ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_MMP ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_PMP ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_MPM ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_PMM ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_MPP ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); @@ -46940,33 +46977,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D27F.f[dirZERO])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); - (D27F.f[dirE ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); - (D27F.f[dirW ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - (D27F.f[dirN ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); - (D27F.f[dirS ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); - (D27F.f[dirT ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); - (D27F.f[dirB ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); - (D27F.f[dirNE ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - (D27F.f[dirSW ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - (D27F.f[dirSE ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - (D27F.f[dirNW ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - (D27F.f[dirTE ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - (D27F.f[dirBW ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - (D27F.f[dirBE ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - (D27F.f[dirTW ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - (D27F.f[dirTN ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - (D27F.f[dirBS ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - (D27F.f[dirBN ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - (D27F.f[dirTS ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - (D27F.f[dirTNE ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - (D27F.f[dirBSW ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirBNE ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirTSW ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirTSE ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirBNW ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirBSE ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirTNW ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_000])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); + (D27F.f[DIR_P00 ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); + (D27F.f[DIR_M00 ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); + (D27F.f[DIR_0P0 ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); + (D27F.f[DIR_0M0 ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); + (D27F.f[DIR_00P ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); + (D27F.f[DIR_00M ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); + (D27F.f[DIR_PP0 ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + (D27F.f[DIR_MM0 ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + (D27F.f[DIR_PM0 ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + (D27F.f[DIR_MP0 ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + (D27F.f[DIR_P0P ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + (D27F.f[DIR_M0M ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + (D27F.f[DIR_P0M ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + (D27F.f[DIR_M0P ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + (D27F.f[DIR_0PP ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + (D27F.f[DIR_0MM ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + (D27F.f[DIR_0PM ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + (D27F.f[DIR_0MP ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + (D27F.f[DIR_PPP ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_MMM ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_PPM ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_MMP ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_PMP ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_MPM ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_PMM ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_MPP ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); @@ -47018,33 +47055,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D27F.f[dirZERO])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); - (D27F.f[dirE ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); - (D27F.f[dirW ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - (D27F.f[dirN ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); - (D27F.f[dirS ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); - (D27F.f[dirT ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); - (D27F.f[dirB ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); - (D27F.f[dirNE ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - (D27F.f[dirSW ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - (D27F.f[dirSE ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - (D27F.f[dirNW ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - (D27F.f[dirTE ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - (D27F.f[dirBW ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - (D27F.f[dirBE ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - (D27F.f[dirTW ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - (D27F.f[dirTN ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - (D27F.f[dirBS ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - (D27F.f[dirBN ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - (D27F.f[dirTS ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - (D27F.f[dirTNE ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - (D27F.f[dirBSW ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirBNE ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirTSW ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirTSE ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirBNW ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirBSE ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirTNW ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_000])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); + (D27F.f[DIR_P00 ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); + (D27F.f[DIR_M00 ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); + (D27F.f[DIR_0P0 ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); + (D27F.f[DIR_0M0 ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); + (D27F.f[DIR_00P ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); + (D27F.f[DIR_00M ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); + (D27F.f[DIR_PP0 ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + (D27F.f[DIR_MM0 ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + (D27F.f[DIR_PM0 ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + (D27F.f[DIR_MP0 ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + (D27F.f[DIR_P0P ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + (D27F.f[DIR_M0M ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + (D27F.f[DIR_P0M ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + (D27F.f[DIR_M0P ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + (D27F.f[DIR_0PP ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + (D27F.f[DIR_0MM ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + (D27F.f[DIR_0PM ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + (D27F.f[DIR_0MP ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + (D27F.f[DIR_PPP ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_MMM ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_PPM ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_MMP ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_PMP ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_MPM ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_PMM ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_MPP ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); @@ -47096,33 +47133,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D27F.f[dirZERO])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); - (D27F.f[dirE ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); - (D27F.f[dirW ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - (D27F.f[dirN ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); - (D27F.f[dirS ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); - (D27F.f[dirT ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); - (D27F.f[dirB ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); - (D27F.f[dirNE ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - (D27F.f[dirSW ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - (D27F.f[dirSE ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - (D27F.f[dirNW ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - (D27F.f[dirTE ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - (D27F.f[dirBW ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - (D27F.f[dirBE ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - (D27F.f[dirTW ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - (D27F.f[dirTN ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - (D27F.f[dirBS ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - (D27F.f[dirBN ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - (D27F.f[dirTS ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - (D27F.f[dirTNE ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - (D27F.f[dirBSW ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirBNE ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirTSW ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirTSE ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirBNW ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirBSE ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirTNW ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_000])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); + (D27F.f[DIR_P00 ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); + (D27F.f[DIR_M00 ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); + (D27F.f[DIR_0P0 ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); + (D27F.f[DIR_0M0 ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); + (D27F.f[DIR_00P ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); + (D27F.f[DIR_00M ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); + (D27F.f[DIR_PP0 ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + (D27F.f[DIR_MM0 ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + (D27F.f[DIR_PM0 ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + (D27F.f[DIR_MP0 ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + (D27F.f[DIR_P0P ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + (D27F.f[DIR_M0M ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + (D27F.f[DIR_P0M ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + (D27F.f[DIR_M0P ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + (D27F.f[DIR_0PP ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + (D27F.f[DIR_0MM ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + (D27F.f[DIR_0PM ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + (D27F.f[DIR_0MP ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + (D27F.f[DIR_PPP ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_MMM ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_PPM ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_MMP ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_PMP ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_MPM ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_PMM ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_MPP ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); @@ -47174,33 +47211,33 @@ extern "C" __global__ void scaleCFThS27( real* DC, cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D27F.f[dirZERO])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); - (D27F.f[dirE ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); - (D27F.f[dirW ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - (D27F.f[dirN ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); - (D27F.f[dirS ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); - (D27F.f[dirT ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); - (D27F.f[dirB ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); - (D27F.f[dirNE ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - (D27F.f[dirSW ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - (D27F.f[dirSE ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - (D27F.f[dirNW ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - (D27F.f[dirTE ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - (D27F.f[dirBW ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - (D27F.f[dirBE ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - (D27F.f[dirTW ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - (D27F.f[dirTN ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - (D27F.f[dirBS ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - (D27F.f[dirBN ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - (D27F.f[dirTS ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - (D27F.f[dirTNE ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - (D27F.f[dirBSW ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirBNE ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirTSW ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirTSE ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - (D27F.f[dirBNW ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - (D27F.f[dirBSE ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - (D27F.f[dirTNW ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_000])[kzero] = c8o27* Conc_F*(c1o1-cu_sq); + (D27F.f[DIR_P00 ])[kzero] = c2o27* (c3o1*( Mx )+Conc_F*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); + (D27F.f[DIR_M00 ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_F*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); + (D27F.f[DIR_0P0 ])[kzero] = c2o27* (c3o1*( My )+Conc_F*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); + (D27F.f[DIR_0M0 ])[ks ] = c2o27* (c3o1*( -My )+Conc_F*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); + (D27F.f[DIR_00P ])[kzero] = c2o27* (c3o1*( Mz)+Conc_F*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); + (D27F.f[DIR_00M ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_F*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); + (D27F.f[DIR_PP0 ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_F*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + (D27F.f[DIR_MM0 ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_F*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + (D27F.f[DIR_PM0 ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_F*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + (D27F.f[DIR_MP0 ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_F*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + (D27F.f[DIR_P0P ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_F*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + (D27F.f[DIR_M0M ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_F*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + (D27F.f[DIR_P0M ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_F*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + (D27F.f[DIR_M0P ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_F*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + (D27F.f[DIR_0PP ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_F*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + (D27F.f[DIR_0MM ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_F*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + (D27F.f[DIR_0PM ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_F*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + (D27F.f[DIR_0MP ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_F*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + (D27F.f[DIR_PPP ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + (D27F.f[DIR_MMM ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_PPM ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_F*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_MMP ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_F*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_PMP ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + (D27F.f[DIR_MPM ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + (D27F.f[DIR_PMM ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_F*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + (D27F.f[DIR_MPP ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_F*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -47242,7 +47279,7 @@ extern "C" __global__ void scaleCFThS27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCFEff27(real* DC, +__global__ void scaleCFEff27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -47252,7 +47289,7 @@ extern "C" __global__ void scaleCFEff27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -47268,96 +47305,96 @@ extern "C" __global__ void scaleCFEff27(real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -48952,7 +48989,7 @@ extern "C" __global__ void scaleCFEff27(real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCF27(real* DC, +__global__ void scaleCF27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -48962,7 +48999,7 @@ extern "C" __global__ void scaleCF27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -48977,96 +49014,96 @@ extern "C" __global__ void scaleCF27(real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/GPU/ScaleCF_F3_27.cu b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleCF_F3_27.cu similarity index 97% rename from src/gpu/VirtualFluids_GPU/GPU/ScaleCF_F3_27.cu rename to src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleCF_F3_27.cu index 5bafb27d28a94491d78c7d7572c959d6ec0cfb21..cb8bd2a322cc9176cd0aa31625ee386e1f62d63d 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/ScaleCF_F3_27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleCF_F3_27.cu @@ -7,13 +7,14 @@ ////////////////////////////////////////////////////////////////////////// /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, +__global__ void scaleCF_comp_D3Q27F3_2018(real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -24,7 +25,7 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -43,107 +44,107 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, *f000dest, *fMMMdest, *fMMPdest, *fMPPdest, *fMPMdest, *fPPMdest, *fPPPdest, *fPMPdest, *fPMMdest; - fP00dest = &DF[dirE *size_MatF]; - fM00dest = &DF[dirW *size_MatF]; - f0P0dest = &DF[dirN *size_MatF]; - f0M0dest = &DF[dirS *size_MatF]; - f00Pdest = &DF[dirT *size_MatF]; - f00Mdest = &DF[dirB *size_MatF]; - fPP0dest = &DF[dirNE *size_MatF]; - fMM0dest = &DF[dirSW *size_MatF]; - fPM0dest = &DF[dirSE *size_MatF]; - fMP0dest = &DF[dirNW *size_MatF]; - fP0Pdest = &DF[dirTE *size_MatF]; - fM0Mdest = &DF[dirBW *size_MatF]; - fP0Mdest = &DF[dirBE *size_MatF]; - fM0Pdest = &DF[dirTW *size_MatF]; - f0PPdest = &DF[dirTN *size_MatF]; - f0MMdest = &DF[dirBS *size_MatF]; - f0PMdest = &DF[dirBN *size_MatF]; - f0MPdest = &DF[dirTS *size_MatF]; - f000dest = &DF[dirZERO*size_MatF]; - fMMMdest = &DF[dirBSW *size_MatF]; - fMMPdest = &DF[dirTSW *size_MatF]; - fMPPdest = &DF[dirTNW *size_MatF]; - fMPMdest = &DF[dirBNW *size_MatF]; - fPPMdest = &DF[dirBNE *size_MatF]; - fPPPdest = &DF[dirTNE *size_MatF]; - fPMPdest = &DF[dirTSE *size_MatF]; - fPMMdest = &DF[dirBSE *size_MatF]; + fP00dest = &DF[DIR_P00 *size_MatF]; + fM00dest = &DF[DIR_M00 *size_MatF]; + f0P0dest = &DF[DIR_0P0 *size_MatF]; + f0M0dest = &DF[DIR_0M0 *size_MatF]; + f00Pdest = &DF[DIR_00P *size_MatF]; + f00Mdest = &DF[DIR_00M *size_MatF]; + fPP0dest = &DF[DIR_PP0 *size_MatF]; + fMM0dest = &DF[DIR_MM0 *size_MatF]; + fPM0dest = &DF[DIR_PM0 *size_MatF]; + fMP0dest = &DF[DIR_MP0 *size_MatF]; + fP0Pdest = &DF[DIR_P0P *size_MatF]; + fM0Mdest = &DF[DIR_M0M *size_MatF]; + fP0Mdest = &DF[DIR_P0M *size_MatF]; + fM0Pdest = &DF[DIR_M0P *size_MatF]; + f0PPdest = &DF[DIR_0PP *size_MatF]; + f0MMdest = &DF[DIR_0MM *size_MatF]; + f0PMdest = &DF[DIR_0PM *size_MatF]; + f0MPdest = &DF[DIR_0MP *size_MatF]; + f000dest = &DF[DIR_000*size_MatF]; + fMMMdest = &DF[DIR_MMM *size_MatF]; + fMMPdest = &DF[DIR_MMP *size_MatF]; + fMPPdest = &DF[DIR_MPP *size_MatF]; + fMPMdest = &DF[DIR_MPM *size_MatF]; + fPPMdest = &DF[DIR_PPM *size_MatF]; + fPPPdest = &DF[DIR_PPP *size_MatF]; + fPMPdest = &DF[DIR_PMP *size_MatF]; + fPMMdest = &DF[DIR_PMM *size_MatF]; real *fP00source, *fM00source, *f0P0source, *f0M0source, *f00Psource, *f00Msource, *fPP0source, *fMM0source, *fPM0source, *fMP0source, *fP0Psource, *fM0Msource, *fP0Msource, *fM0Psource, *f0PPsource, *f0MMsource, *f0PMsource, *f0MPsource, *f000source, *fMMMsource, *fMMPsource, *fMPPsource, *fMPMsource, *fPPMsource, *fPPPsource, *fPMPsource, *fPMMsource; - if (evenOrOdd == true) + if (isEvenTimestep == true) { - fP00source = &DC[dirE *size_MatC]; - fM00source = &DC[dirW *size_MatC]; - f0P0source = &DC[dirN *size_MatC]; - f0M0source = &DC[dirS *size_MatC]; - f00Psource = &DC[dirT *size_MatC]; - f00Msource = &DC[dirB *size_MatC]; - fPP0source = &DC[dirNE *size_MatC]; - fMM0source = &DC[dirSW *size_MatC]; - fPM0source = &DC[dirSE *size_MatC]; - fMP0source = &DC[dirNW *size_MatC]; - fP0Psource = &DC[dirTE *size_MatC]; - fM0Msource = &DC[dirBW *size_MatC]; - fP0Msource = &DC[dirBE *size_MatC]; - fM0Psource = &DC[dirTW *size_MatC]; - f0PPsource = &DC[dirTN *size_MatC]; - f0MMsource = &DC[dirBS *size_MatC]; - f0PMsource = &DC[dirBN *size_MatC]; - f0MPsource = &DC[dirTS *size_MatC]; - f000source = &DC[dirZERO*size_MatC]; - fMMMsource = &DC[dirBSW *size_MatC]; - fMMPsource = &DC[dirTSW *size_MatC]; - fMPPsource = &DC[dirTNW *size_MatC]; - fMPMsource = &DC[dirBNW *size_MatC]; - fPPMsource = &DC[dirBNE *size_MatC]; - fPPPsource = &DC[dirTNE *size_MatC]; - fPMPsource = &DC[dirTSE *size_MatC]; - fPMMsource = &DC[dirBSE *size_MatC]; + fP00source = &DC[DIR_P00 *size_MatC]; + fM00source = &DC[DIR_M00 *size_MatC]; + f0P0source = &DC[DIR_0P0 *size_MatC]; + f0M0source = &DC[DIR_0M0 *size_MatC]; + f00Psource = &DC[DIR_00P *size_MatC]; + f00Msource = &DC[DIR_00M *size_MatC]; + fPP0source = &DC[DIR_PP0 *size_MatC]; + fMM0source = &DC[DIR_MM0 *size_MatC]; + fPM0source = &DC[DIR_PM0 *size_MatC]; + fMP0source = &DC[DIR_MP0 *size_MatC]; + fP0Psource = &DC[DIR_P0P *size_MatC]; + fM0Msource = &DC[DIR_M0M *size_MatC]; + fP0Msource = &DC[DIR_P0M *size_MatC]; + fM0Psource = &DC[DIR_M0P *size_MatC]; + f0PPsource = &DC[DIR_0PP *size_MatC]; + f0MMsource = &DC[DIR_0MM *size_MatC]; + f0PMsource = &DC[DIR_0PM *size_MatC]; + f0MPsource = &DC[DIR_0MP *size_MatC]; + f000source = &DC[DIR_000*size_MatC]; + fMMMsource = &DC[DIR_MMM *size_MatC]; + fMMPsource = &DC[DIR_MMP *size_MatC]; + fMPPsource = &DC[DIR_MPP *size_MatC]; + fMPMsource = &DC[DIR_MPM *size_MatC]; + fPPMsource = &DC[DIR_PPM *size_MatC]; + fPPPsource = &DC[DIR_PPP *size_MatC]; + fPMPsource = &DC[DIR_PMP *size_MatC]; + fPMMsource = &DC[DIR_PMM *size_MatC]; } else { - fP00source = &DC[dirW *size_MatC]; - fM00source = &DC[dirE *size_MatC]; - f0P0source = &DC[dirS *size_MatC]; - f0M0source = &DC[dirN *size_MatC]; - f00Psource = &DC[dirB *size_MatC]; - f00Msource = &DC[dirT *size_MatC]; - fPP0source = &DC[dirSW *size_MatC]; - fMM0source = &DC[dirNE *size_MatC]; - fPM0source = &DC[dirNW *size_MatC]; - fMP0source = &DC[dirSE *size_MatC]; - fP0Psource = &DC[dirBW *size_MatC]; - fM0Msource = &DC[dirTE *size_MatC]; - fP0Msource = &DC[dirTW *size_MatC]; - fM0Psource = &DC[dirBE *size_MatC]; - f0PPsource = &DC[dirBS *size_MatC]; - f0MMsource = &DC[dirTN *size_MatC]; - f0PMsource = &DC[dirTS *size_MatC]; - f0MPsource = &DC[dirBN *size_MatC]; - f000source = &DC[dirZERO*size_MatC]; - fMMMsource = &DC[dirTNE *size_MatC]; - fMMPsource = &DC[dirBNE *size_MatC]; - fMPPsource = &DC[dirBSE *size_MatC]; - fMPMsource = &DC[dirTSE *size_MatC]; - fPPMsource = &DC[dirTSW *size_MatC]; - fPPPsource = &DC[dirBSW *size_MatC]; - fPMPsource = &DC[dirBNW *size_MatC]; - fPMMsource = &DC[dirTNW *size_MatC]; + fP00source = &DC[DIR_M00 *size_MatC]; + fM00source = &DC[DIR_P00 *size_MatC]; + f0P0source = &DC[DIR_0M0 *size_MatC]; + f0M0source = &DC[DIR_0P0 *size_MatC]; + f00Psource = &DC[DIR_00M *size_MatC]; + f00Msource = &DC[DIR_00P *size_MatC]; + fPP0source = &DC[DIR_MM0 *size_MatC]; + fMM0source = &DC[DIR_PP0 *size_MatC]; + fPM0source = &DC[DIR_MP0 *size_MatC]; + fMP0source = &DC[DIR_PM0 *size_MatC]; + fP0Psource = &DC[DIR_M0M *size_MatC]; + fM0Msource = &DC[DIR_P0P *size_MatC]; + fP0Msource = &DC[DIR_M0P *size_MatC]; + fM0Psource = &DC[DIR_P0M *size_MatC]; + f0PPsource = &DC[DIR_0MM *size_MatC]; + f0MMsource = &DC[DIR_0PP *size_MatC]; + f0PMsource = &DC[DIR_0MP *size_MatC]; + f0MPsource = &DC[DIR_0PM *size_MatC]; + f000source = &DC[DIR_000*size_MatC]; + fMMMsource = &DC[DIR_PPP *size_MatC]; + fMMPsource = &DC[DIR_PPM *size_MatC]; + fMPPsource = &DC[DIR_PMM *size_MatC]; + fMPMsource = &DC[DIR_PMP *size_MatC]; + fPPMsource = &DC[DIR_MMP *size_MatC]; + fPPPsource = &DC[DIR_MMM *size_MatC]; + fPMPsource = &DC[DIR_MPM *size_MatC]; + fPMMsource = &DC[DIR_MPP *size_MatC]; } Distributions6 G; - G.g[dirE] = &G6[dirE *size_MatF]; - G.g[dirW] = &G6[dirW *size_MatF]; - G.g[dirN] = &G6[dirN *size_MatF]; - G.g[dirS] = &G6[dirS *size_MatF]; - G.g[dirT] = &G6[dirT *size_MatF]; - G.g[dirB] = &G6[dirB *size_MatF]; + G.g[DIR_P00] = &G6[DIR_P00 *size_MatF]; + G.g[DIR_M00] = &G6[DIR_M00 *size_MatF]; + G.g[DIR_0P0] = &G6[DIR_0P0 *size_MatF]; + G.g[DIR_0M0] = &G6[DIR_0M0 *size_MatF]; + G.g[DIR_00P] = &G6[DIR_00P *size_MatF]; + G.g[DIR_00M] = &G6[DIR_00M *size_MatF]; //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -1186,12 +1187,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -1622,12 +1623,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -2061,12 +2062,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -2500,12 +2501,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -2949,12 +2950,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -3388,12 +3389,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -3827,12 +3828,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -4266,12 +4267,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -4360,7 +4361,7 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3_2018(real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, +__global__ void scaleCF_comp_D3Q27F3( real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -4371,7 +4372,7 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posCSWB, unsigned int* posFSWB, unsigned int kCF, @@ -4390,107 +4391,107 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, *f000dest, *fMMMdest, *fMMPdest, *fMPPdest, *fMPMdest, *fPPMdest, *fPPPdest, *fPMPdest, *fPMMdest; - fP00dest = &DF[dirE *size_MatF]; - fM00dest = &DF[dirW *size_MatF]; - f0P0dest = &DF[dirN *size_MatF]; - f0M0dest = &DF[dirS *size_MatF]; - f00Pdest = &DF[dirT *size_MatF]; - f00Mdest = &DF[dirB *size_MatF]; - fPP0dest = &DF[dirNE *size_MatF]; - fMM0dest = &DF[dirSW *size_MatF]; - fPM0dest = &DF[dirSE *size_MatF]; - fMP0dest = &DF[dirNW *size_MatF]; - fP0Pdest = &DF[dirTE *size_MatF]; - fM0Mdest = &DF[dirBW *size_MatF]; - fP0Mdest = &DF[dirBE *size_MatF]; - fM0Pdest = &DF[dirTW *size_MatF]; - f0PPdest = &DF[dirTN *size_MatF]; - f0MMdest = &DF[dirBS *size_MatF]; - f0PMdest = &DF[dirBN *size_MatF]; - f0MPdest = &DF[dirTS *size_MatF]; - f000dest = &DF[dirZERO*size_MatF]; - fMMMdest = &DF[dirBSW *size_MatF]; - fMMPdest = &DF[dirTSW *size_MatF]; - fMPPdest = &DF[dirTNW *size_MatF]; - fMPMdest = &DF[dirBNW *size_MatF]; - fPPMdest = &DF[dirBNE *size_MatF]; - fPPPdest = &DF[dirTNE *size_MatF]; - fPMPdest = &DF[dirTSE *size_MatF]; - fPMMdest = &DF[dirBSE *size_MatF]; + fP00dest = &DF[DIR_P00 *size_MatF]; + fM00dest = &DF[DIR_M00 *size_MatF]; + f0P0dest = &DF[DIR_0P0 *size_MatF]; + f0M0dest = &DF[DIR_0M0 *size_MatF]; + f00Pdest = &DF[DIR_00P *size_MatF]; + f00Mdest = &DF[DIR_00M *size_MatF]; + fPP0dest = &DF[DIR_PP0 *size_MatF]; + fMM0dest = &DF[DIR_MM0 *size_MatF]; + fPM0dest = &DF[DIR_PM0 *size_MatF]; + fMP0dest = &DF[DIR_MP0 *size_MatF]; + fP0Pdest = &DF[DIR_P0P *size_MatF]; + fM0Mdest = &DF[DIR_M0M *size_MatF]; + fP0Mdest = &DF[DIR_P0M *size_MatF]; + fM0Pdest = &DF[DIR_M0P *size_MatF]; + f0PPdest = &DF[DIR_0PP *size_MatF]; + f0MMdest = &DF[DIR_0MM *size_MatF]; + f0PMdest = &DF[DIR_0PM *size_MatF]; + f0MPdest = &DF[DIR_0MP *size_MatF]; + f000dest = &DF[DIR_000*size_MatF]; + fMMMdest = &DF[DIR_MMM *size_MatF]; + fMMPdest = &DF[DIR_MMP *size_MatF]; + fMPPdest = &DF[DIR_MPP *size_MatF]; + fMPMdest = &DF[DIR_MPM *size_MatF]; + fPPMdest = &DF[DIR_PPM *size_MatF]; + fPPPdest = &DF[DIR_PPP *size_MatF]; + fPMPdest = &DF[DIR_PMP *size_MatF]; + fPMMdest = &DF[DIR_PMM *size_MatF]; real *fP00source, *fM00source, *f0P0source, *f0M0source, *f00Psource, *f00Msource, *fPP0source, *fMM0source, *fPM0source, *fMP0source, *fP0Psource, *fM0Msource, *fP0Msource, *fM0Psource, *f0PPsource, *f0MMsource, *f0PMsource, *f0MPsource, *f000source, *fMMMsource, *fMMPsource, *fMPPsource, *fMPMsource, *fPPMsource, *fPPPsource, *fPMPsource, *fPMMsource; - if (evenOrOdd == true) + if (isEvenTimestep == true) { - fP00source = &DC[dirE *size_MatC]; - fM00source = &DC[dirW *size_MatC]; - f0P0source = &DC[dirN *size_MatC]; - f0M0source = &DC[dirS *size_MatC]; - f00Psource = &DC[dirT *size_MatC]; - f00Msource = &DC[dirB *size_MatC]; - fPP0source = &DC[dirNE *size_MatC]; - fMM0source = &DC[dirSW *size_MatC]; - fPM0source = &DC[dirSE *size_MatC]; - fMP0source = &DC[dirNW *size_MatC]; - fP0Psource = &DC[dirTE *size_MatC]; - fM0Msource = &DC[dirBW *size_MatC]; - fP0Msource = &DC[dirBE *size_MatC]; - fM0Psource = &DC[dirTW *size_MatC]; - f0PPsource = &DC[dirTN *size_MatC]; - f0MMsource = &DC[dirBS *size_MatC]; - f0PMsource = &DC[dirBN *size_MatC]; - f0MPsource = &DC[dirTS *size_MatC]; - f000source = &DC[dirZERO*size_MatC]; - fMMMsource = &DC[dirBSW *size_MatC]; - fMMPsource = &DC[dirTSW *size_MatC]; - fMPPsource = &DC[dirTNW *size_MatC]; - fMPMsource = &DC[dirBNW *size_MatC]; - fPPMsource = &DC[dirBNE *size_MatC]; - fPPPsource = &DC[dirTNE *size_MatC]; - fPMPsource = &DC[dirTSE *size_MatC]; - fPMMsource = &DC[dirBSE *size_MatC]; + fP00source = &DC[DIR_P00 *size_MatC]; + fM00source = &DC[DIR_M00 *size_MatC]; + f0P0source = &DC[DIR_0P0 *size_MatC]; + f0M0source = &DC[DIR_0M0 *size_MatC]; + f00Psource = &DC[DIR_00P *size_MatC]; + f00Msource = &DC[DIR_00M *size_MatC]; + fPP0source = &DC[DIR_PP0 *size_MatC]; + fMM0source = &DC[DIR_MM0 *size_MatC]; + fPM0source = &DC[DIR_PM0 *size_MatC]; + fMP0source = &DC[DIR_MP0 *size_MatC]; + fP0Psource = &DC[DIR_P0P *size_MatC]; + fM0Msource = &DC[DIR_M0M *size_MatC]; + fP0Msource = &DC[DIR_P0M *size_MatC]; + fM0Psource = &DC[DIR_M0P *size_MatC]; + f0PPsource = &DC[DIR_0PP *size_MatC]; + f0MMsource = &DC[DIR_0MM *size_MatC]; + f0PMsource = &DC[DIR_0PM *size_MatC]; + f0MPsource = &DC[DIR_0MP *size_MatC]; + f000source = &DC[DIR_000*size_MatC]; + fMMMsource = &DC[DIR_MMM *size_MatC]; + fMMPsource = &DC[DIR_MMP *size_MatC]; + fMPPsource = &DC[DIR_MPP *size_MatC]; + fMPMsource = &DC[DIR_MPM *size_MatC]; + fPPMsource = &DC[DIR_PPM *size_MatC]; + fPPPsource = &DC[DIR_PPP *size_MatC]; + fPMPsource = &DC[DIR_PMP *size_MatC]; + fPMMsource = &DC[DIR_PMM *size_MatC]; } else { - fP00source = &DC[dirW *size_MatC]; - fM00source = &DC[dirE *size_MatC]; - f0P0source = &DC[dirS *size_MatC]; - f0M0source = &DC[dirN *size_MatC]; - f00Psource = &DC[dirB *size_MatC]; - f00Msource = &DC[dirT *size_MatC]; - fPP0source = &DC[dirSW *size_MatC]; - fMM0source = &DC[dirNE *size_MatC]; - fPM0source = &DC[dirNW *size_MatC]; - fMP0source = &DC[dirSE *size_MatC]; - fP0Psource = &DC[dirBW *size_MatC]; - fM0Msource = &DC[dirTE *size_MatC]; - fP0Msource = &DC[dirTW *size_MatC]; - fM0Psource = &DC[dirBE *size_MatC]; - f0PPsource = &DC[dirBS *size_MatC]; - f0MMsource = &DC[dirTN *size_MatC]; - f0PMsource = &DC[dirTS *size_MatC]; - f0MPsource = &DC[dirBN *size_MatC]; - f000source = &DC[dirZERO*size_MatC]; - fMMMsource = &DC[dirTNE *size_MatC]; - fMMPsource = &DC[dirBNE *size_MatC]; - fMPPsource = &DC[dirBSE *size_MatC]; - fMPMsource = &DC[dirTSE *size_MatC]; - fPPMsource = &DC[dirTSW *size_MatC]; - fPPPsource = &DC[dirBSW *size_MatC]; - fPMPsource = &DC[dirBNW *size_MatC]; - fPMMsource = &DC[dirTNW *size_MatC]; + fP00source = &DC[DIR_M00 *size_MatC]; + fM00source = &DC[DIR_P00 *size_MatC]; + f0P0source = &DC[DIR_0M0 *size_MatC]; + f0M0source = &DC[DIR_0P0 *size_MatC]; + f00Psource = &DC[DIR_00M *size_MatC]; + f00Msource = &DC[DIR_00P *size_MatC]; + fPP0source = &DC[DIR_MM0 *size_MatC]; + fMM0source = &DC[DIR_PP0 *size_MatC]; + fPM0source = &DC[DIR_MP0 *size_MatC]; + fMP0source = &DC[DIR_PM0 *size_MatC]; + fP0Psource = &DC[DIR_M0M *size_MatC]; + fM0Msource = &DC[DIR_P0P *size_MatC]; + fP0Msource = &DC[DIR_M0P *size_MatC]; + fM0Psource = &DC[DIR_P0M *size_MatC]; + f0PPsource = &DC[DIR_0MM *size_MatC]; + f0MMsource = &DC[DIR_0PP *size_MatC]; + f0PMsource = &DC[DIR_0MP *size_MatC]; + f0MPsource = &DC[DIR_0PM *size_MatC]; + f000source = &DC[DIR_000*size_MatC]; + fMMMsource = &DC[DIR_PPP *size_MatC]; + fMMPsource = &DC[DIR_PPM *size_MatC]; + fMPPsource = &DC[DIR_PMM *size_MatC]; + fMPMsource = &DC[DIR_PMP *size_MatC]; + fPPMsource = &DC[DIR_MMP *size_MatC]; + fPPPsource = &DC[DIR_MMM *size_MatC]; + fPMPsource = &DC[DIR_MPM *size_MatC]; + fPMMsource = &DC[DIR_MPP *size_MatC]; } Distributions6 G; - G.g[dirE] = &G6[dirE *size_MatF]; - G.g[dirW] = &G6[dirW *size_MatF]; - G.g[dirN] = &G6[dirN *size_MatF]; - G.g[dirS] = &G6[dirS *size_MatF]; - G.g[dirT] = &G6[dirT *size_MatF]; - G.g[dirB] = &G6[dirB *size_MatF]; + G.g[DIR_P00] = &G6[DIR_P00 *size_MatF]; + G.g[DIR_M00] = &G6[DIR_M00 *size_MatF]; + G.g[DIR_0P0] = &G6[DIR_0P0 *size_MatF]; + G.g[DIR_0M0] = &G6[DIR_0M0 *size_MatF]; + G.g[DIR_00P] = &G6[DIR_00P *size_MatF]; + G.g[DIR_00M] = &G6[DIR_00M *size_MatF]; //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -5521,12 +5522,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -5948,12 +5949,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -6378,12 +6379,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -6808,12 +6809,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -7248,12 +7249,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -7678,12 +7679,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -8108,12 +8109,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -8538,12 +8539,12 @@ extern "C" __global__ void scaleCF_comp_D3Q27F3( real* DC, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; diff --git a/src/gpu/VirtualFluids_GPU/GPU/ScaleFC27.cu b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleFC27.cu similarity index 88% rename from src/gpu/VirtualFluids_GPU/GPU/ScaleFC27.cu rename to src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleFC27.cu index 06d5086cc7f57c8245517f922662e8eea4571d05..f2a66876cf39e3519e22fc2b0e236514f05ce85a 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/ScaleFC27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleFC27.cu @@ -7,13 +7,14 @@ ////////////////////////////////////////////////////////////////////////// /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFC_0817_comp_27( real* DC, +__global__ void scaleFC_0817_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -23,7 +24,7 @@ extern "C" __global__ void scaleFC_0817_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -42,98 +43,98 @@ extern "C" __global__ void scaleFC_0817_comp_27( real* DC, *f000source, *fMMMsource, *fMMPsource, *fMPPsource, *fMPMsource, *fPPMsource, *fPPPsource, *fPMPsource, *fPMMsource; - fP00source = &DF[dirE *size_MatF]; - fM00source = &DF[dirW *size_MatF]; - f0P0source = &DF[dirN *size_MatF]; - f0M0source = &DF[dirS *size_MatF]; - f00Psource = &DF[dirT *size_MatF]; - f00Msource = &DF[dirB *size_MatF]; - fPP0source = &DF[dirNE *size_MatF]; - fMM0source = &DF[dirSW *size_MatF]; - fPM0source = &DF[dirSE *size_MatF]; - fMP0source = &DF[dirNW *size_MatF]; - fP0Psource = &DF[dirTE *size_MatF]; - fM0Msource = &DF[dirBW *size_MatF]; - fP0Msource = &DF[dirBE *size_MatF]; - fM0Psource = &DF[dirTW *size_MatF]; - f0PPsource = &DF[dirTN *size_MatF]; - f0MMsource = &DF[dirBS *size_MatF]; - f0PMsource = &DF[dirBN *size_MatF]; - f0MPsource = &DF[dirTS *size_MatF]; - f000source = &DF[dirZERO*size_MatF]; - fMMMsource = &DF[dirBSW *size_MatF]; - fMMPsource = &DF[dirTSW *size_MatF]; - fMPPsource = &DF[dirTNW *size_MatF]; - fMPMsource = &DF[dirBNW *size_MatF]; - fPPMsource = &DF[dirBNE *size_MatF]; - fPPPsource = &DF[dirTNE *size_MatF]; - fPMPsource = &DF[dirTSE *size_MatF]; - fPMMsource = &DF[dirBSE *size_MatF]; + fP00source = &DF[DIR_P00 *size_MatF]; + fM00source = &DF[DIR_M00 *size_MatF]; + f0P0source = &DF[DIR_0P0 *size_MatF]; + f0M0source = &DF[DIR_0M0 *size_MatF]; + f00Psource = &DF[DIR_00P *size_MatF]; + f00Msource = &DF[DIR_00M *size_MatF]; + fPP0source = &DF[DIR_PP0 *size_MatF]; + fMM0source = &DF[DIR_MM0 *size_MatF]; + fPM0source = &DF[DIR_PM0 *size_MatF]; + fMP0source = &DF[DIR_MP0 *size_MatF]; + fP0Psource = &DF[DIR_P0P *size_MatF]; + fM0Msource = &DF[DIR_M0M *size_MatF]; + fP0Msource = &DF[DIR_P0M *size_MatF]; + fM0Psource = &DF[DIR_M0P *size_MatF]; + f0PPsource = &DF[DIR_0PP *size_MatF]; + f0MMsource = &DF[DIR_0MM *size_MatF]; + f0PMsource = &DF[DIR_0PM *size_MatF]; + f0MPsource = &DF[DIR_0MP *size_MatF]; + f000source = &DF[DIR_000*size_MatF]; + fMMMsource = &DF[DIR_MMM *size_MatF]; + fMMPsource = &DF[DIR_MMP *size_MatF]; + fMPPsource = &DF[DIR_MPP *size_MatF]; + fMPMsource = &DF[DIR_MPM *size_MatF]; + fPPMsource = &DF[DIR_PPM *size_MatF]; + fPPPsource = &DF[DIR_PPP *size_MatF]; + fPMPsource = &DF[DIR_PMP *size_MatF]; + fPMMsource = &DF[DIR_PMM *size_MatF]; real *fP00dest, *fM00dest, *f0P0dest, *f0M0dest, *f00Pdest, *f00Mdest, *fPP0dest, *fMM0dest, *fPM0dest, *fMP0dest, *fP0Pdest, *fM0Mdest, *fP0Mdest, *fM0Pdest, *f0PPdest, *f0MMdest, *f0PMdest, *f0MPdest, *f000dest, *fMMMdest, *fMMPdest, *fMPPdest, *fMPMdest, *fPPMdest, *fPPPdest, *fPMPdest, *fPMMdest; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - fP00dest = &DC[dirE *size_MatC]; - fM00dest = &DC[dirW *size_MatC]; - f0P0dest = &DC[dirN *size_MatC]; - f0M0dest = &DC[dirS *size_MatC]; - f00Pdest = &DC[dirT *size_MatC]; - f00Mdest = &DC[dirB *size_MatC]; - fPP0dest = &DC[dirNE *size_MatC]; - fMM0dest = &DC[dirSW *size_MatC]; - fPM0dest = &DC[dirSE *size_MatC]; - fMP0dest = &DC[dirNW *size_MatC]; - fP0Pdest = &DC[dirTE *size_MatC]; - fM0Mdest = &DC[dirBW *size_MatC]; - fP0Mdest = &DC[dirBE *size_MatC]; - fM0Pdest = &DC[dirTW *size_MatC]; - f0PPdest = &DC[dirTN *size_MatC]; - f0MMdest = &DC[dirBS *size_MatC]; - f0PMdest = &DC[dirBN *size_MatC]; - f0MPdest = &DC[dirTS *size_MatC]; - f000dest = &DC[dirZERO*size_MatC]; - fMMMdest = &DC[dirBSW *size_MatC]; - fMMPdest = &DC[dirTSW *size_MatC]; - fMPPdest = &DC[dirTNW *size_MatC]; - fMPMdest = &DC[dirBNW *size_MatC]; - fPPMdest = &DC[dirBNE *size_MatC]; - fPPPdest = &DC[dirTNE *size_MatC]; - fPMPdest = &DC[dirTSE *size_MatC]; - fPMMdest = &DC[dirBSE *size_MatC]; + fP00dest = &DC[DIR_P00 *size_MatC]; + fM00dest = &DC[DIR_M00 *size_MatC]; + f0P0dest = &DC[DIR_0P0 *size_MatC]; + f0M0dest = &DC[DIR_0M0 *size_MatC]; + f00Pdest = &DC[DIR_00P *size_MatC]; + f00Mdest = &DC[DIR_00M *size_MatC]; + fPP0dest = &DC[DIR_PP0 *size_MatC]; + fMM0dest = &DC[DIR_MM0 *size_MatC]; + fPM0dest = &DC[DIR_PM0 *size_MatC]; + fMP0dest = &DC[DIR_MP0 *size_MatC]; + fP0Pdest = &DC[DIR_P0P *size_MatC]; + fM0Mdest = &DC[DIR_M0M *size_MatC]; + fP0Mdest = &DC[DIR_P0M *size_MatC]; + fM0Pdest = &DC[DIR_M0P *size_MatC]; + f0PPdest = &DC[DIR_0PP *size_MatC]; + f0MMdest = &DC[DIR_0MM *size_MatC]; + f0PMdest = &DC[DIR_0PM *size_MatC]; + f0MPdest = &DC[DIR_0MP *size_MatC]; + f000dest = &DC[DIR_000*size_MatC]; + fMMMdest = &DC[DIR_MMM *size_MatC]; + fMMPdest = &DC[DIR_MMP *size_MatC]; + fMPPdest = &DC[DIR_MPP *size_MatC]; + fMPMdest = &DC[DIR_MPM *size_MatC]; + fPPMdest = &DC[DIR_PPM *size_MatC]; + fPPPdest = &DC[DIR_PPP *size_MatC]; + fPMPdest = &DC[DIR_PMP *size_MatC]; + fPMMdest = &DC[DIR_PMM *size_MatC]; } else { - fP00dest = &DC[dirW *size_MatC]; - fM00dest = &DC[dirE *size_MatC]; - f0P0dest = &DC[dirS *size_MatC]; - f0M0dest = &DC[dirN *size_MatC]; - f00Pdest = &DC[dirB *size_MatC]; - f00Mdest = &DC[dirT *size_MatC]; - fPP0dest = &DC[dirSW *size_MatC]; - fMM0dest = &DC[dirNE *size_MatC]; - fPM0dest = &DC[dirNW *size_MatC]; - fMP0dest = &DC[dirSE *size_MatC]; - fP0Pdest = &DC[dirBW *size_MatC]; - fM0Mdest = &DC[dirTE *size_MatC]; - fP0Mdest = &DC[dirTW *size_MatC]; - fM0Pdest = &DC[dirBE *size_MatC]; - f0PPdest = &DC[dirBS *size_MatC]; - f0MMdest = &DC[dirTN *size_MatC]; - f0PMdest = &DC[dirTS *size_MatC]; - f0MPdest = &DC[dirBN *size_MatC]; - f000dest = &DC[dirZERO*size_MatC]; - fMMMdest = &DC[dirTNE *size_MatC]; - fMMPdest = &DC[dirBNE *size_MatC]; - fMPPdest = &DC[dirBSE *size_MatC]; - fMPMdest = &DC[dirTSE *size_MatC]; - fPPMdest = &DC[dirTSW *size_MatC]; - fPPPdest = &DC[dirBSW *size_MatC]; - fPMPdest = &DC[dirBNW *size_MatC]; - fPMMdest = &DC[dirTNW *size_MatC]; + fP00dest = &DC[DIR_M00 *size_MatC]; + fM00dest = &DC[DIR_P00 *size_MatC]; + f0P0dest = &DC[DIR_0M0 *size_MatC]; + f0M0dest = &DC[DIR_0P0 *size_MatC]; + f00Pdest = &DC[DIR_00M *size_MatC]; + f00Mdest = &DC[DIR_00P *size_MatC]; + fPP0dest = &DC[DIR_MM0 *size_MatC]; + fMM0dest = &DC[DIR_PP0 *size_MatC]; + fPM0dest = &DC[DIR_MP0 *size_MatC]; + fMP0dest = &DC[DIR_PM0 *size_MatC]; + fP0Pdest = &DC[DIR_M0M *size_MatC]; + fM0Mdest = &DC[DIR_P0P *size_MatC]; + fP0Mdest = &DC[DIR_M0P *size_MatC]; + fM0Pdest = &DC[DIR_P0M *size_MatC]; + f0PPdest = &DC[DIR_0MM *size_MatC]; + f0MMdest = &DC[DIR_0PP *size_MatC]; + f0PMdest = &DC[DIR_0MP *size_MatC]; + f0MPdest = &DC[DIR_0PM *size_MatC]; + f000dest = &DC[DIR_000*size_MatC]; + fMMMdest = &DC[DIR_PPP *size_MatC]; + fMMPdest = &DC[DIR_PPM *size_MatC]; + fMPPdest = &DC[DIR_PMM *size_MatC]; + fMPMdest = &DC[DIR_PMP *size_MatC]; + fPPMdest = &DC[DIR_MMP *size_MatC]; + fPPPdest = &DC[DIR_MMM *size_MatC]; + fPMPdest = &DC[DIR_MPM *size_MatC]; + fPMMdest = &DC[DIR_MPP *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -1209,7 +1210,7 @@ extern "C" __global__ void scaleFC_0817_comp_27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFC_AA2016_comp_27(real* DC, +__global__ void scaleFC_AA2016_comp_27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -1219,7 +1220,7 @@ extern "C" __global__ void scaleFC_AA2016_comp_27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -1235,96 +1236,96 @@ extern "C" __global__ void scaleFC_AA2016_comp_27(real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -1454,9 +1455,9 @@ extern "C" __global__ void scaleFC_AA2016_comp_27(real* DC, vx2_SWB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_SWB); vx3_SWB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_SWB); - kxyFromfcNEQ_SWB = -c3o1*omegaS*((f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE ) / (c1o1 + drho_SWB) - ((vx1_SWB*vx2_SWB))); - kyzFromfcNEQ_SWB = -c3o1*omegaS*((f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW ) / (c1o1 + drho_SWB) - ((vx2_SWB*vx3_SWB))); - kxzFromfcNEQ_SWB = -c3o1*omegaS*((f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE ) / (c1o1 + drho_SWB) - ((vx1_SWB*vx3_SWB))); + kxyFromfcNEQ_SWB = -c3o1*omegaS*((f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE ) / (c1o1 + drho_SWB) - ((vx1_SWB*vx2_SWB))); + kyzFromfcNEQ_SWB = -c3o1*omegaS*((f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW ) / (c1o1 + drho_SWB) - ((vx2_SWB*vx3_SWB))); + kxzFromfcNEQ_SWB = -c3o1*omegaS*((f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE ) / (c1o1 + drho_SWB) - ((vx1_SWB*vx3_SWB))); kxxMyyFromfcNEQ_SWB = -c3o2*omegaS *((f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE ) / (c1o1 + drho_SWB) - ((vx1_SWB*vx1_SWB-vx2_SWB*vx2_SWB))); kxxMzzFromfcNEQ_SWB = -c3o2*omegaS *((f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE ) / (c1o1 + drho_SWB) - ((vx1_SWB*vx1_SWB-vx3_SWB*vx3_SWB))); @@ -5065,11 +5066,11 @@ extern "C" __global__ void scaleFC_AA2016_comp_27(real* DC, // linear combinations mfbbb = c4o1 * (c24o1*(-c2o1+omFine)*(-c2o1-c7o1*omFine+c3o1*omFine*omFine)/(c48o1+c152o1*omFine-c130o1*omFine*omFine+c29o1*omFine*omFine*omFine)) / (c24o1*(-c2o1+omCoarse)*(-c2o1-c7o1*omCoarse+c3o1*omCoarse*omCoarse)/(c48o1+c152o1*omCoarse-c130o1*omCoarse*omCoarse+c29o1*omCoarse*omCoarse*omCoarse)) * mfbbbMean; - mxxyPyzz = c4o1 * (c8o1*(-c2o1+omFine)*(c1o1+c2o1*omFine)/(-c8o1-c14o1*omFine+c7o1*omFine*omFine)) / (c8o1*(-c2o1+omCoarse)*(c1o1+c2o1*omCoarse)/(-c8o1-c14o1*omCoarse+c7o1*omCoarse*omCoarse)) * mxxyPyzzMean; + mxxyPyzz = c4o1 * (c8o1*(-c2o1+omFine)*(c1o1+c2o1*omFine) /(-c8o1-c14o1*omFine+c7o1*omFine*omFine)) / (c8o1*(-c2o1+omCoarse)*(c1o1+c2o1*omCoarse)/(-c8o1-c14o1*omCoarse+c7o1*omCoarse*omCoarse)) * mxxyPyzzMean; mxxyMyzz = c4o1 * (c8o1*(-c2o1+omFine)*(-c7o1+c4o1*omFine)/(c56o1-c50o1*omFine+c9o1*omFine*omFine)) / (c8o1*(-c2o1+omCoarse)*(-c7o1+c4o1*omCoarse)/(c56o1-c50o1*omCoarse+c9o1*omCoarse*omCoarse)) * mxxyMyzzMean; - mxxzPyyz = c4o1 * (c8o1*(-c2o1+omFine)*(c1o1+c2o1*omFine)/(-c8o1-c14o1*omFine+c7o1*omFine*omFine)) / (c8o1*(-c2o1+omCoarse)*(c1o1+c2o1*omCoarse)/(-c8o1-c14o1*omCoarse+c7o1*omCoarse*omCoarse)) * mxxzPyyzMean; + mxxzPyyz = c4o1 * (c8o1*(-c2o1+omFine)*(c1o1+c2o1*omFine) /(-c8o1-c14o1*omFine+c7o1*omFine*omFine)) / (c8o1*(-c2o1+omCoarse)*(c1o1+c2o1*omCoarse)/(-c8o1-c14o1*omCoarse+c7o1*omCoarse*omCoarse)) * mxxzPyyzMean; mxxzMyyz = c4o1 * (c8o1*(-c2o1+omFine)*(-c7o1+c4o1*omFine)/(c56o1-c50o1*omFine+c9o1*omFine*omFine)) / (c8o1*(-c2o1+omCoarse)*(-c7o1+c4o1*omCoarse)/(c56o1-c50o1*omCoarse+c9o1*omCoarse*omCoarse)) * mxxzMyyzMean; - mxyyPxzz = c4o1 * (c8o1*(-c2o1+omFine)*(c1o1+c2o1*omFine)/(-c8o1-c14o1*omFine+c7o1*omFine*omFine)) / (c8o1*(-c2o1+omCoarse)*(c1o1+c2o1*omCoarse)/(-c8o1-c14o1*omCoarse+c7o1*omCoarse*omCoarse)) * mxyyPxzzMean; + mxyyPxzz = c4o1 * (c8o1*(-c2o1+omFine)*(c1o1+c2o1*omFine) /(-c8o1-c14o1*omFine+c7o1*omFine*omFine)) / (c8o1*(-c2o1+omCoarse)*(c1o1+c2o1*omCoarse)/(-c8o1-c14o1*omCoarse+c7o1*omCoarse*omCoarse)) * mxyyPxzzMean; mxyyMxzz = c4o1 * (c8o1*(-c2o1+omFine)*(-c7o1+c4o1*omFine)/(c56o1-c50o1*omFine+c9o1*omFine*omFine)) / (c8o1*(-c2o1+omCoarse)*(-c7o1+c4o1*omCoarse)/(c56o1-c50o1*omCoarse+c9o1*omCoarse*omCoarse)) * mxyyMxzzMean; // linear combinations back @@ -5398,7 +5399,7 @@ extern "C" __global__ void scaleFC_AA2016_comp_27(real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFC_RhoSq_3rdMom_comp_27(real* DC, +__global__ void scaleFC_RhoSq_3rdMom_comp_27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -5408,7 +5409,7 @@ extern "C" __global__ void scaleFC_RhoSq_3rdMom_comp_27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -5424,96 +5425,96 @@ extern "C" __global__ void scaleFC_RhoSq_3rdMom_comp_27(real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -9586,7 +9587,1476 @@ extern "C" __global__ void scaleFC_RhoSq_3rdMom_comp_27(real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFC_RhoSq_comp_27(real* DC, +__device__ void scaleFC_RhoSq_comp_27_Calculation(real *DC, real *DF, unsigned int *neighborCX, unsigned int *neighborCY, + unsigned int *neighborCZ, unsigned int *neighborFX, unsigned int *neighborFY, + unsigned int *neighborFZ, unsigned int size_MatC, unsigned int size_MatF, + bool isEvenTimestep, unsigned int *posC, unsigned int *posFSWB, unsigned int kFC, + real omCoarse, real omFine, real nu, unsigned int nxC, unsigned int nyC, + unsigned int nxF, unsigned int nyF, OffFC offFC, const unsigned k) +{ + real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, + *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; + + feF = &DF[DIR_P00 * size_MatF]; + fwF = &DF[DIR_M00 * size_MatF]; + fnF = &DF[DIR_0P0 * size_MatF]; + fsF = &DF[DIR_0M0 * size_MatF]; + ftF = &DF[DIR_00P * size_MatF]; + fbF = &DF[DIR_00M * size_MatF]; + fneF = &DF[DIR_PP0 * size_MatF]; + fswF = &DF[DIR_MM0 * size_MatF]; + fseF = &DF[DIR_PM0 * size_MatF]; + fnwF = &DF[DIR_MP0 * size_MatF]; + fteF = &DF[DIR_P0P * size_MatF]; + fbwF = &DF[DIR_M0M * size_MatF]; + fbeF = &DF[DIR_P0M * size_MatF]; + ftwF = &DF[DIR_M0P * size_MatF]; + ftnF = &DF[DIR_0PP * size_MatF]; + fbsF = &DF[DIR_0MM * size_MatF]; + fbnF = &DF[DIR_0PM * size_MatF]; + ftsF = &DF[DIR_0MP * size_MatF]; + fzeroF = &DF[DIR_000 * size_MatF]; + ftneF = &DF[DIR_PPP * size_MatF]; + ftswF = &DF[DIR_MMP * size_MatF]; + ftseF = &DF[DIR_PMP * size_MatF]; + ftnwF = &DF[DIR_MPP * size_MatF]; + fbneF = &DF[DIR_PPM * size_MatF]; + fbswF = &DF[DIR_MMM * size_MatF]; + fbseF = &DF[DIR_PMM * size_MatF]; + fbnwF = &DF[DIR_MPM * size_MatF]; + + real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, + *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; + + if (isEvenTimestep == true) { + feC = &DC[DIR_P00 * size_MatC]; + fwC = &DC[DIR_M00 * size_MatC]; + fnC = &DC[DIR_0P0 * size_MatC]; + fsC = &DC[DIR_0M0 * size_MatC]; + ftC = &DC[DIR_00P * size_MatC]; + fbC = &DC[DIR_00M * size_MatC]; + fneC = &DC[DIR_PP0 * size_MatC]; + fswC = &DC[DIR_MM0 * size_MatC]; + fseC = &DC[DIR_PM0 * size_MatC]; + fnwC = &DC[DIR_MP0 * size_MatC]; + fteC = &DC[DIR_P0P * size_MatC]; + fbwC = &DC[DIR_M0M * size_MatC]; + fbeC = &DC[DIR_P0M * size_MatC]; + ftwC = &DC[DIR_M0P * size_MatC]; + ftnC = &DC[DIR_0PP * size_MatC]; + fbsC = &DC[DIR_0MM * size_MatC]; + fbnC = &DC[DIR_0PM * size_MatC]; + ftsC = &DC[DIR_0MP * size_MatC]; + fzeroC = &DC[DIR_000 * size_MatC]; + ftneC = &DC[DIR_PPP * size_MatC]; + ftswC = &DC[DIR_MMP * size_MatC]; + ftseC = &DC[DIR_PMP * size_MatC]; + ftnwC = &DC[DIR_MPP * size_MatC]; + fbneC = &DC[DIR_PPM * size_MatC]; + fbswC = &DC[DIR_MMM * size_MatC]; + fbseC = &DC[DIR_PMM * size_MatC]; + fbnwC = &DC[DIR_MPM * size_MatC]; + } else { + fwC = &DC[DIR_P00 * size_MatC]; + feC = &DC[DIR_M00 * size_MatC]; + fsC = &DC[DIR_0P0 * size_MatC]; + fnC = &DC[DIR_0M0 * size_MatC]; + fbC = &DC[DIR_00P * size_MatC]; + ftC = &DC[DIR_00M * size_MatC]; + fswC = &DC[DIR_PP0 * size_MatC]; + fneC = &DC[DIR_MM0 * size_MatC]; + fnwC = &DC[DIR_PM0 * size_MatC]; + fseC = &DC[DIR_MP0 * size_MatC]; + fbwC = &DC[DIR_P0P * size_MatC]; + fteC = &DC[DIR_M0M * size_MatC]; + ftwC = &DC[DIR_P0M * size_MatC]; + fbeC = &DC[DIR_M0P * size_MatC]; + fbsC = &DC[DIR_0PP * size_MatC]; + ftnC = &DC[DIR_0MM * size_MatC]; + ftsC = &DC[DIR_0PM * size_MatC]; + fbnC = &DC[DIR_0MP * size_MatC]; + fzeroC = &DC[DIR_000 * size_MatC]; + fbswC = &DC[DIR_PPP * size_MatC]; + fbneC = &DC[DIR_MMP * size_MatC]; + fbnwC = &DC[DIR_PMP * size_MatC]; + fbseC = &DC[DIR_MPP * size_MatC]; + ftswC = &DC[DIR_PPM * size_MatC]; + ftneC = &DC[DIR_MMM * size_MatC]; + ftnwC = &DC[DIR_PMM * size_MatC]; + ftseC = &DC[DIR_MPM * size_MatC]; + } + + //////////////////////////////////////////////////////////////////////////////// + real eps_new = c2o1; + real omegaS = omFine; //-omFine; + real o = omCoarse; //-omCoarse; + // real op = one; + // real cu_sq; + + real xoff, yoff, zoff; + real xoff_sq, yoff_sq, zoff_sq; + + real press; //,drho,vx1,vx2,vx3; + real /*press_SWT,*/ drho_SWT, vx1_SWT, vx2_SWT, vx3_SWT; + real /*press_NWT,*/ drho_NWT, vx1_NWT, vx2_NWT, vx3_NWT; + real /*press_NET,*/ drho_NET, vx1_NET, vx2_NET, vx3_NET; + real /*press_SET,*/ drho_SET, vx1_SET, vx2_SET, vx3_SET; + real /*press_SWB,*/ drho_SWB, vx1_SWB, vx2_SWB, vx3_SWB; + real /*press_NWB,*/ drho_NWB, vx1_NWB, vx2_NWB, vx3_NWB; + real /*press_NEB,*/ drho_NEB, vx1_NEB, vx2_NEB, vx3_NEB; + real /*press_SEB,*/ drho_SEB, vx1_SEB, vx2_SEB, vx3_SEB; + real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_ZERO, + f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; + // real + // feq_E,feq_W,feq_N,feq_S,feq_T,feq_B,feq_NE,feq_SW,feq_SE,feq_NW,feq_TE,feq_BW,feq_BE,feq_TW,feq_TN,feq_BS,feq_BN,feq_TS,feq_ZERO,feq_TNE, + // feq_TSW, feq_TSE, feq_TNW, feq_BNE, feq_BSW, feq_BSE, feq_BNW; + real kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT; + real kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT; + real kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET; + real kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET; + real kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB; + real kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB; + real kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB; + real kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB; + real a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, + cxx, cyy, czz, cxy, cxz, cyz /*, axyz, bxyz, cxyz*/; + real d0, dx, dy, dz, dxy, dxz, dyz /*, dxyz*/; + + if (k < kFC) { + ////////////////////////////////////////////////////////////////////////// + xoff = offFC.xOffFC[k]; + yoff = offFC.yOffFC[k]; + zoff = offFC.zOffFC[k]; + xoff_sq = xoff * xoff; + yoff_sq = yoff * yoff; + zoff_sq = zoff * zoff; + ////////////////////////////////////////////////////////////////////////// + // SWB// + ////////////////////////////////////////////////////////////////////////// + // index 0 + unsigned int k0zero = posFSWB[k]; + unsigned int k0w = neighborFX[k0zero]; + unsigned int k0s = neighborFY[k0zero]; + unsigned int k0b = neighborFZ[k0zero]; + unsigned int k0sw = neighborFY[k0w]; + unsigned int k0bw = neighborFZ[k0w]; + unsigned int k0bs = neighborFZ[k0s]; + unsigned int k0bsw = neighborFZ[k0sw]; + ////////////////////////////////////////////////////////////////////////// + // index + unsigned int kzero = k0zero; + unsigned int kw = k0w; + unsigned int ks = k0s; + unsigned int kb = k0b; + unsigned int ksw = k0sw; + unsigned int kbw = k0bw; + unsigned int kbs = k0bs; + unsigned int kbsw = k0bsw; + //////////////////////////////////////////////////////////////////////////////// + f_E = feF[kzero]; + f_W = fwF[kw]; + f_N = fnF[kzero]; + f_S = fsF[ks]; + f_T = ftF[kzero]; + f_B = fbF[kb]; + f_NE = fneF[kzero]; + f_SW = fswF[ksw]; + f_SE = fseF[ks]; + f_NW = fnwF[kw]; + f_TE = fteF[kzero]; + f_BW = fbwF[kbw]; + f_BE = fbeF[kb]; + f_TW = ftwF[kw]; + f_TN = ftnF[kzero]; + f_BS = fbsF[kbs]; + f_BN = fbnF[kb]; + f_TS = ftsF[ks]; + f_ZERO = fzeroF[kzero]; + f_TNE = ftneF[kzero]; + f_TSW = ftswF[ksw]; + f_TSE = ftseF[ks]; + f_TNW = ftnwF[kw]; + f_BNE = fbneF[kb]; + f_BSW = fbswF[kbsw]; + f_BSE = fbseF[kbs]; + f_BNW = fbnwF[kbw]; + + drho_SWB = f_E + f_W + f_N + f_S + f_T + f_B + f_NE + f_SW + f_SE + f_NW + f_TE + f_BW + f_BE + f_TW + f_TN + + f_BS + f_BN + f_TS + f_ZERO + f_TNE + f_TSW + f_TSE + f_TNW + f_BNE + f_BSW + f_BSE + f_BNW; + vx1_SWB = (((f_TNE - f_BSW) + (f_TSE - f_BNW) + (f_BNE - f_TSW) + (f_BSE - f_TNW)) + + (((f_NE - f_SW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_BE - f_TW))) + (f_E - f_W)) / + (c1o1 + drho_SWB); + vx2_SWB = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_BNE - f_TSW) + (f_BNW - f_TSE)) + + (((f_NE - f_SW) + (f_TN - f_BS)) + ((f_BN - f_TS) + (f_NW - f_SE))) + (f_N - f_S)) / + (c1o1 + drho_SWB); + vx3_SWB = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_TSE - f_BNW) + (f_TSW - f_BNE)) + + (((f_TE - f_BW) + (f_TN - f_BS)) + ((f_TW - f_BE) + (f_TS - f_BN))) + (f_T - f_B)) / + (c1o1 + drho_SWB); + + kxyFromfcNEQ_SWB = + -c3o1 * omegaS * + ((f_SW + f_BSW + f_TSW - f_NW - f_BNW - f_TNW - f_SE - f_BSE - f_TSE + f_NE + f_BNE + f_TNE) / + (c1o1 + drho_SWB) - + ((vx1_SWB * vx2_SWB))); + kyzFromfcNEQ_SWB = + -c3o1 * omegaS * + ((f_BS + f_BSE + f_BSW - f_TS - f_TSE - f_TSW - f_BN - f_BNE - f_BNW + f_TN + f_TNE + f_TNW) / + (c1o1 + drho_SWB) - + ((vx2_SWB * vx3_SWB))); + kxzFromfcNEQ_SWB = + -c3o1 * omegaS * + ((f_BW + f_BSW + f_BNW - f_TW - f_TSW - f_TNW - f_BE - f_BSE - f_BNE + f_TE + f_TSE + f_TNE) / + (c1o1 + drho_SWB) - + ((vx1_SWB * vx3_SWB))); + kxxMyyFromfcNEQ_SWB = + -c3o2 * omegaS * + ((f_BW + f_W + f_TW - f_BS - f_S - f_TS - f_BN - f_N - f_TN + f_BE + f_E + f_TE) / (c1o1 + drho_SWB) - + ((vx1_SWB * vx1_SWB - vx2_SWB * vx2_SWB))); + kxxMzzFromfcNEQ_SWB = + -c3o2 * omegaS * + ((f_SW + f_W + f_NW - f_BS - f_TS - f_B - f_T - f_BN - f_TN + f_SE + f_E + f_NE) / (c1o1 + drho_SWB) - + ((vx1_SWB * vx1_SWB - vx3_SWB * vx3_SWB))); + + ////////////////////////////////////////////////////////////////////////// + // SWT// + ////////////////////////////////////////////////////////////////////////// + // index + kzero = kb; + kw = kbw; + ks = kbs; + kb = neighborFZ[kb]; + ksw = kbsw; + kbw = neighborFZ[kbw]; + kbs = neighborFZ[kbs]; + kbsw = neighborFZ[kbsw]; + //////////////////////////////////////////////////////////////////////////////// + f_E = feF[kzero]; + f_W = fwF[kw]; + f_N = fnF[kzero]; + f_S = fsF[ks]; + f_T = ftF[kzero]; + f_B = fbF[kb]; + f_NE = fneF[kzero]; + f_SW = fswF[ksw]; + f_SE = fseF[ks]; + f_NW = fnwF[kw]; + f_TE = fteF[kzero]; + f_BW = fbwF[kbw]; + f_BE = fbeF[kb]; + f_TW = ftwF[kw]; + f_TN = ftnF[kzero]; + f_BS = fbsF[kbs]; + f_BN = fbnF[kb]; + f_TS = ftsF[ks]; + f_ZERO = fzeroF[kzero]; + f_TNE = ftneF[kzero]; + f_TSW = ftswF[ksw]; + f_TSE = ftseF[ks]; + f_TNW = ftnwF[kw]; + f_BNE = fbneF[kb]; + f_BSW = fbswF[kbsw]; + f_BSE = fbseF[kbs]; + f_BNW = fbnwF[kbw]; + + drho_SWT = f_E + f_W + f_N + f_S + f_T + f_B + f_NE + f_SW + f_SE + f_NW + f_TE + f_BW + f_BE + f_TW + f_TN + + f_BS + f_BN + f_TS + f_ZERO + f_TNE + f_TSW + f_TSE + f_TNW + f_BNE + f_BSW + f_BSE + f_BNW; + vx1_SWT = (((f_TNE - f_BSW) + (f_TSE - f_BNW) + (f_BNE - f_TSW) + (f_BSE - f_TNW)) + + (((f_NE - f_SW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_BE - f_TW))) + (f_E - f_W)) / + (c1o1 + drho_SWT); + vx2_SWT = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_BNE - f_TSW) + (f_BNW - f_TSE)) + + (((f_NE - f_SW) + (f_TN - f_BS)) + ((f_BN - f_TS) + (f_NW - f_SE))) + (f_N - f_S)) / + (c1o1 + drho_SWT); + vx3_SWT = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_TSE - f_BNW) + (f_TSW - f_BNE)) + + (((f_TE - f_BW) + (f_TN - f_BS)) + ((f_TW - f_BE) + (f_TS - f_BN))) + (f_T - f_B)) / + (c1o1 + drho_SWT); + + kxyFromfcNEQ_SWT = + -c3o1 * omegaS * + ((f_SW + f_BSW + f_TSW - f_NW - f_BNW - f_TNW - f_SE - f_BSE - f_TSE + f_NE + f_BNE + f_TNE) / + (c1o1 + drho_SWT) - + ((vx1_SWT * vx2_SWT))); + kyzFromfcNEQ_SWT = + -c3o1 * omegaS * + ((f_BS + f_BSE + f_BSW - f_TS - f_TSE - f_TSW - f_BN - f_BNE - f_BNW + f_TN + f_TNE + f_TNW) / + (c1o1 + drho_SWT) - + ((vx2_SWT * vx3_SWT))); + kxzFromfcNEQ_SWT = + -c3o1 * omegaS * + ((f_BW + f_BSW + f_BNW - f_TW - f_TSW - f_TNW - f_BE - f_BSE - f_BNE + f_TE + f_TSE + f_TNE) / + (c1o1 + drho_SWT) - + ((vx1_SWT * vx3_SWT))); + kxxMyyFromfcNEQ_SWT = + -c3o2 * omegaS * + ((f_BW + f_W + f_TW - f_BS - f_S - f_TS - f_BN - f_N - f_TN + f_BE + f_E + f_TE) / (c1o1 + drho_SWT) - + ((vx1_SWT * vx1_SWT - vx2_SWT * vx2_SWT))); + kxxMzzFromfcNEQ_SWT = + -c3o2 * omegaS * + ((f_SW + f_W + f_NW - f_BS - f_TS - f_B - f_T - f_BN - f_TN + f_SE + f_E + f_NE) / (c1o1 + drho_SWT) - + ((vx1_SWT * vx1_SWT - vx3_SWT * vx3_SWT))); + + ////////////////////////////////////////////////////////////////////////// + // SET// + ////////////////////////////////////////////////////////////////////////// + // index + kzero = kw; + kw = neighborFX[kw]; + ks = ksw; + kb = kbw; + ksw = neighborFX[ksw]; + kbw = neighborFX[kbw]; + kbs = kbsw; + kbsw = neighborFX[kbsw]; + //////////////////////////////////////////////////////////////////////////////// + f_E = feF[kzero]; + f_W = fwF[kw]; + f_N = fnF[kzero]; + f_S = fsF[ks]; + f_T = ftF[kzero]; + f_B = fbF[kb]; + f_NE = fneF[kzero]; + f_SW = fswF[ksw]; + f_SE = fseF[ks]; + f_NW = fnwF[kw]; + f_TE = fteF[kzero]; + f_BW = fbwF[kbw]; + f_BE = fbeF[kb]; + f_TW = ftwF[kw]; + f_TN = ftnF[kzero]; + f_BS = fbsF[kbs]; + f_BN = fbnF[kb]; + f_TS = ftsF[ks]; + f_ZERO = fzeroF[kzero]; + f_TNE = ftneF[kzero]; + f_TSW = ftswF[ksw]; + f_TSE = ftseF[ks]; + f_TNW = ftnwF[kw]; + f_BNE = fbneF[kb]; + f_BSW = fbswF[kbsw]; + f_BSE = fbseF[kbs]; + f_BNW = fbnwF[kbw]; + + drho_SET = f_E + f_W + f_N + f_S + f_T + f_B + f_NE + f_SW + f_SE + f_NW + f_TE + f_BW + f_BE + f_TW + f_TN + + f_BS + f_BN + f_TS + f_ZERO + f_TNE + f_TSW + f_TSE + f_TNW + f_BNE + f_BSW + f_BSE + f_BNW; + vx1_SET = (((f_TNE - f_BSW) + (f_TSE - f_BNW) + (f_BNE - f_TSW) + (f_BSE - f_TNW)) + + (((f_NE - f_SW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_BE - f_TW))) + (f_E - f_W)) / + (c1o1 + drho_SET); + vx2_SET = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_BNE - f_TSW) + (f_BNW - f_TSE)) + + (((f_NE - f_SW) + (f_TN - f_BS)) + ((f_BN - f_TS) + (f_NW - f_SE))) + (f_N - f_S)) / + (c1o1 + drho_SET); + vx3_SET = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_TSE - f_BNW) + (f_TSW - f_BNE)) + + (((f_TE - f_BW) + (f_TN - f_BS)) + ((f_TW - f_BE) + (f_TS - f_BN))) + (f_T - f_B)) / + (c1o1 + drho_SET); + + kxyFromfcNEQ_SET = + -c3o1 * omegaS * + ((f_SW + f_BSW + f_TSW - f_NW - f_BNW - f_TNW - f_SE - f_BSE - f_TSE + f_NE + f_BNE + f_TNE) / + (c1o1 + drho_SET) - + ((vx1_SET * vx2_SET))); + kyzFromfcNEQ_SET = + -c3o1 * omegaS * + ((f_BS + f_BSE + f_BSW - f_TS - f_TSE - f_TSW - f_BN - f_BNE - f_BNW + f_TN + f_TNE + f_TNW) / + (c1o1 + drho_SET) - + ((vx2_SET * vx3_SET))); + kxzFromfcNEQ_SET = + -c3o1 * omegaS * + ((f_BW + f_BSW + f_BNW - f_TW - f_TSW - f_TNW - f_BE - f_BSE - f_BNE + f_TE + f_TSE + f_TNE) / + (c1o1 + drho_SET) - + ((vx1_SET * vx3_SET))); + kxxMyyFromfcNEQ_SET = + -c3o2 * omegaS * + ((f_BW + f_W + f_TW - f_BS - f_S - f_TS - f_BN - f_N - f_TN + f_BE + f_E + f_TE) / (c1o1 + drho_SET) - + ((vx1_SET * vx1_SET - vx2_SET * vx2_SET))); + kxxMzzFromfcNEQ_SET = + -c3o2 * omegaS * + ((f_SW + f_W + f_NW - f_BS - f_TS - f_B - f_T - f_BN - f_TN + f_SE + f_E + f_NE) / (c1o1 + drho_SET) - + ((vx1_SET * vx1_SET - vx3_SET * vx3_SET))); + + ////////////////////////////////////////////////////////////////////////// + // SEB// + ////////////////////////////////////////////////////////////////////////// + // index + kb = kzero; + kbw = kw; + kbs = ks; + kbsw = ksw; + kzero = k0w; + kw = neighborFX[k0w]; + ks = k0sw; + ksw = neighborFX[k0sw]; + //////////////////////////////////////////////////////////////////////////////// + f_E = feF[kzero]; + f_W = fwF[kw]; + f_N = fnF[kzero]; + f_S = fsF[ks]; + f_T = ftF[kzero]; + f_B = fbF[kb]; + f_NE = fneF[kzero]; + f_SW = fswF[ksw]; + f_SE = fseF[ks]; + f_NW = fnwF[kw]; + f_TE = fteF[kzero]; + f_BW = fbwF[kbw]; + f_BE = fbeF[kb]; + f_TW = ftwF[kw]; + f_TN = ftnF[kzero]; + f_BS = fbsF[kbs]; + f_BN = fbnF[kb]; + f_TS = ftsF[ks]; + f_ZERO = fzeroF[kzero]; + f_TNE = ftneF[kzero]; + f_TSW = ftswF[ksw]; + f_TSE = ftseF[ks]; + f_TNW = ftnwF[kw]; + f_BNE = fbneF[kb]; + f_BSW = fbswF[kbsw]; + f_BSE = fbseF[kbs]; + f_BNW = fbnwF[kbw]; + + drho_SEB = f_E + f_W + f_N + f_S + f_T + f_B + f_NE + f_SW + f_SE + f_NW + f_TE + f_BW + f_BE + f_TW + f_TN + + f_BS + f_BN + f_TS + f_ZERO + f_TNE + f_TSW + f_TSE + f_TNW + f_BNE + f_BSW + f_BSE + f_BNW; + vx1_SEB = (((f_TNE - f_BSW) + (f_TSE - f_BNW) + (f_BNE - f_TSW) + (f_BSE - f_TNW)) + + (((f_NE - f_SW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_BE - f_TW))) + (f_E - f_W)) / + (c1o1 + drho_SEB); + vx2_SEB = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_BNE - f_TSW) + (f_BNW - f_TSE)) + + (((f_NE - f_SW) + (f_TN - f_BS)) + ((f_BN - f_TS) + (f_NW - f_SE))) + (f_N - f_S)) / + (c1o1 + drho_SEB); + vx3_SEB = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_TSE - f_BNW) + (f_TSW - f_BNE)) + + (((f_TE - f_BW) + (f_TN - f_BS)) + ((f_TW - f_BE) + (f_TS - f_BN))) + (f_T - f_B)) / + (c1o1 + drho_SEB); + + kxyFromfcNEQ_SEB = + -c3o1 * omegaS * + ((f_SW + f_BSW + f_TSW - f_NW - f_BNW - f_TNW - f_SE - f_BSE - f_TSE + f_NE + f_BNE + f_TNE) / + (c1o1 + drho_SEB) - + ((vx1_SEB * vx2_SEB))); + kyzFromfcNEQ_SEB = + -c3o1 * omegaS * + ((f_BS + f_BSE + f_BSW - f_TS - f_TSE - f_TSW - f_BN - f_BNE - f_BNW + f_TN + f_TNE + f_TNW) / + (c1o1 + drho_SEB) - + ((vx2_SEB * vx3_SEB))); + kxzFromfcNEQ_SEB = + -c3o1 * omegaS * + ((f_BW + f_BSW + f_BNW - f_TW - f_TSW - f_TNW - f_BE - f_BSE - f_BNE + f_TE + f_TSE + f_TNE) / + (c1o1 + drho_SEB) - + ((vx1_SEB * vx3_SEB))); + kxxMyyFromfcNEQ_SEB = + -c3o2 * omegaS * + ((f_BW + f_W + f_TW - f_BS - f_S - f_TS - f_BN - f_N - f_TN + f_BE + f_E + f_TE) / (c1o1 + drho_SEB) - + ((vx1_SEB * vx1_SEB - vx2_SEB * vx2_SEB))); + kxxMzzFromfcNEQ_SEB = + -c3o2 * omegaS * + ((f_SW + f_W + f_NW - f_BS - f_TS - f_B - f_T - f_BN - f_TN + f_SE + f_E + f_NE) / (c1o1 + drho_SEB) - + ((vx1_SEB * vx1_SEB - vx3_SEB * vx3_SEB))); + + ////////////////////////////////////////////////////////////////////////// + // NWB// + ////////////////////////////////////////////////////////////////////////// + // index 0 + k0zero = k0s; + k0w = k0sw; + k0s = neighborFY[k0s]; + k0b = k0bs; + k0sw = neighborFY[k0sw]; + k0bw = k0bsw; + k0bs = neighborFY[k0bs]; + k0bsw = neighborFY[k0bsw]; + ////////////////////////////////////////////////////////////////////////// + // index + kzero = k0zero; + kw = k0w; + ks = k0s; + kb = k0b; + ksw = k0sw; + kbw = k0bw; + kbs = k0bs; + kbsw = k0bsw; + //////////////////////////////////////////////////////////////////////////////// + f_E = feF[kzero]; + f_W = fwF[kw]; + f_N = fnF[kzero]; + f_S = fsF[ks]; + f_T = ftF[kzero]; + f_B = fbF[kb]; + f_NE = fneF[kzero]; + f_SW = fswF[ksw]; + f_SE = fseF[ks]; + f_NW = fnwF[kw]; + f_TE = fteF[kzero]; + f_BW = fbwF[kbw]; + f_BE = fbeF[kb]; + f_TW = ftwF[kw]; + f_TN = ftnF[kzero]; + f_BS = fbsF[kbs]; + f_BN = fbnF[kb]; + f_TS = ftsF[ks]; + f_ZERO = fzeroF[kzero]; + f_TNE = ftneF[kzero]; + f_TSW = ftswF[ksw]; + f_TSE = ftseF[ks]; + f_TNW = ftnwF[kw]; + f_BNE = fbneF[kb]; + f_BSW = fbswF[kbsw]; + f_BSE = fbseF[kbs]; + f_BNW = fbnwF[kbw]; + + drho_NWB = f_E + f_W + f_N + f_S + f_T + f_B + f_NE + f_SW + f_SE + f_NW + f_TE + f_BW + f_BE + f_TW + f_TN + + f_BS + f_BN + f_TS + f_ZERO + f_TNE + f_TSW + f_TSE + f_TNW + f_BNE + f_BSW + f_BSE + f_BNW; + vx1_NWB = (((f_TNE - f_BSW) + (f_TSE - f_BNW) + (f_BNE - f_TSW) + (f_BSE - f_TNW)) + + (((f_NE - f_SW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_BE - f_TW))) + (f_E - f_W)) / + (c1o1 + drho_NWB); + vx2_NWB = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_BNE - f_TSW) + (f_BNW - f_TSE)) + + (((f_NE - f_SW) + (f_TN - f_BS)) + ((f_BN - f_TS) + (f_NW - f_SE))) + (f_N - f_S)) / + (c1o1 + drho_NWB); + vx3_NWB = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_TSE - f_BNW) + (f_TSW - f_BNE)) + + (((f_TE - f_BW) + (f_TN - f_BS)) + ((f_TW - f_BE) + (f_TS - f_BN))) + (f_T - f_B)) / + (c1o1 + drho_NWB); + + kxyFromfcNEQ_NWB = + -c3o1 * omegaS * + ((f_SW + f_BSW + f_TSW - f_NW - f_BNW - f_TNW - f_SE - f_BSE - f_TSE + f_NE + f_BNE + f_TNE) / + (c1o1 + drho_NWB) - + ((vx1_NWB * vx2_NWB))); + kyzFromfcNEQ_NWB = + -c3o1 * omegaS * + ((f_BS + f_BSE + f_BSW - f_TS - f_TSE - f_TSW - f_BN - f_BNE - f_BNW + f_TN + f_TNE + f_TNW) / + (c1o1 + drho_NWB) - + ((vx2_NWB * vx3_NWB))); + kxzFromfcNEQ_NWB = + -c3o1 * omegaS * + ((f_BW + f_BSW + f_BNW - f_TW - f_TSW - f_TNW - f_BE - f_BSE - f_BNE + f_TE + f_TSE + f_TNE) / + (c1o1 + drho_NWB) - + ((vx1_NWB * vx3_NWB))); + kxxMyyFromfcNEQ_NWB = + -c3o2 * omegaS * + ((f_BW + f_W + f_TW - f_BS - f_S - f_TS - f_BN - f_N - f_TN + f_BE + f_E + f_TE) / (c1o1 + drho_NWB) - + ((vx1_NWB * vx1_NWB - vx2_NWB * vx2_NWB))); + kxxMzzFromfcNEQ_NWB = + -c3o2 * omegaS * + ((f_SW + f_W + f_NW - f_BS - f_TS - f_B - f_T - f_BN - f_TN + f_SE + f_E + f_NE) / (c1o1 + drho_NWB) - + ((vx1_NWB * vx1_NWB - vx3_NWB * vx3_NWB))); + + ////////////////////////////////////////////////////////////////////////// + // NWT// + ////////////////////////////////////////////////////////////////////////// + // index + kzero = kb; + kw = kbw; + ks = kbs; + kb = neighborFZ[kb]; + ksw = kbsw; + kbw = neighborFZ[kbw]; + kbs = neighborFZ[kbs]; + kbsw = neighborFZ[kbsw]; + //////////////////////////////////////////////////////////////////////////////// + f_E = feF[kzero]; + f_W = fwF[kw]; + f_N = fnF[kzero]; + f_S = fsF[ks]; + f_T = ftF[kzero]; + f_B = fbF[kb]; + f_NE = fneF[kzero]; + f_SW = fswF[ksw]; + f_SE = fseF[ks]; + f_NW = fnwF[kw]; + f_TE = fteF[kzero]; + f_BW = fbwF[kbw]; + f_BE = fbeF[kb]; + f_TW = ftwF[kw]; + f_TN = ftnF[kzero]; + f_BS = fbsF[kbs]; + f_BN = fbnF[kb]; + f_TS = ftsF[ks]; + f_ZERO = fzeroF[kzero]; + f_TNE = ftneF[kzero]; + f_TSW = ftswF[ksw]; + f_TSE = ftseF[ks]; + f_TNW = ftnwF[kw]; + f_BNE = fbneF[kb]; + f_BSW = fbswF[kbsw]; + f_BSE = fbseF[kbs]; + f_BNW = fbnwF[kbw]; + + drho_NWT = f_E + f_W + f_N + f_S + f_T + f_B + f_NE + f_SW + f_SE + f_NW + f_TE + f_BW + f_BE + f_TW + f_TN + + f_BS + f_BN + f_TS + f_ZERO + f_TNE + f_TSW + f_TSE + f_TNW + f_BNE + f_BSW + f_BSE + f_BNW; + vx1_NWT = (((f_TNE - f_BSW) + (f_TSE - f_BNW) + (f_BNE - f_TSW) + (f_BSE - f_TNW)) + + (((f_NE - f_SW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_BE - f_TW))) + (f_E - f_W)) / + (c1o1 + drho_NWT); + vx2_NWT = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_BNE - f_TSW) + (f_BNW - f_TSE)) + + (((f_NE - f_SW) + (f_TN - f_BS)) + ((f_BN - f_TS) + (f_NW - f_SE))) + (f_N - f_S)) / + (c1o1 + drho_NWT); + vx3_NWT = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_TSE - f_BNW) + (f_TSW - f_BNE)) + + (((f_TE - f_BW) + (f_TN - f_BS)) + ((f_TW - f_BE) + (f_TS - f_BN))) + (f_T - f_B)) / + (c1o1 + drho_NWT); + + kxyFromfcNEQ_NWT = + -c3o1 * omegaS * + ((f_SW + f_BSW + f_TSW - f_NW - f_BNW - f_TNW - f_SE - f_BSE - f_TSE + f_NE + f_BNE + f_TNE) / + (c1o1 + drho_NWT) - + ((vx1_NWT * vx2_NWT))); + kyzFromfcNEQ_NWT = + -c3o1 * omegaS * + ((f_BS + f_BSE + f_BSW - f_TS - f_TSE - f_TSW - f_BN - f_BNE - f_BNW + f_TN + f_TNE + f_TNW) / + (c1o1 + drho_NWT) - + ((vx2_NWT * vx3_NWT))); + kxzFromfcNEQ_NWT = + -c3o1 * omegaS * + ((f_BW + f_BSW + f_BNW - f_TW - f_TSW - f_TNW - f_BE - f_BSE - f_BNE + f_TE + f_TSE + f_TNE) / + (c1o1 + drho_NWT) - + ((vx1_NWT * vx3_NWT))); + kxxMyyFromfcNEQ_NWT = + -c3o2 * omegaS * + ((f_BW + f_W + f_TW - f_BS - f_S - f_TS - f_BN - f_N - f_TN + f_BE + f_E + f_TE) / (c1o1 + drho_NWT) - + ((vx1_NWT * vx1_NWT - vx2_NWT * vx2_NWT))); + kxxMzzFromfcNEQ_NWT = + -c3o2 * omegaS * + ((f_SW + f_W + f_NW - f_BS - f_TS - f_B - f_T - f_BN - f_TN + f_SE + f_E + f_NE) / (c1o1 + drho_NWT) - + ((vx1_NWT * vx1_NWT - vx3_NWT * vx3_NWT))); + + ////////////////////////////////////////////////////////////////////////// + // NET// + ////////////////////////////////////////////////////////////////////////// + // index + kzero = kw; + kw = neighborFX[kw]; + ks = ksw; + kb = kbw; + ksw = neighborFX[ksw]; + kbw = neighborFX[kbw]; + kbs = kbsw; + kbsw = neighborFX[kbsw]; + //////////////////////////////////////////////////////////////////////////////// + f_E = feF[kzero]; + f_W = fwF[kw]; + f_N = fnF[kzero]; + f_S = fsF[ks]; + f_T = ftF[kzero]; + f_B = fbF[kb]; + f_NE = fneF[kzero]; + f_SW = fswF[ksw]; + f_SE = fseF[ks]; + f_NW = fnwF[kw]; + f_TE = fteF[kzero]; + f_BW = fbwF[kbw]; + f_BE = fbeF[kb]; + f_TW = ftwF[kw]; + f_TN = ftnF[kzero]; + f_BS = fbsF[kbs]; + f_BN = fbnF[kb]; + f_TS = ftsF[ks]; + f_ZERO = fzeroF[kzero]; + f_TNE = ftneF[kzero]; + f_TSW = ftswF[ksw]; + f_TSE = ftseF[ks]; + f_TNW = ftnwF[kw]; + f_BNE = fbneF[kb]; + f_BSW = fbswF[kbsw]; + f_BSE = fbseF[kbs]; + f_BNW = fbnwF[kbw]; + + drho_NET = f_E + f_W + f_N + f_S + f_T + f_B + f_NE + f_SW + f_SE + f_NW + f_TE + f_BW + f_BE + f_TW + f_TN + + f_BS + f_BN + f_TS + f_ZERO + f_TNE + f_TSW + f_TSE + f_TNW + f_BNE + f_BSW + f_BSE + f_BNW; + vx1_NET = (((f_TNE - f_BSW) + (f_TSE - f_BNW) + (f_BNE - f_TSW) + (f_BSE - f_TNW)) + + (((f_NE - f_SW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_BE - f_TW))) + (f_E - f_W)) / + (c1o1 + drho_NET); + vx2_NET = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_BNE - f_TSW) + (f_BNW - f_TSE)) + + (((f_NE - f_SW) + (f_TN - f_BS)) + ((f_BN - f_TS) + (f_NW - f_SE))) + (f_N - f_S)) / + (c1o1 + drho_NET); + vx3_NET = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_TSE - f_BNW) + (f_TSW - f_BNE)) + + (((f_TE - f_BW) + (f_TN - f_BS)) + ((f_TW - f_BE) + (f_TS - f_BN))) + (f_T - f_B)) / + (c1o1 + drho_NET); + + kxyFromfcNEQ_NET = + -c3o1 * omegaS * + ((f_SW + f_BSW + f_TSW - f_NW - f_BNW - f_TNW - f_SE - f_BSE - f_TSE + f_NE + f_BNE + f_TNE) / + (c1o1 + drho_NET) - + ((vx1_NET * vx2_NET))); + kyzFromfcNEQ_NET = + -c3o1 * omegaS * + ((f_BS + f_BSE + f_BSW - f_TS - f_TSE - f_TSW - f_BN - f_BNE - f_BNW + f_TN + f_TNE + f_TNW) / + (c1o1 + drho_NET) - + ((vx2_NET * vx3_NET))); + kxzFromfcNEQ_NET = + -c3o1 * omegaS * + ((f_BW + f_BSW + f_BNW - f_TW - f_TSW - f_TNW - f_BE - f_BSE - f_BNE + f_TE + f_TSE + f_TNE) / + (c1o1 + drho_NET) - + ((vx1_NET * vx3_NET))); + kxxMyyFromfcNEQ_NET = + -c3o2 * omegaS * + ((f_BW + f_W + f_TW - f_BS - f_S - f_TS - f_BN - f_N - f_TN + f_BE + f_E + f_TE) / (c1o1 + drho_NET) - + ((vx1_NET * vx1_NET - vx2_NET * vx2_NET))); + kxxMzzFromfcNEQ_NET = + -c3o2 * omegaS * + ((f_SW + f_W + f_NW - f_BS - f_TS - f_B - f_T - f_BN - f_TN + f_SE + f_E + f_NE) / (c1o1 + drho_NET) - + ((vx1_NET * vx1_NET - vx3_NET * vx3_NET))); + + ////////////////////////////////////////////////////////////////////////// + // NEB// + ////////////////////////////////////////////////////////////////////////// + // index + kb = kzero; + kbw = kw; + kbs = ks; + kbsw = ksw; + kzero = k0w; + kw = neighborFX[k0w]; + ks = k0sw; + ksw = neighborFX[k0sw]; + //////////////////////////////////////////////////////////////////////////////// + f_E = feF[kzero]; + f_W = fwF[kw]; + f_N = fnF[kzero]; + f_S = fsF[ks]; + f_T = ftF[kzero]; + f_B = fbF[kb]; + f_NE = fneF[kzero]; + f_SW = fswF[ksw]; + f_SE = fseF[ks]; + f_NW = fnwF[kw]; + f_TE = fteF[kzero]; + f_BW = fbwF[kbw]; + f_BE = fbeF[kb]; + f_TW = ftwF[kw]; + f_TN = ftnF[kzero]; + f_BS = fbsF[kbs]; + f_BN = fbnF[kb]; + f_TS = ftsF[ks]; + f_ZERO = fzeroF[kzero]; + f_TNE = ftneF[kzero]; + f_TSW = ftswF[ksw]; + f_TSE = ftseF[ks]; + f_TNW = ftnwF[kw]; + f_BNE = fbneF[kb]; + f_BSW = fbswF[kbsw]; + f_BSE = fbseF[kbs]; + f_BNW = fbnwF[kbw]; + + drho_NEB = f_E + f_W + f_N + f_S + f_T + f_B + f_NE + f_SW + f_SE + f_NW + f_TE + f_BW + f_BE + f_TW + f_TN + + f_BS + f_BN + f_TS + f_ZERO + f_TNE + f_TSW + f_TSE + f_TNW + f_BNE + f_BSW + f_BSE + f_BNW; + vx1_NEB = (((f_TNE - f_BSW) + (f_TSE - f_BNW) + (f_BNE - f_TSW) + (f_BSE - f_TNW)) + + (((f_NE - f_SW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_BE - f_TW))) + (f_E - f_W)) / + (c1o1 + drho_NEB); + vx2_NEB = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_BNE - f_TSW) + (f_BNW - f_TSE)) + + (((f_NE - f_SW) + (f_TN - f_BS)) + ((f_BN - f_TS) + (f_NW - f_SE))) + (f_N - f_S)) / + (c1o1 + drho_NEB); + vx3_NEB = (((f_TNE - f_BSW) + (f_TNW - f_BSE) + (f_TSE - f_BNW) + (f_TSW - f_BNE)) + + (((f_TE - f_BW) + (f_TN - f_BS)) + ((f_TW - f_BE) + (f_TS - f_BN))) + (f_T - f_B)) / + (c1o1 + drho_NEB); + + kxyFromfcNEQ_NEB = + -c3o1 * omegaS * + ((f_SW + f_BSW + f_TSW - f_NW - f_BNW - f_TNW - f_SE - f_BSE - f_TSE + f_NE + f_BNE + f_TNE) / + (c1o1 + drho_NEB) - + ((vx1_NEB * vx2_NEB))); + kyzFromfcNEQ_NEB = + -c3o1 * omegaS * + ((f_BS + f_BSE + f_BSW - f_TS - f_TSE - f_TSW - f_BN - f_BNE - f_BNW + f_TN + f_TNE + f_TNW) / + (c1o1 + drho_NEB) - + ((vx2_NEB * vx3_NEB))); + kxzFromfcNEQ_NEB = + -c3o1 * omegaS * + ((f_BW + f_BSW + f_BNW - f_TW - f_TSW - f_TNW - f_BE - f_BSE - f_BNE + f_TE + f_TSE + f_TNE) / + (c1o1 + drho_NEB) - + ((vx1_NEB * vx3_NEB))); + kxxMyyFromfcNEQ_NEB = + -c3o2 * omegaS * + ((f_BW + f_W + f_TW - f_BS - f_S - f_TS - f_BN - f_N - f_TN + f_BE + f_E + f_TE) / (c1o1 + drho_NEB) - + ((vx1_NEB * vx1_NEB - vx2_NEB * vx2_NEB))); + kxxMzzFromfcNEQ_NEB = + -c3o2 * omegaS * + ((f_SW + f_W + f_NW - f_BS - f_TS - f_B - f_T - f_BN - f_TN + f_SE + f_E + f_NE) / (c1o1 + drho_NEB) - + ((vx1_NEB * vx1_NEB - vx3_NEB * vx3_NEB))); + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // kxyFromfcNEQ_SWB = zero; + // kyzFromfcNEQ_SWB = zero; + // kxzFromfcNEQ_SWB = zero; + // kxxMyyFromfcNEQ_SWB = zero; + // kxxMzzFromfcNEQ_SWB = zero; + // kxyFromfcNEQ_SWT = zero; + // kyzFromfcNEQ_SWT = zero; + // kxzFromfcNEQ_SWT = zero; + // kxxMyyFromfcNEQ_SWT = zero; + // kxxMzzFromfcNEQ_SWT = zero; + // kxyFromfcNEQ_SET = zero; + // kyzFromfcNEQ_SET = zero; + // kxzFromfcNEQ_SET = zero; + // kxxMyyFromfcNEQ_SET = zero; + // kxxMzzFromfcNEQ_SET = zero; + // kxyFromfcNEQ_SEB = zero; + // kyzFromfcNEQ_SEB = zero; + // kxzFromfcNEQ_SEB = zero; + // kxxMyyFromfcNEQ_SEB = zero; + // kxxMzzFromfcNEQ_SEB = zero; + // kxyFromfcNEQ_NWB = zero; + // kyzFromfcNEQ_NWB = zero; + // kxzFromfcNEQ_NWB = zero; + // kxxMyyFromfcNEQ_NWB = zero; + // kxxMzzFromfcNEQ_NWB = zero; + // kxyFromfcNEQ_NWT = zero; + // kyzFromfcNEQ_NWT = zero; + // kxzFromfcNEQ_NWT = zero; + // kxxMyyFromfcNEQ_NWT = zero; + // kxxMzzFromfcNEQ_NWT = zero; + // kxyFromfcNEQ_NET = zero; + // kyzFromfcNEQ_NET = zero; + // kxzFromfcNEQ_NET = zero; + // kxxMyyFromfcNEQ_NET = zero; + // kxxMzzFromfcNEQ_NET = zero; + // kxyFromfcNEQ_NEB = zero; + // kyzFromfcNEQ_NEB = zero; + // kxzFromfcNEQ_NEB = zero; + // kxxMyyFromfcNEQ_NEB = zero; + // kxxMzzFromfcNEQ_NEB = zero; + ////////////////////////////////////////////////////////////////////////// + // 3 + ////////////////////////////////////////////////////////////////////////// + a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - + kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT - + kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - + kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - + c2o1 * kxyFromfcNEQ_NEB - c2o1 * kxyFromfcNEQ_NET - c2o1 * kxyFromfcNEQ_NWB - c2o1 * kxyFromfcNEQ_NWT + + c2o1 * kxyFromfcNEQ_SEB + c2o1 * kxyFromfcNEQ_SET + c2o1 * kxyFromfcNEQ_SWB + c2o1 * kxyFromfcNEQ_SWT + + c2o1 * kxzFromfcNEQ_NEB - c2o1 * kxzFromfcNEQ_NET + c2o1 * kxzFromfcNEQ_NWB - c2o1 * kxzFromfcNEQ_NWT + + c2o1 * kxzFromfcNEQ_SEB - c2o1 * kxzFromfcNEQ_SET + c2o1 * kxzFromfcNEQ_SWB - c2o1 * kxzFromfcNEQ_SWT + + c8o1 * vx1_NEB + c8o1 * vx1_NET + c8o1 * vx1_NWB + c8o1 * vx1_NWT + c8o1 * vx1_SEB + c8o1 * vx1_SET + + c8o1 * vx1_SWB + c8o1 * vx1_SWT + c2o1 * vx2_NEB + c2o1 * vx2_NET - c2o1 * vx2_NWB - c2o1 * vx2_NWT - + c2o1 * vx2_SEB - c2o1 * vx2_SET + c2o1 * vx2_SWB + c2o1 * vx2_SWT - c2o1 * vx3_NEB + c2o1 * vx3_NET + + c2o1 * vx3_NWB - c2o1 * vx3_NWT - c2o1 * vx3_SEB + c2o1 * vx3_SET + c2o1 * vx3_SWB - c2o1 * vx3_SWT) / + c64o1; + b0 = (c2o1 * kxxMyyFromfcNEQ_NEB + c2o1 * kxxMyyFromfcNEQ_NET + c2o1 * kxxMyyFromfcNEQ_NWB + + c2o1 * kxxMyyFromfcNEQ_NWT - c2o1 * kxxMyyFromfcNEQ_SEB - c2o1 * kxxMyyFromfcNEQ_SET - + c2o1 * kxxMyyFromfcNEQ_SWB - c2o1 * kxxMyyFromfcNEQ_SWT - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - + kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - c2o1 * kxyFromfcNEQ_NEB - c2o1 * kxyFromfcNEQ_NET + + c2o1 * kxyFromfcNEQ_NWB + c2o1 * kxyFromfcNEQ_NWT - c2o1 * kxyFromfcNEQ_SEB - c2o1 * kxyFromfcNEQ_SET + + c2o1 * kxyFromfcNEQ_SWB + c2o1 * kxyFromfcNEQ_SWT + c2o1 * kyzFromfcNEQ_NEB - c2o1 * kyzFromfcNEQ_NET + + c2o1 * kyzFromfcNEQ_NWB - c2o1 * kyzFromfcNEQ_NWT + c2o1 * kyzFromfcNEQ_SEB - c2o1 * kyzFromfcNEQ_SET + + c2o1 * kyzFromfcNEQ_SWB - c2o1 * kyzFromfcNEQ_SWT + c2o1 * vx1_NEB + c2o1 * vx1_NET - c2o1 * vx1_NWB - + c2o1 * vx1_NWT - c2o1 * vx1_SEB - c2o1 * vx1_SET + c2o1 * vx1_SWB + c2o1 * vx1_SWT + c8o1 * vx2_NEB + + c8o1 * vx2_NET + c8o1 * vx2_NWB + c8o1 * vx2_NWT + c8o1 * vx2_SEB + c8o1 * vx2_SET + c8o1 * vx2_SWB + + c8o1 * vx2_SWT - c2o1 * vx3_NEB + c2o1 * vx3_NET - c2o1 * vx3_NWB + c2o1 * vx3_NWT + c2o1 * vx3_SEB - + c2o1 * vx3_SET + c2o1 * vx3_SWB - c2o1 * vx3_SWT) / + c64o1; + c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + + kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT - + c2o1 * kxxMzzFromfcNEQ_NEB + c2o1 * kxxMzzFromfcNEQ_NET - c2o1 * kxxMzzFromfcNEQ_NWB + + c2o1 * kxxMzzFromfcNEQ_NWT - c2o1 * kxxMzzFromfcNEQ_SEB + c2o1 * kxxMzzFromfcNEQ_SET - + c2o1 * kxxMzzFromfcNEQ_SWB + c2o1 * kxxMzzFromfcNEQ_SWT - c2o1 * kxzFromfcNEQ_NEB - + c2o1 * kxzFromfcNEQ_NET + c2o1 * kxzFromfcNEQ_NWB + c2o1 * kxzFromfcNEQ_NWT - c2o1 * kxzFromfcNEQ_SEB - + c2o1 * kxzFromfcNEQ_SET + c2o1 * kxzFromfcNEQ_SWB + c2o1 * kxzFromfcNEQ_SWT - c2o1 * kyzFromfcNEQ_NEB - + c2o1 * kyzFromfcNEQ_NET - c2o1 * kyzFromfcNEQ_NWB - c2o1 * kyzFromfcNEQ_NWT + c2o1 * kyzFromfcNEQ_SEB + + c2o1 * kyzFromfcNEQ_SET + c2o1 * kyzFromfcNEQ_SWB + c2o1 * kyzFromfcNEQ_SWT - c2o1 * vx1_NEB + + c2o1 * vx1_NET + c2o1 * vx1_NWB - c2o1 * vx1_NWT - c2o1 * vx1_SEB + c2o1 * vx1_SET + c2o1 * vx1_SWB - + c2o1 * vx1_SWT - c2o1 * vx2_NEB + c2o1 * vx2_NET - c2o1 * vx2_NWB + c2o1 * vx2_NWT + c2o1 * vx2_SEB - + c2o1 * vx2_SET + c2o1 * vx2_SWB - c2o1 * vx2_SWT + c8o1 * vx3_NEB + c8o1 * vx3_NET + c8o1 * vx3_NWB + + c8o1 * vx3_NWT + c8o1 * vx3_SEB + c8o1 * vx3_SET + c8o1 * vx3_SWB + c8o1 * vx3_SWT) / + c64o1; + ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT) / c4o1; + bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT) / c4o1; + cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT) / c4o1; + axx = (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + + kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT + + kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + + kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + c2o1 * vx2_NEB + + c2o1 * vx2_NET - c2o1 * vx2_NWB - c2o1 * vx2_NWT - c2o1 * vx2_SEB - c2o1 * vx2_SET + c2o1 * vx2_SWB + + c2o1 * vx2_SWT - c2o1 * vx3_NEB + c2o1 * vx3_NET + c2o1 * vx3_NWB - c2o1 * vx3_NWT - c2o1 * vx3_SEB + + c2o1 * vx3_SET + c2o1 * vx3_SWB - c2o1 * vx3_SWT) / + c16o1; + bxx = (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT + kxyFromfcNEQ_SEB + + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - c2o1 * vx1_NEB - c2o1 * vx1_NET + + c2o1 * vx1_NWB + c2o1 * vx1_NWT + c2o1 * vx1_SEB + c2o1 * vx1_SET - c2o1 * vx1_SWB - c2o1 * vx1_SWT) / + c8o1; + cxx = (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT + kxzFromfcNEQ_SEB + + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT + c2o1 * vx1_NEB - c2o1 * vx1_NET - + c2o1 * vx1_NWB + c2o1 * vx1_NWT + c2o1 * vx1_SEB - c2o1 * vx1_SET - c2o1 * vx1_SWB + c2o1 * vx1_SWT) / + c8o1; + ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT) / c4o1; + by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT) / c4o1; + cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT) / c4o1; + ayy = (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT - kxyFromfcNEQ_SEB - + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - c2o1 * vx2_NEB - c2o1 * vx2_NET + + c2o1 * vx2_NWB + c2o1 * vx2_NWT + c2o1 * vx2_SEB + c2o1 * vx2_SET - c2o1 * vx2_SWB - c2o1 * vx2_SWT) / + c8o1; + byy = (-c2o1 * kxxMyyFromfcNEQ_NEB - c2o1 * kxxMyyFromfcNEQ_NET - c2o1 * kxxMyyFromfcNEQ_NWB - + c2o1 * kxxMyyFromfcNEQ_NWT + c2o1 * kxxMyyFromfcNEQ_SEB + c2o1 * kxxMyyFromfcNEQ_SET + + c2o1 * kxxMyyFromfcNEQ_SWB + c2o1 * kxxMyyFromfcNEQ_SWT + kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - + kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + c2o1 * vx1_NEB + c2o1 * vx1_NET - c2o1 * vx1_NWB - + c2o1 * vx1_NWT - c2o1 * vx1_SEB - c2o1 * vx1_SET + c2o1 * vx1_SWB + c2o1 * vx1_SWT - c2o1 * vx3_NEB + + c2o1 * vx3_NET - c2o1 * vx3_NWB + c2o1 * vx3_NWT + c2o1 * vx3_SEB - c2o1 * vx3_SET + c2o1 * vx3_SWB - + c2o1 * vx3_SWT) / + c16o1; + cyy = (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - kyzFromfcNEQ_SEB - + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT + c2o1 * vx2_NEB - c2o1 * vx2_NET + + c2o1 * vx2_NWB - c2o1 * vx2_NWT - c2o1 * vx2_SEB + c2o1 * vx2_SET - c2o1 * vx2_SWB + c2o1 * vx2_SWT) / + c8o1; + az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT) / c4o1; + bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT) / c4o1; + cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT) / c4o1; + azz = (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT - kxzFromfcNEQ_SEB + + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT + c2o1 * vx3_NEB - c2o1 * vx3_NET - + c2o1 * vx3_NWB + c2o1 * vx3_NWT + c2o1 * vx3_SEB - c2o1 * vx3_SET - c2o1 * vx3_SWB + c2o1 * vx3_SWT) / + c8o1; + bzz = (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - kyzFromfcNEQ_SEB + + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT + c2o1 * vx3_NEB - c2o1 * vx3_NET + + c2o1 * vx3_NWB - c2o1 * vx3_NWT - c2o1 * vx3_SEB + c2o1 * vx3_SET - c2o1 * vx3_SWB + c2o1 * vx3_SWT) / + c8o1; + czz = (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - + kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT + + c2o1 * kxxMzzFromfcNEQ_NEB - c2o1 * kxxMzzFromfcNEQ_NET + c2o1 * kxxMzzFromfcNEQ_NWB - + c2o1 * kxxMzzFromfcNEQ_NWT + c2o1 * kxxMzzFromfcNEQ_SEB - c2o1 * kxxMzzFromfcNEQ_SET + + c2o1 * kxxMzzFromfcNEQ_SWB - c2o1 * kxxMzzFromfcNEQ_SWT - c2o1 * vx1_NEB + c2o1 * vx1_NET + + c2o1 * vx1_NWB - c2o1 * vx1_NWT - c2o1 * vx1_SEB + c2o1 * vx1_SET + c2o1 * vx1_SWB - c2o1 * vx1_SWT - + c2o1 * vx2_NEB + c2o1 * vx2_NET - c2o1 * vx2_NWB + c2o1 * vx2_NWT + c2o1 * vx2_SEB - c2o1 * vx2_SET + + c2o1 * vx2_SWB - c2o1 * vx2_SWT) / + c16o1; + axy = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT) / c2o1; + bxy = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT) / c2o1; + cxy = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT) / c2o1; + axz = (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT) / c2o1; + bxz = (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT) / c2o1; + cxz = (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT) / c2o1; + ayz = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT) / c2o1; + byz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT) / c2o1; + cyz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT) / c2o1; + // axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT; + // bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT; + // cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT; + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real kxyAverage = c0o1; + real kyzAverage = c0o1; + real kxzAverage = c0o1; + real kxxMyyAverage = c0o1; + real kxxMzzAverage = c0o1; + // real kxyAverage =(kxyFromfcNEQ_SWB+ + // kxyFromfcNEQ_SWT+ + // kxyFromfcNEQ_SET+ + // kxyFromfcNEQ_SEB+ + // kxyFromfcNEQ_NWB+ + // kxyFromfcNEQ_NWT+ + // kxyFromfcNEQ_NET+ + // kxyFromfcNEQ_NEB)*c1o8-(ay+bx); + // real kyzAverage =(kyzFromfcNEQ_SWB+ + // kyzFromfcNEQ_SWT+ + // kyzFromfcNEQ_SET+ + // kyzFromfcNEQ_SEB+ + // kyzFromfcNEQ_NWB+ + // kyzFromfcNEQ_NWT+ + // kyzFromfcNEQ_NET+ + // kyzFromfcNEQ_NEB)*c1o8-(bz+cy); + // real kxzAverage =(kxzFromfcNEQ_SWB+ + // kxzFromfcNEQ_SWT+ + // kxzFromfcNEQ_SET+ + // kxzFromfcNEQ_SEB+ + // kxzFromfcNEQ_NWB+ + // kxzFromfcNEQ_NWT+ + // kxzFromfcNEQ_NET+ + // kxzFromfcNEQ_NEB)*c1o8-(az+cx); + // real kxxMyyAverage =(kxxMyyFromfcNEQ_SWB+ + // kxxMyyFromfcNEQ_SWT+ + // kxxMyyFromfcNEQ_SET+ + // kxxMyyFromfcNEQ_SEB+ + // kxxMyyFromfcNEQ_NWB+ + // kxxMyyFromfcNEQ_NWT+ + // kxxMyyFromfcNEQ_NET+ + // kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by); + // real kxxMzzAverage =(kxxMzzFromfcNEQ_SWB+ + // kxxMzzFromfcNEQ_SWT+ + // kxxMzzFromfcNEQ_SET+ + // kxxMzzFromfcNEQ_SEB+ + // kxxMzzFromfcNEQ_NWB+ + // kxxMzzFromfcNEQ_NWT+ + // kxxMzzFromfcNEQ_NET+ + // kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz); + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////Press + // d0 = ( press_NEB + press_NET + press_NWB + press_NWT + press_SEB + press_SET + press_SWB + press_SWT) * + // c1o8; dx = ( press_NEB + press_NET - press_NWB - press_NWT + press_SEB + press_SET - press_SWB - press_SWT) + // * c1o4; dy = ( press_NEB + press_NET + press_NWB + press_NWT - press_SEB - press_SET - press_SWB - + // press_SWT) * c1o4; dz = (-press_NEB + press_NET - press_NWB + press_NWT - press_SEB + press_SET - press_SWB + // + press_SWT) * c1o4; dxy = ( press_NEB + press_NET - press_NWB - press_NWT - press_SEB - press_SET + + // press_SWB + press_SWT) * c1o2; dxz = (-press_NEB + press_NET + press_NWB - press_NWT - press_SEB + press_SET + // + press_SWB - press_SWT) * c1o2; dyz = (-press_NEB + press_NET - press_NWB + press_NWT + press_SEB - + // press_SET + press_SWB - press_SWT) * c1o2; dxyz = -press_NEB + press_NET + press_NWB - press_NWT + press_SEB + // - press_SET - press_SWB + press_SWT; + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // drho + real LapRho = ((xoff != c0o1) || (yoff != c0o1) || (zoff != c0o1)) + ? c0o1 + : -c3o1 * (ax * ax + by * by + cz * cz) - c6o1 * (bx * ay + cx * az + cy * bz); + d0 = (drho_NEB + drho_NET + drho_NWB + drho_NWT + drho_SEB + drho_SET + drho_SWB + drho_SWT - c2o1 * LapRho) * + c1o8; + dx = (drho_NEB + drho_NET - drho_NWB - drho_NWT + drho_SEB + drho_SET - drho_SWB - drho_SWT) * c1o4; + dy = (drho_NEB + drho_NET + drho_NWB + drho_NWT - drho_SEB - drho_SET - drho_SWB - drho_SWT) * c1o4; + dz = (-drho_NEB + drho_NET - drho_NWB + drho_NWT - drho_SEB + drho_SET - drho_SWB + drho_SWT) * c1o4; + dxy = (drho_NEB + drho_NET - drho_NWB - drho_NWT - drho_SEB - drho_SET + drho_SWB + drho_SWT) * c1o2; + dxz = (-drho_NEB + drho_NET + drho_NWB - drho_NWT - drho_SEB + drho_SET + drho_SWB - drho_SWT) * c1o2; + dyz = (-drho_NEB + drho_NET - drho_NWB + drho_NWT + drho_SEB - drho_SET + drho_SWB - drho_SWT) * c1o2; + // dxyz = -drho_NEB + drho_NET + drho_NWB - drho_NWT + drho_SEB - drho_SET - drho_SWB + drho_SWT; + // d0 = zero; + // dx = zero; + // dy = zero; + // dz = zero; + // dxy = zero; + // dxz = zero; + // dyz = zero; + // dxyz = zero; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Bernd das Brot + // + // + // x------x + // | | + // | ---+--->X + // | | \ + // x------x \ + // off-vector + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + + xoff * yoff * axy + xoff * zoff * axz + yoff * zoff * ayz; + ax = ax + c2o1 * xoff * axx + yoff * axy + zoff * axz; + ay = ay + c2o1 * yoff * ayy + xoff * axy + zoff * ayz; + az = az + c2o1 * zoff * azz + xoff * axz + yoff * ayz; + b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + + xoff * yoff * bxy + xoff * zoff * bxz + yoff * zoff * byz; + bx = bx + c2o1 * xoff * bxx + yoff * bxy + zoff * bxz; + by = by + c2o1 * yoff * byy + xoff * bxy + zoff * byz; + bz = bz + c2o1 * zoff * bzz + xoff * bxz + yoff * byz; + c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + + xoff * yoff * cxy + xoff * zoff * cxz + yoff * zoff * cyz; + cx = cx + c2o1 * xoff * cxx + yoff * cxy + zoff * cxz; + cy = cy + c2o1 * yoff * cyy + xoff * cxy + zoff * cyz; + cz = cz + c2o1 * zoff * czz + xoff * cxz + yoff * cyz; + d0 = d0 + xoff * dx + yoff * dy + zoff * dz + xoff * yoff * dxy + xoff * zoff * dxz + yoff * zoff * dyz; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // FIX + // /////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // AAAAAAAAAAAAHHHHHHHHHHHH!!!!! Mieser Test!!! + // b0= bx= by= bz= bxx= byy= bzz= bxy= bxz= byz= c0= cx= cy= cz= cxx= cyy= czz= cxy= cxz= cyz= axyz= bxyz= + // cxyz=zero; b0=zero; bx=zero; by=zero; bz=zero; bxx=zero; byy=zero; bzz=zero; bxy=zero; bxz=zero; byz=zero; + // c0=zero; + // cx=zero; + // cy=zero; + // cz=zero; + // cxx=zero; + // cyy=zero; + // czz=zero; + // cxy=zero; + // cxz=zero; + // cyz=zero; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real mfcbb = c0o1; + real mfabb = c0o1; + real mfbcb = c0o1; + real mfbab = c0o1; + real mfbbc = c0o1; + real mfbba = c0o1; + real mfccb = c0o1; + real mfaab = c0o1; + real mfcab = c0o1; + real mfacb = c0o1; + real mfcbc = c0o1; + real mfaba = c0o1; + real mfcba = c0o1; + real mfabc = c0o1; + real mfbcc = c0o1; + real mfbaa = c0o1; + real mfbca = c0o1; + real mfbac = c0o1; + real mfbbb = c0o1; + real mfccc = c0o1; + real mfaac = c0o1; + real mfcac = c0o1; + real mfacc = c0o1; + real mfcca = c0o1; + real mfaaa = c0o1; + real mfcaa = c0o1; + real mfaca = c0o1; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real m0, m1, m2, vvx, vvy, vvz, vx2, vy2, vz2, oMdrho; + real mxxPyyPzz, mxxMyy, mxxMzz, mxxyPyzz, mxxyMyzz, mxxzPyyz, mxxzMyyz, mxyyPxzz, mxyyMxzz; + // real qudricLimit = c1o100;//ganz schlechte Idee -> muss global sein + // real O3 = c2o1 - o; + // real residu, residutmp; + // residutmp = c0o1;///*-*/ c2o9 * (1./o - c1o2) * eps_new * eps_new; + real NeqOn = c1o1; // zero;//one; //.... one = on ..... zero = off + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Position C 0., 0., 0. + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // x = 0.; + // y = 0.; + // z = 0.; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // real mxoff = -xoff; + // real myoff = -yoff; + // real mzoff = -zoff; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // press = press_NET * (c1o8 - c1o4 * mxoff - c1o4 * myoff - c1o4 * mzoff) + + // press_NWT * (c1o8 + c1o4 * mxoff - c1o4 * myoff - c1o4 * mzoff) + + // press_SET * (c1o8 - c1o4 * mxoff + c1o4 * myoff - c1o4 * mzoff) + + // press_SWT * (c1o8 + c1o4 * mxoff + c1o4 * myoff - c1o4 * mzoff) + + // press_NEB * (c1o8 - c1o4 * mxoff - c1o4 * myoff + c1o4 * mzoff) + + // press_NWB * (c1o8 + c1o4 * mxoff - c1o4 * myoff + c1o4 * mzoff) + + // press_SEB * (c1o8 - c1o4 * mxoff + c1o4 * myoff + c1o4 * mzoff) + + // press_SWB * (c1o8 + c1o4 * mxoff + c1o4 * myoff + c1o4 * mzoff); + // drho = drho_NET * (c1o8 - c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + + // drho_NWT * (c1o8 + c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + + // drho_SET * (c1o8 - c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + + // drho_SWT * (c1o8 + c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + + // drho_NEB * (c1o8 - c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + + // drho_NWB * (c1o8 + c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + + // drho_SEB * (c1o8 - c1o4 * xoff + c1o4 * yoff + c1o4 * zoff) + + // drho_SWB * (c1o8 + c1o4 * xoff + c1o4 * yoff + c1o4 * zoff); + press = d0; + vvx = a0; + vvy = b0; + vvz = c0; + + // mfaaa = drho; + // mfaaa = press + (ax+by+cz)/three; // 1/3 = 2/3*(1/op-1/2) + mfaaa = press; // if drho is interpolated directly + + vx2 = vvx * vvx; + vy2 = vvy * vvy; + vz2 = vvz * vvz; + oMdrho = c1o1; + // oMdrho = one - mfaaa; + + // two + // linear combinations + mxxPyyPzz = mfaaa; + // mxxMyy = -c2o3*(ax - by)*eps_new/o; + // mxxMzz = -c2o3*(ax - cz)*eps_new/o; + + // mfabb = -c1o3 * (bz + cy)*eps_new/o; + // mfbab = -c1o3 * (az + cx)*eps_new/o; + // mfbba = -c1o3 * (ay + bx)*eps_new/o; + mxxMyy = -c2o3 * ((ax - by) + kxxMyyAverage) * eps_new / o * (c1o1 + press); + mxxMzz = -c2o3 * ((ax - cz) + kxxMzzAverage) * eps_new / o * (c1o1 + press); + + mfabb = -c1o3 * ((bz + cy) + kyzAverage) * eps_new / o * (c1o1 + press); + mfbab = -c1o3 * ((az + cx) + kxzAverage) * eps_new / o * (c1o1 + press); + mfbba = -c1o3 * ((ay + bx) + kxyAverage) * eps_new / o * (c1o1 + press); + + // linear combinations back + mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz) * NeqOn; + mfaca = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz) * NeqOn; + mfaac = c1o3 * (mxxMyy - c2o1 * mxxMzz + mxxPyyPzz) * NeqOn; + + // 3. + // linear combinations + // residu = residutmp * (ayz + bxz + cxy ); + // mfbbb = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); + mfbbb = c0o1; + + // residu = residutmp * (axy + two*bxx + two*bzz + cyz ); + // residu = -(c1o9*(axy - 2*bxx - 2*bzz + cyz )); + // mxxyPyzz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); + mxxyPyzz = c0o1; + + // residu = residutmp * (axy + two*bxx - two*bzz - cyz ); + // residu = c1o9*(axy - 2*bxx + 2*bzz - cyz ); + // mxxyMyzz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); + mxxyMyzz = c0o1; + + // residu = residutmp * (axz + byz + two*cxx + two*cyy ); + // residu = -(c1o9*(axz + byz - 2*cxx - 2*cyy )); + // mxxzPyyz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); + mxxzPyyz = c0o1; + + // residu = residutmp * (axz - byz + two*cxx - two*cyy ); + // residu = c1o9*(axz - byz - 2*cxx + 2*cyy ); + // mxxzMyyz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); + mxxzMyyz = c0o1; + + // residu = residutmp * (two*ayy + two*azz + bxy + cxz ); + // residu = c1o9*(2*ayy + 2*azz - bxy - cxz ); + // mxyyPxzz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); + mxyyPxzz = c0o1; + + // residu = residutmp * (two*ayy - two*azz + bxy - cxz ); + // residu = c1o9*(-2*ayy + 2*azz + bxy - cxz ); + // mxyyMxzz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); + mxyyMxzz = c0o1; + + // linear combinations back + mfcba = (mxxyMyzz + mxxyPyzz) * c1o2; + mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2; + mfcab = (mxxzMyyz + mxxzPyyz) * c1o2; + mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2; + mfbca = (mxyyMxzz + mxyyPxzz) * c1o2; + mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2; + + // 4. + mfacc = mfaaa * c1o9; + mfcac = mfacc; + mfcca = mfacc; + // 5. + + // 6. + mfccc = mfaaa * c1o27; + //////////////////////////////////////////////////////////////////////////////////// + // back + //////////////////////////////////////////////////////////////////////////////////// + // mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + c1o1 * oMdrho) * (vz2 - vvz) * c1o2; + m1 = -mfaac - c2o1 * mfaab * vvz + mfaaa * (c1o1 - vz2) - c1o1 * oMdrho * vz2; + m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + c1o1 * oMdrho) * (vz2 + vvz) * c1o2; + mfaaa = m0; + mfaab = m1; + mfaac = m2; + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfabc * c1o2 + mfabb * (vvz - c1o2) + mfaba * (vz2 - vvz) * c1o2; + m1 = -mfabc - c2o1 * mfabb * vvz + mfaba * (c1o1 - vz2); + m2 = mfabc * c1o2 + mfabb * (vvz + c1o2) + mfaba * (vz2 + vvz) * c1o2; + mfaba = m0; + mfabb = m1; + mfabc = m2; + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfacc * c1o2 + mfacb * (vvz - c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 - vvz) * c1o2; + m1 = -mfacc - c2o1 * mfacb * vvz + mfaca * (c1o1 - vz2) - c1o3 * oMdrho * vz2; + m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * (vz2 + vvz) * c1o2; + mfaca = m0; + mfacb = m1; + mfacc = m2; + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * (vz2 - vvz) * c1o2; + m1 = -mfbac - c2o1 * mfbab * vvz + mfbaa * (c1o1 - vz2); + m2 = mfbac * c1o2 + mfbab * (vvz + c1o2) + mfbaa * (vz2 + vvz) * c1o2; + mfbaa = m0; + mfbab = m1; + mfbac = m2; + /////////b////////////////////////////////////////////////////////////////////////// + m0 = mfbbc * c1o2 + mfbbb * (vvz - c1o2) + mfbba * (vz2 - vvz) * c1o2; + m1 = -mfbbc - c2o1 * mfbbb * vvz + mfbba * (c1o1 - vz2); + m2 = mfbbc * c1o2 + mfbbb * (vvz + c1o2) + mfbba * (vz2 + vvz) * c1o2; + mfbba = m0; + mfbbb = m1; + mfbbc = m2; + /////////b////////////////////////////////////////////////////////////////////////// + m0 = mfbcc * c1o2 + mfbcb * (vvz - c1o2) + mfbca * (vz2 - vvz) * c1o2; + m1 = -mfbcc - c2o1 * mfbcb * vvz + mfbca * (c1o1 - vz2); + m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * (vz2 + vvz) * c1o2; + mfbca = m0; + mfbcb = m1; + mfbcc = m2; + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 - vvz) * c1o2; + m1 = -mfcac - c2o1 * mfcab * vvz + mfcaa * (c1o1 - vz2) - c1o3 * oMdrho * vz2; + m2 = mfcac * c1o2 + mfcab * (vvz + c1o2) + (mfcaa + c1o3 * oMdrho) * (vz2 + vvz) * c1o2; + mfcaa = m0; + mfcab = m1; + mfcac = m2; + /////////c////////////////////////////////////////////////////////////////////////// + m0 = mfcbc * c1o2 + mfcbb * (vvz - c1o2) + mfcba * (vz2 - vvz) * c1o2; + m1 = -mfcbc - c2o1 * mfcbb * vvz + mfcba * (c1o1 - vz2); + m2 = mfcbc * c1o2 + mfcbb * (vvz + c1o2) + mfcba * (vz2 + vvz) * c1o2; + mfcba = m0; + mfcbb = m1; + mfcbc = m2; + /////////c////////////////////////////////////////////////////////////////////////// + m0 = mfccc * c1o2 + mfccb * (vvz - c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 - vvz) * c1o2; + m1 = -mfccc - c2o1 * mfccb * vvz + mfcca * (c1o1 - vz2) - c1o9 * oMdrho * vz2; + m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * (vz2 + vvz) * c1o2; + mfcca = m0; + mfccb = m1; + mfccc = m2; + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// + // mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18 Konditionieren + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + m0 = mfaca * c1o2 + mfaba * (vvy - c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 - vvy) * c1o2; + m1 = -mfaca - c2o1 * mfaba * vvy + mfaaa * (c1o1 - vy2) - c1o6 * oMdrho * vy2; + m2 = mfaca * c1o2 + mfaba * (vvy + c1o2) + (mfaaa + c1o6 * oMdrho) * (vy2 + vvy) * c1o2; + mfaaa = m0; + mfaba = m1; + mfaca = m2; + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfacb * c1o2 + mfabb * (vvy - c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 - vvy) * c1o2; + m1 = -mfacb - c2o1 * mfabb * vvy + mfaab * (c1o1 - vy2) - c2o3 * oMdrho * vy2; + m2 = mfacb * c1o2 + mfabb * (vvy + c1o2) + (mfaab + c2o3 * oMdrho) * (vy2 + vvy) * c1o2; + mfaab = m0; + mfabb = m1; + mfacb = m2; + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfacc * c1o2 + mfabc * (vvy - c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 - vvy) * c1o2; + m1 = -mfacc - c2o1 * mfabc * vvy + mfaac * (c1o1 - vy2) - c1o6 * oMdrho * vy2; + m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * (vy2 + vvy) * c1o2; + mfaac = m0; + mfabc = m1; + mfacc = m2; + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * (vy2 - vvy) * c1o2; + m1 = -mfbca - c2o1 * mfbba * vvy + mfbaa * (c1o1 - vy2); + m2 = mfbca * c1o2 + mfbba * (vvy + c1o2) + mfbaa * (vy2 + vvy) * c1o2; + mfbaa = m0; + mfbba = m1; + mfbca = m2; + /////////b////////////////////////////////////////////////////////////////////////// + m0 = mfbcb * c1o2 + mfbbb * (vvy - c1o2) + mfbab * (vy2 - vvy) * c1o2; + m1 = -mfbcb - c2o1 * mfbbb * vvy + mfbab * (c1o1 - vy2); + m2 = mfbcb * c1o2 + mfbbb * (vvy + c1o2) + mfbab * (vy2 + vvy) * c1o2; + mfbab = m0; + mfbbb = m1; + mfbcb = m2; + /////////b////////////////////////////////////////////////////////////////////////// + m0 = mfbcc * c1o2 + mfbbc * (vvy - c1o2) + mfbac * (vy2 - vvy) * c1o2; + m1 = -mfbcc - c2o1 * mfbbc * vvy + mfbac * (c1o1 - vy2); + m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * (vy2 + vvy) * c1o2; + mfbac = m0; + mfbbc = m1; + mfbcc = m2; + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 - vvy) * c1o2; + m1 = -mfcca - c2o1 * mfcba * vvy + mfcaa * (c1o1 - vy2) - c1o18 * oMdrho * vy2; + m2 = mfcca * c1o2 + mfcba * (vvy + c1o2) + (mfcaa + c1o18 * oMdrho) * (vy2 + vvy) * c1o2; + mfcaa = m0; + mfcba = m1; + mfcca = m2; + /////////c////////////////////////////////////////////////////////////////////////// + m0 = mfccb * c1o2 + mfcbb * (vvy - c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 - vvy) * c1o2; + m1 = -mfccb - c2o1 * mfcbb * vvy + mfcab * (c1o1 - vy2) - c2o9 * oMdrho * vy2; + m2 = mfccb * c1o2 + mfcbb * (vvy + c1o2) + (mfcab + c2o9 * oMdrho) * (vy2 + vvy) * c1o2; + mfcab = m0; + mfcbb = m1; + mfccb = m2; + /////////c////////////////////////////////////////////////////////////////////////// + m0 = mfccc * c1o2 + mfcbc * (vvy - c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 - vvy) * c1o2; + m1 = -mfccc - c2o1 * mfcbc * vvy + mfcac * (c1o1 - vy2) - c1o18 * oMdrho * vy2; + m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * (vy2 + vvy) * c1o2; + mfcac = m0; + mfcbc = m1; + mfccc = m2; + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// + // mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + m0 = mfcaa * c1o2 + mfbaa * (vvx - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 - vvx) * c1o2; + m1 = -mfcaa - c2o1 * mfbaa * vvx + mfaaa * (c1o1 - vx2) - c1o36 * oMdrho * vx2; + m2 = mfcaa * c1o2 + mfbaa * (vvx + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx2 + vvx) * c1o2; + mfaaa = m0; + mfbaa = m1; + mfcaa = m2; + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfcba * c1o2 + mfbba * (vvx - c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 - vvx) * c1o2; + m1 = -mfcba - c2o1 * mfbba * vvx + mfaba * (c1o1 - vx2) - c1o9 * oMdrho * vx2; + m2 = mfcba * c1o2 + mfbba * (vvx + c1o2) + (mfaba + c1o9 * oMdrho) * (vx2 + vvx) * c1o2; + mfaba = m0; + mfbba = m1; + mfcba = m2; + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfcca * c1o2 + mfbca * (vvx - c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 - vvx) * c1o2; + m1 = -mfcca - c2o1 * mfbca * vvx + mfaca * (c1o1 - vx2) - c1o36 * oMdrho * vx2; + m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * (vx2 + vvx) * c1o2; + mfaca = m0; + mfbca = m1; + mfcca = m2; + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 - vvx) * c1o2; + m1 = -mfcab - c2o1 * mfbab * vvx + mfaab * (c1o1 - vx2) - c1o9 * oMdrho * vx2; + m2 = mfcab * c1o2 + mfbab * (vvx + c1o2) + (mfaab + c1o9 * oMdrho) * (vx2 + vvx) * c1o2; + mfaab = m0; + mfbab = m1; + mfcab = m2; + ///////////b//////////////////////////////////////////////////////////////////////// + m0 = mfcbb * c1o2 + mfbbb * (vvx - c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 - vvx) * c1o2; + m1 = -mfcbb - c2o1 * mfbbb * vvx + mfabb * (c1o1 - vx2) - c4o9 * oMdrho * vx2; + m2 = mfcbb * c1o2 + mfbbb * (vvx + c1o2) + (mfabb + c4o9 * oMdrho) * (vx2 + vvx) * c1o2; + mfabb = m0; + mfbbb = m1; + mfcbb = m2; + ///////////b//////////////////////////////////////////////////////////////////////// + m0 = mfccb * c1o2 + mfbcb * (vvx - c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 - vvx) * c1o2; + m1 = -mfccb - c2o1 * mfbcb * vvx + mfacb * (c1o1 - vx2) - c1o9 * oMdrho * vx2; + m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * (vx2 + vvx) * c1o2; + mfacb = m0; + mfbcb = m1; + mfccb = m2; + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// + m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 - vvx) * c1o2; + m1 = -mfcac - c2o1 * mfbac * vvx + mfaac * (c1o1 - vx2) - c1o36 * oMdrho * vx2; + m2 = mfcac * c1o2 + mfbac * (vvx + c1o2) + (mfaac + c1o36 * oMdrho) * (vx2 + vvx) * c1o2; + mfaac = m0; + mfbac = m1; + mfcac = m2; + ///////////c//////////////////////////////////////////////////////////////////////// + m0 = mfcbc * c1o2 + mfbbc * (vvx - c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 - vvx) * c1o2; + m1 = -mfcbc - c2o1 * mfbbc * vvx + mfabc * (c1o1 - vx2) - c1o9 * oMdrho * vx2; + m2 = mfcbc * c1o2 + mfbbc * (vvx + c1o2) + (mfabc + c1o9 * oMdrho) * (vx2 + vvx) * c1o2; + mfabc = m0; + mfbbc = m1; + mfcbc = m2; + ///////////c//////////////////////////////////////////////////////////////////////// + m0 = mfccc * c1o2 + mfbcc * (vvx - c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 - vvx) * c1o2; + m1 = -mfccc - c2o1 * mfbcc * vvx + mfacc * (c1o1 - vx2) - c1o36 * oMdrho * vx2; + m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * (vx2 + vvx) * c1o2; + mfacc = m0; + mfbcc = m1; + mfccc = m2; + //////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////////// + // index 0 + kzero = posC[k]; + kw = neighborCX[kzero]; + ks = neighborCY[kzero]; + kb = neighborCZ[kzero]; + ksw = neighborCY[kw]; + kbw = neighborCZ[kw]; + kbs = neighborCZ[ks]; + kbsw = neighborCZ[ksw]; + //////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////////// + feC[kzero] = mfcbb; + fwC[kw] = mfabb; + fnC[kzero] = mfbcb; + fsC[ks] = mfbab; + ftC[kzero] = mfbbc; + fbC[kb] = mfbba; + fneC[kzero] = mfccb; + fswC[ksw] = mfaab; + fseC[ks] = mfcab; + fnwC[kw] = mfacb; + fteC[kzero] = mfcbc; + fbwC[kbw] = mfaba; + fbeC[kb] = mfcba; + ftwC[kw] = mfabc; + ftnC[kzero] = mfbcc; + fbsC[kbs] = mfbaa; + fbnC[kb] = mfbca; + ftsC[ks] = mfbac; + fzeroC[kzero] = mfbbb; + ftneC[kzero] = mfccc; + ftseC[ks] = mfcac; + fbneC[kb] = mfcca; + fbseC[kbs] = mfcaa; + ftnwC[kw] = mfacc; + ftswC[ksw] = mfaac; + fbnwC[kbw] = mfaca; + fbswC[kbsw] = mfaaa; + //////////////////////////////////////////////////////////////////////////////////// + } +} + +__global__ void scaleFC_RhoSq_comp_27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -9596,7 +11066,7 @@ extern "C" __global__ void scaleFC_RhoSq_comp_27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -9609,100 +11079,6 @@ extern "C" __global__ void scaleFC_RhoSq_comp_27(real* DC, unsigned int nyF, OffFC offFC) { - real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, - *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; - - real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, - *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - - if (evenOrOdd==true) - { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; - } - else - { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; - } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index const unsigned iy = blockIdx.x; // Globaler y-Index @@ -9714,1177 +11090,10 @@ extern "C" __global__ void scaleFC_RhoSq_comp_27(real* DC, const unsigned k = nx*(ny*iz + iy) + ix; ////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - real eps_new = c2o1; - real omegaS = omFine;//-omFine; - real o = omCoarse;//-omCoarse; - //real op = one; - //real cu_sq; - - real xoff, yoff, zoff; - real xoff_sq, yoff_sq, zoff_sq; - - real press;//,drho,vx1,vx2,vx3; - real /*press_SWT,*/drho_SWT,vx1_SWT,vx2_SWT,vx3_SWT; - real /*press_NWT,*/drho_NWT,vx1_NWT,vx2_NWT,vx3_NWT; - real /*press_NET,*/drho_NET,vx1_NET,vx2_NET,vx3_NET; - real /*press_SET,*/drho_SET,vx1_SET,vx2_SET,vx3_SET; - real /*press_SWB,*/drho_SWB,vx1_SWB,vx2_SWB,vx3_SWB; - real /*press_NWB,*/drho_NWB,vx1_NWB,vx2_NWB,vx3_NWB; - real /*press_NEB,*/drho_NEB,vx1_NEB,vx2_NEB,vx3_NEB; - real /*press_SEB,*/drho_SEB,vx1_SEB,vx2_SEB,vx3_SEB; - real f_E,f_W,f_N,f_S,f_T,f_B,f_NE,f_SW,f_SE,f_NW,f_TE,f_BW,f_BE,f_TW,f_TN,f_BS,f_BN,f_TS,f_ZERO,f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - //real feq_E,feq_W,feq_N,feq_S,feq_T,feq_B,feq_NE,feq_SW,feq_SE,feq_NW,feq_TE,feq_BW,feq_BE,feq_TW,feq_TN,feq_BS,feq_BN,feq_TS,feq_ZERO,feq_TNE, feq_TSW, feq_TSE, feq_TNW, feq_BNE, feq_BSW, feq_BSE, feq_BNW; - real kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT; - real kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT; - real kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET; - real kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET; - real kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB; - real kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB; - real kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB; - real kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB; - real a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz/*, axyz, bxyz, cxyz*/; - real d0, dx, dy, dz, dxy, dxz, dyz/*, dxyz*/; - - if(k<kFC) - { - ////////////////////////////////////////////////////////////////////////// - xoff = offFC.xOffFC[k]; - yoff = offFC.yOffFC[k]; - zoff = offFC.zOffFC[k]; - xoff_sq = xoff * xoff; - yoff_sq = yoff * yoff; - zoff_sq = zoff * zoff; - ////////////////////////////////////////////////////////////////////////// - //SWB// - ////////////////////////////////////////////////////////////////////////// - //index 0 - unsigned int k0zero= posFSWB[k]; - unsigned int k0w = neighborFX[k0zero]; - unsigned int k0s = neighborFY[k0zero]; - unsigned int k0b = neighborFZ[k0zero]; - unsigned int k0sw = neighborFY[k0w]; - unsigned int k0bw = neighborFZ[k0w]; - unsigned int k0bs = neighborFZ[k0s]; - unsigned int k0bsw = neighborFZ[k0sw]; - ////////////////////////////////////////////////////////////////////////// - //index - unsigned int kzero= k0zero; - unsigned int kw = k0w; - unsigned int ks = k0s; - unsigned int kb = k0b; - unsigned int ksw = k0sw; - unsigned int kbw = k0bw; - unsigned int kbs = k0bs; - unsigned int kbsw = k0bsw; - //////////////////////////////////////////////////////////////////////////////// - f_E = feF[kzero]; - f_W = fwF[kw]; - f_N = fnF[kzero]; - f_S = fsF[ks]; - f_T = ftF[kzero]; - f_B = fbF[kb]; - f_NE = fneF[kzero]; - f_SW = fswF[ksw]; - f_SE = fseF[ks]; - f_NW = fnwF[kw]; - f_TE = fteF[kzero]; - f_BW = fbwF[kbw]; - f_BE = fbeF[kb]; - f_TW = ftwF[kw]; - f_TN = ftnF[kzero]; - f_BS = fbsF[kbs]; - f_BN = fbnF[kb]; - f_TS = ftsF[ks]; - f_ZERO = fzeroF[kzero]; - f_TNE = ftneF[kzero]; - f_TSW = ftswF[ksw]; - f_TSE = ftseF[ks]; - f_TNW = ftnwF[kw]; - f_BNE = fbneF[kb]; - f_BSW = fbswF[kbsw]; - f_BSE = fbseF[kbs]; - f_BNW = fbnwF[kbw]; - - drho_SWB = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; - vx1_SWB = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_SWB); - vx2_SWB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_SWB); - vx3_SWB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_SWB); - - kxyFromfcNEQ_SWB = -c3o1*omegaS*((f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE ) / (c1o1 + drho_SWB) - ((vx1_SWB*vx2_SWB))); - kyzFromfcNEQ_SWB = -c3o1*omegaS*((f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW ) / (c1o1 + drho_SWB) - ((vx2_SWB*vx3_SWB))); - kxzFromfcNEQ_SWB = -c3o1*omegaS*((f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE ) / (c1o1 + drho_SWB) - ((vx1_SWB*vx3_SWB))); - kxxMyyFromfcNEQ_SWB = -c3o2*omegaS *((f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE ) / (c1o1 + drho_SWB) - ((vx1_SWB*vx1_SWB-vx2_SWB*vx2_SWB))); - kxxMzzFromfcNEQ_SWB = -c3o2*omegaS *((f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE ) / (c1o1 + drho_SWB) - ((vx1_SWB*vx1_SWB-vx3_SWB*vx3_SWB))); - - - ////////////////////////////////////////////////////////////////////////// - //SWT// - ////////////////////////////////////////////////////////////////////////// - //index - kzero= kb; - kw = kbw; - ks = kbs; - kb = neighborFZ[kb]; - ksw = kbsw; - kbw = neighborFZ[kbw]; - kbs = neighborFZ[kbs]; - kbsw = neighborFZ[kbsw]; - //////////////////////////////////////////////////////////////////////////////// - f_E = feF[kzero]; - f_W = fwF[kw]; - f_N = fnF[kzero]; - f_S = fsF[ks]; - f_T = ftF[kzero]; - f_B = fbF[kb]; - f_NE = fneF[kzero]; - f_SW = fswF[ksw]; - f_SE = fseF[ks]; - f_NW = fnwF[kw]; - f_TE = fteF[kzero]; - f_BW = fbwF[kbw]; - f_BE = fbeF[kb]; - f_TW = ftwF[kw]; - f_TN = ftnF[kzero]; - f_BS = fbsF[kbs]; - f_BN = fbnF[kb]; - f_TS = ftsF[ks]; - f_ZERO = fzeroF[kzero]; - f_TNE = ftneF[kzero]; - f_TSW = ftswF[ksw]; - f_TSE = ftseF[ks]; - f_TNW = ftnwF[kw]; - f_BNE = fbneF[kb]; - f_BSW = fbswF[kbsw]; - f_BSE = fbseF[kbs]; - f_BNW = fbnwF[kbw]; - - drho_SWT = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; - vx1_SWT = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_SWT); - vx2_SWT = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_SWT); - vx3_SWT = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_SWT); - - kxyFromfcNEQ_SWT = -c3o1*omegaS*((f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE ) / (c1o1 + drho_SWT) - ((vx1_SWT*vx2_SWT))); - kyzFromfcNEQ_SWT = -c3o1*omegaS*((f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW ) / (c1o1 + drho_SWT) - ((vx2_SWT*vx3_SWT))); - kxzFromfcNEQ_SWT = -c3o1*omegaS*((f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE ) / (c1o1 + drho_SWT) - ((vx1_SWT*vx3_SWT))); - kxxMyyFromfcNEQ_SWT = -c3o2*omegaS *((f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE ) / (c1o1 + drho_SWT) - ((vx1_SWT*vx1_SWT-vx2_SWT*vx2_SWT))); - kxxMzzFromfcNEQ_SWT = -c3o2*omegaS *((f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE ) / (c1o1 + drho_SWT) - ((vx1_SWT*vx1_SWT-vx3_SWT*vx3_SWT))); - - ////////////////////////////////////////////////////////////////////////// - //SET// - ////////////////////////////////////////////////////////////////////////// - //index - kzero= kw; - kw = neighborFX[kw]; - ks = ksw; - kb = kbw; - ksw = neighborFX[ksw]; - kbw = neighborFX[kbw]; - kbs = kbsw; - kbsw = neighborFX[kbsw]; - //////////////////////////////////////////////////////////////////////////////// - f_E = feF[kzero]; - f_W = fwF[kw]; - f_N = fnF[kzero]; - f_S = fsF[ks]; - f_T = ftF[kzero]; - f_B = fbF[kb]; - f_NE = fneF[kzero]; - f_SW = fswF[ksw]; - f_SE = fseF[ks]; - f_NW = fnwF[kw]; - f_TE = fteF[kzero]; - f_BW = fbwF[kbw]; - f_BE = fbeF[kb]; - f_TW = ftwF[kw]; - f_TN = ftnF[kzero]; - f_BS = fbsF[kbs]; - f_BN = fbnF[kb]; - f_TS = ftsF[ks]; - f_ZERO = fzeroF[kzero]; - f_TNE = ftneF[kzero]; - f_TSW = ftswF[ksw]; - f_TSE = ftseF[ks]; - f_TNW = ftnwF[kw]; - f_BNE = fbneF[kb]; - f_BSW = fbswF[kbsw]; - f_BSE = fbseF[kbs]; - f_BNW = fbnwF[kbw]; - - drho_SET = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; - vx1_SET = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_SET); - vx2_SET = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_SET); - vx3_SET = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_SET); - - kxyFromfcNEQ_SET = -c3o1*omegaS*((f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE ) / (c1o1 + drho_SET) - ((vx1_SET*vx2_SET))); - kyzFromfcNEQ_SET = -c3o1*omegaS*((f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW ) / (c1o1 + drho_SET) - ((vx2_SET*vx3_SET))); - kxzFromfcNEQ_SET = -c3o1*omegaS*((f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE ) / (c1o1 + drho_SET) - ((vx1_SET*vx3_SET))); - kxxMyyFromfcNEQ_SET = -c3o2*omegaS *((f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE ) / (c1o1 + drho_SET) - ((vx1_SET*vx1_SET-vx2_SET*vx2_SET))); - kxxMzzFromfcNEQ_SET = -c3o2*omegaS *((f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE ) / (c1o1 + drho_SET) - ((vx1_SET*vx1_SET-vx3_SET*vx3_SET))); - - ////////////////////////////////////////////////////////////////////////// - //SEB// - ////////////////////////////////////////////////////////////////////////// - //index - kb = kzero; - kbw = kw; - kbs = ks; - kbsw = ksw; - kzero= k0w; - kw = neighborFX[k0w]; - ks = k0sw; - ksw = neighborFX[k0sw]; - //////////////////////////////////////////////////////////////////////////////// - f_E = feF[kzero]; - f_W = fwF[kw]; - f_N = fnF[kzero]; - f_S = fsF[ks]; - f_T = ftF[kzero]; - f_B = fbF[kb]; - f_NE = fneF[kzero]; - f_SW = fswF[ksw]; - f_SE = fseF[ks]; - f_NW = fnwF[kw]; - f_TE = fteF[kzero]; - f_BW = fbwF[kbw]; - f_BE = fbeF[kb]; - f_TW = ftwF[kw]; - f_TN = ftnF[kzero]; - f_BS = fbsF[kbs]; - f_BN = fbnF[kb]; - f_TS = ftsF[ks]; - f_ZERO = fzeroF[kzero]; - f_TNE = ftneF[kzero]; - f_TSW = ftswF[ksw]; - f_TSE = ftseF[ks]; - f_TNW = ftnwF[kw]; - f_BNE = fbneF[kb]; - f_BSW = fbswF[kbsw]; - f_BSE = fbseF[kbs]; - f_BNW = fbnwF[kbw]; - - drho_SEB = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; - vx1_SEB = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_SEB); - vx2_SEB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_SEB); - vx3_SEB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_SEB); - - kxyFromfcNEQ_SEB = -c3o1*omegaS*((f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE ) / (c1o1 + drho_SEB) - ((vx1_SEB*vx2_SEB))); - kyzFromfcNEQ_SEB = -c3o1*omegaS*((f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW ) / (c1o1 + drho_SEB) - ((vx2_SEB*vx3_SEB))); - kxzFromfcNEQ_SEB = -c3o1*omegaS*((f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE ) / (c1o1 + drho_SEB) - ((vx1_SEB*vx3_SEB))); - kxxMyyFromfcNEQ_SEB = -c3o2*omegaS *((f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE ) / (c1o1 + drho_SEB) - ((vx1_SEB*vx1_SEB-vx2_SEB*vx2_SEB))); - kxxMzzFromfcNEQ_SEB = -c3o2*omegaS *((f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE ) / (c1o1 + drho_SEB) - ((vx1_SEB*vx1_SEB-vx3_SEB*vx3_SEB))); - - ////////////////////////////////////////////////////////////////////////// - //NWB// - ////////////////////////////////////////////////////////////////////////// - //index 0 - k0zero= k0s; - k0w = k0sw; - k0s = neighborFY[k0s]; - k0b = k0bs; - k0sw = neighborFY[k0sw]; - k0bw = k0bsw; - k0bs = neighborFY[k0bs]; - k0bsw = neighborFY[k0bsw]; - ////////////////////////////////////////////////////////////////////////// - //index - kzero= k0zero; - kw = k0w; - ks = k0s; - kb = k0b; - ksw = k0sw; - kbw = k0bw; - kbs = k0bs; - kbsw = k0bsw; - //////////////////////////////////////////////////////////////////////////////// - f_E = feF[kzero]; - f_W = fwF[kw]; - f_N = fnF[kzero]; - f_S = fsF[ks]; - f_T = ftF[kzero]; - f_B = fbF[kb]; - f_NE = fneF[kzero]; - f_SW = fswF[ksw]; - f_SE = fseF[ks]; - f_NW = fnwF[kw]; - f_TE = fteF[kzero]; - f_BW = fbwF[kbw]; - f_BE = fbeF[kb]; - f_TW = ftwF[kw]; - f_TN = ftnF[kzero]; - f_BS = fbsF[kbs]; - f_BN = fbnF[kb]; - f_TS = ftsF[ks]; - f_ZERO = fzeroF[kzero]; - f_TNE = ftneF[kzero]; - f_TSW = ftswF[ksw]; - f_TSE = ftseF[ks]; - f_TNW = ftnwF[kw]; - f_BNE = fbneF[kb]; - f_BSW = fbswF[kbsw]; - f_BSE = fbseF[kbs]; - f_BNW = fbnwF[kbw]; - - drho_NWB = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; - vx1_NWB = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_NWB); - vx2_NWB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_NWB); - vx3_NWB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_NWB); - - kxyFromfcNEQ_NWB = -c3o1*omegaS*((f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE ) / (c1o1 + drho_NWB) - ((vx1_NWB*vx2_NWB))); - kyzFromfcNEQ_NWB = -c3o1*omegaS*((f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW ) / (c1o1 + drho_NWB) - ((vx2_NWB*vx3_NWB))); - kxzFromfcNEQ_NWB = -c3o1*omegaS*((f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE ) / (c1o1 + drho_NWB) - ((vx1_NWB*vx3_NWB))); - kxxMyyFromfcNEQ_NWB = -c3o2*omegaS *((f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE ) / (c1o1 + drho_NWB) - ((vx1_NWB*vx1_NWB-vx2_NWB*vx2_NWB))); - kxxMzzFromfcNEQ_NWB = -c3o2*omegaS *((f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE ) / (c1o1 + drho_NWB) - ((vx1_NWB*vx1_NWB-vx3_NWB*vx3_NWB))); - - ////////////////////////////////////////////////////////////////////////// - //NWT// - ////////////////////////////////////////////////////////////////////////// - //index - kzero= kb; - kw = kbw; - ks = kbs; - kb = neighborFZ[kb]; - ksw = kbsw; - kbw = neighborFZ[kbw]; - kbs = neighborFZ[kbs]; - kbsw = neighborFZ[kbsw]; - //////////////////////////////////////////////////////////////////////////////// - f_E = feF[kzero]; - f_W = fwF[kw]; - f_N = fnF[kzero]; - f_S = fsF[ks]; - f_T = ftF[kzero]; - f_B = fbF[kb]; - f_NE = fneF[kzero]; - f_SW = fswF[ksw]; - f_SE = fseF[ks]; - f_NW = fnwF[kw]; - f_TE = fteF[kzero]; - f_BW = fbwF[kbw]; - f_BE = fbeF[kb]; - f_TW = ftwF[kw]; - f_TN = ftnF[kzero]; - f_BS = fbsF[kbs]; - f_BN = fbnF[kb]; - f_TS = ftsF[ks]; - f_ZERO = fzeroF[kzero]; - f_TNE = ftneF[kzero]; - f_TSW = ftswF[ksw]; - f_TSE = ftseF[ks]; - f_TNW = ftnwF[kw]; - f_BNE = fbneF[kb]; - f_BSW = fbswF[kbsw]; - f_BSE = fbseF[kbs]; - f_BNW = fbnwF[kbw]; - - drho_NWT = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; - vx1_NWT = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_NWT); - vx2_NWT = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_NWT); - vx3_NWT = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_NWT); - - kxyFromfcNEQ_NWT = -c3o1*omegaS*((f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE ) / (c1o1 + drho_NWT) - ((vx1_NWT*vx2_NWT))); - kyzFromfcNEQ_NWT = -c3o1*omegaS*((f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW ) / (c1o1 + drho_NWT) - ((vx2_NWT*vx3_NWT))); - kxzFromfcNEQ_NWT = -c3o1*omegaS*((f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE ) / (c1o1 + drho_NWT) - ((vx1_NWT*vx3_NWT))); - kxxMyyFromfcNEQ_NWT = -c3o2*omegaS *((f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE ) / (c1o1 + drho_NWT) - ((vx1_NWT*vx1_NWT-vx2_NWT*vx2_NWT))); - kxxMzzFromfcNEQ_NWT = -c3o2*omegaS *((f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE ) / (c1o1 + drho_NWT) - ((vx1_NWT*vx1_NWT-vx3_NWT*vx3_NWT))); - - ////////////////////////////////////////////////////////////////////////// - //NET// - ////////////////////////////////////////////////////////////////////////// - //index - kzero= kw; - kw = neighborFX[kw]; - ks = ksw; - kb = kbw; - ksw = neighborFX[ksw]; - kbw = neighborFX[kbw]; - kbs = kbsw; - kbsw = neighborFX[kbsw]; - //////////////////////////////////////////////////////////////////////////////// - f_E = feF[kzero]; - f_W = fwF[kw]; - f_N = fnF[kzero]; - f_S = fsF[ks]; - f_T = ftF[kzero]; - f_B = fbF[kb]; - f_NE = fneF[kzero]; - f_SW = fswF[ksw]; - f_SE = fseF[ks]; - f_NW = fnwF[kw]; - f_TE = fteF[kzero]; - f_BW = fbwF[kbw]; - f_BE = fbeF[kb]; - f_TW = ftwF[kw]; - f_TN = ftnF[kzero]; - f_BS = fbsF[kbs]; - f_BN = fbnF[kb]; - f_TS = ftsF[ks]; - f_ZERO = fzeroF[kzero]; - f_TNE = ftneF[kzero]; - f_TSW = ftswF[ksw]; - f_TSE = ftseF[ks]; - f_TNW = ftnwF[kw]; - f_BNE = fbneF[kb]; - f_BSW = fbswF[kbsw]; - f_BSE = fbseF[kbs]; - f_BNW = fbnwF[kbw]; - - drho_NET = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; - vx1_NET = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_NET); - vx2_NET = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_NET); - vx3_NET = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_NET); - - kxyFromfcNEQ_NET = -c3o1*omegaS*((f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE ) / (c1o1 + drho_NET) - ((vx1_NET*vx2_NET))); - kyzFromfcNEQ_NET = -c3o1*omegaS*((f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW ) / (c1o1 + drho_NET) - ((vx2_NET*vx3_NET))); - kxzFromfcNEQ_NET = -c3o1*omegaS*((f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE ) / (c1o1 + drho_NET) - ((vx1_NET*vx3_NET))); - kxxMyyFromfcNEQ_NET = -c3o2*omegaS *((f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE ) / (c1o1 + drho_NET) - ((vx1_NET*vx1_NET-vx2_NET*vx2_NET))); - kxxMzzFromfcNEQ_NET = -c3o2*omegaS *((f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE ) / (c1o1 + drho_NET) - ((vx1_NET*vx1_NET-vx3_NET*vx3_NET))); - - ////////////////////////////////////////////////////////////////////////// - //NEB// - ////////////////////////////////////////////////////////////////////////// - //index - kb = kzero; - kbw = kw; - kbs = ks; - kbsw = ksw; - kzero= k0w; - kw = neighborFX[k0w]; - ks = k0sw; - ksw = neighborFX[k0sw]; - //////////////////////////////////////////////////////////////////////////////// - f_E = feF[kzero]; - f_W = fwF[kw]; - f_N = fnF[kzero]; - f_S = fsF[ks]; - f_T = ftF[kzero]; - f_B = fbF[kb]; - f_NE = fneF[kzero]; - f_SW = fswF[ksw]; - f_SE = fseF[ks]; - f_NW = fnwF[kw]; - f_TE = fteF[kzero]; - f_BW = fbwF[kbw]; - f_BE = fbeF[kb]; - f_TW = ftwF[kw]; - f_TN = ftnF[kzero]; - f_BS = fbsF[kbs]; - f_BN = fbnF[kb]; - f_TS = ftsF[ks]; - f_ZERO = fzeroF[kzero]; - f_TNE = ftneF[kzero]; - f_TSW = ftswF[ksw]; - f_TSE = ftseF[ks]; - f_TNW = ftnwF[kw]; - f_BNE = fbneF[kb]; - f_BSW = fbswF[kbsw]; - f_BSE = fbseF[kbs]; - f_BNW = fbnwF[kbw]; - - drho_NEB = f_E+f_W+f_N+f_S+f_T+f_B+f_NE+f_SW+f_SE+f_NW+f_TE+f_BW+f_BE+f_TW+f_TN+f_BS+f_BN+f_TS+f_ZERO+f_TNE+f_TSW+f_TSE+f_TNW+f_BNE+f_BSW+f_BSE+f_BNW; - vx1_NEB = (((f_TNE-f_BSW)+(f_TSE-f_BNW)+(f_BNE-f_TSW)+(f_BSE-f_TNW)) + (((f_NE-f_SW)+(f_TE-f_BW))+((f_SE-f_NW)+(f_BE-f_TW))) + (f_E-f_W))/(c1o1 + drho_NEB); - vx2_NEB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_BNE-f_TSW)+(f_BNW-f_TSE)) + (((f_NE-f_SW)+(f_TN-f_BS))+((f_BN-f_TS)+(f_NW-f_SE))) + (f_N-f_S))/(c1o1 + drho_NEB); - vx3_NEB = (((f_TNE-f_BSW)+(f_TNW-f_BSE)+(f_TSE-f_BNW)+(f_TSW-f_BNE)) + (((f_TE-f_BW)+(f_TN-f_BS))+((f_TW-f_BE)+(f_TS-f_BN))) + (f_T-f_B))/(c1o1 + drho_NEB); - - kxyFromfcNEQ_NEB = -c3o1*omegaS*((f_SW+f_BSW+f_TSW-f_NW-f_BNW-f_TNW-f_SE-f_BSE-f_TSE+f_NE+f_BNE+f_TNE ) / (c1o1 + drho_NEB) - ((vx1_NEB*vx2_NEB))); - kyzFromfcNEQ_NEB = -c3o1*omegaS*((f_BS+f_BSE+f_BSW-f_TS-f_TSE-f_TSW-f_BN-f_BNE-f_BNW+f_TN+f_TNE+f_TNW ) / (c1o1 + drho_NEB) - ((vx2_NEB*vx3_NEB))); - kxzFromfcNEQ_NEB = -c3o1*omegaS*((f_BW+f_BSW+f_BNW-f_TW-f_TSW-f_TNW-f_BE-f_BSE-f_BNE+f_TE+f_TSE+f_TNE ) / (c1o1 + drho_NEB) - ((vx1_NEB*vx3_NEB))); - kxxMyyFromfcNEQ_NEB = -c3o2*omegaS *((f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE ) / (c1o1 + drho_NEB) - ((vx1_NEB*vx1_NEB-vx2_NEB*vx2_NEB))); - kxxMzzFromfcNEQ_NEB = -c3o2*omegaS *((f_SW+f_W+f_NW-f_BS-f_TS-f_B-f_T-f_BN-f_TN+f_SE+f_E+f_NE ) / (c1o1 + drho_NEB) - ((vx1_NEB*vx1_NEB-vx3_NEB*vx3_NEB))); - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //kxyFromfcNEQ_SWB = zero; - //kyzFromfcNEQ_SWB = zero; - //kxzFromfcNEQ_SWB = zero; - //kxxMyyFromfcNEQ_SWB = zero; - //kxxMzzFromfcNEQ_SWB = zero; - //kxyFromfcNEQ_SWT = zero; - //kyzFromfcNEQ_SWT = zero; - //kxzFromfcNEQ_SWT = zero; - //kxxMyyFromfcNEQ_SWT = zero; - //kxxMzzFromfcNEQ_SWT = zero; - //kxyFromfcNEQ_SET = zero; - //kyzFromfcNEQ_SET = zero; - //kxzFromfcNEQ_SET = zero; - //kxxMyyFromfcNEQ_SET = zero; - //kxxMzzFromfcNEQ_SET = zero; - //kxyFromfcNEQ_SEB = zero; - //kyzFromfcNEQ_SEB = zero; - //kxzFromfcNEQ_SEB = zero; - //kxxMyyFromfcNEQ_SEB = zero; - //kxxMzzFromfcNEQ_SEB = zero; - //kxyFromfcNEQ_NWB = zero; - //kyzFromfcNEQ_NWB = zero; - //kxzFromfcNEQ_NWB = zero; - //kxxMyyFromfcNEQ_NWB = zero; - //kxxMzzFromfcNEQ_NWB = zero; - //kxyFromfcNEQ_NWT = zero; - //kyzFromfcNEQ_NWT = zero; - //kxzFromfcNEQ_NWT = zero; - //kxxMyyFromfcNEQ_NWT = zero; - //kxxMzzFromfcNEQ_NWT = zero; - //kxyFromfcNEQ_NET = zero; - //kyzFromfcNEQ_NET = zero; - //kxzFromfcNEQ_NET = zero; - //kxxMyyFromfcNEQ_NET = zero; - //kxxMzzFromfcNEQ_NET = zero; - //kxyFromfcNEQ_NEB = zero; - //kyzFromfcNEQ_NEB = zero; - //kxzFromfcNEQ_NEB = zero; - //kxxMyyFromfcNEQ_NEB = zero; - //kxxMzzFromfcNEQ_NEB = zero; - ////////////////////////////////////////////////////////////////////////// - //3 - ////////////////////////////////////////////////////////////////////////// - a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - - kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT - - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET - c2o1*kxyFromfcNEQ_NWB - c2o1*kxyFromfcNEQ_NWT + - c2o1*kxyFromfcNEQ_SEB + c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + - c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB - c2o1*kxzFromfcNEQ_NWT + - c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB - c2o1*kxzFromfcNEQ_SWT + - c8o1*vx1_NEB + c8o1*vx1_NET + c8o1*vx1_NWB + c8o1*vx1_NWT + c8o1*vx1_SEB + - c8o1*vx1_SET + c8o1*vx1_SWB + c8o1*vx1_SWT + c2o1*vx2_NEB + c2o1*vx2_NET - - c2o1*vx2_NWB - c2o1*vx2_NWT - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + - c2o1*vx2_SWT - c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - - c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; - b0 = (c2o1*kxxMyyFromfcNEQ_NEB + c2o1*kxxMyyFromfcNEQ_NET + c2o1*kxxMyyFromfcNEQ_NWB + c2o1*kxxMyyFromfcNEQ_NWT - - c2o1*kxxMyyFromfcNEQ_SEB - c2o1*kxxMyyFromfcNEQ_SET - c2o1*kxxMyyFromfcNEQ_SWB - c2o1*kxxMyyFromfcNEQ_SWT - - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + - kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET + c2o1*kxyFromfcNEQ_NWB + c2o1*kxyFromfcNEQ_NWT - - c2o1*kxyFromfcNEQ_SEB - c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + - c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET + c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + - c2o1*kyzFromfcNEQ_SEB - c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB - c2o1*kyzFromfcNEQ_SWT + - c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - - c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT + - c8o1*vx2_NEB + c8o1*vx2_NET + c8o1*vx2_NWB + c8o1*vx2_NWT + - c8o1*vx2_SEB + c8o1*vx2_SET + c8o1*vx2_SWB + c8o1*vx2_SWT - - c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + - c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; - c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + - kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT - - c2o1*kxxMzzFromfcNEQ_NEB + c2o1*kxxMzzFromfcNEQ_NET - c2o1*kxxMzzFromfcNEQ_NWB + c2o1*kxxMzzFromfcNEQ_NWT - - c2o1*kxxMzzFromfcNEQ_SEB + c2o1*kxxMzzFromfcNEQ_SET - c2o1*kxxMzzFromfcNEQ_SWB + c2o1*kxxMzzFromfcNEQ_SWT - - c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB + c2o1*kxzFromfcNEQ_NWT - - c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB + c2o1*kxzFromfcNEQ_SWT - - c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET - c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + - c2o1*kyzFromfcNEQ_SEB + c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB + c2o1*kyzFromfcNEQ_SWT - - c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - - c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - - c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT + - c8o1*vx3_NEB + c8o1*vx3_NET + c8o1*vx3_NWB + c8o1*vx3_NWT + - c8o1*vx3_SEB + c8o1*vx3_SET + c8o1*vx3_SWB + c8o1*vx3_SWT)/c64o1; - ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/c4o1; - bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/c4o1; - cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/c4o1; - axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT + - kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + - kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB - c2o1*vx2_NWT - - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + c2o1*vx2_SWT - - c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - - c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; - bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT + - kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - c2o1*vx1_NEB - c2o1*vx1_NET + c2o1*vx1_NWB + c2o1*vx1_NWT + - c2o1*vx1_SEB + c2o1*vx1_SET - c2o1*vx1_SWB - c2o1*vx1_SWT)/c8o1; - cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT + - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT + - c2o1*vx1_NEB - c2o1*vx1_NET - c2o1*vx1_NWB + c2o1*vx1_NWT + - c2o1*vx1_SEB - c2o1*vx1_SET - c2o1*vx1_SWB + c2o1*vx1_SWT)/c8o1; - ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/c4o1; - by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/c4o1; - cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/c4o1; - ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT - - kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB + c2o1*vx2_NWT + - c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB - c2o1*vx2_SWT)/c8o1; - byy= (-c2o1*kxxMyyFromfcNEQ_NEB - c2o1*kxxMyyFromfcNEQ_NET - c2o1*kxxMyyFromfcNEQ_NWB - c2o1*kxxMyyFromfcNEQ_NWT + - c2o1*kxxMyyFromfcNEQ_SEB + c2o1*kxxMyyFromfcNEQ_SET + c2o1*kxxMyyFromfcNEQ_SWB + c2o1*kxxMyyFromfcNEQ_SWT + - kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - - c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT - - c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + - c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; - cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - - kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT + - c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB - c2o1*vx2_NWT - - c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB + c2o1*vx2_SWT)/c8o1; - az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/c4o1; - bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/c4o1; - cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/c4o1; - azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT - - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT + - c2o1*vx3_NEB - c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + - c2o1*vx3_SEB - c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; - bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - - kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT + - c2o1*vx3_NEB - c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - - c2o1*vx3_SEB + c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; - czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT + - c2o1*kxxMzzFromfcNEQ_NEB - c2o1*kxxMzzFromfcNEQ_NET + c2o1*kxxMzzFromfcNEQ_NWB - c2o1*kxxMzzFromfcNEQ_NWT + - c2o1*kxxMzzFromfcNEQ_SEB - c2o1*kxxMzzFromfcNEQ_SET + c2o1*kxxMzzFromfcNEQ_SWB - c2o1*kxxMzzFromfcNEQ_SWT - - c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - - c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - - c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT)/c16o1; - axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/c2o1; - bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/c2o1; - cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/c2o1; - axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/c2o1; - bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/c2o1; - cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/c2o1; - ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/c2o1; - byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/c2o1; - cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/c2o1; - //axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT; - //bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT; - //cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT; - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real kxyAverage = c0o1; - real kyzAverage = c0o1; - real kxzAverage = c0o1; - real kxxMyyAverage = c0o1; - real kxxMzzAverage = c0o1; - //real kxyAverage =(kxyFromfcNEQ_SWB+ - // kxyFromfcNEQ_SWT+ - // kxyFromfcNEQ_SET+ - // kxyFromfcNEQ_SEB+ - // kxyFromfcNEQ_NWB+ - // kxyFromfcNEQ_NWT+ - // kxyFromfcNEQ_NET+ - // kxyFromfcNEQ_NEB)*c1o8-(ay+bx); - //real kyzAverage =(kyzFromfcNEQ_SWB+ - // kyzFromfcNEQ_SWT+ - // kyzFromfcNEQ_SET+ - // kyzFromfcNEQ_SEB+ - // kyzFromfcNEQ_NWB+ - // kyzFromfcNEQ_NWT+ - // kyzFromfcNEQ_NET+ - // kyzFromfcNEQ_NEB)*c1o8-(bz+cy); - //real kxzAverage =(kxzFromfcNEQ_SWB+ - // kxzFromfcNEQ_SWT+ - // kxzFromfcNEQ_SET+ - // kxzFromfcNEQ_SEB+ - // kxzFromfcNEQ_NWB+ - // kxzFromfcNEQ_NWT+ - // kxzFromfcNEQ_NET+ - // kxzFromfcNEQ_NEB)*c1o8-(az+cx); - //real kxxMyyAverage =(kxxMyyFromfcNEQ_SWB+ - // kxxMyyFromfcNEQ_SWT+ - // kxxMyyFromfcNEQ_SET+ - // kxxMyyFromfcNEQ_SEB+ - // kxxMyyFromfcNEQ_NWB+ - // kxxMyyFromfcNEQ_NWT+ - // kxxMyyFromfcNEQ_NET+ - // kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by); - //real kxxMzzAverage =(kxxMzzFromfcNEQ_SWB+ - // kxxMzzFromfcNEQ_SWT+ - // kxxMzzFromfcNEQ_SET+ - // kxxMzzFromfcNEQ_SEB+ - // kxxMzzFromfcNEQ_NWB+ - // kxxMzzFromfcNEQ_NWT+ - // kxxMzzFromfcNEQ_NET+ - // kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz); - - - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Press - //d0 = ( press_NEB + press_NET + press_NWB + press_NWT + press_SEB + press_SET + press_SWB + press_SWT) * c1o8; - //dx = ( press_NEB + press_NET - press_NWB - press_NWT + press_SEB + press_SET - press_SWB - press_SWT) * c1o4; - //dy = ( press_NEB + press_NET + press_NWB + press_NWT - press_SEB - press_SET - press_SWB - press_SWT) * c1o4; - //dz = (-press_NEB + press_NET - press_NWB + press_NWT - press_SEB + press_SET - press_SWB + press_SWT) * c1o4; - //dxy = ( press_NEB + press_NET - press_NWB - press_NWT - press_SEB - press_SET + press_SWB + press_SWT) * c1o2; - //dxz = (-press_NEB + press_NET + press_NWB - press_NWT - press_SEB + press_SET + press_SWB - press_SWT) * c1o2; - //dyz = (-press_NEB + press_NET - press_NWB + press_NWT + press_SEB - press_SET + press_SWB - press_SWT) * c1o2; - //dxyz = -press_NEB + press_NET + press_NWB - press_NWT + press_SEB - press_SET - press_SWB + press_SWT; - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //drho - real LapRho = ((xoff != c0o1) || (yoff != c0o1) || (zoff != c0o1)) ? c0o1 : -c3o1*(ax*ax + by*by + cz*cz) - c6o1 * (bx*ay + cx*az + cy*bz); - d0 = ( drho_NEB + drho_NET + drho_NWB + drho_NWT + drho_SEB + drho_SET + drho_SWB + drho_SWT - c2o1*LapRho) * c1o8; - dx = ( drho_NEB + drho_NET - drho_NWB - drho_NWT + drho_SEB + drho_SET - drho_SWB - drho_SWT) * c1o4; - dy = ( drho_NEB + drho_NET + drho_NWB + drho_NWT - drho_SEB - drho_SET - drho_SWB - drho_SWT) * c1o4; - dz = (-drho_NEB + drho_NET - drho_NWB + drho_NWT - drho_SEB + drho_SET - drho_SWB + drho_SWT) * c1o4; - dxy = ( drho_NEB + drho_NET - drho_NWB - drho_NWT - drho_SEB - drho_SET + drho_SWB + drho_SWT) * c1o2; - dxz = (-drho_NEB + drho_NET + drho_NWB - drho_NWT - drho_SEB + drho_SET + drho_SWB - drho_SWT) * c1o2; - dyz = (-drho_NEB + drho_NET - drho_NWB + drho_NWT + drho_SEB - drho_SET + drho_SWB - drho_SWT) * c1o2; - //dxyz = -drho_NEB + drho_NET + drho_NWB - drho_NWT + drho_SEB - drho_SET - drho_SWB + drho_SWT; - //d0 = zero; - //dx = zero; - //dy = zero; - //dz = zero; - //dxy = zero; - //dxz = zero; - //dyz = zero; - //dxyz = zero; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // Bernd das Brot - // - // - // x------x - // | | - // | ---+--->X - // | | \ - // x------x \ - // off-vector - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz; - ax = ax + c2o1 * xoff * axx + yoff * axy + zoff * axz; - ay = ay + c2o1 * yoff * ayy + xoff * axy + zoff * ayz; - az = az + c2o1 * zoff * azz + xoff * axz + yoff * ayz; - b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz; - bx = bx + c2o1 * xoff * bxx + yoff * bxy + zoff * bxz; - by = by + c2o1 * yoff * byy + xoff * bxy + zoff * byz; - bz = bz + c2o1 * zoff * bzz + xoff * bxz + yoff * byz; - c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz; - cx = cx + c2o1 * xoff * cxx + yoff * cxy + zoff * cxz; - cy = cy + c2o1 * yoff * cyy + xoff * cxy + zoff * cyz; - cz = cz + c2o1 * zoff * czz + xoff * cxz + yoff * cyz; - d0 = d0 + xoff * dx + yoff * dy + zoff * dz + xoff*yoff*dxy + xoff*zoff*dxz + yoff*zoff*dyz; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // FIX /////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //AAAAAAAAAAAAHHHHHHHHHHHH!!!!! Mieser Test!!! - //b0= bx= by= bz= bxx= byy= bzz= bxy= bxz= byz= c0= cx= cy= cz= cxx= cyy= czz= cxy= cxz= cyz= axyz= bxyz= cxyz=zero; - //b0=zero; - //bx=zero; - //by=zero; - //bz=zero; - //bxx=zero; - //byy=zero; - //bzz=zero; - //bxy=zero; - //bxz=zero; - //byz=zero; - //c0=zero; - //cx=zero; - //cy=zero; - //cz=zero; - //cxx=zero; - //cyy=zero; - //czz=zero; - //cxy=zero; - //cxz=zero; - //cyz=zero; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = c0o1; - real mfabb = c0o1; - real mfbcb = c0o1; - real mfbab = c0o1; - real mfbbc = c0o1; - real mfbba = c0o1; - real mfccb = c0o1; - real mfaab = c0o1; - real mfcab = c0o1; - real mfacb = c0o1; - real mfcbc = c0o1; - real mfaba = c0o1; - real mfcba = c0o1; - real mfabc = c0o1; - real mfbcc = c0o1; - real mfbaa = c0o1; - real mfbca = c0o1; - real mfbac = c0o1; - real mfbbb = c0o1; - real mfccc = c0o1; - real mfaac = c0o1; - real mfcac = c0o1; - real mfacc = c0o1; - real mfcca = c0o1; - real mfaaa = c0o1; - real mfcaa = c0o1; - real mfaca = c0o1; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real m0, m1, m2, vvx, vvy, vvz, vx2, vy2, vz2, oMdrho; - real mxxPyyPzz, mxxMyy, mxxMzz, mxxyPyzz, mxxyMyzz, mxxzPyyz, mxxzMyyz, mxyyPxzz, mxyyMxzz; - //real qudricLimit = c1o100;//ganz schlechte Idee -> muss global sein - //real O3 = c2o1 - o; - //real residu, residutmp; - //residutmp = c0o1;///*-*/ c2o9 * (1./o - c1o2) * eps_new * eps_new; - real NeqOn = c1o1;//zero;//one; //.... one = on ..... zero = off - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - //Position C 0., 0., 0. - // - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //x = 0.; - //y = 0.; - //z = 0.; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //real mxoff = -xoff; - //real myoff = -yoff; - //real mzoff = -zoff; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //press = press_NET * (c1o8 - c1o4 * mxoff - c1o4 * myoff - c1o4 * mzoff) + - // press_NWT * (c1o8 + c1o4 * mxoff - c1o4 * myoff - c1o4 * mzoff) + - // press_SET * (c1o8 - c1o4 * mxoff + c1o4 * myoff - c1o4 * mzoff) + - // press_SWT * (c1o8 + c1o4 * mxoff + c1o4 * myoff - c1o4 * mzoff) + - // press_NEB * (c1o8 - c1o4 * mxoff - c1o4 * myoff + c1o4 * mzoff) + - // press_NWB * (c1o8 + c1o4 * mxoff - c1o4 * myoff + c1o4 * mzoff) + - // press_SEB * (c1o8 - c1o4 * mxoff + c1o4 * myoff + c1o4 * mzoff) + - // press_SWB * (c1o8 + c1o4 * mxoff + c1o4 * myoff + c1o4 * mzoff); - //drho = drho_NET * (c1o8 - c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + - // drho_NWT * (c1o8 + c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + - // drho_SET * (c1o8 - c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + - // drho_SWT * (c1o8 + c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + - // drho_NEB * (c1o8 - c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + - // drho_NWB * (c1o8 + c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + - // drho_SEB * (c1o8 - c1o4 * xoff + c1o4 * yoff + c1o4 * zoff) + - // drho_SWB * (c1o8 + c1o4 * xoff + c1o4 * yoff + c1o4 * zoff); - press = d0; - vvx = a0; - vvy = b0; - vvz = c0; - - //mfaaa = drho; - //mfaaa = press + (ax+by+cz)/three; // 1/3 = 2/3*(1/op-1/2) - mfaaa = press; // if drho is interpolated directly - - vx2 = vvx*vvx; - vy2 = vvy*vvy; - vz2 = vvz*vvz; - oMdrho = c1o1; - //oMdrho = one - mfaaa; - - //two - // linear combinations - mxxPyyPzz = mfaaa; - //mxxMyy = -c2o3*(ax - by)*eps_new/o; - //mxxMzz = -c2o3*(ax - cz)*eps_new/o; - - //mfabb = -c1o3 * (bz + cy)*eps_new/o; - //mfbab = -c1o3 * (az + cx)*eps_new/o; - //mfbba = -c1o3 * (ay + bx)*eps_new/o; - mxxMyy = -c2o3*((ax - by)+kxxMyyAverage)*eps_new/o * (c1o1 + press); - mxxMzz = -c2o3*((ax - cz)+kxxMzzAverage)*eps_new/o * (c1o1 + press); - - mfabb = -c1o3 * ((bz + cy)+kyzAverage)*eps_new/o * (c1o1 + press); - mfbab = -c1o3 * ((az + cx)+kxzAverage)*eps_new/o * (c1o1 + press); - mfbba = -c1o3 * ((ay + bx)+kxyAverage)*eps_new/o * (c1o1 + press); - - - // linear combinations back - mfcaa = c1o3 * ( mxxMyy + mxxMzz + mxxPyyPzz) * NeqOn; - mfaca = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz) * NeqOn; - mfaac = c1o3 * ( mxxMyy - c2o1 * mxxMzz + mxxPyyPzz) * NeqOn; - - //3. - // linear combinations - //residu = residutmp * (ayz + bxz + cxy ); - //mfbbb = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); - mfbbb = c0o1; - - //residu = residutmp * (axy + two*bxx + two*bzz + cyz ); - //residu = -(c1o9*(axy - 2*bxx - 2*bzz + cyz )); - //mxxyPyzz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); - mxxyPyzz = c0o1; - - //residu = residutmp * (axy + two*bxx - two*bzz - cyz ); - //residu = c1o9*(axy - 2*bxx + 2*bzz - cyz ); - //mxxyMyzz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); - mxxyMyzz = c0o1; - - //residu = residutmp * (axz + byz + two*cxx + two*cyy ); - //residu = -(c1o9*(axz + byz - 2*cxx - 2*cyy )); - //mxxzPyyz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); - mxxzPyyz = c0o1; - - //residu = residutmp * (axz - byz + two*cxx - two*cyy ); - //residu = c1o9*(axz - byz - 2*cxx + 2*cyy ); - //mxxzMyyz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); - mxxzMyyz = c0o1; - - //residu = residutmp * (two*ayy + two*azz + bxy + cxz ); - //residu = c1o9*(2*ayy + 2*azz - bxy - cxz ); - //mxyyPxzz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); - mxyyPxzz = c0o1; - - //residu = residutmp * (two*ayy - two*azz + bxy - cxz ); - //residu = c1o9*(-2*ayy + 2*azz + bxy - cxz ); - //mxyyMxzz = (abs(residu)+qudricLimit) * residu / (qudricLimit * O3 + abs(residu)); - mxyyMxzz = c0o1; - - // linear combinations back - mfcba = ( mxxyMyzz + mxxyPyzz) * c1o2; - mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2; - mfcab = ( mxxzMyyz + mxxzPyyz) * c1o2; - mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2; - mfbca = ( mxyyMxzz + mxyyPxzz) * c1o2; - mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2; - - //4. - mfacc = mfaaa*c1o9; - mfcac = mfacc; - mfcca = mfacc; - //5. - - //6. - mfccc = mfaaa*c1o27; - //////////////////////////////////////////////////////////////////////////////////// - //back - //////////////////////////////////////////////////////////////////////////////////// - //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - m0 = mfaac * c1o2 + mfaab * (vvz - c1o2) + (mfaaa + c1o1 * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfaac - c2o1 * mfaab * vvz + mfaaa * (c1o1 - vz2) - c1o1 * oMdrho * vz2; - m2 = mfaac * c1o2 + mfaab * (vvz + c1o2) + (mfaaa + c1o1 * oMdrho) * ( vz2 + vvz) * c1o2; - mfaaa = m0; - mfaab = m1; - mfaac = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfabc * c1o2 + mfabb * (vvz - c1o2) + mfaba * ( vz2 - vvz) * c1o2; - m1 = -mfabc - c2o1 * mfabb * vvz + mfaba * (c1o1 - vz2); - m2 = mfabc * c1o2 + mfabb * (vvz + c1o2) + mfaba * ( vz2 + vvz) * c1o2; - mfaba = m0; - mfabb = m1; - mfabc = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfacb * (vvz - c1o2) + (mfaca + c1o3 * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfacc - c2o1 * mfacb * vvz + mfaca * (c1o1 - vz2) - c1o3 * oMdrho * vz2; - m2 = mfacc * c1o2 + mfacb * (vvz + c1o2) + (mfaca + c1o3 * oMdrho) * ( vz2 + vvz) * c1o2; - mfaca = m0; - mfacb = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbac * c1o2 + mfbab * (vvz - c1o2) + mfbaa * ( vz2 - vvz) * c1o2; - m1 = -mfbac - c2o1 * mfbab * vvz + mfbaa * (c1o1 - vz2); - m2 = mfbac * c1o2 + mfbab * (vvz + c1o2) + mfbaa * ( vz2 + vvz) * c1o2; - mfbaa = m0; - mfbab = m1; - mfbac = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbbc * c1o2 + mfbbb * (vvz - c1o2) + mfbba * ( vz2 - vvz) * c1o2; - m1 = -mfbbc - c2o1 * mfbbb * vvz + mfbba * (c1o1 - vz2); - m2 = mfbbc * c1o2 + mfbbb * (vvz + c1o2) + mfbba * ( vz2 + vvz) * c1o2; - mfbba = m0; - mfbbb = m1; - mfbbc = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbcb * (vvz - c1o2) + mfbca * ( vz2 - vvz) * c1o2; - m1 = -mfbcc - c2o1 * mfbcb * vvz + mfbca * (c1o1 - vz2); - m2 = mfbcc * c1o2 + mfbcb * (vvz + c1o2) + mfbca * ( vz2 + vvz) * c1o2; - mfbca = m0; - mfbcb = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfcab * (vvz - c1o2) + (mfcaa + c1o3 * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfcac - c2o1 * mfcab * vvz + mfcaa * (c1o1 - vz2) - c1o3 * oMdrho * vz2; - m2 = mfcac * c1o2 + mfcab * (vvz + c1o2) + (mfcaa + c1o3 * oMdrho) * ( vz2 + vvz) * c1o2; - mfcaa = m0; - mfcab = m1; - mfcac = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfcbb * (vvz - c1o2) + mfcba * ( vz2 - vvz) * c1o2; - m1 = -mfcbc - c2o1 * mfcbb * vvz + mfcba * (c1o1 - vz2); - m2 = mfcbc * c1o2 + mfcbb * (vvz + c1o2) + mfcba * ( vz2 + vvz) * c1o2; - mfcba = m0; - mfcbb = m1; - mfcbc = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfccb * (vvz - c1o2) + (mfcca + c1o9 * oMdrho) * ( vz2 - vvz) * c1o2; - m1 = -mfccc - c2o1 * mfccb * vvz + mfcca * (c1o1 - vz2) - c1o9 * oMdrho * vz2; - m2 = mfccc * c1o2 + mfccb * (vvz + c1o2) + (mfcca + c1o9 * oMdrho) * ( vz2 + vvz) * c1o2; - mfcca = m0; - mfccb = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m0 = mfaca * c1o2 + mfaba * (vvy - c1o2) + (mfaaa + c1o6 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfaca - c2o1 * mfaba * vvy + mfaaa * (c1o1 - vy2) - c1o6 * oMdrho * vy2; - m2 = mfaca * c1o2 + mfaba * (vvy + c1o2) + (mfaaa + c1o6 * oMdrho) * ( vy2 + vvy) * c1o2; - mfaaa = m0; - mfaba = m1; - mfaca = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacb * c1o2 + mfabb * (vvy - c1o2) + (mfaab + c2o3 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfacb - c2o1 * mfabb * vvy + mfaab * (c1o1 - vy2) - c2o3 * oMdrho * vy2; - m2 = mfacb * c1o2 + mfabb * (vvy + c1o2) + (mfaab + c2o3 * oMdrho) * ( vy2 + vvy) * c1o2; - mfaab = m0; - mfabb = m1; - mfacb = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfabc * (vvy - c1o2) + (mfaac + c1o6 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfacc - c2o1 * mfabc * vvy + mfaac * (c1o1 - vy2) - c1o6 * oMdrho * vy2; - m2 = mfacc * c1o2 + mfabc * (vvy + c1o2) + (mfaac + c1o6 * oMdrho) * ( vy2 + vvy) * c1o2; - mfaac = m0; - mfabc = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbca * c1o2 + mfbba * (vvy - c1o2) + mfbaa * ( vy2 - vvy) * c1o2; - m1 = -mfbca - c2o1 * mfbba * vvy + mfbaa * (c1o1 - vy2); - m2 = mfbca * c1o2 + mfbba * (vvy + c1o2) + mfbaa * ( vy2 + vvy) * c1o2; - mfbaa = m0; - mfbba = m1; - mfbca = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcb * c1o2 + mfbbb * (vvy - c1o2) + mfbab * ( vy2 - vvy) * c1o2; - m1 = -mfbcb - c2o1 * mfbbb * vvy + mfbab * (c1o1 - vy2); - m2 = mfbcb * c1o2 + mfbbb * (vvy + c1o2) + mfbab * ( vy2 + vvy) * c1o2; - mfbab = m0; - mfbbb = m1; - mfbcb = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbbc * (vvy - c1o2) + mfbac * ( vy2 - vvy) * c1o2; - m1 = -mfbcc - c2o1 * mfbbc * vvy + mfbac * (c1o1 - vy2); - m2 = mfbcc * c1o2 + mfbbc * (vvy + c1o2) + mfbac * ( vy2 + vvy) * c1o2; - mfbac = m0; - mfbbc = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfcba * (vvy - c1o2) + (mfcaa + c1o18 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfcca - c2o1 * mfcba * vvy + mfcaa * (c1o1 - vy2) - c1o18 * oMdrho * vy2; - m2 = mfcca * c1o2 + mfcba * (vvy + c1o2) + (mfcaa + c1o18 * oMdrho) * ( vy2 + vvy) * c1o2; - mfcaa = m0; - mfcba = m1; - mfcca = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfcbb * (vvy - c1o2) + (mfcab + c2o9 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfccb - c2o1 * mfcbb * vvy + mfcab * (c1o1 - vy2) - c2o9 * oMdrho * vy2; - m2 = mfccb * c1o2 + mfcbb * (vvy + c1o2) + (mfcab + c2o9 * oMdrho) * ( vy2 + vvy) * c1o2; - mfcab = m0; - mfcbb = m1; - mfccb = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfcbc * (vvy - c1o2) + (mfcac + c1o18 * oMdrho) * ( vy2 - vvy) * c1o2; - m1 = -mfccc - c2o1 * mfcbc * vvy + mfcac * (c1o1 - vy2) - c1o18 * oMdrho * vy2; - m2 = mfccc * c1o2 + mfcbc * (vvy + c1o2) + (mfcac + c1o18 * oMdrho) * ( vy2 + vvy) * c1o2; - mfcac = m0; - mfcbc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m0 = mfcaa * c1o2 + mfbaa * (vvx - c1o2) + (mfaaa + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcaa - c2o1 * mfbaa * vvx + mfaaa * (c1o1 - vx2) - c1o36 * oMdrho * vx2; - m2 = mfcaa * c1o2 + mfbaa * (vvx + c1o2) + (mfaaa + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaaa = m0; - mfbaa = m1; - mfcaa = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcba * c1o2 + mfbba * (vvx - c1o2) + (mfaba + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcba - c2o1 * mfbba * vvx + mfaba * (c1o1 - vx2) - c1o9 * oMdrho * vx2; - m2 = mfcba * c1o2 + mfbba * (vvx + c1o2) + (mfaba + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaba = m0; - mfbba = m1; - mfcba = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfbca * (vvx - c1o2) + (mfaca + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcca - c2o1 * mfbca * vvx + mfaca * (c1o1 - vx2) - c1o36 * oMdrho * vx2; - m2 = mfcca * c1o2 + mfbca * (vvx + c1o2) + (mfaca + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaca = m0; - mfbca = m1; - mfcca = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcab * c1o2 + mfbab * (vvx - c1o2) + (mfaab + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcab - c2o1 * mfbab * vvx + mfaab * (c1o1 - vx2) - c1o9 * oMdrho * vx2; - m2 = mfcab * c1o2 + mfbab * (vvx + c1o2) + (mfaab + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaab = m0; - mfbab = m1; - mfcab = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfcbb * c1o2 + mfbbb * (vvx - c1o2) + (mfabb + c4o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcbb - c2o1 * mfbbb * vvx + mfabb * (c1o1 - vx2) - c4o9 * oMdrho * vx2; - m2 = mfcbb * c1o2 + mfbbb * (vvx + c1o2) + (mfabb + c4o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfabb = m0; - mfbbb = m1; - mfcbb = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfbcb * (vvx - c1o2) + (mfacb + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfccb - c2o1 * mfbcb * vvx + mfacb * (c1o1 - vx2) - c1o9 * oMdrho * vx2; - m2 = mfccb * c1o2 + mfbcb * (vvx + c1o2) + (mfacb + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfacb = m0; - mfbcb = m1; - mfccb = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfbac * (vvx - c1o2) + (mfaac + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcac - c2o1 * mfbac * vvx + mfaac * (c1o1 - vx2) - c1o36 * oMdrho * vx2; - m2 = mfcac * c1o2 + mfbac * (vvx + c1o2) + (mfaac + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfaac = m0; - mfbac = m1; - mfcac = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfbbc * (vvx - c1o2) + (mfabc + c1o9 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfcbc - c2o1 * mfbbc * vvx + mfabc * (c1o1 - vx2) - c1o9 * oMdrho * vx2; - m2 = mfcbc * c1o2 + mfbbc * (vvx + c1o2) + (mfabc + c1o9 * oMdrho) * ( vx2 + vvx) * c1o2; - mfabc = m0; - mfbbc = m1; - mfcbc = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfbcc * (vvx - c1o2) + (mfacc + c1o36 * oMdrho) * ( vx2 - vvx) * c1o2; - m1 = -mfccc - c2o1 * mfbcc * vvx + mfacc * (c1o1 - vx2) - c1o36 * oMdrho * vx2; - m2 = mfccc * c1o2 + mfbcc * (vvx + c1o2) + (mfacc + c1o36 * oMdrho) * ( vx2 + vvx) * c1o2; - mfacc = m0; - mfbcc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////////// - //index 0 - kzero= posC[k]; - kw = neighborCX[kzero]; - ks = neighborCY[kzero]; - kb = neighborCZ[kzero]; - ksw = neighborCY[kw]; - kbw = neighborCZ[kw]; - kbs = neighborCZ[ks]; - kbsw = neighborCZ[ksw]; - //////////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////////// - feC[kzero] = mfcbb; - fwC[kw] = mfabb; - fnC[kzero] = mfbcb; - fsC[ks] = mfbab; - ftC[kzero] = mfbbc; - fbC[kb] = mfbba; - fneC[kzero] = mfccb; - fswC[ksw] = mfaab; - fseC[ks] = mfcab; - fnwC[kw] = mfacb; - fteC[kzero] = mfcbc; - fbwC[kbw] = mfaba; - fbeC[kb] = mfcba; - ftwC[kw] = mfabc; - ftnC[kzero] = mfbcc; - fbsC[kbs] = mfbaa; - fbnC[kb] = mfbca; - ftsC[ks] = mfbac; - fzeroC[kzero] = mfbbb; - ftneC[kzero] = mfccc; - ftseC[ks] = mfcac; - fbneC[kb] = mfcca; - fbseC[kbs] = mfcaa; - ftnwC[kw] = mfacc; - ftswC[ksw] = mfaac; - fbnwC[kbw] = mfaca; - fbswC[kbsw] = mfaaa; - //////////////////////////////////////////////////////////////////////////////////// - } + scaleFC_RhoSq_comp_27_Calculation(DC, DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, + size_MatC, size_MatF, isEvenTimestep, posC, posFSWB, kFC, omCoarse, omFine, nu, nxC, + nyC, nxF, nyF, offFC, k); } -////////////////////////////////////////////////////////////////////////// @@ -10940,7 +11149,7 @@ extern "C" __global__ void scaleFC_RhoSq_comp_27(real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFC_staggered_time_comp_27( real* DC, +__global__ void scaleFC_staggered_time_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -10950,7 +11159,7 @@ extern "C" __global__ void scaleFC_staggered_time_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -10966,96 +11175,96 @@ extern "C" __global__ void scaleFC_staggered_time_comp_27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -11548,65 +11757,65 @@ extern "C" __global__ void scaleFC_staggered_time_comp_27( real* DC, // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////pointertausch - // if (evenOrOdd==false) + // if (isEvenTimestep==false) // { - // feC = &DC[dirE *size_MatC]; - // fwC = &DC[dirW *size_MatC]; - // fnC = &DC[dirN *size_MatC]; - // fsC = &DC[dirS *size_MatC]; - // ftC = &DC[dirT *size_MatC]; - // fbC = &DC[dirB *size_MatC]; - // fneC = &DC[dirNE *size_MatC]; - // fswC = &DC[dirSW *size_MatC]; - // fseC = &DC[dirSE *size_MatC]; - // fnwC = &DC[dirNW *size_MatC]; - // fteC = &DC[dirTE *size_MatC]; - // fbwC = &DC[dirBW *size_MatC]; - // fbeC = &DC[dirBE *size_MatC]; - // ftwC = &DC[dirTW *size_MatC]; - // ftnC = &DC[dirTN *size_MatC]; - // fbsC = &DC[dirBS *size_MatC]; - // fbnC = &DC[dirBN *size_MatC]; - // ftsC = &DC[dirTS *size_MatC]; - // fzeroC = &DC[dirZERO*size_MatC]; - // ftneC = &DC[dirTNE *size_MatC]; - // ftswC = &DC[dirTSW *size_MatC]; - // ftseC = &DC[dirTSE *size_MatC]; - // ftnwC = &DC[dirTNW *size_MatC]; - // fbneC = &DC[dirBNE *size_MatC]; - // fbswC = &DC[dirBSW *size_MatC]; - // fbseC = &DC[dirBSE *size_MatC]; - // fbnwC = &DC[dirBNW *size_MatC]; + // feC = &DC[DIR_P00 *size_MatC]; + // fwC = &DC[DIR_M00 *size_MatC]; + // fnC = &DC[DIR_0P0 *size_MatC]; + // fsC = &DC[DIR_0M0 *size_MatC]; + // ftC = &DC[DIR_00P *size_MatC]; + // fbC = &DC[DIR_00M *size_MatC]; + // fneC = &DC[DIR_PP0 *size_MatC]; + // fswC = &DC[DIR_MM0 *size_MatC]; + // fseC = &DC[DIR_PM0 *size_MatC]; + // fnwC = &DC[DIR_MP0 *size_MatC]; + // fteC = &DC[DIR_P0P *size_MatC]; + // fbwC = &DC[DIR_M0M *size_MatC]; + // fbeC = &DC[DIR_P0M *size_MatC]; + // ftwC = &DC[DIR_M0P *size_MatC]; + // ftnC = &DC[DIR_0PP *size_MatC]; + // fbsC = &DC[DIR_0MM *size_MatC]; + // fbnC = &DC[DIR_0PM *size_MatC]; + // ftsC = &DC[DIR_0MP *size_MatC]; + // fzeroC = &DC[DIR_000*size_MatC]; + // ftneC = &DC[DIR_PPP *size_MatC]; + // ftswC = &DC[DIR_MMP *size_MatC]; + // ftseC = &DC[DIR_PMP *size_MatC]; + // ftnwC = &DC[DIR_MPP *size_MatC]; + // fbneC = &DC[DIR_PPM *size_MatC]; + // fbswC = &DC[DIR_MMM *size_MatC]; + // fbseC = &DC[DIR_PMM *size_MatC]; + // fbnwC = &DC[DIR_MPM *size_MatC]; // } // else // { - // fwC = &DC[dirE *size_MatC]; - // feC = &DC[dirW *size_MatC]; - // fsC = &DC[dirN *size_MatC]; - // fnC = &DC[dirS *size_MatC]; - // fbC = &DC[dirT *size_MatC]; - // ftC = &DC[dirB *size_MatC]; - // fswC = &DC[dirNE *size_MatC]; - // fneC = &DC[dirSW *size_MatC]; - // fnwC = &DC[dirSE *size_MatC]; - // fseC = &DC[dirNW *size_MatC]; - // fbwC = &DC[dirTE *size_MatC]; - // fteC = &DC[dirBW *size_MatC]; - // ftwC = &DC[dirBE *size_MatC]; - // fbeC = &DC[dirTW *size_MatC]; - // fbsC = &DC[dirTN *size_MatC]; - // ftnC = &DC[dirBS *size_MatC]; - // ftsC = &DC[dirBN *size_MatC]; - // fbnC = &DC[dirTS *size_MatC]; - // fzeroC = &DC[dirZERO*size_MatC]; - // fbswC = &DC[dirTNE *size_MatC]; - // fbneC = &DC[dirTSW *size_MatC]; - // fbnwC = &DC[dirTSE *size_MatC]; - // fbseC = &DC[dirTNW *size_MatC]; - // ftswC = &DC[dirBNE *size_MatC]; - // ftneC = &DC[dirBSW *size_MatC]; - // ftnwC = &DC[dirBSE *size_MatC]; - // ftseC = &DC[dirBNW *size_MatC]; + // fwC = &DC[DIR_P00 *size_MatC]; + // feC = &DC[DIR_M00 *size_MatC]; + // fsC = &DC[DIR_0P0 *size_MatC]; + // fnC = &DC[DIR_0M0 *size_MatC]; + // fbC = &DC[DIR_00P *size_MatC]; + // ftC = &DC[DIR_00M *size_MatC]; + // fswC = &DC[DIR_PP0 *size_MatC]; + // fneC = &DC[DIR_MM0 *size_MatC]; + // fnwC = &DC[DIR_PM0 *size_MatC]; + // fseC = &DC[DIR_MP0 *size_MatC]; + // fbwC = &DC[DIR_P0P *size_MatC]; + // fteC = &DC[DIR_M0M *size_MatC]; + // ftwC = &DC[DIR_P0M *size_MatC]; + // fbeC = &DC[DIR_M0P *size_MatC]; + // fbsC = &DC[DIR_0PP *size_MatC]; + // ftnC = &DC[DIR_0MM *size_MatC]; + // ftsC = &DC[DIR_0PM *size_MatC]; + // fbnC = &DC[DIR_0MP *size_MatC]; + // fzeroC = &DC[DIR_000*size_MatC]; + // fbswC = &DC[DIR_PPP *size_MatC]; + // fbneC = &DC[DIR_MMP *size_MatC]; + // fbnwC = &DC[DIR_PMP *size_MatC]; + // fbseC = &DC[DIR_MPP *size_MatC]; + // ftswC = &DC[DIR_PPM *size_MatC]; + // ftneC = &DC[DIR_MMM *size_MatC]; + // ftnwC = &DC[DIR_PMM *size_MatC]; + // ftseC = &DC[DIR_MPM *size_MatC]; // } // real rho_tmp; @@ -13061,7 +13270,7 @@ extern "C" __global__ void scaleFC_staggered_time_comp_27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFC_Fix_comp_27( real* DC, +__global__ void scaleFC_Fix_comp_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -13071,7 +13280,7 @@ extern "C" __global__ void scaleFC_Fix_comp_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -13087,96 +13296,96 @@ extern "C" __global__ void scaleFC_Fix_comp_27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -14921,7 +15130,7 @@ extern "C" __global__ void scaleFC_Fix_comp_27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFC_NSPress_27( real* DC, +__global__ void scaleFC_NSPress_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -14931,7 +15140,7 @@ extern "C" __global__ void scaleFC_NSPress_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -14947,96 +15156,96 @@ extern "C" __global__ void scaleFC_NSPress_27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -16127,7 +16336,7 @@ extern "C" __global__ void scaleFC_NSPress_27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFC_Fix_27( real* DC, +__global__ void scaleFC_Fix_27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -16137,7 +16346,7 @@ extern "C" __global__ void scaleFC_Fix_27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -16153,96 +16362,96 @@ extern "C" __global__ void scaleFC_Fix_27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -17487,7 +17696,7 @@ extern "C" __global__ void scaleFC_Fix_27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFCpress27(real* DC, +__global__ void scaleFCpress27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -17497,7 +17706,7 @@ extern "C" __global__ void scaleFCpress27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -17513,96 +17722,96 @@ extern "C" __global__ void scaleFCpress27(real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -18412,7 +18621,7 @@ extern "C" __global__ void scaleFCpress27(real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFCLast27( real* DC, +__global__ void scaleFCLast27( real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -18422,7 +18631,7 @@ extern "C" __global__ void scaleFCLast27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -18438,96 +18647,96 @@ extern "C" __global__ void scaleFCLast27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -19808,7 +20017,7 @@ extern "C" __global__ void scaleFCLast27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFCThSMG7( real* DC, +__global__ void scaleFCThSMG7( real* DC, real* DF, real* DD7C, real* DD7F, @@ -19820,7 +20029,7 @@ extern "C" __global__ void scaleFCThSMG7( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -19831,96 +20040,96 @@ extern "C" __global__ void scaleFCThSMG7( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, //*fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - //fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + //fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, //*fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } Distributions7 D7F; @@ -19933,7 +20142,7 @@ extern "C" __global__ void scaleFCThSMG7( real* DC, D7F.f[6] = &DD7F[6*size_MatF]; Distributions7 D7C; - if (evenOrOdd==true) + if (isEvenTimestep==true) { D7C.f[0] = &DD7C[0*size_MatC]; D7C.f[1] = &DD7C[1*size_MatC]; @@ -20681,7 +20890,7 @@ extern "C" __global__ void scaleFCThSMG7( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFCThS7( real* DC, +__global__ void scaleFCThS7( real* DC, real* DF, real* DD7C, real* DD7F, @@ -20693,7 +20902,7 @@ extern "C" __global__ void scaleFCThS7( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -20703,96 +20912,96 @@ extern "C" __global__ void scaleFCThS7( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, //*fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - //fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + //fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, //*fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } Distributions7 D7F; @@ -20805,7 +21014,7 @@ extern "C" __global__ void scaleFCThS7( real* DC, D7F.f[6] = &DD7F[6*size_MatF]; Distributions7 D7C; - if (evenOrOdd==true) + if (isEvenTimestep==true) { D7C.f[0] = &DD7C[0*size_MatC]; D7C.f[1] = &DD7C[1*size_MatC]; @@ -21472,7 +21681,7 @@ extern "C" __global__ void scaleFCThS7( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFCThS27( real* DC, +__global__ void scaleFCThS27( real* DC, real* DF, real* DD27C, real* DD27F, @@ -21484,7 +21693,7 @@ extern "C" __global__ void scaleFCThS27( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -21495,187 +21704,187 @@ extern "C" __global__ void scaleFCThS27( real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, //*fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - //fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + //fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, //*fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - //fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + //fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } Distributions27 D27F; - D27F.f[dirE ] = &DD27F[dirE *size_MatF]; - D27F.f[dirW ] = &DD27F[dirW *size_MatF]; - D27F.f[dirN ] = &DD27F[dirN *size_MatF]; - D27F.f[dirS ] = &DD27F[dirS *size_MatF]; - D27F.f[dirT ] = &DD27F[dirT *size_MatF]; - D27F.f[dirB ] = &DD27F[dirB *size_MatF]; - D27F.f[dirNE ] = &DD27F[dirNE *size_MatF]; - D27F.f[dirSW ] = &DD27F[dirSW *size_MatF]; - D27F.f[dirSE ] = &DD27F[dirSE *size_MatF]; - D27F.f[dirNW ] = &DD27F[dirNW *size_MatF]; - D27F.f[dirTE ] = &DD27F[dirTE *size_MatF]; - D27F.f[dirBW ] = &DD27F[dirBW *size_MatF]; - D27F.f[dirBE ] = &DD27F[dirBE *size_MatF]; - D27F.f[dirTW ] = &DD27F[dirTW *size_MatF]; - D27F.f[dirTN ] = &DD27F[dirTN *size_MatF]; - D27F.f[dirBS ] = &DD27F[dirBS *size_MatF]; - D27F.f[dirBN ] = &DD27F[dirBN *size_MatF]; - D27F.f[dirTS ] = &DD27F[dirTS *size_MatF]; - D27F.f[dirZERO] = &DD27F[dirZERO*size_MatF]; - D27F.f[dirTNE ] = &DD27F[dirTNE *size_MatF]; - D27F.f[dirTSW ] = &DD27F[dirTSW *size_MatF]; - D27F.f[dirTSE ] = &DD27F[dirTSE *size_MatF]; - D27F.f[dirTNW ] = &DD27F[dirTNW *size_MatF]; - D27F.f[dirBNE ] = &DD27F[dirBNE *size_MatF]; - D27F.f[dirBSW ] = &DD27F[dirBSW *size_MatF]; - D27F.f[dirBSE ] = &DD27F[dirBSE *size_MatF]; - D27F.f[dirBNW ] = &DD27F[dirBNW *size_MatF]; + D27F.f[DIR_P00 ] = &DD27F[DIR_P00 *size_MatF]; + D27F.f[DIR_M00 ] = &DD27F[DIR_M00 *size_MatF]; + D27F.f[DIR_0P0 ] = &DD27F[DIR_0P0 *size_MatF]; + D27F.f[DIR_0M0 ] = &DD27F[DIR_0M0 *size_MatF]; + D27F.f[DIR_00P ] = &DD27F[DIR_00P *size_MatF]; + D27F.f[DIR_00M ] = &DD27F[DIR_00M *size_MatF]; + D27F.f[DIR_PP0 ] = &DD27F[DIR_PP0 *size_MatF]; + D27F.f[DIR_MM0 ] = &DD27F[DIR_MM0 *size_MatF]; + D27F.f[DIR_PM0 ] = &DD27F[DIR_PM0 *size_MatF]; + D27F.f[DIR_MP0 ] = &DD27F[DIR_MP0 *size_MatF]; + D27F.f[DIR_P0P ] = &DD27F[DIR_P0P *size_MatF]; + D27F.f[DIR_M0M ] = &DD27F[DIR_M0M *size_MatF]; + D27F.f[DIR_P0M ] = &DD27F[DIR_P0M *size_MatF]; + D27F.f[DIR_M0P ] = &DD27F[DIR_M0P *size_MatF]; + D27F.f[DIR_0PP ] = &DD27F[DIR_0PP *size_MatF]; + D27F.f[DIR_0MM ] = &DD27F[DIR_0MM *size_MatF]; + D27F.f[DIR_0PM ] = &DD27F[DIR_0PM *size_MatF]; + D27F.f[DIR_0MP ] = &DD27F[DIR_0MP *size_MatF]; + D27F.f[DIR_000] = &DD27F[DIR_000*size_MatF]; + D27F.f[DIR_PPP ] = &DD27F[DIR_PPP *size_MatF]; + D27F.f[DIR_MMP ] = &DD27F[DIR_MMP *size_MatF]; + D27F.f[DIR_PMP ] = &DD27F[DIR_PMP *size_MatF]; + D27F.f[DIR_MPP ] = &DD27F[DIR_MPP *size_MatF]; + D27F.f[DIR_PPM ] = &DD27F[DIR_PPM *size_MatF]; + D27F.f[DIR_MMM ] = &DD27F[DIR_MMM *size_MatF]; + D27F.f[DIR_PMM ] = &DD27F[DIR_PMM *size_MatF]; + D27F.f[DIR_MPM ] = &DD27F[DIR_MPM *size_MatF]; Distributions27 D27C; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D27C.f[dirE ] = &DD27C[dirE *size_MatC]; - D27C.f[dirW ] = &DD27C[dirW *size_MatC]; - D27C.f[dirN ] = &DD27C[dirN *size_MatC]; - D27C.f[dirS ] = &DD27C[dirS *size_MatC]; - D27C.f[dirT ] = &DD27C[dirT *size_MatC]; - D27C.f[dirB ] = &DD27C[dirB *size_MatC]; - D27C.f[dirNE ] = &DD27C[dirNE *size_MatC]; - D27C.f[dirSW ] = &DD27C[dirSW *size_MatC]; - D27C.f[dirSE ] = &DD27C[dirSE *size_MatC]; - D27C.f[dirNW ] = &DD27C[dirNW *size_MatC]; - D27C.f[dirTE ] = &DD27C[dirTE *size_MatC]; - D27C.f[dirBW ] = &DD27C[dirBW *size_MatC]; - D27C.f[dirBE ] = &DD27C[dirBE *size_MatC]; - D27C.f[dirTW ] = &DD27C[dirTW *size_MatC]; - D27C.f[dirTN ] = &DD27C[dirTN *size_MatC]; - D27C.f[dirBS ] = &DD27C[dirBS *size_MatC]; - D27C.f[dirBN ] = &DD27C[dirBN *size_MatC]; - D27C.f[dirTS ] = &DD27C[dirTS *size_MatC]; - D27C.f[dirZERO] = &DD27C[dirZERO*size_MatC]; - D27C.f[dirTNE ] = &DD27C[dirTNE *size_MatC]; - D27C.f[dirTSW ] = &DD27C[dirTSW *size_MatC]; - D27C.f[dirTSE ] = &DD27C[dirTSE *size_MatC]; - D27C.f[dirTNW ] = &DD27C[dirTNW *size_MatC]; - D27C.f[dirBNE ] = &DD27C[dirBNE *size_MatC]; - D27C.f[dirBSW ] = &DD27C[dirBSW *size_MatC]; - D27C.f[dirBSE ] = &DD27C[dirBSE *size_MatC]; - D27C.f[dirBNW ] = &DD27C[dirBNW *size_MatC]; + D27C.f[DIR_P00 ] = &DD27C[DIR_P00 *size_MatC]; + D27C.f[DIR_M00 ] = &DD27C[DIR_M00 *size_MatC]; + D27C.f[DIR_0P0 ] = &DD27C[DIR_0P0 *size_MatC]; + D27C.f[DIR_0M0 ] = &DD27C[DIR_0M0 *size_MatC]; + D27C.f[DIR_00P ] = &DD27C[DIR_00P *size_MatC]; + D27C.f[DIR_00M ] = &DD27C[DIR_00M *size_MatC]; + D27C.f[DIR_PP0 ] = &DD27C[DIR_PP0 *size_MatC]; + D27C.f[DIR_MM0 ] = &DD27C[DIR_MM0 *size_MatC]; + D27C.f[DIR_PM0 ] = &DD27C[DIR_PM0 *size_MatC]; + D27C.f[DIR_MP0 ] = &DD27C[DIR_MP0 *size_MatC]; + D27C.f[DIR_P0P ] = &DD27C[DIR_P0P *size_MatC]; + D27C.f[DIR_M0M ] = &DD27C[DIR_M0M *size_MatC]; + D27C.f[DIR_P0M ] = &DD27C[DIR_P0M *size_MatC]; + D27C.f[DIR_M0P ] = &DD27C[DIR_M0P *size_MatC]; + D27C.f[DIR_0PP ] = &DD27C[DIR_0PP *size_MatC]; + D27C.f[DIR_0MM ] = &DD27C[DIR_0MM *size_MatC]; + D27C.f[DIR_0PM ] = &DD27C[DIR_0PM *size_MatC]; + D27C.f[DIR_0MP ] = &DD27C[DIR_0MP *size_MatC]; + D27C.f[DIR_000] = &DD27C[DIR_000*size_MatC]; + D27C.f[DIR_PPP ] = &DD27C[DIR_PPP *size_MatC]; + D27C.f[DIR_MMP ] = &DD27C[DIR_MMP *size_MatC]; + D27C.f[DIR_PMP ] = &DD27C[DIR_PMP *size_MatC]; + D27C.f[DIR_MPP ] = &DD27C[DIR_MPP *size_MatC]; + D27C.f[DIR_PPM ] = &DD27C[DIR_PPM *size_MatC]; + D27C.f[DIR_MMM ] = &DD27C[DIR_MMM *size_MatC]; + D27C.f[DIR_PMM ] = &DD27C[DIR_PMM *size_MatC]; + D27C.f[DIR_MPM ] = &DD27C[DIR_MPM *size_MatC]; } else { - D27C.f[dirW ] = &DD27C[dirE *size_MatC]; - D27C.f[dirE ] = &DD27C[dirW *size_MatC]; - D27C.f[dirS ] = &DD27C[dirN *size_MatC]; - D27C.f[dirN ] = &DD27C[dirS *size_MatC]; - D27C.f[dirB ] = &DD27C[dirT *size_MatC]; - D27C.f[dirT ] = &DD27C[dirB *size_MatC]; - D27C.f[dirSW ] = &DD27C[dirNE *size_MatC]; - D27C.f[dirNE ] = &DD27C[dirSW *size_MatC]; - D27C.f[dirNW ] = &DD27C[dirSE *size_MatC]; - D27C.f[dirSE ] = &DD27C[dirNW *size_MatC]; - D27C.f[dirBW ] = &DD27C[dirTE *size_MatC]; - D27C.f[dirTE ] = &DD27C[dirBW *size_MatC]; - D27C.f[dirTW ] = &DD27C[dirBE *size_MatC]; - D27C.f[dirBE ] = &DD27C[dirTW *size_MatC]; - D27C.f[dirBS ] = &DD27C[dirTN *size_MatC]; - D27C.f[dirTN ] = &DD27C[dirBS *size_MatC]; - D27C.f[dirTS ] = &DD27C[dirBN *size_MatC]; - D27C.f[dirBN ] = &DD27C[dirTS *size_MatC]; - D27C.f[dirZERO] = &DD27C[dirZERO*size_MatC]; - D27C.f[dirBSW ] = &DD27C[dirTNE *size_MatC]; - D27C.f[dirBNE ] = &DD27C[dirTSW *size_MatC]; - D27C.f[dirBNW ] = &DD27C[dirTSE *size_MatC]; - D27C.f[dirBSE ] = &DD27C[dirTNW *size_MatC]; - D27C.f[dirTSW ] = &DD27C[dirBNE *size_MatC]; - D27C.f[dirTNE ] = &DD27C[dirBSW *size_MatC]; - D27C.f[dirTNW ] = &DD27C[dirBSE *size_MatC]; - D27C.f[dirTSE ] = &DD27C[dirBNW *size_MatC]; + D27C.f[DIR_M00 ] = &DD27C[DIR_P00 *size_MatC]; + D27C.f[DIR_P00 ] = &DD27C[DIR_M00 *size_MatC]; + D27C.f[DIR_0M0 ] = &DD27C[DIR_0P0 *size_MatC]; + D27C.f[DIR_0P0 ] = &DD27C[DIR_0M0 *size_MatC]; + D27C.f[DIR_00M ] = &DD27C[DIR_00P *size_MatC]; + D27C.f[DIR_00P ] = &DD27C[DIR_00M *size_MatC]; + D27C.f[DIR_MM0 ] = &DD27C[DIR_PP0 *size_MatC]; + D27C.f[DIR_PP0 ] = &DD27C[DIR_MM0 *size_MatC]; + D27C.f[DIR_MP0 ] = &DD27C[DIR_PM0 *size_MatC]; + D27C.f[DIR_PM0 ] = &DD27C[DIR_MP0 *size_MatC]; + D27C.f[DIR_M0M ] = &DD27C[DIR_P0P *size_MatC]; + D27C.f[DIR_P0P ] = &DD27C[DIR_M0M *size_MatC]; + D27C.f[DIR_M0P ] = &DD27C[DIR_P0M *size_MatC]; + D27C.f[DIR_P0M ] = &DD27C[DIR_M0P *size_MatC]; + D27C.f[DIR_0MM ] = &DD27C[DIR_0PP *size_MatC]; + D27C.f[DIR_0PP ] = &DD27C[DIR_0MM *size_MatC]; + D27C.f[DIR_0MP ] = &DD27C[DIR_0PM *size_MatC]; + D27C.f[DIR_0PM ] = &DD27C[DIR_0MP *size_MatC]; + D27C.f[DIR_000] = &DD27C[DIR_000*size_MatC]; + D27C.f[DIR_MMM ] = &DD27C[DIR_PPP *size_MatC]; + D27C.f[DIR_PPM ] = &DD27C[DIR_MMP *size_MatC]; + D27C.f[DIR_MPM ] = &DD27C[DIR_PMP *size_MatC]; + D27C.f[DIR_PMM ] = &DD27C[DIR_MPP *size_MatC]; + D27C.f[DIR_MMP ] = &DD27C[DIR_PPM *size_MatC]; + D27C.f[DIR_PPP ] = &DD27C[DIR_MMM *size_MatC]; + D27C.f[DIR_MPP ] = &DD27C[DIR_PMM *size_MatC]; + D27C.f[DIR_PMP ] = &DD27C[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -21771,33 +21980,33 @@ extern "C" __global__ void scaleFCThS27( real* DC, f_BSE = fbseF[kbs]; f_BNW = fbnwF[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27F.f[dirE ])[kzero];//ke - f27W = (D27F.f[dirW ])[kw ]; - f27N = (D27F.f[dirN ])[kzero];//kn - f27S = (D27F.f[dirS ])[ks ]; - f27T = (D27F.f[dirT ])[kzero];//kt - f27B = (D27F.f[dirB ])[kb ]; - f27NE = (D27F.f[dirNE ])[kzero];//kne - f27SW = (D27F.f[dirSW ])[ksw ]; - f27SE = (D27F.f[dirSE ])[ks ];//kse - f27NW = (D27F.f[dirNW ])[kw ];//knw - f27TE = (D27F.f[dirTE ])[kzero];//kte - f27BW = (D27F.f[dirBW ])[kbw ]; - f27BE = (D27F.f[dirBE ])[kb ];//kbe - f27TW = (D27F.f[dirTW ])[kw ];//ktw - f27TN = (D27F.f[dirTN ])[kzero];//ktn - f27BS = (D27F.f[dirBS ])[kbs ]; - f27BN = (D27F.f[dirBN ])[kb ];//kbn - f27TS = (D27F.f[dirTS ])[ks ];//kts - f27ZERO = (D27F.f[dirZERO])[kzero];//kzero - f27TNE = (D27F.f[dirTNE ])[kzero];//ktne - f27TSW = (D27F.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27F.f[dirTSE ])[ks ];//ktse - f27TNW = (D27F.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27F.f[dirBNE ])[kb ];//kbne - f27BSW = (D27F.f[dirBSW ])[kbsw ]; - f27BSE = (D27F.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27F.f[dirBNW ])[kbw ];//kbnw + f27E = (D27F.f[DIR_P00 ])[kzero];//ke + f27W = (D27F.f[DIR_M00 ])[kw ]; + f27N = (D27F.f[DIR_0P0 ])[kzero];//kn + f27S = (D27F.f[DIR_0M0 ])[ks ]; + f27T = (D27F.f[DIR_00P ])[kzero];//kt + f27B = (D27F.f[DIR_00M ])[kb ]; + f27NE = (D27F.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27F.f[DIR_MM0 ])[ksw ]; + f27SE = (D27F.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27F.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27F.f[DIR_P0P ])[kzero];//kte + f27BW = (D27F.f[DIR_M0M ])[kbw ]; + f27BE = (D27F.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27F.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27F.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27F.f[DIR_0MM ])[kbs ]; + f27BN = (D27F.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27F.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27F.f[DIR_000])[kzero];//kzero + f27TNE = (D27F.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27F.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27F.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27F.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27F.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27F.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27F.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27F.f[DIR_MPM ])[kbw ];//kbnw Conc_F_SWB = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -21858,33 +22067,33 @@ extern "C" __global__ void scaleFCThS27( real* DC, f_BSE = fbseF[kbs]; f_BNW = fbnwF[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27F.f[dirE ])[kzero];//ke - f27W = (D27F.f[dirW ])[kw ]; - f27N = (D27F.f[dirN ])[kzero];//kn - f27S = (D27F.f[dirS ])[ks ]; - f27T = (D27F.f[dirT ])[kzero];//kt - f27B = (D27F.f[dirB ])[kb ]; - f27NE = (D27F.f[dirNE ])[kzero];//kne - f27SW = (D27F.f[dirSW ])[ksw ]; - f27SE = (D27F.f[dirSE ])[ks ];//kse - f27NW = (D27F.f[dirNW ])[kw ];//knw - f27TE = (D27F.f[dirTE ])[kzero];//kte - f27BW = (D27F.f[dirBW ])[kbw ]; - f27BE = (D27F.f[dirBE ])[kb ];//kbe - f27TW = (D27F.f[dirTW ])[kw ];//ktw - f27TN = (D27F.f[dirTN ])[kzero];//ktn - f27BS = (D27F.f[dirBS ])[kbs ]; - f27BN = (D27F.f[dirBN ])[kb ];//kbn - f27TS = (D27F.f[dirTS ])[ks ];//kts - f27ZERO = (D27F.f[dirZERO])[kzero];//kzero - f27TNE = (D27F.f[dirTNE ])[kzero];//ktne - f27TSW = (D27F.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27F.f[dirTSE ])[ks ];//ktse - f27TNW = (D27F.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27F.f[dirBNE ])[kb ];//kbne - f27BSW = (D27F.f[dirBSW ])[kbsw ]; - f27BSE = (D27F.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27F.f[dirBNW ])[kbw ];//kbnw + f27E = (D27F.f[DIR_P00 ])[kzero];//ke + f27W = (D27F.f[DIR_M00 ])[kw ]; + f27N = (D27F.f[DIR_0P0 ])[kzero];//kn + f27S = (D27F.f[DIR_0M0 ])[ks ]; + f27T = (D27F.f[DIR_00P ])[kzero];//kt + f27B = (D27F.f[DIR_00M ])[kb ]; + f27NE = (D27F.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27F.f[DIR_MM0 ])[ksw ]; + f27SE = (D27F.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27F.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27F.f[DIR_P0P ])[kzero];//kte + f27BW = (D27F.f[DIR_M0M ])[kbw ]; + f27BE = (D27F.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27F.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27F.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27F.f[DIR_0MM ])[kbs ]; + f27BN = (D27F.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27F.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27F.f[DIR_000])[kzero];//kzero + f27TNE = (D27F.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27F.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27F.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27F.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27F.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27F.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27F.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27F.f[DIR_MPM ])[kbw ];//kbnw Conc_F_SWT = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -21945,33 +22154,33 @@ extern "C" __global__ void scaleFCThS27( real* DC, f_BSE = fbseF[kbs]; f_BNW = fbnwF[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27F.f[dirE ])[kzero];//ke - f27W = (D27F.f[dirW ])[kw ]; - f27N = (D27F.f[dirN ])[kzero];//kn - f27S = (D27F.f[dirS ])[ks ]; - f27T = (D27F.f[dirT ])[kzero];//kt - f27B = (D27F.f[dirB ])[kb ]; - f27NE = (D27F.f[dirNE ])[kzero];//kne - f27SW = (D27F.f[dirSW ])[ksw ]; - f27SE = (D27F.f[dirSE ])[ks ];//kse - f27NW = (D27F.f[dirNW ])[kw ];//knw - f27TE = (D27F.f[dirTE ])[kzero];//kte - f27BW = (D27F.f[dirBW ])[kbw ]; - f27BE = (D27F.f[dirBE ])[kb ];//kbe - f27TW = (D27F.f[dirTW ])[kw ];//ktw - f27TN = (D27F.f[dirTN ])[kzero];//ktn - f27BS = (D27F.f[dirBS ])[kbs ]; - f27BN = (D27F.f[dirBN ])[kb ];//kbn - f27TS = (D27F.f[dirTS ])[ks ];//kts - f27ZERO = (D27F.f[dirZERO])[kzero];//kzero - f27TNE = (D27F.f[dirTNE ])[kzero];//ktne - f27TSW = (D27F.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27F.f[dirTSE ])[ks ];//ktse - f27TNW = (D27F.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27F.f[dirBNE ])[kb ];//kbne - f27BSW = (D27F.f[dirBSW ])[kbsw ]; - f27BSE = (D27F.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27F.f[dirBNW ])[kbw ];//kbnw + f27E = (D27F.f[DIR_P00 ])[kzero];//ke + f27W = (D27F.f[DIR_M00 ])[kw ]; + f27N = (D27F.f[DIR_0P0 ])[kzero];//kn + f27S = (D27F.f[DIR_0M0 ])[ks ]; + f27T = (D27F.f[DIR_00P ])[kzero];//kt + f27B = (D27F.f[DIR_00M ])[kb ]; + f27NE = (D27F.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27F.f[DIR_MM0 ])[ksw ]; + f27SE = (D27F.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27F.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27F.f[DIR_P0P ])[kzero];//kte + f27BW = (D27F.f[DIR_M0M ])[kbw ]; + f27BE = (D27F.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27F.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27F.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27F.f[DIR_0MM ])[kbs ]; + f27BN = (D27F.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27F.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27F.f[DIR_000])[kzero];//kzero + f27TNE = (D27F.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27F.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27F.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27F.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27F.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27F.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27F.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27F.f[DIR_MPM ])[kbw ];//kbnw Conc_F_SET = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -22032,33 +22241,33 @@ extern "C" __global__ void scaleFCThS27( real* DC, f_BSE = fbseF[kbs]; f_BNW = fbnwF[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27F.f[dirE ])[kzero];//ke - f27W = (D27F.f[dirW ])[kw ]; - f27N = (D27F.f[dirN ])[kzero];//kn - f27S = (D27F.f[dirS ])[ks ]; - f27T = (D27F.f[dirT ])[kzero];//kt - f27B = (D27F.f[dirB ])[kb ]; - f27NE = (D27F.f[dirNE ])[kzero];//kne - f27SW = (D27F.f[dirSW ])[ksw ]; - f27SE = (D27F.f[dirSE ])[ks ];//kse - f27NW = (D27F.f[dirNW ])[kw ];//knw - f27TE = (D27F.f[dirTE ])[kzero];//kte - f27BW = (D27F.f[dirBW ])[kbw ]; - f27BE = (D27F.f[dirBE ])[kb ];//kbe - f27TW = (D27F.f[dirTW ])[kw ];//ktw - f27TN = (D27F.f[dirTN ])[kzero];//ktn - f27BS = (D27F.f[dirBS ])[kbs ]; - f27BN = (D27F.f[dirBN ])[kb ];//kbn - f27TS = (D27F.f[dirTS ])[ks ];//kts - f27ZERO = (D27F.f[dirZERO])[kzero];//kzero - f27TNE = (D27F.f[dirTNE ])[kzero];//ktne - f27TSW = (D27F.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27F.f[dirTSE ])[ks ];//ktse - f27TNW = (D27F.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27F.f[dirBNE ])[kb ];//kbne - f27BSW = (D27F.f[dirBSW ])[kbsw ]; - f27BSE = (D27F.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27F.f[dirBNW ])[kbw ];//kbnw + f27E = (D27F.f[DIR_P00 ])[kzero];//ke + f27W = (D27F.f[DIR_M00 ])[kw ]; + f27N = (D27F.f[DIR_0P0 ])[kzero];//kn + f27S = (D27F.f[DIR_0M0 ])[ks ]; + f27T = (D27F.f[DIR_00P ])[kzero];//kt + f27B = (D27F.f[DIR_00M ])[kb ]; + f27NE = (D27F.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27F.f[DIR_MM0 ])[ksw ]; + f27SE = (D27F.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27F.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27F.f[DIR_P0P ])[kzero];//kte + f27BW = (D27F.f[DIR_M0M ])[kbw ]; + f27BE = (D27F.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27F.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27F.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27F.f[DIR_0MM ])[kbs ]; + f27BN = (D27F.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27F.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27F.f[DIR_000])[kzero];//kzero + f27TNE = (D27F.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27F.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27F.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27F.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27F.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27F.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27F.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27F.f[DIR_MPM ])[kbw ];//kbnw Conc_F_SEB = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -22129,33 +22338,33 @@ extern "C" __global__ void scaleFCThS27( real* DC, f_BSE = fbseF[kbs]; f_BNW = fbnwF[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27F.f[dirE ])[kzero];//ke - f27W = (D27F.f[dirW ])[kw ]; - f27N = (D27F.f[dirN ])[kzero];//kn - f27S = (D27F.f[dirS ])[ks ]; - f27T = (D27F.f[dirT ])[kzero];//kt - f27B = (D27F.f[dirB ])[kb ]; - f27NE = (D27F.f[dirNE ])[kzero];//kne - f27SW = (D27F.f[dirSW ])[ksw ]; - f27SE = (D27F.f[dirSE ])[ks ];//kse - f27NW = (D27F.f[dirNW ])[kw ];//knw - f27TE = (D27F.f[dirTE ])[kzero];//kte - f27BW = (D27F.f[dirBW ])[kbw ]; - f27BE = (D27F.f[dirBE ])[kb ];//kbe - f27TW = (D27F.f[dirTW ])[kw ];//ktw - f27TN = (D27F.f[dirTN ])[kzero];//ktn - f27BS = (D27F.f[dirBS ])[kbs ]; - f27BN = (D27F.f[dirBN ])[kb ];//kbn - f27TS = (D27F.f[dirTS ])[ks ];//kts - f27ZERO = (D27F.f[dirZERO])[kzero];//kzero - f27TNE = (D27F.f[dirTNE ])[kzero];//ktne - f27TSW = (D27F.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27F.f[dirTSE ])[ks ];//ktse - f27TNW = (D27F.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27F.f[dirBNE ])[kb ];//kbne - f27BSW = (D27F.f[dirBSW ])[kbsw ]; - f27BSE = (D27F.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27F.f[dirBNW ])[kbw ];//kbnw + f27E = (D27F.f[DIR_P00 ])[kzero];//ke + f27W = (D27F.f[DIR_M00 ])[kw ]; + f27N = (D27F.f[DIR_0P0 ])[kzero];//kn + f27S = (D27F.f[DIR_0M0 ])[ks ]; + f27T = (D27F.f[DIR_00P ])[kzero];//kt + f27B = (D27F.f[DIR_00M ])[kb ]; + f27NE = (D27F.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27F.f[DIR_MM0 ])[ksw ]; + f27SE = (D27F.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27F.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27F.f[DIR_P0P ])[kzero];//kte + f27BW = (D27F.f[DIR_M0M ])[kbw ]; + f27BE = (D27F.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27F.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27F.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27F.f[DIR_0MM ])[kbs ]; + f27BN = (D27F.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27F.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27F.f[DIR_000])[kzero];//kzero + f27TNE = (D27F.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27F.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27F.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27F.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27F.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27F.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27F.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27F.f[DIR_MPM ])[kbw ];//kbnw Conc_F_NWB = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -22216,33 +22425,33 @@ extern "C" __global__ void scaleFCThS27( real* DC, f_BSE = fbseF[kbs]; f_BNW = fbnwF[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27F.f[dirE ])[kzero];//ke - f27W = (D27F.f[dirW ])[kw ]; - f27N = (D27F.f[dirN ])[kzero];//kn - f27S = (D27F.f[dirS ])[ks ]; - f27T = (D27F.f[dirT ])[kzero];//kt - f27B = (D27F.f[dirB ])[kb ]; - f27NE = (D27F.f[dirNE ])[kzero];//kne - f27SW = (D27F.f[dirSW ])[ksw ]; - f27SE = (D27F.f[dirSE ])[ks ];//kse - f27NW = (D27F.f[dirNW ])[kw ];//knw - f27TE = (D27F.f[dirTE ])[kzero];//kte - f27BW = (D27F.f[dirBW ])[kbw ]; - f27BE = (D27F.f[dirBE ])[kb ];//kbe - f27TW = (D27F.f[dirTW ])[kw ];//ktw - f27TN = (D27F.f[dirTN ])[kzero];//ktn - f27BS = (D27F.f[dirBS ])[kbs ]; - f27BN = (D27F.f[dirBN ])[kb ];//kbn - f27TS = (D27F.f[dirTS ])[ks ];//kts - f27ZERO = (D27F.f[dirZERO])[kzero];//kzero - f27TNE = (D27F.f[dirTNE ])[kzero];//ktne - f27TSW = (D27F.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27F.f[dirTSE ])[ks ];//ktse - f27TNW = (D27F.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27F.f[dirBNE ])[kb ];//kbne - f27BSW = (D27F.f[dirBSW ])[kbsw ]; - f27BSE = (D27F.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27F.f[dirBNW ])[kbw ];//kbnw + f27E = (D27F.f[DIR_P00 ])[kzero];//ke + f27W = (D27F.f[DIR_M00 ])[kw ]; + f27N = (D27F.f[DIR_0P0 ])[kzero];//kn + f27S = (D27F.f[DIR_0M0 ])[ks ]; + f27T = (D27F.f[DIR_00P ])[kzero];//kt + f27B = (D27F.f[DIR_00M ])[kb ]; + f27NE = (D27F.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27F.f[DIR_MM0 ])[ksw ]; + f27SE = (D27F.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27F.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27F.f[DIR_P0P ])[kzero];//kte + f27BW = (D27F.f[DIR_M0M ])[kbw ]; + f27BE = (D27F.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27F.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27F.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27F.f[DIR_0MM ])[kbs ]; + f27BN = (D27F.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27F.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27F.f[DIR_000])[kzero];//kzero + f27TNE = (D27F.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27F.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27F.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27F.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27F.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27F.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27F.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27F.f[DIR_MPM ])[kbw ];//kbnw Conc_F_NWT = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -22303,33 +22512,33 @@ extern "C" __global__ void scaleFCThS27( real* DC, f_BSE = fbseF[kbs]; f_BNW = fbnwF[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27F.f[dirE ])[kzero];//ke - f27W = (D27F.f[dirW ])[kw ]; - f27N = (D27F.f[dirN ])[kzero];//kn - f27S = (D27F.f[dirS ])[ks ]; - f27T = (D27F.f[dirT ])[kzero];//kt - f27B = (D27F.f[dirB ])[kb ]; - f27NE = (D27F.f[dirNE ])[kzero];//kne - f27SW = (D27F.f[dirSW ])[ksw ]; - f27SE = (D27F.f[dirSE ])[ks ];//kse - f27NW = (D27F.f[dirNW ])[kw ];//knw - f27TE = (D27F.f[dirTE ])[kzero];//kte - f27BW = (D27F.f[dirBW ])[kbw ]; - f27BE = (D27F.f[dirBE ])[kb ];//kbe - f27TW = (D27F.f[dirTW ])[kw ];//ktw - f27TN = (D27F.f[dirTN ])[kzero];//ktn - f27BS = (D27F.f[dirBS ])[kbs ]; - f27BN = (D27F.f[dirBN ])[kb ];//kbn - f27TS = (D27F.f[dirTS ])[ks ];//kts - f27ZERO = (D27F.f[dirZERO])[kzero];//kzero - f27TNE = (D27F.f[dirTNE ])[kzero];//ktne - f27TSW = (D27F.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27F.f[dirTSE ])[ks ];//ktse - f27TNW = (D27F.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27F.f[dirBNE ])[kb ];//kbne - f27BSW = (D27F.f[dirBSW ])[kbsw ]; - f27BSE = (D27F.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27F.f[dirBNW ])[kbw ];//kbnw + f27E = (D27F.f[DIR_P00 ])[kzero];//ke + f27W = (D27F.f[DIR_M00 ])[kw ]; + f27N = (D27F.f[DIR_0P0 ])[kzero];//kn + f27S = (D27F.f[DIR_0M0 ])[ks ]; + f27T = (D27F.f[DIR_00P ])[kzero];//kt + f27B = (D27F.f[DIR_00M ])[kb ]; + f27NE = (D27F.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27F.f[DIR_MM0 ])[ksw ]; + f27SE = (D27F.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27F.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27F.f[DIR_P0P ])[kzero];//kte + f27BW = (D27F.f[DIR_M0M ])[kbw ]; + f27BE = (D27F.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27F.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27F.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27F.f[DIR_0MM ])[kbs ]; + f27BN = (D27F.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27F.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27F.f[DIR_000])[kzero];//kzero + f27TNE = (D27F.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27F.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27F.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27F.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27F.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27F.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27F.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27F.f[DIR_MPM ])[kbw ];//kbnw Conc_F_NET = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -22390,33 +22599,33 @@ extern "C" __global__ void scaleFCThS27( real* DC, f_BSE = fbseF[kbs]; f_BNW = fbnwF[kbw]; ////////////////////////////////////////////////////////////////////////////////// - f27E = (D27F.f[dirE ])[kzero];//ke - f27W = (D27F.f[dirW ])[kw ]; - f27N = (D27F.f[dirN ])[kzero];//kn - f27S = (D27F.f[dirS ])[ks ]; - f27T = (D27F.f[dirT ])[kzero];//kt - f27B = (D27F.f[dirB ])[kb ]; - f27NE = (D27F.f[dirNE ])[kzero];//kne - f27SW = (D27F.f[dirSW ])[ksw ]; - f27SE = (D27F.f[dirSE ])[ks ];//kse - f27NW = (D27F.f[dirNW ])[kw ];//knw - f27TE = (D27F.f[dirTE ])[kzero];//kte - f27BW = (D27F.f[dirBW ])[kbw ]; - f27BE = (D27F.f[dirBE ])[kb ];//kbe - f27TW = (D27F.f[dirTW ])[kw ];//ktw - f27TN = (D27F.f[dirTN ])[kzero];//ktn - f27BS = (D27F.f[dirBS ])[kbs ]; - f27BN = (D27F.f[dirBN ])[kb ];//kbn - f27TS = (D27F.f[dirTS ])[ks ];//kts - f27ZERO = (D27F.f[dirZERO])[kzero];//kzero - f27TNE = (D27F.f[dirTNE ])[kzero];//ktne - f27TSW = (D27F.f[dirTSW ])[ksw ];//ktsw - f27TSE = (D27F.f[dirTSE ])[ks ];//ktse - f27TNW = (D27F.f[dirTNW ])[kw ];//ktnw - f27BNE = (D27F.f[dirBNE ])[kb ];//kbne - f27BSW = (D27F.f[dirBSW ])[kbsw ]; - f27BSE = (D27F.f[dirBSE ])[kbs ];//kbse - f27BNW = (D27F.f[dirBNW ])[kbw ];//kbnw + f27E = (D27F.f[DIR_P00 ])[kzero];//ke + f27W = (D27F.f[DIR_M00 ])[kw ]; + f27N = (D27F.f[DIR_0P0 ])[kzero];//kn + f27S = (D27F.f[DIR_0M0 ])[ks ]; + f27T = (D27F.f[DIR_00P ])[kzero];//kt + f27B = (D27F.f[DIR_00M ])[kb ]; + f27NE = (D27F.f[DIR_PP0 ])[kzero];//kne + f27SW = (D27F.f[DIR_MM0 ])[ksw ]; + f27SE = (D27F.f[DIR_PM0 ])[ks ];//kse + f27NW = (D27F.f[DIR_MP0 ])[kw ];//knw + f27TE = (D27F.f[DIR_P0P ])[kzero];//kte + f27BW = (D27F.f[DIR_M0M ])[kbw ]; + f27BE = (D27F.f[DIR_P0M ])[kb ];//kbe + f27TW = (D27F.f[DIR_M0P ])[kw ];//ktw + f27TN = (D27F.f[DIR_0PP ])[kzero];//ktn + f27BS = (D27F.f[DIR_0MM ])[kbs ]; + f27BN = (D27F.f[DIR_0PM ])[kb ];//kbn + f27TS = (D27F.f[DIR_0MP ])[ks ];//kts + f27ZERO = (D27F.f[DIR_000])[kzero];//kzero + f27TNE = (D27F.f[DIR_PPP ])[kzero];//ktne + f27TSW = (D27F.f[DIR_MMP ])[ksw ];//ktsw + f27TSE = (D27F.f[DIR_PMP ])[ks ];//ktse + f27TNW = (D27F.f[DIR_MPP ])[kw ];//ktnw + f27BNE = (D27F.f[DIR_PPM ])[kb ];//kbne + f27BSW = (D27F.f[DIR_MMM ])[kbsw ]; + f27BSE = (D27F.f[DIR_PMM ])[kbs ];//kbse + f27BNW = (D27F.f[DIR_MPM ])[kbw ];//kbnw Conc_F_NEB = f27E + f27W + f27N + f27S + f27T + f27B + f27NE + f27SW + f27SE + f27NW + f27TE + f27BW + f27BE + f27TW + f27TN + f27BS + f27BN + f27TS + f27ZERO + @@ -22529,33 +22738,33 @@ extern "C" __global__ void scaleFCThS27( real* DC, cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D27C.f[dirZERO])[kzero] = c8o27* Conc_C*(c1o1-cu_sq); - (D27C.f[dirE ])[kzero] = c2o27* (c3o1*( Mx )+Conc_C*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); - (D27C.f[dirW ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_C*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - (D27C.f[dirN ])[kzero] = c2o27* (c3o1*( My )+Conc_C*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); - (D27C.f[dirS ])[ks ] = c2o27* (c3o1*( -My )+Conc_C*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); - (D27C.f[dirT ])[kzero] = c2o27* (c3o1*( Mz)+Conc_C*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); - (D27C.f[dirB ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_C*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); - (D27C.f[dirNE ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_C*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - (D27C.f[dirSW ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_C*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - (D27C.f[dirSE ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_C*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - (D27C.f[dirNW ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_C*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - (D27C.f[dirTE ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_C*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - (D27C.f[dirBW ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_C*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - (D27C.f[dirBE ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_C*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - (D27C.f[dirTW ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_C*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - (D27C.f[dirTN ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_C*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - (D27C.f[dirBS ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_C*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - (D27C.f[dirBN ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_C*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - (D27C.f[dirTS ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_C*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - (D27C.f[dirTNE ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_C*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - (D27C.f[dirBSW ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_C*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - (D27C.f[dirBNE ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_C*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - (D27C.f[dirTSW ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_C*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - (D27C.f[dirTSE ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_C*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - (D27C.f[dirBNW ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_C*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - (D27C.f[dirBSE ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_C*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - (D27C.f[dirTNW ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_C*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + (D27C.f[DIR_000])[kzero] = c8o27* Conc_C*(c1o1-cu_sq); + (D27C.f[DIR_P00 ])[kzero] = c2o27* (c3o1*( Mx )+Conc_C*(c1o1+c9o2*( vx1 )*( vx1 )-cu_sq)); + (D27C.f[DIR_M00 ])[kw ] = c2o27* (c3o1*(-Mx )+Conc_C*(c1o1+c9o2*(-vx1 )*(-vx1 )-cu_sq)); + (D27C.f[DIR_0P0 ])[kzero] = c2o27* (c3o1*( My )+Conc_C*(c1o1+c9o2*( vx2 )*( vx2 )-cu_sq)); + (D27C.f[DIR_0M0 ])[ks ] = c2o27* (c3o1*( -My )+Conc_C*(c1o1+c9o2*( -vx2 )*( -vx2 )-cu_sq)); + (D27C.f[DIR_00P ])[kzero] = c2o27* (c3o1*( Mz)+Conc_C*(c1o1+c9o2*( vx3)*( vx3)-cu_sq)); + (D27C.f[DIR_00M ])[kb ] = c2o27* (c3o1*( -Mz)+Conc_C*(c1o1+c9o2*( -vx3)*( -vx3)-cu_sq)); + (D27C.f[DIR_PP0 ])[kzero] = c1o54* (c3o1*( Mx +My )+Conc_C*(c1o1+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + (D27C.f[DIR_MM0 ])[ksw ] = c1o54* (c3o1*(-Mx -My )+Conc_C*(c1o1+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + (D27C.f[DIR_PM0 ])[ks ] = c1o54* (c3o1*( Mx -My )+Conc_C*(c1o1+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + (D27C.f[DIR_MP0 ])[kw ] = c1o54* (c3o1*(-Mx +My )+Conc_C*(c1o1+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + (D27C.f[DIR_P0P ])[kzero] = c1o54* (c3o1*( Mx +Mz)+Conc_C*(c1o1+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + (D27C.f[DIR_M0M ])[kbw ] = c1o54* (c3o1*(-Mx -Mz)+Conc_C*(c1o1+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + (D27C.f[DIR_P0M ])[kb ] = c1o54* (c3o1*( Mx -Mz)+Conc_C*(c1o1+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + (D27C.f[DIR_M0P ])[kw ] = c1o54* (c3o1*(-Mx +Mz)+Conc_C*(c1o1+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + (D27C.f[DIR_0PP ])[kzero] = c1o54* (c3o1*( My +Mz)+Conc_C*(c1o1+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + (D27C.f[DIR_0MM ])[kbs ] = c1o54* (c3o1*( -My -Mz)+Conc_C*(c1o1+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + (D27C.f[DIR_0PM ])[kb ] = c1o54* (c3o1*( My -Mz)+Conc_C*(c1o1+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + (D27C.f[DIR_0MP ])[ks ] = c1o54* (c3o1*( -My +Mz)+Conc_C*(c1o1+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + (D27C.f[DIR_PPP ])[kzero] = c1o216*(c3o1*( Mx +My +Mz)+Conc_C*(c1o1+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + (D27C.f[DIR_MMM ])[kbsw ] = c1o216*(c3o1*(-Mx -My -Mz)+Conc_C*(c1o1+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + (D27C.f[DIR_PPM ])[kb ] = c1o216*(c3o1*( Mx +My -Mz)+Conc_C*(c1o1+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + (D27C.f[DIR_MMP ])[ksw ] = c1o216*(c3o1*(-Mx -My +Mz)+Conc_C*(c1o1+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + (D27C.f[DIR_PMP ])[ks ] = c1o216*(c3o1*( Mx -My +Mz)+Conc_C*(c1o1+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + (D27C.f[DIR_MPM ])[kbw ] = c1o216*(c3o1*(-Mx +My -Mz)+Conc_C*(c1o1+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + (D27C.f[DIR_PMM ])[kbs ] = c1o216*(c3o1*( Mx -My -Mz)+Conc_C*(c1o1+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + (D27C.f[DIR_MPP ])[kw ] = c1o216*(c3o1*(-Mx +My +Mz)+Conc_C*(c1o1+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); } } @@ -22595,7 +22804,7 @@ extern "C" __global__ void scaleFCThS27( real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFCEff27(real* DC, +__global__ void scaleFCEff27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -22605,7 +22814,7 @@ extern "C" __global__ void scaleFCEff27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -22621,96 +22830,96 @@ extern "C" __global__ void scaleFCEff27(real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -23574,7 +23783,7 @@ extern "C" __global__ void scaleFCEff27(real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFC27(real* DC, +__global__ void scaleFC27(real* DC, real* DF, unsigned int* neighborCX, unsigned int* neighborCY, @@ -23584,7 +23793,7 @@ extern "C" __global__ void scaleFC27(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -23599,96 +23808,96 @@ extern "C" __global__ void scaleFC27(real* DC, real *feF, *fwF, *fnF, *fsF, *ftF, *fbF, *fneF, *fswF, *fseF, *fnwF, *fteF, *fbwF, *fbeF, *ftwF, *ftnF, *fbsF, *fbnF, *ftsF, *fzeroF, *ftneF, *ftswF, *ftseF, *ftnwF, *fbneF, *fbswF, *fbseF, *fbnwF; - feF = &DF[dirE *size_MatF]; - fwF = &DF[dirW *size_MatF]; - fnF = &DF[dirN *size_MatF]; - fsF = &DF[dirS *size_MatF]; - ftF = &DF[dirT *size_MatF]; - fbF = &DF[dirB *size_MatF]; - fneF = &DF[dirNE *size_MatF]; - fswF = &DF[dirSW *size_MatF]; - fseF = &DF[dirSE *size_MatF]; - fnwF = &DF[dirNW *size_MatF]; - fteF = &DF[dirTE *size_MatF]; - fbwF = &DF[dirBW *size_MatF]; - fbeF = &DF[dirBE *size_MatF]; - ftwF = &DF[dirTW *size_MatF]; - ftnF = &DF[dirTN *size_MatF]; - fbsF = &DF[dirBS *size_MatF]; - fbnF = &DF[dirBN *size_MatF]; - ftsF = &DF[dirTS *size_MatF]; - fzeroF = &DF[dirZERO*size_MatF]; - ftneF = &DF[dirTNE *size_MatF]; - ftswF = &DF[dirTSW *size_MatF]; - ftseF = &DF[dirTSE *size_MatF]; - ftnwF = &DF[dirTNW *size_MatF]; - fbneF = &DF[dirBNE *size_MatF]; - fbswF = &DF[dirBSW *size_MatF]; - fbseF = &DF[dirBSE *size_MatF]; - fbnwF = &DF[dirBNW *size_MatF]; + feF = &DF[DIR_P00 *size_MatF]; + fwF = &DF[DIR_M00 *size_MatF]; + fnF = &DF[DIR_0P0 *size_MatF]; + fsF = &DF[DIR_0M0 *size_MatF]; + ftF = &DF[DIR_00P *size_MatF]; + fbF = &DF[DIR_00M *size_MatF]; + fneF = &DF[DIR_PP0 *size_MatF]; + fswF = &DF[DIR_MM0 *size_MatF]; + fseF = &DF[DIR_PM0 *size_MatF]; + fnwF = &DF[DIR_MP0 *size_MatF]; + fteF = &DF[DIR_P0P *size_MatF]; + fbwF = &DF[DIR_M0M *size_MatF]; + fbeF = &DF[DIR_P0M *size_MatF]; + ftwF = &DF[DIR_M0P *size_MatF]; + ftnF = &DF[DIR_0PP *size_MatF]; + fbsF = &DF[DIR_0MM *size_MatF]; + fbnF = &DF[DIR_0PM *size_MatF]; + ftsF = &DF[DIR_0MP *size_MatF]; + fzeroF = &DF[DIR_000*size_MatF]; + ftneF = &DF[DIR_PPP *size_MatF]; + ftswF = &DF[DIR_MMP *size_MatF]; + ftseF = &DF[DIR_PMP *size_MatF]; + ftnwF = &DF[DIR_MPP *size_MatF]; + fbneF = &DF[DIR_PPM *size_MatF]; + fbswF = &DF[DIR_MMM *size_MatF]; + fbseF = &DF[DIR_PMM *size_MatF]; + fbnwF = &DF[DIR_MPM *size_MatF]; real *feC, *fwC, *fnC, *fsC, *ftC, *fbC, *fneC, *fswC, *fseC, *fnwC, *fteC, *fbwC, *fbeC, *ftwC, *ftnC, *fbsC, *fbnC, *ftsC, *fzeroC, *ftneC, *ftswC, *ftseC, *ftnwC, *fbneC, *fbswC, *fbseC, *fbnwC; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DC[dirE *size_MatC]; - fwC = &DC[dirW *size_MatC]; - fnC = &DC[dirN *size_MatC]; - fsC = &DC[dirS *size_MatC]; - ftC = &DC[dirT *size_MatC]; - fbC = &DC[dirB *size_MatC]; - fneC = &DC[dirNE *size_MatC]; - fswC = &DC[dirSW *size_MatC]; - fseC = &DC[dirSE *size_MatC]; - fnwC = &DC[dirNW *size_MatC]; - fteC = &DC[dirTE *size_MatC]; - fbwC = &DC[dirBW *size_MatC]; - fbeC = &DC[dirBE *size_MatC]; - ftwC = &DC[dirTW *size_MatC]; - ftnC = &DC[dirTN *size_MatC]; - fbsC = &DC[dirBS *size_MatC]; - fbnC = &DC[dirBN *size_MatC]; - ftsC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - ftneC = &DC[dirTNE *size_MatC]; - ftswC = &DC[dirTSW *size_MatC]; - ftseC = &DC[dirTSE *size_MatC]; - ftnwC = &DC[dirTNW *size_MatC]; - fbneC = &DC[dirBNE *size_MatC]; - fbswC = &DC[dirBSW *size_MatC]; - fbseC = &DC[dirBSE *size_MatC]; - fbnwC = &DC[dirBNW *size_MatC]; + feC = &DC[DIR_P00 *size_MatC]; + fwC = &DC[DIR_M00 *size_MatC]; + fnC = &DC[DIR_0P0 *size_MatC]; + fsC = &DC[DIR_0M0 *size_MatC]; + ftC = &DC[DIR_00P *size_MatC]; + fbC = &DC[DIR_00M *size_MatC]; + fneC = &DC[DIR_PP0 *size_MatC]; + fswC = &DC[DIR_MM0 *size_MatC]; + fseC = &DC[DIR_PM0 *size_MatC]; + fnwC = &DC[DIR_MP0 *size_MatC]; + fteC = &DC[DIR_P0P *size_MatC]; + fbwC = &DC[DIR_M0M *size_MatC]; + fbeC = &DC[DIR_P0M *size_MatC]; + ftwC = &DC[DIR_M0P *size_MatC]; + ftnC = &DC[DIR_0PP *size_MatC]; + fbsC = &DC[DIR_0MM *size_MatC]; + fbnC = &DC[DIR_0PM *size_MatC]; + ftsC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + ftneC = &DC[DIR_PPP *size_MatC]; + ftswC = &DC[DIR_MMP *size_MatC]; + ftseC = &DC[DIR_PMP *size_MatC]; + ftnwC = &DC[DIR_MPP *size_MatC]; + fbneC = &DC[DIR_PPM *size_MatC]; + fbswC = &DC[DIR_MMM *size_MatC]; + fbseC = &DC[DIR_PMM *size_MatC]; + fbnwC = &DC[DIR_MPM *size_MatC]; } else { - fwC = &DC[dirE *size_MatC]; - feC = &DC[dirW *size_MatC]; - fsC = &DC[dirN *size_MatC]; - fnC = &DC[dirS *size_MatC]; - fbC = &DC[dirT *size_MatC]; - ftC = &DC[dirB *size_MatC]; - fswC = &DC[dirNE *size_MatC]; - fneC = &DC[dirSW *size_MatC]; - fnwC = &DC[dirSE *size_MatC]; - fseC = &DC[dirNW *size_MatC]; - fbwC = &DC[dirTE *size_MatC]; - fteC = &DC[dirBW *size_MatC]; - ftwC = &DC[dirBE *size_MatC]; - fbeC = &DC[dirTW *size_MatC]; - fbsC = &DC[dirTN *size_MatC]; - ftnC = &DC[dirBS *size_MatC]; - ftsC = &DC[dirBN *size_MatC]; - fbnC = &DC[dirTS *size_MatC]; - fzeroC = &DC[dirZERO*size_MatC]; - fbswC = &DC[dirTNE *size_MatC]; - fbneC = &DC[dirTSW *size_MatC]; - fbnwC = &DC[dirTSE *size_MatC]; - fbseC = &DC[dirTNW *size_MatC]; - ftswC = &DC[dirBNE *size_MatC]; - ftneC = &DC[dirBSW *size_MatC]; - ftnwC = &DC[dirBSE *size_MatC]; - ftseC = &DC[dirBNW *size_MatC]; + fwC = &DC[DIR_P00 *size_MatC]; + feC = &DC[DIR_M00 *size_MatC]; + fsC = &DC[DIR_0P0 *size_MatC]; + fnC = &DC[DIR_0M0 *size_MatC]; + fbC = &DC[DIR_00P *size_MatC]; + ftC = &DC[DIR_00M *size_MatC]; + fswC = &DC[DIR_PP0 *size_MatC]; + fneC = &DC[DIR_MM0 *size_MatC]; + fnwC = &DC[DIR_PM0 *size_MatC]; + fseC = &DC[DIR_MP0 *size_MatC]; + fbwC = &DC[DIR_P0P *size_MatC]; + fteC = &DC[DIR_M0M *size_MatC]; + ftwC = &DC[DIR_P0M *size_MatC]; + fbeC = &DC[DIR_M0P *size_MatC]; + fbsC = &DC[DIR_0PP *size_MatC]; + ftnC = &DC[DIR_0MM *size_MatC]; + ftsC = &DC[DIR_0PM *size_MatC]; + fbnC = &DC[DIR_0MP *size_MatC]; + fzeroC = &DC[DIR_000*size_MatC]; + fbswC = &DC[DIR_PPP *size_MatC]; + fbneC = &DC[DIR_MMP *size_MatC]; + fbnwC = &DC[DIR_PMP *size_MatC]; + fbseC = &DC[DIR_MPP *size_MatC]; + ftswC = &DC[DIR_PPM *size_MatC]; + ftneC = &DC[DIR_MMM *size_MatC]; + ftnwC = &DC[DIR_PMM *size_MatC]; + ftseC = &DC[DIR_MPM *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index diff --git a/src/gpu/VirtualFluids_GPU/GPU/ScaleFC_F3_27.cu b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleFC_F3_27.cu similarity index 93% rename from src/gpu/VirtualFluids_GPU/GPU/ScaleFC_F3_27.cu rename to src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleFC_F3_27.cu index efb0bf523b74bcbf17c8030ca53aaa127bca96e8..e7fe8b50637e97b9c8cc34025216f4d02e684c55 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/ScaleFC_F3_27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/ScaleFC_F3_27.cu @@ -7,13 +7,14 @@ ////////////////////////////////////////////////////////////////////////// /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFC_comp_D3Q27F3_2018(real* DC, +__global__ void scaleFC_comp_D3Q27F3_2018(real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -24,7 +25,7 @@ extern "C" __global__ void scaleFC_comp_D3Q27F3_2018(real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -43,118 +44,118 @@ extern "C" __global__ void scaleFC_comp_D3Q27F3_2018(real* DC, *f000source, *fMMMsource, *fMMPsource, *fMPPsource, *fMPMsource, *fPPMsource, *fPPPsource, *fPMPsource, *fPMMsource; - fP00source = &DF[dirE *size_MatF]; - fM00source = &DF[dirW *size_MatF]; - f0P0source = &DF[dirN *size_MatF]; - f0M0source = &DF[dirS *size_MatF]; - f00Psource = &DF[dirT *size_MatF]; - f00Msource = &DF[dirB *size_MatF]; - fPP0source = &DF[dirNE *size_MatF]; - fMM0source = &DF[dirSW *size_MatF]; - fPM0source = &DF[dirSE *size_MatF]; - fMP0source = &DF[dirNW *size_MatF]; - fP0Psource = &DF[dirTE *size_MatF]; - fM0Msource = &DF[dirBW *size_MatF]; - fP0Msource = &DF[dirBE *size_MatF]; - fM0Psource = &DF[dirTW *size_MatF]; - f0PPsource = &DF[dirTN *size_MatF]; - f0MMsource = &DF[dirBS *size_MatF]; - f0PMsource = &DF[dirBN *size_MatF]; - f0MPsource = &DF[dirTS *size_MatF]; - f000source = &DF[dirZERO*size_MatF]; - fMMMsource = &DF[dirBSW *size_MatF]; - fMMPsource = &DF[dirTSW *size_MatF]; - fMPPsource = &DF[dirTNW *size_MatF]; - fMPMsource = &DF[dirBNW *size_MatF]; - fPPMsource = &DF[dirBNE *size_MatF]; - fPPPsource = &DF[dirTNE *size_MatF]; - fPMPsource = &DF[dirTSE *size_MatF]; - fPMMsource = &DF[dirBSE *size_MatF]; + fP00source = &DF[DIR_P00 *size_MatF]; + fM00source = &DF[DIR_M00 *size_MatF]; + f0P0source = &DF[DIR_0P0 *size_MatF]; + f0M0source = &DF[DIR_0M0 *size_MatF]; + f00Psource = &DF[DIR_00P *size_MatF]; + f00Msource = &DF[DIR_00M *size_MatF]; + fPP0source = &DF[DIR_PP0 *size_MatF]; + fMM0source = &DF[DIR_MM0 *size_MatF]; + fPM0source = &DF[DIR_PM0 *size_MatF]; + fMP0source = &DF[DIR_MP0 *size_MatF]; + fP0Psource = &DF[DIR_P0P *size_MatF]; + fM0Msource = &DF[DIR_M0M *size_MatF]; + fP0Msource = &DF[DIR_P0M *size_MatF]; + fM0Psource = &DF[DIR_M0P *size_MatF]; + f0PPsource = &DF[DIR_0PP *size_MatF]; + f0MMsource = &DF[DIR_0MM *size_MatF]; + f0PMsource = &DF[DIR_0PM *size_MatF]; + f0MPsource = &DF[DIR_0MP *size_MatF]; + f000source = &DF[DIR_000*size_MatF]; + fMMMsource = &DF[DIR_MMM *size_MatF]; + fMMPsource = &DF[DIR_MMP *size_MatF]; + fMPPsource = &DF[DIR_MPP *size_MatF]; + fMPMsource = &DF[DIR_MPM *size_MatF]; + fPPMsource = &DF[DIR_PPM *size_MatF]; + fPPPsource = &DF[DIR_PPP *size_MatF]; + fPMPsource = &DF[DIR_PMP *size_MatF]; + fPMMsource = &DF[DIR_PMM *size_MatF]; real *fP00dest, *fM00dest, *f0P0dest, *f0M0dest, *f00Pdest, *f00Mdest, *fPP0dest, *fMM0dest, *fPM0dest, *fMP0dest, *fP0Pdest, *fM0Mdest, *fP0Mdest, *fM0Pdest, *f0PPdest, *f0MMdest, *f0PMdest, *f0MPdest, *f000dest, *fMMMdest, *fMMPdest, *fMPPdest, *fMPMdest, *fPPMdest, *fPPPdest, *fPMPdest, *fPMMdest; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - fP00dest = &DC[dirE *size_MatC]; - fM00dest = &DC[dirW *size_MatC]; - f0P0dest = &DC[dirN *size_MatC]; - f0M0dest = &DC[dirS *size_MatC]; - f00Pdest = &DC[dirT *size_MatC]; - f00Mdest = &DC[dirB *size_MatC]; - fPP0dest = &DC[dirNE *size_MatC]; - fMM0dest = &DC[dirSW *size_MatC]; - fPM0dest = &DC[dirSE *size_MatC]; - fMP0dest = &DC[dirNW *size_MatC]; - fP0Pdest = &DC[dirTE *size_MatC]; - fM0Mdest = &DC[dirBW *size_MatC]; - fP0Mdest = &DC[dirBE *size_MatC]; - fM0Pdest = &DC[dirTW *size_MatC]; - f0PPdest = &DC[dirTN *size_MatC]; - f0MMdest = &DC[dirBS *size_MatC]; - f0PMdest = &DC[dirBN *size_MatC]; - f0MPdest = &DC[dirTS *size_MatC]; - f000dest = &DC[dirZERO*size_MatC]; - fMMMdest = &DC[dirBSW *size_MatC]; - fMMPdest = &DC[dirTSW *size_MatC]; - fMPPdest = &DC[dirTNW *size_MatC]; - fMPMdest = &DC[dirBNW *size_MatC]; - fPPMdest = &DC[dirBNE *size_MatC]; - fPPPdest = &DC[dirTNE *size_MatC]; - fPMPdest = &DC[dirTSE *size_MatC]; - fPMMdest = &DC[dirBSE *size_MatC]; + fP00dest = &DC[DIR_P00 *size_MatC]; + fM00dest = &DC[DIR_M00 *size_MatC]; + f0P0dest = &DC[DIR_0P0 *size_MatC]; + f0M0dest = &DC[DIR_0M0 *size_MatC]; + f00Pdest = &DC[DIR_00P *size_MatC]; + f00Mdest = &DC[DIR_00M *size_MatC]; + fPP0dest = &DC[DIR_PP0 *size_MatC]; + fMM0dest = &DC[DIR_MM0 *size_MatC]; + fPM0dest = &DC[DIR_PM0 *size_MatC]; + fMP0dest = &DC[DIR_MP0 *size_MatC]; + fP0Pdest = &DC[DIR_P0P *size_MatC]; + fM0Mdest = &DC[DIR_M0M *size_MatC]; + fP0Mdest = &DC[DIR_P0M *size_MatC]; + fM0Pdest = &DC[DIR_M0P *size_MatC]; + f0PPdest = &DC[DIR_0PP *size_MatC]; + f0MMdest = &DC[DIR_0MM *size_MatC]; + f0PMdest = &DC[DIR_0PM *size_MatC]; + f0MPdest = &DC[DIR_0MP *size_MatC]; + f000dest = &DC[DIR_000*size_MatC]; + fMMMdest = &DC[DIR_MMM *size_MatC]; + fMMPdest = &DC[DIR_MMP *size_MatC]; + fMPPdest = &DC[DIR_MPP *size_MatC]; + fMPMdest = &DC[DIR_MPM *size_MatC]; + fPPMdest = &DC[DIR_PPM *size_MatC]; + fPPPdest = &DC[DIR_PPP *size_MatC]; + fPMPdest = &DC[DIR_PMP *size_MatC]; + fPMMdest = &DC[DIR_PMM *size_MatC]; } else { - fP00dest = &DC[dirW *size_MatC]; - fM00dest = &DC[dirE *size_MatC]; - f0P0dest = &DC[dirS *size_MatC]; - f0M0dest = &DC[dirN *size_MatC]; - f00Pdest = &DC[dirB *size_MatC]; - f00Mdest = &DC[dirT *size_MatC]; - fPP0dest = &DC[dirSW *size_MatC]; - fMM0dest = &DC[dirNE *size_MatC]; - fPM0dest = &DC[dirNW *size_MatC]; - fMP0dest = &DC[dirSE *size_MatC]; - fP0Pdest = &DC[dirBW *size_MatC]; - fM0Mdest = &DC[dirTE *size_MatC]; - fP0Mdest = &DC[dirTW *size_MatC]; - fM0Pdest = &DC[dirBE *size_MatC]; - f0PPdest = &DC[dirBS *size_MatC]; - f0MMdest = &DC[dirTN *size_MatC]; - f0PMdest = &DC[dirTS *size_MatC]; - f0MPdest = &DC[dirBN *size_MatC]; - f000dest = &DC[dirZERO*size_MatC]; - fMMMdest = &DC[dirTNE *size_MatC]; - fMMPdest = &DC[dirBNE *size_MatC]; - fMPPdest = &DC[dirBSE *size_MatC]; - fMPMdest = &DC[dirTSE *size_MatC]; - fPPMdest = &DC[dirTSW *size_MatC]; - fPPPdest = &DC[dirBSW *size_MatC]; - fPMPdest = &DC[dirBNW *size_MatC]; - fPMMdest = &DC[dirTNW *size_MatC]; + fP00dest = &DC[DIR_M00 *size_MatC]; + fM00dest = &DC[DIR_P00 *size_MatC]; + f0P0dest = &DC[DIR_0M0 *size_MatC]; + f0M0dest = &DC[DIR_0P0 *size_MatC]; + f00Pdest = &DC[DIR_00M *size_MatC]; + f00Mdest = &DC[DIR_00P *size_MatC]; + fPP0dest = &DC[DIR_MM0 *size_MatC]; + fMM0dest = &DC[DIR_PP0 *size_MatC]; + fPM0dest = &DC[DIR_MP0 *size_MatC]; + fMP0dest = &DC[DIR_PM0 *size_MatC]; + fP0Pdest = &DC[DIR_M0M *size_MatC]; + fM0Mdest = &DC[DIR_P0P *size_MatC]; + fP0Mdest = &DC[DIR_M0P *size_MatC]; + fM0Pdest = &DC[DIR_P0M *size_MatC]; + f0PPdest = &DC[DIR_0MM *size_MatC]; + f0MMdest = &DC[DIR_0PP *size_MatC]; + f0PMdest = &DC[DIR_0MP *size_MatC]; + f0MPdest = &DC[DIR_0PM *size_MatC]; + f000dest = &DC[DIR_000*size_MatC]; + fMMMdest = &DC[DIR_PPP *size_MatC]; + fMMPdest = &DC[DIR_PPM *size_MatC]; + fMPPdest = &DC[DIR_PMM *size_MatC]; + fMPMdest = &DC[DIR_PMP *size_MatC]; + fPPMdest = &DC[DIR_MMP *size_MatC]; + fPPPdest = &DC[DIR_MMM *size_MatC]; + fPMPdest = &DC[DIR_MPM *size_MatC]; + fPMMdest = &DC[DIR_MPP *size_MatC]; } Distributions6 G; - if (evenOrOdd == true) + if (isEvenTimestep == true) { - G.g[dirE] = &G6[dirE *size_MatC]; - G.g[dirW] = &G6[dirW *size_MatC]; - G.g[dirN] = &G6[dirN *size_MatC]; - G.g[dirS] = &G6[dirS *size_MatC]; - G.g[dirT] = &G6[dirT *size_MatC]; - G.g[dirB] = &G6[dirB *size_MatC]; + G.g[DIR_P00] = &G6[DIR_P00 *size_MatC]; + G.g[DIR_M00] = &G6[DIR_M00 *size_MatC]; + G.g[DIR_0P0] = &G6[DIR_0P0 *size_MatC]; + G.g[DIR_0M0] = &G6[DIR_0M0 *size_MatC]; + G.g[DIR_00P] = &G6[DIR_00P *size_MatC]; + G.g[DIR_00M] = &G6[DIR_00M *size_MatC]; } else { - G.g[dirW] = &G6[dirE *size_MatC]; - G.g[dirE] = &G6[dirW *size_MatC]; - G.g[dirS] = &G6[dirN *size_MatC]; - G.g[dirN] = &G6[dirS *size_MatC]; - G.g[dirB] = &G6[dirT *size_MatC]; - G.g[dirT] = &G6[dirB *size_MatC]; + G.g[DIR_M00] = &G6[DIR_P00 *size_MatC]; + G.g[DIR_P00] = &G6[DIR_M00 *size_MatC]; + G.g[DIR_0M0] = &G6[DIR_0P0 *size_MatC]; + G.g[DIR_0P0] = &G6[DIR_0M0 *size_MatC]; + G.g[DIR_00M] = &G6[DIR_00P *size_MatC]; + G.g[DIR_00P] = &G6[DIR_00M *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -1167,12 +1168,12 @@ extern "C" __global__ void scaleFC_comp_D3Q27F3_2018(real* DC, //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; @@ -1260,7 +1261,7 @@ extern "C" __global__ void scaleFC_comp_D3Q27F3_2018(real* DC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void scaleFC_comp_D3Q27F3( real* DC, +__global__ void scaleFC_comp_D3Q27F3( real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -1271,7 +1272,7 @@ extern "C" __global__ void scaleFC_comp_D3Q27F3( real* DC, unsigned int* neighborFZ, unsigned int size_MatC, unsigned int size_MatF, - bool evenOrOdd, + bool isEvenTimestep, unsigned int* posC, unsigned int* posFSWB, unsigned int kFC, @@ -1290,118 +1291,118 @@ extern "C" __global__ void scaleFC_comp_D3Q27F3( real* DC, *f000source, *fMMMsource, *fMMPsource, *fMPPsource, *fMPMsource, *fPPMsource, *fPPPsource, *fPMPsource, *fPMMsource; - fP00source = &DF[dirE *size_MatF]; - fM00source = &DF[dirW *size_MatF]; - f0P0source = &DF[dirN *size_MatF]; - f0M0source = &DF[dirS *size_MatF]; - f00Psource = &DF[dirT *size_MatF]; - f00Msource = &DF[dirB *size_MatF]; - fPP0source = &DF[dirNE *size_MatF]; - fMM0source = &DF[dirSW *size_MatF]; - fPM0source = &DF[dirSE *size_MatF]; - fMP0source = &DF[dirNW *size_MatF]; - fP0Psource = &DF[dirTE *size_MatF]; - fM0Msource = &DF[dirBW *size_MatF]; - fP0Msource = &DF[dirBE *size_MatF]; - fM0Psource = &DF[dirTW *size_MatF]; - f0PPsource = &DF[dirTN *size_MatF]; - f0MMsource = &DF[dirBS *size_MatF]; - f0PMsource = &DF[dirBN *size_MatF]; - f0MPsource = &DF[dirTS *size_MatF]; - f000source = &DF[dirZERO*size_MatF]; - fMMMsource = &DF[dirBSW *size_MatF]; - fMMPsource = &DF[dirTSW *size_MatF]; - fMPPsource = &DF[dirTNW *size_MatF]; - fMPMsource = &DF[dirBNW *size_MatF]; - fPPMsource = &DF[dirBNE *size_MatF]; - fPPPsource = &DF[dirTNE *size_MatF]; - fPMPsource = &DF[dirTSE *size_MatF]; - fPMMsource = &DF[dirBSE *size_MatF]; + fP00source = &DF[DIR_P00 *size_MatF]; + fM00source = &DF[DIR_M00 *size_MatF]; + f0P0source = &DF[DIR_0P0 *size_MatF]; + f0M0source = &DF[DIR_0M0 *size_MatF]; + f00Psource = &DF[DIR_00P *size_MatF]; + f00Msource = &DF[DIR_00M *size_MatF]; + fPP0source = &DF[DIR_PP0 *size_MatF]; + fMM0source = &DF[DIR_MM0 *size_MatF]; + fPM0source = &DF[DIR_PM0 *size_MatF]; + fMP0source = &DF[DIR_MP0 *size_MatF]; + fP0Psource = &DF[DIR_P0P *size_MatF]; + fM0Msource = &DF[DIR_M0M *size_MatF]; + fP0Msource = &DF[DIR_P0M *size_MatF]; + fM0Psource = &DF[DIR_M0P *size_MatF]; + f0PPsource = &DF[DIR_0PP *size_MatF]; + f0MMsource = &DF[DIR_0MM *size_MatF]; + f0PMsource = &DF[DIR_0PM *size_MatF]; + f0MPsource = &DF[DIR_0MP *size_MatF]; + f000source = &DF[DIR_000*size_MatF]; + fMMMsource = &DF[DIR_MMM *size_MatF]; + fMMPsource = &DF[DIR_MMP *size_MatF]; + fMPPsource = &DF[DIR_MPP *size_MatF]; + fMPMsource = &DF[DIR_MPM *size_MatF]; + fPPMsource = &DF[DIR_PPM *size_MatF]; + fPPPsource = &DF[DIR_PPP *size_MatF]; + fPMPsource = &DF[DIR_PMP *size_MatF]; + fPMMsource = &DF[DIR_PMM *size_MatF]; real *fP00dest, *fM00dest, *f0P0dest, *f0M0dest, *f00Pdest, *f00Mdest, *fPP0dest, *fMM0dest, *fPM0dest, *fMP0dest, *fP0Pdest, *fM0Mdest, *fP0Mdest, *fM0Pdest, *f0PPdest, *f0MMdest, *f0PMdest, *f0MPdest, *f000dest, *fMMMdest, *fMMPdest, *fMPPdest, *fMPMdest, *fPPMdest, *fPPPdest, *fPMPdest, *fPMMdest; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - fP00dest = &DC[dirE *size_MatC]; - fM00dest = &DC[dirW *size_MatC]; - f0P0dest = &DC[dirN *size_MatC]; - f0M0dest = &DC[dirS *size_MatC]; - f00Pdest = &DC[dirT *size_MatC]; - f00Mdest = &DC[dirB *size_MatC]; - fPP0dest = &DC[dirNE *size_MatC]; - fMM0dest = &DC[dirSW *size_MatC]; - fPM0dest = &DC[dirSE *size_MatC]; - fMP0dest = &DC[dirNW *size_MatC]; - fP0Pdest = &DC[dirTE *size_MatC]; - fM0Mdest = &DC[dirBW *size_MatC]; - fP0Mdest = &DC[dirBE *size_MatC]; - fM0Pdest = &DC[dirTW *size_MatC]; - f0PPdest = &DC[dirTN *size_MatC]; - f0MMdest = &DC[dirBS *size_MatC]; - f0PMdest = &DC[dirBN *size_MatC]; - f0MPdest = &DC[dirTS *size_MatC]; - f000dest = &DC[dirZERO*size_MatC]; - fMMMdest = &DC[dirBSW *size_MatC]; - fMMPdest = &DC[dirTSW *size_MatC]; - fMPPdest = &DC[dirTNW *size_MatC]; - fMPMdest = &DC[dirBNW *size_MatC]; - fPPMdest = &DC[dirBNE *size_MatC]; - fPPPdest = &DC[dirTNE *size_MatC]; - fPMPdest = &DC[dirTSE *size_MatC]; - fPMMdest = &DC[dirBSE *size_MatC]; + fP00dest = &DC[DIR_P00 *size_MatC]; + fM00dest = &DC[DIR_M00 *size_MatC]; + f0P0dest = &DC[DIR_0P0 *size_MatC]; + f0M0dest = &DC[DIR_0M0 *size_MatC]; + f00Pdest = &DC[DIR_00P *size_MatC]; + f00Mdest = &DC[DIR_00M *size_MatC]; + fPP0dest = &DC[DIR_PP0 *size_MatC]; + fMM0dest = &DC[DIR_MM0 *size_MatC]; + fPM0dest = &DC[DIR_PM0 *size_MatC]; + fMP0dest = &DC[DIR_MP0 *size_MatC]; + fP0Pdest = &DC[DIR_P0P *size_MatC]; + fM0Mdest = &DC[DIR_M0M *size_MatC]; + fP0Mdest = &DC[DIR_P0M *size_MatC]; + fM0Pdest = &DC[DIR_M0P *size_MatC]; + f0PPdest = &DC[DIR_0PP *size_MatC]; + f0MMdest = &DC[DIR_0MM *size_MatC]; + f0PMdest = &DC[DIR_0PM *size_MatC]; + f0MPdest = &DC[DIR_0MP *size_MatC]; + f000dest = &DC[DIR_000*size_MatC]; + fMMMdest = &DC[DIR_MMM *size_MatC]; + fMMPdest = &DC[DIR_MMP *size_MatC]; + fMPPdest = &DC[DIR_MPP *size_MatC]; + fMPMdest = &DC[DIR_MPM *size_MatC]; + fPPMdest = &DC[DIR_PPM *size_MatC]; + fPPPdest = &DC[DIR_PPP *size_MatC]; + fPMPdest = &DC[DIR_PMP *size_MatC]; + fPMMdest = &DC[DIR_PMM *size_MatC]; } else { - fP00dest = &DC[dirW *size_MatC]; - fM00dest = &DC[dirE *size_MatC]; - f0P0dest = &DC[dirS *size_MatC]; - f0M0dest = &DC[dirN *size_MatC]; - f00Pdest = &DC[dirB *size_MatC]; - f00Mdest = &DC[dirT *size_MatC]; - fPP0dest = &DC[dirSW *size_MatC]; - fMM0dest = &DC[dirNE *size_MatC]; - fPM0dest = &DC[dirNW *size_MatC]; - fMP0dest = &DC[dirSE *size_MatC]; - fP0Pdest = &DC[dirBW *size_MatC]; - fM0Mdest = &DC[dirTE *size_MatC]; - fP0Mdest = &DC[dirTW *size_MatC]; - fM0Pdest = &DC[dirBE *size_MatC]; - f0PPdest = &DC[dirBS *size_MatC]; - f0MMdest = &DC[dirTN *size_MatC]; - f0PMdest = &DC[dirTS *size_MatC]; - f0MPdest = &DC[dirBN *size_MatC]; - f000dest = &DC[dirZERO*size_MatC]; - fMMMdest = &DC[dirTNE *size_MatC]; - fMMPdest = &DC[dirBNE *size_MatC]; - fMPPdest = &DC[dirBSE *size_MatC]; - fMPMdest = &DC[dirTSE *size_MatC]; - fPPMdest = &DC[dirTSW *size_MatC]; - fPPPdest = &DC[dirBSW *size_MatC]; - fPMPdest = &DC[dirBNW *size_MatC]; - fPMMdest = &DC[dirTNW *size_MatC]; + fP00dest = &DC[DIR_M00 *size_MatC]; + fM00dest = &DC[DIR_P00 *size_MatC]; + f0P0dest = &DC[DIR_0M0 *size_MatC]; + f0M0dest = &DC[DIR_0P0 *size_MatC]; + f00Pdest = &DC[DIR_00M *size_MatC]; + f00Mdest = &DC[DIR_00P *size_MatC]; + fPP0dest = &DC[DIR_MM0 *size_MatC]; + fMM0dest = &DC[DIR_PP0 *size_MatC]; + fPM0dest = &DC[DIR_MP0 *size_MatC]; + fMP0dest = &DC[DIR_PM0 *size_MatC]; + fP0Pdest = &DC[DIR_M0M *size_MatC]; + fM0Mdest = &DC[DIR_P0P *size_MatC]; + fP0Mdest = &DC[DIR_M0P *size_MatC]; + fM0Pdest = &DC[DIR_P0M *size_MatC]; + f0PPdest = &DC[DIR_0MM *size_MatC]; + f0MMdest = &DC[DIR_0PP *size_MatC]; + f0PMdest = &DC[DIR_0MP *size_MatC]; + f0MPdest = &DC[DIR_0PM *size_MatC]; + f000dest = &DC[DIR_000*size_MatC]; + fMMMdest = &DC[DIR_PPP *size_MatC]; + fMMPdest = &DC[DIR_PPM *size_MatC]; + fMPPdest = &DC[DIR_PMM *size_MatC]; + fMPMdest = &DC[DIR_PMP *size_MatC]; + fPPMdest = &DC[DIR_MMP *size_MatC]; + fPPPdest = &DC[DIR_MMM *size_MatC]; + fPMPdest = &DC[DIR_MPM *size_MatC]; + fPMMdest = &DC[DIR_MPP *size_MatC]; } Distributions6 G; - if (evenOrOdd == true) + if (isEvenTimestep == true) { - G.g[dirE] = &G6[dirE *size_MatC]; - G.g[dirW] = &G6[dirW *size_MatC]; - G.g[dirN] = &G6[dirN *size_MatC]; - G.g[dirS] = &G6[dirS *size_MatC]; - G.g[dirT] = &G6[dirT *size_MatC]; - G.g[dirB] = &G6[dirB *size_MatC]; + G.g[DIR_P00] = &G6[DIR_P00 *size_MatC]; + G.g[DIR_M00] = &G6[DIR_M00 *size_MatC]; + G.g[DIR_0P0] = &G6[DIR_0P0 *size_MatC]; + G.g[DIR_0M0] = &G6[DIR_0M0 *size_MatC]; + G.g[DIR_00P] = &G6[DIR_00P *size_MatC]; + G.g[DIR_00M] = &G6[DIR_00M *size_MatC]; } else { - G.g[dirW] = &G6[dirE *size_MatC]; - G.g[dirE] = &G6[dirW *size_MatC]; - G.g[dirS] = &G6[dirN *size_MatC]; - G.g[dirN] = &G6[dirS *size_MatC]; - G.g[dirB] = &G6[dirT *size_MatC]; - G.g[dirT] = &G6[dirB *size_MatC]; + G.g[DIR_M00] = &G6[DIR_P00 *size_MatC]; + G.g[DIR_P00] = &G6[DIR_M00 *size_MatC]; + G.g[DIR_0M0] = &G6[DIR_0P0 *size_MatC]; + G.g[DIR_0P0] = &G6[DIR_0M0 *size_MatC]; + G.g[DIR_00M] = &G6[DIR_00P *size_MatC]; + G.g[DIR_00P] = &G6[DIR_00M *size_MatC]; } //////////////////////////////////////////////////////////////////////////////// @@ -2408,12 +2409,12 @@ extern "C" __global__ void scaleFC_comp_D3Q27F3( real* DC, //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (G.g[dirE])[k000] = mgcbb; - (G.g[dirW])[kM00] = mgabb; - (G.g[dirN])[k000] = mgbcb; - (G.g[dirS])[k0M0] = mgbab; - (G.g[dirT])[k000] = mgbbc; - (G.g[dirB])[k00M] = mgbba; + (G.g[DIR_P00])[k000] = mgcbb; + (G.g[DIR_M00])[kM00] = mgabb; + (G.g[DIR_0P0])[k000] = mgbcb; + (G.g[DIR_0M0])[k0M0] = mgbab; + (G.g[DIR_00P])[k000] = mgbbc; + (G.g[DIR_00M])[k00M] = mgbba; //////////////////////////////////////////////////////////////////////////////////// fP00dest[k000] = mfcbb; fM00dest[kM00] = mfabb; diff --git a/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleCF_compressible.cu b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleCF_compressible.cu new file mode 100644 index 0000000000000000000000000000000000000000..f4160b89c047a7e6244a5579baae03d30b3c89cb --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleCF_compressible.cu @@ -0,0 +1,1319 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file scaleCF_compressible.cu +//! \ingroup GPU/GridScaling +//! \author Martin Schoenherr, Anna Wellmann +//======================================================================================= + +#include "DataTypes.h" +#include "Kernel/Utilities/DistributionHelper.cuh" +#include "Kernel/Utilities/ChimeraTransformation.h" +#include "Kernel/Utilities/ScalingHelperFunctions.h" + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + +////////////////////////////////////////////////////////////////////////// +//! \brief Calculate the interpolated distributions on the fine destination nodes +//! \details Used in scaling from coarse to fine +//! The function is executed in the following steps: +//! +__device__ __inline__ void interpolateDistributions( + const real& x, const real& y, const real& z, + real& m_000, + real& m_100, real& m_010, real& m_001, + real& m_011, real& m_101, real& m_110, real& m_200, real& m_020, real& m_002, + real& m_111, real& m_210, real& m_012, real& m_201, real& m_021, real& m_120, real& m_102, + real& m_022, real& m_202, real& m_220, real& m_211, real& m_121, real& m_112, + real& m_122, real& m_212, real& m_221, + real& m_222, + const real& a_000, const real& a_100, const real& a_010, const real& a_001, const real& a_200, const real& a_020, const real& a_002, const real& a_110, const real& a_101, const real& a_011, const real& a_111, + const real& b_000, const real& b_100, const real& b_010, const real& b_001, const real& b_200, const real& b_020, const real& b_002, const real& b_110, const real& b_101, const real& b_011, const real& b_111, + const real& c_000, const real& c_100, const real& c_010, const real& c_001, const real& c_200, const real& c_020, const real& c_002, const real& c_110, const real& c_101, const real& c_011, const real& c_111, + const real& d_000, const real& d_100, const real& d_010, const real& d_001, const real& d_110, const real& d_101, const real& d_011, const real& d_111, + const real& LaplaceRho, const real& eps_new, const real& omegaF, + const real& kxxMyyAverage, const real& kxxMzzAverage, const real& kyzAverage, const real& kxzAverage, const real& kxyAverage +) +{ + real useNEQ = c1o1;//zero;//one; //.... one = on ..... zero = off + + ////////////////////////////////////////////////////////////////////////// + // - Reset all moments to zero + // + m_111 = c0o1; + m_211 = c0o1; + m_011 = c0o1; + m_121 = c0o1; + m_101 = c0o1; + m_112 = c0o1; + m_110 = c0o1; + m_221 = c0o1; + m_001 = c0o1; + m_201 = c0o1; + m_021 = c0o1; + m_212 = c0o1; + m_010 = c0o1; + m_210 = c0o1; + m_012 = c0o1; + m_122 = c0o1; + m_100 = c0o1; + m_120 = c0o1; + m_102 = c0o1; + m_222 = c0o1; + m_022 = c0o1; + m_202 = c0o1; + m_002 = c0o1; + m_220 = c0o1; + m_020 = c0o1; + m_200 = c0o1; + m_000 = c0o1; + + //////////////////////////////////////////////////////////////////////////////// + //! - Set macroscopic values on destination node (zeroth and first order moments) + //! + real press = d_000 + x * d_100 + y * d_010 + z * d_001 + + x * y * d_110 + x * z * d_101 + y * z * d_011 + x * y * z * d_111 + c3o1 * x * x * LaplaceRho; + real vvx = a_000 + x * a_100 + y * a_010 + z * a_001 + + x * x * a_200 + y * y * a_020 + z * z * a_002 + + x * y * a_110 + x * z * a_101 + y * z * a_011 + x * y * z * a_111; + real vvy = b_000 + x * b_100 + y * b_010 + z * b_001 + + x * x * b_200 + y * y * b_020 + z * z * b_002 + + x * y * b_110 + x * z * b_101 + y * z * b_011 + x * y * z * b_111; + real vvz = c_000 + x * c_100 + y * c_010 + z * c_001 + + x * x * c_200 + y * y * c_020 + z * z * c_002 + + x * y * c_110 + x * z * c_101 + y * z * c_011 + x * y * z * c_111; + + m_000 = press; // m_000 is press, if drho is interpolated directly + + //////////////////////////////////////////////////////////////////////////////// + //! - Set moments (second to sixth order) on destination node + //! + // linear combinations for second order moments + real mxxPyyPzz = m_000; + + real mxxMyy = -c2o3 * (a_100 - b_010 + kxxMyyAverage + c2o1 * a_200 * x - b_110 * x + a_110 * y + -c2o1 * b_020 * y + a_101 * z - b_011 * z - b_111 * x * z + a_111 * y * z) * eps_new/ omegaF * (c1o1 + press); + real mxxMzz = -c2o3 * (a_100 - c_001 + kxxMzzAverage + c2o1 * a_200 * x - c_101 * x + a_110 * y + -c_011 * y - c_111 * x * y + a_101 * z - c2o1 * c_002 * z + a_111 * y * z) * eps_new/ omegaF * (c1o1 + press); + + m_011 = -c1o3 * (b_001 + c_010 + kyzAverage + b_101 * x + c_110 * x + b_011 * y + c2o1 * c_020 * y + + b_111 * x * y + c2o1 * b_002 * z + c_011 * z + c_111 * x * z) * eps_new / omegaF * (c1o1 + press); + m_101 = -c1o3 * (a_001 + c_100 + kxzAverage + a_101 * x + c2o1 * c_200 * x + a_011 * y + c_110 * y + + a_111 * x * y + c2o1 * a_002 * z + c_101 * z + c_111 * y * z) * eps_new / omegaF * (c1o1 + press); + m_110 = -c1o3 * (a_010 + b_100 + kxyAverage + a_110 * x + c2o1 * b_200 * x + c2o1 * a_020 * y + + b_110 * y + a_011 * z + b_101 * z + a_111 * x * z + b_111 * y * z) * eps_new / omegaF * (c1o1 + press); + + m_200 = c1o3 * ( mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; + m_020 = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; + m_002 = c1o3 * ( mxxMyy - c2o1 * mxxMzz + mxxPyyPzz) * useNEQ; + + // linear combinations for third order moments + m_111 = c0o1; + + real mxxyPyzz = c0o1; + real mxxyMyzz = c0o1; + real mxxzPyyz = c0o1; + real mxxzMyyz = c0o1; + real mxyyPxzz = c0o1; + real mxyyMxzz = c0o1; + + m_210 = ( mxxyMyzz + mxxyPyzz) * c1o2; + m_012 = (-mxxyMyzz + mxxyPyzz) * c1o2; + m_201 = ( mxxzMyyz + mxxzPyyz) * c1o2; + m_021 = (-mxxzMyyz + mxxzPyyz) * c1o2; + m_120 = ( mxyyMxzz + mxyyPxzz) * c1o2; + m_102 = (-mxyyMxzz + mxyyPxzz) * c1o2; + + // fourth order moments + m_022 = m_000 * c1o9; + m_202 = m_022; + m_220 = m_022; + + // fifth order moments + + // sixth order moment + m_222 = m_000 * c1o27; + + real vx_sq = vvx * vvx; + real vy_sq = vvy * vvy; + real vz_sq = vvz * vvz; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (88)-(96) in <a + //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> + //! + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + backwardInverseChimeraWithK(m_000, m_100, m_200, vvx, vx_sq, c1o1, c1o1); + backwardChimera( m_010, m_110, m_210, vvx, vx_sq); + backwardInverseChimeraWithK(m_020, m_120, m_220, vvx, vx_sq, c3o1, c1o3); + backwardChimera( m_001, m_101, m_201, vvx, vx_sq); + backwardChimera( m_011, m_111, m_211, vvx, vx_sq); + backwardChimera( m_021, m_121, m_221, vvx, vx_sq); + backwardInverseChimeraWithK(m_002, m_102, m_202, vvx, vx_sq, c3o1, c1o3); + backwardChimera( m_012, m_112, m_212, vvx, vx_sq); + backwardInverseChimeraWithK(m_022, m_122, m_222, vvx, vx_sq, c9o1, c1o9); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithK(m_000, m_010, m_020, vvy, vy_sq, c6o1, c1o6); + backwardChimera( m_001, m_011, m_021, vvy, vy_sq); + backwardInverseChimeraWithK(m_002, m_012, m_022, vvy, vy_sq, c18o1, c1o18); + backwardInverseChimeraWithK(m_100, m_110, m_120, vvy, vy_sq, c3o2, c2o3); + backwardChimera( m_101, m_111, m_121, vvy, vy_sq); + backwardInverseChimeraWithK(m_102, m_112, m_122, vvy, vy_sq, c9o2, c2o9); + backwardInverseChimeraWithK(m_200, m_210, m_220, vvy, vy_sq, c6o1, c1o6); + backwardChimera( m_201, m_211, m_221, vvy, vy_sq); + backwardInverseChimeraWithK(m_202, m_212, m_222, vvy, vy_sq, c18o1, c1o18); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithK(m_000, m_001, m_002, vvz, vz_sq, c36o1, c1o36); + backwardInverseChimeraWithK(m_010, m_011, m_012, vvz, vz_sq, c9o1, c1o9); + backwardInverseChimeraWithK(m_020, m_021, m_022, vvz, vz_sq, c36o1, c1o36); + backwardInverseChimeraWithK(m_100, m_101, m_102, vvz, vz_sq, c9o1, c1o9); + backwardInverseChimeraWithK(m_110, m_111, m_112, vvz, vz_sq, c9o4, c4o9); + backwardInverseChimeraWithK(m_120, m_121, m_122, vvz, vz_sq, c9o1, c1o9); + backwardInverseChimeraWithK(m_200, m_201, m_202, vvz, vz_sq, c36o1, c1o36); + backwardInverseChimeraWithK(m_210, m_211, m_212, vvz, vz_sq, c9o1, c1o9); + backwardInverseChimeraWithK(m_220, m_221, m_222, vvz, vz_sq, c36o1, c1o36); +} + +////////////////////////////////////////////////////////////////////////// +//! \brief Interpolate from coarse to fine nodes +//! \details This scaling function is designed for the Cumulant K17 Kernel chimera collision kernel. +//! +//! The function is executed in the following steps: +//! + +// based on scaleCF_RhoSq_comp_27 +__global__ void scaleCF_compressible( + real* distributionsCoarse, + real* distributionsFine, + unsigned int* neighborXcoarse, + unsigned int* neighborYcoarse, + unsigned int* neighborZcoarse, + unsigned int* neighborXfine, + unsigned int* neighborYfine, + unsigned int* neighborZfine, + unsigned int numberOfLBnodesCoarse, + unsigned int numberOfLBnodesFine, + bool isEvenTimestep, + unsigned int* indicesCoarseMMM, + unsigned int* indicesFineMMM, + unsigned int numberOfInterfaceNodes, + real omegaCoarse, + real omegaFine, + OffCF offsetCF) +{ + //////////////////////////////////////////////////////////////////////////////// + //! - Get the thread index coordinates from threadId_100, blockId_100, blockDim and gridDim. + //! + const unsigned k_thread = vf::gpu::getNodeIndex(); + + ////////////////////////////////////////////////////////////////////////// + //! - Return for non-interface node + if (k_thread >= numberOfInterfaceNodes) + return; + + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on + //! timestep is based on the esoteric twist algorithm \ref <a + //! href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), + //! DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 distFine = vf::gpu::getDistributionReferences27(distributionsFine, numberOfLBnodesFine, true); + Distributions27 distCoarse = vf::gpu::getDistributionReferences27(distributionsCoarse, numberOfLBnodesCoarse, isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - declare local variables for source nodes + //! + real eps_new = c1o2; // ratio of grid resolutions + real omegaC = omegaCoarse; + real omegaF = omegaFine; + + // zeroth and first order moments at the source nodes + real drho_PPP, vx1_PPP, vx2_PPP, vx3_PPP; + real drho_MPP, vx1_MPP, vx2_MPP, vx3_MPP; + real drho_PMP, vx1_PMP, vx2_PMP, vx3_PMP; + real drho_MMP, vx1_MMP, vx2_MMP, vx3_MMP; + real drho_PPM, vx1_PPM, vx2_PPM, vx3_PPM; + real drho_MPM, vx1_MPM, vx2_MPM, vx3_MPM; + real drho_PMM, vx1_PMM, vx2_PMM, vx3_PMM; + real drho_MMM, vx1_MMM, vx2_MMM, vx3_MMM; + + // second order moments at the source nodes + real kxyFromfcNEQ_PPP, kyzFromfcNEQ_PPP, kxzFromfcNEQ_PPP, kxxMyyFromfcNEQ_PPP, kxxMzzFromfcNEQ_PPP; + real kxyFromfcNEQ_MPP, kyzFromfcNEQ_MPP, kxzFromfcNEQ_MPP, kxxMyyFromfcNEQ_MPP, kxxMzzFromfcNEQ_MPP; + real kxyFromfcNEQ_PMP, kyzFromfcNEQ_PMP, kxzFromfcNEQ_PMP, kxxMyyFromfcNEQ_PMP, kxxMzzFromfcNEQ_PMP; + real kxyFromfcNEQ_MMP, kyzFromfcNEQ_MMP, kxzFromfcNEQ_MMP, kxxMyyFromfcNEQ_MMP, kxxMzzFromfcNEQ_MMP; + real kxyFromfcNEQ_PPM, kyzFromfcNEQ_PPM, kxzFromfcNEQ_PPM, kxxMyyFromfcNEQ_PPM, kxxMzzFromfcNEQ_PPM; + real kxyFromfcNEQ_MPM, kyzFromfcNEQ_MPM, kxzFromfcNEQ_MPM, kxxMyyFromfcNEQ_MPM, kxxMzzFromfcNEQ_MPM; + real kxyFromfcNEQ_PMM, kyzFromfcNEQ_PMM, kxzFromfcNEQ_PMM, kxxMyyFromfcNEQ_PMM, kxxMzzFromfcNEQ_PMM; + real kxyFromfcNEQ_MMM, kyzFromfcNEQ_MMM, kxzFromfcNEQ_MMM, kxxMyyFromfcNEQ_MMM, kxxMzzFromfcNEQ_MMM; + + //////////////////////////////////////////////////////////////////////////////// + //! - Calculate moments for each source node + //! + //////////////////////////////////////////////////////////////////////////////// + // source node BSW = MMM + //////////////////////////////////////////////////////////////////////////////// + // index of the base node and its neighbors + unsigned int k_base_000 = indicesCoarseMMM[k_thread]; + unsigned int k_base_M00 = neighborXcoarse [k_base_000]; + unsigned int k_base_0M0 = neighborYcoarse [k_base_000]; + unsigned int k_base_00M = neighborZcoarse [k_base_000]; + unsigned int k_base_MM0 = neighborYcoarse [k_base_M00]; + unsigned int k_base_M0M = neighborZcoarse [k_base_M00]; + unsigned int k_base_0MM = neighborZcoarse [k_base_0M0]; + unsigned int k_base_MMM = neighborZcoarse [k_base_MM0]; + //////////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + unsigned int k_000 = k_base_000; + unsigned int k_M00 = k_base_M00; + unsigned int k_0M0 = k_base_0M0; + unsigned int k_00M = k_base_00M; + unsigned int k_MM0 = k_base_MM0; + unsigned int k_M0M = k_base_M0M; + unsigned int k_0MM = k_base_0MM; + unsigned int k_MMM = k_base_MMM; + + calculateMomentsOnSourceNodes( distCoarse, omegaC, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MMM, vx1_MMM, vx2_MMM, vx3_MMM, + kxyFromfcNEQ_MMM, kyzFromfcNEQ_MMM, kxzFromfcNEQ_MMM, kxxMyyFromfcNEQ_MMM, kxxMzzFromfcNEQ_MMM); + + ////////////////////////////////////////////////////////////////////////// + // source node TSW = MMP + ////////////////////////////////////////////////////////////////////////// + // Set neighbor indices - has to be recalculated for the new source node + k_000 = k_00M; + k_M00 = k_M0M; + k_0M0 = k_0MM; + k_00M = neighborZcoarse[k_00M]; + k_MM0 = k_MMM; + k_M0M = neighborZcoarse[k_M0M]; + k_0MM = neighborZcoarse[k_0MM]; + k_MMM = neighborZcoarse[k_MMM]; + + calculateMomentsOnSourceNodes( distCoarse, omegaC, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MMP, vx1_MMP, vx2_MMP, vx3_MMP, + kxyFromfcNEQ_MMP, kyzFromfcNEQ_MMP, kxzFromfcNEQ_MMP, kxxMyyFromfcNEQ_MMP, kxxMzzFromfcNEQ_MMP); + + ////////////////////////////////////////////////////////////////////////// + // source node TSE = PMP + ////////////////////////////////////////////////////////////////////////// + // index + k_000 = k_M00; + k_M00 = neighborXcoarse[k_M00]; + k_0M0 = k_MM0; + k_00M = k_M0M; + k_MM0 = neighborXcoarse[k_MM0]; + k_M0M = neighborXcoarse[k_M0M]; + k_0MM = k_MMM; + k_MMM = neighborXcoarse[k_MMM]; + + calculateMomentsOnSourceNodes( distCoarse, omegaC, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PMP, vx1_PMP, vx2_PMP, vx3_PMP, + kxyFromfcNEQ_PMP, kyzFromfcNEQ_PMP, kxzFromfcNEQ_PMP, kxxMyyFromfcNEQ_PMP, kxxMzzFromfcNEQ_PMP); + + ////////////////////////////////////////////////////////////////////////// + // source node BSE = PMM + ////////////////////////////////////////////////////////////////////////// + // index + k_00M = k_000; + k_M0M = k_M00; + k_0MM = k_0M0; + k_MMM = k_MM0; + k_000 = k_base_M00; + k_M00 = neighborXcoarse[k_base_M00]; + k_0M0 = k_base_MM0; + k_MM0 = neighborXcoarse[k_base_MM0]; + + calculateMomentsOnSourceNodes( distCoarse, omegaC, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PMM, vx1_PMM, vx2_PMM, vx3_PMM, + kxyFromfcNEQ_PMM, kyzFromfcNEQ_PMM, kxzFromfcNEQ_PMM, kxxMyyFromfcNEQ_PMM, kxxMzzFromfcNEQ_PMM); + + ////////////////////////////////////////////////////////////////////////// + // source node BNW = MPM + ////////////////////////////////////////////////////////////////////////// + // index of the base node and its neighbors --> indices of all source nodes + k_base_000 = k_base_0M0; + k_base_M00 = k_base_MM0; + k_base_0M0 = neighborYcoarse[k_base_0M0]; + k_base_00M = k_base_0MM; + k_base_MM0 = neighborYcoarse[k_base_MM0]; + k_base_M0M = k_base_MMM; + k_base_0MM = neighborYcoarse[k_base_0MM]; + k_base_MMM = neighborYcoarse[k_base_MMM]; + ////////////////////////////////////////////////////////////////////////// + // index + k_000 = k_base_000; + k_M00 = k_base_M00; + k_0M0 = k_base_0M0; + k_00M = k_base_00M; + k_MM0 = k_base_MM0; + k_M0M = k_base_M0M; + k_0MM = k_base_0MM; + k_MMM = k_base_MMM; + + calculateMomentsOnSourceNodes( distCoarse, omegaC, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MPM, vx1_MPM, vx2_MPM, vx3_MPM, + kxyFromfcNEQ_MPM, kyzFromfcNEQ_MPM, kxzFromfcNEQ_MPM, kxxMyyFromfcNEQ_MPM, kxxMzzFromfcNEQ_MPM); + + ////////////////////////////////////////////////////////////////////////// + // source node TNW = MPP + ////////////////////////////////////////////////////////////////////////// + // index + k_000 = k_00M; + k_M00 = k_M0M; + k_0M0 = k_0MM; + k_00M = neighborZcoarse[k_00M]; + k_MM0 = k_MMM; + k_M0M = neighborZcoarse[k_M0M]; + k_0MM = neighborZcoarse[k_0MM]; + k_MMM = neighborZcoarse[k_MMM]; + + calculateMomentsOnSourceNodes( distCoarse, omegaC, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MPP, vx1_MPP, vx2_MPP, vx3_MPP, + kxyFromfcNEQ_MPP, kyzFromfcNEQ_MPP, kxzFromfcNEQ_MPP, kxxMyyFromfcNEQ_MPP, kxxMzzFromfcNEQ_MPP); + + ////////////////////////////////////////////////////////////////////////// + // source node TNE = PPP + ////////////////////////////////////////////////////////////////////////// + // index + // index + k_000 = k_M00; + k_M00 = neighborXcoarse[k_M00]; + k_0M0 = k_MM0; + k_00M = k_M0M; + k_MM0 = neighborXcoarse[k_MM0]; + k_M0M = neighborXcoarse[k_M0M]; + k_0MM = k_MMM; + k_MMM = neighborXcoarse[k_MMM]; + + calculateMomentsOnSourceNodes( distCoarse, omegaC, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PPP, vx1_PPP, vx2_PPP, vx3_PPP, + kxyFromfcNEQ_PPP, kyzFromfcNEQ_PPP, kxzFromfcNEQ_PPP, kxxMyyFromfcNEQ_PPP, kxxMzzFromfcNEQ_PPP); + + + ////////////////////////////////////////////////////////////////////////// + // source node BNE = PPM + ////////////////////////////////////////////////////////////////////////// + // index + k_00M = k_000; + k_M0M = k_M00; + k_0MM = k_0M0; + k_MMM = k_MM0; + k_000 = k_base_M00; + k_M00 = neighborXcoarse[k_base_M00]; + k_0M0 = k_base_MM0; + k_MM0 = neighborXcoarse[k_base_MM0]; + + calculateMomentsOnSourceNodes( distCoarse, omegaC, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PPM, vx1_PPM, vx2_PPM, vx3_PPM, + kxyFromfcNEQ_PPM, kyzFromfcNEQ_PPM, kxzFromfcNEQ_PPM, kxxMyyFromfcNEQ_PPM, kxxMzzFromfcNEQ_PPM); + + ////////////////////////////////////////////////////////////////////////// + //! - Calculate coefficients for polynomial interpolation + //! + // example: a_110: derivation in x and y direction + real a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111; + real b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111; + real c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111; + real d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111; + + a_000 = (-kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_PPP + kxxMyyFromfcNEQ_MPM + kxxMyyFromfcNEQ_MPP - + kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_PMP + kxxMyyFromfcNEQ_MMM + kxxMyyFromfcNEQ_MMP - + kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_PPP + kxxMzzFromfcNEQ_MPM + kxxMzzFromfcNEQ_MPP - + kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_PMP + kxxMzzFromfcNEQ_MMM + kxxMzzFromfcNEQ_MMP - + c2o1 * kxyFromfcNEQ_PPM - c2o1 * kxyFromfcNEQ_PPP - c2o1 * kxyFromfcNEQ_MPM - c2o1 * kxyFromfcNEQ_MPP + + c2o1 * kxyFromfcNEQ_PMM + c2o1 * kxyFromfcNEQ_PMP + c2o1 * kxyFromfcNEQ_MMM + c2o1 * kxyFromfcNEQ_MMP + + c2o1 * kxzFromfcNEQ_PPM - c2o1 * kxzFromfcNEQ_PPP + c2o1 * kxzFromfcNEQ_MPM - c2o1 * kxzFromfcNEQ_MPP + + c2o1 * kxzFromfcNEQ_PMM - c2o1 * kxzFromfcNEQ_PMP + c2o1 * kxzFromfcNEQ_MMM - c2o1 * kxzFromfcNEQ_MMP + + c8o1 * vx1_PPM + c8o1 * vx1_PPP + c8o1 * vx1_MPM + c8o1 * vx1_MPP + c8o1 * vx1_PMM + c8o1 * vx1_PMP + + c8o1 * vx1_MMM + c8o1 * vx1_MMP + c2o1 * vx2_PPM + c2o1 * vx2_PPP - c2o1 * vx2_MPM - c2o1 * vx2_MPP - + c2o1 * vx2_PMM - c2o1 * vx2_PMP + c2o1 * vx2_MMM + c2o1 * vx2_MMP - c2o1 * vx3_PPM + c2o1 * vx3_PPP + + c2o1 * vx3_MPM - c2o1 * vx3_MPP - c2o1 * vx3_PMM + c2o1 * vx3_PMP + c2o1 * vx3_MMM - c2o1 * vx3_MMP) / + c64o1; + b_000 = (c2o1 * kxxMyyFromfcNEQ_PPM + c2o1 * kxxMyyFromfcNEQ_PPP + c2o1 * kxxMyyFromfcNEQ_MPM + + c2o1 * kxxMyyFromfcNEQ_MPP - c2o1 * kxxMyyFromfcNEQ_PMM - c2o1 * kxxMyyFromfcNEQ_PMP - + c2o1 * kxxMyyFromfcNEQ_MMM - c2o1 * kxxMyyFromfcNEQ_MMP - kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_PPP - + kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_MPP + kxxMzzFromfcNEQ_PMM + kxxMzzFromfcNEQ_PMP + + kxxMzzFromfcNEQ_MMM + kxxMzzFromfcNEQ_MMP - c2o1 * kxyFromfcNEQ_PPM - c2o1 * kxyFromfcNEQ_PPP + + c2o1 * kxyFromfcNEQ_MPM + c2o1 * kxyFromfcNEQ_MPP - c2o1 * kxyFromfcNEQ_PMM - c2o1 * kxyFromfcNEQ_PMP + + c2o1 * kxyFromfcNEQ_MMM + c2o1 * kxyFromfcNEQ_MMP + c2o1 * kyzFromfcNEQ_PPM - c2o1 * kyzFromfcNEQ_PPP + + c2o1 * kyzFromfcNEQ_MPM - c2o1 * kyzFromfcNEQ_MPP + c2o1 * kyzFromfcNEQ_PMM - c2o1 * kyzFromfcNEQ_PMP + + c2o1 * kyzFromfcNEQ_MMM - c2o1 * kyzFromfcNEQ_MMP + c2o1 * vx1_PPM + c2o1 * vx1_PPP - c2o1 * vx1_MPM - + c2o1 * vx1_MPP - c2o1 * vx1_PMM - c2o1 * vx1_PMP + c2o1 * vx1_MMM + c2o1 * vx1_MMP + c8o1 * vx2_PPM + + c8o1 * vx2_PPP + c8o1 * vx2_MPM + c8o1 * vx2_MPP + c8o1 * vx2_PMM + c8o1 * vx2_PMP + c8o1 * vx2_MMM + + c8o1 * vx2_MMP - c2o1 * vx3_PPM + c2o1 * vx3_PPP - c2o1 * vx3_MPM + c2o1 * vx3_MPP + c2o1 * vx3_PMM - + c2o1 * vx3_PMP + c2o1 * vx3_MMM - c2o1 * vx3_MMP) / + c64o1; + c_000 = (kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_PPP + kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_MPP + + kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_PMP + kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_MMP - + c2o1 * kxxMzzFromfcNEQ_PPM + c2o1 * kxxMzzFromfcNEQ_PPP - c2o1 * kxxMzzFromfcNEQ_MPM + + c2o1 * kxxMzzFromfcNEQ_MPP - c2o1 * kxxMzzFromfcNEQ_PMM + c2o1 * kxxMzzFromfcNEQ_PMP - + c2o1 * kxxMzzFromfcNEQ_MMM + c2o1 * kxxMzzFromfcNEQ_MMP - c2o1 * kxzFromfcNEQ_PPM - + c2o1 * kxzFromfcNEQ_PPP + c2o1 * kxzFromfcNEQ_MPM + c2o1 * kxzFromfcNEQ_MPP - c2o1 * kxzFromfcNEQ_PMM - + c2o1 * kxzFromfcNEQ_PMP + c2o1 * kxzFromfcNEQ_MMM + c2o1 * kxzFromfcNEQ_MMP - c2o1 * kyzFromfcNEQ_PPM - + c2o1 * kyzFromfcNEQ_PPP - c2o1 * kyzFromfcNEQ_MPM - c2o1 * kyzFromfcNEQ_MPP + c2o1 * kyzFromfcNEQ_PMM + + c2o1 * kyzFromfcNEQ_PMP + c2o1 * kyzFromfcNEQ_MMM + c2o1 * kyzFromfcNEQ_MMP - c2o1 * vx1_PPM + + c2o1 * vx1_PPP + c2o1 * vx1_MPM - c2o1 * vx1_MPP - c2o1 * vx1_PMM + c2o1 * vx1_PMP + c2o1 * vx1_MMM - + c2o1 * vx1_MMP - c2o1 * vx2_PPM + c2o1 * vx2_PPP - c2o1 * vx2_MPM + c2o1 * vx2_MPP + c2o1 * vx2_PMM - + c2o1 * vx2_PMP + c2o1 * vx2_MMM - c2o1 * vx2_MMP + c8o1 * vx3_PPM + c8o1 * vx3_PPP + c8o1 * vx3_MPM + + c8o1 * vx3_MPP + c8o1 * vx3_PMM + c8o1 * vx3_PMP + c8o1 * vx3_MMM + c8o1 * vx3_MMP) / + c64o1; + a_100 = (vx1_PPM + vx1_PPP - vx1_MPM - vx1_MPP + vx1_PMM + vx1_PMP - vx1_MMM - vx1_MMP) / c4o1; + b_100 = (vx2_PPM + vx2_PPP - vx2_MPM - vx2_MPP + vx2_PMM + vx2_PMP - vx2_MMM - vx2_MMP) / c4o1; + c_100 = (vx3_PPM + vx3_PPP - vx3_MPM - vx3_MPP + vx3_PMM + vx3_PMP - vx3_MMM - vx3_MMP) / c4o1; + a_200 = (kxxMyyFromfcNEQ_PPM + kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_MPP + + kxxMyyFromfcNEQ_PMM + kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_MMP + + kxxMzzFromfcNEQ_PPM + kxxMzzFromfcNEQ_PPP - kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_MPP + + kxxMzzFromfcNEQ_PMM + kxxMzzFromfcNEQ_PMP - kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_MMP + c2o1 * vx2_PPM + + c2o1 * vx2_PPP - c2o1 * vx2_MPM - c2o1 * vx2_MPP - c2o1 * vx2_PMM - c2o1 * vx2_PMP + c2o1 * vx2_MMM + + c2o1 * vx2_MMP - c2o1 * vx3_PPM + c2o1 * vx3_PPP + c2o1 * vx3_MPM - c2o1 * vx3_MPP - c2o1 * vx3_PMM + + c2o1 * vx3_PMP + c2o1 * vx3_MMM - c2o1 * vx3_MMP) / + c16o1; + b_200 = (kxyFromfcNEQ_PPM + kxyFromfcNEQ_PPP - kxyFromfcNEQ_MPM - kxyFromfcNEQ_MPP + kxyFromfcNEQ_PMM + + kxyFromfcNEQ_PMP - kxyFromfcNEQ_MMM - kxyFromfcNEQ_MMP - c2o1 * vx1_PPM - c2o1 * vx1_PPP + + c2o1 * vx1_MPM + c2o1 * vx1_MPP + c2o1 * vx1_PMM + c2o1 * vx1_PMP - c2o1 * vx1_MMM - c2o1 * vx1_MMP) / + c8o1; + c_200 = (kxzFromfcNEQ_PPM + kxzFromfcNEQ_PPP - kxzFromfcNEQ_MPM - kxzFromfcNEQ_MPP + kxzFromfcNEQ_PMM + + kxzFromfcNEQ_PMP - kxzFromfcNEQ_MMM - kxzFromfcNEQ_MMP + c2o1 * vx1_PPM - c2o1 * vx1_PPP - + c2o1 * vx1_MPM + c2o1 * vx1_MPP + c2o1 * vx1_PMM - c2o1 * vx1_PMP - c2o1 * vx1_MMM + c2o1 * vx1_MMP) / + c8o1; + a_010 = (vx1_PPM + vx1_PPP + vx1_MPM + vx1_MPP - vx1_PMM - vx1_PMP - vx1_MMM - vx1_MMP) / c4o1; + b_010 = (vx2_PPM + vx2_PPP + vx2_MPM + vx2_MPP - vx2_PMM - vx2_PMP - vx2_MMM - vx2_MMP) / c4o1; + c_010 = (vx3_PPM + vx3_PPP + vx3_MPM + vx3_MPP - vx3_PMM - vx3_PMP - vx3_MMM - vx3_MMP) / c4o1; + a_020 = (kxyFromfcNEQ_PPM + kxyFromfcNEQ_PPP + kxyFromfcNEQ_MPM + kxyFromfcNEQ_MPP - kxyFromfcNEQ_PMM - + kxyFromfcNEQ_PMP - kxyFromfcNEQ_MMM - kxyFromfcNEQ_MMP - c2o1 * vx2_PPM - c2o1 * vx2_PPP + + c2o1 * vx2_MPM + c2o1 * vx2_MPP + c2o1 * vx2_PMM + c2o1 * vx2_PMP - c2o1 * vx2_MMM - c2o1 * vx2_MMP) / + c8o1; + b_020 = (-c2o1 * kxxMyyFromfcNEQ_PPM - c2o1 * kxxMyyFromfcNEQ_PPP - c2o1 * kxxMyyFromfcNEQ_MPM - + c2o1 * kxxMyyFromfcNEQ_MPP + c2o1 * kxxMyyFromfcNEQ_PMM + c2o1 * kxxMyyFromfcNEQ_PMP + + c2o1 * kxxMyyFromfcNEQ_MMM + c2o1 * kxxMyyFromfcNEQ_MMP + kxxMzzFromfcNEQ_PPM + kxxMzzFromfcNEQ_PPP + + kxxMzzFromfcNEQ_MPM + kxxMzzFromfcNEQ_MPP - kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_PMP - + kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_MMP + c2o1 * vx1_PPM + c2o1 * vx1_PPP - c2o1 * vx1_MPM - + c2o1 * vx1_MPP - c2o1 * vx1_PMM - c2o1 * vx1_PMP + c2o1 * vx1_MMM + c2o1 * vx1_MMP - c2o1 * vx3_PPM + + c2o1 * vx3_PPP - c2o1 * vx3_MPM + c2o1 * vx3_MPP + c2o1 * vx3_PMM - c2o1 * vx3_PMP + c2o1 * vx3_MMM - + c2o1 * vx3_MMP) / + c16o1; + c_020 = (kyzFromfcNEQ_PPM + kyzFromfcNEQ_PPP + kyzFromfcNEQ_MPM + kyzFromfcNEQ_MPP - kyzFromfcNEQ_PMM - + kyzFromfcNEQ_PMP - kyzFromfcNEQ_MMM - kyzFromfcNEQ_MMP + c2o1 * vx2_PPM - c2o1 * vx2_PPP + + c2o1 * vx2_MPM - c2o1 * vx2_MPP - c2o1 * vx2_PMM + c2o1 * vx2_PMP - c2o1 * vx2_MMM + c2o1 * vx2_MMP) / + c8o1; + a_001 = (-vx1_PPM + vx1_PPP - vx1_MPM + vx1_MPP - vx1_PMM + vx1_PMP - vx1_MMM + vx1_MMP) / c4o1; + b_001 = (-vx2_PPM + vx2_PPP - vx2_MPM + vx2_MPP - vx2_PMM + vx2_PMP - vx2_MMM + vx2_MMP) / c4o1; + c_001 = (-vx3_PPM + vx3_PPP - vx3_MPM + vx3_MPP - vx3_PMM + vx3_PMP - vx3_MMM + vx3_MMP) / c4o1; + a_002 = (-kxzFromfcNEQ_PPM + kxzFromfcNEQ_PPP - kxzFromfcNEQ_MPM + kxzFromfcNEQ_MPP - kxzFromfcNEQ_PMM + + kxzFromfcNEQ_PMP - kxzFromfcNEQ_MMM + kxzFromfcNEQ_MMP + c2o1 * vx3_PPM - c2o1 * vx3_PPP - + c2o1 * vx3_MPM + c2o1 * vx3_MPP + c2o1 * vx3_PMM - c2o1 * vx3_PMP - c2o1 * vx3_MMM + c2o1 * vx3_MMP) / + c8o1; + b_002 = (-kyzFromfcNEQ_PPM + kyzFromfcNEQ_PPP - kyzFromfcNEQ_MPM + kyzFromfcNEQ_MPP - kyzFromfcNEQ_PMM + + kyzFromfcNEQ_PMP - kyzFromfcNEQ_MMM + kyzFromfcNEQ_MMP + c2o1 * vx3_PPM - c2o1 * vx3_PPP + + c2o1 * vx3_MPM - c2o1 * vx3_MPP - c2o1 * vx3_PMM + c2o1 * vx3_PMP - c2o1 * vx3_MMM + c2o1 * vx3_MMP) / + c8o1; + c_002 = (-kxxMyyFromfcNEQ_PPM + kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MPM + kxxMyyFromfcNEQ_MPP - + kxxMyyFromfcNEQ_PMM + kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MMM + kxxMyyFromfcNEQ_MMP + + c2o1 * kxxMzzFromfcNEQ_PPM - c2o1 * kxxMzzFromfcNEQ_PPP + c2o1 * kxxMzzFromfcNEQ_MPM - + c2o1 * kxxMzzFromfcNEQ_MPP + c2o1 * kxxMzzFromfcNEQ_PMM - c2o1 * kxxMzzFromfcNEQ_PMP + + c2o1 * kxxMzzFromfcNEQ_MMM - c2o1 * kxxMzzFromfcNEQ_MMP - c2o1 * vx1_PPM + c2o1 * vx1_PPP + + c2o1 * vx1_MPM - c2o1 * vx1_MPP - c2o1 * vx1_PMM + c2o1 * vx1_PMP + c2o1 * vx1_MMM - c2o1 * vx1_MMP - + c2o1 * vx2_PPM + c2o1 * vx2_PPP - c2o1 * vx2_MPM + c2o1 * vx2_MPP + c2o1 * vx2_PMM - c2o1 * vx2_PMP + + c2o1 * vx2_MMM - c2o1 * vx2_MMP) / + c16o1; + a_110 = (vx1_PPM + vx1_PPP - vx1_MPM - vx1_MPP - vx1_PMM - vx1_PMP + vx1_MMM + vx1_MMP) / c2o1; + b_110 = (vx2_PPM + vx2_PPP - vx2_MPM - vx2_MPP - vx2_PMM - vx2_PMP + vx2_MMM + vx2_MMP) / c2o1; + c_110 = (vx3_PPM + vx3_PPP - vx3_MPM - vx3_MPP - vx3_PMM - vx3_PMP + vx3_MMM + vx3_MMP) / c2o1; + a_101 = (-vx1_PPM + vx1_PPP + vx1_MPM - vx1_MPP - vx1_PMM + vx1_PMP + vx1_MMM - vx1_MMP) / c2o1; + b_101 = (-vx2_PPM + vx2_PPP + vx2_MPM - vx2_MPP - vx2_PMM + vx2_PMP + vx2_MMM - vx2_MMP) / c2o1; + c_101 = (-vx3_PPM + vx3_PPP + vx3_MPM - vx3_MPP - vx3_PMM + vx3_PMP + vx3_MMM - vx3_MMP) / c2o1; + a_011 = (-vx1_PPM + vx1_PPP - vx1_MPM + vx1_MPP + vx1_PMM - vx1_PMP + vx1_MMM - vx1_MMP) / c2o1; + b_011 = (-vx2_PPM + vx2_PPP - vx2_MPM + vx2_MPP + vx2_PMM - vx2_PMP + vx2_MMM - vx2_MMP) / c2o1; + c_011 = (-vx3_PPM + vx3_PPP - vx3_MPM + vx3_MPP + vx3_PMM - vx3_PMP + vx3_MMM - vx3_MMP) / c2o1; + + a_111 = -vx1_PPM + vx1_PPP + vx1_MPM - vx1_MPP + vx1_PMM - vx1_PMP - vx1_MMM + vx1_MMP; + b_111 = -vx2_PPM + vx2_PPP + vx2_MPM - vx2_MPP + vx2_PMM - vx2_PMP - vx2_MMM + vx2_MMP; + c_111 = -vx3_PPM + vx3_PPP + vx3_MPM - vx3_MPP + vx3_PMM - vx3_PMP - vx3_MMM + vx3_MMP; + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + real kxyAverage = c0o1; + real kyzAverage = c0o1; + real kxzAverage = c0o1; + real kxxMyyAverage = c0o1; + real kxxMzzAverage = c0o1; + + // real kxyAverage = (kxyFromfcNEQ_MMM+ + // kxyFromfcNEQ_MMP+ + // kxyFromfcNEQ_PMP+ + // kxyFromfcNEQ_PMM+ + // kxyFromfcNEQ_MPM+ + // kxyFromfcNEQ_MPP+ + // kxyFromfcNEQ_PPP+ + // kxyFromfcNEQ_PPM) * c1o8 - (a_010 + b_100); + // real kyzAverage = (kyzFromfcNEQ_MMM+ + // kyzFromfcNEQ_MMP+ + // kyzFromfcNEQ_PMP+ + // kyzFromfcNEQ_PMM+ + // kyzFromfcNEQ_MPM+ + // kyzFromfcNEQ_MPP+ + // kyzFromfcNEQ_PPP+ + // kyzFromfcNEQ_PPM) * c1o8 - (b_001 + c_010); + // real kxzAverage = (kxzFromfcNEQ_MMM+ + // kxzFromfcNEQ_MMP+ + // kxzFromfcNEQ_PMP+ + // kxzFromfcNEQ_PMM+ + // kxzFromfcNEQ_MPM+ + // kxzFromfcNEQ_MPP+ + // kxzFromfcNEQ_PPP+ + // kxzFromfcNEQ_PPM) * c1o8 - (a_001 + c_100); + // real kxxMyyAverage = (kxxMyyFromfcNEQ_MMM+ + // kxxMyyFromfcNEQ_MMP+ + // kxxMyyFromfcNEQ_PMP+ + // kxxMyyFromfcNEQ_PMM+ + // kxxMyyFromfcNEQ_MPM+ + // kxxMyyFromfcNEQ_MPP+ + // kxxMyyFromfcNEQ_PPP+ + // kxxMyyFromfcNEQ_PPM) * c1o8 - (a_100 - b_010); + // real kxxMzzAverage = (kxxMzzFromfcNEQ_MMM+ + // kxxMzzFromfcNEQ_MMP+ + // kxxMzzFromfcNEQ_PMP+ + // kxxMzzFromfcNEQ_PMM+ + // kxxMzzFromfcNEQ_MPM+ + // kxxMzzFromfcNEQ_MPP+ + // kxxMzzFromfcNEQ_PPP+ + // kxxMzzFromfcNEQ_PPM) * c1o8 - (a_100 - c_001); + + //////////////////////////////////////////////////////////////////////////////// + //! - Set the relative position of the offset cell {-1, 0, 1} + //! + real xoff = offsetCF.xOffCF[k_thread]; + real yoff = offsetCF.yOffCF[k_thread]; + real zoff = offsetCF.zOffCF[k_thread]; + + real xoff_sq = xoff * xoff; + real yoff_sq = yoff * yoff; + real zoff_sq = zoff * zoff; + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //drho + real LaplaceRho = + ((xoff != c0o1) || (yoff != c0o1) || (zoff != c0o1)) + ? c0o1 + : -c3o1 * (a_100 * a_100 + b_010 * b_010 + c_001 * c_001) - c6o1 * (b_100 * a_010 + c_100 * a_001 + c_010 * b_001); + d_000 = ( drho_PPM + drho_PPP + drho_MPM + drho_MPP + drho_PMM + drho_PMP + drho_MMM + drho_MMP) * c1o8; + d_100 = ( drho_PPM + drho_PPP - drho_MPM - drho_MPP + drho_PMM + drho_PMP - drho_MMM - drho_MMP) * c1o4; + d_010 = ( drho_PPM + drho_PPP + drho_MPM + drho_MPP - drho_PMM - drho_PMP - drho_MMM - drho_MMP) * c1o4; + d_001 = (-drho_PPM + drho_PPP - drho_MPM + drho_MPP - drho_PMM + drho_PMP - drho_MMM + drho_MMP) * c1o4; + d_110 = ( drho_PPM + drho_PPP - drho_MPM - drho_MPP - drho_PMM - drho_PMP + drho_MMM + drho_MMP) * c1o2; + d_101 = (-drho_PPM + drho_PPP + drho_MPM - drho_MPP - drho_PMM + drho_PMP + drho_MMM - drho_MMP) * c1o2; + d_011 = (-drho_PPM + drho_PPP - drho_MPM + drho_MPP + drho_PMM - drho_PMP + drho_MMM - drho_MMP) * c1o2; + d_111 = -drho_PPM + drho_PPP + drho_MPM - drho_MPP + drho_PMM - drho_PMP - drho_MMM + drho_MMP; + + ////////////////////////////////////////////////////////////////////////// + //! - Extrapolation for refinement in to the wall (polynomial coefficients) + //! + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // X------X + // | | x---x + // | ---+-+-> | ----> offset-vector + // | | x---x + // X------X + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + a_000 = a_000 + xoff * a_100 + yoff * a_010 + zoff * a_001 + xoff_sq * a_200 + yoff_sq * a_020 + zoff_sq * a_002 + + xoff * yoff * a_110 + xoff * zoff * a_101 + yoff * zoff * a_011; + a_100 = a_100 + c2o1 * xoff * a_200 + yoff * a_110 + zoff * a_101; + a_010 = a_010 + c2o1 * yoff * a_020 + xoff * a_110 + zoff * a_011; + a_001 = a_001 + c2o1 * zoff * a_002 + xoff * a_101 + yoff * a_011; + b_000 = b_000 + xoff * b_100 + yoff * b_010 + zoff * b_001 + xoff_sq * b_200 + yoff_sq * b_020 + zoff_sq * b_002 + + xoff * yoff * b_110 + xoff * zoff * b_101 + yoff * zoff * b_011; + b_100 = b_100 + c2o1 * xoff * b_200 + yoff * b_110 + zoff * b_101; + b_010 = b_010 + c2o1 * yoff * b_020 + xoff * b_110 + zoff * b_011; + b_001 = b_001 + c2o1 * zoff * b_002 + xoff * b_101 + yoff * b_011; + c_000 = c_000 + xoff * c_100 + yoff * c_010 + zoff * c_001 + xoff_sq * c_200 + yoff_sq * c_020 + zoff_sq * c_002 + + xoff * yoff * c_110 + xoff * zoff * c_101 + yoff * zoff * c_011; + c_100 = c_100 + c2o1 * xoff * c_200 + yoff * c_110 + zoff * c_101; + c_010 = c_010 + c2o1 * yoff * c_020 + xoff * c_110 + zoff * c_011; + c_001 = c_001 + c2o1 * zoff * c_002 + xoff * c_101 + yoff * c_011; + d_000 = d_000 + xoff * d_100 + yoff * d_010 + zoff * d_001 + + xoff * yoff * d_110 + xoff * zoff * d_101 + yoff * zoff * d_011; + d_100 = d_100 + yoff * d_110 + zoff * d_101; + d_010 = d_010 + xoff * d_110 + zoff * d_011; + d_001 = d_001 + xoff * d_101 + yoff * d_011; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Set all moments to zero + //! + real m_111 = c0o1; + real m_211 = c0o1; + real m_011 = c0o1; + real m_121 = c0o1; + real m_101 = c0o1; + real m_112 = c0o1; + real m_110 = c0o1; + real m_221 = c0o1; + real m_001 = c0o1; + real m_201 = c0o1; + real m_021 = c0o1; + real m_212 = c0o1; + real m_010 = c0o1; + real m_210 = c0o1; + real m_012 = c0o1; + real m_122 = c0o1; + real m_100 = c0o1; + real m_120 = c0o1; + real m_102 = c0o1; + real m_222 = c0o1; + real m_022 = c0o1; + real m_202 = c0o1; + real m_002 = c0o1; + real m_220 = c0o1; + real m_020 = c0o1; + real m_200 = c0o1; + real m_000 = c0o1; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Define aliases to use the same variable for the distributions (f's): + //! + real& f_000 = m_111; + real& f_P00 = m_211; + real& f_M00 = m_011; + real& f_0P0 = m_121; + real& f_0M0 = m_101; + real& f_00P = m_112; + real& f_00M = m_110; + real& f_PP0 = m_221; + real& f_MM0 = m_001; + real& f_PM0 = m_201; + real& f_MP0 = m_021; + real& f_P0P = m_212; + real& f_M0M = m_010; + real& f_P0M = m_210; + real& f_M0P = m_012; + real& f_0PP = m_122; + real& f_0MM = m_100; + real& f_0PM = m_120; + real& f_0MP = m_102; + real& f_PPP = m_222; + real& f_MPP = m_022; + real& f_PMP = m_202; + real& f_MMP = m_002; + real& f_PPM = m_220; + real& f_MPM = m_020; + real& f_PMM = m_200; + real& f_MMM = m_000; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Position BSW = MMM: -0.25, -0.25, -0.25 + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real x = -c1o4; + real y = -c1o4; + real z = -c1o4; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////// + //! - Set moments (zeroth to sixth order) on destination node + //! + interpolateDistributions( + x, y, z, + m_000, + m_100, m_010, m_001, + m_011, m_101, m_110, m_200, m_020, m_002, + m_111, m_210, m_012, m_201, m_021, m_120, m_102, + m_022, m_202, m_220, m_211, m_121, m_112, + m_122, m_212, m_221, + m_222, + a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, + b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, + c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, + d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, + LaplaceRho, eps_new, omegaF, + kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage + ); + + ////////////////////////////////////////////////////////////////////////// + // index of the base node and its neighbors + k_base_000 = indicesFineMMM[k_thread]; + k_base_M00 = neighborXfine [k_base_000]; + k_base_0M0 = neighborYfine [k_base_000]; + k_base_00M = neighborZfine [k_base_000]; + k_base_MM0 = neighborYfine [k_base_M00]; + k_base_M0M = neighborZfine [k_base_M00]; + k_base_0MM = neighborZfine [k_base_0M0]; + k_base_MMM = neighborZfine [k_base_MM0]; + ////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + k_000 = k_base_000; + k_M00 = k_base_M00; + k_0M0 = k_base_0M0; + k_00M = k_base_00M; + k_MM0 = k_base_MM0; + k_M0M = k_base_M0M; + k_0MM = k_base_0MM; + k_MMM = k_base_MMM; + + ////////////////////////////////////////////////////////////////////////// + //! - Write distributions: style of reading and writing the distributions from/to + //! stored arrays dependent on timestep is based on the esoteric twist algorithm + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), + //! DOI:10.3390/computation5020019 ]</b></a> + //! + (distFine.f[DIR_000])[k_000] = f_000; + (distFine.f[DIR_P00])[k_000] = f_P00; + (distFine.f[DIR_M00])[k_M00] = f_M00; + (distFine.f[DIR_0P0])[k_000] = f_0P0; + (distFine.f[DIR_0M0])[k_0M0] = f_0M0; + (distFine.f[DIR_00P])[k_000] = f_00P; + (distFine.f[DIR_00M])[k_00M] = f_00M; + (distFine.f[DIR_PP0])[k_000] = f_PP0; + (distFine.f[DIR_MM0])[k_MM0] = f_MM0; + (distFine.f[DIR_PM0])[k_0M0] = f_PM0; + (distFine.f[DIR_MP0])[k_M00] = f_MP0; + (distFine.f[DIR_P0P])[k_000] = f_P0P; + (distFine.f[DIR_M0M])[k_M0M] = f_M0M; + (distFine.f[DIR_P0M])[k_00M] = f_P0M; + (distFine.f[DIR_M0P])[k_M00] = f_M0P; + (distFine.f[DIR_0PP])[k_000] = f_0PP; + (distFine.f[DIR_0MM])[k_0MM] = f_0MM; + (distFine.f[DIR_0PM])[k_00M] = f_0PM; + (distFine.f[DIR_0MP])[k_0M0] = f_0MP; + (distFine.f[DIR_PPP])[k_000] = f_PPP; + (distFine.f[DIR_MPP])[k_M00] = f_MPP; + (distFine.f[DIR_PMP])[k_0M0] = f_PMP; + (distFine.f[DIR_MMP])[k_MM0] = f_MMP; + (distFine.f[DIR_PPM])[k_00M] = f_PPM; + (distFine.f[DIR_MPM])[k_M0M] = f_MPM; + (distFine.f[DIR_PMM])[k_0MM] = f_PMM; + (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + ////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Position TSW = MMP: -0.25, -0.25, 0.25 + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + x = -c1o4; + y = -c1o4; + z = c1o4; + + //////////////////////////////////////////////////////////////////////////////// + // Set moments (zeroth to sixth orders) on destination node + interpolateDistributions( + x, y, z, + m_000, + m_100, m_010, m_001, + m_011, m_101, m_110, m_200, m_020, m_002, + m_111, m_210, m_012, m_201, m_021, m_120, m_102, + m_022, m_202, m_220, m_211, m_121, m_112, + m_122, m_212, m_221, + m_222, + a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, + b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, + c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, + d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, + LaplaceRho, eps_new, omegaF, + kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage + ); + + //////////////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + k_000 = k_00M; + k_M00 = k_M0M; + k_0M0 = k_0MM; + k_00M = neighborZfine[k_00M]; + k_MM0 = k_MMM; + k_M0M = neighborZfine[k_M0M]; + k_0MM = neighborZfine[k_0MM]; + k_MMM = neighborZfine[k_MMM]; + + ////////////////////////////////////////////////////////////////////////// + // Write distributions + (distFine.f[DIR_000])[k_000] = f_000; + (distFine.f[DIR_P00])[k_000] = f_P00; + (distFine.f[DIR_M00])[k_M00] = f_M00; + (distFine.f[DIR_0P0])[k_000] = f_0P0; + (distFine.f[DIR_0M0])[k_0M0] = f_0M0; + (distFine.f[DIR_00P])[k_000] = f_00P; + (distFine.f[DIR_00M])[k_00M] = f_00M; + (distFine.f[DIR_PP0])[k_000] = f_PP0; + (distFine.f[DIR_MM0])[k_MM0] = f_MM0; + (distFine.f[DIR_PM0])[k_0M0] = f_PM0; + (distFine.f[DIR_MP0])[k_M00] = f_MP0; + (distFine.f[DIR_P0P])[k_000] = f_P0P; + (distFine.f[DIR_M0M])[k_M0M] = f_M0M; + (distFine.f[DIR_P0M])[k_00M] = f_P0M; + (distFine.f[DIR_M0P])[k_M00] = f_M0P; + (distFine.f[DIR_0PP])[k_000] = f_0PP; + (distFine.f[DIR_0MM])[k_0MM] = f_0MM; + (distFine.f[DIR_0PM])[k_00M] = f_0PM; + (distFine.f[DIR_0MP])[k_0M0] = f_0MP; + (distFine.f[DIR_PPP])[k_000] = f_PPP; + (distFine.f[DIR_MPP])[k_M00] = f_MPP; + (distFine.f[DIR_PMP])[k_0M0] = f_PMP; + (distFine.f[DIR_MMP])[k_MM0] = f_MMP; + (distFine.f[DIR_PPM])[k_00M] = f_PPM; + (distFine.f[DIR_MPM])[k_M0M] = f_MPM; + (distFine.f[DIR_PMM])[k_0MM] = f_PMM; + (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Position TSE = PMP: 0.25, -0.25, 0.25 + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + x = c1o4; + y = -c1o4; + z = c1o4; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////// + // Set moments (zeroth to sixth orders) on destination node + interpolateDistributions( + x, y, z, + m_000, + m_100, m_010, m_001, + m_011, m_101, m_110, m_200, m_020, m_002, + m_111, m_210, m_012, m_201, m_021, m_120, m_102, + m_022, m_202, m_220, m_211, m_121, m_112, + m_122, m_212, m_221, + m_222, + a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, + b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, + c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, + d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, + LaplaceRho, eps_new, omegaF, + kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage + ); + + //////////////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + k_000 = k_M00; + k_M00 = neighborXfine[k_M00]; + k_0M0 = k_MM0; + k_00M = k_M0M; + k_MM0 = neighborXfine[k_MM0]; + k_M0M = neighborXfine[k_M0M]; + k_0MM = k_MMM; + k_MMM = neighborXfine[k_MMM]; + + ////////////////////////////////////////////////////////////////////////// + // Write distributions + (distFine.f[DIR_000])[k_000] = f_000; + (distFine.f[DIR_P00])[k_000] = f_P00; + (distFine.f[DIR_M00])[k_M00] = f_M00; + (distFine.f[DIR_0P0])[k_000] = f_0P0; + (distFine.f[DIR_0M0])[k_0M0] = f_0M0; + (distFine.f[DIR_00P])[k_000] = f_00P; + (distFine.f[DIR_00M])[k_00M] = f_00M; + (distFine.f[DIR_PP0])[k_000] = f_PP0; + (distFine.f[DIR_MM0])[k_MM0] = f_MM0; + (distFine.f[DIR_PM0])[k_0M0] = f_PM0; + (distFine.f[DIR_MP0])[k_M00] = f_MP0; + (distFine.f[DIR_P0P])[k_000] = f_P0P; + (distFine.f[DIR_M0M])[k_M0M] = f_M0M; + (distFine.f[DIR_P0M])[k_00M] = f_P0M; + (distFine.f[DIR_M0P])[k_M00] = f_M0P; + (distFine.f[DIR_0PP])[k_000] = f_0PP; + (distFine.f[DIR_0MM])[k_0MM] = f_0MM; + (distFine.f[DIR_0PM])[k_00M] = f_0PM; + (distFine.f[DIR_0MP])[k_0M0] = f_0MP; + (distFine.f[DIR_PPP])[k_000] = f_PPP; + (distFine.f[DIR_MPP])[k_M00] = f_MPP; + (distFine.f[DIR_PMP])[k_0M0] = f_PMP; + (distFine.f[DIR_MMP])[k_MM0] = f_MMP; + (distFine.f[DIR_PPM])[k_00M] = f_PPM; + (distFine.f[DIR_MPM])[k_M0M] = f_MPM; + (distFine.f[DIR_PMM])[k_0MM] = f_PMM; + (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Position BSE = PMM: 0.25, -0.25, -0.25 + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + x = c1o4; + y = -c1o4; + z = -c1o4; + + //////////////////////////////////////////////////////////////////////////////// + // Set moments (zeroth to sixth orders) on destination node + interpolateDistributions( + x, y, z, + m_000, + m_100, m_010, m_001, + m_011, m_101, m_110, m_200, m_020, m_002, + m_111, m_210, m_012, m_201, m_021, m_120, m_102, + m_022, m_202, m_220, m_211, m_121, m_112, + m_122, m_212, m_221, + m_222, + a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, + b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, + c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, + d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, + LaplaceRho, eps_new, omegaF, + kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage + ); + + //////////////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + k_00M = k_000; + k_M0M = k_M00; + k_0MM = k_0M0; + k_MMM = k_MM0; + k_000 = k_base_M00; + k_M00 = neighborXfine[k_base_M00]; + k_0M0 = k_base_MM0; + k_MM0 = neighborXfine[k_base_MM0]; + + ////////////////////////////////////////////////////////////////////////// + // Write distributions + (distFine.f[DIR_000])[k_000] = f_000; + (distFine.f[DIR_P00])[k_000] = f_P00; + (distFine.f[DIR_M00])[k_M00] = f_M00; + (distFine.f[DIR_0P0])[k_000] = f_0P0; + (distFine.f[DIR_0M0])[k_0M0] = f_0M0; + (distFine.f[DIR_00P])[k_000] = f_00P; + (distFine.f[DIR_00M])[k_00M] = f_00M; + (distFine.f[DIR_PP0])[k_000] = f_PP0; + (distFine.f[DIR_MM0])[k_MM0] = f_MM0; + (distFine.f[DIR_PM0])[k_0M0] = f_PM0; + (distFine.f[DIR_MP0])[k_M00] = f_MP0; + (distFine.f[DIR_P0P])[k_000] = f_P0P; + (distFine.f[DIR_M0M])[k_M0M] = f_M0M; + (distFine.f[DIR_P0M])[k_00M] = f_P0M; + (distFine.f[DIR_M0P])[k_M00] = f_M0P; + (distFine.f[DIR_0PP])[k_000] = f_0PP; + (distFine.f[DIR_0MM])[k_0MM] = f_0MM; + (distFine.f[DIR_0PM])[k_00M] = f_0PM; + (distFine.f[DIR_0MP])[k_0M0] = f_0MP; + (distFine.f[DIR_PPP])[k_000] = f_PPP; + (distFine.f[DIR_MPP])[k_M00] = f_MPP; + (distFine.f[DIR_PMP])[k_0M0] = f_PMP; + (distFine.f[DIR_MMP])[k_MM0] = f_MMP; + (distFine.f[DIR_PPM])[k_00M] = f_PPM; + (distFine.f[DIR_MPM])[k_M0M] = f_MPM; + (distFine.f[DIR_PMM])[k_0MM] = f_PMM; + (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Position BNW = MPM: -0.25, 0.25, -0.25 + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + x = -c1o4; + y = c1o4; + z = -c1o4; + + //////////////////////////////////////////////////////////////////////////////// + // Set moments (zeroth to sixth orders) on destination node + interpolateDistributions( + x, y, z, + m_000, + m_100, m_010, m_001, + m_011, m_101, m_110, m_200, m_020, m_002, + m_111, m_210, m_012, m_201, m_021, m_120, m_102, + m_022, m_202, m_220, m_211, m_121, m_112, + m_122, m_212, m_221, + m_222, + a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, + b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, + c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, + d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, + LaplaceRho, eps_new, omegaF, + kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage + ); + + ////////////////////////////////////////////////////////////////////////// + // index of the base node and its neighbors + k_base_000 = k_base_0M0; + k_base_M00 = k_base_MM0; + k_base_0M0 = neighborYfine[k_base_0M0]; + k_base_00M = k_base_0MM; + k_base_MM0 = neighborYfine[k_base_MM0]; + k_base_M0M = k_base_MMM; + k_base_0MM = neighborYfine[k_base_0MM]; + k_base_MMM = neighborYfine[k_base_MMM]; + + ////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + k_000 = k_base_000; + k_M00 = k_base_M00; + k_0M0 = k_base_0M0; + k_00M = k_base_00M; + k_MM0 = k_base_MM0; + k_M0M = k_base_M0M; + k_0MM = k_base_0MM; + k_MMM = k_base_MMM; + + ////////////////////////////////////////////////////////////////////////// + // Write distributions + (distFine.f[DIR_000])[k_000] = f_000; + (distFine.f[DIR_P00])[k_000] = f_P00; + (distFine.f[DIR_M00])[k_M00] = f_M00; + (distFine.f[DIR_0P0])[k_000] = f_0P0; + (distFine.f[DIR_0M0])[k_0M0] = f_0M0; + (distFine.f[DIR_00P])[k_000] = f_00P; + (distFine.f[DIR_00M])[k_00M] = f_00M; + (distFine.f[DIR_PP0])[k_000] = f_PP0; + (distFine.f[DIR_MM0])[k_MM0] = f_MM0; + (distFine.f[DIR_PM0])[k_0M0] = f_PM0; + (distFine.f[DIR_MP0])[k_M00] = f_MP0; + (distFine.f[DIR_P0P])[k_000] = f_P0P; + (distFine.f[DIR_M0M])[k_M0M] = f_M0M; + (distFine.f[DIR_P0M])[k_00M] = f_P0M; + (distFine.f[DIR_M0P])[k_M00] = f_M0P; + (distFine.f[DIR_0PP])[k_000] = f_0PP; + (distFine.f[DIR_0MM])[k_0MM] = f_0MM; + (distFine.f[DIR_0PM])[k_00M] = f_0PM; + (distFine.f[DIR_0MP])[k_0M0] = f_0MP; + (distFine.f[DIR_PPP])[k_000] = f_PPP; + (distFine.f[DIR_MPP])[k_M00] = f_MPP; + (distFine.f[DIR_PMP])[k_0M0] = f_PMP; + (distFine.f[DIR_MMP])[k_MM0] = f_MMP; + (distFine.f[DIR_PPM])[k_00M] = f_PPM; + (distFine.f[DIR_MPM])[k_M0M] = f_MPM; + (distFine.f[DIR_PMM])[k_0MM] = f_PMM; + (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Position TNW = MPP: -0.25, 0.25, 0.25 + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + x = -c1o4; + y = c1o4; + z = c1o4; + + //////////////////////////////////////////////////////////////////////////////// + // Set moments (zeroth to sixth orders) on destination node + interpolateDistributions( + x, y, z, + m_000, + m_100, m_010, m_001, + m_011, m_101, m_110, m_200, m_020, m_002, + m_111, m_210, m_012, m_201, m_021, m_120, m_102, + m_022, m_202, m_220, m_211, m_121, m_112, + m_122, m_212, m_221, + m_222, + a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, + b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, + c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, + d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, + LaplaceRho, eps_new, omegaF, + kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage + ); + + //////////////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + k_000 = k_00M; + k_M00 = k_M0M; + k_0M0 = k_0MM; + k_00M = neighborZfine[k_00M]; + k_MM0 = k_MMM; + k_M0M = neighborZfine[k_M0M]; + k_0MM = neighborZfine[k_0MM]; + k_MMM = neighborZfine[k_MMM]; + + ////////////////////////////////////////////////////////////////////////// + // Write distributions + (distFine.f[DIR_000])[k_000] = f_000; + (distFine.f[DIR_P00])[k_000] = f_P00; + (distFine.f[DIR_M00])[k_M00] = f_M00; + (distFine.f[DIR_0P0])[k_000] = f_0P0; + (distFine.f[DIR_0M0])[k_0M0] = f_0M0; + (distFine.f[DIR_00P])[k_000] = f_00P; + (distFine.f[DIR_00M])[k_00M] = f_00M; + (distFine.f[DIR_PP0])[k_000] = f_PP0; + (distFine.f[DIR_MM0])[k_MM0] = f_MM0; + (distFine.f[DIR_PM0])[k_0M0] = f_PM0; + (distFine.f[DIR_MP0])[k_M00] = f_MP0; + (distFine.f[DIR_P0P])[k_000] = f_P0P; + (distFine.f[DIR_M0M])[k_M0M] = f_M0M; + (distFine.f[DIR_P0M])[k_00M] = f_P0M; + (distFine.f[DIR_M0P])[k_M00] = f_M0P; + (distFine.f[DIR_0PP])[k_000] = f_0PP; + (distFine.f[DIR_0MM])[k_0MM] = f_0MM; + (distFine.f[DIR_0PM])[k_00M] = f_0PM; + (distFine.f[DIR_0MP])[k_0M0] = f_0MP; + (distFine.f[DIR_PPP])[k_000] = f_PPP; + (distFine.f[DIR_MPP])[k_M00] = f_MPP; + (distFine.f[DIR_PMP])[k_0M0] = f_PMP; + (distFine.f[DIR_MMP])[k_MM0] = f_MMP; + (distFine.f[DIR_PPM])[k_00M] = f_PPM; + (distFine.f[DIR_MPM])[k_M0M] = f_MPM; + (distFine.f[DIR_PMM])[k_0MM] = f_PMM; + (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Position TNE = PPP: 0.25, 0.25, 0.25 + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + x = c1o4; + y = c1o4; + z = c1o4; + + //////////////////////////////////////////////////////////////////////////////// + // Set moments (zeroth to sixth orders) on destination node + interpolateDistributions( + x, y, z, + m_000, + m_100, m_010, m_001, + m_011, m_101, m_110, m_200, m_020, m_002, + m_111, m_210, m_012, m_201, m_021, m_120, m_102, + m_022, m_202, m_220, m_211, m_121, m_112, + m_122, m_212, m_221, + m_222, + a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, + b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, + c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, + d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, + LaplaceRho, eps_new, omegaF, + kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage + ); + + //////////////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + k_000 = k_M00; + k_M00 = neighborXfine[k_M00]; + k_0M0 = k_MM0; + k_00M = k_M0M; + k_MM0 = neighborXfine[k_MM0]; + k_M0M = neighborXfine[k_M0M]; + k_0MM = k_MMM; + k_MMM = neighborXfine[k_MMM]; + + ////////////////////////////////////////////////////////////////////////// + // Write distributions + (distFine.f[DIR_000])[k_000] = f_000; + (distFine.f[DIR_P00])[k_000] = f_P00; + (distFine.f[DIR_M00])[k_M00] = f_M00; + (distFine.f[DIR_0P0])[k_000] = f_0P0; + (distFine.f[DIR_0M0])[k_0M0] = f_0M0; + (distFine.f[DIR_00P])[k_000] = f_00P; + (distFine.f[DIR_00M])[k_00M] = f_00M; + (distFine.f[DIR_PP0])[k_000] = f_PP0; + (distFine.f[DIR_MM0])[k_MM0] = f_MM0; + (distFine.f[DIR_PM0])[k_0M0] = f_PM0; + (distFine.f[DIR_MP0])[k_M00] = f_MP0; + (distFine.f[DIR_P0P])[k_000] = f_P0P; + (distFine.f[DIR_M0M])[k_M0M] = f_M0M; + (distFine.f[DIR_P0M])[k_00M] = f_P0M; + (distFine.f[DIR_M0P])[k_M00] = f_M0P; + (distFine.f[DIR_0PP])[k_000] = f_0PP; + (distFine.f[DIR_0MM])[k_0MM] = f_0MM; + (distFine.f[DIR_0PM])[k_00M] = f_0PM; + (distFine.f[DIR_0MP])[k_0M0] = f_0MP; + (distFine.f[DIR_PPP])[k_000] = f_PPP; + (distFine.f[DIR_MPP])[k_M00] = f_MPP; + (distFine.f[DIR_PMP])[k_0M0] = f_PMP; + (distFine.f[DIR_MMP])[k_MM0] = f_MMP; + (distFine.f[DIR_PPM])[k_00M] = f_PPM; + (distFine.f[DIR_MPM])[k_M0M] = f_MPM; + (distFine.f[DIR_PMM])[k_0MM] = f_PMM; + (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + //Position BNE = PPM: 0.25, 0.25, -0.25 + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + x = c1o4; + y = c1o4; + z = -c1o4; + + //////////////////////////////////////////////////////////////////////////////// + // Set moments (zeroth to sixth orders) on destination node + interpolateDistributions( + x, y, z, + m_000, + m_100, m_010, m_001, + m_011, m_101, m_110, m_200, m_020, m_002, + m_111, m_210, m_012, m_201, m_021, m_120, m_102, + m_022, m_202, m_220, m_211, m_121, m_112, + m_122, m_212, m_221, + m_222, + a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, + b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, + c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, + d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, + LaplaceRho, eps_new, omegaF, + kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage + ); + + //////////////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + k_00M = k_000; + k_M0M = k_M00; + k_0MM = k_0M0; + k_MMM = k_MM0; + k_000 = k_base_M00; + k_M00 = neighborXfine[k_base_M00]; + k_0M0 = k_base_MM0; + k_MM0 = neighborXfine[k_base_MM0]; + + ////////////////////////////////////////////////////////////////////////// + // Write distributions + (distFine.f[DIR_000])[k_000] = f_000; + (distFine.f[DIR_P00])[k_000] = f_P00; + (distFine.f[DIR_M00])[k_M00] = f_M00; + (distFine.f[DIR_0P0])[k_000] = f_0P0; + (distFine.f[DIR_0M0])[k_0M0] = f_0M0; + (distFine.f[DIR_00P])[k_000] = f_00P; + (distFine.f[DIR_00M])[k_00M] = f_00M; + (distFine.f[DIR_PP0])[k_000] = f_PP0; + (distFine.f[DIR_MM0])[k_MM0] = f_MM0; + (distFine.f[DIR_PM0])[k_0M0] = f_PM0; + (distFine.f[DIR_MP0])[k_M00] = f_MP0; + (distFine.f[DIR_P0P])[k_000] = f_P0P; + (distFine.f[DIR_M0M])[k_M0M] = f_M0M; + (distFine.f[DIR_P0M])[k_00M] = f_P0M; + (distFine.f[DIR_M0P])[k_M00] = f_M0P; + (distFine.f[DIR_0PP])[k_000] = f_0PP; + (distFine.f[DIR_0MM])[k_0MM] = f_0MM; + (distFine.f[DIR_0PM])[k_00M] = f_0PM; + (distFine.f[DIR_0MP])[k_0M0] = f_0MP; + (distFine.f[DIR_PPP])[k_000] = f_PPP; + (distFine.f[DIR_MPP])[k_M00] = f_MPP; + (distFine.f[DIR_PMP])[k_0M0] = f_PMP; + (distFine.f[DIR_MMP])[k_MM0] = f_MMP; + (distFine.f[DIR_PPM])[k_00M] = f_PPM; + (distFine.f[DIR_MPM])[k_M0M] = f_MPM; + (distFine.f[DIR_PMM])[k_0MM] = f_PMM; + (distFine.f[DIR_MMM])[k_MMM] = f_MMM; +} diff --git a/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleFC_compressible.cu b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleFC_compressible.cu new file mode 100644 index 0000000000000000000000000000000000000000..3ab8b9d20279eff341ca42d20cee9fe7550a2039 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleFC_compressible.cu @@ -0,0 +1,686 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file scaleFC_compressible.cu +//! \ingroup GPU/GridScaling +//! \author Martin Schoenherr, Anna Wellmann +//======================================================================================= + +#include "Kernel/Utilities/DistributionHelper.cuh" +#include "Kernel/Utilities/ChimeraTransformation.h" +#include "Kernel/Utilities/ScalingHelperFunctions.h" + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + +////////////////////////////////////////////////////////////////////////// +//! \brief Interpolate from fine to coarse +//! \details This scaling function is designed for the Cumulant K17 Kernel chimera collision kernel +//! The function is executed in the following steps: +//! + +// based on scaleFC_RhoSq_comp_27 +__global__ void scaleFC_compressible( + real *distributionsCoarse, + real *distributionsFine, + unsigned int *neighborXcoarse, + unsigned int *neighborYcoarse, + unsigned int *neighborZcoarse, + unsigned int *neighborXfine, + unsigned int *neighborYfine, + unsigned int *neighborZfine, + unsigned int numberOfLBnodesCoarse, + unsigned int numberOfLBnodesFine, + bool isEvenTimestep, + unsigned int *indicesCoarse000, + unsigned int *indicesFineMMM, + unsigned int numberOfInterfaceNodes, + real omegaCoarse, + real omegaFine, + OffFC offsetFC) +{ + //////////////////////////////////////////////////////////////////////////////// + //! - Get the thread index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned k_thread = vf::gpu::getNodeIndex(); + + ////////////////////////////////////////////////////////////////////////// + //! - Return for non-interface node + if (k_thread >= numberOfInterfaceNodes) + return; + + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on + //! timestep is based on the esoteric twist algorithm \ref <a + //! href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), + //! DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 distFine = vf::gpu::getDistributionReferences27(distributionsFine, numberOfLBnodesFine, true); + Distributions27 distCoarse = vf::gpu::getDistributionReferences27(distributionsCoarse, numberOfLBnodesCoarse, isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - declare local variables for source nodes + //! + real eps_new = c2o1; // ratio of grid resolutions + real omegaF = omegaFine; + real omegaC = omegaCoarse; + + // zeroth and first order moments at the source nodes + real drho_PPP, vx1_PPP, vx2_PPP, vx3_PPP; + real drho_MPP, vx1_MPP, vx2_MPP, vx3_MPP; + real drho_PMP, vx1_PMP, vx2_PMP, vx3_PMP; + real drho_MMP, vx1_MMP, vx2_MMP, vx3_MMP; + real drho_PPM, vx1_PPM, vx2_PPM, vx3_PPM; + real drho_MPM, vx1_MPM, vx2_MPM, vx3_MPM; + real drho_PMM, vx1_PMM, vx2_PMM, vx3_PMM; + real drho_MMM, vx1_MMM, vx2_MMM, vx3_MMM; + + // second order moments at the source nodes + real kxyFromfcNEQ_PPP, kyzFromfcNEQ_PPP, kxzFromfcNEQ_PPP, kxxMyyFromfcNEQ_PPP, kxxMzzFromfcNEQ_PPP; + real kxyFromfcNEQ_MPP, kyzFromfcNEQ_MPP, kxzFromfcNEQ_MPP, kxxMyyFromfcNEQ_MPP, kxxMzzFromfcNEQ_MPP; + real kxyFromfcNEQ_PMP, kyzFromfcNEQ_PMP, kxzFromfcNEQ_PMP, kxxMyyFromfcNEQ_PMP, kxxMzzFromfcNEQ_PMP; + real kxyFromfcNEQ_MMP, kyzFromfcNEQ_MMP, kxzFromfcNEQ_MMP, kxxMyyFromfcNEQ_MMP, kxxMzzFromfcNEQ_MMP; + real kxyFromfcNEQ_PPM, kyzFromfcNEQ_PPM, kxzFromfcNEQ_PPM, kxxMyyFromfcNEQ_PPM, kxxMzzFromfcNEQ_PPM; + real kxyFromfcNEQ_MPM, kyzFromfcNEQ_MPM, kxzFromfcNEQ_MPM, kxxMyyFromfcNEQ_MPM, kxxMzzFromfcNEQ_MPM; + real kxyFromfcNEQ_PMM, kyzFromfcNEQ_PMM, kxzFromfcNEQ_PMM, kxxMyyFromfcNEQ_PMM, kxxMzzFromfcNEQ_PMM; + real kxyFromfcNEQ_MMM, kyzFromfcNEQ_MMM, kxzFromfcNEQ_MMM, kxxMyyFromfcNEQ_MMM, kxxMzzFromfcNEQ_MMM; + + ////////////////////////////////////////////////////////////////////////// + //! - Calculate moments for each source node + //! + ////////////////////////////////////////////////////////////////////////// + // source node BSW = MMM + ////////////////////////////////////////////////////////////////////////// + // index of the base node and its neighbors + unsigned int k_base_000 = indicesFineMMM[k_thread]; + unsigned int k_base_M00 = neighborXfine [k_base_000]; + unsigned int k_base_0M0 = neighborYfine [k_base_000]; + unsigned int k_base_00M = neighborZfine [k_base_000]; + unsigned int k_base_MM0 = neighborYfine [k_base_M00]; + unsigned int k_base_M0M = neighborZfine [k_base_M00]; + unsigned int k_base_0MM = neighborZfine [k_base_0M0]; + unsigned int k_base_MMM = neighborZfine [k_base_MM0]; + ////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + unsigned int k_000 = k_base_000; + unsigned int k_M00 = k_base_M00; + unsigned int k_0M0 = k_base_0M0; + unsigned int k_00M = k_base_00M; + unsigned int k_MM0 = k_base_MM0; + unsigned int k_M0M = k_base_M0M; + unsigned int k_0MM = k_base_0MM; + unsigned int k_MMM = k_base_MMM; + + calculateMomentsOnSourceNodes( distFine, omegaF, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MMM, vx1_MMM, vx2_MMM, vx3_MMM, + kxyFromfcNEQ_MMM, kyzFromfcNEQ_MMM, kxzFromfcNEQ_MMM, kxxMyyFromfcNEQ_MMM, kxxMzzFromfcNEQ_MMM); + + ////////////////////////////////////////////////////////////////////////// + // source node TSW = MMP + ////////////////////////////////////////////////////////////////////////// + // Set neighbor indices - has to be recalculated for the new source node + k_000 = k_00M; + k_M00 = k_M0M; + k_0M0 = k_0MM; + k_00M = neighborZfine[k_00M]; + k_MM0 = k_MMM; + k_M0M = neighborZfine[k_M0M]; + k_0MM = neighborZfine[k_0MM]; + k_MMM = neighborZfine[k_MMM]; + + calculateMomentsOnSourceNodes( distFine, omegaF, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MMP, vx1_MMP, vx2_MMP, vx3_MMP, + kxyFromfcNEQ_MMP, kyzFromfcNEQ_MMP, kxzFromfcNEQ_MMP, kxxMyyFromfcNEQ_MMP, kxxMzzFromfcNEQ_MMP); + + ////////////////////////////////////////////////////////////////////////// + // source node TSE = PMP + ////////////////////////////////////////////////////////////////////////// + // index + k_000 = k_M00; + k_M00 = neighborXfine[k_M00]; + k_0M0 = k_MM0; + k_00M = k_M0M; + k_MM0 = neighborXfine[k_MM0]; + k_M0M = neighborXfine[k_M0M]; + k_0MM = k_MMM; + k_MMM = neighborXfine[k_MMM]; + + calculateMomentsOnSourceNodes( distFine, omegaF, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PMP, vx1_PMP, vx2_PMP, vx3_PMP, + kxyFromfcNEQ_PMP, kyzFromfcNEQ_PMP, kxzFromfcNEQ_PMP, kxxMyyFromfcNEQ_PMP, kxxMzzFromfcNEQ_PMP); + + ////////////////////////////////////////////////////////////////////////// + // source node BSE = PMM + ////////////////////////////////////////////////////////////////////////// + // index + k_00M = k_000; + k_M0M = k_M00; + k_0MM = k_0M0; + k_MMM = k_MM0; + k_000 = k_base_M00; + k_M00 = neighborXfine[k_base_M00]; + k_0M0 = k_base_MM0; + k_MM0 = neighborXfine[k_base_MM0]; + + calculateMomentsOnSourceNodes( distFine, omegaF, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PMM, vx1_PMM, vx2_PMM, vx3_PMM, + kxyFromfcNEQ_PMM, kyzFromfcNEQ_PMM, kxzFromfcNEQ_PMM, kxxMyyFromfcNEQ_PMM, kxxMzzFromfcNEQ_PMM); + + ////////////////////////////////////////////////////////////////////////// + // source node BNW = MPM + ////////////////////////////////////////////////////////////////////////// + // index of the base node and its neighbors --> indices of all source nodes + k_base_000 = k_base_0M0; + k_base_M00 = k_base_MM0; + k_base_0M0 = neighborYfine[k_base_0M0]; + k_base_00M = k_base_0MM; + k_base_MM0 = neighborYfine[k_base_MM0]; + k_base_M0M = k_base_MMM; + k_base_0MM = neighborYfine[k_base_0MM]; + k_base_MMM = neighborYfine[k_base_MMM]; + ////////////////////////////////////////////////////////////////////////// + // index + k_000 = k_base_000; + k_M00 = k_base_M00; + k_0M0 = k_base_0M0; + k_00M = k_base_00M; + k_MM0 = k_base_MM0; + k_M0M = k_base_M0M; + k_0MM = k_base_0MM; + k_MMM = k_base_MMM; + + calculateMomentsOnSourceNodes( distFine, omegaF, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MPM, vx1_MPM, vx2_MPM, vx3_MPM, + kxyFromfcNEQ_MPM, kyzFromfcNEQ_MPM, kxzFromfcNEQ_MPM, kxxMyyFromfcNEQ_MPM, kxxMzzFromfcNEQ_MPM); + + ////////////////////////////////////////////////////////////////////////// + // source node TNW = MPP + ////////////////////////////////////////////////////////////////////////// + // index + k_000 = k_00M; + k_M00 = k_M0M; + k_0M0 = k_0MM; + k_00M = neighborZfine[k_00M]; + k_MM0 = k_MMM; + k_M0M = neighborZfine[k_M0M]; + k_0MM = neighborZfine[k_0MM]; + k_MMM = neighborZfine[k_MMM]; + + calculateMomentsOnSourceNodes( distFine, omegaF, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MPP, vx1_MPP, vx2_MPP, vx3_MPP, + kxyFromfcNEQ_MPP, kyzFromfcNEQ_MPP, kxzFromfcNEQ_MPP, kxxMyyFromfcNEQ_MPP, kxxMzzFromfcNEQ_MPP); + + ////////////////////////////////////////////////////////////////////////// + // source node TNE = PPP + ////////////////////////////////////////////////////////////////////////// + // index + k_000 = k_M00; + k_M00 = neighborXfine[k_M00]; + k_0M0 = k_MM0; + k_00M = k_M0M; + k_MM0 = neighborXfine[k_MM0]; + k_M0M = neighborXfine[k_M0M]; + k_0MM = k_MMM; + k_MMM = neighborXfine[k_MMM]; + + calculateMomentsOnSourceNodes( distFine, omegaF, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PPP, vx1_PPP, vx2_PPP, vx3_PPP, + kxyFromfcNEQ_PPP, kyzFromfcNEQ_PPP, kxzFromfcNEQ_PPP, kxxMyyFromfcNEQ_PPP, kxxMzzFromfcNEQ_PPP); + + ////////////////////////////////////////////////////////////////////////// + // source node BNE = PPM + ////////////////////////////////////////////////////////////////////////// + // index + k_00M = k_000; + k_M0M = k_M00; + k_0MM = k_0M0; + k_MMM = k_MM0; + k_000 = k_base_M00; + k_M00 = neighborXfine[k_base_M00]; + k_0M0 = k_base_MM0; + k_MM0 = neighborXfine[k_base_MM0]; + + calculateMomentsOnSourceNodes( distFine, omegaF, + k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PPM, vx1_PPM, vx2_PPM, vx3_PPM, + kxyFromfcNEQ_PPM, kyzFromfcNEQ_PPM, kxzFromfcNEQ_PPM, kxxMyyFromfcNEQ_PPM, kxxMzzFromfcNEQ_PPM); + + ////////////////////////////////////////////////////////////////////////// + //! - Calculate coefficients for polynomial interpolation + //! + // example: a_110: derivation in x and y direction + real a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011; + real b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011; + real c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011; + real d_000, d_100, d_010, d_001, d_110, d_101, d_011; + + a_000 = (-kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_PPP + kxxMyyFromfcNEQ_MPM + kxxMyyFromfcNEQ_MPP - + kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_PMP + kxxMyyFromfcNEQ_MMM + kxxMyyFromfcNEQ_MMP - + kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_PPP + kxxMzzFromfcNEQ_MPM + kxxMzzFromfcNEQ_MPP - + kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_PMP + kxxMzzFromfcNEQ_MMM + kxxMzzFromfcNEQ_MMP - + c2o1 * kxyFromfcNEQ_PPM - c2o1 * kxyFromfcNEQ_PPP - c2o1 * kxyFromfcNEQ_MPM - c2o1 * kxyFromfcNEQ_MPP + + c2o1 * kxyFromfcNEQ_PMM + c2o1 * kxyFromfcNEQ_PMP + c2o1 * kxyFromfcNEQ_MMM + c2o1 * kxyFromfcNEQ_MMP + + c2o1 * kxzFromfcNEQ_PPM - c2o1 * kxzFromfcNEQ_PPP + c2o1 * kxzFromfcNEQ_MPM - c2o1 * kxzFromfcNEQ_MPP + + c2o1 * kxzFromfcNEQ_PMM - c2o1 * kxzFromfcNEQ_PMP + c2o1 * kxzFromfcNEQ_MMM - c2o1 * kxzFromfcNEQ_MMP + + c8o1 * vx1_PPM + c8o1 * vx1_PPP + c8o1 * vx1_MPM + c8o1 * vx1_MPP + c8o1 * vx1_PMM + c8o1 * vx1_PMP + + c8o1 * vx1_MMM + c8o1 * vx1_MMP + c2o1 * vx2_PPM + c2o1 * vx2_PPP - c2o1 * vx2_MPM - c2o1 * vx2_MPP - + c2o1 * vx2_PMM - c2o1 * vx2_PMP + c2o1 * vx2_MMM + c2o1 * vx2_MMP - c2o1 * vx3_PPM + c2o1 * vx3_PPP + + c2o1 * vx3_MPM - c2o1 * vx3_MPP - c2o1 * vx3_PMM + c2o1 * vx3_PMP + c2o1 * vx3_MMM - c2o1 * vx3_MMP) / + c64o1; + b_000 = (c2o1 * kxxMyyFromfcNEQ_PPM + c2o1 * kxxMyyFromfcNEQ_PPP + c2o1 * kxxMyyFromfcNEQ_MPM + + c2o1 * kxxMyyFromfcNEQ_MPP - c2o1 * kxxMyyFromfcNEQ_PMM - c2o1 * kxxMyyFromfcNEQ_PMP - + c2o1 * kxxMyyFromfcNEQ_MMM - c2o1 * kxxMyyFromfcNEQ_MMP - kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_PPP - + kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_MPP + kxxMzzFromfcNEQ_PMM + kxxMzzFromfcNEQ_PMP + + kxxMzzFromfcNEQ_MMM + kxxMzzFromfcNEQ_MMP - c2o1 * kxyFromfcNEQ_PPM - c2o1 * kxyFromfcNEQ_PPP + + c2o1 * kxyFromfcNEQ_MPM + c2o1 * kxyFromfcNEQ_MPP - c2o1 * kxyFromfcNEQ_PMM - c2o1 * kxyFromfcNEQ_PMP + + c2o1 * kxyFromfcNEQ_MMM + c2o1 * kxyFromfcNEQ_MMP + c2o1 * kyzFromfcNEQ_PPM - c2o1 * kyzFromfcNEQ_PPP + + c2o1 * kyzFromfcNEQ_MPM - c2o1 * kyzFromfcNEQ_MPP + c2o1 * kyzFromfcNEQ_PMM - c2o1 * kyzFromfcNEQ_PMP + + c2o1 * kyzFromfcNEQ_MMM - c2o1 * kyzFromfcNEQ_MMP + c2o1 * vx1_PPM + c2o1 * vx1_PPP - c2o1 * vx1_MPM - + c2o1 * vx1_MPP - c2o1 * vx1_PMM - c2o1 * vx1_PMP + c2o1 * vx1_MMM + c2o1 * vx1_MMP + c8o1 * vx2_PPM + + c8o1 * vx2_PPP + c8o1 * vx2_MPM + c8o1 * vx2_MPP + c8o1 * vx2_PMM + c8o1 * vx2_PMP + c8o1 * vx2_MMM + + c8o1 * vx2_MMP - c2o1 * vx3_PPM + c2o1 * vx3_PPP - c2o1 * vx3_MPM + c2o1 * vx3_MPP + c2o1 * vx3_PMM - + c2o1 * vx3_PMP + c2o1 * vx3_MMM - c2o1 * vx3_MMP) / + c64o1; + c_000 = (kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_PPP + kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_MPP + + kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_PMP + kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_MMP - + c2o1 * kxxMzzFromfcNEQ_PPM + c2o1 * kxxMzzFromfcNEQ_PPP - c2o1 * kxxMzzFromfcNEQ_MPM + + c2o1 * kxxMzzFromfcNEQ_MPP - c2o1 * kxxMzzFromfcNEQ_PMM + c2o1 * kxxMzzFromfcNEQ_PMP - + c2o1 * kxxMzzFromfcNEQ_MMM + c2o1 * kxxMzzFromfcNEQ_MMP - c2o1 * kxzFromfcNEQ_PPM - + c2o1 * kxzFromfcNEQ_PPP + c2o1 * kxzFromfcNEQ_MPM + c2o1 * kxzFromfcNEQ_MPP - c2o1 * kxzFromfcNEQ_PMM - + c2o1 * kxzFromfcNEQ_PMP + c2o1 * kxzFromfcNEQ_MMM + c2o1 * kxzFromfcNEQ_MMP - c2o1 * kyzFromfcNEQ_PPM - + c2o1 * kyzFromfcNEQ_PPP - c2o1 * kyzFromfcNEQ_MPM - c2o1 * kyzFromfcNEQ_MPP + c2o1 * kyzFromfcNEQ_PMM + + c2o1 * kyzFromfcNEQ_PMP + c2o1 * kyzFromfcNEQ_MMM + c2o1 * kyzFromfcNEQ_MMP - c2o1 * vx1_PPM + + c2o1 * vx1_PPP + c2o1 * vx1_MPM - c2o1 * vx1_MPP - c2o1 * vx1_PMM + c2o1 * vx1_PMP + c2o1 * vx1_MMM - + c2o1 * vx1_MMP - c2o1 * vx2_PPM + c2o1 * vx2_PPP - c2o1 * vx2_MPM + c2o1 * vx2_MPP + c2o1 * vx2_PMM - + c2o1 * vx2_PMP + c2o1 * vx2_MMM - c2o1 * vx2_MMP + c8o1 * vx3_PPM + c8o1 * vx3_PPP + c8o1 * vx3_MPM + + c8o1 * vx3_MPP + c8o1 * vx3_PMM + c8o1 * vx3_PMP + c8o1 * vx3_MMM + c8o1 * vx3_MMP) / + c64o1; + a_100 = (vx1_PPM + vx1_PPP - vx1_MPM - vx1_MPP + vx1_PMM + vx1_PMP - vx1_MMM - vx1_MMP) / c4o1; + b_100 = (vx2_PPM + vx2_PPP - vx2_MPM - vx2_MPP + vx2_PMM + vx2_PMP - vx2_MMM - vx2_MMP) / c4o1; + c_100 = (vx3_PPM + vx3_PPP - vx3_MPM - vx3_MPP + vx3_PMM + vx3_PMP - vx3_MMM - vx3_MMP) / c4o1; + a_200 = (kxxMyyFromfcNEQ_PPM + kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_MPP + + kxxMyyFromfcNEQ_PMM + kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_MMP + + kxxMzzFromfcNEQ_PPM + kxxMzzFromfcNEQ_PPP - kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_MPP + + kxxMzzFromfcNEQ_PMM + kxxMzzFromfcNEQ_PMP - kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_MMP + c2o1 * vx2_PPM + + c2o1 * vx2_PPP - c2o1 * vx2_MPM - c2o1 * vx2_MPP - c2o1 * vx2_PMM - c2o1 * vx2_PMP + c2o1 * vx2_MMM + + c2o1 * vx2_MMP - c2o1 * vx3_PPM + c2o1 * vx3_PPP + c2o1 * vx3_MPM - c2o1 * vx3_MPP - c2o1 * vx3_PMM + + c2o1 * vx3_PMP + c2o1 * vx3_MMM - c2o1 * vx3_MMP) / + c16o1; + b_200 = (kxyFromfcNEQ_PPM + kxyFromfcNEQ_PPP - kxyFromfcNEQ_MPM - kxyFromfcNEQ_MPP + kxyFromfcNEQ_PMM + + kxyFromfcNEQ_PMP - kxyFromfcNEQ_MMM - kxyFromfcNEQ_MMP - c2o1 * vx1_PPM - c2o1 * vx1_PPP + + c2o1 * vx1_MPM + c2o1 * vx1_MPP + c2o1 * vx1_PMM + c2o1 * vx1_PMP - c2o1 * vx1_MMM - c2o1 * vx1_MMP) / + c8o1; + c_200 = (kxzFromfcNEQ_PPM + kxzFromfcNEQ_PPP - kxzFromfcNEQ_MPM - kxzFromfcNEQ_MPP + kxzFromfcNEQ_PMM + + kxzFromfcNEQ_PMP - kxzFromfcNEQ_MMM - kxzFromfcNEQ_MMP + c2o1 * vx1_PPM - c2o1 * vx1_PPP - + c2o1 * vx1_MPM + c2o1 * vx1_MPP + c2o1 * vx1_PMM - c2o1 * vx1_PMP - c2o1 * vx1_MMM + c2o1 * vx1_MMP) / + c8o1; + a_010 = (vx1_PPM + vx1_PPP + vx1_MPM + vx1_MPP - vx1_PMM - vx1_PMP - vx1_MMM - vx1_MMP) / c4o1; + b_010 = (vx2_PPM + vx2_PPP + vx2_MPM + vx2_MPP - vx2_PMM - vx2_PMP - vx2_MMM - vx2_MMP) / c4o1; + c_010 = (vx3_PPM + vx3_PPP + vx3_MPM + vx3_MPP - vx3_PMM - vx3_PMP - vx3_MMM - vx3_MMP) / c4o1; + a_020 = (kxyFromfcNEQ_PPM + kxyFromfcNEQ_PPP + kxyFromfcNEQ_MPM + kxyFromfcNEQ_MPP - kxyFromfcNEQ_PMM - + kxyFromfcNEQ_PMP - kxyFromfcNEQ_MMM - kxyFromfcNEQ_MMP - c2o1 * vx2_PPM - c2o1 * vx2_PPP + + c2o1 * vx2_MPM + c2o1 * vx2_MPP + c2o1 * vx2_PMM + c2o1 * vx2_PMP - c2o1 * vx2_MMM - c2o1 * vx2_MMP) / + c8o1; + b_020 = (-c2o1 * kxxMyyFromfcNEQ_PPM - c2o1 * kxxMyyFromfcNEQ_PPP - c2o1 * kxxMyyFromfcNEQ_MPM - + c2o1 * kxxMyyFromfcNEQ_MPP + c2o1 * kxxMyyFromfcNEQ_PMM + c2o1 * kxxMyyFromfcNEQ_PMP + + c2o1 * kxxMyyFromfcNEQ_MMM + c2o1 * kxxMyyFromfcNEQ_MMP + kxxMzzFromfcNEQ_PPM + kxxMzzFromfcNEQ_PPP + + kxxMzzFromfcNEQ_MPM + kxxMzzFromfcNEQ_MPP - kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_PMP - + kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_MMP + c2o1 * vx1_PPM + c2o1 * vx1_PPP - c2o1 * vx1_MPM - + c2o1 * vx1_MPP - c2o1 * vx1_PMM - c2o1 * vx1_PMP + c2o1 * vx1_MMM + c2o1 * vx1_MMP - c2o1 * vx3_PPM + + c2o1 * vx3_PPP - c2o1 * vx3_MPM + c2o1 * vx3_MPP + c2o1 * vx3_PMM - c2o1 * vx3_PMP + c2o1 * vx3_MMM - + c2o1 * vx3_MMP) / + c16o1; + c_020 = (kyzFromfcNEQ_PPM + kyzFromfcNEQ_PPP + kyzFromfcNEQ_MPM + kyzFromfcNEQ_MPP - kyzFromfcNEQ_PMM - + kyzFromfcNEQ_PMP - kyzFromfcNEQ_MMM - kyzFromfcNEQ_MMP + c2o1 * vx2_PPM - c2o1 * vx2_PPP + + c2o1 * vx2_MPM - c2o1 * vx2_MPP - c2o1 * vx2_PMM + c2o1 * vx2_PMP - c2o1 * vx2_MMM + c2o1 * vx2_MMP) / + c8o1; + a_001 = (-vx1_PPM + vx1_PPP - vx1_MPM + vx1_MPP - vx1_PMM + vx1_PMP - vx1_MMM + vx1_MMP) / c4o1; + b_001 = (-vx2_PPM + vx2_PPP - vx2_MPM + vx2_MPP - vx2_PMM + vx2_PMP - vx2_MMM + vx2_MMP) / c4o1; + c_001 = (-vx3_PPM + vx3_PPP - vx3_MPM + vx3_MPP - vx3_PMM + vx3_PMP - vx3_MMM + vx3_MMP) / c4o1; + a_002 = (-kxzFromfcNEQ_PPM + kxzFromfcNEQ_PPP - kxzFromfcNEQ_MPM + kxzFromfcNEQ_MPP - kxzFromfcNEQ_PMM + + kxzFromfcNEQ_PMP - kxzFromfcNEQ_MMM + kxzFromfcNEQ_MMP + c2o1 * vx3_PPM - c2o1 * vx3_PPP - + c2o1 * vx3_MPM + c2o1 * vx3_MPP + c2o1 * vx3_PMM - c2o1 * vx3_PMP - c2o1 * vx3_MMM + c2o1 * vx3_MMP) / + c8o1; + b_002 = (-kyzFromfcNEQ_PPM + kyzFromfcNEQ_PPP - kyzFromfcNEQ_MPM + kyzFromfcNEQ_MPP - kyzFromfcNEQ_PMM + + kyzFromfcNEQ_PMP - kyzFromfcNEQ_MMM + kyzFromfcNEQ_MMP + c2o1 * vx3_PPM - c2o1 * vx3_PPP + + c2o1 * vx3_MPM - c2o1 * vx3_MPP - c2o1 * vx3_PMM + c2o1 * vx3_PMP - c2o1 * vx3_MMM + c2o1 * vx3_MMP) / + c8o1; + c_002 = (-kxxMyyFromfcNEQ_PPM + kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MPM + kxxMyyFromfcNEQ_MPP - + kxxMyyFromfcNEQ_PMM + kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MMM + kxxMyyFromfcNEQ_MMP + + c2o1 * kxxMzzFromfcNEQ_PPM - c2o1 * kxxMzzFromfcNEQ_PPP + c2o1 * kxxMzzFromfcNEQ_MPM - + c2o1 * kxxMzzFromfcNEQ_MPP + c2o1 * kxxMzzFromfcNEQ_PMM - c2o1 * kxxMzzFromfcNEQ_PMP + + c2o1 * kxxMzzFromfcNEQ_MMM - c2o1 * kxxMzzFromfcNEQ_MMP - c2o1 * vx1_PPM + c2o1 * vx1_PPP + + c2o1 * vx1_MPM - c2o1 * vx1_MPP - c2o1 * vx1_PMM + c2o1 * vx1_PMP + c2o1 * vx1_MMM - c2o1 * vx1_MMP - + c2o1 * vx2_PPM + c2o1 * vx2_PPP - c2o1 * vx2_MPM + c2o1 * vx2_MPP + c2o1 * vx2_PMM - c2o1 * vx2_PMP + + c2o1 * vx2_MMM - c2o1 * vx2_MMP) / + c16o1; + a_110 = (vx1_PPM + vx1_PPP - vx1_MPM - vx1_MPP - vx1_PMM - vx1_PMP + vx1_MMM + vx1_MMP) / c2o1; + b_110 = (vx2_PPM + vx2_PPP - vx2_MPM - vx2_MPP - vx2_PMM - vx2_PMP + vx2_MMM + vx2_MMP) / c2o1; + c_110 = (vx3_PPM + vx3_PPP - vx3_MPM - vx3_MPP - vx3_PMM - vx3_PMP + vx3_MMM + vx3_MMP) / c2o1; + a_101 = (-vx1_PPM + vx1_PPP + vx1_MPM - vx1_MPP - vx1_PMM + vx1_PMP + vx1_MMM - vx1_MMP) / c2o1; + b_101 = (-vx2_PPM + vx2_PPP + vx2_MPM - vx2_MPP - vx2_PMM + vx2_PMP + vx2_MMM - vx2_MMP) / c2o1; + c_101 = (-vx3_PPM + vx3_PPP + vx3_MPM - vx3_MPP - vx3_PMM + vx3_PMP + vx3_MMM - vx3_MMP) / c2o1; + a_011 = (-vx1_PPM + vx1_PPP - vx1_MPM + vx1_MPP + vx1_PMM - vx1_PMP + vx1_MMM - vx1_MMP) / c2o1; + b_011 = (-vx2_PPM + vx2_PPP - vx2_MPM + vx2_MPP + vx2_PMM - vx2_PMP + vx2_MMM - vx2_MMP) / c2o1; + c_011 = (-vx3_PPM + vx3_PPP - vx3_MPM + vx3_MPP + vx3_PMM - vx3_PMP + vx3_MMM - vx3_MMP) / c2o1; + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + real kxyAverage = c0o1; + real kyzAverage = c0o1; + real kxzAverage = c0o1; + real kxxMyyAverage = c0o1; + real kxxMzzAverage = c0o1; + + //////////////////////////////////////////////////////////////////////////////// + //! - Set the relative position of the offset cell {-1, 0, 1} + //! + real xoff = offsetFC.xOffFC[k_thread]; + real yoff = offsetFC.yOffFC[k_thread]; + real zoff = offsetFC.zOffFC[k_thread]; + + real xoff_sq = xoff * xoff; + real yoff_sq = yoff * yoff; + real zoff_sq = zoff * zoff; + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //!- Calculate coefficients for the polynomial interpolation of the pressure + //! + real LaplaceRho = + ((xoff != c0o1) || (yoff != c0o1) || (zoff != c0o1)) + ? c0o1 + : -c3o1 * (a_100 * a_100 + b_010 * b_010 + c_001 * c_001) - c6o1 * (b_100 * a_010 + c_100 * a_001 + c_010 * b_001); + d_000 = ( drho_PPM + drho_PPP + drho_MPM + drho_MPP + drho_PMM + drho_PMP + drho_MMM + drho_MMP - c2o1 * LaplaceRho) * c1o8; + d_100 = ( drho_PPM + drho_PPP - drho_MPM - drho_MPP + drho_PMM + drho_PMP - drho_MMM - drho_MMP) * c1o4; + d_010 = ( drho_PPM + drho_PPP + drho_MPM + drho_MPP - drho_PMM - drho_PMP - drho_MMM - drho_MMP) * c1o4; + d_001 = (-drho_PPM + drho_PPP - drho_MPM + drho_MPP - drho_PMM + drho_PMP - drho_MMM + drho_MMP) * c1o4; + d_110 = ( drho_PPM + drho_PPP - drho_MPM - drho_MPP - drho_PMM - drho_PMP + drho_MMM + drho_MMP) * c1o2; + d_101 = (-drho_PPM + drho_PPP + drho_MPM - drho_MPP - drho_PMM + drho_PMP + drho_MMM - drho_MMP) * c1o2; + d_011 = (-drho_PPM + drho_PPP - drho_MPM + drho_MPP + drho_PMM - drho_PMP + drho_MMM - drho_MMP) * c1o2; + + + ////////////////////////////////////////////////////////////////////////// + //! - Extrapolation for refinement in to the wall (polynomial coefficients) + //! + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // x------x + // | | + // | ---+--->X + // | | \ + // x------x \ + // offset-vector + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + a_000 = a_000 + xoff * a_100 + yoff * a_010 + zoff * a_001 + xoff_sq * a_200 + yoff_sq * a_020 + zoff_sq * a_002 + + xoff * yoff * a_110 + xoff * zoff * a_101 + yoff * zoff * a_011; + a_100 = a_100 + c2o1 * xoff * a_200 + yoff * a_110 + zoff * a_101; + a_010 = a_010 + c2o1 * yoff * a_020 + xoff * a_110 + zoff * a_011; + a_001 = a_001 + c2o1 * zoff * a_002 + xoff * a_101 + yoff * a_011; + b_000 = b_000 + xoff * b_100 + yoff * b_010 + zoff * b_001 + xoff_sq * b_200 + yoff_sq * b_020 + zoff_sq * b_002 + + xoff * yoff * b_110 + xoff * zoff * b_101 + yoff * zoff * b_011; + b_100 = b_100 + c2o1 * xoff * b_200 + yoff * b_110 + zoff * b_101; + b_010 = b_010 + c2o1 * yoff * b_020 + xoff * b_110 + zoff * b_011; + b_001 = b_001 + c2o1 * zoff * b_002 + xoff * b_101 + yoff * b_011; + c_000 = c_000 + xoff * c_100 + yoff * c_010 + zoff * c_001 + xoff_sq * c_200 + yoff_sq * c_020 + zoff_sq * c_002 + + xoff * yoff * c_110 + xoff * zoff * c_101 + yoff * zoff * c_011; + c_100 = c_100 + c2o1 * xoff * c_200 + yoff * c_110 + zoff * c_101; + c_010 = c_010 + c2o1 * yoff * c_020 + xoff * c_110 + zoff * c_011; + c_001 = c_001 + c2o1 * zoff * c_002 + xoff * c_101 + yoff * c_011; + d_000 = d_000 + xoff * d_100 + yoff * d_010 + zoff * d_001 + + xoff * yoff * d_110 + xoff * zoff * d_101 + yoff * zoff * d_011; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Set all moments to zero + //! + real m_111 = c0o1; + real m_211 = c0o1; + real m_011 = c0o1; + real m_121 = c0o1; + real m_101 = c0o1; + real m_112 = c0o1; + real m_110 = c0o1; + real m_221 = c0o1; + real m_001 = c0o1; + real m_201 = c0o1; + real m_021 = c0o1; + real m_212 = c0o1; + real m_010 = c0o1; + real m_210 = c0o1; + real m_012 = c0o1; + real m_122 = c0o1; + real m_100 = c0o1; + real m_120 = c0o1; + real m_102 = c0o1; + real m_222 = c0o1; + real m_022 = c0o1; + real m_202 = c0o1; + real m_002 = c0o1; + real m_220 = c0o1; + real m_020 = c0o1; + real m_200 = c0o1; + real m_000 = c0o1; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Define aliases to use the same variable for the distributions (f's): + //! + real& f_000 = m_111; + real& f_P00 = m_211; + real& f_M00 = m_011; + real& f_0P0 = m_121; + real& f_0M0 = m_101; + real& f_00P = m_112; + real& f_00M = m_110; + real& f_PP0 = m_221; + real& f_MM0 = m_001; + real& f_PM0 = m_201; + real& f_MP0 = m_021; + real& f_P0P = m_212; + real& f_M0M = m_010; + real& f_P0M = m_210; + real& f_M0P = m_012; + real& f_0PP = m_122; + real& f_0MM = m_100; + real& f_0PM = m_120; + real& f_0MP = m_102; + real& f_PPP = m_222; + real& f_MPP = m_022; + real& f_PMP = m_202; + real& f_MMP = m_002; + real& f_PPM = m_220; + real& f_MPM = m_020; + real& f_PMM = m_200; + real& f_MMM = m_000; + + //////////////////////////////////////////////////////////////////////////////// + //! - Declare local variables for destination nodes + //! + real vvx, vvy, vvz, vx_sq, vy_sq, vz_sq; + real mxxPyyPzz, mxxMyy, mxxMzz, mxxyPyzz, mxxyMyzz, mxxzPyyz, mxxzMyyz, mxyyPxzz, mxyyMxzz; + real useNEQ = c1o1; // zero; //one; //.... one = on ..... zero = off + real press; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Position Coarse 0., 0., 0. + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // x = 0.; + // y = 0.; + // z = 0.; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////// + //! - Set macroscopic values on destination node (zeroth and first order moments) + //! + press = d_000; + vvx = a_000; + vvy = b_000; + vvz = c_000; + + m_000 = press; // m_000 is press, if drho is interpolated directly + + vx_sq = vvx * vvx; + vy_sq = vvy * vvy; + vz_sq = vvz * vvz; + + //////////////////////////////////////////////////////////////////////////////// + //! - Set moments (second to sixth order) on destination node + //! + // linear combinations for second order moments + mxxPyyPzz = m_000; + + mxxMyy = -c2o3 * ((a_100 - b_010) + kxxMyyAverage) * eps_new / omegaC * (c1o1 + press); + mxxMzz = -c2o3 * ((a_100 - c_001) + kxxMzzAverage) * eps_new / omegaC * (c1o1 + press); + + m_011 = -c1o3 * ((b_001 + c_010) + kyzAverage) * eps_new / omegaC * (c1o1 + press); + m_101 = -c1o3 * ((a_001 + c_100) + kxzAverage) * eps_new / omegaC * (c1o1 + press); + m_110 = -c1o3 * ((a_010 + b_100) + kxyAverage) * eps_new / omegaC * (c1o1 + press); + + m_200 = c1o3 * ( mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; + m_020 = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; + m_002 = c1o3 * ( mxxMyy - c2o1 * mxxMzz + mxxPyyPzz) * useNEQ; + + // linear combinations for third order moments + m_111 = c0o1; + + mxxyPyzz = c0o1; + mxxyMyzz = c0o1; + mxxzPyyz = c0o1; + mxxzMyyz = c0o1; + mxyyPxzz = c0o1; + mxyyMxzz = c0o1; + + m_210 = ( mxxyMyzz + mxxyPyzz) * c1o2; + m_012 = (-mxxyMyzz + mxxyPyzz) * c1o2; + m_201 = ( mxxzMyyz + mxxzPyyz) * c1o2; + m_021 = (-mxxzMyyz + mxxzPyyz) * c1o2; + m_120 = ( mxyyMxzz + mxyyPxzz) * c1o2; + m_102 = (-mxyyMxzz + mxyyPxzz) * c1o2; + + // fourth order moments + m_022 = m_000 * c1o9; + m_202 = m_022; + m_220 = m_022; + + // fifth order moments + + // sixth order moments + m_222 = m_000 * c1o27; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (88)-(96) in <a + //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + backwardInverseChimeraWithK(m_000, m_100, m_200, vvx, vx_sq, c1o1, c1o1); + backwardChimera( m_010, m_110, m_210, vvx, vx_sq); + backwardInverseChimeraWithK(m_020, m_120, m_220, vvx, vx_sq, c3o1, c1o3); + backwardChimera( m_001, m_101, m_201, vvx, vx_sq); + backwardChimera( m_011, m_111, m_211, vvx, vx_sq); + backwardChimera( m_021, m_121, m_221, vvx, vx_sq); + backwardInverseChimeraWithK(m_002, m_102, m_202, vvx, vx_sq, c3o1, c1o3); + backwardChimera( m_012, m_112, m_212, vvx, vx_sq); + backwardInverseChimeraWithK(m_022, m_122, m_222, vvx, vx_sq, c9o1, c1o9); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithK(m_000, m_010, m_020, vvy, vy_sq, c6o1, c1o6); + backwardChimera( m_001, m_011, m_021, vvy, vy_sq); + backwardInverseChimeraWithK(m_002, m_012, m_022, vvy, vy_sq, c18o1, c1o18); + backwardInverseChimeraWithK(m_100, m_110, m_120, vvy, vy_sq, c3o2, c2o3); + backwardChimera( m_101, m_111, m_121, vvy, vy_sq); + backwardInverseChimeraWithK(m_102, m_112, m_122, vvy, vy_sq, c9o2, c2o9); + backwardInverseChimeraWithK(m_200, m_210, m_220, vvy, vy_sq, c6o1, c1o6); + backwardChimera( m_201, m_211, m_221, vvy, vy_sq); + backwardInverseChimeraWithK(m_202, m_212, m_222, vvy, vy_sq, c18o1, c1o18); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithK(m_000, m_001, m_002, vvz, vz_sq, c36o1, c1o36); + backwardInverseChimeraWithK(m_010, m_011, m_012, vvz, vz_sq, c9o1, c1o9); + backwardInverseChimeraWithK(m_020, m_021, m_022, vvz, vz_sq, c36o1, c1o36); + backwardInverseChimeraWithK(m_100, m_101, m_102, vvz, vz_sq, c9o1, c1o9); + backwardInverseChimeraWithK(m_110, m_111, m_112, vvz, vz_sq, c9o4, c4o9); + backwardInverseChimeraWithK(m_120, m_121, m_122, vvz, vz_sq, c9o1, c1o9); + backwardInverseChimeraWithK(m_200, m_201, m_202, vvz, vz_sq, c36o1, c1o36); + backwardInverseChimeraWithK(m_210, m_211, m_212, vvz, vz_sq, c9o1, c1o9); + backwardInverseChimeraWithK(m_220, m_221, m_222, vvz, vz_sq, c36o1, c1o36); + + + //////////////////////////////////////////////////////////////////////////////////// + // index of the destination node and its neighbors + k_000 = indicesCoarse000[k_thread]; + k_M00 = neighborXcoarse [k_000]; + k_0M0 = neighborYcoarse [k_000]; + k_00M = neighborZcoarse [k_000]; + k_MM0 = neighborYcoarse [k_M00]; + k_M0M = neighborZcoarse [k_M00]; + k_0MM = neighborZcoarse [k_0M0]; + k_MMM = neighborZcoarse [k_MM0]; + //////////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////////// + //! - Write distributions: style of reading and writing the distributions from/to + //! stored arrays dependent on timestep is based on the esoteric twist algorithm + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), + //! DOI:10.3390/computation5020019 ]</b></a> + //! + (distCoarse.f[DIR_000])[k_000] = f_000; + (distCoarse.f[DIR_P00])[k_000] = f_P00; + (distCoarse.f[DIR_M00])[k_M00] = f_M00; + (distCoarse.f[DIR_0P0])[k_000] = f_0P0; + (distCoarse.f[DIR_0M0])[k_0M0] = f_0M0; + (distCoarse.f[DIR_00P])[k_000] = f_00P; + (distCoarse.f[DIR_00M])[k_00M] = f_00M; + (distCoarse.f[DIR_PP0])[k_000] = f_PP0; + (distCoarse.f[DIR_MM0])[k_MM0] = f_MM0; + (distCoarse.f[DIR_PM0])[k_0M0] = f_PM0; + (distCoarse.f[DIR_MP0])[k_M00] = f_MP0; + (distCoarse.f[DIR_P0P])[k_000] = f_P0P; + (distCoarse.f[DIR_M0M])[k_M0M] = f_M0M; + (distCoarse.f[DIR_P0M])[k_00M] = f_P0M; + (distCoarse.f[DIR_M0P])[k_M00] = f_M0P; + (distCoarse.f[DIR_0PP])[k_000] = f_0PP; + (distCoarse.f[DIR_0MM])[k_0MM] = f_0MM; + (distCoarse.f[DIR_0PM])[k_00M] = f_0PM; + (distCoarse.f[DIR_0MP])[k_0M0] = f_0MP; + (distCoarse.f[DIR_PPP])[k_000] = f_PPP; + (distCoarse.f[DIR_MPP])[k_M00] = f_MPP; + (distCoarse.f[DIR_PMP])[k_0M0] = f_PMP; + (distCoarse.f[DIR_MMP])[k_MM0] = f_MMP; + (distCoarse.f[DIR_PPM])[k_00M] = f_PPM; + (distCoarse.f[DIR_MPM])[k_M0M] = f_MPM; + (distCoarse.f[DIR_PMM])[k_0MM] = f_PMM; + (distCoarse.f[DIR_MMM])[k_MMM] = f_MMM; + //////////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/gpu/VirtualFluids_GPU/GPU/Init27.cu b/src/gpu/VirtualFluids_GPU/GPU/Init27.cu index 7b3426b0117a4f36da0088727f31422839edbebc..6d497d2a1ab7ec305bec4f1ad1ed2e2d63c4dc27 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/Init27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/Init27.cu @@ -1,12 +1,13 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBInit27( int myid, +__global__ void LBInit27( int myid, int numprocs, real u0, unsigned int* geoD, @@ -23,33 +24,33 @@ extern "C" __global__ void LBInit27( int myid, int maxlev) { Distributions27 D; - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; //////////////////////////////////////////////////////////////////////////////// unsigned int k; // Zugriff auf arrays im device // @@ -140,33 +141,33 @@ extern "C" __global__ void LBInit27( int myid, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D.f[dirZERO])[kzero] = c8o27* (drho-cu_sq); - (D.f[dirE ])[ke ] = c2o27* (drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - (D.f[dirW ])[kw ] = c2o27* (drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - (D.f[dirN ])[kn ] = c2o27* (drho+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - (D.f[dirS ])[ks ] = c2o27* (drho+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - (D.f[dirT ])[kt ] = c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - (D.f[dirB ])[kb ] = c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - (D.f[dirNE ])[kne ] = c1o54* (drho+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - (D.f[dirSW ])[ksw ] = c1o54* (drho+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - (D.f[dirSE ])[kse ] = c1o54* (drho+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - (D.f[dirNW ])[knw ] = c1o54* (drho+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - (D.f[dirTE ])[kte ] = c1o54* (drho+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - (D.f[dirBW ])[kbw ] = c1o54* (drho+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - (D.f[dirBE ])[kbe ] = c1o54* (drho+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - (D.f[dirTW ])[ktw ] = c1o54* (drho+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - (D.f[dirTN ])[ktn ] = c1o54* (drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - (D.f[dirBS ])[kbs ] = c1o54* (drho+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - (D.f[dirBN ])[kbn ] = c1o54* (drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - (D.f[dirTS ])[kts ] = c1o54* (drho+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - (D.f[dirTNE ])[ktne ] = c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - (D.f[dirBSW ])[kbsw ] = c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - (D.f[dirBNE ])[kbne ] = c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - (D.f[dirTSW ])[ktsw ] = c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - (D.f[dirTSE ])[ktse ] = c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - (D.f[dirBNW ])[kbnw ] = c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - (D.f[dirBSE ])[kbse ] = c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - (D.f[dirTNW ])[ktnw ] = c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + (D.f[DIR_000])[kzero] = c8o27* (drho-cu_sq); + (D.f[DIR_P00 ])[ke ] = c2o27* (drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + (D.f[DIR_M00 ])[kw ] = c2o27* (drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + (D.f[DIR_0P0 ])[kn ] = c2o27* (drho+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + (D.f[DIR_0M0 ])[ks ] = c2o27* (drho+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + (D.f[DIR_00P ])[kt ] = c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + (D.f[DIR_00M ])[kb ] = c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + (D.f[DIR_PP0 ])[kne ] = c1o54* (drho+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + (D.f[DIR_MM0 ])[ksw ] = c1o54* (drho+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + (D.f[DIR_PM0 ])[kse ] = c1o54* (drho+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + (D.f[DIR_MP0 ])[knw ] = c1o54* (drho+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + (D.f[DIR_P0P ])[kte ] = c1o54* (drho+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + (D.f[DIR_M0M ])[kbw ] = c1o54* (drho+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + (D.f[DIR_P0M ])[kbe ] = c1o54* (drho+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + (D.f[DIR_M0P ])[ktw ] = c1o54* (drho+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + (D.f[DIR_0PP ])[ktn ] = c1o54* (drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + (D.f[DIR_0MM ])[kbs ] = c1o54* (drho+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + (D.f[DIR_0PM ])[kbn ] = c1o54* (drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + (D.f[DIR_0MP ])[kts ] = c1o54* (drho+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + (D.f[DIR_PPP ])[ktne ] = c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + (D.f[DIR_MMM ])[kbsw ] = c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + (D.f[DIR_PPM ])[kbne ] = c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + (D.f[DIR_MMP ])[ktsw ] = c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + (D.f[DIR_PMP ])[ktse ] = c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + (D.f[DIR_MPM ])[kbnw ] = c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + (D.f[DIR_PMM ])[kbse ] = c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + (D.f[DIR_MPP ])[ktnw ] = c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); } //////////////////////////////////////////////////////////////////////////////// @@ -181,7 +182,7 @@ extern "C" __global__ void LBInit27( int myid, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBInitNonEqPartSP27( unsigned int* neighborX, +__global__ void LBInitNonEqPartSP27( unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* neighborWSB, @@ -217,63 +218,63 @@ extern "C" __global__ void LBInitNonEqPartSP27( unsigned int* neighborX, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; } ////////////////////////////////////////////////////////////////////////// real drho = rho[k];//0.0f;// @@ -395,63 +396,63 @@ extern "C" __global__ void LBInitNonEqPartSP27( unsigned int* neighborX, ////////////////////////////////////////////////////////////////////////// real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D.f[dirZERO])[kzero] = c8o27* (drho-cu_sq); - (D.f[dirE ])[ke ] = c2o27* (drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - (D.f[dirW ])[kw ] = c2o27* (drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - (D.f[dirN ])[kn ] = c2o27* (drho+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - (D.f[dirS ])[ks ] = c2o27* (drho+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - (D.f[dirT ])[kt ] = c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - (D.f[dirB ])[kb ] = c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - (D.f[dirNE ])[kne ] = c1o54* (drho+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - (D.f[dirSW ])[ksw ] = c1o54* (drho+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - (D.f[dirSE ])[kse ] = c1o54* (drho+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - (D.f[dirNW ])[knw ] = c1o54* (drho+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - (D.f[dirTE ])[kte ] = c1o54* (drho+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - (D.f[dirBW ])[kbw ] = c1o54* (drho+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - (D.f[dirBE ])[kbe ] = c1o54* (drho+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - (D.f[dirTW ])[ktw ] = c1o54* (drho+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - (D.f[dirTN ])[ktn ] = c1o54* (drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - (D.f[dirBS ])[kbs ] = c1o54* (drho+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - (D.f[dirBN ])[kbn ] = c1o54* (drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - (D.f[dirTS ])[kts ] = c1o54* (drho+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - (D.f[dirTNE ])[ktne ] = c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - (D.f[dirBSW ])[kbsw ] = c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - (D.f[dirBNE ])[kbne ] = c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - (D.f[dirTSW ])[ktsw ] = c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - (D.f[dirTSE ])[ktse ] = c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - (D.f[dirBNW ])[kbnw ] = c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - (D.f[dirBSE ])[kbse ] = c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - (D.f[dirTNW ])[ktnw ] = c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + (D.f[DIR_000])[kzero] = c8o27* (drho-cu_sq); + (D.f[DIR_P00 ])[ke ] = c2o27* (drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + (D.f[DIR_M00 ])[kw ] = c2o27* (drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + (D.f[DIR_0P0 ])[kn ] = c2o27* (drho+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + (D.f[DIR_0M0 ])[ks ] = c2o27* (drho+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + (D.f[DIR_00P ])[kt ] = c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + (D.f[DIR_00M ])[kb ] = c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + (D.f[DIR_PP0 ])[kne ] = c1o54* (drho+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + (D.f[DIR_MM0 ])[ksw ] = c1o54* (drho+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + (D.f[DIR_PM0 ])[kse ] = c1o54* (drho+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + (D.f[DIR_MP0 ])[knw ] = c1o54* (drho+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + (D.f[DIR_P0P ])[kte ] = c1o54* (drho+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + (D.f[DIR_M0M ])[kbw ] = c1o54* (drho+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + (D.f[DIR_P0M ])[kbe ] = c1o54* (drho+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + (D.f[DIR_M0P ])[ktw ] = c1o54* (drho+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + (D.f[DIR_0PP ])[ktn ] = c1o54* (drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + (D.f[DIR_0MM ])[kbs ] = c1o54* (drho+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + (D.f[DIR_0PM ])[kbn ] = c1o54* (drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + (D.f[DIR_0MP ])[kts ] = c1o54* (drho+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + (D.f[DIR_PPP ])[ktne ] = c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + (D.f[DIR_MMM ])[kbsw ] = c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + (D.f[DIR_PPM ])[kbne ] = c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + (D.f[DIR_MMP ])[ktsw ] = c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + (D.f[DIR_PMP ])[ktse ] = c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + (D.f[DIR_MPM ])[kbnw ] = c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + (D.f[DIR_PMM ])[kbse ] = c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + (D.f[DIR_MPP ])[ktnw ] = c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); ////////////////////////////////////////////////////////////////////////// - (D.f[dirZERO])[kzero] += f_ZERO; - (D.f[dirE ])[ke ] += f_E ; - (D.f[dirW ])[kw ] += f_E ; - (D.f[dirN ])[kn ] += f_N ; - (D.f[dirS ])[ks ] += f_N ; - (D.f[dirT ])[kt ] += f_T ; - (D.f[dirB ])[kb ] += f_T ; - (D.f[dirNE ])[kne ] += f_NE ; - (D.f[dirSW ])[ksw ] += f_NE ; - (D.f[dirSE ])[kse ] += f_SE ; - (D.f[dirNW ])[knw ] += f_SE ; - (D.f[dirTE ])[kte ] += f_TE ; - (D.f[dirBW ])[kbw ] += f_TE ; - (D.f[dirBE ])[kbe ] += f_BE ; - (D.f[dirTW ])[ktw ] += f_BE ; - (D.f[dirTN ])[ktn ] += f_TN ; - (D.f[dirBS ])[kbs ] += f_TN ; - (D.f[dirBN ])[kbn ] += f_BN ; - (D.f[dirTS ])[kts ] += f_BN ; - (D.f[dirTNE ])[ktne ] += f_TNE ; - (D.f[dirBSW ])[kbsw ] += f_TNE ; - (D.f[dirBNE ])[kbne ] += f_TSW ; - (D.f[dirTSW ])[ktsw ] += f_TSW ; - (D.f[dirTSE ])[ktse ] += f_TSE ; - (D.f[dirBNW ])[kbnw ] += f_TSE ; - (D.f[dirBSE ])[kbse ] += f_TNW ; - (D.f[dirTNW ])[ktnw ] += f_TNW ; + (D.f[DIR_000])[kzero] += f_ZERO; + (D.f[DIR_P00 ])[ke ] += f_E ; + (D.f[DIR_M00 ])[kw ] += f_E ; + (D.f[DIR_0P0 ])[kn ] += f_N ; + (D.f[DIR_0M0 ])[ks ] += f_N ; + (D.f[DIR_00P ])[kt ] += f_T ; + (D.f[DIR_00M ])[kb ] += f_T ; + (D.f[DIR_PP0 ])[kne ] += f_NE ; + (D.f[DIR_MM0 ])[ksw ] += f_NE ; + (D.f[DIR_PM0 ])[kse ] += f_SE ; + (D.f[DIR_MP0 ])[knw ] += f_SE ; + (D.f[DIR_P0P ])[kte ] += f_TE ; + (D.f[DIR_M0M ])[kbw ] += f_TE ; + (D.f[DIR_P0M ])[kbe ] += f_BE ; + (D.f[DIR_M0P ])[ktw ] += f_BE ; + (D.f[DIR_0PP ])[ktn ] += f_TN ; + (D.f[DIR_0MM ])[kbs ] += f_TN ; + (D.f[DIR_0PM ])[kbn ] += f_BN ; + (D.f[DIR_0MP ])[kts ] += f_BN ; + (D.f[DIR_PPP ])[ktne ] += f_TNE ; + (D.f[DIR_MMM ])[kbsw ] += f_TNE ; + (D.f[DIR_PPM ])[kbne ] += f_TSW ; + (D.f[DIR_MMP ])[ktsw ] += f_TSW ; + (D.f[DIR_PMP ])[ktse ] += f_TSE ; + (D.f[DIR_MPM ])[kbnw ] += f_TSE ; + (D.f[DIR_PMM ])[kbse ] += f_TNW ; + (D.f[DIR_MPP ])[ktnw ] += f_TNW ; ////////////////////////////////////////////////////////////////////////// } @@ -459,9 +460,9 @@ extern "C" __global__ void LBInitNonEqPartSP27( unsigned int* neighborX, { ////////////////////////////////////////////////////////////////////////// Distributions27 D; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; ////////////////////////////////////////////////////////////////////////// - (D.f[dirZERO])[k] = c96o1; + (D.f[DIR_000])[k] = c96o1; ////////////////////////////////////////////////////////////////////////// } } @@ -487,94 +488,6 @@ extern "C" __global__ void LBInitNonEqPartSP27( unsigned int* neighborX, -//////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBInitThS7( unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int* geoD, - real* Conc, - real* ux, - real* uy, - real* uz, - unsigned int size_Mat, - real* DD7, - bool EvenOrOdd) -{ - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<size_Mat) - { - //////////////////////////////////////////////////////////////////////////////// - unsigned int BC; - BC = geoD[k]; - - if( BC != GEO_SOLID && BC != GEO_VOID) - { - Distributions7 D7; - if (EvenOrOdd==true) - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[1] = &DD7[1*size_Mat]; - D7.f[2] = &DD7[2*size_Mat]; - D7.f[3] = &DD7[3*size_Mat]; - D7.f[4] = &DD7[4*size_Mat]; - D7.f[5] = &DD7[5*size_Mat]; - D7.f[6] = &DD7[6*size_Mat]; - } - else - { - D7.f[0] = &DD7[0*size_Mat]; - D7.f[2] = &DD7[1*size_Mat]; - D7.f[1] = &DD7[2*size_Mat]; - D7.f[4] = &DD7[3*size_Mat]; - D7.f[3] = &DD7[4*size_Mat]; - D7.f[6] = &DD7[5*size_Mat]; - D7.f[5] = &DD7[6*size_Mat]; - } - ////////////////////////////////////////////////////////////////////////// - real ConcD = Conc[k]; - real vx1 = ux[k]; - real vx2 = uy[k]; - real vx3 = uz[k]; - real lambdaD = -c3o1 + sqrt(c3o1); - real Diffusivity = c1o20; - real Lam = -(c1o2+c1o1/lambdaD); - real nue_d = Lam/c3o1; - real ae = Diffusivity/nue_d - c1o1; - real ux_sq = vx1 * vx1; - real uy_sq = vx2 * vx2; - real uz_sq = vx3 * vx3; - ////////////////////////////////////////////////////////////////////////// - //index - ////////////////////////////////////////////////////////////////////////// - unsigned int kzero= k; - unsigned int ke = k; - unsigned int kw = neighborX[k]; - unsigned int kn = k; - unsigned int ks = neighborY[k]; - unsigned int kt = k; - unsigned int kb = neighborZ[k]; - ////////////////////////////////////////////////////////////////////////// - - (D7.f[0])[kzero] = ConcD*(c1o3*(ae*(-c3o1))-(ux_sq+uy_sq+uz_sq)); - (D7.f[1])[ke ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)+vx1*c1o2); - (D7.f[2])[kw ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)-vx1*c1o2); - (D7.f[3])[kn ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)+vx2*c1o2); - (D7.f[4])[ks ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)-vx2*c1o2); - (D7.f[5])[kt ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)+vx3*c1o2); - (D7.f[6])[kb ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)-vx3*c1o2); - } - } -} @@ -587,199 +500,6 @@ extern "C" __global__ void LBInitThS7( unsigned int* neighborX, -//////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LBInitThS27(unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int* geoD, - real* Conc, - real* ux, - real* uy, - real* uz, - unsigned int size_Mat, - real* DD27, - bool EvenOrOdd) -{ - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - - if(k<size_Mat) - { - //////////////////////////////////////////////////////////////////////////////// - unsigned int BC; - BC = geoD[k]; - - if( BC != GEO_SOLID && BC != GEO_VOID) - { - Distributions27 D27; - if (EvenOrOdd==true) - { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; - } - else - { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; - } - ////////////////////////////////////////////////////////////////////////// - real ConcD = Conc[k]; - real vx1 = ux[k]; - real vx2 = uy[k]; - real vx3 = uz[k]; - //real lambdaD = -three + sqrt(three); - //real Diffusivity = c1o20; - //real Lam = -(c1o2+one/lambdaD); - //real nue_d = Lam/three; - //real ae = Diffusivity/nue_d - one; - //real ux_sq = vx1 * vx1; - //real uy_sq = vx2 * vx2; - //real uz_sq = vx3 * vx3; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //D3Q7 - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //index - //unsigned int kzero= k; - //unsigned int ke = k; - //unsigned int kw = neighborX[k]; - //unsigned int kn = k; - //unsigned int ks = neighborY[k]; - //unsigned int kt = k; - //unsigned int kb = neighborZ[k]; - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //(D7.f[0])[kzero] = ConcD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); - //(D7.f[1])[ke ] = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)+vx1*c1o2); - //(D7.f[2])[kw ] = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)-vx1*c1o2); - //(D7.f[3])[kn ] = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)+vx2*c1o2); - //(D7.f[4])[ks ] = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)-vx2*c1o2); - //(D7.f[5])[kt ] = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)+vx3*c1o2); - //(D7.f[6])[kb ] = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)-vx3*c1o2); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //D3Q27 - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //index - unsigned int kzero= k; - unsigned int ke = k; - unsigned int kw = neighborX[k]; - unsigned int kn = k; - unsigned int ks = neighborY[k]; - unsigned int kt = k; - unsigned int kb = neighborZ[k]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = k; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = k; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = k; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = k; - unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - - (D27.f[dirZERO])[kzero] = c8o27* ConcD*(c1o1-cu_sq); - (D27.f[dirE ])[ke ] = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - (D27.f[dirW ])[kw ] = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - (D27.f[dirN ])[kn ] = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - (D27.f[dirS ])[ks ] = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - (D27.f[dirT ])[kt ] = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - (D27.f[dirB ])[kb ] = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - (D27.f[dirNE ])[kne ] = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - (D27.f[dirSW ])[ksw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - (D27.f[dirSE ])[kse ] = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - (D27.f[dirNW ])[knw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - (D27.f[dirTE ])[kte ] = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - (D27.f[dirBW ])[kbw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - (D27.f[dirBE ])[kbe ] = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - (D27.f[dirTW ])[ktw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - (D27.f[dirTN ])[ktn ] = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - (D27.f[dirBS ])[kbs ] = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - (D27.f[dirBN ])[kbn ] = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - (D27.f[dirTS ])[kts ] = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - (D27.f[dirTNE ])[ktne ] = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - (D27.f[dirBSW ])[kbsw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - (D27.f[dirBNE ])[kbne ] = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - (D27.f[dirTSW ])[ktsw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - (D27.f[dirTSE ])[ktse ] = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - (D27.f[dirBNW ])[kbnw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - (D27.f[dirBSE ])[kbse ] = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - (D27.f[dirTNW ])[ktnw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - } - } -} @@ -790,4 +510,3 @@ extern "C" __global__ void LBInitThS27(unsigned int* neighborX, -//test \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/GPU/InitAdvectionDiffusion27.cu b/src/gpu/VirtualFluids_GPU/GPU/InitAdvectionDiffusion27.cu new file mode 100644 index 0000000000000000000000000000000000000000..c091aa8b9a29017ddc0f6ea6584e805d7afc4859 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/InitAdvectionDiffusion27.cu @@ -0,0 +1,529 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file InitAdvectionDiffusion.cu +//! \ingroup GPU +//! \author Martin Schoenherr +//======================================================================================= +/* Device code */ +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" +#include <lbm/constants/NumericConstants.h> + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + +__global__ void InitAD27( + uint* neighborX, + uint* neighborY, + uint* neighborZ, + uint* typeOfGridNode, + real* concentration, + real* velocityX, + real* velocityY, + real* velocityZ, + uint size_Mat, + real* distributionsAD, + bool isEvenTimestep) +{ + ////////////////////////////////////////////////////////////////////////// + //! The initialization is executed in the following steps + //! + //////////////////////////////////////////////////////////////////////////////// + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + + ////////////////////////////////////////////////////////////////////////// + // run for all indices in size_Mat and fluid nodes + if ((k < size_Mat) && (typeOfGridNode[k] == GEO_FLUID)) + { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 distAD; + if (isEvenTimestep) + { + distAD.f[DIR_P00 ] = &distributionsAD[DIR_P00 *size_Mat]; + distAD.f[DIR_M00 ] = &distributionsAD[DIR_M00 *size_Mat]; + distAD.f[DIR_0P0 ] = &distributionsAD[DIR_0P0 *size_Mat]; + distAD.f[DIR_0M0 ] = &distributionsAD[DIR_0M0 *size_Mat]; + distAD.f[DIR_00P ] = &distributionsAD[DIR_00P *size_Mat]; + distAD.f[DIR_00M ] = &distributionsAD[DIR_00M *size_Mat]; + distAD.f[DIR_PP0 ] = &distributionsAD[DIR_PP0 *size_Mat]; + distAD.f[DIR_MM0 ] = &distributionsAD[DIR_MM0 *size_Mat]; + distAD.f[DIR_PM0 ] = &distributionsAD[DIR_PM0 *size_Mat]; + distAD.f[DIR_MP0 ] = &distributionsAD[DIR_MP0 *size_Mat]; + distAD.f[DIR_P0P ] = &distributionsAD[DIR_P0P *size_Mat]; + distAD.f[DIR_M0M ] = &distributionsAD[DIR_M0M *size_Mat]; + distAD.f[DIR_P0M ] = &distributionsAD[DIR_P0M *size_Mat]; + distAD.f[DIR_M0P ] = &distributionsAD[DIR_M0P *size_Mat]; + distAD.f[DIR_0PP ] = &distributionsAD[DIR_0PP *size_Mat]; + distAD.f[DIR_0MM ] = &distributionsAD[DIR_0MM *size_Mat]; + distAD.f[DIR_0PM ] = &distributionsAD[DIR_0PM *size_Mat]; + distAD.f[DIR_0MP ] = &distributionsAD[DIR_0MP *size_Mat]; + distAD.f[DIR_000] = &distributionsAD[DIR_000*size_Mat]; + distAD.f[DIR_PPP ] = &distributionsAD[DIR_PPP *size_Mat]; + distAD.f[DIR_MMP ] = &distributionsAD[DIR_MMP *size_Mat]; + distAD.f[DIR_PMP ] = &distributionsAD[DIR_PMP *size_Mat]; + distAD.f[DIR_MPP ] = &distributionsAD[DIR_MPP *size_Mat]; + distAD.f[DIR_PPM ] = &distributionsAD[DIR_PPM *size_Mat]; + distAD.f[DIR_MMM ] = &distributionsAD[DIR_MMM *size_Mat]; + distAD.f[DIR_PMM ] = &distributionsAD[DIR_PMM *size_Mat]; + distAD.f[DIR_MPM ] = &distributionsAD[DIR_MPM *size_Mat]; + } + else + { + distAD.f[DIR_M00 ] = &distributionsAD[DIR_P00 *size_Mat]; + distAD.f[DIR_P00 ] = &distributionsAD[DIR_M00 *size_Mat]; + distAD.f[DIR_0M0 ] = &distributionsAD[DIR_0P0 *size_Mat]; + distAD.f[DIR_0P0 ] = &distributionsAD[DIR_0M0 *size_Mat]; + distAD.f[DIR_00M ] = &distributionsAD[DIR_00P *size_Mat]; + distAD.f[DIR_00P ] = &distributionsAD[DIR_00M *size_Mat]; + distAD.f[DIR_MM0 ] = &distributionsAD[DIR_PP0 *size_Mat]; + distAD.f[DIR_PP0 ] = &distributionsAD[DIR_MM0 *size_Mat]; + distAD.f[DIR_MP0 ] = &distributionsAD[DIR_PM0 *size_Mat]; + distAD.f[DIR_PM0 ] = &distributionsAD[DIR_MP0 *size_Mat]; + distAD.f[DIR_M0M ] = &distributionsAD[DIR_P0P *size_Mat]; + distAD.f[DIR_P0P ] = &distributionsAD[DIR_M0M *size_Mat]; + distAD.f[DIR_M0P ] = &distributionsAD[DIR_P0M *size_Mat]; + distAD.f[DIR_P0M ] = &distributionsAD[DIR_M0P *size_Mat]; + distAD.f[DIR_0MM ] = &distributionsAD[DIR_0PP *size_Mat]; + distAD.f[DIR_0PP ] = &distributionsAD[DIR_0MM *size_Mat]; + distAD.f[DIR_0MP ] = &distributionsAD[DIR_0PM *size_Mat]; + distAD.f[DIR_0PM ] = &distributionsAD[DIR_0MP *size_Mat]; + distAD.f[DIR_000] = &distributionsAD[DIR_000*size_Mat]; + distAD.f[DIR_MMM ] = &distributionsAD[DIR_PPP *size_Mat]; + distAD.f[DIR_PPM ] = &distributionsAD[DIR_MMP *size_Mat]; + distAD.f[DIR_MPM ] = &distributionsAD[DIR_PMP *size_Mat]; + distAD.f[DIR_PMM ] = &distributionsAD[DIR_MPP *size_Mat]; + distAD.f[DIR_MMP ] = &distributionsAD[DIR_PPM *size_Mat]; + distAD.f[DIR_PPP ] = &distributionsAD[DIR_MMM *size_Mat]; + distAD.f[DIR_MPP ] = &distributionsAD[DIR_PMM *size_Mat]; + distAD.f[DIR_PMP ] = &distributionsAD[DIR_MPM *size_Mat]; + } + ////////////////////////////////////////////////////////////////////////// + //! - Set local velocities and concetration + //! + real conc = concentration[k]; + real vx1 = velocityX[k]; + real vx2 = velocityY[k]; + real vx3 = velocityZ[k]; + ////////////////////////////////////////////////////////////////////////// + //! - Set neighbor indices (necessary for indirect addressing) + //! + uint kzero = k; + uint ke = k; + uint kw = neighborX[k]; + uint kn = k; + uint ks = neighborY[k]; + uint kt = k; + uint kb = neighborZ[k]; + uint ksw = neighborY[kw]; + uint kne = k; + uint kse = ks; + uint knw = kw; + uint kbw = neighborZ[kw]; + uint kte = k; + uint kbe = kb; + uint ktw = kw; + uint kbs = neighborZ[ks]; + uint ktn = k; + uint kbn = kb; + uint kts = ks; + uint ktse = ks; + uint kbnw = kbw; + uint ktnw = kw; + uint kbse = kbs; + uint ktsw = ksw; + uint kbne = kb; + uint ktne = k; + uint kbsw = neighborZ[ksw]; + ////////////////////////////////////////////////////////////////////////// + //! - Calculate the equilibrium and set the distributions + //! + real cu_sq = c3o2*(vx1*vx1 + vx2*vx2 + vx3*vx3); + + (distAD.f[DIR_000])[kzero] = c8o27 * conc * (c1o1 - cu_sq); + (distAD.f[DIR_P00 ])[ke ] = c2o27 * conc * (c1o1 + c3o1 * ( vx1 ) + c9o2 * ( vx1 ) * ( vx1 ) - cu_sq); + (distAD.f[DIR_M00 ])[kw ] = c2o27 * conc * (c1o1 + c3o1 * (-vx1 ) + c9o2 * (-vx1 ) * (-vx1 ) - cu_sq); + (distAD.f[DIR_0P0 ])[kn ] = c2o27 * conc * (c1o1 + c3o1 * ( vx2 ) + c9o2 * ( vx2 ) * ( vx2 ) - cu_sq); + (distAD.f[DIR_0M0 ])[ks ] = c2o27 * conc * (c1o1 + c3o1 * ( - vx2 ) + c9o2 * ( - vx2 ) * ( - vx2 ) - cu_sq); + (distAD.f[DIR_00P ])[kt ] = c2o27 * conc * (c1o1 + c3o1 * ( vx3) + c9o2 * ( vx3) * ( vx3) - cu_sq); + (distAD.f[DIR_00M ])[kb ] = c2o27 * conc * (c1o1 + c3o1 * ( - vx3) + c9o2 * ( - vx3) * ( - vx3) - cu_sq); + (distAD.f[DIR_PP0 ])[kne ] = c1o54 * conc * (c1o1 + c3o1 * ( vx1 + vx2 ) + c9o2 * ( vx1 + vx2 ) * ( vx1 + vx2 ) - cu_sq); + (distAD.f[DIR_MM0 ])[ksw ] = c1o54 * conc * (c1o1 + c3o1 * (-vx1 - vx2 ) + c9o2 * (-vx1 - vx2 ) * (-vx1 - vx2 ) - cu_sq); + (distAD.f[DIR_PM0 ])[kse ] = c1o54 * conc * (c1o1 + c3o1 * ( vx1 - vx2 ) + c9o2 * ( vx1 - vx2 ) * ( vx1 - vx2 ) - cu_sq); + (distAD.f[DIR_MP0 ])[knw ] = c1o54 * conc * (c1o1 + c3o1 * (-vx1 + vx2 ) + c9o2 * (-vx1 + vx2 ) * (-vx1 + vx2 ) - cu_sq); + (distAD.f[DIR_P0P ])[kte ] = c1o54 * conc * (c1o1 + c3o1 * ( vx1 + vx3) + c9o2 * ( vx1 + vx3) * ( vx1 + vx3) - cu_sq); + (distAD.f[DIR_M0M ])[kbw ] = c1o54 * conc * (c1o1 + c3o1 * (-vx1 - vx3) + c9o2 * (-vx1 - vx3) * (-vx1 - vx3) - cu_sq); + (distAD.f[DIR_P0M ])[kbe ] = c1o54 * conc * (c1o1 + c3o1 * ( vx1 - vx3) + c9o2 * ( vx1 - vx3) * ( vx1 - vx3) - cu_sq); + (distAD.f[DIR_M0P ])[ktw ] = c1o54 * conc * (c1o1 + c3o1 * (-vx1 + vx3) + c9o2 * (-vx1 + vx3) * (-vx1 + vx3) - cu_sq); + (distAD.f[DIR_0PP ])[ktn ] = c1o54 * conc * (c1o1 + c3o1 * ( vx2 + vx3) + c9o2 * ( vx2 + vx3) * ( vx2 + vx3) - cu_sq); + (distAD.f[DIR_0MM ])[kbs ] = c1o54 * conc * (c1o1 + c3o1 * ( - vx2 - vx3) + c9o2 * ( - vx2 - vx3) * ( - vx2 - vx3) - cu_sq); + (distAD.f[DIR_0PM ])[kbn ] = c1o54 * conc * (c1o1 + c3o1 * ( vx2 - vx3) + c9o2 * ( vx2 - vx3) * ( vx2 - vx3) - cu_sq); + (distAD.f[DIR_0MP ])[kts ] = c1o54 * conc * (c1o1 + c3o1 * ( - vx2 + vx3) + c9o2 * ( - vx2 + vx3) * ( - vx2 + vx3) - cu_sq); + (distAD.f[DIR_PPP ])[ktne ] = c1o216 * conc * (c1o1 + c3o1 * ( vx1 + vx2 + vx3) + c9o2 * ( vx1 + vx2 + vx3) * ( vx1 + vx2 + vx3) - cu_sq); + (distAD.f[DIR_MMM ])[kbsw ] = c1o216 * conc * (c1o1 + c3o1 * (-vx1 - vx2 - vx3) + c9o2 * (-vx1 - vx2 - vx3) * (-vx1 - vx2 - vx3) - cu_sq); + (distAD.f[DIR_PPM ])[kbne ] = c1o216 * conc * (c1o1 + c3o1 * ( vx1 + vx2 - vx3) + c9o2 * ( vx1 + vx2 - vx3) * ( vx1 + vx2 - vx3) - cu_sq); + (distAD.f[DIR_MMP ])[ktsw ] = c1o216 * conc * (c1o1 + c3o1 * (-vx1 - vx2 + vx3) + c9o2 * (-vx1 - vx2 + vx3) * (-vx1 - vx2 + vx3) - cu_sq); + (distAD.f[DIR_PMP ])[ktse ] = c1o216 * conc * (c1o1 + c3o1 * ( vx1 - vx2 + vx3) + c9o2 * ( vx1 - vx2 + vx3) * ( vx1 - vx2 + vx3) - cu_sq); + (distAD.f[DIR_MPM ])[kbnw ] = c1o216 * conc * (c1o1 + c3o1 * (-vx1 + vx2 - vx3) + c9o2 * (-vx1 + vx2 - vx3) * (-vx1 + vx2 - vx3) - cu_sq); + (distAD.f[DIR_PMM ])[kbse ] = c1o216 * conc * (c1o1 + c3o1 * ( vx1 - vx2 - vx3) + c9o2 * ( vx1 - vx2 - vx3) * ( vx1 - vx2 - vx3) - cu_sq); + (distAD.f[DIR_MPP ])[ktnw ] = c1o216 * conc * (c1o1 + c3o1 * (-vx1 + vx2 + vx3) + c9o2 * (-vx1 + vx2 + vx3) * (-vx1 + vx2 + vx3) - cu_sq); + } +} + + + + + + + + + + + + + + + + + + + + +// DEPRECATED (2022) + +// //////////////////////////////////////////////////////////////////////////////// +// __global__ void InitAD27(unsigned int* neighborX, +// unsigned int* neighborY, +// unsigned int* neighborZ, +// unsigned int* geoD, +// real* Conc, +// real* ux, +// real* uy, +// real* uz, +// unsigned int size_Mat, +// real* DD27, +// bool EvenOrOdd) +// { +// //////////////////////////////////////////////////////////////////////////////// +// const unsigned x = threadIdx.x; // Globaler x-Index +// const unsigned y = blockIdx.x; // Globaler y-Index +// const unsigned z = blockIdx.y; // Globaler z-Index + +// const unsigned nx = blockDim.x; +// const unsigned ny = gridDim.x; + +// const unsigned k = nx*(ny*z + y) + x; +// ////////////////////////////////////////////////////////////////////////// + +// if(k<size_Mat) +// { +// //////////////////////////////////////////////////////////////////////////////// +// unsigned int BC; +// BC = geoD[k]; + +// if( BC != GEO_SOLID && BC != GEO_VOID) +// { +// Distributions27 D27; +// if (EvenOrOdd==true) +// { +// D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; +// D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; +// D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; +// D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; +// D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; +// D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; +// D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; +// D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; +// D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; +// D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; +// D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; +// D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; +// D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; +// D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; +// D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; +// D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; +// D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; +// D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; +// D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; +// D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; +// D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; +// D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; +// D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; +// D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; +// D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; +// D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; +// D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; +// } +// else +// { +// D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; +// D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; +// D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; +// D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; +// D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; +// D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; +// D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; +// D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; +// D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; +// D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; +// D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; +// D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; +// D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; +// D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; +// D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; +// D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; +// D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; +// D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; +// D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; +// D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; +// D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; +// D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; +// D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; +// D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; +// D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; +// D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; +// D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; +// } +// ////////////////////////////////////////////////////////////////////////// +// real ConcD = Conc[k]; +// real vx1 = ux[k]; +// real vx2 = uy[k]; +// real vx3 = uz[k]; +// //real lambdaD = -three + sqrt(three); +// //real Diffusivity = c1o20; +// //real Lam = -(c1o2+one/lambdaD); +// //real nue_d = Lam/three; +// //real ae = Diffusivity/nue_d - one; +// //real ux_sq = vx1 * vx1; +// //real uy_sq = vx2 * vx2; +// //real uz_sq = vx3 * vx3; +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// //D3Q7 +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// //index +// //unsigned int kzero= k; +// //unsigned int ke = k; +// //unsigned int kw = neighborX[k]; +// //unsigned int kn = k; +// //unsigned int ks = neighborY[k]; +// //unsigned int kt = k; +// //unsigned int kb = neighborZ[k]; +// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// //(D7.f[0])[kzero] = ConcD*(c1o3*(ae*(-three))-(ux_sq+uy_sq+uz_sq)); +// //(D7.f[1])[ke ] = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)+vx1*c1o2); +// //(D7.f[2])[kw ] = ConcD*(c1o6*(ae+one)+c1o2*(ux_sq)-vx1*c1o2); +// //(D7.f[3])[kn ] = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)+vx2*c1o2); +// //(D7.f[4])[ks ] = ConcD*(c1o6*(ae+one)+c1o2*(uy_sq)-vx2*c1o2); +// //(D7.f[5])[kt ] = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)+vx3*c1o2); +// //(D7.f[6])[kb ] = ConcD*(c1o6*(ae+one)+c1o2*(uz_sq)-vx3*c1o2); +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// //D3Q27 +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// //index +// unsigned int kzero= k; +// unsigned int ke = k; +// unsigned int kw = neighborX[k]; +// unsigned int kn = k; +// unsigned int ks = neighborY[k]; +// unsigned int kt = k; +// unsigned int kb = neighborZ[k]; +// unsigned int ksw = neighborY[kw]; +// unsigned int kne = k; +// unsigned int kse = ks; +// unsigned int knw = kw; +// unsigned int kbw = neighborZ[kw]; +// unsigned int kte = k; +// unsigned int kbe = kb; +// unsigned int ktw = kw; +// unsigned int kbs = neighborZ[ks]; +// unsigned int ktn = k; +// unsigned int kbn = kb; +// unsigned int kts = ks; +// unsigned int ktse = ks; +// unsigned int kbnw = kbw; +// unsigned int ktnw = kw; +// unsigned int kbse = kbs; +// unsigned int ktsw = ksw; +// unsigned int kbne = kb; +// unsigned int ktne = k; +// unsigned int kbsw = neighborZ[ksw]; +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); + +// (D27.f[DIR_000])[kzero] = c8o27* ConcD*(c1o1-cu_sq); +// (D27.f[DIR_P00 ])[ke ] = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); +// (D27.f[DIR_M00 ])[kw ] = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); +// (D27.f[DIR_0P0 ])[kn ] = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); +// (D27.f[DIR_0M0 ])[ks ] = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); +// (D27.f[DIR_00P ])[kt ] = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); +// (D27.f[DIR_00M ])[kb ] = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); +// (D27.f[DIR_PP0 ])[kne ] = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); +// (D27.f[DIR_MM0 ])[ksw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); +// (D27.f[DIR_PM0 ])[kse ] = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); +// (D27.f[DIR_MP0 ])[knw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); +// (D27.f[DIR_P0P ])[kte ] = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); +// (D27.f[DIR_M0M ])[kbw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); +// (D27.f[DIR_P0M ])[kbe ] = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); +// (D27.f[DIR_M0P ])[ktw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); +// (D27.f[DIR_0PP ])[ktn ] = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); +// (D27.f[DIR_0MM ])[kbs ] = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); +// (D27.f[DIR_0PM ])[kbn ] = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); +// (D27.f[DIR_0MP ])[kts ] = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); +// (D27.f[DIR_PPP ])[ktne ] = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); +// (D27.f[DIR_MMM ])[kbsw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); +// (D27.f[DIR_PPM ])[kbne ] = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); +// (D27.f[DIR_MMP ])[ktsw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); +// (D27.f[DIR_PMP ])[ktse ] = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); +// (D27.f[DIR_MPM ])[kbnw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); +// (D27.f[DIR_PMM ])[kbse ] = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); +// (D27.f[DIR_MPP ])[ktnw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// } +// } +// } + + + + + + + + + + + + + + + + + + +//////////////////////////////////////////////////////////////////////////////// +__global__ void InitAD7( unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int* geoD, + real* Conc, + real* ux, + real* uy, + real* uz, + unsigned int size_Mat, + real* DD7, + bool EvenOrOdd) +{ + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k<size_Mat) + { + //////////////////////////////////////////////////////////////////////////////// + unsigned int BC; + BC = geoD[k]; + + if( BC != GEO_SOLID && BC != GEO_VOID) + { + Distributions7 D7; + if (EvenOrOdd==true) + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[1] = &DD7[1*size_Mat]; + D7.f[2] = &DD7[2*size_Mat]; + D7.f[3] = &DD7[3*size_Mat]; + D7.f[4] = &DD7[4*size_Mat]; + D7.f[5] = &DD7[5*size_Mat]; + D7.f[6] = &DD7[6*size_Mat]; + } + else + { + D7.f[0] = &DD7[0*size_Mat]; + D7.f[2] = &DD7[1*size_Mat]; + D7.f[1] = &DD7[2*size_Mat]; + D7.f[4] = &DD7[3*size_Mat]; + D7.f[3] = &DD7[4*size_Mat]; + D7.f[6] = &DD7[5*size_Mat]; + D7.f[5] = &DD7[6*size_Mat]; + } + ////////////////////////////////////////////////////////////////////////// + real ConcD = Conc[k]; + real vx1 = ux[k]; + real vx2 = uy[k]; + real vx3 = uz[k]; + real lambdaD = -c3o1 + sqrt(c3o1); + real Diffusivity = c1o20; + real Lam = -(c1o2+c1o1/lambdaD); + real nue_d = Lam/c3o1; + real ae = Diffusivity/nue_d - c1o1; + real ux_sq = vx1 * vx1; + real uy_sq = vx2 * vx2; + real uz_sq = vx3 * vx3; + ////////////////////////////////////////////////////////////////////////// + //index + ////////////////////////////////////////////////////////////////////////// + unsigned int kzero= k; + unsigned int ke = k; + unsigned int kw = neighborX[k]; + unsigned int kn = k; + unsigned int ks = neighborY[k]; + unsigned int kt = k; + unsigned int kb = neighborZ[k]; + ////////////////////////////////////////////////////////////////////////// + + (D7.f[0])[kzero] = ConcD*(c1o3*(ae*(-c3o1))-(ux_sq+uy_sq+uz_sq)); + (D7.f[1])[ke ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)+vx1*c1o2); + (D7.f[2])[kw ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(ux_sq)-vx1*c1o2); + (D7.f[3])[kn ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)+vx2*c1o2); + (D7.f[4])[ks ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(uy_sq)-vx2*c1o2); + (D7.f[5])[kt ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)+vx3*c1o2); + (D7.f[6])[kb ] = ConcD*(c1o6*(ae+c1o1)+c1o2*(uz_sq)-vx3*c1o2); + } + } +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/GPU/KernelUtilities.h b/src/gpu/VirtualFluids_GPU/GPU/KernelUtilities.h new file mode 100644 index 0000000000000000000000000000000000000000..2f6a11aa17398b65858508c3f94b241c16551b37 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/KernelUtilities.h @@ -0,0 +1,177 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file KernelUtilities.h +//! \ingroup GPU +//! \author Martin Schoenherr, Anna Wellmann +//====================================================================================== +#ifndef KERNELUTILS_H +#define KERNELUTILS_H + +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" +#include "lbm/constants/NumericConstants.h" + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + +__inline__ __device__ void getPointersToDistributions(Distributions27 &dist, real *distributionArray, const uint numberOfLBnodes, const bool isEvenTimestep) +{ + if (isEvenTimestep) + { + dist.f[DIR_P00 ] = &distributionArray[DIR_P00 *numberOfLBnodes]; + dist.f[DIR_M00 ] = &distributionArray[DIR_M00 *numberOfLBnodes]; + dist.f[DIR_0P0 ] = &distributionArray[DIR_0P0 *numberOfLBnodes]; + dist.f[DIR_0M0 ] = &distributionArray[DIR_0M0 *numberOfLBnodes]; + dist.f[DIR_00P ] = &distributionArray[DIR_00P *numberOfLBnodes]; + dist.f[DIR_00M ] = &distributionArray[DIR_00M *numberOfLBnodes]; + dist.f[DIR_PP0 ] = &distributionArray[DIR_PP0 *numberOfLBnodes]; + dist.f[DIR_MM0 ] = &distributionArray[DIR_MM0 *numberOfLBnodes]; + dist.f[DIR_PM0 ] = &distributionArray[DIR_PM0 *numberOfLBnodes]; + dist.f[DIR_MP0 ] = &distributionArray[DIR_MP0 *numberOfLBnodes]; + dist.f[DIR_P0P ] = &distributionArray[DIR_P0P *numberOfLBnodes]; + dist.f[DIR_M0M ] = &distributionArray[DIR_M0M *numberOfLBnodes]; + dist.f[DIR_P0M ] = &distributionArray[DIR_P0M *numberOfLBnodes]; + dist.f[DIR_M0P ] = &distributionArray[DIR_M0P *numberOfLBnodes]; + dist.f[DIR_0PP ] = &distributionArray[DIR_0PP *numberOfLBnodes]; + dist.f[DIR_0MM ] = &distributionArray[DIR_0MM *numberOfLBnodes]; + dist.f[DIR_0PM ] = &distributionArray[DIR_0PM *numberOfLBnodes]; + dist.f[DIR_0MP ] = &distributionArray[DIR_0MP *numberOfLBnodes]; + dist.f[DIR_000] = &distributionArray[DIR_000*numberOfLBnodes]; + dist.f[DIR_PPP ] = &distributionArray[DIR_PPP *numberOfLBnodes]; + dist.f[DIR_MMP ] = &distributionArray[DIR_MMP *numberOfLBnodes]; + dist.f[DIR_PMP ] = &distributionArray[DIR_PMP *numberOfLBnodes]; + dist.f[DIR_MPP ] = &distributionArray[DIR_MPP *numberOfLBnodes]; + dist.f[DIR_PPM ] = &distributionArray[DIR_PPM *numberOfLBnodes]; + dist.f[DIR_MMM ] = &distributionArray[DIR_MMM *numberOfLBnodes]; + dist.f[DIR_PMM ] = &distributionArray[DIR_PMM *numberOfLBnodes]; + dist.f[DIR_MPM ] = &distributionArray[DIR_MPM *numberOfLBnodes]; + } + else + { + dist.f[DIR_M00 ] = &distributionArray[DIR_P00 *numberOfLBnodes]; + dist.f[DIR_P00 ] = &distributionArray[DIR_M00 *numberOfLBnodes]; + dist.f[DIR_0M0 ] = &distributionArray[DIR_0P0 *numberOfLBnodes]; + dist.f[DIR_0P0 ] = &distributionArray[DIR_0M0 *numberOfLBnodes]; + dist.f[DIR_00M ] = &distributionArray[DIR_00P *numberOfLBnodes]; + dist.f[DIR_00P ] = &distributionArray[DIR_00M *numberOfLBnodes]; + dist.f[DIR_MM0 ] = &distributionArray[DIR_PP0 *numberOfLBnodes]; + dist.f[DIR_PP0 ] = &distributionArray[DIR_MM0 *numberOfLBnodes]; + dist.f[DIR_MP0 ] = &distributionArray[DIR_PM0 *numberOfLBnodes]; + dist.f[DIR_PM0 ] = &distributionArray[DIR_MP0 *numberOfLBnodes]; + dist.f[DIR_M0M ] = &distributionArray[DIR_P0P *numberOfLBnodes]; + dist.f[DIR_P0P ] = &distributionArray[DIR_M0M *numberOfLBnodes]; + dist.f[DIR_M0P ] = &distributionArray[DIR_P0M *numberOfLBnodes]; + dist.f[DIR_P0M ] = &distributionArray[DIR_M0P *numberOfLBnodes]; + dist.f[DIR_0MM ] = &distributionArray[DIR_0PP *numberOfLBnodes]; + dist.f[DIR_0PP ] = &distributionArray[DIR_0MM *numberOfLBnodes]; + dist.f[DIR_0MP ] = &distributionArray[DIR_0PM *numberOfLBnodes]; + dist.f[DIR_0PM ] = &distributionArray[DIR_0MP *numberOfLBnodes]; + dist.f[DIR_000] = &distributionArray[DIR_000*numberOfLBnodes]; + dist.f[DIR_PPP ] = &distributionArray[DIR_MMM *numberOfLBnodes]; + dist.f[DIR_MMP ] = &distributionArray[DIR_PPM *numberOfLBnodes]; + dist.f[DIR_PMP ] = &distributionArray[DIR_MPM *numberOfLBnodes]; + dist.f[DIR_MPP ] = &distributionArray[DIR_PMM *numberOfLBnodes]; + dist.f[DIR_PPM ] = &distributionArray[DIR_MMP *numberOfLBnodes]; + dist.f[DIR_MMM ] = &distributionArray[DIR_PPP *numberOfLBnodes]; + dist.f[DIR_PMM ] = &distributionArray[DIR_MPP *numberOfLBnodes]; + dist.f[DIR_MPM ] = &distributionArray[DIR_PMP *numberOfLBnodes]; + } +} + +__inline__ __device__ void getPointersToSubgridDistances(SubgridDistances27& subgridD, real* subgridDistances, const unsigned int numberOfSubgridIndices) +{ + subgridD.q[DIR_P00 ] = &subgridDistances[DIR_P00 *numberOfSubgridIndices]; + subgridD.q[DIR_M00 ] = &subgridDistances[DIR_M00 *numberOfSubgridIndices]; + subgridD.q[DIR_0P0 ] = &subgridDistances[DIR_0P0 *numberOfSubgridIndices]; + subgridD.q[DIR_0M0 ] = &subgridDistances[DIR_0M0 *numberOfSubgridIndices]; + subgridD.q[DIR_00P ] = &subgridDistances[DIR_00P *numberOfSubgridIndices]; + subgridD.q[DIR_00M ] = &subgridDistances[DIR_00M *numberOfSubgridIndices]; + subgridD.q[DIR_PP0 ] = &subgridDistances[DIR_PP0 *numberOfSubgridIndices]; + subgridD.q[DIR_MM0 ] = &subgridDistances[DIR_MM0 *numberOfSubgridIndices]; + subgridD.q[DIR_PM0 ] = &subgridDistances[DIR_PM0 *numberOfSubgridIndices]; + subgridD.q[DIR_MP0 ] = &subgridDistances[DIR_MP0 *numberOfSubgridIndices]; + subgridD.q[DIR_P0P ] = &subgridDistances[DIR_P0P *numberOfSubgridIndices]; + subgridD.q[DIR_M0M ] = &subgridDistances[DIR_M0M *numberOfSubgridIndices]; + subgridD.q[DIR_P0M ] = &subgridDistances[DIR_P0M *numberOfSubgridIndices]; + subgridD.q[DIR_M0P ] = &subgridDistances[DIR_M0P *numberOfSubgridIndices]; + subgridD.q[DIR_0PP ] = &subgridDistances[DIR_0PP *numberOfSubgridIndices]; + subgridD.q[DIR_0MM ] = &subgridDistances[DIR_0MM *numberOfSubgridIndices]; + subgridD.q[DIR_0PM ] = &subgridDistances[DIR_0PM *numberOfSubgridIndices]; + subgridD.q[DIR_0MP ] = &subgridDistances[DIR_0MP *numberOfSubgridIndices]; + subgridD.q[DIR_000] = &subgridDistances[DIR_000 *numberOfSubgridIndices]; + subgridD.q[DIR_PPP ] = &subgridDistances[DIR_PPP *numberOfSubgridIndices]; + subgridD.q[DIR_MMP ] = &subgridDistances[DIR_MMP *numberOfSubgridIndices]; + subgridD.q[DIR_PMP ] = &subgridDistances[DIR_PMP *numberOfSubgridIndices]; + subgridD.q[DIR_MPP ] = &subgridDistances[DIR_MPP *numberOfSubgridIndices]; + subgridD.q[DIR_PPM ] = &subgridDistances[DIR_PPM *numberOfSubgridIndices]; + subgridD.q[DIR_MMM ] = &subgridDistances[DIR_MMM *numberOfSubgridIndices]; + subgridD.q[DIR_PMM ] = &subgridDistances[DIR_PMM *numberOfSubgridIndices]; + subgridD.q[DIR_MPM ] = &subgridDistances[DIR_MPM *numberOfSubgridIndices]; +} + +__inline__ __device__ real getEquilibriumForBC(const real& drho, const real& velocity, const real& cu_sq, const real weight) +{ + return weight * (drho + c9o2 * velocity * velocity * (c1o1 + drho) - cu_sq); +} + +__inline__ __device__ real getInterpolatedDistributionForVeloBC(const real& q, const real& f, const real& fInverse, const real& feq, + const real& omega, const real& velocity, const real weight) +{ + + return (c1o1-q) / (c1o1+q) * (f - fInverse + (f + fInverse - c2o1 * feq * omega) / (c1o1 - omega)) * c1o2 + + (q * (f + fInverse) - c6o1 * weight * velocity) / (c1o1 + q); +} + +__inline__ __device__ real getBounceBackDistributionForVeloBC( const real& f, + const real& velocity, const real weight) +{ + + return f - (c6o1 * weight * velocity); +} + +__inline__ __device__ real getInterpolatedDistributionForNoSlipBC(const real& q, const real& f, const real& fInverse, const real& feq, + const real& omega) +{ + + return (c1o1-q) / (c1o1+q) * (f - fInverse + (f + fInverse - c2o1 * feq * omega) / (c1o1 - omega)) * c1o2 + + (q * (f + fInverse)) / (c1o1 + q); +} + + +__inline__ __device__ real getInterpolatedDistributionForVeloWithPressureBC(const real& q, const real& f, const real& fInverse, const real& feq, + const real& omega, const real& drho, const real& velocity, const real weight) +{ + + return (c1o1-q) / (c1o1+q) * (f - fInverse + (f + fInverse - c2o1 * feq * omega) / (c1o1 - omega)) * c1o2 + + (q * (f + fInverse) - c6o1 * weight * velocity) / (c1o1 + q) - weight * drho; +} + + + +#endif diff --git a/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu b/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu index 42e424062ffb3b13e1e787ceece30a05eb5527e2..51368bbe09e6fc43a7a1ff6b8b15387417774964 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu @@ -22,6 +22,7 @@ #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; __global__ void kineticEnergyKernel (real* vx, real* vy, real* vz, real* rho, uint* neighborX, uint* neighborY, uint* neighborZ, uint* neighborWSB, uint* geo, real* kineticEnergy, uint* isFluid, uint size_Mat); @@ -34,7 +35,7 @@ bool KineticEnergyAnalyzer::run(uint iter) if( iter % this->analyzeIter != 0 ) return false; int lev = 0; - int size_Mat = this->para->getParD(lev)->size_Mat_SP; + int size_Mat = this->para->getParD(lev)->numberOfNodes; thrust::device_vector<real> kineticEnergy(size_Mat, c0o1); thrust::device_vector<uint> isFluid (size_Mat, 0); @@ -55,29 +56,29 @@ bool KineticEnergyAnalyzer::run(uint iter) dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - LBCalcMacCompSP27<<< grid, threads >>> (para->getParD(lev)->vx_SP, - para->getParD(lev)->vy_SP, - para->getParD(lev)->vz_SP, - para->getParD(lev)->rho_SP, - para->getParD(lev)->press_SP, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->d0SP.f[0], - para->getParD(lev)->evenOrOdd); + LBCalcMacCompSP27<<< grid, threads >>> (para->getParD(lev)->velocityX, + para->getParD(lev)->velocityY, + para->getParD(lev)->velocityZ, + para->getParD(lev)->rho, + para->getParD(lev)->pressure, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, + para->getParD(lev)->distributions.f[0], + para->getParD(lev)->isEvenTimestep); getLastCudaError("LBCalcMacSP27 execution failed"); - kineticEnergyKernel <<< grid, threads >>> ( para->getParD(lev)->vx_SP, - para->getParD(lev)->vy_SP, - para->getParD(lev)->vz_SP, - para->getParD(lev)->rho_SP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->neighborWSB_SP, - para->getParD(lev)->geoSP, + kineticEnergyKernel <<< grid, threads >>> ( para->getParD(lev)->velocityX, + para->getParD(lev)->velocityY, + para->getParD(lev)->velocityZ, + para->getParD(lev)->rho, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->neighborInverse, + para->getParD(lev)->typeOfGridNode, kineticEnergy.data().get(), isFluid.data().get(), size_Mat); diff --git a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu index 8b80e5ea9dbed3deef4c4332b2d43bf62ba9e48b..63fc5be0ebe5d4a26d4662ee8c0dddbc3098247a 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu @@ -1,7 +1,7 @@ // _ ___ __ __________ _ __ ______________ __ // | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ / ___/ __ / / / / // | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ / /___/ /_/ / / / / -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) / /_) / ____/ /__/ / +// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) / /_) / ____/ /__/ / // |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ \____/_/ \_____/ // ////////////////////////////////////////////////////////////////////////// @@ -11,13 +11,16 @@ #include <helper_cuda.h> #include "LBM/LB.h" +#include "cuda/CudaGrid.h" // includes, kernels #include "GPU/GPU_Kernels.cuh" + +#include "Parameter/Parameter.h" ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelCas27( unsigned int grid_nx, - unsigned int grid_ny, - unsigned int grid_nz, +void KernelCas27( unsigned int grid_nx, + unsigned int grid_ny, + unsigned int grid_nz, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -37,11 +40,11 @@ extern "C" void KernelCas27( unsigned int grid_nx, neighborZ, DD, size_Mat, - EvenOrOdd); - getLastCudaError("LB_Kernel_Casc27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_Casc27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelCasSP27( unsigned int numberOfThreads, +void KernelCasSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -57,7 +60,7 @@ extern "C" void KernelCasSP27( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -73,11 +76,11 @@ extern "C" void KernelCasSP27( unsigned int numberOfThreads, neighborZ, DD, size_Mat, - EvenOrOdd); - getLastCudaError("LB_Kernel_Casc_SP_27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_Casc_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelCasSPMS27( unsigned int numberOfThreads, +void KernelCasSPMS27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -93,7 +96,7 @@ extern "C" void KernelCasSPMS27( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -109,11 +112,11 @@ extern "C" void KernelCasSPMS27( unsigned int numberOfThreads, neighborZ, DD, size_Mat, - EvenOrOdd); - getLastCudaError("LB_Kernel_Casc_SP_MS_27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_Casc_SP_MS_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelCasSPMSOHM27( unsigned int numberOfThreads, +void KernelCasSPMSOHM27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -129,7 +132,7 @@ extern "C" void KernelCasSPMSOHM27( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -145,11 +148,11 @@ extern "C" void KernelCasSPMSOHM27( unsigned int numberOfThreads, neighborZ, DD, size_Mat, - EvenOrOdd); - getLastCudaError("LB_Kernel_Casc_SP_MS_OHM_27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_Casc_SP_MS_OHM_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelKumCompSRTSP27( +void KernelKumCompSRTSP27( unsigned int numberOfThreads, real omega, unsigned int* bcMatD, @@ -168,7 +171,7 @@ extern "C" void KernelKumCompSRTSP27( { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -187,11 +190,11 @@ extern "C" void KernelKumCompSRTSP27( size_Mat, level, forces, - EvenOrOdd); - getLastCudaError("LB_Kernel_Kum_New_Comp_SRT_SP_27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_Kum_New_Comp_SRT_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelKum1hSP27( unsigned int numberOfThreads, +void KernelKum1hSP27( unsigned int numberOfThreads, real omega, real deltaPhi, real angularVelocity, @@ -212,7 +215,7 @@ extern "C" void KernelKum1hSP27( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -233,11 +236,11 @@ extern "C" void KernelKum1hSP27( unsigned int numberOfThreads, coordZ, DDStart, size_Mat, - EvenOrOdd); - getLastCudaError("LB_Kernel_Kum_New_SP_27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_Kum_New_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelCascadeSP27( unsigned int numberOfThreads, +void KernelCascadeSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -253,7 +256,7 @@ extern "C" void KernelCascadeSP27( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -269,11 +272,11 @@ extern "C" void KernelCascadeSP27( unsigned int numberOfThreads, neighborZ, DD, size_Mat, - EvenOrOdd); - getLastCudaError("LB_Kernel_Cascade_SP_27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_Cascade_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelKumNewSP27( unsigned int numberOfThreads, +void KernelKumNewSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -289,7 +292,7 @@ extern "C" void KernelKumNewSP27( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -305,11 +308,11 @@ extern "C" void KernelKumNewSP27( unsigned int numberOfThreads, neighborZ, DD, size_Mat, - EvenOrOdd); - getLastCudaError("LB_Kernel_Kum_New_SP_27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_Kum_New_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelKumNewCompSP27(unsigned int numberOfThreads, +void KernelKumNewCompSP27(unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -350,12 +353,12 @@ extern "C" void KernelKumNewCompSP27(unsigned int numberOfThreads, // size_Mat, // level, // forces, - // EvenOrOdd); - //getLastCudaError("LB_Kernel_Kum_New_Comp_SP_27 execution failed"); + // EvenOrOdd); + //getLastCudaError("LB_Kernel_Kum_New_Comp_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CumulantOnePreconditionedErrorDiffusionChimCompSP27(unsigned int numberOfThreads, +void CumulantOnePreconditionedErrorDiffusionChimCompSP27(unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -396,11 +399,11 @@ extern "C" void CumulantOnePreconditionedErrorDiffusionChimCompSP27(unsigned int size_Mat, level, forces, - EvenOrOdd); - getLastCudaError("Cumulant_One_preconditioned_chim_Comp_SP_27 execution failed"); + EvenOrOdd); + getLastCudaError("Cumulant_One_preconditioned_chim_Comp_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CumulantOnePreconditionedChimCompSP27( unsigned int numberOfThreads, +void CumulantOnePreconditionedChimCompSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -441,11 +444,11 @@ extern "C" void CumulantOnePreconditionedChimCompSP27( unsigned int numberOfThr size_Mat, level, forces, - EvenOrOdd); - getLastCudaError("Cumulant_One_preconditioned_chim_Comp_SP_27 execution failed"); + EvenOrOdd); + getLastCudaError("Cumulant_One_preconditioned_chim_Comp_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CumulantOneChimCompSP27(unsigned int numberOfThreads, +void CumulantOneChimCompSP27(unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -486,11 +489,11 @@ extern "C" void CumulantOneChimCompSP27(unsigned int numberOfThreads, size_Mat, level, forces, - EvenOrOdd); - getLastCudaError("Cumulant_One_chim_Comp_SP_27 execution failed"); + EvenOrOdd); + getLastCudaError("Cumulant_One_chim_Comp_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelKumIsoTestSP27(unsigned int numberOfThreads, +void KernelKumIsoTestSP27(unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -509,7 +512,7 @@ extern "C" void KernelKumIsoTestSP27(unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -528,11 +531,11 @@ extern "C" void KernelKumIsoTestSP27(unsigned int numberOfThreads, dyyUy, dzzUz, size_Mat, - EvenOrOdd); - getLastCudaError("LB_Kernel_Kum_IsoTest_SP_27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_Kum_IsoTest_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelKumCompSP27( unsigned int numberOfThreads, +void KernelKumCompSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, unsigned int* neighborX, @@ -548,7 +551,7 @@ extern "C" void KernelKumCompSP27( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -564,11 +567,11 @@ extern "C" void KernelKumCompSP27( unsigned int numberOfThreads, neighborZ, DD, size_Mat, - EvenOrOdd); - getLastCudaError("LB_Kernel_Kum_Comp_SP_27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_Kum_Comp_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelPMCumOneCompSP27(unsigned int numberOfThreads, +void KernelPMCumOneCompSP27(unsigned int numberOfThreads, real omega, unsigned int* neighborX, unsigned int* neighborY, @@ -581,7 +584,7 @@ extern "C" void KernelPMCumOneCompSP27(unsigned int numberOfThreads, real darcy, real forchheimer, unsigned int sizeOfPorousMedia, - unsigned int* nodeIdsPorousMedia, + unsigned int* nodeIdsPorousMedia, bool EvenOrOdd) { int Grid = (size_Mat / numberOfThreads) + 1; @@ -612,11 +615,11 @@ extern "C" void KernelPMCumOneCompSP27(unsigned int numberOfThreads, forchheimer, sizeOfPorousMedia, nodeIdsPorousMedia, - EvenOrOdd); - getLastCudaError("LB_Kernel_PM_Cum_One_Comp_SP_27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_PM_Cum_One_Comp_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelWaleBySoniMalavCumAA2016CompSP27( +void KernelWaleBySoniMalavCumAA2016CompSP27( unsigned int numberOfThreads, real s9, unsigned int* bcMatD, @@ -673,7 +676,7 @@ extern "C" void KernelWaleBySoniMalavCumAA2016CompSP27( getLastCudaError("LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelADincomp7( unsigned int numberOfThreads, +void KernelADincomp7( unsigned int numberOfThreads, real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, @@ -690,7 +693,7 @@ extern "C" void KernelADincomp7( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -707,11 +710,11 @@ extern "C" void KernelADincomp7( unsigned int numberOfThreads, DD, DD7, size_Mat, - EvenOrOdd); - getLastCudaError("LB_Kernel_AD_Incomp_7 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_AD_Incomp_7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void KernelADincomp27( unsigned int numberOfThreads, +void KernelADincomp27( unsigned int numberOfThreads, real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, @@ -728,7 +731,7 @@ extern "C" void KernelADincomp27( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -745,11 +748,11 @@ extern "C" void KernelADincomp27( unsigned int numberOfThreads, DD, DD27, size_Mat, - EvenOrOdd); - getLastCudaError("LB_Kernel_AD_Incomp_27 execution failed"); + EvenOrOdd); + getLastCudaError("LB_Kernel_AD_Incomp_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void Init27( int myid, +void Init27( int myid, int numprocs, real u0, unsigned int* geoD, @@ -758,35 +761,35 @@ extern "C" void Init27( int myid, unsigned int* neighborZ, real* vParab, unsigned int size_Mat, - unsigned int grid_nx, - unsigned int grid_ny, - unsigned int grid_nz, + unsigned int grid_nx, + unsigned int grid_ny, + unsigned int grid_nz, real* DD, int level, int maxlevel) -{ +{ dim3 threads ( grid_nx, 1, 1 ); dim3 grid ( grid_ny, grid_nz ); // Gitter fuer Kollision und Propagation - LBInit27<<< grid, threads >>> ( myid, - numprocs, - u0, - geoD, + LBInit27<<< grid, threads >>> ( myid, + numprocs, + u0, + geoD, neighborX, neighborY, neighborZ, - vParab, - size_Mat, - grid_nx, - grid_ny, - grid_nz, + vParab, + size_Mat, + grid_nx, + grid_ny, + grid_nz, DD, level, - maxlevel); - getLastCudaError("LBInit27 execution failed"); + maxlevel); + getLastCudaError("LBInit27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void InitNonEqPartSP27( unsigned int numberOfThreads, +void InitNonEqPartSP27( unsigned int numberOfThreads, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, @@ -807,7 +810,7 @@ extern "C" void InitNonEqPartSP27( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -829,10 +832,10 @@ extern "C" void InitNonEqPartSP27( unsigned int numberOfThreads, DD, omega, EvenOrOdd); - getLastCudaError("LBInitNonEqPartSP27 execution failed"); + getLastCudaError("LBInitNonEqPartSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void InitThS7( unsigned int numberOfThreads, +void InitThS7( unsigned int numberOfThreads, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, @@ -851,7 +854,7 @@ extern "C" void InitThS7( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -860,7 +863,7 @@ extern "C" void InitThS7( unsigned int numberOfThreads, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - LBInitThS7<<< grid, threads >>>( neighborX, + InitAD7<<< grid, threads >>>( neighborX, neighborY, neighborZ, geoD, @@ -871,10 +874,10 @@ extern "C" void InitThS7( unsigned int numberOfThreads, size_Mat, DD7, EvenOrOdd); - getLastCudaError("LBInitThS7 execution failed"); + getLastCudaError("InitAD7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void InitThS27( unsigned int numberOfThreads, +void InitADDev27( unsigned int numberOfThreads, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, @@ -893,7 +896,7 @@ extern "C" void InitThS27( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -902,7 +905,7 @@ extern "C" void InitThS27( unsigned int numberOfThreads, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - LBInitThS27<<< grid, threads >>>(neighborX, + InitAD27<<< grid, threads >>>(neighborX, neighborY, neighborZ, geoD, @@ -913,10 +916,10 @@ extern "C" void InitThS27( unsigned int numberOfThreads, size_Mat, DD27, EvenOrOdd); - getLastCudaError("LBInitThS27 execution failed"); + getLastCudaError("InitAD27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void PostProcessorF3_2018Fehlberg( +void PostProcessorF3_2018Fehlberg( unsigned int numberOfThreads, real omega, unsigned int* bcMatD, @@ -933,7 +936,7 @@ extern "C" void PostProcessorF3_2018Fehlberg( int level, real* forces, bool EvenOrOdd) -{ +{ int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; if (Grid>512) @@ -964,10 +967,10 @@ extern "C" void PostProcessorF3_2018Fehlberg( level, forces, EvenOrOdd); - getLastCudaError("LB_PostProcessor_F3_2018_Fehlberg execution failed"); + getLastCudaError("LB_PostProcessor_F3_2018_Fehlberg execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcMac27( real* vxD, +void CalcMac27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -976,30 +979,30 @@ extern "C" void CalcMac27( real* vxD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int grid_nx, - unsigned int grid_ny, - unsigned int grid_nz, + unsigned int grid_nx, + unsigned int grid_ny, + unsigned int grid_nz, real* DD, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ dim3 threads ( grid_nx, 1, 1 ); dim3 grid ( grid_ny, grid_nz ); - LBCalcMac27<<< grid, threads >>> ( vxD, - vyD, - vzD, - rhoD, - geoD, + LBCalcMac27<<< grid, threads >>> ( vxD, + vyD, + vzD, + rhoD, + geoD, neighborX, neighborY, neighborZ, - size_Mat, - DD, - evenOrOdd); - getLastCudaError("LBCalcMac27 execution failed"); + size_Mat, + DD, + isEvenTimestep); + getLastCudaError("LBCalcMac27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcMacSP27( real* vxD, +void CalcMacSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -1009,17 +1012,17 @@ extern "C" void CalcMacSP27( real* vxD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1028,22 +1031,22 @@ extern "C" void CalcMacSP27( real* vxD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - LBCalcMacSP27<<< grid, threads >>> ( vxD, - vyD, - vzD, - rhoD, - pressD, - geoD, + LBCalcMacSP27<<< grid, threads >>> ( vxD, + vyD, + vzD, + rhoD, + pressD, + geoD, neighborX, neighborY, neighborZ, - size_Mat, - DD, - evenOrOdd); - getLastCudaError("LBCalcMacSP27 execution failed"); + size_Mat, + DD, + isEvenTimestep); + getLastCudaError("LBCalcMacSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcMacCompSP27( real* vxD, +void CalcMacCompSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -1053,17 +1056,17 @@ extern "C" void CalcMacCompSP27( real* vxD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1072,38 +1075,38 @@ extern "C" void CalcMacCompSP27( real* vxD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - LBCalcMacCompSP27<<< grid, threads >>> ( vxD, - vyD, - vzD, - rhoD, - pressD, - geoD, + LBCalcMacCompSP27<<< grid, threads >>> ( vxD, + vyD, + vzD, + rhoD, + pressD, + geoD, neighborX, neighborY, neighborZ, - size_Mat, - DD, - evenOrOdd); - getLastCudaError("LBCalcMacSP27 execution failed"); + size_Mat, + DD, + isEvenTimestep); + getLastCudaError("LBCalcMacSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcMacThS7( real* Conc, +void CalcMacThS7( real* Conc, unsigned int* geoD, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD7, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1112,18 +1115,18 @@ extern "C" void CalcMacThS7( real* Conc, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - LBCalcMacThS7<<< grid, threads >>> (Conc, - geoD, + CalcConc7<<< grid, threads >>> (Conc, + geoD, neighborX, neighborY, neighborZ, - size_Mat, - DD7, - evenOrOdd); - getLastCudaError("LBCalcMacThS7 execution failed"); + size_Mat, + DD7, + isEvenTimestep); + getLastCudaError("CalcConc7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void PlaneConcThS7(real* Conc, +void PlaneConcThS7(real* Conc, int* kPC, unsigned int numberOfPointskPC, unsigned int* geoD, @@ -1131,17 +1134,17 @@ extern "C" void PlaneConcThS7(real* Conc, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD7, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (numberOfPointskPC / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1150,20 +1153,20 @@ extern "C" void PlaneConcThS7(real* Conc, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - GetPlaneConcThS7<<< grid, threads >>> ( Conc, + GetPlaneConc7<<< grid, threads >>> ( Conc, kPC, numberOfPointskPC, - geoD, + geoD, neighborX, neighborY, neighborZ, - size_Mat, - DD7, - evenOrOdd); - getLastCudaError("GetPlaneConcThS7 execution failed"); + size_Mat, + DD7, + isEvenTimestep); + getLastCudaError("GetPlaneConc7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void PlaneConcThS27(real* Conc, +void PlaneConcThS27(real* Conc, int* kPC, unsigned int numberOfPointskPC, unsigned int* geoD, @@ -1171,17 +1174,17 @@ extern "C" void PlaneConcThS27(real* Conc, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD27, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (numberOfPointskPC / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1190,36 +1193,36 @@ extern "C" void PlaneConcThS27(real* Conc, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - GetPlaneConcThS27<<< grid, threads >>> ( Conc, + GetPlaneConc27<<< grid, threads >>> ( Conc, kPC, numberOfPointskPC, - geoD, + geoD, neighborX, neighborY, neighborZ, - size_Mat, - DD27, - evenOrOdd); - getLastCudaError("GetPlaneConcThS27 execution failed"); + size_Mat, + DD27, + isEvenTimestep); + getLastCudaError("GetPlaneConc27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcMacThS27( real* Conc, - unsigned int* geoD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - unsigned int numberOfThreads, - real* DD27, - bool evenOrOdd) -{ +void CalcConcentration27( unsigned int numberOfThreads, + real* Conc, + unsigned int* geoD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + real* DD27, + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1228,18 +1231,18 @@ extern "C" void CalcMacThS27( real* Conc, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - LBCalcMacThS27<<< grid, threads >>> ( Conc, - geoD, + CalcConc27<<< grid, threads >>> ( Conc, + geoD, neighborX, neighborY, neighborZ, - size_Mat, - DD27, - evenOrOdd); - getLastCudaError("LBCalcMacThS27 execution failed"); + size_Mat, + DD27, + isEvenTimestep); + getLastCudaError("CalcConc27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcMedSP27( real* vxD, +void CalcMedSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -1249,17 +1252,17 @@ extern "C" void CalcMedSP27( real* vxD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1268,22 +1271,22 @@ extern "C" void CalcMedSP27( real* vxD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - LBCalcMedSP27<<< grid, threads >>> ( vxD, - vyD, - vzD, - rhoD, - pressD, - geoD, + LBCalcMedSP27<<< grid, threads >>> ( vxD, + vyD, + vzD, + rhoD, + pressD, + geoD, neighborX, neighborY, neighborZ, - size_Mat, - DD, - evenOrOdd); - getLastCudaError("LBCalcMedSP27 execution failed"); + size_Mat, + DD, + isEvenTimestep); + getLastCudaError("LBCalcMedSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcMedCompSP27( real* vxD, +void CalcMedCompSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -1293,17 +1296,17 @@ extern "C" void CalcMedCompSP27( real* vxD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1312,22 +1315,22 @@ extern "C" void CalcMedCompSP27( real* vxD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - LBCalcMedCompSP27<<< grid, threads >>> ( vxD, - vyD, - vzD, - rhoD, - pressD, - geoD, + LBCalcMedCompSP27<<< grid, threads >>> ( vxD, + vyD, + vzD, + rhoD, + pressD, + geoD, neighborX, neighborY, neighborZ, - size_Mat, - DD, - evenOrOdd); - getLastCudaError("LBCalcMedSP27 execution failed"); + size_Mat, + DD, + isEvenTimestep); + getLastCudaError("LBCalcMedSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcMedCompAD27( +void CalcMedCompAD27( real* vxD, real* vyD, real* vzD, @@ -1342,7 +1345,7 @@ extern "C" void CalcMedCompAD27( unsigned int numberOfThreads, real* DD, real* DD_AD, - bool evenOrOdd) + bool isEvenTimestep) { int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -1373,11 +1376,11 @@ extern "C" void CalcMedCompAD27( size_Mat, DD, DD_AD, - evenOrOdd); + isEvenTimestep); getLastCudaError("LBCalcMedAD27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcMacMedSP27( real* vxD, +void CalcMacMedSP27( real* vxD, real* vyD, real* vzD, real* rhoD, @@ -1388,16 +1391,16 @@ extern "C" void CalcMacMedSP27( real* vxD, unsigned int* neighborZ, unsigned int tdiff, unsigned int size_Mat, - unsigned int numberOfThreads, - bool evenOrOdd) -{ + unsigned int numberOfThreads, + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1406,22 +1409,22 @@ extern "C" void CalcMacMedSP27( real* vxD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - LBCalcMacMedSP27<<< grid, threads >>> ( vxD, - vyD, - vzD, - rhoD, - pressD, - geoD, + LBCalcMacMedSP27<<< grid, threads >>> ( vxD, + vyD, + vzD, + rhoD, + pressD, + geoD, neighborX, neighborY, neighborZ, tdiff, size_Mat, - evenOrOdd); - getLastCudaError("LBCalcMacMedSP27 execution failed"); + isEvenTimestep); + getLastCudaError("LBCalcMacMedSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ResetMedianValuesSP27( +void ResetMedianValuesSP27( real* vxD, real* vyD, real* vzD, @@ -1429,7 +1432,7 @@ extern "C" void ResetMedianValuesSP27( real* pressD, unsigned int size_Mat, unsigned int numberOfThreads, - bool evenOrOdd) + bool isEvenTimestep) { int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -1453,11 +1456,11 @@ extern "C" void ResetMedianValuesSP27( rhoD, pressD, size_Mat, - evenOrOdd); + isEvenTimestep); getLastCudaError("LBResetMedianValuesSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ResetMedianValuesAD27( +void ResetMedianValuesAD27( real* vxD, real* vyD, real* vzD, @@ -1466,7 +1469,7 @@ extern "C" void ResetMedianValuesAD27( real* concD, unsigned int size_Mat, unsigned int numberOfThreads, - bool evenOrOdd) + bool isEvenTimestep) { int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -1491,11 +1494,11 @@ extern "C" void ResetMedianValuesAD27( pressD, concD, size_Mat, - evenOrOdd); + isEvenTimestep); getLastCudaError("LBResetMedianValuesAD27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void Calc2ndMomentsIncompSP27(real* kxyFromfcNEQ, +void Calc2ndMomentsIncompSP27(real* kxyFromfcNEQ, real* kyzFromfcNEQ, real* kxzFromfcNEQ, real* kxxMyyFromfcNEQ, @@ -1505,17 +1508,17 @@ extern "C" void Calc2ndMomentsIncompSP27(real* kxyFromfcNEQ, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1528,18 +1531,18 @@ extern "C" void Calc2ndMomentsIncompSP27(real* kxyFromfcNEQ, kyzFromfcNEQ, kxzFromfcNEQ, kxxMyyFromfcNEQ, - kxxMzzFromfcNEQ, - geoD, + kxxMzzFromfcNEQ, + geoD, neighborX, neighborY, neighborZ, - size_Mat, - DD, - evenOrOdd); - getLastCudaError("LBCalc2ndMomentsIncompSP27 execution failed"); + size_Mat, + DD, + isEvenTimestep); + getLastCudaError("LBCalc2ndMomentsIncompSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void Calc2ndMomentsCompSP27( real* kxyFromfcNEQ, +void Calc2ndMomentsCompSP27( real* kxyFromfcNEQ, real* kyzFromfcNEQ, real* kxzFromfcNEQ, real* kxxMyyFromfcNEQ, @@ -1549,17 +1552,17 @@ extern "C" void Calc2ndMomentsCompSP27( real* kxyFromfcNEQ, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1572,18 +1575,18 @@ extern "C" void Calc2ndMomentsCompSP27( real* kxyFromfcNEQ, kyzFromfcNEQ, kxzFromfcNEQ, kxxMyyFromfcNEQ, - kxxMzzFromfcNEQ, - geoD, + kxxMzzFromfcNEQ, + geoD, neighborX, neighborY, neighborZ, - size_Mat, - DD, - evenOrOdd); - getLastCudaError("LBCalc2ndMomentsCompSP27 execution failed"); + size_Mat, + DD, + isEvenTimestep); + getLastCudaError("LBCalc2ndMomentsCompSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void Calc3rdMomentsIncompSP27(real* CUMbbb, +void Calc3rdMomentsIncompSP27(real* CUMbbb, real* CUMabc, real* CUMbac, real* CUMbca, @@ -1595,17 +1598,17 @@ extern "C" void Calc3rdMomentsIncompSP27(real* CUMbbb, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1618,20 +1621,20 @@ extern "C" void Calc3rdMomentsIncompSP27(real* CUMbbb, CUMabc, CUMbac, CUMbca, - CUMcba, - CUMacb, - CUMcab, - geoD, + CUMcba, + CUMacb, + CUMcab, + geoD, neighborX, neighborY, neighborZ, - DD, - size_Mat, - evenOrOdd); - getLastCudaError("LBCalc3rdMomentsIncompSP27 execution failed"); + DD, + size_Mat, + isEvenTimestep); + getLastCudaError("LBCalc3rdMomentsIncompSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void Calc3rdMomentsCompSP27( real* CUMbbb, +void Calc3rdMomentsCompSP27( real* CUMbbb, real* CUMabc, real* CUMbac, real* CUMbca, @@ -1643,17 +1646,17 @@ extern "C" void Calc3rdMomentsCompSP27( real* CUMbbb, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1666,20 +1669,20 @@ extern "C" void Calc3rdMomentsCompSP27( real* CUMbbb, CUMabc, CUMbac, CUMbca, - CUMcba, - CUMacb, - CUMcab, - geoD, + CUMcba, + CUMacb, + CUMcab, + geoD, neighborX, neighborY, neighborZ, - DD, - size_Mat, - evenOrOdd); - getLastCudaError("LBCalc3rdMomentsCompSP27 execution failed"); + DD, + size_Mat, + isEvenTimestep); + getLastCudaError("LBCalc3rdMomentsCompSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcHigherMomentsIncompSP27(real* CUMcbb, +void CalcHigherMomentsIncompSP27(real* CUMcbb, real* CUMbcb, real* CUMbbc, real* CUMcca, @@ -1694,17 +1697,17 @@ extern "C" void CalcHigherMomentsIncompSP27(real* CUMcbb, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1717,23 +1720,23 @@ extern "C" void CalcHigherMomentsIncompSP27(real* CUMcbb, CUMbcb, CUMbbc, CUMcca, - CUMcac, - CUMacc, - CUMbcc, - CUMcbc, - CUMccb, - CUMccc, - geoD, + CUMcac, + CUMacc, + CUMbcc, + CUMcbc, + CUMccb, + CUMccc, + geoD, neighborX, neighborY, neighborZ, - DD, - size_Mat, - evenOrOdd); - getLastCudaError("LBCalcHigherMomentsIncompSP27 execution failed"); + DD, + size_Mat, + isEvenTimestep); + getLastCudaError("LBCalcHigherMomentsIncompSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcHigherMomentsCompSP27( real* CUMcbb, +void CalcHigherMomentsCompSP27( real* CUMcbb, real* CUMbcb, real* CUMbbc, real* CUMcca, @@ -1748,17 +1751,17 @@ extern "C" void CalcHigherMomentsCompSP27( real* CUMcbb, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - unsigned int numberOfThreads, + unsigned int numberOfThreads, real* DD, - bool evenOrOdd) -{ + bool isEvenTimestep) +{ int Grid = (size_Mat / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1771,23 +1774,23 @@ extern "C" void CalcHigherMomentsCompSP27( real* CUMcbb, CUMbcb, CUMbbc, CUMcca, - CUMcac, - CUMacc, - CUMbcc, - CUMcbc, - CUMccb, - CUMccc, - geoD, + CUMcac, + CUMacc, + CUMbcc, + CUMcbc, + CUMccb, + CUMccc, + geoD, neighborX, neighborY, neighborZ, - DD, - size_Mat, - evenOrOdd); - getLastCudaError("LBCalcHigherMomentsCompSP27 execution failed"); + DD, + size_Mat, + isEvenTimestep); + getLastCudaError("LBCalcHigherMomentsCompSP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void LBCalcMeasurePoints27(real* vxMP, +void LBCalcMeasurePoints27(real* vxMP, real* vyMP, real* vzMP, real* rhoMP, @@ -1801,16 +1804,16 @@ extern "C" void LBCalcMeasurePoints27(real* vxMP, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - unsigned int numberOfThreads, - bool evenOrOdd) -{ + unsigned int numberOfThreads, + bool isEvenTimestep) +{ int Grid = (numberOfPointskMP / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1833,102 +1836,99 @@ extern "C" void LBCalcMeasurePoints27(real* vxMP, neighborZ, size_Mat, DD, - evenOrOdd); - getLastCudaError("LBCalcMeasurePoints execution failed"); + isEvenTimestep); + getLastCudaError("LBCalcMeasurePoints execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void BcPress27( int nx, - int ny, - int tz, - unsigned int grid_nx, - unsigned int grid_ny, - unsigned int* bcMatD, +void BcPress27( int nx, + int ny, + int tz, + unsigned int grid_nx, + unsigned int grid_ny, + unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - real* DD, - unsigned int size_Mat, - bool evenOrOdd) + real* DD, + unsigned int size_Mat, + bool isEvenTimestep) { dim3 threads ( grid_nx, 1, 1 ); dim3 grid ( grid_ny, 1 ); - LB_BC_Press_East27<<< grid, threads >>> ( nx, - ny, - tz, - bcMatD, + LB_BC_Press_East27<<< grid, threads >>> ( nx, + ny, + tz, + bcMatD, neighborX, neighborY, neighborZ, - DD, - size_Mat, - evenOrOdd); - getLastCudaError("LB_BC_Press_East27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void BcVel27(int nx, - int ny, - int nz, - int itz, - unsigned int grid_nx, - unsigned int grid_ny, - unsigned int* bcMatD, + DD, + size_Mat, + isEvenTimestep); + getLastCudaError("LB_BC_Press_East27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void BcVel27(int nx, + int ny, + int nz, + int itz, + unsigned int grid_nx, + unsigned int grid_ny, + unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - real* DD, - unsigned int size_Mat, - bool evenOrOdd, - real u0x, + real* DD, + unsigned int size_Mat, + bool isEvenTimestep, + real u0x, real om) { dim3 threads ( grid_nx, 1, 1 ); dim3 grid ( grid_ny, 1 ); - LB_BC_Vel_West_27<<< grid, threads >>> ( nx, - ny, - nz, - itz, - bcMatD, + LB_BC_Vel_West_27<<< grid, threads >>> ( nx, + ny, + nz, + itz, + bcMatD, neighborX, neighborY, neighborZ, - DD, - size_Mat, - evenOrOdd, + DD, + size_Mat, + isEvenTimestep, u0x, - grid_nx, - grid_ny, - om); - getLastCudaError("LB_BC_Vel_West_27 execution failed"); + grid_nx, + grid_ny, + om); + getLastCudaError("LB_BC_Vel_West_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADPressDev7( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QADPressDev7( unsigned int numberOfThreads, + real* DD, real* DD7, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1937,52 +1937,46 @@ extern "C" void QADPressDev7( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QADPress7<<< gridQ, threads >>>( nx, - ny, - DD, + QADPress7<<< gridQ, threads >>>( DD, DD7, temp, velo, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QADPress7 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QADPress7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADPressDev27(unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QADPressDev27(unsigned int numberOfThreads, + real* DD, real* DD27, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -1991,48 +1985,45 @@ extern "C" void QADPressDev27(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QADPress27<<< gridQ, threads >>>( nx, - ny, - DD, + QADPress27<<< gridQ, threads >>>( DD, DD27, temp, velo, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QADPress27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QADPress27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADPressNEQNeighborDev27( +void QADPressNEQNeighborDev27( unsigned int numberOfThreads, real* DD, real* DD27, int* k_Q, int* k_N, - int kQ, + int numberOfBCnodes, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd + bool isEvenTimestep ) { - - int Grid = (kQ / numberOfThreads)+1; + + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2041,47 +2032,44 @@ extern "C" void QADPressNEQNeighborDev27( dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QADPressNEQNeighbor27<<< gridQ, threads >>>( + QADPressNEQNeighbor27<<< gridQ, threads >>>( DD, DD27, k_Q, k_N, - kQ, + numberOfBCnodes, neighborX, neighborY, neighborZ, size_Mat, - evenOrOdd + isEvenTimestep ); - getLastCudaError("QADPressNEQNeighbor27 execution failed"); + getLastCudaError("QADPressNEQNeighbor27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADVelDev7(unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QADVelDev7(unsigned int numberOfThreads, + real* DD, real* DD7, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2090,52 +2078,47 @@ extern "C" void QADVelDev7(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QADVel7<<< gridQ, threads >>> ( nx, - ny, - DD, + QADVel7<<< gridQ, threads >>> ( + DD, DD7, temp, velo, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QADVel7 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QADVel7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADVelDev27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QADVelDev27( unsigned int numberOfThreads, + real* DD, real* DD27, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2144,51 +2127,45 @@ extern "C" void QADVelDev27( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QADVel27<<< gridQ, threads >>> (nx, - ny, - DD, + QADVel27<<< gridQ, threads >>> ( DD, DD27, temp, velo, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QADVel27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QADVel27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADDev7(unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QADDev7(unsigned int numberOfThreads, + real* DD, real* DD7, real* temp, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2197,50 +2174,119 @@ extern "C" void QADDev7(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QAD7<<< gridQ, threads >>> ( nx, - ny, - DD, + QAD7<<< gridQ, threads >>> ( DD, DD7, temp, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QAD7 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QAD7 execution failed"); +} + + +////////////////////////////////////////////////////////////////////////// +// Other advection diffusion kernels are in kernel factory :( +void FactorizedCentralMomentsAdvectionDiffusionDeviceKernel( + uint numberOfThreads, + real omegaDiffusivity, + uint* typeOfGridNode, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + real* distributions, + real* distributionsAD, + int size_Mat, + real* forces, + bool isEvenTimestep) +{ + int Grid = (size_Mat / numberOfThreads) + 1; + dim3 grid(Grid, 1, 1); + dim3 threads(numberOfThreads, 1, 1); + + Factorized_Central_Moments_Advection_Diffusion_Device_Kernel <<< grid, threads >>> ( + omegaDiffusivity, + typeOfGridNode, + neighborX, + neighborY, + neighborZ, + distributions, + distributionsAD, + size_Mat, + forces, + isEvenTimestep); + getLastCudaError("Factorized_Central_Moments_Advection_Diffusion_Device_Kernel execution failed"); +} + +////////////////////////////////////////////////////////////////////////// +void ADSlipVelDevComp( + uint numberOfThreads, + real * normalX, + real * normalY, + real * normalZ, + real * distributions, + real * distributionsAD, + int* QindexArray, + real * Qarrays, + uint numberOfBCnodes, + real omegaDiffusivity, + uint * neighborX, + uint * neighborY, + uint * neighborZ, + uint size_Mat, + bool isEvenTimestep) +{ + int Grid = (numberOfBCnodes / numberOfThreads) + 1; + dim3 gridQ(Grid, 1, 1); + dim3 threads(numberOfThreads, 1, 1); + + AD_SlipVelDeviceComp << < gridQ, threads >> > ( + normalX, + normalY, + normalZ, + distributions, + distributionsAD, + QindexArray, + Qarrays, + numberOfBCnodes, + omegaDiffusivity, + neighborX, + neighborY, + neighborZ, + size_Mat, + isEvenTimestep); + getLastCudaError("AD_SlipVelDeviceComp execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADDirichletDev27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, + +void QADDirichletDev27( unsigned int numberOfThreads, + real* DD, real* DD27, real* temp, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2249,50 +2295,45 @@ extern "C" void QADDirichletDev27( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QADDirichlet27<<< gridQ, threads >>> ( nx, - ny, - DD, + QADDirichlet27<<< gridQ, threads >>> ( + DD, DD27, temp, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QAD27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QADDirichletDev27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADBBDev27(unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QADBBDev27(unsigned int numberOfThreads, + real* DD, real* DD27, real* temp, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2301,50 +2342,44 @@ extern "C" void QADBBDev27(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QADBB27<<< gridQ, threads >>> ( nx, - ny, - DD, + QADBB27<<< gridQ, threads >>> ( DD, DD27, temp, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QADBB27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QADBB27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QNoSlipADincompDev7(unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QNoSlipADincompDev7(unsigned int numberOfThreads, + real* DD, real* DD7, real* temp, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2353,50 +2388,45 @@ extern "C" void QNoSlipADincompDev7(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QNoSlipADincomp7<<< gridQ, threads >>> ( nx, - ny, - DD, + QNoSlipADincomp7<<< gridQ, threads >>> ( + DD, DD7, temp, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QNoSlipADincomp7 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QNoSlipADincomp7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QNoSlipADincompDev27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QNoSlipADincompDev27( unsigned int numberOfThreads, + real* DD, real* DD27, real* temp, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2405,51 +2435,46 @@ extern "C" void QNoSlipADincompDev27( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QNoSlipADincomp27<<< gridQ, threads >>> (nx, - ny, - DD, + QNoSlipADincomp27<<< gridQ, threads >>> ( + DD, DD27, temp, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QNoSlipADincomp27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QNoSlipADincomp27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADVeloIncompDev7( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QADVeloIncompDev7( unsigned int numberOfThreads, + real* DD, real* DD7, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2458,52 +2483,47 @@ extern "C" void QADVeloIncompDev7( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QADVeloIncomp7<<< gridQ, threads >>> ( nx, - ny, - DD, + QADVeloIncomp7<<< gridQ, threads >>> ( + DD, DD7, temp, velo, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QADVeloIncomp7 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QADVeloIncomp7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADVeloIncompDev27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QADVeloIncompDev27( unsigned int numberOfThreads, + real* DD, real* DD27, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2512,52 +2532,47 @@ extern "C" void QADVeloIncompDev27( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QADVeloIncomp27<<< gridQ, threads >>> ( nx, - ny, - DD, + QADVeloIncomp27<<< gridQ, threads >>> ( + DD, DD27, temp, velo, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QADVeloIncomp27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QADVeloIncomp27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADPressIncompDev7( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QADPressIncompDev7( unsigned int numberOfThreads, + real* DD, real* DD7, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2566,52 +2581,47 @@ extern "C" void QADPressIncompDev7( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QADPressIncomp7<<< gridQ, threads >>>( nx, - ny, - DD, + QADPressIncomp7<<< gridQ, threads >>>( + DD, DD7, temp, velo, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QADPressIncomp7 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QADPressIncomp7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QADPressIncompDev27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, +void QADPressIncompDev27( unsigned int numberOfThreads, + real* DD, real* DD27, real* temp, real* velo, real diffusivity, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2620,140 +2630,84 @@ extern "C" void QADPressIncompDev27( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QADPressIncomp27<<< gridQ, threads >>>( nx, - ny, - DD, + QADPressIncomp27<<< gridQ, threads >>>( + DD, DD27, temp, velo, diffusivity, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QADPressIncomp27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QADPressIncomp27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QDev27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) +void QDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) { - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); - QDevice27<<< gridQ, threads >>> (nx, - ny, - DD, - k_Q, - QQ, - sizeQ, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QDevice27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QDevComp27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + QDevice27<<< grid, threads >>> ( + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + + getLastCudaError("QDevice27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) { - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); - QDeviceComp27<<< gridQ, threads >>> (nx, - ny, - DD, - k_Q, - QQ, - sizeQ, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QDeviceComp27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QDevCompThinWalls27(unsigned int numberOfThreads, - real* DD, - int* k_Q, + QDeviceComp27<<< grid, threads >>> ( + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QDeviceComp27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QDevCompThinWalls27(unsigned int numberOfThreads, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* geom, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* neighborWSB, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2762,103 +2716,71 @@ extern "C" void QDevCompThinWalls27(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QDeviceCompThinWallsPartOne27 <<< gridQ, threads >>> (DD, - k_Q, + QDeviceCompThinWallsPartOne27 <<< gridQ, threads >>> (DD, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QDeviceCompThinWallsPartOne27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QDeviceCompThinWallsPartOne27 execution failed"); QThinWallsPartTwo27 <<< gridQ, threads >>> ( DD, k_Q, QQ, - sizeQ, - kQ, + numberOfBCnodes, geom, neighborX, neighborY, neighborZ, neighborWSB, size_Mat, - evenOrOdd); + isEvenTimestep); getLastCudaError("QThinWallsPartTwo27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QDev3rdMomentsComp27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) +void QDev3rdMomentsComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) { - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1); - QDevice3rdMomentsComp27<<< gridQ, threads >>> ( nx, - ny, - DD, - k_Q, - QQ, - sizeQ, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QDevice3rdMomentsComp27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QDevIncompHighNu27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, - int* k_Q, + QDevice3rdMomentsComp27<<< grid, threads >>> ( + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QDevice3rdMomentsComp27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QDevIncompHighNu27( unsigned int numberOfThreads, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2867,44 +2789,39 @@ extern "C" void QDevIncompHighNu27( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QDeviceIncompHighNu27<<< gridQ, threads >>> (nx, - ny, - DD, - k_Q, + QDeviceIncompHighNu27<<< gridQ, threads >>> ( + DD, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QDeviceIncompHighNu27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QDeviceIncompHighNu27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QDevCompHighNu27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, - int* k_Q, +void QDevCompHighNu27( unsigned int numberOfThreads, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -2913,93 +2830,63 @@ extern "C" void QDevCompHighNu27( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QDeviceCompHighNu27<<< gridQ, threads >>> ( nx, - ny, - DD, - k_Q, + QDeviceCompHighNu27<<< gridQ, threads >>> ( + DD, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QDevice27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QDevice27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QVelDevicePlainBB27(unsigned int numberOfThreads, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) +void QVelDevicePlainBB27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) { - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); - QVelDevPlainBB27<<< gridQ, threads >>> ( vx, - vy, - vz, - DD, - k_Q, - QQ, - sizeQ, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QVelDevicePlainBB27 execution failed"); + QVelDevPlainBB27<<< grid, threads >>> ( + boundaryCondition->Vx, + boundaryCondition->Vy, + boundaryCondition->Vz, + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QVelDevicePlainBB27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QVelDeviceCouhette27(unsigned int numberOfThreads, +void QVelDeviceCouette27(unsigned int numberOfThreads, real* vx, real* vy, real* vz, real* DD, - int* k_Q, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3008,36 +2895,34 @@ extern "C" void QVelDeviceCouhette27(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QVelDevCouhette27<<< gridQ, threads >>> ( vx, + QVelDevCouette27<<< gridQ, threads >>> ( vx, vy, vz, DD, - k_Q, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, size_Mat, - evenOrOdd); - getLastCudaError("QVelDevicePlainBB27 execution failed"); + isEvenTimestep); + getLastCudaError("QVelDevicePlainBB27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QVelDevice1h27( unsigned int numberOfThreads, +void QVelDevice1h27( unsigned int numberOfThreads, int nx, int ny, real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - real Phi, + unsigned int numberOfBCnodes, + real om1, + real Phi, real angularVelocity, unsigned int* neighborX, unsigned int* neighborY, @@ -3045,16 +2930,16 @@ extern "C" void QVelDevice1h27( unsigned int numberOfThreads, real* coordX, real* coordY, real* coordZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3068,11 +2953,10 @@ extern "C" void QVelDevice1h27( unsigned int numberOfThreads, vx, vy, vz, - DD, - k_Q, + DD, + k_Q, QQ, - sizeQ, - kQ, + numberOfBCnodes, om1, Phi, angularVelocity, @@ -3082,88 +2966,57 @@ extern "C" void QVelDevice1h27( unsigned int numberOfThreads, coordX, coordY, coordZ, - size_Mat, - evenOrOdd); - getLastCudaError("QVelDevice27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QVelDev27(unsigned int numberOfThreads, - int nx, - int ny, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - QVelDevice27<<< gridQ, threads >>> (nx, - ny, - vx, - vy, - vz, - DD, - k_Q, - QQ, - sizeQ, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QVelDevice27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QVelDevCompPlusSlip27(unsigned int numberOfThreads, - int nx, - int ny, + size_Mat, + isEvenTimestep); + getLastCudaError("QVelDevice27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QVelDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QVelDevice27<<< grid, threads >>> ( + parameterDevice->nx, + parameterDevice->ny, + boundaryCondition->Vx, + boundaryCondition->Vy, + boundaryCondition->Vz, + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QVelDevice27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QVelDevCompPlusSlip27(unsigned int numberOfThreads, real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3172,102 +3025,69 @@ extern "C" void QVelDevCompPlusSlip27(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QVelDeviceCompPlusSlip27<<< gridQ, threads >>> (nx, - ny, + QVelDeviceCompPlusSlip27<<< gridQ, threads >>> ( vx, vy, vz, - DD, - k_Q, + DD, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QVelDeviceCompPlusSlip27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QVelDevComp27(unsigned int numberOfThreads, - int nx, - int ny, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - QVelDeviceComp27<<< gridQ, threads >>> (nx, - ny, - vx, - vy, - vz, - DD, - k_Q, - QQ, - sizeQ, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QVelDeviceComp27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QVelDevCompThinWalls27(unsigned int numberOfThreads, + size_Mat, + isEvenTimestep); + getLastCudaError("QVelDeviceCompPlusSlip27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QVelDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid(parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QVelDeviceComp27<<< grid, threads >>> ( + boundaryCondition->Vx, + boundaryCondition->Vy, + boundaryCondition->Vz, + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QVelDeviceComp27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QVelDevCompThinWalls27(unsigned int numberOfThreads, real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* geom, + unsigned int numberOfBCnodes, + real om1, + unsigned int* geom, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int* neighborWSB, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int* neighborWSB, + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3276,116 +3096,80 @@ extern "C" void QVelDevCompThinWalls27(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QVelDeviceCompThinWallsPartOne27<<< gridQ, threads >>> (vx, + QVelDeviceCompThinWallsPartOne27<<< gridQ, threads >>> (vx, vy, vz, - DD, - k_Q, + DD, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QVelDeviceCompThinWallsPartOne27 execution failed"); - - QThinWallsPartTwo27 <<< gridQ, threads >>> (DD, - k_Q, - QQ, - sizeQ, - kQ, - geom, - neighborX, - neighborY, - neighborZ, - neighborWSB, - size_Mat, - evenOrOdd); - getLastCudaError("QThinWallsPartTwo27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QVelDevCompZeroPress27( unsigned int numberOfThreads, - int nx, - int ny, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kArray, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + size_Mat, + isEvenTimestep); + getLastCudaError("QVelDeviceCompThinWallsPartOne27 execution failed"); + + QThinWallsPartTwo27 <<< gridQ, threads >>> ( + DD, + k_Q, + QQ, + numberOfBCnodes, + geom, + neighborX, + neighborY, + neighborZ, + neighborWSB, + size_Mat, + isEvenTimestep); + getLastCudaError("QThinWallsPartTwo27 execution failed"); +} + +void QVelDevCompZeroPress27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) { - //int Grid = kArray / numberOfThreads; - int Grid = (sizeQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - //dim3 gridQ(Grid, 1, 1); - dim3 threads(numberOfThreads, 1, 1 ); + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); - QVelDeviceCompZeroPress27<<< gridQ, threads >>> ( nx, - ny, - vx, - vy, - vz, - DD, - k_Q, - QQ, - sizeQ, - //kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QVelDeviceCompZeroPress27 execution failed"); + QVelDeviceCompZeroPress27<<< grid, threads >>> ( + boundaryCondition->Vx, + boundaryCondition->Vy, + boundaryCondition->Vz, + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QVelDeviceCompZeroPress27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QVelDevIncompHighNu27(unsigned int numberOfThreads, - int nx, - int ny, +void QVelDevIncompHighNu27(unsigned int numberOfThreads, real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3394,50 +3178,45 @@ extern "C" void QVelDevIncompHighNu27(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QVelDeviceIncompHighNu27<<< gridQ, threads >>> (nx, - ny, + QVelDeviceIncompHighNu27<<< gridQ, threads >>> ( vx, vy, vz, - DD, - k_Q, + DD, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QVelDeviceIncompHighNu27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QVelDeviceIncompHighNu27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QVelDevCompHighNu27( unsigned int numberOfThreads, - int nx, - int ny, +void QVelDevCompHighNu27( unsigned int numberOfThreads, real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3446,46 +3225,44 @@ extern "C" void QVelDevCompHighNu27( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QVelDeviceCompHighNu27<<< gridQ, threads >>> ( nx, - ny, + QVelDeviceCompHighNu27<<< gridQ, threads >>> ( vx, vy, vz, - DD, - k_Q, + DD, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QVelDeviceComp27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QVelDeviceComp27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QVeloDevEQ27(unsigned int numberOfThreads, +void QVeloDevEQ27(unsigned int numberOfThreads, real* VeloX, real* VeloY, real* VeloZ, - real* DD, - int* k_Q, - int kQ, - real om1, + real* DD, + int* k_Q, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3495,21 +3272,21 @@ extern "C" void QVeloDevEQ27(unsigned int numberOfThreads, dim3 threads(numberOfThreads, 1, 1 ); QVeloDeviceEQ27<<< gridQ, threads >>> (VeloX, - VeloY, - VeloZ, - DD, - k_Q, - kQ, - om1, + VeloY, + VeloZ, + DD, + k_Q, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QVeloDeviceEQ27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QVeloDeviceEQ27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QVeloStreetDevEQ27( +void QVeloStreetDevEQ27( uint numberOfThreads, real* veloXfraction, real* veloYfraction, @@ -3522,7 +3299,7 @@ extern "C" void QVeloStreetDevEQ27( uint* neighborY, uint* neighborZ, uint size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { int Grid = (numberOfStreetNodes / numberOfThreads) + 1; int Grid1, Grid2; @@ -3551,112 +3328,129 @@ extern "C" void QVeloStreetDevEQ27( neighborY, neighborZ, size_Mat, - evenOrOdd); + isEvenTimestep); getLastCudaError("QVeloStreetDeviceEQ27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QSlipDev27(unsigned int numberOfThreads, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - int Grid = (sizeQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - QSlipDevice27<<< gridQ, threads >>> (DD, - k_Q, - QQ, - sizeQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QSlipDevice27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QSlipDevComp27(unsigned int numberOfThreads, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - int Grid = (sizeQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - QSlipDeviceComp27<<< gridQ, threads >>> (DD, - k_Q, - QQ, - sizeQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QSlipDeviceComp27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QSlipGeomDevComp27(unsigned int numberOfThreads, - real* DD, - int* k_Q, +void QSlipDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QSlipDevice27<<< grid, threads >>> ( + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QSlipDevice27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QSlipDevCompTurbulentViscosity27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QSlipDeviceComp27TurbViscosity<<< grid, threads >>> ( + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->turbViscosity, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QSlipDeviceComp27TurbViscosity execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QSlipPressureDevCompTurbulentViscosity27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QSlipPressureDeviceComp27TurbViscosity<<< grid, threads >>> ( + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->turbViscosity, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QSlipDeviceComp27TurbViscosity execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QSlipDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QSlipDeviceComp27<<< grid, threads >>> ( + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QSlipDeviceComp27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void BBSlipDevComp27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QSlipDeviceComp27<<< grid, threads >>> ( + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("BBSlipDeviceComp27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QSlipGeomDevComp27(unsigned int numberOfThreads, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - real om1, + unsigned int numberOfBCnodes, + real om1, real* NormalX, real* NormalY, real* NormalZ, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (sizeQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3665,10 +3459,10 @@ extern "C" void QSlipGeomDevComp27(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QSlipGeomDeviceComp27<<< gridQ, threads >>> (DD, - k_Q, + QSlipGeomDeviceComp27<<< gridQ, threads >>> (DD, + k_Q, QQ, - sizeQ, + numberOfBCnodes, om1, NormalX, NormalY, @@ -3676,33 +3470,33 @@ extern "C" void QSlipGeomDevComp27(unsigned int numberOfThreads, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QSlipGeomDeviceComp27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QSlipGeomDeviceComp27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QSlipNormDevComp27(unsigned int numberOfThreads, - real* DD, - int* k_Q, +void QSlipNormDevComp27(unsigned int numberOfThreads, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - real om1, + unsigned int numberOfBCnodes, + real om1, real* NormalX, real* NormalY, real* NormalZ, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (sizeQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3711,10 +3505,10 @@ extern "C" void QSlipNormDevComp27(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QSlipNormDeviceComp27<<< gridQ, threads >>> (DD, - k_Q, + QSlipNormDeviceComp27<<< gridQ, threads >>> (DD, + k_Q, QQ, - sizeQ, + numberOfBCnodes, om1, NormalX, NormalY, @@ -3722,82 +3516,173 @@ extern "C" void QSlipNormDevComp27(unsigned int numberOfThreads, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QSlipGeomDeviceComp27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QPressDev27(unsigned int numberOfThreads, - int nx, - int ny, - real* rhoBC, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - QPressDevice27<<< gridQ, threads >>> (nx, - ny, - rhoBC, - DD, - k_Q, - QQ, - sizeQ, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressDevice27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QPressDevAntiBB27( unsigned int numberOfThreads, + size_Mat, + isEvenTimestep); + getLastCudaError("QSlipGeomDeviceComp27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QStressDevComp27(Parameter *para, QforBoundaryConditions* boundaryCondition, const int level) +{ + dim3 grid = vf::cuda::getCudaGrid( para->getParD(level)->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(para->getParD(level)->numberofthreads, 1, 1 ); + + QStressDeviceComp27<<< grid, threads >>> ( + para->getParD(level)->distributions.f[0], + boundaryCondition->k, + boundaryCondition->kN, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + para->getParD(level)->omega, + para->getParD(level)->turbViscosity, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityY, + boundaryCondition->normalX, + boundaryCondition->normalY, + boundaryCondition->normalZ, + boundaryCondition->Vx, + boundaryCondition->Vy, + boundaryCondition->Vz, + boundaryCondition->Vx1, + boundaryCondition->Vy1, + boundaryCondition->Vz1, + para->getParD(level)->wallModel.samplingOffset, + para->getParD(level)->wallModel.z0, + para->getHasWallModelMonitor(), + para->getParD(level)->wallModel.u_star, + para->getParD(level)->wallModel.Fx, + para->getParD(level)->wallModel.Fy, + para->getParD(level)->wallModel.Fz, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + getLastCudaError("QSlipDeviceComp27 execution failed"); +} + +////////////////////////////////////////////////////////////////////////// +void BBStressDev27(Parameter *para, QforBoundaryConditions* boundaryCondition, const int level) +{ + dim3 grid = vf::cuda::getCudaGrid( para->getParD(level)->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(para->getParD(level)->numberofthreads, 1, 1 ); + + BBStressDevice27<<< grid, threads >>> ( + para->getParD(level)->distributions.f[0], + boundaryCondition->k, + boundaryCondition->kN, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityY, + boundaryCondition->normalX, + boundaryCondition->normalY, + boundaryCondition->normalZ, + boundaryCondition->Vx, + boundaryCondition->Vy, + boundaryCondition->Vz, + boundaryCondition->Vx1, + boundaryCondition->Vy1, + boundaryCondition->Vz1, + para->getParD(level)->wallModel.samplingOffset, + para->getParD(level)->wallModel.z0, + para->getHasWallModelMonitor(), + para->getParD(level)->wallModel.u_star, + para->getParD(level)->wallModel.Fx, + para->getParD(level)->wallModel.Fy, + para->getParD(level)->wallModel.Fz, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + getLastCudaError("BBStressDevice27 execution failed"); +} + +////////////////////////////////////////////////////////////////////////// +void BBStressPressureDev27(Parameter *para, QforBoundaryConditions* boundaryCondition, const int level) +{ + dim3 grid = vf::cuda::getCudaGrid( para->getParD(level)->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(para->getParD(level)->numberofthreads, 1, 1 ); + + BBStressPressureDevice27<<< grid, threads >>> ( + para->getParD(level)->distributions.f[0], + boundaryCondition->k, + boundaryCondition->kN, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityY, + boundaryCondition->normalX, + boundaryCondition->normalY, + boundaryCondition->normalZ, + boundaryCondition->Vx, + boundaryCondition->Vy, + boundaryCondition->Vz, + boundaryCondition->Vx1, + boundaryCondition->Vy1, + boundaryCondition->Vz1, + para->getParD(level)->wallModel.samplingOffset, + para->getParD(level)->wallModel.z0, + para->getHasWallModelMonitor(), + para->getParD(level)->wallModel.u_star, + para->getParD(level)->wallModel.Fx, + para->getParD(level)->wallModel.Fy, + para->getParD(level)->wallModel.Fz, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + getLastCudaError("BBStressDevice27 execution failed"); +} + +////////////////////////////////////////////////////////////////////////// +void QPressDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QPressDevice27<<< grid, threads >>> ( + boundaryCondition->RhoBC, + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QPressDevice27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QPressDevAntiBB27( unsigned int numberOfThreads, real* rhoBC, real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - int kQ, - real om1, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3810,38 +3695,38 @@ extern "C" void QPressDevAntiBB27( unsigned int numberOfThreads, vx, vy, vz, - DD, - k_Q, + DD, + k_Q, QQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressDeviceAntiBB27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QPressDeviceAntiBB27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QPressDevFixBackflow27( unsigned int numberOfThreads, +void QPressDevFixBackflow27( unsigned int numberOfThreads, real* rhoBC, - real* DD, - int* k_Q, - unsigned int kQ, - real om1, + real* DD, + int* k_Q, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3851,37 +3736,37 @@ extern "C" void QPressDevFixBackflow27( unsigned int numberOfThreads, dim3 threads(numberOfThreads, 1, 1 ); QPressDeviceFixBackflow27<<< gridQ, threads >>> ( rhoBC, - DD, - k_Q, - kQ, - om1, + DD, + k_Q, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressDeviceFixBackflow27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QPressDeviceFixBackflow27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QPressDevDirDepBot27( unsigned int numberOfThreads, +void QPressDevDirDepBot27( unsigned int numberOfThreads, real* rhoBC, - real* DD, - int* k_Q, - unsigned int kQ, - real om1, + real* DD, + int* k_Q, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -3891,122 +3776,78 @@ extern "C" void QPressDevDirDepBot27( unsigned int numberOfThreads, dim3 threads(numberOfThreads, 1, 1 ); QPressDeviceDirDepBot27<<< gridQ, threads >>> ( rhoBC, - DD, - k_Q, - kQ, - om1, + DD, + k_Q, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressDeviceDirDepBot27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QPressNoRhoDev27(unsigned int numberOfThreads, - real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - QPressNoRhoDevice27<<< gridQ, threads >>> ( rhoBC, - DD, - k_Q, - k_N, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressNoRhoDevice27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QInflowScaleByPressDev27(unsigned int numberOfThreads, - real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - QInflowScaleByPressDevice27<<< gridQ, threads >>> ( rhoBC, - DD, - k_Q, - k_N, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QInflowScaleByPressDevice27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QPressDevOld27( unsigned int numberOfThreads, + size_Mat, + isEvenTimestep); + getLastCudaError("QPressDeviceDirDepBot27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QPressNoRhoDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QPressNoRhoDevice27<<< grid, threads >>> ( + boundaryCondition->RhoBC, + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->kN, + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QPressNoRhoDevice27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QInflowScaleByPressDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QInflowScaleByPressDevice27<<< grid, threads >>> ( + boundaryCondition->RhoBC, + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->kN, + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QInflowScaleByPressDevice27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QPressDevOld27( unsigned int numberOfThreads, real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - unsigned int kQ, - real om1, + real* DD, + int* k_Q, + int* k_N, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4016,81 +3857,97 @@ extern "C" void QPressDevOld27( unsigned int numberOfThreads, dim3 threads(numberOfThreads, 1, 1 ); QPressDeviceOld27<<< gridQ, threads >>> ( rhoBC, - DD, - k_Q, - k_N, - kQ, - om1, + DD, + k_Q, + k_N, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressDeviceOld27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QPressDevIncompNEQ27(unsigned int numberOfThreads, - real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + size_Mat, + isEvenTimestep); + getLastCudaError("QPressDeviceOld27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QPressDevIncompNEQ27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QPressDeviceIncompNEQ27<<< grid, threads >>> ( + boundaryCondition->RhoBC, + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->kN, + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QPressDeviceIncompNEQ27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QPressDevNEQ27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QPressDeviceNEQ27<<< grid, threads >>> ( + boundaryCondition->RhoBC, + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->kN, + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QPressDevNEQ27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QPressDevEQZ27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) +{ + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); + + QPressDeviceEQZ27<<< grid, threads >>> ( + boundaryCondition->RhoBC, + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->kN, + parameterDevice->kDistTestRE.f[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->omega, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("QPressDeviceEQZ27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void QPressDevZero27(unsigned int numberOfThreads, + real* DD, + int* k_Q, + unsigned int numberOfBCnodes, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - QPressDeviceIncompNEQ27<<< gridQ, threads >>> ( rhoBC, - DD, - k_Q, - k_N, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressDeviceIncompNEQ27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QPressDevNEQ27( unsigned int numberOfThreads, - real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } else { Grid1 = 1; @@ -4099,81 +3956,37 @@ extern "C" void QPressDevNEQ27( unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QPressDeviceNEQ27<<< gridQ, threads >>> ( rhoBC, - DD, - k_Q, - k_N, - kQ, - om1, + QPressDeviceZero27<<< gridQ, threads >>> (DD, + k_Q, + numberOfBCnodes, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressDeviceOld27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QPressDeviceOld27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QPressDevEQZ27( unsigned int numberOfThreads, +void QPressDevFake27( unsigned int numberOfThreads, real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - real* kTestRE, - unsigned int kQ, - real om1, + real* DD, + int* k_Q, + int* k_N, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - QPressDeviceEQZ27<<< gridQ, threads >>> ( rhoBC, - DD, - k_Q, - k_N, - kTestRE, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressDeviceEQZ27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void QPressDevZero27(unsigned int numberOfThreads, - real* DD, - int* k_Q, - unsigned int kQ, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } else { Grid1 = 1; @@ -4182,126 +3995,58 @@ extern "C" void QPressDevZero27(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - QPressDeviceZero27<<< gridQ, threads >>> (DD, - k_Q, - kQ, + QPressDeviceFake27<<< gridQ, threads >>> (rhoBC, + DD, + k_Q, + k_N, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressDeviceOld27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QPressDeviceFake27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QPressDevFake27( unsigned int numberOfThreads, - real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) +void BBDev27(LBMSimulationParameter* parameterDevice, QforBoundaryConditions* boundaryCondition) { - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - QPressDeviceFake27<<< gridQ, threads >>> (rhoBC, - DD, - k_Q, - k_N, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressDeviceFake27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void BBDev27( unsigned int numberOfThreads, - int nx, - int ny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) -{ - int Grid = (kQ / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridQ(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); + dim3 grid = vf::cuda::getCudaGrid( parameterDevice->numberofthreads, boundaryCondition->numberOfBCnodes); + dim3 threads(parameterDevice->numberofthreads, 1, 1 ); - BBDevice27<<< gridQ, threads >>> ( nx, - ny, - DD, - k_Q, - QQ, - sizeQ, - kQ, - om1, - neighborX, - neighborY, - neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("BBDevice27 execution failed"); + BBDevice27<<< grid, threads >>> ( + parameterDevice->distributions.f[0], + boundaryCondition->k, + boundaryCondition->q27[0], + boundaryCondition->numberOfBCnodes, + parameterDevice->neighborX, + parameterDevice->neighborY, + parameterDevice->neighborZ, + parameterDevice->numberOfNodes, + parameterDevice->isEvenTimestep); + getLastCudaError("BBDevice27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void QPressDev27_IntBB( unsigned int numberOfThreads, +void QPressDev27_IntBB( unsigned int numberOfThreads, real* rho, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4311,44 +4056,44 @@ extern "C" void QPressDev27_IntBB( unsigned int numberOfThreads, dim3 threads(numberOfThreads, 1, 1 ); QPressDevice27_IntBB<<< gridQ, threads >>> (rho, - DD, - k_Q, + DD, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("QPressDevice27_IntBB execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("QPressDevice27_IntBB execution failed"); } +// TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 ////////////////////////////////////////////////////////////////////////// -extern "C" void PressSchlaffer27(unsigned int numberOfThreads, +void PressSchlaffer27(unsigned int numberOfThreads, real* rhoBC, real* DD, real* vx0, real* vy0, real* vz0, real* deltaVz0, - int* k_Q, - int* k_N, - int kQ, - real om1, + int* k_Q, + int* k_N, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4363,40 +4108,41 @@ extern "C" void PressSchlaffer27(unsigned int numberOfThreads, vy0, vz0, deltaVz0, - k_Q, - k_N, - kQ, - om1, + k_Q, + k_N, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("PressSchlaff27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("PressSchlaff27 execution failed"); } +// TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 ////////////////////////////////////////////////////////////////////////// -extern "C" void VelSchlaffer27( unsigned int numberOfThreads, +void VelSchlaffer27( unsigned int numberOfThreads, int t, real* DD, real* vz0, real* deltaVz0, - int* k_Q, - int* k_N, - int kQ, - real om1, + int* k_Q, + int* k_N, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4409,19 +4155,19 @@ extern "C" void VelSchlaffer27( unsigned int numberOfThreads, DD, vz0, deltaVz0, - k_Q, - k_N, - kQ, - om1, + k_Q, + k_N, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("VelSchlaff27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("VelSchlaff27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void PropVelo( unsigned int numberOfThreads, +void PropVelo( unsigned int numberOfThreads, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, @@ -4429,7 +4175,7 @@ extern "C" void PropVelo( unsigned int numberOfThreads, real* ux, real* uy, real* uz, - int* k_Q, + int* k_Q, unsigned int size_Prop, unsigned int size_Mat, unsigned int* bcMatD, @@ -4442,7 +4188,7 @@ extern "C" void PropVelo( unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4464,29 +4210,29 @@ extern "C" void PropVelo( unsigned int numberOfThreads, bcMatD, DD, EvenOrOdd); - getLastCudaError("PropellerBC execution failed"); + getLastCudaError("PropellerBC execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCF27( real* DC, - real* DF, +void ScaleCF27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads) { @@ -4496,7 +4242,7 @@ extern "C" void ScaleCF27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4505,50 +4251,50 @@ extern "C" void ScaleCF27( real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCF27<<< gridINT_CF, threads >>> ( DC, - DF, + scaleCF27<<< gridINT_CF, threads >>> ( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF); - getLastCudaError("scaleCF27 execution failed"); + getLastCudaError("scaleCF27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCFEff27(real* DC, - real* DF, +void ScaleCFEff27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffCF offCF) @@ -4559,7 +4305,7 @@ extern "C" void ScaleCFEff27(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4568,51 +4314,51 @@ extern "C" void ScaleCFEff27(real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCFEff27<<< gridINT_CF, threads >>> ( DC, - DF, + scaleCFEff27<<< gridINT_CF, threads >>> ( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCFEff27 execution failed"); + getLastCudaError("scaleCFEff27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCFLast27(real* DC, - real* DF, +void ScaleCFLast27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffCF offCF) @@ -4623,7 +4369,7 @@ extern "C" void ScaleCFLast27(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4632,51 +4378,51 @@ extern "C" void ScaleCFLast27(real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCFLast27<<< gridINT_CF, threads >>> (DC, - DF, + scaleCFLast27<<< gridINT_CF, threads >>> (DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCFLast27 execution failed"); + getLastCudaError("scaleCFLast27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCFpress27( real* DC, - real* DF, +void ScaleCFpress27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffCF offCF) @@ -4687,7 +4433,7 @@ extern "C" void ScaleCFpress27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4696,51 +4442,51 @@ extern "C" void ScaleCFpress27( real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCFpress27<<< gridINT_CF, threads >>>(DC, - DF, + scaleCFpress27<<< gridINT_CF, threads >>>(DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCFpress27 execution failed"); + getLastCudaError("scaleCFpress27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCF_Fix_27( real* DC, - real* DF, +void ScaleCF_Fix_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffCF offCF) @@ -4751,7 +4497,7 @@ extern "C" void ScaleCF_Fix_27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4760,51 +4506,51 @@ extern "C" void ScaleCF_Fix_27( real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCF_Fix_27<<< gridINT_CF, threads >>>(DC, - DF, + scaleCF_Fix_27<<< gridINT_CF, threads >>>(DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCF_Fix_27 execution failed"); + getLastCudaError("scaleCF_Fix_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCF_Fix_comp_27( real* DC, - real* DF, +void ScaleCF_Fix_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffCF offCF) @@ -4815,7 +4561,7 @@ extern "C" void ScaleCF_Fix_comp_27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4824,54 +4570,55 @@ extern "C" void ScaleCF_Fix_comp_27( real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCF_Fix_comp_27<<< gridINT_CF, threads >>>( DC, - DF, + scaleCF_Fix_comp_27<<< gridINT_CF, threads >>>( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCF_Fix_27 execution failed"); + getLastCudaError("scaleCF_Fix_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCF_0817_comp_27(real* DC, - real* DF, +void ScaleCF_0817_comp_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffCF offCF) + OffCF offCF, + CUstream_st *stream) { int Grid = (kCF / numberOfThreads)+1; int Grid1, Grid2; @@ -4879,7 +4626,7 @@ extern "C" void ScaleCF_0817_comp_27(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4888,52 +4635,52 @@ extern "C" void ScaleCF_0817_comp_27(real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCF_0817_comp_27<<< gridINT_CF, threads >>>( DC, - DF, + scaleCF_0817_comp_27<<< gridINT_CF, threads, 0, stream >>>( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCF_0817_27 execution failed"); + getLastCudaError("scaleCF_0817_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCF_comp_D3Q27F3_2018(real* DC, +void ScaleCF_comp_D3Q27F3_2018(real* DC, real* DF, - real* G6, + real* G6, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffCF offCF) @@ -4944,7 +4691,7 @@ extern "C" void ScaleCF_comp_D3Q27F3_2018(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -4962,47 +4709,48 @@ extern "C" void ScaleCF_comp_D3Q27F3_2018(real* DC, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCF_comp_D3Q27F3_2018 execution failed"); + getLastCudaError("scaleCF_comp_D3Q27F3_2018 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCF_comp_D3Q27F3(real* DC, +void ScaleCF_comp_D3Q27F3(real* DC, real* DF, - real* G6, + real* G6, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffCF offCF) + OffCF offCF, + CUstream_st *stream) { int Grid = (kCF / numberOfThreads)+1; int Grid1, Grid2; @@ -5010,7 +4758,7 @@ extern "C" void ScaleCF_comp_D3Q27F3(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5019,7 +4767,7 @@ extern "C" void ScaleCF_comp_D3Q27F3(real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCF_comp_D3Q27F3 <<< gridINT_CF, threads >>>( DC, + scaleCF_comp_D3Q27F3 <<< gridINT_CF, threads, 0, stream >>>( DC, DF, G6, neighborCX, @@ -5028,43 +4776,43 @@ extern "C" void ScaleCF_comp_D3Q27F3(real* DC, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCF_comp_D3Q27F3 execution failed"); + getLastCudaError("scaleCF_comp_D3Q27F3 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCF_staggered_time_comp_27( real* DC, - real* DF, +void ScaleCF_staggered_time_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffCF offCF) @@ -5075,7 +4823,7 @@ extern "C" void ScaleCF_staggered_time_comp_27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5084,118 +4832,113 @@ extern "C" void ScaleCF_staggered_time_comp_27( real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCF_staggered_time_comp_27<<< gridINT_CF, threads >>>( DC, - DF, + scaleCF_staggered_time_comp_27<<< gridINT_CF, threads >>>( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCF_Fix_27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCF_RhoSq_comp_27( real* DC, - real* DF, - unsigned int* neighborCX, - unsigned int* neighborCY, - unsigned int* neighborCZ, - unsigned int* neighborFX, - unsigned int* neighborFY, - unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, - unsigned int nyF, - unsigned int numberOfThreads, - OffCF offCF) -{ - int Grid = (kCF / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridINT_CF(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - scaleCF_RhoSq_comp_27<<< gridINT_CF, threads >>>( DC, - DF, - neighborCX, - neighborCY, - neighborCZ, - neighborFX, - neighborFY, - neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, - nyF, - offCF); - getLastCudaError("scaleCF_RhoSq_27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCF_RhoSq_3rdMom_comp_27(real* DC, - real* DF, + getLastCudaError("scaleCF_Fix_27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void ScaleCF_RhoSq_comp_27(LBMSimulationParameter * parameterDeviceC, LBMSimulationParameter* parameterDeviceF, ICellCF * icellCF, OffCF& offsetCF, CUstream_st *stream) +{ + dim3 grid = vf::cuda::getCudaGrid(parameterDeviceC->numberofthreads, icellCF->kCF); + dim3 threads(parameterDeviceC->numberofthreads, 1, 1 ); + + scaleCF_RhoSq_comp_27<<<grid, threads, 0, stream>>>( + parameterDeviceC->distributions.f[0], + parameterDeviceF->distributions.f[0], + parameterDeviceC->neighborX, + parameterDeviceC->neighborY, + parameterDeviceC->neighborZ, + parameterDeviceF->neighborX, + parameterDeviceF->neighborY, + parameterDeviceF->neighborZ, + parameterDeviceC->numberOfNodes, + parameterDeviceF->numberOfNodes, + parameterDeviceC->isEvenTimestep, + icellCF->ICellCFC, + icellCF->ICellCFF, + icellCF->kCF, + parameterDeviceC->omega, + parameterDeviceF->omega, + parameterDeviceC->vis, + parameterDeviceC->nx, + parameterDeviceC->ny, + parameterDeviceF->nx, + parameterDeviceF->ny, + offsetCF); + getLastCudaError("scaleCF_RhoSq_27 execution failed"); +} + +void ScaleCF_compressible(LBMSimulationParameter * parameterDeviceC, LBMSimulationParameter* parameterDeviceF, ICellCF * icellCF, OffCF& offsetCF, CUstream_st *stream) +{ + dim3 grid = vf::cuda::getCudaGrid(parameterDeviceC->numberofthreads, icellCF->kCF); + dim3 threads(parameterDeviceC->numberofthreads, 1, 1 ); + + scaleCF_compressible<<<grid, threads, 0, stream>>>( + parameterDeviceC->distributions.f[0], + parameterDeviceF->distributions.f[0], + parameterDeviceC->neighborX, + parameterDeviceC->neighborY, + parameterDeviceC->neighborZ, + parameterDeviceF->neighborX, + parameterDeviceF->neighborY, + parameterDeviceF->neighborZ, + parameterDeviceC->numberOfNodes, + parameterDeviceF->numberOfNodes, + parameterDeviceC->isEvenTimestep, + icellCF->ICellCFC, + icellCF->ICellCFF, + icellCF->kCF, + parameterDeviceC->omega, + parameterDeviceF->omega, + offsetCF); + getLastCudaError("scaleCF_compressible execution failed"); +} + +////////////////////////////////////////////////////////////////////////// +void ScaleCF_RhoSq_3rdMom_comp_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffCF offCF) + OffCF offCF, + CUstream_st *stream) { int Grid = (kCF / numberOfThreads)+1; int Grid1, Grid2; @@ -5203,7 +4946,7 @@ extern "C" void ScaleCF_RhoSq_3rdMom_comp_27(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5212,54 +4955,55 @@ extern "C" void ScaleCF_RhoSq_3rdMom_comp_27(real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCF_RhoSq_3rdMom_comp_27<<< gridINT_CF, threads >>>( DC, - DF, + scaleCF_RhoSq_3rdMom_comp_27<<< gridINT_CF, threads, 0, stream >>>( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCF_RhoSq_3rdMom_comp_27 execution failed"); + getLastCudaError("scaleCF_RhoSq_3rdMom_comp_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCF_AA2016_comp_27(real* DC, - real* DF, +void ScaleCF_AA2016_comp_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffCF offCF) + OffCF offCF, + CUstream_st *stream) { int Grid = (kCF / numberOfThreads)+1; int Grid1, Grid2; @@ -5267,7 +5011,7 @@ extern "C" void ScaleCF_AA2016_comp_27(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5276,51 +5020,51 @@ extern "C" void ScaleCF_AA2016_comp_27(real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCF_AA2016_comp_27<<< gridINT_CF, threads >>>(DC, - DF, + scaleCF_AA2016_comp_27<<< gridINT_CF, threads, 0, stream >>>(DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCF_AA2016_comp_27 execution failed"); + getLastCudaError("scaleCF_AA2016_comp_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCF_NSPress_27( real* DC, - real* DF, +void ScaleCF_NSPress_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffCF offCF) @@ -5331,7 +5075,7 @@ extern "C" void ScaleCF_NSPress_27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5340,34 +5084,34 @@ extern "C" void ScaleCF_NSPress_27( real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCF_NSPress_27<<< gridINT_CF, threads >>>(DC, - DF, + scaleCF_NSPress_27<<< gridINT_CF, threads >>>(DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offCF); - getLastCudaError("scaleCF_Fix_27 execution failed"); + getLastCudaError("scaleCF_Fix_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCFThSMG7( real* DC, +void ScaleCFThSMG7( real* DC, real* DF, - real* DD7C, + real* DD7C, real* DD7F, unsigned int* neighborCX, unsigned int* neighborCY, @@ -5375,12 +5119,12 @@ extern "C" void ScaleCFThSMG7( real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, real nu, real diffusivity_fine, unsigned int numberOfThreads, @@ -5392,7 +5136,7 @@ extern "C" void ScaleCFThSMG7( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5401,7 +5145,7 @@ extern "C" void ScaleCFThSMG7( real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCFThSMG7<<< gridINT_CF, threads >>> (DC, + scaleCFThSMG7<<< gridINT_CF, threads >>> (DC, DF, DD7C, DD7F, @@ -5411,21 +5155,21 @@ extern "C" void ScaleCFThSMG7( real* DC, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, nu, diffusivity_fine, offCF); - getLastCudaError("scaleCFThSMG7 execution failed"); + getLastCudaError("scaleCFThSMG7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCFThS7( real* DC, +void ScaleCFThS7( real* DC, real* DF, - real* DD7C, + real* DD7C, real* DD7F, unsigned int* neighborCX, unsigned int* neighborCY, @@ -5433,12 +5177,12 @@ extern "C" void ScaleCFThS7( real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, real nu, real diffusivity_fine, unsigned int numberOfThreads) @@ -5449,7 +5193,7 @@ extern "C" void ScaleCFThS7( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5458,7 +5202,7 @@ extern "C" void ScaleCFThS7( real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCFThS7<<< gridINT_CF, threads >>> ( DC, + scaleCFThS7<<< gridINT_CF, threads >>> ( DC, DF, DD7C, DD7F, @@ -5468,20 +5212,20 @@ extern "C" void ScaleCFThS7( real* DC, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, nu, diffusivity_fine); - getLastCudaError("scaleCFThS7 execution failed"); + getLastCudaError("scaleCFThS7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleCFThS27( real* DC, +void ScaleCFThS27( real* DC, real* DF, - real* DD27C, + real* DD27C, real* DD27F, unsigned int* neighborCX, unsigned int* neighborCY, @@ -5489,12 +5233,12 @@ extern "C" void ScaleCFThS27( real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posCSWB, - unsigned int* posFSWB, - unsigned int kCF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posCSWB, + unsigned int* posFSWB, + unsigned int kCF, real nu, real diffusivity_fine, unsigned int numberOfThreads, @@ -5506,7 +5250,7 @@ extern "C" void ScaleCFThS27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5515,7 +5259,7 @@ extern "C" void ScaleCFThS27( real* DC, dim3 gridINT_CF(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleCFThS27<<< gridINT_CF, threads >>> ( DC, + scaleCFThS27<<< gridINT_CF, threads >>> ( DC, DF, DD27C, DD27F, @@ -5525,38 +5269,38 @@ extern "C" void ScaleCFThS27( real* DC, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posCSWB, - posFSWB, - kCF, + size_MatC, + size_MatF, + isEvenTimestep, + posCSWB, + posFSWB, + kCF, nu, diffusivity_fine, offCF); - getLastCudaError("scaleCFThS27 execution failed"); + getLastCudaError("scaleCFThS27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFC27( real* DC, - real* DF, +void ScaleFC27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads) { @@ -5566,7 +5310,7 @@ extern "C" void ScaleFC27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5575,50 +5319,50 @@ extern "C" void ScaleFC27( real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFC27<<< gridINT_FC, threads >>> ( DC, - DF, + scaleFC27<<< gridINT_FC, threads >>> ( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF); - getLastCudaError("scaleFC27 execution failed"); + getLastCudaError("scaleFC27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFCEff27(real* DC, - real* DF, +void ScaleFCEff27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffFC offFC) @@ -5629,7 +5373,7 @@ extern "C" void ScaleFCEff27(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5638,51 +5382,51 @@ extern "C" void ScaleFCEff27(real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFCEff27<<< gridINT_FC, threads >>> ( DC, - DF, + scaleFCEff27<<< gridINT_FC, threads >>> ( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("scaleFCEff27 execution failed"); + getLastCudaError("scaleFCEff27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFCLast27(real* DC, - real* DF, +void ScaleFCLast27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffFC offFC) @@ -5693,7 +5437,7 @@ extern "C" void ScaleFCLast27(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5702,51 +5446,51 @@ extern "C" void ScaleFCLast27(real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFCLast27<<< gridINT_FC, threads >>> (DC, - DF, + scaleFCLast27<<< gridINT_FC, threads >>> (DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("Kernel execution failed"); + getLastCudaError("Kernel execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFCpress27(real* DC, - real* DF, +void ScaleFCpress27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffFC offFC) @@ -5757,7 +5501,7 @@ extern "C" void ScaleFCpress27(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5766,51 +5510,51 @@ extern "C" void ScaleFCpress27(real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFCpress27<<< gridINT_FC, threads >>> ( DC, - DF, + scaleFCpress27<<< gridINT_FC, threads >>> ( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("scaleFCpress27 execution failed"); + getLastCudaError("scaleFCpress27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFC_Fix_27(real* DC, - real* DF, +void ScaleFC_Fix_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffFC offFC) @@ -5821,7 +5565,7 @@ extern "C" void ScaleFC_Fix_27(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5830,51 +5574,51 @@ extern "C" void ScaleFC_Fix_27(real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFC_Fix_27<<< gridINT_FC, threads >>> ( DC, - DF, + scaleFC_Fix_27<<< gridINT_FC, threads >>> ( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("scaleFC_Fix_27 execution failed"); + getLastCudaError("scaleFC_Fix_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFC_Fix_comp_27( real* DC, - real* DF, +void ScaleFC_Fix_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffFC offFC) @@ -5885,7 +5629,7 @@ extern "C" void ScaleFC_Fix_comp_27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5894,54 +5638,55 @@ extern "C" void ScaleFC_Fix_comp_27( real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFC_Fix_comp_27<<< gridINT_FC, threads >>> ( DC, - DF, + scaleFC_Fix_comp_27<<< gridINT_FC, threads >>> ( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("scaleFC_Fix_27 execution failed"); + getLastCudaError("scaleFC_Fix_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFC_0817_comp_27( real* DC, - real* DF, +void ScaleFC_0817_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffFC offFC) + OffFC offFC, + CUstream_st *stream) { int Grid = (kFC / numberOfThreads)+1; int Grid1, Grid2; @@ -5949,7 +5694,7 @@ extern "C" void ScaleFC_0817_comp_27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -5958,32 +5703,32 @@ extern "C" void ScaleFC_0817_comp_27( real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFC_0817_comp_27<<< gridINT_FC, threads >>> (DC, - DF, + scaleFC_0817_comp_27<<< gridINT_FC, threads, 0, stream >>> (DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("scaleFC_0817_27 execution failed"); + getLastCudaError("scaleFC_0817_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFC_comp_D3Q27F3_2018( real* DC, +void ScaleFC_comp_D3Q27F3_2018( real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -5992,18 +5737,18 @@ extern "C" void ScaleFC_comp_D3Q27F3_2018( real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffFC offFC) @@ -6014,7 +5759,7 @@ extern "C" void ScaleFC_comp_D3Q27F3_2018( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6032,24 +5777,24 @@ extern "C" void ScaleFC_comp_D3Q27F3_2018( real* DC, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("scaleFC_comp_D3Q27F3_2018 execution failed"); + getLastCudaError("scaleFC_comp_D3Q27F3_2018 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFC_comp_D3Q27F3( real* DC, +void ScaleFC_comp_D3Q27F3( real* DC, real* DF, real* G6, unsigned int* neighborCX, @@ -6058,21 +5803,22 @@ extern "C" void ScaleFC_comp_D3Q27F3( real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffFC offFC) + OffFC offFC, + CUstream_st *stream) { int Grid = (kFC / numberOfThreads)+1; int Grid1, Grid2; @@ -6080,7 +5826,7 @@ extern "C" void ScaleFC_comp_D3Q27F3( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6089,7 +5835,7 @@ extern "C" void ScaleFC_comp_D3Q27F3( real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFC_comp_D3Q27F3 <<< gridINT_FC, threads >>> (DC, + scaleFC_comp_D3Q27F3 <<< gridINT_FC, threads, 0, stream >>> (DC, DF, G6, neighborCX, @@ -6098,43 +5844,43 @@ extern "C" void ScaleFC_comp_D3Q27F3( real* DC, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("scaleFC_0817_27 execution failed"); + getLastCudaError("scaleFC_0817_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFC_staggered_time_comp_27( real* DC, - real* DF, +void ScaleFC_staggered_time_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffFC offFC) @@ -6145,7 +5891,7 @@ extern "C" void ScaleFC_staggered_time_comp_27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6154,118 +5900,112 @@ extern "C" void ScaleFC_staggered_time_comp_27( real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFC_staggered_time_comp_27<<< gridINT_FC, threads >>> ( DC, - DF, + scaleFC_staggered_time_comp_27<<< gridINT_FC, threads >>> ( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("scaleFC_Fix_27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFC_RhoSq_comp_27(real* DC, - real* DF, - unsigned int* neighborCX, - unsigned int* neighborCY, - unsigned int* neighborCZ, - unsigned int* neighborFX, - unsigned int* neighborFY, - unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, - unsigned int nyF, - unsigned int numberOfThreads, - OffFC offFC) -{ - int Grid = (kFC / numberOfThreads)+1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid/Grid1)+1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 gridINT_FC(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1 ); - - scaleFC_RhoSq_comp_27<<< gridINT_FC, threads >>>(DC, - DF, - neighborCX, - neighborCY, - neighborCZ, - neighborFX, - neighborFY, - neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, - nyF, - offFC); - getLastCudaError("scaleFC_RhoSq_27 execution failed"); -} -////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFC_RhoSq_3rdMom_comp_27( real* DC, - real* DF, + getLastCudaError("scaleFC_Fix_27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void ScaleFC_RhoSq_comp_27(LBMSimulationParameter * parameterDeviceC, LBMSimulationParameter* parameterDeviceF, ICellFC * icellFC, OffFC &offsetFC, CUstream_st *stream) +{ + dim3 grid = vf::cuda::getCudaGrid(parameterDeviceC->numberofthreads, icellFC->kFC); + dim3 threads(parameterDeviceC->numberofthreads, 1, 1 ); + + scaleFC_RhoSq_comp_27<<<grid, threads, 0, stream>>>( + parameterDeviceC->distributions.f[0], + parameterDeviceF->distributions.f[0], + parameterDeviceC->neighborX, + parameterDeviceC->neighborY, + parameterDeviceC->neighborZ, + parameterDeviceF->neighborX, + parameterDeviceF->neighborY, + parameterDeviceF->neighborZ, + parameterDeviceC->numberOfNodes, + parameterDeviceF->numberOfNodes, + parameterDeviceC->isEvenTimestep, + icellFC->ICellFCC, + icellFC->ICellFCF, + icellFC->kFC, + parameterDeviceC->omega, + parameterDeviceF->omega, + parameterDeviceC->vis, + parameterDeviceC->nx, + parameterDeviceC->ny, + parameterDeviceF->nx, + parameterDeviceF->ny, + offsetFC); + getLastCudaError("scaleFC_RhoSq_27 execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void ScaleFC_compressible(LBMSimulationParameter * parameterDeviceC, LBMSimulationParameter* parameterDeviceF, ICellFC * icellFC, OffFC &offsetFC, CUstream_st *stream) +{ + dim3 grid = vf::cuda::getCudaGrid(parameterDeviceC->numberofthreads, icellFC->kFC); + dim3 threads(parameterDeviceC->numberofthreads, 1, 1 ); + + scaleFC_compressible<<<grid, threads, 0, stream>>>( + parameterDeviceC->distributions.f[0], + parameterDeviceF->distributions.f[0], + parameterDeviceC->neighborX, + parameterDeviceC->neighborY, + parameterDeviceC->neighborZ, + parameterDeviceF->neighborX, + parameterDeviceF->neighborY, + parameterDeviceF->neighborZ, + parameterDeviceC->numberOfNodes, + parameterDeviceF->numberOfNodes, + parameterDeviceC->isEvenTimestep, + icellFC->ICellFCC, + icellFC->ICellFCF, + icellFC->kFC, + parameterDeviceC->omega, + parameterDeviceF->omega, + offsetFC); + getLastCudaError("scaleFC_compressible execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void ScaleFC_RhoSq_3rdMom_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffFC offFC) + OffFC offFC, + CUstream_st *stream) { int Grid = (kFC / numberOfThreads)+1; int Grid1, Grid2; @@ -6273,7 +6013,7 @@ extern "C" void ScaleFC_RhoSq_3rdMom_comp_27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6282,54 +6022,55 @@ extern "C" void ScaleFC_RhoSq_3rdMom_comp_27( real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFC_RhoSq_3rdMom_comp_27<<< gridINT_FC, threads >>>(DC, - DF, + scaleFC_RhoSq_3rdMom_comp_27<<< gridINT_FC, threads, 0, stream >>>(DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("scaleFC_RhoSq_3rdMom_comp_27 execution failed"); + getLastCudaError("scaleFC_RhoSq_3rdMom_comp_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFC_AA2016_comp_27( real* DC, - real* DF, +void ScaleFC_AA2016_comp_27( real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, - OffFC offFC) + OffFC offFC, + CUstream_st *stream) { int Grid = (kFC / numberOfThreads)+1; int Grid1, Grid2; @@ -6337,7 +6078,7 @@ extern "C" void ScaleFC_AA2016_comp_27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6346,51 +6087,51 @@ extern "C" void ScaleFC_AA2016_comp_27( real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFC_AA2016_comp_27<<< gridINT_FC, threads >>>(DC, - DF, + scaleFC_AA2016_comp_27<<< gridINT_FC, threads, 0, stream >>>(DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("scaleFC_AA2016_comp_27 execution failed"); + getLastCudaError("scaleFC_AA2016_comp_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFC_NSPress_27(real* DC, - real* DF, +void ScaleFC_NSPress_27(real* DC, + real* DF, unsigned int* neighborCX, unsigned int* neighborCY, unsigned int* neighborCZ, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, - real omCoarse, - real omFine, - real nu, - unsigned int nxC, - unsigned int nyC, - unsigned int nxF, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, + real omCoarse, + real omFine, + real nu, + unsigned int nxC, + unsigned int nyC, + unsigned int nxF, unsigned int nyF, unsigned int numberOfThreads, OffFC offFC) @@ -6401,7 +6142,7 @@ extern "C" void ScaleFC_NSPress_27(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6410,34 +6151,34 @@ extern "C" void ScaleFC_NSPress_27(real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFC_NSPress_27<<< gridINT_FC, threads >>> ( DC, - DF, + scaleFC_NSPress_27<<< gridINT_FC, threads >>> ( DC, + DF, neighborCX, neighborCY, neighborCZ, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, - omCoarse, - omFine, - nu, - nxC, - nyC, - nxF, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, + omCoarse, + omFine, + nu, + nxC, + nyC, + nxF, nyF, offFC); - getLastCudaError("scaleFC_Fix_27 execution failed"); + getLastCudaError("scaleFC_Fix_27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFCThSMG7(real* DC, +void ScaleFCThSMG7(real* DC, real* DF, - real* DD7C, + real* DD7C, real* DD7F, unsigned int* neighborCX, unsigned int* neighborCY, @@ -6445,12 +6186,12 @@ extern "C" void ScaleFCThSMG7(real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, real nu, real diffusivity_coarse, unsigned int numberOfThreads, @@ -6462,7 +6203,7 @@ extern "C" void ScaleFCThSMG7(real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6471,9 +6212,9 @@ extern "C" void ScaleFCThSMG7(real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFCThSMG7<<< gridINT_FC, threads >>>( DC, + scaleFCThSMG7<<< gridINT_FC, threads >>>( DC, DF, - DD7C, + DD7C, DD7F, neighborCX, neighborCY, @@ -6481,21 +6222,21 @@ extern "C" void ScaleFCThSMG7(real* DC, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, nu, diffusivity_coarse, offFC); - getLastCudaError("scaleFCThSMG7 execution failed"); + getLastCudaError("scaleFCThSMG7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFCThS7( real* DC, +void ScaleFCThS7( real* DC, real* DF, - real* DD7C, + real* DD7C, real* DD7F, unsigned int* neighborCX, unsigned int* neighborCY, @@ -6503,12 +6244,12 @@ extern "C" void ScaleFCThS7( real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, real nu, real diffusivity_coarse, unsigned int numberOfThreads) @@ -6519,7 +6260,7 @@ extern "C" void ScaleFCThS7( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6528,9 +6269,9 @@ extern "C" void ScaleFCThS7( real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFCThS7<<< gridINT_FC, threads >>>(DC, + scaleFCThS7<<< gridINT_FC, threads >>>(DC, DF, - DD7C, + DD7C, DD7F, neighborCX, neighborCY, @@ -6538,20 +6279,20 @@ extern "C" void ScaleFCThS7( real* DC, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, nu, diffusivity_coarse); - getLastCudaError("scaleFCThS7 execution failed"); + getLastCudaError("scaleFCThS7 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void ScaleFCThS27( real* DC, +void ScaleFCThS27( real* DC, real* DF, - real* DD27C, + real* DD27C, real* DD27F, unsigned int* neighborCX, unsigned int* neighborCY, @@ -6559,12 +6300,12 @@ extern "C" void ScaleFCThS27( real* DC, unsigned int* neighborFX, unsigned int* neighborFY, unsigned int* neighborFZ, - unsigned int size_MatC, - unsigned int size_MatF, - bool evenOrOdd, - unsigned int* posC, - unsigned int* posFSWB, - unsigned int kFC, + unsigned int size_MatC, + unsigned int size_MatF, + bool isEvenTimestep, + unsigned int* posC, + unsigned int* posFSWB, + unsigned int kFC, real nu, real diffusivity_coarse, unsigned int numberOfThreads, @@ -6576,7 +6317,7 @@ extern "C" void ScaleFCThS27( real* DC, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6585,9 +6326,9 @@ extern "C" void ScaleFCThS27( real* DC, dim3 gridINT_FC(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - scaleFCThS27<<< gridINT_FC, threads >>>( DC, + scaleFCThS27<<< gridINT_FC, threads >>>( DC, DF, - DD27C, + DD27C, DD27F, neighborCX, neighborCY, @@ -6595,39 +6336,39 @@ extern "C" void ScaleFCThS27( real* DC, neighborFX, neighborFY, neighborFZ, - size_MatC, - size_MatF, - evenOrOdd, - posC, - posFSWB, - kFC, + size_MatC, + size_MatF, + isEvenTimestep, + posC, + posFSWB, + kFC, nu, diffusivity_coarse, offFC); - getLastCudaError("scaleFCThS27 execution failed"); + getLastCudaError("scaleFCThS27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void DragLiftPostD27(real* DD, - int* k_Q, +void DragLiftPostD27(real* DD, + int* k_Q, real* QQ, - int kQ, + int numberOfBCnodes, double *DragX, double *DragY, double *DragZ, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd, + unsigned int size_Mat, + bool isEvenTimestep, unsigned int numberOfThreads) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6636,42 +6377,42 @@ extern "C" void DragLiftPostD27(real* DD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - DragLiftPost27<<< grid, threads >>>(DD, - k_Q, + DragLiftPost27<<< grid, threads >>>(DD, + k_Q, QQ, - kQ, + numberOfBCnodes, DragX, DragY, DragZ, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("DragLift27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("DragLift27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void DragLiftPreD27( real* DD, - int* k_Q, +void DragLiftPreD27( real* DD, + int* k_Q, real* QQ, - int kQ, + int numberOfBCnodes, double *DragX, double *DragY, double *DragZ, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd, + unsigned int size_Mat, + bool isEvenTimestep, unsigned int numberOfThreads) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6680,30 +6421,30 @@ extern "C" void DragLiftPreD27( real* DD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - DragLiftPre27<<< grid, threads >>>( DD, - k_Q, + DragLiftPre27<<< grid, threads >>>( DD, + k_Q, QQ, - kQ, + numberOfBCnodes, DragX, DragY, DragZ, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("DragLift27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("DragLift27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcCPtop27(real* DD, - int* cpIndex, - int nonCp, +void CalcCPtop27(real* DD, + int* cpIndex, + int nonCp, double *cpPress, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd, + unsigned int size_Mat, + bool isEvenTimestep, unsigned int numberOfThreads) { int Grid = (nonCp / numberOfThreads)+1; @@ -6712,7 +6453,7 @@ extern "C" void CalcCPtop27(real* DD, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6721,27 +6462,27 @@ extern "C" void CalcCPtop27(real* DD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - CalcCP27<<< grid, threads >>>(DD, - cpIndex, - nonCp, + CalcCP27<<< grid, threads >>>(DD, + cpIndex, + nonCp, cpPress, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("CalcCP27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("CalcCP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void CalcCPbottom27( real* DD, - int* cpIndex, - int nonCp, +void CalcCPbottom27( real* DD, + int* cpIndex, + int nonCp, double *cpPress, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd, + unsigned int size_Mat, + bool isEvenTimestep, unsigned int numberOfThreads) { int Grid = (nonCp / numberOfThreads)+1; @@ -6750,7 +6491,7 @@ extern "C" void CalcCPbottom27( real* DD, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6759,28 +6500,29 @@ extern "C" void CalcCPbottom27( real* DD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - CalcCP27<<< grid, threads >>>(DD, - cpIndex, - nonCp, + CalcCP27<<< grid, threads >>>(DD, + cpIndex, + nonCp, cpPress, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("CalcCP27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("CalcCP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void GetSendFsPreDev27(real* DD, +void GetSendFsPreDev27(real* DD, real* bufferFs, int* sendIndex, int buffmax, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd, - unsigned int numberOfThreads) + unsigned int size_Mat, + bool isEvenTimestep, + unsigned int numberOfThreads, + cudaStream_t stream) { int Grid = (buffmax / numberOfThreads)+1; int Grid1, Grid2; @@ -6788,7 +6530,7 @@ extern "C" void GetSendFsPreDev27(real* DD, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6797,28 +6539,29 @@ extern "C" void GetSendFsPreDev27(real* DD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - getSendFsPre27<<< grid, threads >>>(DD, - bufferFs, - sendIndex, + getSendFsPre27<<< grid, threads, 0, stream >>>(DD, + bufferFs, + sendIndex, buffmax, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("getSendFsPre27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("getSendFsPre27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void GetSendFsPostDev27(real* DD, +void GetSendFsPostDev27(real* DD, real* bufferFs, int* sendIndex, int buffmax, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd, - unsigned int numberOfThreads) + unsigned int size_Mat, + bool isEvenTimestep, + unsigned int numberOfThreads, + cudaStream_t stream) { int Grid = (buffmax / numberOfThreads)+1; int Grid1, Grid2; @@ -6826,7 +6569,7 @@ extern "C" void GetSendFsPostDev27(real* DD, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6835,28 +6578,29 @@ extern "C" void GetSendFsPostDev27(real* DD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - getSendFsPost27<<< grid, threads >>>(DD, - bufferFs, - sendIndex, + getSendFsPost27<<< grid, threads, 0, stream >>>(DD, + bufferFs, + sendIndex, buffmax, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("getSendFsPost27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("getSendFsPost27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void SetRecvFsPreDev27(real* DD, +void SetRecvFsPreDev27(real* DD, real* bufferFs, int* recvIndex, int buffmax, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd, - unsigned int numberOfThreads) + unsigned int size_Mat, + bool isEvenTimestep, + unsigned int numberOfThreads, + cudaStream_t stream) { int Grid = (buffmax / numberOfThreads)+1; int Grid1, Grid2; @@ -6864,7 +6608,7 @@ extern "C" void SetRecvFsPreDev27(real* DD, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6873,28 +6617,29 @@ extern "C" void SetRecvFsPreDev27(real* DD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - setRecvFsPre27<<< grid, threads >>>(DD, - bufferFs, - recvIndex, + setRecvFsPre27<<< grid, threads, 0, stream >>>(DD, + bufferFs, + recvIndex, buffmax, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("setRecvFsPre27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("setRecvFsPre27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void SetRecvFsPostDev27(real* DD, +void SetRecvFsPostDev27(real* DD, real* bufferFs, int* recvIndex, int buffmax, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd, - unsigned int numberOfThreads) + unsigned int size_Mat, + bool isEvenTimestep, + unsigned int numberOfThreads, + cudaStream_t stream) { int Grid = (buffmax / numberOfThreads)+1; int Grid1, Grid2; @@ -6902,7 +6647,7 @@ extern "C" void SetRecvFsPostDev27(real* DD, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -6911,19 +6656,19 @@ extern "C" void SetRecvFsPostDev27(real* DD, dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - setRecvFsPost27<<< grid, threads >>>(DD, - bufferFs, - recvIndex, + setRecvFsPost27<<< grid, threads, 0, stream >>>(DD, + bufferFs, + recvIndex, buffmax, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("setRecvFsPost27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("setRecvFsPost27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void getSendGsDevF3( +void getSendGsDevF3( real* G6, real* bufferGs, int* sendIndex, @@ -6932,7 +6677,7 @@ extern "C" void getSendGsDevF3( unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, + bool isEvenTimestep, unsigned int numberOfThreads) { int Grid = (buffmax / numberOfThreads) + 1; @@ -6959,11 +6704,11 @@ extern "C" void getSendGsDevF3( neighborY, neighborZ, size_Mat, - evenOrOdd); + isEvenTimestep); getLastCudaError("getSendGsF3 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void setRecvGsDevF3( +void setRecvGsDevF3( real* G6, real* bufferGs, int* recvIndex, @@ -6972,7 +6717,7 @@ extern "C" void setRecvGsDevF3( unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd, + bool isEvenTimestep, unsigned int numberOfThreads) { int Grid = (buffmax / numberOfThreads) + 1; @@ -6999,35 +6744,32 @@ extern "C" void setRecvGsDevF3( neighborY, neighborZ, size_Mat, - evenOrOdd); + isEvenTimestep); getLastCudaError("setRecvGsF3 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void WallFuncDev27(unsigned int numberOfThreads, - int nx, - int ny, +void WallFuncDev27(unsigned int numberOfThreads, real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - unsigned int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { - int Grid = (kQ / numberOfThreads)+1; + int Grid = (numberOfBCnodes / numberOfThreads)+1; int Grid1, Grid2; if (Grid>512) { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -7036,34 +6778,32 @@ extern "C" void WallFuncDev27(unsigned int numberOfThreads, dim3 gridQ(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1 ); - WallFunction27<<< gridQ, threads >>> ( nx, - ny, + WallFunction27<<< gridQ, threads >>> ( vx, vy, vz, - DD, - k_Q, + DD, + k_Q, QQ, - sizeQ, - kQ, - om1, + numberOfBCnodes, + om1, neighborX, neighborY, neighborZ, - size_Mat, - evenOrOdd); - getLastCudaError("WallFunction27 execution failed"); + size_Mat, + isEvenTimestep); + getLastCudaError("WallFunction27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void SetOutputWallVelocitySP27(unsigned int numberOfThreads, +void SetOutputWallVelocitySP27(unsigned int numberOfThreads, real* vxD, real* vyD, real* vzD, real* vxWall, real* vyWall, real* vzWall, - int numberOfWallNodes, - int* kWallNodes, + int numberOfWallNodes, + int* kWallNodes, real* rhoD, real* pressD, unsigned int* geoD, @@ -7072,7 +6812,7 @@ extern "C" void SetOutputWallVelocitySP27(unsigned int numberOfThreads, unsigned int* neighborZ, unsigned int size_Mat, real* DD, - bool evenOrOdd) + bool isEvenTimestep) { int Grid = (numberOfWallNodes / numberOfThreads)+1; int Grid1, Grid2; @@ -7080,7 +6820,7 @@ extern "C" void SetOutputWallVelocitySP27(unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -7095,8 +6835,8 @@ extern "C" void SetOutputWallVelocitySP27(unsigned int numberOfThreads, vxWall, vyWall, vzWall, - numberOfWallNodes, - kWallNodes, + numberOfWallNodes, + kWallNodes, rhoD, pressD, geoD, @@ -7105,22 +6845,22 @@ extern "C" void SetOutputWallVelocitySP27(unsigned int numberOfThreads, neighborZ, size_Mat, DD, - evenOrOdd); - getLastCudaError("LBSetOutputWallVelocitySP27 execution failed"); + isEvenTimestep); + getLastCudaError("LBSetOutputWallVelocitySP27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void GetVelotoForce27(unsigned int numberOfThreads, - real* DD, - int* bcIndex, - int nonAtBC, +void GetVelotoForce27(unsigned int numberOfThreads, + real* DD, + int* bcIndex, + int nonAtBC, real* Vx, real* Vy, real* Vz, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { int Grid = (nonAtBC / numberOfThreads)+1; int Grid1, Grid2; @@ -7128,7 +6868,7 @@ extern "C" void GetVelotoForce27(unsigned int numberOfThreads, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -7147,16 +6887,16 @@ extern "C" void GetVelotoForce27(unsigned int numberOfThreads, neighborY, neighborZ, size_Mat, - evenOrOdd); - getLastCudaError("GetVeloforForcing27 execution failed"); + isEvenTimestep); + getLastCudaError("GetVeloforForcing27 execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void InitParticlesDevice(real* coordX, +void InitParticlesDevice(real* coordX, real* coordY, - real* coordZ, + real* coordZ, real* coordParticleXlocal, real* coordParticleYlocal, - real* coordParticleZlocal, + real* coordParticleZlocal, real* coordParticleXglobal, real* coordParticleYglobal, real* coordParticleZglobal, @@ -7172,7 +6912,7 @@ extern "C" void InitParticlesDevice(real* coordX, unsigned int* neighborZ, unsigned int* neighborWSB, int level, - unsigned int numberOfParticles, + unsigned int numberOfParticles, unsigned int size_Mat, unsigned int numberOfThreads) { @@ -7182,7 +6922,7 @@ extern "C" void InitParticlesDevice(real* coordX, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -7193,10 +6933,10 @@ extern "C" void InitParticlesDevice(real* coordX, InitParticles<<< gridQ, threads >>> (coordX, coordY, - coordZ, + coordZ, coordParticleXlocal, coordParticleYlocal, - coordParticleZlocal, + coordParticleZlocal, coordParticleXglobal, coordParticleYglobal, coordParticleZglobal, @@ -7214,15 +6954,15 @@ extern "C" void InitParticlesDevice(real* coordX, level, numberOfParticles, size_Mat); - getLastCudaError("InitParticles execution failed"); + getLastCudaError("InitParticles execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void MoveParticlesDevice(real* coordX, +void MoveParticlesDevice(real* coordX, real* coordY, - real* coordZ, + real* coordZ, real* coordParticleXlocal, real* coordParticleYlocal, - real* coordParticleZlocal, + real* coordParticleZlocal, real* coordParticleXglobal, real* coordParticleYglobal, real* coordParticleZglobal, @@ -7239,12 +6979,12 @@ extern "C" void MoveParticlesDevice(real* coordX, unsigned int* neighborZ, unsigned int* neighborWSB, int level, - unsigned int timestep, - unsigned int numberOfTimesteps, - unsigned int numberOfParticles, + unsigned int timestep, + unsigned int numberOfTimesteps, + unsigned int numberOfParticles, unsigned int size_Mat, unsigned int numberOfThreads, - bool evenOrOdd) + bool isEvenTimestep) { int Grid = (numberOfParticles / numberOfThreads)+1; int Grid1, Grid2; @@ -7252,7 +6992,7 @@ extern "C" void MoveParticlesDevice(real* coordX, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -7263,10 +7003,10 @@ extern "C" void MoveParticlesDevice(real* coordX, MoveParticles<<< gridQ, threads >>> (coordX, coordY, - coordZ, + coordZ, coordParticleXlocal, coordParticleYlocal, - coordParticleZlocal, + coordParticleZlocal, coordParticleXglobal, coordParticleYglobal, coordParticleZglobal, @@ -7287,11 +7027,11 @@ extern "C" void MoveParticlesDevice(real* coordX, numberOfTimesteps, numberOfParticles, size_Mat, - evenOrOdd); - getLastCudaError("MoveParticles execution failed"); + isEvenTimestep); + getLastCudaError("MoveParticles execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void initRandomDevice(curandState* state, +void initRandomDevice(curandState* state, unsigned int size_Mat, unsigned int numberOfThreads) { @@ -7301,7 +7041,7 @@ extern "C" void initRandomDevice(curandState* state, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -7311,10 +7051,10 @@ extern "C" void initRandomDevice(curandState* state, dim3 threads(numberOfThreads, 1, 1 ); initRandom<<< gridQ, threads >>> (state); - getLastCudaError("initRandom execution failed"); + getLastCudaError("initRandom execution failed"); } ////////////////////////////////////////////////////////////////////////// -extern "C" void generateRandomValuesDevice( curandState* state, +void generateRandomValuesDevice( curandState* state, unsigned int size_Mat, real* randArray, unsigned int numberOfThreads) @@ -7325,7 +7065,7 @@ extern "C" void generateRandomValuesDevice( curandState* state, { Grid1 = 512; Grid2 = (Grid/Grid1)+1; - } + } else { Grid1 = 1; @@ -7335,7 +7075,62 @@ extern "C" void generateRandomValuesDevice( curandState* state, dim3 threads(numberOfThreads, 1, 1 ); generateRandomValues<<< gridQ, threads >>> (state,randArray); - getLastCudaError("generateRandomValues execution failed"); + getLastCudaError("generateRandomValues execution failed"); +} +////////////////////////////////////////////////////////////////////////// +void CalcTurbulenceIntensityDevice( + real* vxx, + real* vyy, + real* vzz, + real* vxy, + real* vxz, + real* vyz, + real* vx_mean, + real* vy_mean, + real* vz_mean, + real* DD, + uint* typeOfGridNode, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep, + uint numberOfThreads) +{ + int Grid = (size_Mat / numberOfThreads)+1; + int Grid1, Grid2; + if (Grid>512) + { + Grid1 = 512; + Grid2 = (Grid/Grid1)+1; + } + else + { + Grid1 = 1; + Grid2 = Grid; + } + dim3 gridQ(Grid1, Grid2); + dim3 threads(numberOfThreads, 1, 1 ); + + CalcTurbulenceIntensity<<<gridQ, threads>>>( + vxx, + vyy, + vzz, + vxy, + vxz, + vyz, + vx_mean, + vy_mean, + vz_mean, + DD, + typeOfGridNode, + neighborX, + neighborY, + neighborZ, + size_Mat, + isEvenTimestep); + + getLastCudaError("CalcTurbulenceIntensity execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/GPU/NoSlipBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/NoSlipBCs27.cu index 9c8392ff01859c42fe180d2127ada52a703abfdc..314687c4b29a32962b386d7c083f72b754388e5b 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/NoSlipBCs27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/NoSlipBCs27.cu @@ -7,86 +7,86 @@ ////////////////////////////////////////////////////////////////////////// /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> +#include "KernelUtilities.h" using namespace vf::lbm::constant; +using namespace vf::lbm::dir; ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QDevice3rdMomentsComp27( int inx, - int iny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, +__global__ void QDevice3rdMomentsComp27( + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int numberOfLBnodes, + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &distributions[DIR_P00 *numberOfLBnodes]; + D.f[DIR_M00 ] = &distributions[DIR_M00 *numberOfLBnodes]; + D.f[DIR_0P0 ] = &distributions[DIR_0P0 *numberOfLBnodes]; + D.f[DIR_0M0 ] = &distributions[DIR_0M0 *numberOfLBnodes]; + D.f[DIR_00P ] = &distributions[DIR_00P *numberOfLBnodes]; + D.f[DIR_00M ] = &distributions[DIR_00M *numberOfLBnodes]; + D.f[DIR_PP0 ] = &distributions[DIR_PP0 *numberOfLBnodes]; + D.f[DIR_MM0 ] = &distributions[DIR_MM0 *numberOfLBnodes]; + D.f[DIR_PM0 ] = &distributions[DIR_PM0 *numberOfLBnodes]; + D.f[DIR_MP0 ] = &distributions[DIR_MP0 *numberOfLBnodes]; + D.f[DIR_P0P ] = &distributions[DIR_P0P *numberOfLBnodes]; + D.f[DIR_M0M ] = &distributions[DIR_M0M *numberOfLBnodes]; + D.f[DIR_P0M ] = &distributions[DIR_P0M *numberOfLBnodes]; + D.f[DIR_M0P ] = &distributions[DIR_M0P *numberOfLBnodes]; + D.f[DIR_0PP ] = &distributions[DIR_0PP *numberOfLBnodes]; + D.f[DIR_0MM ] = &distributions[DIR_0MM *numberOfLBnodes]; + D.f[DIR_0PM ] = &distributions[DIR_0PM *numberOfLBnodes]; + D.f[DIR_0MP ] = &distributions[DIR_0MP *numberOfLBnodes]; + D.f[DIR_000] = &distributions[DIR_000*numberOfLBnodes]; + D.f[DIR_PPP ] = &distributions[DIR_PPP *numberOfLBnodes]; + D.f[DIR_MMP ] = &distributions[DIR_MMP *numberOfLBnodes]; + D.f[DIR_PMP ] = &distributions[DIR_PMP *numberOfLBnodes]; + D.f[DIR_MPP ] = &distributions[DIR_MPP *numberOfLBnodes]; + D.f[DIR_PPM ] = &distributions[DIR_PPM *numberOfLBnodes]; + D.f[DIR_MMM ] = &distributions[DIR_MMM *numberOfLBnodes]; + D.f[DIR_PMM ] = &distributions[DIR_PMM *numberOfLBnodes]; + D.f[DIR_MPM ] = &distributions[DIR_MPM *numberOfLBnodes]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &distributions[DIR_P00 *numberOfLBnodes]; + D.f[DIR_P00 ] = &distributions[DIR_M00 *numberOfLBnodes]; + D.f[DIR_0M0 ] = &distributions[DIR_0P0 *numberOfLBnodes]; + D.f[DIR_0P0 ] = &distributions[DIR_0M0 *numberOfLBnodes]; + D.f[DIR_00M ] = &distributions[DIR_00P *numberOfLBnodes]; + D.f[DIR_00P ] = &distributions[DIR_00M *numberOfLBnodes]; + D.f[DIR_MM0 ] = &distributions[DIR_PP0 *numberOfLBnodes]; + D.f[DIR_PP0 ] = &distributions[DIR_MM0 *numberOfLBnodes]; + D.f[DIR_MP0 ] = &distributions[DIR_PM0 *numberOfLBnodes]; + D.f[DIR_PM0 ] = &distributions[DIR_MP0 *numberOfLBnodes]; + D.f[DIR_M0M ] = &distributions[DIR_P0P *numberOfLBnodes]; + D.f[DIR_P0P ] = &distributions[DIR_M0M *numberOfLBnodes]; + D.f[DIR_M0P ] = &distributions[DIR_P0M *numberOfLBnodes]; + D.f[DIR_P0M ] = &distributions[DIR_M0P *numberOfLBnodes]; + D.f[DIR_0MM ] = &distributions[DIR_0PP *numberOfLBnodes]; + D.f[DIR_0PP ] = &distributions[DIR_0MM *numberOfLBnodes]; + D.f[DIR_0MP ] = &distributions[DIR_0PM *numberOfLBnodes]; + D.f[DIR_0PM ] = &distributions[DIR_0MP *numberOfLBnodes]; + D.f[DIR_000] = &distributions[DIR_000*numberOfLBnodes]; + D.f[DIR_PPP ] = &distributions[DIR_MMM *numberOfLBnodes]; + D.f[DIR_MMP ] = &distributions[DIR_PPM *numberOfLBnodes]; + D.f[DIR_PMP ] = &distributions[DIR_MPM *numberOfLBnodes]; + D.f[DIR_MPP ] = &distributions[DIR_PMM *numberOfLBnodes]; + D.f[DIR_PPM ] = &distributions[DIR_MMP *numberOfLBnodes]; + D.f[DIR_MMM ] = &distributions[DIR_PPP *numberOfLBnodes]; + D.f[DIR_PMM ] = &distributions[DIR_MPP *numberOfLBnodes]; + D.f[DIR_MPM ] = &distributions[DIR_PMP *numberOfLBnodes]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -99,7 +99,7 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k < numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, @@ -107,52 +107,52 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &subgridDistances[DIR_P00 * numberOfBCnodes]; + q_dirW = &subgridDistances[DIR_M00 * numberOfBCnodes]; + q_dirN = &subgridDistances[DIR_0P0 * numberOfBCnodes]; + q_dirS = &subgridDistances[DIR_0M0 * numberOfBCnodes]; + q_dirT = &subgridDistances[DIR_00P * numberOfBCnodes]; + q_dirB = &subgridDistances[DIR_00M * numberOfBCnodes]; + q_dirNE = &subgridDistances[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &subgridDistances[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &subgridDistances[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &subgridDistances[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &subgridDistances[DIR_P0P * numberOfBCnodes]; + q_dirBW = &subgridDistances[DIR_M0M * numberOfBCnodes]; + q_dirBE = &subgridDistances[DIR_P0M * numberOfBCnodes]; + q_dirTW = &subgridDistances[DIR_M0P * numberOfBCnodes]; + q_dirTN = &subgridDistances[DIR_0PP * numberOfBCnodes]; + q_dirBS = &subgridDistances[DIR_0MM * numberOfBCnodes]; + q_dirBN = &subgridDistances[DIR_0PM * numberOfBCnodes]; + q_dirTS = &subgridDistances[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &subgridDistances[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &subgridDistances[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &subgridDistances[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &subgridDistances[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &subgridDistances[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &subgridDistances[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &subgridDistances[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &subgridDistances[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; + unsigned int numberOfNodesK = subgridDistanceIndices[k]; + unsigned int kzero= numberOfNodesK; + unsigned int ke = numberOfNodesK; + unsigned int kw = neighborX[numberOfNodesK]; + unsigned int kn = numberOfNodesK; + unsigned int ks = neighborY[numberOfNodesK]; + unsigned int kt = numberOfNodesK; + unsigned int kb = neighborZ[numberOfNodesK]; unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; + unsigned int kne = numberOfNodesK; unsigned int kse = ks; unsigned int knw = kw; unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; + unsigned int kte = numberOfNodesK; unsigned int kbe = kb; unsigned int ktw = kw; unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; + unsigned int ktn = numberOfNodesK; unsigned int kbn = kb; unsigned int kts = ks; unsigned int ktse = ks; @@ -161,43 +161,43 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, unsigned int kbse = kbs; unsigned int ktsw = ksw; unsigned int kbne = kb; - unsigned int ktne = KQK; + unsigned int ktne = numberOfNodesK; unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q, m3; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -215,69 +215,69 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &distributions[DIR_P00 *numberOfLBnodes]; + D.f[DIR_M00 ] = &distributions[DIR_M00 *numberOfLBnodes]; + D.f[DIR_0P0 ] = &distributions[DIR_0P0 *numberOfLBnodes]; + D.f[DIR_0M0 ] = &distributions[DIR_0M0 *numberOfLBnodes]; + D.f[DIR_00P ] = &distributions[DIR_00P *numberOfLBnodes]; + D.f[DIR_00M ] = &distributions[DIR_00M *numberOfLBnodes]; + D.f[DIR_PP0 ] = &distributions[DIR_PP0 *numberOfLBnodes]; + D.f[DIR_MM0 ] = &distributions[DIR_MM0 *numberOfLBnodes]; + D.f[DIR_PM0 ] = &distributions[DIR_PM0 *numberOfLBnodes]; + D.f[DIR_MP0 ] = &distributions[DIR_MP0 *numberOfLBnodes]; + D.f[DIR_P0P ] = &distributions[DIR_P0P *numberOfLBnodes]; + D.f[DIR_M0M ] = &distributions[DIR_M0M *numberOfLBnodes]; + D.f[DIR_P0M ] = &distributions[DIR_P0M *numberOfLBnodes]; + D.f[DIR_M0P ] = &distributions[DIR_M0P *numberOfLBnodes]; + D.f[DIR_0PP ] = &distributions[DIR_0PP *numberOfLBnodes]; + D.f[DIR_0MM ] = &distributions[DIR_0MM *numberOfLBnodes]; + D.f[DIR_0PM ] = &distributions[DIR_0PM *numberOfLBnodes]; + D.f[DIR_0MP ] = &distributions[DIR_0MP *numberOfLBnodes]; + D.f[DIR_000] = &distributions[DIR_000*numberOfLBnodes]; + D.f[DIR_PPP ] = &distributions[DIR_PPP *numberOfLBnodes]; + D.f[DIR_MMP ] = &distributions[DIR_MMP *numberOfLBnodes]; + D.f[DIR_PMP ] = &distributions[DIR_PMP *numberOfLBnodes]; + D.f[DIR_MPP ] = &distributions[DIR_MPP *numberOfLBnodes]; + D.f[DIR_PPM ] = &distributions[DIR_PPM *numberOfLBnodes]; + D.f[DIR_MMM ] = &distributions[DIR_MMM *numberOfLBnodes]; + D.f[DIR_PMM ] = &distributions[DIR_PMM *numberOfLBnodes]; + D.f[DIR_MPM ] = &distributions[DIR_MPM *numberOfLBnodes]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &distributions[DIR_P00 *numberOfLBnodes]; + D.f[DIR_P00 ] = &distributions[DIR_M00 *numberOfLBnodes]; + D.f[DIR_0M0 ] = &distributions[DIR_0P0 *numberOfLBnodes]; + D.f[DIR_0P0 ] = &distributions[DIR_0M0 *numberOfLBnodes]; + D.f[DIR_00M ] = &distributions[DIR_00P *numberOfLBnodes]; + D.f[DIR_00P ] = &distributions[DIR_00M *numberOfLBnodes]; + D.f[DIR_MM0 ] = &distributions[DIR_PP0 *numberOfLBnodes]; + D.f[DIR_PP0 ] = &distributions[DIR_MM0 *numberOfLBnodes]; + D.f[DIR_MP0 ] = &distributions[DIR_PM0 *numberOfLBnodes]; + D.f[DIR_PM0 ] = &distributions[DIR_MP0 *numberOfLBnodes]; + D.f[DIR_M0M ] = &distributions[DIR_P0P *numberOfLBnodes]; + D.f[DIR_P0P ] = &distributions[DIR_M0M *numberOfLBnodes]; + D.f[DIR_M0P ] = &distributions[DIR_P0M *numberOfLBnodes]; + D.f[DIR_P0M ] = &distributions[DIR_M0P *numberOfLBnodes]; + D.f[DIR_0MM ] = &distributions[DIR_0PP *numberOfLBnodes]; + D.f[DIR_0PP ] = &distributions[DIR_0MM *numberOfLBnodes]; + D.f[DIR_0MP ] = &distributions[DIR_0PM *numberOfLBnodes]; + D.f[DIR_0PM ] = &distributions[DIR_0MP *numberOfLBnodes]; + D.f[DIR_000] = &distributions[DIR_000*numberOfLBnodes]; + D.f[DIR_PPP ] = &distributions[DIR_MMM *numberOfLBnodes]; + D.f[DIR_MMP ] = &distributions[DIR_PPM *numberOfLBnodes]; + D.f[DIR_PMP ] = &distributions[DIR_MPM *numberOfLBnodes]; + D.f[DIR_MPP ] = &distributions[DIR_PMM *numberOfLBnodes]; + D.f[DIR_PPM ] = &distributions[DIR_MMP *numberOfLBnodes]; + D.f[DIR_MMM ] = &distributions[DIR_PPP *numberOfLBnodes]; + D.f[DIR_PMM ] = &distributions[DIR_MPP *numberOfLBnodes]; + D.f[DIR_MPM ] = &distributions[DIR_PMP *numberOfLBnodes]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Test - //(D.f[dirZERO])[k]=c1o10; + //(D.f[DIR_000])[k]=c1o10; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -288,8 +288,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_E - f_W - c2o1 * drho * c2o27 * (c3o1*( vx1 )); feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W-m3+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W))/(c1o1+q)+(m3*c1o2); - //(D.f[dirW])[kw]=zero; + (D.f[DIR_M00])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W-m3+(f_E+f_W-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_E+f_W))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_M00])[kw]=zero; } q = q_dirW[k]; @@ -297,8 +297,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_W - f_E - c2o1 * drho * c2o27 * (c3o1*(-vx1 )); feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E-m3+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E))/(c1o1+q)+(m3*c1o2); - //(D.f[dirE])[ke]=zero; + (D.f[DIR_P00])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E-m3+(f_W+f_E-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_W+f_E))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_P00])[ke]=zero; } q = q_dirN[k]; @@ -306,8 +306,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_N - f_S - c2o1 * drho * c2o27 * (c3o1*( vx2 )); feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S-m3+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S))/(c1o1+q)+(m3*c1o2); - //(D.f[dirS])[ks]=zero; + (D.f[DIR_0M0])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S-m3+(f_N+f_S-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_N+f_S))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_0M0])[ks]=zero; } q = q_dirS[k]; @@ -315,8 +315,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_S - f_N - c2o1 * drho * c2o27 * (c3o1*( -vx2 )); feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N-m3+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N))/(c1o1+q)+(m3*c1o2); - //(D.f[dirN])[kn]=zero; + (D.f[DIR_0P0])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N-m3+(f_S+f_N-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_S+f_N))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_0P0])[kn]=zero; } q = q_dirT[k]; @@ -324,8 +324,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_T - f_B - c2o1 * drho * c2o27 * (c3o1*( vx3)); feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B-m3+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B))/(c1o1+q)+(m3*c1o2); - //(D.f[dirB])[kb]=one; + (D.f[DIR_00M])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B-m3+(f_T+f_B-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_T+f_B))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_00M])[kb]=one; } q = q_dirB[k]; @@ -333,8 +333,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_B - f_T - c2o1 * drho * c2o27 * (c3o1*( -vx3)); feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T-m3+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T))/(c1o1+q)+(m3*c1o2); - //(D.f[dirT])[kt]=zero; + (D.f[DIR_00P])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T-m3+(f_B+f_T-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_B+f_T))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_00P])[kt]=zero; } q = q_dirNE[k]; @@ -342,8 +342,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_NE - f_SW - c2o1 * drho * c1o54 * (c3o1*( vx1+vx2 )); feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW-m3+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW))/(c1o1+q)+(m3*c1o2); - //(D.f[dirSW])[ksw]=zero; + (D.f[DIR_MM0])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW-m3+(f_NE+f_SW-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_NE+f_SW))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_MM0])[ksw]=zero; } q = q_dirSW[k]; @@ -351,8 +351,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_SW - f_NE - c2o1 * drho * c1o54 * (c3o1*(-vx1-vx2 )); feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE-m3+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE))/(c1o1+q)+(m3*c1o2); - //(D.f[dirNE])[kne]=zero; + (D.f[DIR_PP0])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE-m3+(f_SW+f_NE-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_SW+f_NE))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_PP0])[kne]=zero; } q = q_dirSE[k]; @@ -360,8 +360,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_SE - f_NW - c2o1 * drho * c1o54 * (c3o1*( vx1-vx2 )); feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW-m3+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW))/(c1o1+q)+(m3*c1o2); - //(D.f[dirNW])[knw]=zero; + (D.f[DIR_MP0])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW-m3+(f_SE+f_NW-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_SE+f_NW))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_MP0])[knw]=zero; } q = q_dirNW[k]; @@ -369,8 +369,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_NW - f_SE - c2o1 * drho * c1o54 * (c3o1*(-vx1+vx2 )); feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE-m3+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE))/(c1o1+q)+(m3*c1o2); - //(D.f[dirSE])[kse]=zero; + (D.f[DIR_PM0])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE-m3+(f_NW+f_SE-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_NW+f_SE))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_PM0])[kse]=zero; } q = q_dirTE[k]; @@ -378,8 +378,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_TE - f_BW - c2o1 * drho * c1o54 * (c3o1*( vx1 +vx3)); feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW-m3+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW))/(c1o1+q)+(m3*c1o2); - //(D.f[dirBW])[kbw]=zero; + (D.f[DIR_M0M])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW-m3+(f_TE+f_BW-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_TE+f_BW))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_M0M])[kbw]=zero; } q = q_dirBW[k]; @@ -387,8 +387,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_BW - f_TE - c2o1 * drho * c1o54 * (c3o1*(-vx1 -vx3)); feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE-m3+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE))/(c1o1+q)+(m3*c1o2); - //(D.f[dirTE])[kte]=zero; + (D.f[DIR_P0P])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE-m3+(f_BW+f_TE-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_BW+f_TE))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_P0P])[kte]=zero; } q = q_dirBE[k]; @@ -396,8 +396,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_BE - f_TW - c2o1 * drho * c1o54 * (c3o1*( vx1 -vx3)); feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW-m3+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW))/(c1o1+q)+(m3*c1o2); - //(D.f[dirTW])[ktw]=zero; + (D.f[DIR_M0P])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW-m3+(f_BE+f_TW-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_BE+f_TW))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_M0P])[ktw]=zero; } q = q_dirTW[k]; @@ -405,8 +405,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_TW - f_BE - c2o1 * drho * c1o54 * (c3o1*(-vx1 +vx3)); feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE-m3+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE))/(c1o1+q)+(m3*c1o2); - //(D.f[dirBE])[kbe]=zero; + (D.f[DIR_P0M])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE-m3+(f_TW+f_BE-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_TW+f_BE))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_P0M])[kbe]=zero; } q = q_dirTN[k]; @@ -414,8 +414,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_TN - f_BS - c2o1 * drho * c1o54 * (c3o1*( vx2+vx3)); feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS-m3+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS))/(c1o1+q)+(m3*c1o2); - //(D.f[dirBS])[kbs]=zero; + (D.f[DIR_0MM])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS-m3+(f_TN+f_BS-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_TN+f_BS))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_0MM])[kbs]=zero; } q = q_dirBS[k]; @@ -423,8 +423,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_BS - f_TN - c2o1 * drho * c1o54 * (c3o1*( -vx2-vx3)); feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN-m3+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN))/(c1o1+q)+(m3*c1o2); - //(D.f[dirTN])[ktn]=zero; + (D.f[DIR_0PP])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN-m3+(f_BS+f_TN-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_BS+f_TN))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_0PP])[ktn]=zero; } q = q_dirBN[k]; @@ -432,8 +432,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_BN - f_TS - c2o1 * drho * c1o54 * (c3o1*( vx2-vx3)); feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS-m3+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS))/(c1o1+q)+(m3*c1o2); - //(D.f[dirTS])[kts]=zero; + (D.f[DIR_0MP])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS-m3+(f_BN+f_TS-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_BN+f_TS))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_0MP])[kts]=zero; } q = q_dirTS[k]; @@ -441,8 +441,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_TS - f_BN - c2o1 * drho * c1o54 * (c3o1*( -vx2+vx3)); feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN-m3+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN))/(c1o1+q)+(m3*c1o2); - //(D.f[dirBN])[kbn]=zero; + (D.f[DIR_0PM])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN-m3+(f_TS+f_BN-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_TS+f_BN))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_0PM])[kbn]=zero; } q = q_dirTNE[k]; @@ -450,8 +450,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_TNE - f_BSW - c2o1 * drho * c1o216 * (c3o1*( vx1+vx2+vx3)); feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW-m3+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW))/(c1o1+q)+(m3*c1o2); - //(D.f[dirBSW])[kbsw]=zero; + (D.f[DIR_MMM])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW-m3+(f_TNE+f_BSW-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_TNE+f_BSW))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_MMM])[kbsw]=zero; } q = q_dirBSW[k]; @@ -459,8 +459,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_BSW - f_TNE - c2o1 * drho * c1o216 * (c3o1*(-vx1-vx2-vx3)); feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE-m3+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE))/(c1o1+q)+(m3*c1o2); - //(D.f[dirTNE])[ktne]=zero; + (D.f[DIR_PPP])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE-m3+(f_BSW+f_TNE-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_BSW+f_TNE))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_PPP])[ktne]=zero; } q = q_dirBNE[k]; @@ -468,8 +468,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_BNE - f_TSW - c2o1 * drho * c1o216 * (c3o1*( vx1+vx2-vx3)); feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW-m3+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW))/(c1o1+q)+(m3*c1o2); - //(D.f[dirTSW])[ktsw]=zero; + (D.f[DIR_MMP])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW-m3+(f_BNE+f_TSW-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_BNE+f_TSW))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_MMP])[ktsw]=zero; } q = q_dirTSW[k]; @@ -477,8 +477,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_TSW - f_BNE - c2o1 * drho * c1o216 * (c3o1*(-vx1-vx2+vx3)); feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE-m3+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE))/(c1o1+q)+(m3*c1o2); - //(D.f[dirBNE])[kbne]=zero; + (D.f[DIR_PPM])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE-m3+(f_TSW+f_BNE-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_TSW+f_BNE))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_PPM])[kbne]=zero; } q = q_dirTSE[k]; @@ -486,8 +486,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_TSE - f_BNW - c2o1 * drho * c1o216 * (c3o1*( vx1-vx2+vx3)); feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW-m3+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW))/(c1o1+q)+(m3*c1o2); - //(D.f[dirBNW])[kbnw]=zero; + (D.f[DIR_MPM])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW-m3+(f_TSE+f_BNW-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_TSE+f_BNW))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_MPM])[kbnw]=zero; } q = q_dirBNW[k]; @@ -495,8 +495,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_BNW - f_TSE - c2o1 * drho * c1o216 * (c3o1*(-vx1+vx2-vx3)); feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE-m3+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE))/(c1o1+q)+(m3*c1o2); - //(D.f[dirTSE])[ktse]=zero; + (D.f[DIR_PMP])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE-m3+(f_BNW+f_TSE-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_BNW+f_TSE))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_PMP])[ktse]=zero; } q = q_dirBSE[k]; @@ -504,8 +504,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_BSE - f_TNW - c2o1 * drho * c1o216 * (c3o1*( vx1-vx2-vx3)); feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW-m3+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW))/(c1o1+q)+(m3*c1o2); - //(D.f[dirTNW])[ktnw]=zero; + (D.f[DIR_MPP])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW-m3+(f_BSE+f_TNW-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_BSE+f_TNW))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_MPP])[ktnw]=zero; } q = q_dirTNW[k]; @@ -513,8 +513,8 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, { m3 = f_TNW - f_BSE - c2o1 * drho * c1o216 * (c3o1*(-vx1+vx2+vx3)); feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE-m3+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE))/(c1o1+q)+(m3*c1o2); - //(D.f[dirBSE])[kbse]=zero; + (D.f[DIR_PMM])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE-m3+(f_TNW+f_BSE-c2o1*feq*omega)/(c1o1-omega))*c1o2+(q*(f_TNW+f_BSE))/(c1o1+q)+(m3*c1o2); + //(D.f[DIR_PMM])[kbse]=zero; } } } @@ -559,80 +559,77 @@ extern "C" __global__ void QDevice3rdMomentsComp27( int inx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QDeviceIncompHighNu27(int inx, - int iny, - real* DD, +__global__ void QDeviceIncompHighNu27(real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int numberOfLBnodes, + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *numberOfLBnodes]; + D.f[DIR_M00 ] = &DD[DIR_M00 *numberOfLBnodes]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *numberOfLBnodes]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *numberOfLBnodes]; + D.f[DIR_00P ] = &DD[DIR_00P *numberOfLBnodes]; + D.f[DIR_00M ] = &DD[DIR_00M *numberOfLBnodes]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *numberOfLBnodes]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *numberOfLBnodes]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *numberOfLBnodes]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *numberOfLBnodes]; + D.f[DIR_P0P ] = &DD[DIR_P0P *numberOfLBnodes]; + D.f[DIR_M0M ] = &DD[DIR_M0M *numberOfLBnodes]; + D.f[DIR_P0M ] = &DD[DIR_P0M *numberOfLBnodes]; + D.f[DIR_M0P ] = &DD[DIR_M0P *numberOfLBnodes]; + D.f[DIR_0PP ] = &DD[DIR_0PP *numberOfLBnodes]; + D.f[DIR_0MM ] = &DD[DIR_0MM *numberOfLBnodes]; + D.f[DIR_0PM ] = &DD[DIR_0PM *numberOfLBnodes]; + D.f[DIR_0MP ] = &DD[DIR_0MP *numberOfLBnodes]; + D.f[DIR_000] = &DD[DIR_000*numberOfLBnodes]; + D.f[DIR_PPP ] = &DD[DIR_PPP *numberOfLBnodes]; + D.f[DIR_MMP ] = &DD[DIR_MMP *numberOfLBnodes]; + D.f[DIR_PMP ] = &DD[DIR_PMP *numberOfLBnodes]; + D.f[DIR_MPP ] = &DD[DIR_MPP *numberOfLBnodes]; + D.f[DIR_PPM ] = &DD[DIR_PPM *numberOfLBnodes]; + D.f[DIR_MMM ] = &DD[DIR_MMM *numberOfLBnodes]; + D.f[DIR_PMM ] = &DD[DIR_PMM *numberOfLBnodes]; + D.f[DIR_MPM ] = &DD[DIR_MPM *numberOfLBnodes]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *numberOfLBnodes]; + D.f[DIR_P00 ] = &DD[DIR_M00 *numberOfLBnodes]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *numberOfLBnodes]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *numberOfLBnodes]; + D.f[DIR_00M ] = &DD[DIR_00P *numberOfLBnodes]; + D.f[DIR_00P ] = &DD[DIR_00M *numberOfLBnodes]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *numberOfLBnodes]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *numberOfLBnodes]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *numberOfLBnodes]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *numberOfLBnodes]; + D.f[DIR_M0M ] = &DD[DIR_P0P *numberOfLBnodes]; + D.f[DIR_P0P ] = &DD[DIR_M0M *numberOfLBnodes]; + D.f[DIR_M0P ] = &DD[DIR_P0M *numberOfLBnodes]; + D.f[DIR_P0M ] = &DD[DIR_M0P *numberOfLBnodes]; + D.f[DIR_0MM ] = &DD[DIR_0PP *numberOfLBnodes]; + D.f[DIR_0PP ] = &DD[DIR_0MM *numberOfLBnodes]; + D.f[DIR_0MP ] = &DD[DIR_0PM *numberOfLBnodes]; + D.f[DIR_0PM ] = &DD[DIR_0MP *numberOfLBnodes]; + D.f[DIR_000] = &DD[DIR_000*numberOfLBnodes]; + D.f[DIR_PPP ] = &DD[DIR_MMM *numberOfLBnodes]; + D.f[DIR_MMP ] = &DD[DIR_PPM *numberOfLBnodes]; + D.f[DIR_PMP ] = &DD[DIR_MPM *numberOfLBnodes]; + D.f[DIR_MPP ] = &DD[DIR_PMM *numberOfLBnodes]; + D.f[DIR_PPM ] = &DD[DIR_MMP *numberOfLBnodes]; + D.f[DIR_MMM ] = &DD[DIR_PPP *numberOfLBnodes]; + D.f[DIR_PMM ] = &DD[DIR_MPP *numberOfLBnodes]; + D.f[DIR_MPM ] = &DD[DIR_PMP *numberOfLBnodes]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -645,7 +642,7 @@ extern "C" __global__ void QDeviceIncompHighNu27(int inx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, @@ -653,52 +650,52 @@ extern "C" __global__ void QDeviceIncompHighNu27(int inx, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; + unsigned int numberOfNodesK = k_Q[k]; + unsigned int kzero= numberOfNodesK; + unsigned int ke = numberOfNodesK; + unsigned int kw = neighborX[numberOfNodesK]; + unsigned int kn = numberOfNodesK; + unsigned int ks = neighborY[numberOfNodesK]; + unsigned int kt = numberOfNodesK; + unsigned int kb = neighborZ[numberOfNodesK]; unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; + unsigned int kne = numberOfNodesK; unsigned int kse = ks; unsigned int knw = kw; unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; + unsigned int kte = numberOfNodesK; unsigned int kbe = kb; unsigned int ktw = kw; unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; + unsigned int ktn = numberOfNodesK; unsigned int kbn = kb; unsigned int kts = ks; unsigned int ktse = ks; @@ -707,43 +704,43 @@ extern "C" __global__ void QDeviceIncompHighNu27(int inx, unsigned int kbse = kbs; unsigned int ktsw = ksw; unsigned int kbne = kb; - unsigned int ktne = KQK; + unsigned int ktne = numberOfNodesK; unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_E = (D.f[dirE ])[ke ]; - f_W = (D.f[dirW ])[kw ]; - f_N = (D.f[dirN ])[kn ]; - f_S = (D.f[dirS ])[ks ]; - f_T = (D.f[dirT ])[kt ]; - f_B = (D.f[dirB ])[kb ]; - f_NE = (D.f[dirNE ])[kne ]; - f_SW = (D.f[dirSW ])[ksw ]; - f_SE = (D.f[dirSE ])[kse ]; - f_NW = (D.f[dirNW ])[knw ]; - f_TE = (D.f[dirTE ])[kte ]; - f_BW = (D.f[dirBW ])[kbw ]; - f_BE = (D.f[dirBE ])[kbe ]; - f_TW = (D.f[dirTW ])[ktw ]; - f_TN = (D.f[dirTN ])[ktn ]; - f_BS = (D.f[dirBS ])[kbs ]; - f_BN = (D.f[dirBN ])[kbn ]; - f_TS = (D.f[dirTS ])[kts ]; - f_TNE = (D.f[dirTNE ])[ktne ]; - f_TSW = (D.f[dirTSW ])[ktsw ]; - f_TSE = (D.f[dirTSE ])[ktse ]; - f_TNW = (D.f[dirTNW ])[ktnw ]; - f_BNE = (D.f[dirBNE ])[kbne ]; - f_BSW = (D.f[dirBSW ])[kbsw ]; - f_BSE = (D.f[dirBSE ])[kbse ]; - f_BNW = (D.f[dirBNW ])[kbnw ]; + f_E = (D.f[DIR_P00 ])[ke ]; + f_W = (D.f[DIR_M00 ])[kw ]; + f_N = (D.f[DIR_0P0 ])[kn ]; + f_S = (D.f[DIR_0M0 ])[ks ]; + f_T = (D.f[DIR_00P ])[kt ]; + f_B = (D.f[DIR_00M ])[kb ]; + f_NE = (D.f[DIR_PP0 ])[kne ]; + f_SW = (D.f[DIR_MM0 ])[ksw ]; + f_SE = (D.f[DIR_PM0 ])[kse ]; + f_NW = (D.f[DIR_MP0 ])[knw ]; + f_TE = (D.f[DIR_P0P ])[kte ]; + f_BW = (D.f[DIR_M0M ])[kbw ]; + f_BE = (D.f[DIR_P0M ])[kbe ]; + f_TW = (D.f[DIR_M0P ])[ktw ]; + f_TN = (D.f[DIR_0PP ])[ktn ]; + f_BS = (D.f[DIR_0MM ])[kbs ]; + f_BN = (D.f[DIR_0PM ])[kbn ]; + f_TS = (D.f[DIR_0MP ])[kts ]; + f_TNE = (D.f[DIR_PPP ])[ktne ]; + f_TSW = (D.f[DIR_MMP ])[ktsw ]; + f_TSE = (D.f[DIR_PMP ])[ktse ]; + f_TNW = (D.f[DIR_MPP ])[ktnw ]; + f_BNE = (D.f[DIR_PPM ])[kbne ]; + f_BSW = (D.f[DIR_MMM ])[kbsw ]; + f_BSE = (D.f[DIR_PMM ])[kbse ]; + f_BNW = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -761,69 +758,69 @@ extern "C" __global__ void QDeviceIncompHighNu27(int inx, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3);// * (one + drho); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *numberOfLBnodes]; + D.f[DIR_M00 ] = &DD[DIR_M00 *numberOfLBnodes]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *numberOfLBnodes]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *numberOfLBnodes]; + D.f[DIR_00P ] = &DD[DIR_00P *numberOfLBnodes]; + D.f[DIR_00M ] = &DD[DIR_00M *numberOfLBnodes]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *numberOfLBnodes]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *numberOfLBnodes]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *numberOfLBnodes]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *numberOfLBnodes]; + D.f[DIR_P0P ] = &DD[DIR_P0P *numberOfLBnodes]; + D.f[DIR_M0M ] = &DD[DIR_M0M *numberOfLBnodes]; + D.f[DIR_P0M ] = &DD[DIR_P0M *numberOfLBnodes]; + D.f[DIR_M0P ] = &DD[DIR_M0P *numberOfLBnodes]; + D.f[DIR_0PP ] = &DD[DIR_0PP *numberOfLBnodes]; + D.f[DIR_0MM ] = &DD[DIR_0MM *numberOfLBnodes]; + D.f[DIR_0PM ] = &DD[DIR_0PM *numberOfLBnodes]; + D.f[DIR_0MP ] = &DD[DIR_0MP *numberOfLBnodes]; + D.f[DIR_000] = &DD[DIR_000*numberOfLBnodes]; + D.f[DIR_PPP ] = &DD[DIR_PPP *numberOfLBnodes]; + D.f[DIR_MMP ] = &DD[DIR_MMP *numberOfLBnodes]; + D.f[DIR_PMP ] = &DD[DIR_PMP *numberOfLBnodes]; + D.f[DIR_MPP ] = &DD[DIR_MPP *numberOfLBnodes]; + D.f[DIR_PPM ] = &DD[DIR_PPM *numberOfLBnodes]; + D.f[DIR_MMM ] = &DD[DIR_MMM *numberOfLBnodes]; + D.f[DIR_PMM ] = &DD[DIR_PMM *numberOfLBnodes]; + D.f[DIR_MPM ] = &DD[DIR_MPM *numberOfLBnodes]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *numberOfLBnodes]; + D.f[DIR_P00 ] = &DD[DIR_M00 *numberOfLBnodes]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *numberOfLBnodes]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *numberOfLBnodes]; + D.f[DIR_00M ] = &DD[DIR_00P *numberOfLBnodes]; + D.f[DIR_00P ] = &DD[DIR_00M *numberOfLBnodes]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *numberOfLBnodes]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *numberOfLBnodes]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *numberOfLBnodes]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *numberOfLBnodes]; + D.f[DIR_M0M ] = &DD[DIR_P0P *numberOfLBnodes]; + D.f[DIR_P0P ] = &DD[DIR_M0M *numberOfLBnodes]; + D.f[DIR_M0P ] = &DD[DIR_P0M *numberOfLBnodes]; + D.f[DIR_P0M ] = &DD[DIR_M0P *numberOfLBnodes]; + D.f[DIR_0MM ] = &DD[DIR_0PP *numberOfLBnodes]; + D.f[DIR_0PP ] = &DD[DIR_0MM *numberOfLBnodes]; + D.f[DIR_0MP ] = &DD[DIR_0PM *numberOfLBnodes]; + D.f[DIR_0PM ] = &DD[DIR_0MP *numberOfLBnodes]; + D.f[DIR_000] = &DD[DIR_000*numberOfLBnodes]; + D.f[DIR_PPP ] = &DD[DIR_MMM *numberOfLBnodes]; + D.f[DIR_MMP ] = &DD[DIR_PPM *numberOfLBnodes]; + D.f[DIR_PMP ] = &DD[DIR_MPM *numberOfLBnodes]; + D.f[DIR_MPP ] = &DD[DIR_PMM *numberOfLBnodes]; + D.f[DIR_PPM ] = &DD[DIR_MMP *numberOfLBnodes]; + D.f[DIR_MMM ] = &DD[DIR_PPP *numberOfLBnodes]; + D.f[DIR_PMM ] = &DD[DIR_MPP *numberOfLBnodes]; + D.f[DIR_MPM ] = &DD[DIR_PMP *numberOfLBnodes]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Test - //(D.f[dirZERO])[k]=c1o10; + //(D.f[DIR_000])[k]=c1o10; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real VeloX = c0o1; real VeloY = c0o1; @@ -837,182 +834,182 @@ extern "C" __global__ void QDeviceIncompHighNu27(int inx, if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) /** (one + drho)*/-cu_sq); - (D.f[dirW])[kw]=((c1o1 - q) * f_E + q * ((f_E + f_W) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloX )) / (q + c1o1) ; + (D.f[DIR_M00])[kw]=((c1o1 - q) * f_E + q * ((f_E + f_W) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloX )) / (q + c1o1) ; } q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) /** (one + drho)*/-cu_sq); - (D.f[dirE])[ke]=((c1o1 - q) * f_W + q * ((f_W + f_E) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloX )) / (q + c1o1) ; + (D.f[DIR_P00])[ke]=((c1o1 - q) * f_W + q * ((f_W + f_E) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloX )) / (q + c1o1) ; } q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirS])[ks]=((c1o1 - q) * f_N + q * ((f_N + f_S) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloY )) / (q + c1o1) ; + (D.f[DIR_0M0])[ks]=((c1o1 - q) * f_N + q * ((f_N + f_S) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloY )) / (q + c1o1) ; } q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirN])[kn]=((c1o1 - q) * f_S + q * ((f_S + f_N) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloY )) / (q + c1o1) ; + (D.f[DIR_0P0])[kn]=((c1o1 - q) * f_S + q * ((f_S + f_N) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloY )) / (q + c1o1) ; } q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) /** (one + drho)*/-cu_sq); - (D.f[dirB])[kb]=((c1o1 - q) * f_T + q * ((f_T + f_B) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloZ )) / (q + c1o1) ; + (D.f[DIR_00M])[kb]=((c1o1 - q) * f_T + q * ((f_T + f_B) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloZ )) / (q + c1o1) ; } q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) /** (one + drho)*/-cu_sq); - (D.f[dirT])[kt]=((c1o1 - q) * f_B + q * ((f_B + f_T) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloZ )) / (q + c1o1) ; + (D.f[DIR_00P])[kt]=((c1o1 - q) * f_B + q * ((f_B + f_T) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloZ )) / (q + c1o1) ; } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirSW])[ksw]=((c1o1 - q) * f_NE + q * ((f_NE + f_SW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloY)) / (q + c1o1) ; + (D.f[DIR_MM0])[ksw]=((c1o1 - q) * f_NE + q * ((f_NE + f_SW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloY)) / (q + c1o1) ; } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirNE])[kne]=((c1o1 - q) * f_SW + q * ((f_SW + f_NE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloY)) / (q + c1o1) ; + (D.f[DIR_PP0])[kne]=((c1o1 - q) * f_SW + q * ((f_SW + f_NE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloY)) / (q + c1o1) ; } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirNW])[knw]=((c1o1 - q) * f_SE + q * ((f_SE + f_NW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloY)) / (q + c1o1) ; + (D.f[DIR_MP0])[knw]=((c1o1 - q) * f_SE + q * ((f_SE + f_NW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloY)) / (q + c1o1) ; } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirSE])[kse]=((c1o1 - q) * f_NW + q * ((f_NW + f_SE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloY)) / (q + c1o1) ; + (D.f[DIR_PM0])[kse]=((c1o1 - q) * f_NW + q * ((f_NW + f_SE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloY)) / (q + c1o1) ; } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBW])[kbw]=((c1o1 - q) * f_TE + q * ((f_TE + f_BW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloZ)) / (q + c1o1) ; + (D.f[DIR_M0M])[kbw]=((c1o1 - q) * f_TE + q * ((f_TE + f_BW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloZ)) / (q + c1o1) ; } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTE])[kte]=((c1o1 - q) * f_BW + q * ((f_BW + f_TE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloZ)) / (q + c1o1) ; + (D.f[DIR_P0P])[kte]=((c1o1 - q) * f_BW + q * ((f_BW + f_TE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloZ)) / (q + c1o1) ; } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTW])[ktw]=((c1o1 - q) * f_BE + q * ((f_BE + f_TW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloZ)) / (q + c1o1) ; + (D.f[DIR_M0P])[ktw]=((c1o1 - q) * f_BE + q * ((f_BE + f_TW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloZ)) / (q + c1o1) ; } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBE])[kbe]=((c1o1 - q) * f_TW + q * ((f_TW + f_BE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloZ)) / (q + c1o1) ; + (D.f[DIR_P0M])[kbe]=((c1o1 - q) * f_TW + q * ((f_TW + f_BE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloZ)) / (q + c1o1) ; } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBS])[kbs]=((c1o1 - q) * f_TN + q * ((f_TN + f_BS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_0MM])[kbs]=((c1o1 - q) * f_TN + q * ((f_TN + f_BS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY+VeloZ)) / (q + c1o1) ; } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTN])[ktn]=((c1o1 - q) * f_BS + q * ((f_BS + f_TN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_0PP])[ktn]=((c1o1 - q) * f_BS + q * ((f_BS + f_TN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTS])[kts]=((c1o1 - q) * f_BN + q * ((f_BN + f_TS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_0MP])[kts]=((c1o1 - q) * f_BN + q * ((f_BN + f_TS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBN])[kbn]=((c1o1 - q) * f_TS + q * ((f_TS + f_BN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_0PM])[kbn]=((c1o1 - q) * f_TS + q * ((f_TS + f_BN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY+VeloZ)) / (q + c1o1) ; } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBSW])[kbsw]=((c1o1 - q) * f_TNE + q * ((f_TNE + f_BSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_MMM])[kbsw]=((c1o1 - q) * f_TNE + q * ((f_TNE + f_BSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY+VeloZ)) / (q + c1o1) ; } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTNE])[ktne]=((c1o1 - q) * f_BSW + q * ((f_BSW + f_TNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_PPP])[ktne]=((c1o1 - q) * f_BSW + q * ((f_BSW + f_TNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTSW])[ktsw]=((c1o1 - q) * f_BNE + q * ((f_BNE + f_TSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_MMP])[ktsw]=((c1o1 - q) * f_BNE + q * ((f_BNE + f_TSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBNE])[kbne]=((c1o1 - q) * f_TSW + q * ((f_TSW + f_BNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_PPM])[kbne]=((c1o1 - q) * f_TSW + q * ((f_TSW + f_BNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY+VeloZ)) / (q + c1o1) ; } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBNW])[kbnw]=((c1o1 - q) * f_TSE + q * ((f_TSE + f_BNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_MPM])[kbnw]=((c1o1 - q) * f_TSE + q * ((f_TSE + f_BNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY+VeloZ)) / (q + c1o1) ; } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTSE])[ktse]=((c1o1 - q) * f_BNW + q * ((f_BNW + f_TSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_PMP])[ktse]=((c1o1 - q) * f_BNW + q * ((f_BNW + f_TSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTNW])[ktnw]=((c1o1 - q) * f_BSE + q * ((f_BSE + f_TNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_MPP])[ktnw]=((c1o1 - q) * f_BSE + q * ((f_BSE + f_TNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBSE])[kbse]=((c1o1 - q) * f_TNW + q * ((f_TNW + f_BSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_PMM])[kbse]=((c1o1 - q) * f_TNW + q * ((f_TNW + f_BSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY+VeloZ)) / (q + c1o1) ; } } } @@ -1057,80 +1054,78 @@ extern "C" __global__ void QDeviceIncompHighNu27(int inx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QDeviceCompHighNu27( int inx, - int iny, +__global__ void QDeviceCompHighNu27( real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1143,7 +1138,7 @@ extern "C" __global__ void QDeviceCompHighNu27( int inx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, @@ -1151,52 +1146,52 @@ extern "C" __global__ void QDeviceCompHighNu27( int inx, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; + unsigned int numberOfNodesK = k_Q[k]; + unsigned int kzero= numberOfNodesK; + unsigned int ke = numberOfNodesK; + unsigned int kw = neighborX[numberOfNodesK]; + unsigned int kn = numberOfNodesK; + unsigned int ks = neighborY[numberOfNodesK]; + unsigned int kt = numberOfNodesK; + unsigned int kb = neighborZ[numberOfNodesK]; unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; + unsigned int kne = numberOfNodesK; unsigned int kse = ks; unsigned int knw = kw; unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; + unsigned int kte = numberOfNodesK; unsigned int kbe = kb; unsigned int ktw = kw; unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; + unsigned int ktn = numberOfNodesK; unsigned int kbn = kb; unsigned int kts = ks; unsigned int ktse = ks; @@ -1205,69 +1200,69 @@ extern "C" __global__ void QDeviceCompHighNu27( int inx, unsigned int kbse = kbs; unsigned int ktsw = ksw; unsigned int kbne = kb; - unsigned int ktne = KQK; + unsigned int ktne = numberOfNodesK; unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_E = (D.f[dirE ])[ke ]; - f_W = (D.f[dirW ])[kw ]; - f_N = (D.f[dirN ])[kn ]; - f_S = (D.f[dirS ])[ks ]; - f_T = (D.f[dirT ])[kt ]; - f_B = (D.f[dirB ])[kb ]; - f_NE = (D.f[dirNE ])[kne ]; - f_SW = (D.f[dirSW ])[ksw ]; - f_SE = (D.f[dirSE ])[kse ]; - f_NW = (D.f[dirNW ])[knw ]; - f_TE = (D.f[dirTE ])[kte ]; - f_BW = (D.f[dirBW ])[kbw ]; - f_BE = (D.f[dirBE ])[kbe ]; - f_TW = (D.f[dirTW ])[ktw ]; - f_TN = (D.f[dirTN ])[ktn ]; - f_BS = (D.f[dirBS ])[kbs ]; - f_BN = (D.f[dirBN ])[kbn ]; - f_TS = (D.f[dirTS ])[kts ]; - f_TNE = (D.f[dirTNE ])[ktne ]; - f_TSW = (D.f[dirTSW ])[ktsw ]; - f_TSE = (D.f[dirTSE ])[ktse ]; - f_TNW = (D.f[dirTNW ])[ktnw ]; - f_BNE = (D.f[dirBNE ])[kbne ]; - f_BSW = (D.f[dirBSW ])[kbsw ]; - f_BSE = (D.f[dirBSE ])[kbse ]; - f_BNW = (D.f[dirBNW ])[kbnw ]; - //f_W = (D.f[dirE ])[ke ]; - //f_E = (D.f[dirW ])[kw ]; - //f_S = (D.f[dirN ])[kn ]; - //f_N = (D.f[dirS ])[ks ]; - //f_B = (D.f[dirT ])[kt ]; - //f_T = (D.f[dirB ])[kb ]; - //f_SW = (D.f[dirNE ])[kne ]; - //f_NE = (D.f[dirSW ])[ksw ]; - //f_NW = (D.f[dirSE ])[kse ]; - //f_SE = (D.f[dirNW ])[knw ]; - //f_BW = (D.f[dirTE ])[kte ]; - //f_TE = (D.f[dirBW ])[kbw ]; - //f_TW = (D.f[dirBE ])[kbe ]; - //f_BE = (D.f[dirTW ])[ktw ]; - //f_BS = (D.f[dirTN ])[ktn ]; - //f_TN = (D.f[dirBS ])[kbs ]; - //f_TS = (D.f[dirBN ])[kbn ]; - //f_BN = (D.f[dirTS ])[kts ]; - //f_BSW = (D.f[dirTNE ])[ktne ]; - //f_BNE = (D.f[dirTSW ])[ktsw ]; - //f_BNW = (D.f[dirTSE ])[ktse ]; - //f_BSE = (D.f[dirTNW ])[ktnw ]; - //f_TSW = (D.f[dirBNE ])[kbne ]; - //f_TNE = (D.f[dirBSW ])[kbsw ]; - //f_TNW = (D.f[dirBSE ])[kbse ]; - //f_TSE = (D.f[dirBNW ])[kbnw ]; + f_E = (D.f[DIR_P00 ])[ke ]; + f_W = (D.f[DIR_M00 ])[kw ]; + f_N = (D.f[DIR_0P0 ])[kn ]; + f_S = (D.f[DIR_0M0 ])[ks ]; + f_T = (D.f[DIR_00P ])[kt ]; + f_B = (D.f[DIR_00M ])[kb ]; + f_NE = (D.f[DIR_PP0 ])[kne ]; + f_SW = (D.f[DIR_MM0 ])[ksw ]; + f_SE = (D.f[DIR_PM0 ])[kse ]; + f_NW = (D.f[DIR_MP0 ])[knw ]; + f_TE = (D.f[DIR_P0P ])[kte ]; + f_BW = (D.f[DIR_M0M ])[kbw ]; + f_BE = (D.f[DIR_P0M ])[kbe ]; + f_TW = (D.f[DIR_M0P ])[ktw ]; + f_TN = (D.f[DIR_0PP ])[ktn ]; + f_BS = (D.f[DIR_0MM ])[kbs ]; + f_BN = (D.f[DIR_0PM ])[kbn ]; + f_TS = (D.f[DIR_0MP ])[kts ]; + f_TNE = (D.f[DIR_PPP ])[ktne ]; + f_TSW = (D.f[DIR_MMP ])[ktsw ]; + f_TSE = (D.f[DIR_PMP ])[ktse ]; + f_TNW = (D.f[DIR_MPP ])[ktnw ]; + f_BNE = (D.f[DIR_PPM ])[kbne ]; + f_BSW = (D.f[DIR_MMM ])[kbsw ]; + f_BSE = (D.f[DIR_PMM ])[kbse ]; + f_BNW = (D.f[DIR_MPM ])[kbnw ]; + //f_W = (D.f[DIR_P00 ])[ke ]; + //f_E = (D.f[DIR_M00 ])[kw ]; + //f_S = (D.f[DIR_0P0 ])[kn ]; + //f_N = (D.f[DIR_0M0 ])[ks ]; + //f_B = (D.f[DIR_00P ])[kt ]; + //f_T = (D.f[DIR_00M ])[kb ]; + //f_SW = (D.f[DIR_PP0 ])[kne ]; + //f_NE = (D.f[DIR_MM0 ])[ksw ]; + //f_NW = (D.f[DIR_PM0 ])[kse ]; + //f_SE = (D.f[DIR_MP0 ])[knw ]; + //f_BW = (D.f[DIR_P0P ])[kte ]; + //f_TE = (D.f[DIR_M0M ])[kbw ]; + //f_TW = (D.f[DIR_P0M ])[kbe ]; + //f_BE = (D.f[DIR_M0P ])[ktw ]; + //f_BS = (D.f[DIR_0PP ])[ktn ]; + //f_TN = (D.f[DIR_0MM ])[kbs ]; + //f_TS = (D.f[DIR_0PM ])[kbn ]; + //f_BN = (D.f[DIR_0MP ])[kts ]; + //f_BSW = (D.f[DIR_PPP ])[ktne ]; + //f_BNE = (D.f[DIR_MMP ])[ktsw ]; + //f_BNW = (D.f[DIR_PMP ])[ktse ]; + //f_BSE = (D.f[DIR_MPP ])[ktnw ]; + //f_TSW = (D.f[DIR_PPM ])[kbne ]; + //f_TNE = (D.f[DIR_MMM ])[kbsw ]; + //f_TNW = (D.f[DIR_PMM ])[kbse ]; + //f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -1285,69 +1280,69 @@ extern "C" __global__ void QDeviceCompHighNu27( int inx, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Test - //(D.f[dirZERO])[k]=c1o10; + //(D.f[DIR_000])[k]=c1o10; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real VeloX = c0o1; real VeloY = c0o1; @@ -1361,234 +1356,234 @@ extern "C" __global__ void QDeviceCompHighNu27( int inx, if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw]=((c1o1 - q) * f_E + q * ((f_E + f_W) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloX )) / (q + c1o1) ; - //(D.f[dirW])[kw]=(one-q)/(one+q)*(f_E-f_W+(f_E+f_W-two*feq*om1)/(one-om1))*c1o2+(q*(f_E+f_W)-six*c2over27*( VeloX ))/(one+q) - c2over27 * drho; - //(D.f[dirW])[kw]=zero; + (D.f[DIR_M00])[kw]=((c1o1 - q) * f_E + q * ((f_E + f_W) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloX )) / (q + c1o1) ; + //(D.f[DIR_M00])[kw]=(one-q)/(one+q)*(f_E-f_W+(f_E+f_W-two*feq*om1)/(one-om1))*c1o2+(q*(f_E+f_W)-six*c2over27*( VeloX ))/(one+q) - c2over27 * drho; + //(D.f[DIR_M00])[kw]=zero; } q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirE])[ke]=((c1o1 - q) * f_W + q * ((f_W + f_E) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloX )) / (q + c1o1) ; - //(D.f[dirE])[ke]=(one-q)/(one+q)*(f_W-f_E+(f_W+f_E-two*feq*om1)/(one-om1))*c1o2+(q*(f_W+f_E)-six*c2over27*(-VeloX ))/(one+q) - c2over27 * drho; - //(D.f[dirE])[ke]=zero; + (D.f[DIR_P00])[ke]=((c1o1 - q) * f_W + q * ((f_W + f_E) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloX )) / (q + c1o1) ; + //(D.f[DIR_P00])[ke]=(one-q)/(one+q)*(f_W-f_E+(f_W+f_E-two*feq*om1)/(one-om1))*c1o2+(q*(f_W+f_E)-six*c2over27*(-VeloX ))/(one+q) - c2over27 * drho; + //(D.f[DIR_P00])[ke]=zero; } q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirS])[ks]=((c1o1 - q) * f_N + q * ((f_N + f_S) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloY )) / (q + c1o1) ; - //(D.f[dirS])[ks]=(one-q)/(one+q)*(f_N-f_S+(f_N+f_S-two*feq*om1)/(one-om1))*c1o2+(q*(f_N+f_S)-six*c2over27*( VeloY ))/(one+q) - c2over27 * drho; - //(D.f[dirS])[ks]=zero; + (D.f[DIR_0M0])[ks]=((c1o1 - q) * f_N + q * ((f_N + f_S) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloY )) / (q + c1o1) ; + //(D.f[DIR_0M0])[ks]=(one-q)/(one+q)*(f_N-f_S+(f_N+f_S-two*feq*om1)/(one-om1))*c1o2+(q*(f_N+f_S)-six*c2over27*( VeloY ))/(one+q) - c2over27 * drho; + //(D.f[DIR_0M0])[ks]=zero; } q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirN])[kn]=((c1o1 - q) * f_S + q * ((f_S + f_N) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloY )) / (q + c1o1) ; - //(D.f[dirN])[kn]=(one-q)/(one+q)*(f_S-f_N+(f_S+f_N-two*feq*om1)/(one-om1))*c1o2+(q*(f_S+f_N)-six*c2over27*(-VeloY ))/(one+q) - c2over27 * drho; - //(D.f[dirN])[kn]=zero; + (D.f[DIR_0P0])[kn]=((c1o1 - q) * f_S + q * ((f_S + f_N) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloY )) / (q + c1o1) ; + //(D.f[DIR_0P0])[kn]=(one-q)/(one+q)*(f_S-f_N+(f_S+f_N-two*feq*om1)/(one-om1))*c1o2+(q*(f_S+f_N)-six*c2over27*(-VeloY ))/(one+q) - c2over27 * drho; + //(D.f[DIR_0P0])[kn]=zero; } q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirB])[kb]=((c1o1 - q) * f_T + q * ((f_T + f_B) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloZ )) / (q + c1o1) ; - //(D.f[dirB])[kb]=(one-q)/(one+q)*(f_T-f_B+(f_T+f_B-two*feq*om1)/(one-om1))*c1o2+(q*(f_T+f_B)-six*c2over27*( VeloZ ))/(one+q) - c2over27 * drho; - //(D.f[dirB])[kb]=one; + (D.f[DIR_00M])[kb]=((c1o1 - q) * f_T + q * ((f_T + f_B) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloZ )) / (q + c1o1) ; + //(D.f[DIR_00M])[kb]=(one-q)/(one+q)*(f_T-f_B+(f_T+f_B-two*feq*om1)/(one-om1))*c1o2+(q*(f_T+f_B)-six*c2over27*( VeloZ ))/(one+q) - c2over27 * drho; + //(D.f[DIR_00M])[kb]=one; } q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirT])[kt]=((c1o1 - q) * f_B + q * ((f_B + f_T) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloZ )) / (q + c1o1) ; - //(D.f[dirT])[kt]=(one-q)/(one+q)*(f_B-f_T+(f_B+f_T-two*feq*om1)/(one-om1))*c1o2+(q*(f_B+f_T)-six*c2over27*(-VeloZ ))/(one+q) - c2over27 * drho; - //(D.f[dirT])[kt]=zero; + (D.f[DIR_00P])[kt]=((c1o1 - q) * f_B + q * ((f_B + f_T) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloZ )) / (q + c1o1) ; + //(D.f[DIR_00P])[kt]=(one-q)/(one+q)*(f_B-f_T+(f_B+f_T-two*feq*om1)/(one-om1))*c1o2+(q*(f_B+f_T)-six*c2over27*(-VeloZ ))/(one+q) - c2over27 * drho; + //(D.f[DIR_00P])[kt]=zero; } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]=((c1o1 - q) * f_NE + q * ((f_NE + f_SW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloY)) / (q + c1o1) ; - //(D.f[dirSW])[ksw]=(one-q)/(one+q)*(f_NE-f_SW+(f_NE+f_SW-two*feq*om1)/(one-om1))*c1o2+(q*(f_NE+f_SW)-six*c1over54*(VeloX+VeloY))/(one+q) - c1over54 * drho; - //(D.f[dirSW])[ksw]=zero; + (D.f[DIR_MM0])[ksw]=((c1o1 - q) * f_NE + q * ((f_NE + f_SW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloY)) / (q + c1o1) ; + //(D.f[DIR_MM0])[ksw]=(one-q)/(one+q)*(f_NE-f_SW+(f_NE+f_SW-two*feq*om1)/(one-om1))*c1o2+(q*(f_NE+f_SW)-six*c1over54*(VeloX+VeloY))/(one+q) - c1over54 * drho; + //(D.f[DIR_MM0])[ksw]=zero; } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]=((c1o1 - q) * f_SW + q * ((f_SW + f_NE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloY)) / (q + c1o1) ; - //(D.f[dirNE])[kne]=(one-q)/(one+q)*(f_SW-f_NE+(f_SW+f_NE-two*feq*om1)/(one-om1))*c1o2+(q*(f_SW+f_NE)-six*c1over54*(-VeloX-VeloY))/(one+q) - c1over54 * drho; - //(D.f[dirNE])[kne]=zero; + (D.f[DIR_PP0])[kne]=((c1o1 - q) * f_SW + q * ((f_SW + f_NE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloY)) / (q + c1o1) ; + //(D.f[DIR_PP0])[kne]=(one-q)/(one+q)*(f_SW-f_NE+(f_SW+f_NE-two*feq*om1)/(one-om1))*c1o2+(q*(f_SW+f_NE)-six*c1over54*(-VeloX-VeloY))/(one+q) - c1over54 * drho; + //(D.f[DIR_PP0])[kne]=zero; } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]=((c1o1 - q) * f_SE + q * ((f_SE + f_NW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloY)) / (q + c1o1) ; - //(D.f[dirNW])[knw]=(one-q)/(one+q)*(f_SE-f_NW+(f_SE+f_NW-two*feq*om1)/(one-om1))*c1o2+(q*(f_SE+f_NW)-six*c1over54*( VeloX-VeloY))/(one+q) - c1over54 * drho; - //(D.f[dirNW])[knw]=zero; + (D.f[DIR_MP0])[knw]=((c1o1 - q) * f_SE + q * ((f_SE + f_NW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloY)) / (q + c1o1) ; + //(D.f[DIR_MP0])[knw]=(one-q)/(one+q)*(f_SE-f_NW+(f_SE+f_NW-two*feq*om1)/(one-om1))*c1o2+(q*(f_SE+f_NW)-six*c1over54*( VeloX-VeloY))/(one+q) - c1over54 * drho; + //(D.f[DIR_MP0])[knw]=zero; } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]=((c1o1 - q) * f_NW + q * ((f_NW + f_SE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloY)) / (q + c1o1) ; - //(D.f[dirSE])[kse]=(one-q)/(one+q)*(f_NW-f_SE+(f_NW+f_SE-two*feq*om1)/(one-om1))*c1o2+(q*(f_NW+f_SE)-six*c1over54*(-VeloX+VeloY))/(one+q) - c1over54 * drho; - //(D.f[dirSE])[kse]=zero; + (D.f[DIR_PM0])[kse]=((c1o1 - q) * f_NW + q * ((f_NW + f_SE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloY)) / (q + c1o1) ; + //(D.f[DIR_PM0])[kse]=(one-q)/(one+q)*(f_NW-f_SE+(f_NW+f_SE-two*feq*om1)/(one-om1))*c1o2+(q*(f_NW+f_SE)-six*c1over54*(-VeloX+VeloY))/(one+q) - c1over54 * drho; + //(D.f[DIR_PM0])[kse]=zero; } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]=((c1o1 - q) * f_TE + q * ((f_TE + f_BW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloZ)) / (q + c1o1) ; - //(D.f[dirBW])[kbw]=(one-q)/(one+q)*(f_TE-f_BW+(f_TE+f_BW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TE+f_BW)-six*c1over54*( VeloX+VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirBW])[kbw]=zero; + (D.f[DIR_M0M])[kbw]=((c1o1 - q) * f_TE + q * ((f_TE + f_BW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_M0M])[kbw]=(one-q)/(one+q)*(f_TE-f_BW+(f_TE+f_BW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TE+f_BW)-six*c1over54*( VeloX+VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_M0M])[kbw]=zero; } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]=((c1o1 - q) * f_BW + q * ((f_BW + f_TE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloZ)) / (q + c1o1) ; - //(D.f[dirTE])[kte]=(one-q)/(one+q)*(f_BW-f_TE+(f_BW+f_TE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BW+f_TE)-six*c1over54*(-VeloX-VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirTE])[kte]=zero; + (D.f[DIR_P0P])[kte]=((c1o1 - q) * f_BW + q * ((f_BW + f_TE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_P0P])[kte]=(one-q)/(one+q)*(f_BW-f_TE+(f_BW+f_TE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BW+f_TE)-six*c1over54*(-VeloX-VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_P0P])[kte]=zero; } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]=((c1o1 - q) * f_BE + q * ((f_BE + f_TW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloZ)) / (q + c1o1) ; - //(D.f[dirTW])[ktw]=(one-q)/(one+q)*(f_BE-f_TW+(f_BE+f_TW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BE+f_TW)-six*c1over54*( VeloX-VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirTW])[ktw]=zero; + (D.f[DIR_M0P])[ktw]=((c1o1 - q) * f_BE + q * ((f_BE + f_TW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_M0P])[ktw]=(one-q)/(one+q)*(f_BE-f_TW+(f_BE+f_TW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BE+f_TW)-six*c1over54*( VeloX-VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_M0P])[ktw]=zero; } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]=((c1o1 - q) * f_TW + q * ((f_TW + f_BE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloZ)) / (q + c1o1) ; - //(D.f[dirBE])[kbe]=(one-q)/(one+q)*(f_TW-f_BE+(f_TW+f_BE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TW+f_BE)-six*c1over54*(-VeloX+VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirBE])[kbe]=zero; + (D.f[DIR_P0M])[kbe]=((c1o1 - q) * f_TW + q * ((f_TW + f_BE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_P0M])[kbe]=(one-q)/(one+q)*(f_TW-f_BE+(f_TW+f_BE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TW+f_BE)-six*c1over54*(-VeloX+VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_P0M])[kbe]=zero; } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]=((c1o1 - q) * f_TN + q * ((f_TN + f_BS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBS])[kbs]=(one-q)/(one+q)*(f_TN-f_BS+(f_TN+f_BS-two*feq*om1)/(one-om1))*c1o2+(q*(f_TN+f_BS)-six*c1over54*( VeloY+VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirBS])[kbs]=zero; + (D.f[DIR_0MM])[kbs]=((c1o1 - q) * f_TN + q * ((f_TN + f_BS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_0MM])[kbs]=(one-q)/(one+q)*(f_TN-f_BS+(f_TN+f_BS-two*feq*om1)/(one-om1))*c1o2+(q*(f_TN+f_BS)-six*c1over54*( VeloY+VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_0MM])[kbs]=zero; } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]=((c1o1 - q) * f_BS + q * ((f_BS + f_TN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTN])[ktn]=(one-q)/(one+q)*(f_BS-f_TN+(f_BS+f_TN-two*feq*om1)/(one-om1))*c1o2+(q*(f_BS+f_TN)-six*c1over54*( -VeloY-VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirTN])[ktn]=zero; + (D.f[DIR_0PP])[ktn]=((c1o1 - q) * f_BS + q * ((f_BS + f_TN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_0PP])[ktn]=(one-q)/(one+q)*(f_BS-f_TN+(f_BS+f_TN-two*feq*om1)/(one-om1))*c1o2+(q*(f_BS+f_TN)-six*c1over54*( -VeloY-VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_0PP])[ktn]=zero; } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]=((c1o1 - q) * f_BN + q * ((f_BN + f_TS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTS])[kts]=(one-q)/(one+q)*(f_BN-f_TS+(f_BN+f_TS-two*feq*om1)/(one-om1))*c1o2+(q*(f_BN+f_TS)-six*c1over54*( VeloY-VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirTS])[kts]=zero; + (D.f[DIR_0MP])[kts]=((c1o1 - q) * f_BN + q * ((f_BN + f_TS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_0MP])[kts]=(one-q)/(one+q)*(f_BN-f_TS+(f_BN+f_TS-two*feq*om1)/(one-om1))*c1o2+(q*(f_BN+f_TS)-six*c1over54*( VeloY-VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_0MP])[kts]=zero; } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]=((c1o1 - q) * f_TS + q * ((f_TS + f_BN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBN])[kbn]=(one-q)/(one+q)*(f_TS-f_BN+(f_TS+f_BN-two*feq*om1)/(one-om1))*c1o2+(q*(f_TS+f_BN)-six*c1over54*( -VeloY+VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirBN])[kbn]=zero; + (D.f[DIR_0PM])[kbn]=((c1o1 - q) * f_TS + q * ((f_TS + f_BN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_0PM])[kbn]=(one-q)/(one+q)*(f_TS-f_BN+(f_TS+f_BN-two*feq*om1)/(one-om1))*c1o2+(q*(f_TS+f_BN)-six*c1over54*( -VeloY+VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_0PM])[kbn]=zero; } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]=((c1o1 - q) * f_TNE + q * ((f_TNE + f_BSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBSW])[kbsw]=(one-q)/(one+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNE+f_BSW)-six*c1over216*( VeloX+VeloY+VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirBSW])[kbsw]=zero; + (D.f[DIR_MMM])[kbsw]=((c1o1 - q) * f_TNE + q * ((f_TNE + f_BSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_MMM])[kbsw]=(one-q)/(one+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNE+f_BSW)-six*c1over216*( VeloX+VeloY+VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_MMM])[kbsw]=zero; } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]=((c1o1 - q) * f_BSW + q * ((f_BSW + f_TNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTNE])[ktne]=(one-q)/(one+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSW+f_TNE)-six*c1over216*(-VeloX-VeloY-VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirTNE])[ktne]=zero; + (D.f[DIR_PPP])[ktne]=((c1o1 - q) * f_BSW + q * ((f_BSW + f_TNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_PPP])[ktne]=(one-q)/(one+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSW+f_TNE)-six*c1over216*(-VeloX-VeloY-VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_PPP])[ktne]=zero; } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]=((c1o1 - q) * f_BNE + q * ((f_BNE + f_TSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTSW])[ktsw]=(one-q)/(one+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNE+f_TSW)-six*c1over216*( VeloX+VeloY-VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirTSW])[ktsw]=zero; + (D.f[DIR_MMP])[ktsw]=((c1o1 - q) * f_BNE + q * ((f_BNE + f_TSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_MMP])[ktsw]=(one-q)/(one+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNE+f_TSW)-six*c1over216*( VeloX+VeloY-VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_MMP])[ktsw]=zero; } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]=((c1o1 - q) * f_TSW + q * ((f_TSW + f_BNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBNE])[kbne]=(one-q)/(one+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSW+f_BNE)-six*c1over216*(-VeloX-VeloY+VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirBNE])[kbne]=zero; + (D.f[DIR_PPM])[kbne]=((c1o1 - q) * f_TSW + q * ((f_TSW + f_BNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_PPM])[kbne]=(one-q)/(one+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSW+f_BNE)-six*c1over216*(-VeloX-VeloY+VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_PPM])[kbne]=zero; } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]=((c1o1 - q) * f_TSE + q * ((f_TSE + f_BNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBNW])[kbnw]=(one-q)/(one+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSE+f_BNW)-six*c1over216*( VeloX-VeloY+VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirBNW])[kbnw]=zero; + (D.f[DIR_MPM])[kbnw]=((c1o1 - q) * f_TSE + q * ((f_TSE + f_BNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_MPM])[kbnw]=(one-q)/(one+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSE+f_BNW)-six*c1over216*( VeloX-VeloY+VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_MPM])[kbnw]=zero; } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]=((c1o1 - q) * f_BNW + q * ((f_BNW + f_TSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTSE])[ktse]=(one-q)/(one+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNW+f_TSE)-six*c1over216*(-VeloX+VeloY-VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirTSE])[ktse]=zero; + (D.f[DIR_PMP])[ktse]=((c1o1 - q) * f_BNW + q * ((f_BNW + f_TSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_PMP])[ktse]=(one-q)/(one+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNW+f_TSE)-six*c1over216*(-VeloX+VeloY-VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_PMP])[ktse]=zero; } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]=((c1o1 - q) * f_BSE + q * ((f_BSE + f_TNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTNW])[ktnw]=(one-q)/(one+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSE+f_TNW)-six*c1over216*( VeloX-VeloY-VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirTNW])[ktnw]=zero; + (D.f[DIR_MPP])[ktnw]=((c1o1 - q) * f_BSE + q * ((f_BSE + f_TNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_MPP])[ktnw]=(one-q)/(one+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSE+f_TNW)-six*c1over216*( VeloX-VeloY-VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_MPP])[ktnw]=zero; } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]=((c1o1 - q) * f_TNW + q * ((f_TNW + f_BSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBSE])[kbse]=(one-q)/(one+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNW+f_BSE)-six*c1over216*(-VeloX+VeloY+VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirBSE])[kbse]=zero; + (D.f[DIR_PMM])[kbse]=((c1o1 - q) * f_TNW + q * ((f_TNW + f_BSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_PMM])[kbse]=(one-q)/(one+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNW+f_BSE)-six*c1over216*(-VeloX+VeloY+VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_PMM])[kbse]=zero; } } } @@ -1633,146 +1628,69 @@ extern "C" __global__ void QDeviceCompHighNu27( int inx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QDeviceComp27(int inx, - int iny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, +__global__ void QDeviceComp27( + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int numberOfLBnodes, + bool isEvenTimestep) { - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } + ////////////////////////////////////////////////////////////////////////// + //! The no-slip boundary condition is executed in the following steps + //! //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index const unsigned nx = blockDim.x; const unsigned ny = gridDim.x; const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k < numberOfBCnodes) { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep); + //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + //! - Set local subgrid distances (q's) + //! + SubgridDistances27 subgridD; + getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes); + //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; + //! - Set neighbor indices (necessary for indirect addressing) + //! + unsigned int indexOfBCnode = subgridDistanceIndices[k]; + unsigned int kzero= indexOfBCnode; + unsigned int ke = indexOfBCnode; + unsigned int kw = neighborX[indexOfBCnode]; + unsigned int kn = indexOfBCnode; + unsigned int ks = neighborY[indexOfBCnode]; + unsigned int kt = indexOfBCnode; + unsigned int kb = neighborZ[indexOfBCnode]; unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; + unsigned int kne = indexOfBCnode; unsigned int kse = ks; unsigned int knw = kw; unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; + unsigned int kte = indexOfBCnode; unsigned int kbe = kb; unsigned int ktw = kw; unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; + unsigned int ktn = indexOfBCnode; unsigned int kbn = kb; unsigned int kts = ks; unsigned int ktse = ks; @@ -1781,334 +1699,274 @@ extern "C" __global__ void QDeviceComp27(int inx, unsigned int kbse = kbs; unsigned int ktsw = ksw; unsigned int kbne = kb; - unsigned int ktne = KQK; + unsigned int ktne = indexOfBCnode; unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// - real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, - f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; + //! - Set local distributions + //! + real f_W = (dist.f[DIR_P00 ])[ke ]; + real f_E = (dist.f[DIR_M00 ])[kw ]; + real f_S = (dist.f[DIR_0P0 ])[kn ]; + real f_N = (dist.f[DIR_0M0 ])[ks ]; + real f_B = (dist.f[DIR_00P ])[kt ]; + real f_T = (dist.f[DIR_00M ])[kb ]; + real f_SW = (dist.f[DIR_PP0 ])[kne ]; + real f_NE = (dist.f[DIR_MM0 ])[ksw ]; + real f_NW = (dist.f[DIR_PM0 ])[kse ]; + real f_SE = (dist.f[DIR_MP0 ])[knw ]; + real f_BW = (dist.f[DIR_P0P ])[kte ]; + real f_TE = (dist.f[DIR_M0M ])[kbw ]; + real f_TW = (dist.f[DIR_P0M ])[kbe ]; + real f_BE = (dist.f[DIR_M0P ])[ktw ]; + real f_BS = (dist.f[DIR_0PP ])[ktn ]; + real f_TN = (dist.f[DIR_0MM ])[kbs ]; + real f_TS = (dist.f[DIR_0PM ])[kbn ]; + real f_BN = (dist.f[DIR_0MP ])[kts ]; + real f_BSW = (dist.f[DIR_PPP ])[ktne ]; + real f_BNE = (dist.f[DIR_MMP ])[ktsw ]; + real f_BNW = (dist.f[DIR_PMP ])[ktse ]; + real f_BSE = (dist.f[DIR_MPP ])[ktnw ]; + real f_TSW = (dist.f[DIR_PPM ])[kbne ]; + real f_TNE = (dist.f[DIR_MMM ])[kbsw ]; + real f_TNW = (dist.f[DIR_PMM ])[kbse ]; + real f_TSE = (dist.f[DIR_MPM ])[kbnw ]; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// - real vx1, vx2, vx3, drho, feq, q; - drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + //! - Calculate macroscopic quantities + //! + real drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((dist.f[DIR_000])[kzero]); - vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - (f_E - f_W)) / (c1o1 + drho); + real vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) / (c1o1 + drho); + real vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) / (c1o1 + drho); - vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - (f_N - f_S)) / (c1o1 + drho); + real vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) / (c1o1 + drho); - vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - (f_T - f_B)) / (c1o1 + drho); + real cu_sq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3) * (c1o1 + drho); - real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); + //////////////////////////////////////////////////////////////////////////////// + //! - change the pointer to write the results in the correct array + //! + getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep); - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - //ToDo anders klammern !!!!!! - - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) + //////////////////////////////////////////////////////////////////////////////// + //! - Update distributions with subgrid distance (q) between zero and one + real feq, q, velocityLB; + q = (subgridD.q[DIR_P00])[k]; + if (q>=c0o1 && q<=c1o1) // only update distribution for q between zero and one { - feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W))/(c1o1+q); - //(D.f[dirW])[kw]=zero; + velocityLB = vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_M00])[kw] = getInterpolatedDistributionForNoSlipBC(q, f_E, f_W, feq, omega); } - q = q_dirW[k]; + q = (subgridD.q[DIR_M00])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E))/(c1o1+q); - //(D.f[dirE])[ke]=zero; + velocityLB = -vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_P00])[ke] = getInterpolatedDistributionForNoSlipBC(q, f_W, f_E, feq, omega); } - q = q_dirN[k]; + q = (subgridD.q[DIR_0P0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S))/(c1o1+q); - //(D.f[dirS])[ks]=zero; + velocityLB = vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_0M0])[ks] = getInterpolatedDistributionForNoSlipBC(q, f_N, f_S, feq, omega); } - q = q_dirS[k]; + q = (subgridD.q[DIR_0M0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N))/(c1o1+q); - //(D.f[dirN])[kn]=zero; + velocityLB = -vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_0P0])[kn] = getInterpolatedDistributionForNoSlipBC(q, f_S, f_N, feq, omega); } - q = q_dirT[k]; + q = (subgridD.q[DIR_00P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B))/(c1o1+q); - //(D.f[dirB])[kb]=one; + velocityLB = vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_00M])[kb] = getInterpolatedDistributionForNoSlipBC(q, f_T, f_B, feq, omega); } - q = q_dirB[k]; + q = (subgridD.q[DIR_00M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T))/(c1o1+q); - //(D.f[dirT])[kt]=zero; + velocityLB = -vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_00P])[kt] = getInterpolatedDistributionForNoSlipBC(q, f_B, f_T, feq, omega); } - q = q_dirNE[k]; + q = (subgridD.q[DIR_PP0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW))/(c1o1+q); - //(D.f[dirSW])[ksw]=zero; + velocityLB = vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_MM0])[ksw] = getInterpolatedDistributionForNoSlipBC(q, f_NE, f_SW, feq, omega); } - q = q_dirSW[k]; + q = (subgridD.q[DIR_MM0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE))/(c1o1+q); - //(D.f[dirNE])[kne]=zero; + velocityLB = -vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_PP0])[kne] = getInterpolatedDistributionForNoSlipBC(q, f_SW, f_NE, feq, omega); } - q = q_dirSE[k]; + q = (subgridD.q[DIR_PM0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW))/(c1o1+q); - //(D.f[dirNW])[knw]=zero; + velocityLB = vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_MP0])[knw] = getInterpolatedDistributionForNoSlipBC(q, f_SE, f_NW, feq, omega); } - q = q_dirNW[k]; + q = (subgridD.q[DIR_MP0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE))/(c1o1+q); - //(D.f[dirSE])[kse]=zero; + velocityLB = -vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_PM0])[kse] = getInterpolatedDistributionForNoSlipBC(q, f_NW, f_SE, feq, omega); } - q = q_dirTE[k]; + q = (subgridD.q[DIR_P0P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW))/(c1o1+q); - //(D.f[dirBW])[kbw]=zero; + velocityLB = vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_M0M])[kbw] = getInterpolatedDistributionForNoSlipBC(q, f_TE, f_BW, feq, omega); } - q = q_dirBW[k]; + q = (subgridD.q[DIR_M0M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE))/(c1o1+q); - //(D.f[dirTE])[kte]=zero; + velocityLB = -vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_P0P])[kte] = getInterpolatedDistributionForNoSlipBC(q, f_BW, f_TE, feq, omega); } - q = q_dirBE[k]; + q = (subgridD.q[DIR_P0M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW))/(c1o1+q); - //(D.f[dirTW])[ktw]=zero; + velocityLB = vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_M0P])[ktw] = getInterpolatedDistributionForNoSlipBC(q, f_BE, f_TW, feq, omega); } - q = q_dirTW[k]; + q = (subgridD.q[DIR_M0P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE))/(c1o1+q); - //(D.f[dirBE])[kbe]=zero; + velocityLB = -vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_P0M])[kbe] = getInterpolatedDistributionForNoSlipBC(q, f_TW, f_BE, feq, omega); } - q = q_dirTN[k]; + q = (subgridD.q[DIR_0PP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS))/(c1o1+q); - //(D.f[dirBS])[kbs]=zero; + velocityLB = vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_0MM])[kbs] = getInterpolatedDistributionForNoSlipBC(q, f_TN, f_BS, feq, omega); } - q = q_dirBS[k]; + q = (subgridD.q[DIR_0MM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN))/(c1o1+q); - //(D.f[dirTN])[ktn]=zero; + velocityLB = -vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_0PP])[ktn] = getInterpolatedDistributionForNoSlipBC(q, f_BS, f_TN, feq, omega); } - q = q_dirBN[k]; + q = (subgridD.q[DIR_0PM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS))/(c1o1+q); - //(D.f[dirTS])[kts]=zero; + velocityLB = vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_0MP])[kts] = getInterpolatedDistributionForNoSlipBC(q, f_BN, f_TS, feq, omega); } - q = q_dirTS[k]; + q = (subgridD.q[DIR_0MP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN))/(c1o1+q); - //(D.f[dirBN])[kbn]=zero; + velocityLB = -vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_0PM])[kbn] = getInterpolatedDistributionForNoSlipBC(q, f_TS, f_BN, feq, omega); } - q = q_dirTNE[k]; + q = (subgridD.q[DIR_PPP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW))/(c1o1+q); - //(D.f[dirBSW])[kbsw]=zero; + velocityLB = vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_MMM])[kbsw] = getInterpolatedDistributionForNoSlipBC(q, f_TNE, f_BSW, feq, omega); } - q = q_dirBSW[k]; + q = (subgridD.q[DIR_MMM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE))/(c1o1+q); - //(D.f[dirTNE])[ktne]=zero; + velocityLB = -vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_PPP])[ktne] = getInterpolatedDistributionForNoSlipBC(q, f_BSW, f_TNE, feq, omega); } - q = q_dirBNE[k]; + q = (subgridD.q[DIR_PPM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW))/(c1o1+q); - //(D.f[dirTSW])[ktsw]=zero; + velocityLB = vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_MMP])[ktsw] = getInterpolatedDistributionForNoSlipBC(q, f_BNE, f_TSW, feq, omega); } - q = q_dirTSW[k]; + q = (subgridD.q[DIR_MMP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE))/(c1o1+q); - //(D.f[dirBNE])[kbne]=zero; + velocityLB = -vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_PPM])[kbne] = getInterpolatedDistributionForNoSlipBC(q, f_TSW, f_BNE, feq, omega); } - q = q_dirTSE[k]; + q = (subgridD.q[DIR_PMP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW))/(c1o1+q); - //(D.f[dirBNW])[kbnw]=zero; + velocityLB = vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_MPM])[kbnw] = getInterpolatedDistributionForNoSlipBC(q, f_TSE, f_BNW, feq, omega); } - q = q_dirBNW[k]; + q = (subgridD.q[DIR_MPM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE))/(c1o1+q); - //(D.f[dirTSE])[ktse]=zero; + velocityLB = -vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_PMP])[ktse] = getInterpolatedDistributionForNoSlipBC(q, f_BNW, f_TSE, feq, omega); } - q = q_dirBSE[k]; + q = (subgridD.q[DIR_PMM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW))/(c1o1+q); - //(D.f[dirTNW])[ktnw]=zero; + velocityLB = vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_MPP])[ktnw] = getInterpolatedDistributionForNoSlipBC(q, f_BSE, f_TNW, feq, omega); } - q = q_dirTNW[k]; + q = (subgridD.q[DIR_MPP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE))/(c1o1+q); - //(D.f[dirBSE])[kbse]=zero; + velocityLB = -vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_PMM])[kbse] = getInterpolatedDistributionForNoSlipBC(q, f_TNW, f_BSE, feq, omega); } } } @@ -2153,146 +2011,72 @@ extern "C" __global__ void QDeviceComp27(int inx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QDevice27(int inx, - int iny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, +__global__ void QDevice27(real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int numberOfLBnodes, + bool isEvenTimestep) { - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } + ////////////////////////////////////////////////////////////////////////// + //! The no-slip boundary condition is executed in the following steps + //! //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index const unsigned nx = blockDim.x; const unsigned ny = gridDim.x; const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + ////////////////////////////////////////////////////////////////////////// + //! - Run for all indices in size of boundary condition (numberOfBCnodes) + //! + if(k < numberOfBCnodes) { + + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep); + //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + //! - Set local subgrid distances (q's) + //! + SubgridDistances27 subgridD; + getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes); + //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; + //! - Set neighbor indices (necessary for indirect addressing) + //! + unsigned int indexOfBCnode = subgridDistanceIndices[k]; + unsigned int kzero= indexOfBCnode; + unsigned int ke = indexOfBCnode; + unsigned int kw = neighborX[indexOfBCnode]; + unsigned int kn = indexOfBCnode; + unsigned int ks = neighborY[indexOfBCnode]; + unsigned int kt = indexOfBCnode; + unsigned int kb = neighborZ[indexOfBCnode]; unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; + unsigned int kne = indexOfBCnode; unsigned int kse = ks; unsigned int knw = kw; unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; + unsigned int kte = indexOfBCnode; unsigned int kbe = kb; unsigned int ktw = kw; unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; + unsigned int ktn = indexOfBCnode; unsigned int kbn = kb; unsigned int kts = ks; unsigned int ktse = ks; @@ -2301,751 +2085,276 @@ extern "C" __global__ void QDevice27(int inx, unsigned int kbse = kbs; unsigned int ktsw = ksw; unsigned int kbne = kb; - unsigned int ktne = KQK; + unsigned int ktne = indexOfBCnode; unsigned int kbsw = neighborZ[ksw]; - //unsigned int nxny = nx*ny; - //unsigned int kzero= KQK; - //unsigned int ke = KQK; - //unsigned int kw = KQK + 1; - //unsigned int kn = KQK; - //unsigned int ks = KQK + nx; - //unsigned int kt = KQK; - //unsigned int kb = KQK + nxny; - //unsigned int ksw = KQK + nx + 1; - //unsigned int kne = KQK; - //unsigned int kse = KQK + nx; - //unsigned int knw = KQK + 1; - //unsigned int kbw = KQK + nxny + 1; - //unsigned int kte = KQK; - //unsigned int kbe = KQK + nxny; - //unsigned int ktw = KQK + 1; - //unsigned int kbs = KQK + nxny + nx; - //unsigned int ktn = KQK; - //unsigned int kbn = KQK + nxny; - //unsigned int kts = KQK + nx; - //unsigned int ktse = KQK + nx; - //unsigned int kbnw = KQK + nxny + 1; - //unsigned int ktnw = KQK + 1; - //unsigned int kbse = KQK + nxny + nx; - //unsigned int ktsw = KQK + nx + 1; - //unsigned int kbne = KQK + nxny; - //unsigned int ktne = KQK; - //unsigned int kbsw = KQK + nxny + nx + 1; - //////////////////////////////////////////////////////////////////////////////// - //real vx1, vx2, vx3, drho, feq, q; - //drho = (D.f[dirE ])[ke ]+ (D.f[dirW ])[kw ]+ - // (D.f[dirN ])[kn ]+ (D.f[dirS ])[ks ]+ - // (D.f[dirT ])[kt ]+ (D.f[dirB ])[kb ]+ - // (D.f[dirNE ])[kne ]+ (D.f[dirSW ])[ksw ]+ - // (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - // (D.f[dirTE ])[kte ]+ (D.f[dirBW ])[kbw ]+ - // (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - // (D.f[dirTN ])[ktn ]+ (D.f[dirBS ])[kbs ]+ - // (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ]+ - // (D.f[dirZERO])[kzero]+ - // (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - // (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - // (D.f[dirBNE ])[kbne]+ (D.f[dirBSW ])[kbsw]+ - // (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw]; - - //vx1 = (D.f[dirE ])[ke ]- (D.f[dirW ])[kw ]+ - // (D.f[dirNE ])[kne ]- (D.f[dirSW ])[ksw ]+ - // (D.f[dirSE ])[kse ]- (D.f[dirNW ])[knw ]+ - // (D.f[dirTE ])[kte ]- (D.f[dirBW ])[kbw ]+ - // (D.f[dirBE ])[kbe ]- (D.f[dirTW ])[ktw ]+ - // (D.f[dirTNE ])[ktne]- (D.f[dirTSW ])[ktsw]+ - // (D.f[dirTSE ])[ktse]- (D.f[dirTNW ])[ktnw]+ - // (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]+ - // (D.f[dirBSE ])[kbse]- (D.f[dirBNW ])[kbnw]; - - //vx2 = (D.f[dirN ])[kn ]- (D.f[dirS ])[ks ]+ - // (D.f[dirNE ])[kne ]- (D.f[dirSW ])[ksw ]- - // (D.f[dirSE ])[kse ]+ (D.f[dirNW ])[knw ]+ - // (D.f[dirTN ])[ktn ]- (D.f[dirBS ])[kbs ]+ - // (D.f[dirBN ])[kbn ]- (D.f[dirTS ])[kts ]+ - // (D.f[dirTNE ])[ktne]- (D.f[dirTSW ])[ktsw]- - // (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]+ - // (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]- - // (D.f[dirBSE ])[kbse]+ (D.f[dirBNW ])[kbnw]; - - //vx3 = (D.f[dirT ])[kt ]- (D.f[dirB ])[kb ]+ - // (D.f[dirTE ])[kte ]- (D.f[dirBW ])[kbw ]- - // (D.f[dirBE ])[kbe ]+ (D.f[dirTW ])[ktw ]+ - // (D.f[dirTN ])[ktn ]- (D.f[dirBS ])[kbs ]- - // (D.f[dirBN ])[kbn ]+ (D.f[dirTS ])[kts ]+ - // (D.f[dirTNE ])[ktne]+ (D.f[dirTSW ])[ktsw]+ - // (D.f[dirTSE ])[ktse]+ (D.f[dirTNW ])[ktnw]- - // (D.f[dirBNE ])[kbne]- (D.f[dirBSW ])[kbsw]- - // (D.f[dirBSE ])[kbse]- (D.f[dirBNW ])[kbnw]; - - //real cu_sq=1.5f*(vx1*vx1+vx2*vx2+vx3*vx3); + //////////////////////////////////////////////////////////////////////////////// - real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, - f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; + //! - Set local distributions + //! + real f_W = (dist.f[DIR_P00 ])[ke ]; + real f_E = (dist.f[DIR_M00 ])[kw ]; + real f_S = (dist.f[DIR_0P0 ])[kn ]; + real f_N = (dist.f[DIR_0M0 ])[ks ]; + real f_B = (dist.f[DIR_00P ])[kt ]; + real f_T = (dist.f[DIR_00M ])[kb ]; + real f_SW = (dist.f[DIR_PP0 ])[kne ]; + real f_NE = (dist.f[DIR_MM0 ])[ksw ]; + real f_NW = (dist.f[DIR_PM0 ])[kse ]; + real f_SE = (dist.f[DIR_MP0 ])[knw ]; + real f_BW = (dist.f[DIR_P0P ])[kte ]; + real f_TE = (dist.f[DIR_M0M ])[kbw ]; + real f_TW = (dist.f[DIR_P0M ])[kbe ]; + real f_BE = (dist.f[DIR_M0P ])[ktw ]; + real f_BS = (dist.f[DIR_0PP ])[ktn ]; + real f_TN = (dist.f[DIR_0MM ])[kbs ]; + real f_TS = (dist.f[DIR_0PM ])[kbn ]; + real f_BN = (dist.f[DIR_0MP ])[kts ]; + real f_BSW = (dist.f[DIR_PPP ])[ktne ]; + real f_BNE = (dist.f[DIR_MMP ])[ktsw ]; + real f_BNW = (dist.f[DIR_PMP ])[ktse ]; + real f_BSE = (dist.f[DIR_MPP ])[ktnw ]; + real f_TSW = (dist.f[DIR_PPM ])[kbne ]; + real f_TNE = (dist.f[DIR_MMM ])[kbsw ]; + real f_TNW = (dist.f[DIR_PMM ])[kbse ]; + real f_TSE = (dist.f[DIR_MPM ])[kbnw ]; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// - real vx1, vx2, vx3, drho, feq, q; - drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + //! - Calculate macroscopic quantities + //! + real drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((dist.f[DIR_000])[kzero]); - vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - (f_E - f_W); + real vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)); + real vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)); - vx2 = (-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - (f_N - f_S); + real vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)); - vx3 = ((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - (f_T - f_B); - - real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - - //b�ser lecktest - //q = q_dirE[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirW])[kw]=999.f; - // } - - // q = q_dirW[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirE])[ke]=999.f; - // } - - // q = q_dirN[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirS])[ks]=999.f; - // } - - // q = q_dirS[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirN])[kn]=999.f; - // } - - // q = q_dirT[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirB])[kb]=999.f; - // } - - // q = q_dirB[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirT])[kt]=999.f; - // } - - // q = q_dirNE[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirSW])[ksw]=999.f; - // } - - // q = q_dirSW[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirNE])[kne]=999.f; - // } - - // q = q_dirSE[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirNW])[knw]=999.f; - // } - - // q = q_dirNW[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirSE])[kse]=999.f; - // } - - // q = q_dirTE[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirBW])[kbw]=999.f; - // } - - // q = q_dirBW[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirTE])[kte]=999.f; - // } - - // q = q_dirBE[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirTW])[ktw]=999.f; - // } - - // q = q_dirTW[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirBE])[kbe]=999.f; - // } - - // q = q_dirTN[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirBS])[kbs]=999.f; - // } - - // q = q_dirBS[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirTN])[ktn]=999.f; - // } - - // q = q_dirBN[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirTS])[kts]=999.f; - // } - - // q = q_dirTS[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirBN])[kbn]=999.f; - // } - - // q = q_dirTNE[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirBSW])[kbsw]=999.f; - // } - - // q = q_dirBSW[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirTNE])[ktne]=999.f; - // } - - // q = q_dirBNE[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirTSW])[ktsw]=999.f; - // } - - // q = q_dirTSW[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirBNE])[kbne]=999.f; - // } - - // q = q_dirTSE[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirBNW])[kbnw]=999.f; - // } - - // q = q_dirBNW[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirTSE])[ktse]=999.f; - // } - - // q = q_dirBSE[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirTNW])[ktnw]=999.f; - // } - - // q = q_dirTNW[k]; - // if (q>=zero && q<=one) - // { - // (D.f[dirBSE])[kbse]=999.f; - // } + real cu_sq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3); - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - //ToDo anders klammern !!!!!! - - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) + //////////////////////////////////////////////////////////////////////////////// + //! - change the pointer to write the results in the correct array + //! + getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - Update distributions with subgrid distance (q) between zero and one + //! + real feq, q, velocityLB; + q = (subgridD.q[DIR_P00])[k]; + if (q>=c0o1 && q<=c1o1) // only update distribution for q between zero and one { - feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 )-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W))/(c1o1+q); - //(D.f[dirW])[kw]=zero; + velocityLB = vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_M00])[kw] = getInterpolatedDistributionForNoSlipBC(q, f_E, f_W, feq, omega); } - q = q_dirW[k]; + q = (subgridD.q[DIR_M00])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 )-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E))/(c1o1+q); - //(D.f[dirE])[ke]=zero; + velocityLB = -vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_P00])[ke] = getInterpolatedDistributionForNoSlipBC(q, f_W, f_E, feq, omega); } - q = q_dirN[k]; + q = (subgridD.q[DIR_0P0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 )-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S))/(c1o1+q); - //(D.f[dirS])[ks]=zero; + velocityLB = vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_0M0])[ks] = getInterpolatedDistributionForNoSlipBC(q, f_N, f_S, feq, omega); } - q = q_dirS[k]; + q = (subgridD.q[DIR_0M0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 )-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N))/(c1o1+q); - //(D.f[dirN])[kn]=zero; + velocityLB = -vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_0P0])[kn] = getInterpolatedDistributionForNoSlipBC(q, f_S, f_N, feq, omega); } - q = q_dirT[k]; + q = (subgridD.q[DIR_00P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B))/(c1o1+q); - //(D.f[dirB])[kb]=one; + velocityLB = vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_00M])[kb] = getInterpolatedDistributionForNoSlipBC(q, f_T, f_B, feq, omega); } - q = q_dirB[k]; + q = (subgridD.q[DIR_00M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T))/(c1o1+q); - //(D.f[dirT])[kt]=zero; + velocityLB = -vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + (dist.f[DIR_00P])[kt] = getInterpolatedDistributionForNoSlipBC(q, f_B, f_T, feq, omega); } - q = q_dirNE[k]; + q = (subgridD.q[DIR_PP0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW))/(c1o1+q); - //(D.f[dirSW])[ksw]=zero; + velocityLB = vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_MM0])[ksw] = getInterpolatedDistributionForNoSlipBC(q, f_NE, f_SW, feq, omega); } - q = q_dirSW[k]; + q = (subgridD.q[DIR_MM0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE))/(c1o1+q); - //(D.f[dirNE])[kne]=zero; + velocityLB = -vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_PP0])[kne] = getInterpolatedDistributionForNoSlipBC(q, f_SW, f_NE, feq, omega); } - q = q_dirSE[k]; + q = (subgridD.q[DIR_PM0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW))/(c1o1+q); - //(D.f[dirNW])[knw]=zero; + velocityLB = vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_MP0])[knw] = getInterpolatedDistributionForNoSlipBC(q, f_SE, f_NW, feq, omega); } - q = q_dirNW[k]; + q = (subgridD.q[DIR_MP0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE))/(c1o1+q); - //(D.f[dirSE])[kse]=zero; + velocityLB = -vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_PM0])[kse] = getInterpolatedDistributionForNoSlipBC(q, f_NW, f_SE, feq, omega); } - q = q_dirTE[k]; + q = (subgridD.q[DIR_P0P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW))/(c1o1+q); - //(D.f[dirBW])[kbw]=zero; + velocityLB = vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_M0M])[kbw] = getInterpolatedDistributionForNoSlipBC(q, f_TE, f_BW, feq, omega); } - q = q_dirBW[k]; + q = (subgridD.q[DIR_M0M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE))/(c1o1+q); - //(D.f[dirTE])[kte]=zero; + velocityLB = -vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_P0P])[kte] = getInterpolatedDistributionForNoSlipBC(q, f_BW, f_TE, feq, omega); } - q = q_dirBE[k]; + q = (subgridD.q[DIR_P0M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW))/(c1o1+q); - //(D.f[dirTW])[ktw]=zero; + velocityLB = vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_M0P])[ktw] = getInterpolatedDistributionForNoSlipBC(q, f_BE, f_TW, feq, omega); } - q = q_dirTW[k]; + q = (subgridD.q[DIR_M0P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE))/(c1o1+q); - //(D.f[dirBE])[kbe]=zero; + velocityLB = -vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_P0M])[kbe] = getInterpolatedDistributionForNoSlipBC(q, f_TW, f_BE, feq, omega); } - q = q_dirTN[k]; + q = (subgridD.q[DIR_0PP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS))/(c1o1+q); - //(D.f[dirBS])[kbs]=zero; + velocityLB = vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_0MM])[kbs] = getInterpolatedDistributionForNoSlipBC(q, f_TN, f_BS, feq, omega); } - q = q_dirBS[k]; + q = (subgridD.q[DIR_0MM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN))/(c1o1+q); - //(D.f[dirTN])[ktn]=zero; + velocityLB = -vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_0PP])[ktn] = getInterpolatedDistributionForNoSlipBC(q, f_BS, f_TN, feq, omega); } - q = q_dirBN[k]; + q = (subgridD.q[DIR_0PM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS))/(c1o1+q); - //(D.f[dirTS])[kts]=zero; + velocityLB = vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_0MP])[kts] = getInterpolatedDistributionForNoSlipBC(q, f_BN, f_TS, feq, omega); } - q = q_dirTS[k]; + q = (subgridD.q[DIR_0MP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN))/(c1o1+q); - //(D.f[dirBN])[kbn]=zero; + velocityLB = -vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + (dist.f[DIR_0PM])[kbn] = getInterpolatedDistributionForNoSlipBC(q, f_TS, f_BN, feq, omega); } - q = q_dirTNE[k]; + q = (subgridD.q[DIR_PPP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW))/(c1o1+q); - //(D.f[dirBSW])[kbsw]=zero; + velocityLB = vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_MMM])[kbsw] = getInterpolatedDistributionForNoSlipBC(q, f_TNE, f_BSW, feq, omega); } - q = q_dirBSW[k]; + q = (subgridD.q[DIR_MMM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE))/(c1o1+q); - //(D.f[dirTNE])[ktne]=zero; + velocityLB = -vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_PPP])[ktne] = getInterpolatedDistributionForNoSlipBC(q, f_BSW, f_TNE, feq, omega); } - q = q_dirBNE[k]; + q = (subgridD.q[DIR_PPM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW))/(c1o1+q); - //(D.f[dirTSW])[ktsw]=zero; + velocityLB = vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_MMP])[ktsw] = getInterpolatedDistributionForNoSlipBC(q, f_BNE, f_TSW, feq, omega); } - q = q_dirTSW[k]; + q = (subgridD.q[DIR_MMP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE))/(c1o1+q); - //(D.f[dirBNE])[kbne]=zero; + velocityLB = -vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_PPM])[kbne] = getInterpolatedDistributionForNoSlipBC(q, f_TSW, f_BNE, feq, omega); } - q = q_dirTSE[k]; + q = (subgridD.q[DIR_PMP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW))/(c1o1+q); - //(D.f[dirBNW])[kbnw]=zero; + velocityLB = vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_MPM])[kbnw] = getInterpolatedDistributionForNoSlipBC(q, f_TSE, f_BNW, feq, omega); } - q = q_dirBNW[k]; + q = (subgridD.q[DIR_MPM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE))/(c1o1+q); - //(D.f[dirTSE])[ktse]=zero; + velocityLB = -vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_PMP])[ktse] = getInterpolatedDistributionForNoSlipBC(q, f_BNW, f_TSE, feq, omega); } - q = q_dirBSE[k]; + q = (subgridD.q[DIR_PMM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW))/(c1o1+q); - //(D.f[dirTNW])[ktnw]=zero; + velocityLB = vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_MPP])[ktnw] = getInterpolatedDistributionForNoSlipBC(q, f_BSE, f_TNW, feq, omega); } - q = q_dirTNW[k]; + q = (subgridD.q[DIR_MPP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE))/(c1o1+q); - //(D.f[dirBSE])[kbse]=zero; - } - - // q = q_dirE[k]; - // if (q>=zero && q<=one) - // { - // feq=c2over27* (drho+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq); - // (D.f[dirW])[kw]=(one-q)/(one+q)*(f_E-feq*om1)/(one-om1)+q/(one+q)*(f_E+f_W); - //// (D.f[dirW])[kw]=(one-q)/(one+q)*(f_E-f_W+(f_E+f_W-two*feq*om1)/(one-om1))*c1o2+(q*(f_E+f_W)-six*c2over27*( VeloX ))/(one+q); - // } - - // q = q_dirW[k]; - // if (q>=zero && q<=one) - // { - // feq=c2over27* (drho+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq); - // (D.f[dirE])[ke]=(one-q)/(one+q)*(f_W-feq*om1)/(one-om1)+q/(one+q)*(f_W+f_E); - // } - - // q = q_dirN[k]; - // if (q>=zero && q<=one) - // { - // feq=c2over27* (drho+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq); - // (D.f[dirS])[ks]=(one-q)/(one+q)*(f_N-feq*om1)/(one-om1)+q/(one+q)*(f_N+f_S); - // } - - // q = q_dirS[k]; - // if (q>=zero && q<=one) - // { - // feq=c2over27* (drho+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq); - // (D.f[dirN])[kn]=(one-q)/(one+q)*(f_S-feq*om1)/(one-om1)+q/(one+q)*(f_S+f_N); - // } - - // q = q_dirT[k]; - // if (q>=zero && q<=one) - // { - // feq=c2over27* (drho+three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq); - // (D.f[dirB])[kb]=(one-q)/(one+q)*(f_T-feq*om1)/(one-om1)+q/(one+q)*(f_T+f_B); - // } - - // q = q_dirB[k]; - // if (q>=zero && q<=one) - // { - // feq=c2over27* (drho+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq); - // (D.f[dirT])[kt]=(one-q)/(one+q)*(f_B-feq*om1)/(one-om1)+q/(one+q)*(f_B+f_T); - // } - - // q = q_dirNE[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - // (D.f[dirSW])[ksw]=(one-q)/(one+q)*(f_NE-feq*om1)/(one-om1)+q/(one+q)*(f_NE+f_SW); - // } - - // q = q_dirSW[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - // (D.f[dirNE])[kne]=(one-q)/(one+q)*(f_SW-feq*om1)/(one-om1)+q/(one+q)*(f_SW+f_NE); - // } - - // q = q_dirSE[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - // (D.f[dirNW])[knw]=(one-q)/(one+q)*(f_SE-feq*om1)/(one-om1)+q/(one+q)*(f_SE+f_NW); - // } - - // q = q_dirNW[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - // (D.f[dirSE])[kse]=(one-q)/(one+q)*(f_NW-feq*om1)/(one-om1)+q/(one+q)*(f_NW+f_SE); - // } - - // q = q_dirTE[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - // (D.f[dirBW])[kbw]=(one-q)/(one+q)*(f_TE-feq*om1)/(one-om1)+q/(one+q)*(f_TE+f_BW); - // } - - // q = q_dirBW[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - // (D.f[dirTE])[kte]=(one-q)/(one+q)*(f_BW-feq*om1)/(one-om1)+q/(one+q)*(f_BW+f_TE); - // } - - // q = q_dirBE[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - // (D.f[dirTW])[ktw]=(one-q)/(one+q)*(f_BE-feq*om1)/(one-om1)+q/(one+q)*(f_BE+f_TW); - // } - - // q = q_dirTW[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - // (D.f[dirBE])[kbe]=(one-q)/(one+q)*(f_TW-feq*om1)/(one-om1)+q/(one+q)*(f_TW+f_BE); - // } - - // q = q_dirTN[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq); - // (D.f[dirBS])[kbs]=(one-q)/(one+q)*(f_TN-feq*om1)/(one-om1)+q/(one+q)*(f_TN+f_BS); - // } - - // q = q_dirBS[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - // (D.f[dirTN])[ktn]=(one-q)/(one+q)*(f_BS-feq*om1)/(one-om1)+q/(one+q)*(f_BS+f_TN); - // } - - // q = q_dirBN[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq); - // (D.f[dirTS])[kts]=(one-q)/(one+q)*(f_BN-feq*om1)/(one-om1)+q/(one+q)*(f_BN+f_TS); - // } - - // q = q_dirTS[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over54* (drho+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - // (D.f[dirBN])[kbn]=(one-q)/(one+q)*(f_TS-feq*om1)/(one-om1)+q/(one+q)*(f_TS+f_BN); - // } - - // q = q_dirTNE[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over216*(drho+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - // (D.f[dirBSW])[kbsw]=(one-q)/(one+q)*(f_TNE-feq*om1)/(one-om1)+q/(one+q)*(f_TNE+f_BSW); - // } - - // q = q_dirBSW[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over216*(drho+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - // (D.f[dirTNE])[ktne]=(one-q)/(one+q)*(f_BSW-feq*om1)/(one-om1)+q/(one+q)*(f_BSW+f_TNE); - // } - - // q = q_dirBNE[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over216*(drho+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - // (D.f[dirTSW])[ktsw]=(one-q)/(one+q)*(f_BNE-feq*om1)/(one-om1)+q/(one+q)*(f_BNE+f_TSW); - // } - - // q = q_dirTSW[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over216*(drho+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - // (D.f[dirBNE])[kbne]=(one-q)/(one+q)*(f_TSW-feq*om1)/(one-om1)+q/(one+q)*(f_TSW+f_BNE); - // } - - // q = q_dirTSE[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over216*(drho+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - // (D.f[dirBNW])[kbnw]=(one-q)/(one+q)*(f_TSE-feq*om1)/(one-om1)+q/(one+q)*(f_TSE+f_BNW); - // } - - // q = q_dirBNW[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over216*(drho+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - // (D.f[dirTSE])[ktse]=(one-q)/(one+q)*(f_BNW-feq*om1)/(one-om1)+q/(one+q)*(f_BNW+f_TSE); - // } - - // q = q_dirBSE[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over216*(drho+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - // (D.f[dirTNW])[ktnw]=(one-q)/(one+q)*(f_BSE-feq*om1)/(one-om1)+q/(one+q)*(f_BSE+f_TNW); - // } - - // q = q_dirTNW[k]; - // if (q>=zero && q<=one) - // { - // feq=c1over216*(drho+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - // (D.f[dirBSE])[kbse]=(one-q)/(one+q)*(f_TNW-feq*om1)/(one-om1)+q/(one+q)*(f_TNW+f_BSE); - // } + velocityLB = -vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + (dist.f[DIR_PMM])[kbse] = getInterpolatedDistributionForNoSlipBC(q, f_TNW, f_BSE, feq, omega); + } } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -3089,146 +2398,68 @@ extern "C" __global__ void QDevice27(int inx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void BBDevice27(int inx, - int iny, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, +__global__ void BBDevice27(real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int numberOfLBnodes, + bool isEvenTimestep) { - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } + ////////////////////////////////////////////////////////////////////////// + //! The no-slip boundary condition is executed in the following steps + //! //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index const unsigned nx = blockDim.x; const unsigned ny = gridDim.x; const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + ////////////////////////////////////////////////////////////////////////// + // run for all indices in size of boundary condition (numberOfBCnodes) + if(k < numberOfBCnodes) { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep); + //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + //! - Set local subgrid distances (q's) + //! + SubgridDistances27 subgridD; + getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes); + //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - //unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; + //! - Set neighbor indices (necessary for indirect addressing) + //! + unsigned int indexOfBCnode = subgridDistanceIndices[k]; + unsigned int ke = indexOfBCnode; + unsigned int kw = neighborX[indexOfBCnode]; + unsigned int kn = indexOfBCnode; + unsigned int ks = neighborY[indexOfBCnode]; + unsigned int kt = indexOfBCnode; + unsigned int kb = neighborZ[indexOfBCnode]; unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; + unsigned int kne = indexOfBCnode; unsigned int kse = ks; unsigned int knw = kw; unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; + unsigned int kte = indexOfBCnode; unsigned int kbe = kb; unsigned int ktw = kw; unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; + unsigned int ktn = indexOfBCnode; unsigned int kbn = kb; unsigned int kts = ks; unsigned int ktse = ks; @@ -3237,290 +2468,73 @@ extern "C" __global__ void BBDevice27(int inx, unsigned int kbse = kbs; unsigned int ktsw = ksw; unsigned int kbne = kb; - unsigned int ktne = KQK; + unsigned int ktne = indexOfBCnode; unsigned int kbsw = neighborZ[ksw]; - //unsigned int nxny = nx*ny; - //unsigned int kzero= KQK; - //unsigned int ke = KQK; - //unsigned int kw = KQK + 1; - //unsigned int kn = KQK; - //unsigned int ks = KQK + nx; - //unsigned int kt = KQK; - //unsigned int kb = KQK + nxny; - //unsigned int ksw = KQK + nx + 1; - //unsigned int kne = KQK; - //unsigned int kse = KQK + nx; - //unsigned int knw = KQK + 1; - //unsigned int kbw = KQK + nxny + 1; - //unsigned int kte = KQK; - //unsigned int kbe = KQK + nxny; - //unsigned int ktw = KQK + 1; - //unsigned int kbs = KQK + nxny + nx; - //unsigned int ktn = KQK; - //unsigned int kbn = KQK + nxny; - //unsigned int kts = KQK + nx; - //unsigned int ktse = KQK + nx; - //unsigned int kbnw = KQK + nxny + 1; - //unsigned int ktnw = KQK + 1; - //unsigned int kbse = KQK + nxny + nx; - //unsigned int ktsw = KQK + nx + 1; - //unsigned int kbne = KQK + nxny; - //unsigned int ktne = KQK; - //unsigned int kbsw = KQK + nxny + nx + 1; + //////////////////////////////////////////////////////////////////////////////// - + //! - Set local distributions + //! + real f_W = (dist.f[DIR_P00 ])[ke ]; + real f_E = (dist.f[DIR_M00 ])[kw ]; + real f_S = (dist.f[DIR_0P0 ])[kn ]; + real f_N = (dist.f[DIR_0M0 ])[ks ]; + real f_B = (dist.f[DIR_00P ])[kt ]; + real f_T = (dist.f[DIR_00M ])[kb ]; + real f_SW = (dist.f[DIR_PP0 ])[kne ]; + real f_NE = (dist.f[DIR_MM0 ])[ksw ]; + real f_NW = (dist.f[DIR_PM0 ])[kse ]; + real f_SE = (dist.f[DIR_MP0 ])[knw ]; + real f_BW = (dist.f[DIR_P0P ])[kte ]; + real f_TE = (dist.f[DIR_M0M ])[kbw ]; + real f_TW = (dist.f[DIR_P0M ])[kbe ]; + real f_BE = (dist.f[DIR_M0P ])[ktw ]; + real f_BS = (dist.f[DIR_0PP ])[ktn ]; + real f_TN = (dist.f[DIR_0MM ])[kbs ]; + real f_TS = (dist.f[DIR_0PM ])[kbn ]; + real f_BN = (dist.f[DIR_0MP ])[kts ]; + real f_BSW = (dist.f[DIR_PPP ])[ktne ]; + real f_BNE = (dist.f[DIR_MMP ])[ktsw ]; + real f_BNW = (dist.f[DIR_PMP ])[ktse ]; + real f_BSE = (dist.f[DIR_MPP ])[ktnw ]; + real f_TSW = (dist.f[DIR_PPM ])[kbne ]; + real f_TNE = (dist.f[DIR_MMM ])[kbsw ]; + real f_TNW = (dist.f[DIR_PMM ])[kbse ]; + real f_TSE = (dist.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// - real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, - f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; + //! - change the pointer to write the results in the correct array + //! + getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep); - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //! - rewrite distributions if there is a sub-grid distance (q) in same direction real q; - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirW])[kw]=f_E; - } - - q = q_dirW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirE])[ke]=f_W; - } - - q = q_dirN[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirS])[ks]=f_N; - } - - q = q_dirS[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirN])[kn]=f_S; - } - - q = q_dirT[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirB])[kb]=f_T; - } - - q = q_dirB[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirT])[kt]=f_B; - } - - q = q_dirNE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirSW])[ksw]=f_NE; - } - - q = q_dirSW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirNE])[kne]=f_SW; - } - - q = q_dirSE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirNW])[knw]=f_SE; - } - - q = q_dirNW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirSE])[kse]=f_NW; - } - - q = q_dirTE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirBW])[kbw]=f_TE; - } - - q = q_dirBW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirTE])[kte]=f_BW; - } - - q = q_dirBE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirTW])[ktw]=f_BE; - } - - q = q_dirTW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirBE])[kbe]=f_TW; - } - - q = q_dirTN[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirBS])[kbs]=f_TN; - } - - q = q_dirBS[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirTN])[ktn]=f_BS; - } - - q = q_dirBN[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirTS])[kts]=f_BN; - } - - q = q_dirTS[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirBN])[kbn]=f_TS; - } - - q = q_dirTNE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirBSW])[kbsw]=f_TNE; - } - - q = q_dirBSW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirTNE])[ktne]=f_BSW; - } - - q = q_dirBNE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirTSW])[ktsw]=f_BNE; - } - - q = q_dirTSW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirBNE])[kbne]=f_TSW; - } - - q = q_dirTSE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirBNW])[kbnw]=f_TSE; - } - - q = q_dirBNW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirTSE])[ktse]=f_BNW; - } - - q = q_dirBSE[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirTNW])[ktnw]=f_BSE; - } - - q = q_dirTNW[k]; - if (q>=c0o1 && q<=c1o1) - { - (D.f[dirBSE])[kbse]=f_TNW; - } + q = (subgridD.q[DIR_P00 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_M00 ])[kw ]=f_E ; + q = (subgridD.q[DIR_M00 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_P00 ])[ke ]=f_W ; + q = (subgridD.q[DIR_0P0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0M0 ])[ks ]=f_N ; + q = (subgridD.q[DIR_0M0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0P0 ])[kn ]=f_S ; + q = (subgridD.q[DIR_00P ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_00M ])[kb ]=f_T ; + q = (subgridD.q[DIR_00M ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_00P ])[kt ]=f_B ; + q = (subgridD.q[DIR_PP0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MM0 ])[ksw ]=f_NE ; + q = (subgridD.q[DIR_MM0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PP0 ])[kne ]=f_SW ; + q = (subgridD.q[DIR_PM0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MP0 ])[knw ]=f_SE ; + q = (subgridD.q[DIR_MP0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PM0 ])[kse ]=f_NW ; + q = (subgridD.q[DIR_P0P ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_M0M ])[kbw ]=f_TE ; + q = (subgridD.q[DIR_M0M ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_P0P ])[kte ]=f_BW ; + q = (subgridD.q[DIR_P0M ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_M0P ])[ktw ]=f_BE ; + q = (subgridD.q[DIR_M0P ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_P0M ])[kbe ]=f_TW ; + q = (subgridD.q[DIR_0PP ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0MM ])[kbs ]=f_TN ; + q = (subgridD.q[DIR_0MM ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0PP ])[ktn ]=f_BS ; + q = (subgridD.q[DIR_0PM ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0MP ])[kts ]=f_BN ; + q = (subgridD.q[DIR_0MP ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0PM ])[kbn ]=f_TS ; + q = (subgridD.q[DIR_PPP])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MMM])[kbsw]=f_TNE; + q = (subgridD.q[DIR_MMM])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PPP])[ktne]=f_BSW; + q = (subgridD.q[DIR_PPM])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MMP])[ktsw]=f_BNE; + q = (subgridD.q[DIR_MMP])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PPM])[kbne]=f_TSW; + q = (subgridD.q[DIR_PMP])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MPM])[kbnw]=f_TSE; + q = (subgridD.q[DIR_MPM])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PMP])[ktse]=f_BNW; + q = (subgridD.q[DIR_PMM])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MPP])[ktnw]=f_BSE; + q = (subgridD.q[DIR_MPP])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PMM])[kbse]=f_TNW; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/GPU/Particles.cu b/src/gpu/VirtualFluids_GPU/GPU/Particles.cu index a286434d805c0b60de2b36b61e5ebe65c7a45d11..3a3ab784e6a7901c41d402629172c3c6154ffde9 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/Particles.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/Particles.cu @@ -1,13 +1,13 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; - +using namespace vf::lbm::dir; ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void InitParticles( real* coordX, +__global__ void InitParticles( real* coordX, real* coordY, real* coordZ, real* coordParticleXlocal, @@ -158,7 +158,7 @@ extern "C" __global__ void InitParticles( real* coordX, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void MoveParticles( real* coordX, +__global__ void MoveParticles( real* coordX, real* coordY, real* coordZ, real* coordParticleXlocal, @@ -184,7 +184,7 @@ extern "C" __global__ void MoveParticles( real* coordX, unsigned int numberOfTimesteps, unsigned int numberOfParticles, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -246,65 +246,65 @@ extern "C" __global__ void MoveParticles( real* coordX, (BC0yz >= GEO_FLUID) || (BCxyz >= GEO_FLUID) ) { - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DD[dirE *size_Mat]; - fwC = &DD[dirW *size_Mat]; - fnC = &DD[dirN *size_Mat]; - fsC = &DD[dirS *size_Mat]; - ftC = &DD[dirT *size_Mat]; - fbC = &DD[dirB *size_Mat]; - fneC = &DD[dirNE *size_Mat]; - fswC = &DD[dirSW *size_Mat]; - fseC = &DD[dirSE *size_Mat]; - fnwC = &DD[dirNW *size_Mat]; - fteC = &DD[dirTE *size_Mat]; - fbwC = &DD[dirBW *size_Mat]; - fbeC = &DD[dirBE *size_Mat]; - ftwC = &DD[dirTW *size_Mat]; - ftnC = &DD[dirTN *size_Mat]; - fbsC = &DD[dirBS *size_Mat]; - fbnC = &DD[dirBN *size_Mat]; - ftsC = &DD[dirTS *size_Mat]; - fzeroC = &DD[dirZERO*size_Mat]; - ftneC = &DD[dirTNE *size_Mat]; - ftswC = &DD[dirTSW *size_Mat]; - ftseC = &DD[dirTSE *size_Mat]; - ftnwC = &DD[dirTNW *size_Mat]; - fbneC = &DD[dirBNE *size_Mat]; - fbswC = &DD[dirBSW *size_Mat]; - fbseC = &DD[dirBSE *size_Mat]; - fbnwC = &DD[dirBNW *size_Mat]; + feC = &DD[DIR_P00 *size_Mat]; + fwC = &DD[DIR_M00 *size_Mat]; + fnC = &DD[DIR_0P0 *size_Mat]; + fsC = &DD[DIR_0M0 *size_Mat]; + ftC = &DD[DIR_00P *size_Mat]; + fbC = &DD[DIR_00M *size_Mat]; + fneC = &DD[DIR_PP0 *size_Mat]; + fswC = &DD[DIR_MM0 *size_Mat]; + fseC = &DD[DIR_PM0 *size_Mat]; + fnwC = &DD[DIR_MP0 *size_Mat]; + fteC = &DD[DIR_P0P *size_Mat]; + fbwC = &DD[DIR_M0M *size_Mat]; + fbeC = &DD[DIR_P0M *size_Mat]; + ftwC = &DD[DIR_M0P *size_Mat]; + ftnC = &DD[DIR_0PP *size_Mat]; + fbsC = &DD[DIR_0MM *size_Mat]; + fbnC = &DD[DIR_0PM *size_Mat]; + ftsC = &DD[DIR_0MP *size_Mat]; + fzeroC = &DD[DIR_000*size_Mat]; + ftneC = &DD[DIR_PPP *size_Mat]; + ftswC = &DD[DIR_MMP *size_Mat]; + ftseC = &DD[DIR_PMP *size_Mat]; + ftnwC = &DD[DIR_MPP *size_Mat]; + fbneC = &DD[DIR_PPM *size_Mat]; + fbswC = &DD[DIR_MMM *size_Mat]; + fbseC = &DD[DIR_PMM *size_Mat]; + fbnwC = &DD[DIR_MPM *size_Mat]; } else { - fwC = &DD[dirE *size_Mat]; - feC = &DD[dirW *size_Mat]; - fsC = &DD[dirN *size_Mat]; - fnC = &DD[dirS *size_Mat]; - fbC = &DD[dirT *size_Mat]; - ftC = &DD[dirB *size_Mat]; - fswC = &DD[dirNE *size_Mat]; - fneC = &DD[dirSW *size_Mat]; - fnwC = &DD[dirSE *size_Mat]; - fseC = &DD[dirNW *size_Mat]; - fbwC = &DD[dirTE *size_Mat]; - fteC = &DD[dirBW *size_Mat]; - ftwC = &DD[dirBE *size_Mat]; - fbeC = &DD[dirTW *size_Mat]; - fbsC = &DD[dirTN *size_Mat]; - ftnC = &DD[dirBS *size_Mat]; - ftsC = &DD[dirBN *size_Mat]; - fbnC = &DD[dirTS *size_Mat]; - fzeroC = &DD[dirZERO*size_Mat]; - fbswC = &DD[dirTNE *size_Mat]; - fbneC = &DD[dirTSW *size_Mat]; - fbnwC = &DD[dirTSE *size_Mat]; - fbseC = &DD[dirTNW *size_Mat]; - ftswC = &DD[dirBNE *size_Mat]; - ftneC = &DD[dirBSW *size_Mat]; - ftnwC = &DD[dirBSE *size_Mat]; - ftseC = &DD[dirBNW *size_Mat]; + fwC = &DD[DIR_P00 *size_Mat]; + feC = &DD[DIR_M00 *size_Mat]; + fsC = &DD[DIR_0P0 *size_Mat]; + fnC = &DD[DIR_0M0 *size_Mat]; + fbC = &DD[DIR_00P *size_Mat]; + ftC = &DD[DIR_00M *size_Mat]; + fswC = &DD[DIR_PP0 *size_Mat]; + fneC = &DD[DIR_MM0 *size_Mat]; + fnwC = &DD[DIR_PM0 *size_Mat]; + fseC = &DD[DIR_MP0 *size_Mat]; + fbwC = &DD[DIR_P0P *size_Mat]; + fteC = &DD[DIR_M0M *size_Mat]; + ftwC = &DD[DIR_P0M *size_Mat]; + fbeC = &DD[DIR_M0P *size_Mat]; + fbsC = &DD[DIR_0PP *size_Mat]; + ftnC = &DD[DIR_0MM *size_Mat]; + ftsC = &DD[DIR_0PM *size_Mat]; + fbnC = &DD[DIR_0MP *size_Mat]; + fzeroC = &DD[DIR_000*size_Mat]; + fbswC = &DD[DIR_PPP *size_Mat]; + fbneC = &DD[DIR_MMP *size_Mat]; + fbnwC = &DD[DIR_PMP *size_Mat]; + fbseC = &DD[DIR_MPP *size_Mat]; + ftswC = &DD[DIR_PPM *size_Mat]; + ftneC = &DD[DIR_MMM *size_Mat]; + ftnwC = &DD[DIR_PMM *size_Mat]; + ftseC = &DD[DIR_MPM *size_Mat]; } ////////////////////////////////////////////////////////////////////////// @@ -1030,7 +1030,7 @@ extern "C" __global__ void MoveParticles( real* coordX, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void MoveParticlesWithoutBCs( real* coordX, +__global__ void MoveParticlesWithoutBCs( real* coordX, real* coordY, real* coordZ, real* coordParticleXlocal, @@ -1056,7 +1056,7 @@ extern "C" __global__ void MoveParticlesWithoutBCs( real* coordX, unsigned int numberOfTimesteps, unsigned int numberOfParticles, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned ix = threadIdx.x; // Globaler x-Index @@ -1112,65 +1112,65 @@ extern "C" __global__ void MoveParticlesWithoutBCs( real* coordX, if( (BC000 == GEO_FLUID) || (BCx00 == GEO_FLUID) || (BC0y0 == GEO_FLUID) || (BC00z == GEO_FLUID) || (BCxy0 == GEO_FLUID) || (BCx0z == GEO_FLUID) || (BC0yz == GEO_FLUID) || (BCxyz == GEO_FLUID) ) { - if (evenOrOdd==true) + if (isEvenTimestep==true) { - feC = &DD[dirE *size_Mat]; - fwC = &DD[dirW *size_Mat]; - fnC = &DD[dirN *size_Mat]; - fsC = &DD[dirS *size_Mat]; - ftC = &DD[dirT *size_Mat]; - fbC = &DD[dirB *size_Mat]; - fneC = &DD[dirNE *size_Mat]; - fswC = &DD[dirSW *size_Mat]; - fseC = &DD[dirSE *size_Mat]; - fnwC = &DD[dirNW *size_Mat]; - fteC = &DD[dirTE *size_Mat]; - fbwC = &DD[dirBW *size_Mat]; - fbeC = &DD[dirBE *size_Mat]; - ftwC = &DD[dirTW *size_Mat]; - ftnC = &DD[dirTN *size_Mat]; - fbsC = &DD[dirBS *size_Mat]; - fbnC = &DD[dirBN *size_Mat]; - ftsC = &DD[dirTS *size_Mat]; - fzeroC = &DD[dirZERO*size_Mat]; - ftneC = &DD[dirTNE *size_Mat]; - ftswC = &DD[dirTSW *size_Mat]; - ftseC = &DD[dirTSE *size_Mat]; - ftnwC = &DD[dirTNW *size_Mat]; - fbneC = &DD[dirBNE *size_Mat]; - fbswC = &DD[dirBSW *size_Mat]; - fbseC = &DD[dirBSE *size_Mat]; - fbnwC = &DD[dirBNW *size_Mat]; + feC = &DD[DIR_P00 *size_Mat]; + fwC = &DD[DIR_M00 *size_Mat]; + fnC = &DD[DIR_0P0 *size_Mat]; + fsC = &DD[DIR_0M0 *size_Mat]; + ftC = &DD[DIR_00P *size_Mat]; + fbC = &DD[DIR_00M *size_Mat]; + fneC = &DD[DIR_PP0 *size_Mat]; + fswC = &DD[DIR_MM0 *size_Mat]; + fseC = &DD[DIR_PM0 *size_Mat]; + fnwC = &DD[DIR_MP0 *size_Mat]; + fteC = &DD[DIR_P0P *size_Mat]; + fbwC = &DD[DIR_M0M *size_Mat]; + fbeC = &DD[DIR_P0M *size_Mat]; + ftwC = &DD[DIR_M0P *size_Mat]; + ftnC = &DD[DIR_0PP *size_Mat]; + fbsC = &DD[DIR_0MM *size_Mat]; + fbnC = &DD[DIR_0PM *size_Mat]; + ftsC = &DD[DIR_0MP *size_Mat]; + fzeroC = &DD[DIR_000*size_Mat]; + ftneC = &DD[DIR_PPP *size_Mat]; + ftswC = &DD[DIR_MMP *size_Mat]; + ftseC = &DD[DIR_PMP *size_Mat]; + ftnwC = &DD[DIR_MPP *size_Mat]; + fbneC = &DD[DIR_PPM *size_Mat]; + fbswC = &DD[DIR_MMM *size_Mat]; + fbseC = &DD[DIR_PMM *size_Mat]; + fbnwC = &DD[DIR_MPM *size_Mat]; } else { - fwC = &DD[dirE *size_Mat]; - feC = &DD[dirW *size_Mat]; - fsC = &DD[dirN *size_Mat]; - fnC = &DD[dirS *size_Mat]; - fbC = &DD[dirT *size_Mat]; - ftC = &DD[dirB *size_Mat]; - fswC = &DD[dirNE *size_Mat]; - fneC = &DD[dirSW *size_Mat]; - fnwC = &DD[dirSE *size_Mat]; - fseC = &DD[dirNW *size_Mat]; - fbwC = &DD[dirTE *size_Mat]; - fteC = &DD[dirBW *size_Mat]; - ftwC = &DD[dirBE *size_Mat]; - fbeC = &DD[dirTW *size_Mat]; - fbsC = &DD[dirTN *size_Mat]; - ftnC = &DD[dirBS *size_Mat]; - ftsC = &DD[dirBN *size_Mat]; - fbnC = &DD[dirTS *size_Mat]; - fzeroC = &DD[dirZERO*size_Mat]; - fbswC = &DD[dirTNE *size_Mat]; - fbneC = &DD[dirTSW *size_Mat]; - fbnwC = &DD[dirTSE *size_Mat]; - fbseC = &DD[dirTNW *size_Mat]; - ftswC = &DD[dirBNE *size_Mat]; - ftneC = &DD[dirBSW *size_Mat]; - ftnwC = &DD[dirBSE *size_Mat]; - ftseC = &DD[dirBNW *size_Mat]; + fwC = &DD[DIR_P00 *size_Mat]; + feC = &DD[DIR_M00 *size_Mat]; + fsC = &DD[DIR_0P0 *size_Mat]; + fnC = &DD[DIR_0M0 *size_Mat]; + fbC = &DD[DIR_00P *size_Mat]; + ftC = &DD[DIR_00M *size_Mat]; + fswC = &DD[DIR_PP0 *size_Mat]; + fneC = &DD[DIR_MM0 *size_Mat]; + fnwC = &DD[DIR_PM0 *size_Mat]; + fseC = &DD[DIR_MP0 *size_Mat]; + fbwC = &DD[DIR_P0P *size_Mat]; + fteC = &DD[DIR_M0M *size_Mat]; + ftwC = &DD[DIR_P0M *size_Mat]; + fbeC = &DD[DIR_M0P *size_Mat]; + fbsC = &DD[DIR_0PP *size_Mat]; + ftnC = &DD[DIR_0MM *size_Mat]; + ftsC = &DD[DIR_0PM *size_Mat]; + fbnC = &DD[DIR_0MP *size_Mat]; + fzeroC = &DD[DIR_000*size_Mat]; + fbswC = &DD[DIR_PPP *size_Mat]; + fbneC = &DD[DIR_MMP *size_Mat]; + fbnwC = &DD[DIR_PMP *size_Mat]; + fbseC = &DD[DIR_MPP *size_Mat]; + ftswC = &DD[DIR_PPM *size_Mat]; + ftneC = &DD[DIR_MMM *size_Mat]; + ftnwC = &DD[DIR_PMM *size_Mat]; + ftseC = &DD[DIR_MPM *size_Mat]; } ////////////////////////////////////////////////////////////////////////// @@ -1896,7 +1896,7 @@ extern "C" __global__ void MoveParticlesWithoutBCs( real* coordX, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void ParticleNoSlipDeviceComp27(real* coordX, +__global__ void ParticleNoSlipDeviceComp27(real* coordX, real* coordY, real* coordZ, real* coordParticleXlocal, @@ -1924,76 +1924,76 @@ extern "C" __global__ void ParticleNoSlipDeviceComp27(real* coordX, unsigned int numberOfParticles, int* k_Q, real* QQ, - unsigned int sizeQ, + unsigned int numberOfBCnodes, real* NormalX, real* NormalY, real* NormalZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //TODO: What is this function for??? //Distributions27 D; - //if (evenOrOdd==true) + //if (isEvenTimestep==true) //{ - // D.f[dirE ] = &DD[dirE *size_Mat]; - // D.f[dirW ] = &DD[dirW *size_Mat]; - // D.f[dirN ] = &DD[dirN *size_Mat]; - // D.f[dirS ] = &DD[dirS *size_Mat]; - // D.f[dirT ] = &DD[dirT *size_Mat]; - // D.f[dirB ] = &DD[dirB *size_Mat]; - // D.f[dirNE ] = &DD[dirNE *size_Mat]; - // D.f[dirSW ] = &DD[dirSW *size_Mat]; - // D.f[dirSE ] = &DD[dirSE *size_Mat]; - // D.f[dirNW ] = &DD[dirNW *size_Mat]; - // D.f[dirTE ] = &DD[dirTE *size_Mat]; - // D.f[dirBW ] = &DD[dirBW *size_Mat]; - // D.f[dirBE ] = &DD[dirBE *size_Mat]; - // D.f[dirTW ] = &DD[dirTW *size_Mat]; - // D.f[dirTN ] = &DD[dirTN *size_Mat]; - // D.f[dirBS ] = &DD[dirBS *size_Mat]; - // D.f[dirBN ] = &DD[dirBN *size_Mat]; - // D.f[dirTS ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - // D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - // D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - // D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - // D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - // D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + // D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; //} //else //{ - // D.f[dirW ] = &DD[dirE *size_Mat]; - // D.f[dirE ] = &DD[dirW *size_Mat]; - // D.f[dirS ] = &DD[dirN *size_Mat]; - // D.f[dirN ] = &DD[dirS *size_Mat]; - // D.f[dirB ] = &DD[dirT *size_Mat]; - // D.f[dirT ] = &DD[dirB *size_Mat]; - // D.f[dirSW ] = &DD[dirNE *size_Mat]; - // D.f[dirNE ] = &DD[dirSW *size_Mat]; - // D.f[dirNW ] = &DD[dirSE *size_Mat]; - // D.f[dirSE ] = &DD[dirNW *size_Mat]; - // D.f[dirBW ] = &DD[dirTE *size_Mat]; - // D.f[dirTE ] = &DD[dirBW *size_Mat]; - // D.f[dirTW ] = &DD[dirBE *size_Mat]; - // D.f[dirBE ] = &DD[dirTW *size_Mat]; - // D.f[dirBS ] = &DD[dirTN *size_Mat]; - // D.f[dirTN ] = &DD[dirBS *size_Mat]; - // D.f[dirTS ] = &DD[dirBN *size_Mat]; - // D.f[dirBN ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - // D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - // D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - // D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - // D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - // D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + // D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; //} ////////////////////////////////////////////////////////////////////////////////// //const unsigned x = threadIdx.x; // Globaler x-Index @@ -2006,7 +2006,7 @@ extern "C" __global__ void ParticleNoSlipDeviceComp27(real* coordX, //const unsigned k = nx*(ny*z + y) + x; //////////////////////////////////////////////////////////////////////////// - //if(k < sizeQ) + //if(k < numberOfBCnodes) //{ // //////////////////////////////////////////////////////////////////////////////// // real *q_dirW, *q_dirS, *q_dirB; @@ -2015,128 +2015,128 @@ extern "C" __global__ void ParticleNoSlipDeviceComp27(real* coordX, // // *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, // // *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, // // *q_dirBSE, *q_dirBNW; - // // q_dirE = &QQ[dirE *sizeQ]; - // q_dirW = &QQ[dirW *sizeQ]; - // // q_dirN = &QQ[dirN *sizeQ]; - // q_dirS = &QQ[dirS *sizeQ]; - // // q_dirT = &QQ[dirT *sizeQ]; - // q_dirB = &QQ[dirB *sizeQ]; - // // q_dirNE = &QQ[dirNE *sizeQ]; - // // q_dirSW = &QQ[dirSW *sizeQ]; - // // q_dirSE = &QQ[dirSE *sizeQ]; - // // q_dirNW = &QQ[dirNW *sizeQ]; - // // q_dirTE = &QQ[dirTE *sizeQ]; - // // q_dirBW = &QQ[dirBW *sizeQ]; - // // q_dirBE = &QQ[dirBE *sizeQ]; - // // q_dirTW = &QQ[dirTW *sizeQ]; - // // q_dirTN = &QQ[dirTN *sizeQ]; - // // q_dirBS = &QQ[dirBS *sizeQ]; - // // q_dirBN = &QQ[dirBN *sizeQ]; - // // q_dirTS = &QQ[dirTS *sizeQ]; - // // q_dirTNE = &QQ[dirTNE *sizeQ]; - // // q_dirTSW = &QQ[dirTSW *sizeQ]; - // // q_dirTSE = &QQ[dirTSE *sizeQ]; - // // q_dirTNW = &QQ[dirTNW *sizeQ]; - // // q_dirBNE = &QQ[dirBNE *sizeQ]; - // // q_dirBSW = &QQ[dirBSW *sizeQ]; - // // q_dirBSE = &QQ[dirBSE *sizeQ]; - // // q_dirBNW = &QQ[dirBNW *sizeQ]; + // // q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + // q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + // // q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + // q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + // // q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + // q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + // // q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + // // q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + // // q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + // // q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + // // q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + // // q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + // // q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + // // q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + // // q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + // // q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + // // q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + // // q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + // // q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + // // q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + // // q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + // // q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + // // q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + // // q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + // // q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + // // q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; // //////////////////////////////////////////////////////////////////////////////// // // real *nx_dirE, *nx_dirW, *nx_dirN, *nx_dirS, *nx_dirT, *nx_dirB, // // *nx_dirNE, *nx_dirSW, *nx_dirSE, *nx_dirNW, *nx_dirTE, *nx_dirBW, // // *nx_dirBE, *nx_dirTW, *nx_dirTN, *nx_dirBS, *nx_dirBN, *nx_dirTS, // // *nx_dirTNE, *nx_dirTSW, *nx_dirTSE, *nx_dirTNW, *nx_dirBNE, *nx_dirBSW, // // *nx_dirBSE, *nx_dirBNW; - // // nx_dirE = &NormalX[dirE *sizeQ]; - // // nx_dirW = &NormalX[dirW *sizeQ]; - // // nx_dirN = &NormalX[dirN *sizeQ]; - // // nx_dirS = &NormalX[dirS *sizeQ]; - // // nx_dirT = &NormalX[dirT *sizeQ]; - // // nx_dirB = &NormalX[dirB *sizeQ]; - // // nx_dirNE = &NormalX[dirNE *sizeQ]; - // // nx_dirSW = &NormalX[dirSW *sizeQ]; - // // nx_dirSE = &NormalX[dirSE *sizeQ]; - // // nx_dirNW = &NormalX[dirNW *sizeQ]; - // // nx_dirTE = &NormalX[dirTE *sizeQ]; - // // nx_dirBW = &NormalX[dirBW *sizeQ]; - // // nx_dirBE = &NormalX[dirBE *sizeQ]; - // // nx_dirTW = &NormalX[dirTW *sizeQ]; - // // nx_dirTN = &NormalX[dirTN *sizeQ]; - // // nx_dirBS = &NormalX[dirBS *sizeQ]; - // // nx_dirBN = &NormalX[dirBN *sizeQ]; - // // nx_dirTS = &NormalX[dirTS *sizeQ]; - // // nx_dirTNE = &NormalX[dirTNE *sizeQ]; - // // nx_dirTSW = &NormalX[dirTSW *sizeQ]; - // // nx_dirTSE = &NormalX[dirTSE *sizeQ]; - // // nx_dirTNW = &NormalX[dirTNW *sizeQ]; - // // nx_dirBNE = &NormalX[dirBNE *sizeQ]; - // // nx_dirBSW = &NormalX[dirBSW *sizeQ]; - // // nx_dirBSE = &NormalX[dirBSE *sizeQ]; - // // nx_dirBNW = &NormalX[dirBNW *sizeQ]; + // // nx_dirE = &NormalX[DIR_P00 * numberOfBCnodes]; + // // nx_dirW = &NormalX[DIR_M00 * numberOfBCnodes]; + // // nx_dirN = &NormalX[DIR_0P0 * numberOfBCnodes]; + // // nx_dirS = &NormalX[DIR_0M0 * numberOfBCnodes]; + // // nx_dirT = &NormalX[DIR_00P * numberOfBCnodes]; + // // nx_dirB = &NormalX[DIR_00M * numberOfBCnodes]; + // // nx_dirNE = &NormalX[DIR_PP0 * numberOfBCnodes]; + // // nx_dirSW = &NormalX[DIR_MM0 * numberOfBCnodes]; + // // nx_dirSE = &NormalX[DIR_PM0 * numberOfBCnodes]; + // // nx_dirNW = &NormalX[DIR_MP0 * numberOfBCnodes]; + // // nx_dirTE = &NormalX[DIR_P0P * numberOfBCnodes]; + // // nx_dirBW = &NormalX[DIR_M0M * numberOfBCnodes]; + // // nx_dirBE = &NormalX[DIR_P0M * numberOfBCnodes]; + // // nx_dirTW = &NormalX[DIR_M0P * numberOfBCnodes]; + // // nx_dirTN = &NormalX[DIR_0PP * numberOfBCnodes]; + // // nx_dirBS = &NormalX[DIR_0MM * numberOfBCnodes]; + // // nx_dirBN = &NormalX[DIR_0PM * numberOfBCnodes]; + // // nx_dirTS = &NormalX[DIR_0MP * numberOfBCnodes]; + // // nx_dirTNE = &NormalX[DIR_PPP * numberOfBCnodes]; + // // nx_dirTSW = &NormalX[DIR_MMP * numberOfBCnodes]; + // // nx_dirTSE = &NormalX[DIR_PMP * numberOfBCnodes]; + // // nx_dirTNW = &NormalX[DIR_MPP * numberOfBCnodes]; + // // nx_dirBNE = &NormalX[DIR_PPM * numberOfBCnodes]; + // // nx_dirBSW = &NormalX[DIR_MMM * numberOfBCnodes]; + // // nx_dirBSE = &NormalX[DIR_PMM * numberOfBCnodes]; + // // nx_dirBNW = &NormalX[DIR_MPM * numberOfBCnodes]; // //////////////////////////////////////////////////////////////////////////////// // // real *ny_dirE, *ny_dirW, *ny_dirN, *ny_dirS, *ny_dirT, *ny_dirB, // // *ny_dirNE, *ny_dirSW, *ny_dirSE, *ny_dirNW, *ny_dirTE, *ny_dirBW, // // *ny_dirBE, *ny_dirTW, *ny_dirTN, *ny_dirBS, *ny_dirBN, *ny_dirTS, // // *ny_dirTNE, *ny_dirTSW, *ny_dirTSE, *ny_dirTNW, *ny_dirBNE, *ny_dirBSW, // // *ny_dirBSE, *ny_dirBNW; - // // ny_dirE = &NormalY[dirE *sizeQ]; - // // ny_dirW = &NormalY[dirW *sizeQ]; - // // ny_dirN = &NormalY[dirN *sizeQ]; - // // ny_dirS = &NormalY[dirS *sizeQ]; - // // ny_dirT = &NormalY[dirT *sizeQ]; - // // ny_dirB = &NormalY[dirB *sizeQ]; - // // ny_dirNE = &NormalY[dirNE *sizeQ]; - // // ny_dirSW = &NormalY[dirSW *sizeQ]; - // // ny_dirSE = &NormalY[dirSE *sizeQ]; - // // ny_dirNW = &NormalY[dirNW *sizeQ]; - // // ny_dirTE = &NormalY[dirTE *sizeQ]; - // // ny_dirBW = &NormalY[dirBW *sizeQ]; - // // ny_dirBE = &NormalY[dirBE *sizeQ]; - // // ny_dirTW = &NormalY[dirTW *sizeQ]; - // // ny_dirTN = &NormalY[dirTN *sizeQ]; - // // ny_dirBS = &NormalY[dirBS *sizeQ]; - // // ny_dirBN = &NormalY[dirBN *sizeQ]; - // // ny_dirTS = &NormalY[dirTS *sizeQ]; - // // ny_dirTNE = &NormalY[dirTNE *sizeQ]; - // // ny_dirTSW = &NormalY[dirTSW *sizeQ]; - // // ny_dirTSE = &NormalY[dirTSE *sizeQ]; - // // ny_dirTNW = &NormalY[dirTNW *sizeQ]; - // // ny_dirBNE = &NormalY[dirBNE *sizeQ]; - // // ny_dirBSW = &NormalY[dirBSW *sizeQ]; - // // ny_dirBSE = &NormalY[dirBSE *sizeQ]; - // // ny_dirBNW = &NormalY[dirBNW *sizeQ]; + // // ny_dirE = &NormalY[DIR_P00 * numberOfBCnodes]; + // // ny_dirW = &NormalY[DIR_M00 * numberOfBCnodes]; + // // ny_dirN = &NormalY[DIR_0P0 * numberOfBCnodes]; + // // ny_dirS = &NormalY[DIR_0M0 * numberOfBCnodes]; + // // ny_dirT = &NormalY[DIR_00P * numberOfBCnodes]; + // // ny_dirB = &NormalY[DIR_00M * numberOfBCnodes]; + // // ny_dirNE = &NormalY[DIR_PP0 * numberOfBCnodes]; + // // ny_dirSW = &NormalY[DIR_MM0 * numberOfBCnodes]; + // // ny_dirSE = &NormalY[DIR_PM0 * numberOfBCnodes]; + // // ny_dirNW = &NormalY[DIR_MP0 * numberOfBCnodes]; + // // ny_dirTE = &NormalY[DIR_P0P * numberOfBCnodes]; + // // ny_dirBW = &NormalY[DIR_M0M * numberOfBCnodes]; + // // ny_dirBE = &NormalY[DIR_P0M * numberOfBCnodes]; + // // ny_dirTW = &NormalY[DIR_M0P * numberOfBCnodes]; + // // ny_dirTN = &NormalY[DIR_0PP * numberOfBCnodes]; + // // ny_dirBS = &NormalY[DIR_0MM * numberOfBCnodes]; + // // ny_dirBN = &NormalY[DIR_0PM * numberOfBCnodes]; + // // ny_dirTS = &NormalY[DIR_0MP * numberOfBCnodes]; + // // ny_dirTNE = &NormalY[DIR_PPP * numberOfBCnodes]; + // // ny_dirTSW = &NormalY[DIR_MMP * numberOfBCnodes]; + // // ny_dirTSE = &NormalY[DIR_PMP * numberOfBCnodes]; + // // ny_dirTNW = &NormalY[DIR_MPP * numberOfBCnodes]; + // // ny_dirBNE = &NormalY[DIR_PPM * numberOfBCnodes]; + // // ny_dirBSW = &NormalY[DIR_MMM * numberOfBCnodes]; + // // ny_dirBSE = &NormalY[DIR_PMM * numberOfBCnodes]; + // // ny_dirBNW = &NormalY[DIR_MPM * numberOfBCnodes]; // //////////////////////////////////////////////////////////////////////////////// // // real *nz_dirE, *nz_dirW, *nz_dirN, *nz_dirS, *nz_dirT, *nz_dirB, // // *nz_dirNE, *nz_dirSW, *nz_dirSE, *nz_dirNW, *nz_dirTE, *nz_dirBW, // // *nz_dirBE, *nz_dirTW, *nz_dirTN, *nz_dirBS, *nz_dirBN, *nz_dirTS, // // *nz_dirTNE, *nz_dirTSW, *nz_dirTSE, *nz_dirTNW, *nz_dirBNE, *nz_dirBSW, // // *nz_dirBSE, *nz_dirBNW; - // // nz_dirE = &NormalZ[dirE *sizeQ]; - // // nz_dirW = &NormalZ[dirW *sizeQ]; - // // nz_dirN = &NormalZ[dirN *sizeQ]; - // // nz_dirS = &NormalZ[dirS *sizeQ]; - // // nz_dirT = &NormalZ[dirT *sizeQ]; - // // nz_dirB = &NormalZ[dirB *sizeQ]; - // // nz_dirNE = &NormalZ[dirNE *sizeQ]; - // // nz_dirSW = &NormalZ[dirSW *sizeQ]; - // // nz_dirSE = &NormalZ[dirSE *sizeQ]; - // // nz_dirNW = &NormalZ[dirNW *sizeQ]; - // // nz_dirTE = &NormalZ[dirTE *sizeQ]; - // // nz_dirBW = &NormalZ[dirBW *sizeQ]; - // // nz_dirBE = &NormalZ[dirBE *sizeQ]; - // // nz_dirTW = &NormalZ[dirTW *sizeQ]; - // // nz_dirTN = &NormalZ[dirTN *sizeQ]; - // // nz_dirBS = &NormalZ[dirBS *sizeQ]; - // // nz_dirBN = &NormalZ[dirBN *sizeQ]; - // // nz_dirTS = &NormalZ[dirTS *sizeQ]; - // // nz_dirTNE = &NormalZ[dirTNE *sizeQ]; - // // nz_dirTSW = &NormalZ[dirTSW *sizeQ]; - // // nz_dirTSE = &NormalZ[dirTSE *sizeQ]; - // // nz_dirTNW = &NormalZ[dirTNW *sizeQ]; - // // nz_dirBNE = &NormalZ[dirBNE *sizeQ]; - // // nz_dirBSW = &NormalZ[dirBSW *sizeQ]; - // // nz_dirBSE = &NormalZ[dirBSE *sizeQ]; - // // nz_dirBNW = &NormalZ[dirBNW *sizeQ]; + // // nz_dirE = &NormalZ[DIR_P00 * numberOfBCnodes]; + // // nz_dirW = &NormalZ[DIR_M00 * numberOfBCnodes]; + // // nz_dirN = &NormalZ[DIR_0P0 * numberOfBCnodes]; + // // nz_dirS = &NormalZ[DIR_0M0 * numberOfBCnodes]; + // // nz_dirT = &NormalZ[DIR_00P * numberOfBCnodes]; + // // nz_dirB = &NormalZ[DIR_00M * numberOfBCnodes]; + // // nz_dirNE = &NormalZ[DIR_PP0 * numberOfBCnodes]; + // // nz_dirSW = &NormalZ[DIR_MM0 * numberOfBCnodes]; + // // nz_dirSE = &NormalZ[DIR_PM0 * numberOfBCnodes]; + // // nz_dirNW = &NormalZ[DIR_MP0 * numberOfBCnodes]; + // // nz_dirTE = &NormalZ[DIR_P0P * numberOfBCnodes]; + // // nz_dirBW = &NormalZ[DIR_M0M * numberOfBCnodes]; + // // nz_dirBE = &NormalZ[DIR_P0M * numberOfBCnodes]; + // // nz_dirTW = &NormalZ[DIR_M0P * numberOfBCnodes]; + // // nz_dirTN = &NormalZ[DIR_0PP * numberOfBCnodes]; + // // nz_dirBS = &NormalZ[DIR_0MM * numberOfBCnodes]; + // // nz_dirBN = &NormalZ[DIR_0PM * numberOfBCnodes]; + // // nz_dirTS = &NormalZ[DIR_0MP * numberOfBCnodes]; + // // nz_dirTNE = &NormalZ[DIR_PPP * numberOfBCnodes]; + // // nz_dirTSW = &NormalZ[DIR_MMP * numberOfBCnodes]; + // // nz_dirTSE = &NormalZ[DIR_PMP * numberOfBCnodes]; + // // nz_dirTNW = &NormalZ[DIR_MPP * numberOfBCnodes]; + // // nz_dirBNE = &NormalZ[DIR_PPM * numberOfBCnodes]; + // // nz_dirBSW = &NormalZ[DIR_MMM * numberOfBCnodes]; + // // nz_dirBSE = &NormalZ[DIR_PMM * numberOfBCnodes]; + // // nz_dirBNW = &NormalZ[DIR_MPM * numberOfBCnodes]; // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //bool changeCell = false; // unsigned int KQK = k_Q[k]; @@ -2190,38 +2190,38 @@ extern "C" __global__ void ParticleNoSlipDeviceComp27(real* coordX, // unsigned int ktne = KQK; // unsigned int kbsw = neighborZ[ksw]; // //////////////////////////////////////////////////////////////////////////////// - // real f_W = (D.f[dirE ])[ke ]; - // real f_E = (D.f[dirW ])[kw ]; - // real f_S = (D.f[dirN ])[kn ]; - // real f_N = (D.f[dirS ])[ks ]; - // real f_B = (D.f[dirT ])[kt ]; - // real f_T = (D.f[dirB ])[kb ]; - // real f_SW = (D.f[dirNE ])[kne ]; - // real f_NE = (D.f[dirSW ])[ksw ]; - // real f_NW = (D.f[dirSE ])[kse ]; - // real f_SE = (D.f[dirNW ])[knw ]; - // real f_BW = (D.f[dirTE ])[kte ]; - // real f_TE = (D.f[dirBW ])[kbw ]; - // real f_TW = (D.f[dirBE ])[kbe ]; - // real f_BE = (D.f[dirTW ])[ktw ]; - // real f_BS = (D.f[dirTN ])[ktn ]; - // real f_TN = (D.f[dirBS ])[kbs ]; - // real f_TS = (D.f[dirBN ])[kbn ]; - // real f_BN = (D.f[dirTS ])[kts ]; - // real f_BSW = (D.f[dirTNE ])[ktne ]; - // real f_BNE = (D.f[dirTSW ])[ktsw ]; - // real f_BNW = (D.f[dirTSE ])[ktse ]; - // real f_BSE = (D.f[dirTNW ])[ktnw ]; - // real f_TSW = (D.f[dirBNE ])[kbne ]; - // real f_TNE = (D.f[dirBSW ])[kbsw ]; - // real f_TNW = (D.f[dirBSE ])[kbse ]; - // real f_TSE = (D.f[dirBNW ])[kbnw ]; + // real f_W = (D.f[DIR_P00 ])[ke ]; + // real f_E = (D.f[DIR_M00 ])[kw ]; + // real f_S = (D.f[DIR_0P0 ])[kn ]; + // real f_N = (D.f[DIR_0M0 ])[ks ]; + // real f_B = (D.f[DIR_00P ])[kt ]; + // real f_T = (D.f[DIR_00M ])[kb ]; + // real f_SW = (D.f[DIR_PP0 ])[kne ]; + // real f_NE = (D.f[DIR_MM0 ])[ksw ]; + // real f_NW = (D.f[DIR_PM0 ])[kse ]; + // real f_SE = (D.f[DIR_MP0 ])[knw ]; + // real f_BW = (D.f[DIR_P0P ])[kte ]; + // real f_TE = (D.f[DIR_M0M ])[kbw ]; + // real f_TW = (D.f[DIR_P0M ])[kbe ]; + // real f_BE = (D.f[DIR_M0P ])[ktw ]; + // real f_BS = (D.f[DIR_0PP ])[ktn ]; + // real f_TN = (D.f[DIR_0MM ])[kbs ]; + // real f_TS = (D.f[DIR_0PM ])[kbn ]; + // real f_BN = (D.f[DIR_0MP ])[kts ]; + // real f_BSW = (D.f[DIR_PPP ])[ktne ]; + // real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + // real f_BNW = (D.f[DIR_PMP ])[ktse ]; + // real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + // real f_TSW = (D.f[DIR_PPM ])[kbne ]; + // real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + // real f_TNW = (D.f[DIR_PMM ])[kbse ]; + // real f_TSE = (D.f[DIR_MPM ])[kbnw ]; // //////////////////////////////////////////////////////////////////////////////// // // real feq, q; // real vx1, vx2, vx3, drho; // drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + // f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - // f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + // f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); // vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -2239,65 +2239,65 @@ extern "C" __global__ void ParticleNoSlipDeviceComp27(real* coordX, // //real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); // ////////////////////////////////////////////////////////////////////////// - // if (evenOrOdd==false) + // if (isEvenTimestep==false) // { - // D.f[dirE ] = &DD[dirE *size_Mat]; - // D.f[dirW ] = &DD[dirW *size_Mat]; - // D.f[dirN ] = &DD[dirN *size_Mat]; - // D.f[dirS ] = &DD[dirS *size_Mat]; - // D.f[dirT ] = &DD[dirT *size_Mat]; - // D.f[dirB ] = &DD[dirB *size_Mat]; - // D.f[dirNE ] = &DD[dirNE *size_Mat]; - // D.f[dirSW ] = &DD[dirSW *size_Mat]; - // D.f[dirSE ] = &DD[dirSE *size_Mat]; - // D.f[dirNW ] = &DD[dirNW *size_Mat]; - // D.f[dirTE ] = &DD[dirTE *size_Mat]; - // D.f[dirBW ] = &DD[dirBW *size_Mat]; - // D.f[dirBE ] = &DD[dirBE *size_Mat]; - // D.f[dirTW ] = &DD[dirTW *size_Mat]; - // D.f[dirTN ] = &DD[dirTN *size_Mat]; - // D.f[dirBS ] = &DD[dirBS *size_Mat]; - // D.f[dirBN ] = &DD[dirBN *size_Mat]; - // D.f[dirTS ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - // D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - // D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - // D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - // D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - // D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + // D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; // } // else // { - // D.f[dirW ] = &DD[dirE *size_Mat]; - // D.f[dirE ] = &DD[dirW *size_Mat]; - // D.f[dirS ] = &DD[dirN *size_Mat]; - // D.f[dirN ] = &DD[dirS *size_Mat]; - // D.f[dirB ] = &DD[dirT *size_Mat]; - // D.f[dirT ] = &DD[dirB *size_Mat]; - // D.f[dirSW ] = &DD[dirNE *size_Mat]; - // D.f[dirNE ] = &DD[dirSW *size_Mat]; - // D.f[dirNW ] = &DD[dirSE *size_Mat]; - // D.f[dirSE ] = &DD[dirNW *size_Mat]; - // D.f[dirBW ] = &DD[dirTE *size_Mat]; - // D.f[dirTE ] = &DD[dirBW *size_Mat]; - // D.f[dirTW ] = &DD[dirBE *size_Mat]; - // D.f[dirBE ] = &DD[dirTW *size_Mat]; - // D.f[dirBS ] = &DD[dirTN *size_Mat]; - // D.f[dirTN ] = &DD[dirBS *size_Mat]; - // D.f[dirTS ] = &DD[dirBN *size_Mat]; - // D.f[dirBN ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - // D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - // D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - // D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - // D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - // D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + // D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; // } //} } diff --git a/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu index 4d647cdd1f5cbefc2423fa9b95ecde29c3c89dbb..ccb2ce79c63515e59e4f9ae75016f44ced71a170 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/PressBCs27.cu @@ -1,22 +1,24 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" -#include <lbm/constants/NumericConstants.h> +#include "lbm/constants/D3Q27.h" +#include "lbm/constants/NumericConstants.h" +#include "KernelUtilities.h" using namespace vf::lbm::constant; +using namespace vf::lbm::dir; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QInflowScaleByPressDevice27( real* rhoBC, +__global__ void QInflowScaleByPressDevice27( real* rhoBC, real* DD, int* k_Q, int* k_N, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -29,7 +31,7 @@ extern "C" __global__ void QInflowScaleByPressDevice27( real* rhoBC, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -93,122 +95,122 @@ extern "C" __global__ void QInflowScaleByPressDevice27( real* rhoBC, unsigned int k1bsw = neighborZ[k1sw]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real f1_E = (D.f[dirE ])[k1e ]; - real f1_W = (D.f[dirW ])[k1w ]; - real f1_N = (D.f[dirN ])[k1n ]; - real f1_S = (D.f[dirS ])[k1s ]; - real f1_T = (D.f[dirT ])[k1t ]; - real f1_B = (D.f[dirB ])[k1b ]; - real f1_NE = (D.f[dirNE ])[k1ne ]; - real f1_SW = (D.f[dirSW ])[k1sw ]; - real f1_SE = (D.f[dirSE ])[k1se ]; - real f1_NW = (D.f[dirNW ])[k1nw ]; - real f1_TE = (D.f[dirTE ])[k1te ]; - real f1_BW = (D.f[dirBW ])[k1bw ]; - real f1_BE = (D.f[dirBE ])[k1be ]; - real f1_TW = (D.f[dirTW ])[k1tw ]; - real f1_TN = (D.f[dirTN ])[k1tn ]; - real f1_BS = (D.f[dirBS ])[k1bs ]; - real f1_BN = (D.f[dirBN ])[k1bn ]; - real f1_TS = (D.f[dirTS ])[k1ts ]; - //real f1_ZERO = (D.f[dirZERO])[k1zero]; - real f1_TNE = (D.f[dirTNE ])[k1tne ]; - real f1_TSW = (D.f[dirTSW ])[k1tsw ]; - real f1_TSE = (D.f[dirTSE ])[k1tse ]; - real f1_TNW = (D.f[dirTNW ])[k1tnw ]; - real f1_BNE = (D.f[dirBNE ])[k1bne ]; - real f1_BSW = (D.f[dirBSW ])[k1bsw ]; - real f1_BSE = (D.f[dirBSE ])[k1bse ]; - real f1_BNW = (D.f[dirBNW ])[k1bnw ]; + real f1_E = (D.f[DIR_P00 ])[k1e ]; + real f1_W = (D.f[DIR_M00 ])[k1w ]; + real f1_N = (D.f[DIR_0P0 ])[k1n ]; + real f1_S = (D.f[DIR_0M0 ])[k1s ]; + real f1_T = (D.f[DIR_00P ])[k1t ]; + real f1_B = (D.f[DIR_00M ])[k1b ]; + real f1_NE = (D.f[DIR_PP0 ])[k1ne ]; + real f1_SW = (D.f[DIR_MM0 ])[k1sw ]; + real f1_SE = (D.f[DIR_PM0 ])[k1se ]; + real f1_NW = (D.f[DIR_MP0 ])[k1nw ]; + real f1_TE = (D.f[DIR_P0P ])[k1te ]; + real f1_BW = (D.f[DIR_M0M ])[k1bw ]; + real f1_BE = (D.f[DIR_P0M ])[k1be ]; + real f1_TW = (D.f[DIR_M0P ])[k1tw ]; + real f1_TN = (D.f[DIR_0PP ])[k1tn ]; + real f1_BS = (D.f[DIR_0MM ])[k1bs ]; + real f1_BN = (D.f[DIR_0PM ])[k1bn ]; + real f1_TS = (D.f[DIR_0MP ])[k1ts ]; + //real f1_ZERO = (D.f[DIR_000])[k1zero]; + real f1_TNE = (D.f[DIR_PPP ])[k1tne ]; + real f1_TSW = (D.f[DIR_MMP ])[k1tsw ]; + real f1_TSE = (D.f[DIR_PMP ])[k1tse ]; + real f1_TNW = (D.f[DIR_MPP ])[k1tnw ]; + real f1_BNE = (D.f[DIR_PPM ])[k1bne ]; + real f1_BSW = (D.f[DIR_MMM ])[k1bsw ]; + real f1_BSE = (D.f[DIR_PMM ])[k1bse ]; + real f1_BNW = (D.f[DIR_MPM ])[k1bnw ]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real f_E = (D.f[dirE ])[ke ]; - real f_W = (D.f[dirW ])[kw ]; - real f_N = (D.f[dirN ])[kn ]; - real f_S = (D.f[dirS ])[ks ]; - real f_T = (D.f[dirT ])[kt ]; - real f_B = (D.f[dirB ])[kb ]; - real f_NE = (D.f[dirNE ])[kne ]; - real f_SW = (D.f[dirSW ])[ksw ]; - real f_SE = (D.f[dirSE ])[kse ]; - real f_NW = (D.f[dirNW ])[knw ]; - real f_TE = (D.f[dirTE ])[kte ]; - real f_BW = (D.f[dirBW ])[kbw ]; - real f_BE = (D.f[dirBE ])[kbe ]; - real f_TW = (D.f[dirTW ])[ktw ]; - real f_TN = (D.f[dirTN ])[ktn ]; - real f_BS = (D.f[dirBS ])[kbs ]; - real f_BN = (D.f[dirBN ])[kbn ]; - real f_TS = (D.f[dirTS ])[kts ]; - //real f_ZERO = (D.f[dirZERO])[kzero]; - real f_TNE = (D.f[dirTNE ])[ktne ]; - real f_TSW = (D.f[dirTSW ])[ktsw ]; - real f_TSE = (D.f[dirTSE ])[ktse ]; - real f_TNW = (D.f[dirTNW ])[ktnw ]; - real f_BNE = (D.f[dirBNE ])[kbne ]; - real f_BSW = (D.f[dirBSW ])[kbsw ]; - real f_BSE = (D.f[dirBSE ])[kbse ]; - real f_BNW = (D.f[dirBNW ])[kbnw ]; + real f_E = (D.f[DIR_P00 ])[ke ]; + real f_W = (D.f[DIR_M00 ])[kw ]; + real f_N = (D.f[DIR_0P0 ])[kn ]; + real f_S = (D.f[DIR_0M0 ])[ks ]; + real f_T = (D.f[DIR_00P ])[kt ]; + real f_B = (D.f[DIR_00M ])[kb ]; + real f_NE = (D.f[DIR_PP0 ])[kne ]; + real f_SW = (D.f[DIR_MM0 ])[ksw ]; + real f_SE = (D.f[DIR_PM0 ])[kse ]; + real f_NW = (D.f[DIR_MP0 ])[knw ]; + real f_TE = (D.f[DIR_P0P ])[kte ]; + real f_BW = (D.f[DIR_M0M ])[kbw ]; + real f_BE = (D.f[DIR_P0M ])[kbe ]; + real f_TW = (D.f[DIR_M0P ])[ktw ]; + real f_TN = (D.f[DIR_0PP ])[ktn ]; + real f_BS = (D.f[DIR_0MM ])[kbs ]; + real f_BN = (D.f[DIR_0PM ])[kbn ]; + real f_TS = (D.f[DIR_0MP ])[kts ]; + //real f_ZERO = (D.f[DIR_000])[kzero]; + real f_TNE = (D.f[DIR_PPP ])[ktne ]; + real f_TSW = (D.f[DIR_MMP ])[ktsw ]; + real f_TSE = (D.f[DIR_PMP ])[ktse ]; + real f_TNW = (D.f[DIR_MPP ])[ktnw ]; + real f_BNE = (D.f[DIR_PPM ])[kbne ]; + real f_BSW = (D.f[DIR_MMM ])[kbsw ]; + real f_BSE = (D.f[DIR_PMM ])[kbse ]; + real f_BNW = (D.f[DIR_MPM ])[kbnw ]; ////////////////////////////////////////////////////////////////////////// // real vx1, vx2, vx3; real drho, drho1; @@ -216,10 +218,10 @@ extern "C" __global__ void QInflowScaleByPressDevice27( real* rhoBC, //Dichte drho1 = f1_TSE + f1_TNW + f1_TNE + f1_TSW + f1_BSE + f1_BNW + f1_BNE + f1_BSW + f1_BN + f1_TS + f1_TN + f1_BS + f1_BE + f1_TW + f1_TE + f1_BW + f1_SE + f1_NW + f1_NE + f1_SW + - f1_T + f1_B + f1_N + f1_S + f1_E + f1_W + ((D.f[dirZERO])[k1zero]); + f1_T + f1_B + f1_N + f1_S + f1_E + f1_W + ((D.f[DIR_000])[k1zero]); drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); ////////////////////////////////////////////////////////////////////////// //Schallgeschwindigkeit real cs = c1o1 / sqrtf(c3o1); @@ -317,108 +319,108 @@ extern "C" __global__ void QInflowScaleByPressDevice27( real* rhoBC, ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////// //__syncthreads(); // -X - //(D.f[dirE ])[ke ] = f_E ; - //(D.f[dirSE ])[kse ] = f_SE ; - //(D.f[dirNE ])[kne ] = f_NE ; - //(D.f[dirBE ])[kbe ] = f_BE ; - //(D.f[dirTE ])[kte ] = f_TE ; - //(D.f[dirTSE ])[ktse ] = f_TSE ; - //(D.f[dirTNE ])[ktne ] = f_TNE ; - //(D.f[dirBSE ])[kbse ] = f_BSE ; - //(D.f[dirBNE ])[kbne ] = f_BNE ; + //(D.f[DIR_P00 ])[ke ] = f_E ; + //(D.f[DIR_PM0 ])[kse ] = f_SE ; + //(D.f[DIR_PP0 ])[kne ] = f_NE ; + //(D.f[DIR_P0M ])[kbe ] = f_BE ; + //(D.f[DIR_P0P ])[kte ] = f_TE ; + //(D.f[DIR_PMP ])[ktse ] = f_TSE ; + //(D.f[DIR_PPP ])[ktne ] = f_TNE ; + //(D.f[DIR_PMM ])[kbse ] = f_BSE ; + //(D.f[DIR_PPM ])[kbne ] = f_BNE ; // X - (D.f[dirW ])[kw ] = f_W ; - (D.f[dirSW ])[ksw ] = f_SW ; - (D.f[dirNW ])[knw ] = f_NW ; - (D.f[dirBW ])[kbw ] = f_BW ; - (D.f[dirTW ])[ktw ] = f_TW ; - (D.f[dirTSW ])[ktsw ] = f_TSW ; - (D.f[dirTNW ])[ktnw ] = f_TNW ; - (D.f[dirBSW ])[kbsw ] = f_BSW ; - (D.f[dirBNW ])[kbnw ] = f_BNW ; + (D.f[DIR_M00 ])[kw ] = f_W ; + (D.f[DIR_MM0 ])[ksw ] = f_SW ; + (D.f[DIR_MP0 ])[knw ] = f_NW ; + (D.f[DIR_M0M ])[kbw ] = f_BW ; + (D.f[DIR_M0P ])[ktw ] = f_TW ; + (D.f[DIR_MMP ])[ktsw ] = f_TSW ; + (D.f[DIR_MPP ])[ktnw ] = f_TNW ; + (D.f[DIR_MMM ])[kbsw ] = f_BSW ; + (D.f[DIR_MPM ])[kbnw ] = f_BNW ; // Y - //(D.f[dirS ])[ks ] = f_S ; - //(D.f[dirSE ])[kse ] = f_SE ; - //(D.f[dirSW ])[ksw ] = f_SW ; - //(D.f[dirTS ])[kts ] = f_TS ; - //(D.f[dirBS ])[kbs ] = f_BS ; - //(D.f[dirTSE ])[ktse ] = f_TSE ; - //(D.f[dirTSW ])[ktsw ] = f_TSW ; - //(D.f[dirBSE ])[kbse ] = f_BSE ; - //(D.f[dirBSW ])[kbsw ] = f_BSW ; + //(D.f[DIR_0M0 ])[ks ] = f_S ; + //(D.f[DIR_PM0 ])[kse ] = f_SE ; + //(D.f[DIR_MM0 ])[ksw ] = f_SW ; + //(D.f[DIR_0MP ])[kts ] = f_TS ; + //(D.f[DIR_0MM ])[kbs ] = f_BS ; + //(D.f[DIR_PMP ])[ktse ] = f_TSE ; + //(D.f[DIR_MMP ])[ktsw ] = f_TSW ; + //(D.f[DIR_PMM ])[kbse ] = f_BSE ; + //(D.f[DIR_MMM ])[kbsw ] = f_BSW ; // Z - //(D.f[dirB ])[kb ] = f_B ; - //(D.f[dirBE ])[kbe ] = f_BE ; - //(D.f[dirBW ])[kbw ] = f_BW ; - //(D.f[dirBN ])[kbn ] = f_BN ; - //(D.f[dirBS ])[kbs ] = f_BS ; - //(D.f[dirBNE ])[kbne ] = f_BNE ; - //(D.f[dirBNW ])[kbnw ] = f_BNW ; - //(D.f[dirBSE ])[kbse ] = f_BSE ; - //(D.f[dirBSW ])[kbsw ] = f_BSW ; + //(D.f[DIR_00M ])[kb ] = f_B ; + //(D.f[DIR_P0M ])[kbe ] = f_BE ; + //(D.f[DIR_M0M ])[kbw ] = f_BW ; + //(D.f[DIR_0PM ])[kbn ] = f_BN ; + //(D.f[DIR_0MM ])[kbs ] = f_BS ; + //(D.f[DIR_PPM ])[kbne ] = f_BNE ; + //(D.f[DIR_MPM ])[kbnw ] = f_BNW ; + //(D.f[DIR_PMM ])[kbse ] = f_BSE ; + //(D.f[DIR_MMM ])[kbsw ] = f_BSW ; ////////////////////////////////////////////////////////////////////////// } } @@ -463,17 +465,17 @@ extern "C" __global__ void QInflowScaleByPressDevice27( real* rhoBC, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressDeviceIncompNEQ27( real* rhoBC, +__global__ void QPressDeviceIncompNEQ27( real* rhoBC, real* DD, int* k_Q, int* k_N, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -486,7 +488,7 @@ extern "C" __global__ void QPressDeviceIncompNEQ27( real* rhoBC, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -550,97 +552,97 @@ extern "C" __global__ void QPressDeviceIncompNEQ27( real* rhoBC, unsigned int k1bsw = neighborZ[k1sw]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==true) //// ACHTUNG PREColl !!!!!!!!!!!!!! + if (isEvenTimestep==true) //// ACHTUNG PREColl !!!!!!!!!!!!!! { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real f1_E,f1_W,f1_N,f1_S,f1_T,f1_B,f1_NE,f1_SW,f1_SE,f1_NW,f1_TE,f1_BW,f1_BE,f1_TW,f1_TN,f1_BS,f1_BN,f1_TS,f1_ZERO, f1_TNE,f1_TSW,f1_TSE,f1_TNW,f1_BNE,f1_BSW,f1_BSE,f1_BNW; - f1_W = (D.f[dirE ])[k1e ]; - f1_E = (D.f[dirW ])[k1w ]; - f1_S = (D.f[dirN ])[k1n ]; - f1_N = (D.f[dirS ])[k1s ]; - f1_B = (D.f[dirT ])[k1t ]; - f1_T = (D.f[dirB ])[k1b ]; - f1_SW = (D.f[dirNE ])[k1ne ]; - f1_NE = (D.f[dirSW ])[k1sw ]; - f1_NW = (D.f[dirSE ])[k1se ]; - f1_SE = (D.f[dirNW ])[k1nw ]; - f1_BW = (D.f[dirTE ])[k1te ]; - f1_TE = (D.f[dirBW ])[k1bw ]; - f1_TW = (D.f[dirBE ])[k1be ]; - f1_BE = (D.f[dirTW ])[k1tw ]; - f1_BS = (D.f[dirTN ])[k1tn ]; - f1_TN = (D.f[dirBS ])[k1bs ]; - f1_TS = (D.f[dirBN ])[k1bn ]; - f1_BN = (D.f[dirTS ])[k1ts ]; - f1_ZERO = (D.f[dirZERO])[k1zero]; - f1_BSW = (D.f[dirTNE ])[k1tne ]; - f1_BNE = (D.f[dirTSW ])[k1tsw ]; - f1_BNW = (D.f[dirTSE ])[k1tse ]; - f1_BSE = (D.f[dirTNW ])[k1tnw ]; - f1_TSW = (D.f[dirBNE ])[k1bne ]; - f1_TNE = (D.f[dirBSW ])[k1bsw ]; - f1_TNW = (D.f[dirBSE ])[k1bse ]; - f1_TSE = (D.f[dirBNW ])[k1bnw ]; + f1_W = (D.f[DIR_P00 ])[k1e ]; + f1_E = (D.f[DIR_M00 ])[k1w ]; + f1_S = (D.f[DIR_0P0 ])[k1n ]; + f1_N = (D.f[DIR_0M0 ])[k1s ]; + f1_B = (D.f[DIR_00P ])[k1t ]; + f1_T = (D.f[DIR_00M ])[k1b ]; + f1_SW = (D.f[DIR_PP0 ])[k1ne ]; + f1_NE = (D.f[DIR_MM0 ])[k1sw ]; + f1_NW = (D.f[DIR_PM0 ])[k1se ]; + f1_SE = (D.f[DIR_MP0 ])[k1nw ]; + f1_BW = (D.f[DIR_P0P ])[k1te ]; + f1_TE = (D.f[DIR_M0M ])[k1bw ]; + f1_TW = (D.f[DIR_P0M ])[k1be ]; + f1_BE = (D.f[DIR_M0P ])[k1tw ]; + f1_BS = (D.f[DIR_0PP ])[k1tn ]; + f1_TN = (D.f[DIR_0MM ])[k1bs ]; + f1_TS = (D.f[DIR_0PM ])[k1bn ]; + f1_BN = (D.f[DIR_0MP ])[k1ts ]; + f1_ZERO = (D.f[DIR_000])[k1zero]; + f1_BSW = (D.f[DIR_PPP ])[k1tne ]; + f1_BNE = (D.f[DIR_MMP ])[k1tsw ]; + f1_BNW = (D.f[DIR_PMP ])[k1tse ]; + f1_BSE = (D.f[DIR_MPP ])[k1tnw ]; + f1_TSW = (D.f[DIR_PPM ])[k1bne ]; + f1_TNE = (D.f[DIR_MMM ])[k1bsw ]; + f1_TNW = (D.f[DIR_PMM ])[k1bse ]; + f1_TSE = (D.f[DIR_MPM ])[k1bnw ]; ////////////////////////////////////////////////////////////////////////// real drho1 = f1_ZERO+f1_E+f1_W+f1_N+f1_S+f1_T+f1_B+f1_NE+f1_SW+f1_SE+f1_NW+f1_TE+f1_BW+f1_BE+f1_TW+f1_TN+f1_BS+f1_BN+f1_TS+ @@ -732,33 +734,33 @@ extern "C" __global__ void QPressDeviceIncompNEQ27( real* rhoBC, __syncthreads(); - (D.f[dirE ])[ke ] = f1_W ; - (D.f[dirW ])[kw ] = f1_E ; - (D.f[dirN ])[kn ] = f1_S ; - (D.f[dirS ])[ks ] = f1_N ; - (D.f[dirT ])[kt ] = f1_B ; - (D.f[dirB ])[kb ] = f1_T ; - (D.f[dirNE ])[kne ] = f1_SW ; - (D.f[dirSW ])[ksw ] = f1_NE ; - (D.f[dirSE ])[kse ] = f1_NW ; - (D.f[dirNW ])[knw ] = f1_SE ; - (D.f[dirTE ])[kte ] = f1_BW ; - (D.f[dirBW ])[kbw ] = f1_TE ; - (D.f[dirBE ])[kbe ] = f1_TW ; - (D.f[dirTW ])[ktw ] = f1_BE ; - (D.f[dirTN ])[ktn ] = f1_BS ; - (D.f[dirBS ])[kbs ] = f1_TN ; - (D.f[dirBN ])[kbn ] = f1_TS ; - (D.f[dirTS ])[kts ] = f1_BN ; - (D.f[dirZERO])[kzero] = f1_ZERO; - (D.f[dirTNE ])[ktne ] = f1_BSW ; - (D.f[dirTSW ])[ktsw ] = f1_BNE ; - (D.f[dirTSE ])[ktse ] = f1_BNW ; - (D.f[dirTNW ])[ktnw ] = f1_BSE ; - (D.f[dirBNE ])[kbne ] = f1_TSW ; - (D.f[dirBSW ])[kbsw ] = f1_TNE ; - (D.f[dirBSE ])[kbse ] = f1_TNW ; - (D.f[dirBNW ])[kbnw ] = f1_TSE ; + (D.f[DIR_P00 ])[ke ] = f1_W ; + (D.f[DIR_M00 ])[kw ] = f1_E ; + (D.f[DIR_0P0 ])[kn ] = f1_S ; + (D.f[DIR_0M0 ])[ks ] = f1_N ; + (D.f[DIR_00P ])[kt ] = f1_B ; + (D.f[DIR_00M ])[kb ] = f1_T ; + (D.f[DIR_PP0 ])[kne ] = f1_SW ; + (D.f[DIR_MM0 ])[ksw ] = f1_NE ; + (D.f[DIR_PM0 ])[kse ] = f1_NW ; + (D.f[DIR_MP0 ])[knw ] = f1_SE ; + (D.f[DIR_P0P ])[kte ] = f1_BW ; + (D.f[DIR_M0M ])[kbw ] = f1_TE ; + (D.f[DIR_P0M ])[kbe ] = f1_TW ; + (D.f[DIR_M0P ])[ktw ] = f1_BE ; + (D.f[DIR_0PP ])[ktn ] = f1_BS ; + (D.f[DIR_0MM ])[kbs ] = f1_TN ; + (D.f[DIR_0PM ])[kbn ] = f1_TS ; + (D.f[DIR_0MP ])[kts ] = f1_BN ; + (D.f[DIR_000])[kzero] = f1_ZERO; + (D.f[DIR_PPP ])[ktne ] = f1_BSW ; + (D.f[DIR_MMP ])[ktsw ] = f1_BNE ; + (D.f[DIR_PMP ])[ktse ] = f1_BNW ; + (D.f[DIR_MPP ])[ktnw ] = f1_BSE ; + (D.f[DIR_PPM ])[kbne ] = f1_TSW ; + (D.f[DIR_MMM ])[kbsw ] = f1_TNE ; + (D.f[DIR_PMM ])[kbse ] = f1_TNW ; + (D.f[DIR_MPM ])[kbnw ] = f1_TSE ; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -802,34 +804,54 @@ extern "C" __global__ void QPressDeviceIncompNEQ27( real* rhoBC, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressDeviceNEQ27(real* rhoBC, - real* DD, - int* k_Q, - int* k_N, - int kQ, - real om1, +__global__ void QPressDeviceNEQ27(real* rhoBC, + real* distribution, + int* bcNodeIndices, + int* bcNeighborIndices, + int numberOfBCnodes, + real omega1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int numberOfLBnodes, + bool isEvenTimestep) { - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index + ////////////////////////////////////////////////////////////////////////// + //! The pressure boundary condition is executed in the following steps + //! + //////////////////////////////////////////////////////////////////////////////// + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index const unsigned nx = blockDim.x; const unsigned ny = gridDim.x; const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + ////////////////////////////////////////////////////////////////////////// + //! - Run for all indices in size of boundary condition (numberOfBCnodes) + //! + if(k < numberOfBCnodes) { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + getPointersToDistributions(dist, distribution, numberOfLBnodes, isEvenTimestep); + //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; + //! - Set local pressure + //! + real rhoBClocal = rhoBC[k]; + + //////////////////////////////////////////////////////////////////////////////// + //! - Set neighbor indices (necessary for indirect addressing) + //! + unsigned int KQK = bcNodeIndices[k]; unsigned int kzero= KQK; unsigned int ke = KQK; unsigned int kw = neighborX[KQK]; @@ -858,8 +880,9 @@ extern "C" __global__ void QPressDeviceNEQ27(real* rhoBC, unsigned int ktne = KQK; unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// - //index1 - unsigned int K1QK = k_N[k]; + //! - Set neighbor indices (necessary for indirect addressing) for neighboring node + //! + unsigned int K1QK = bcNeighborIndices[k]; unsigned int k1zero= K1QK; unsigned int k1e = K1QK; unsigned int k1w = neighborX[K1QK]; @@ -887,123 +910,62 @@ extern "C" __global__ void QPressDeviceNEQ27(real* rhoBC, unsigned int k1bne = k1b; unsigned int k1tne = K1QK; unsigned int k1bsw = neighborZ[k1sw]; - //////////////////////////////////////////////////////////////////////////////// - Distributions27 D; - if (evenOrOdd==true) //// ACHTUNG PREColl !!!!!!!!!!!!!! - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real f1_E,f1_W,f1_N,f1_S,f1_T,f1_B,f1_NE,f1_SW,f1_SE,f1_NW,f1_TE,f1_BW,f1_BE,f1_TW,f1_TN,f1_BS,f1_BN,f1_TS,f1_ZERO, - f1_TNE,f1_TSW,f1_TSE,f1_TNW,f1_BNE,f1_BSW,f1_BSE,f1_BNW; - - f1_W = (D.f[dirE ])[k1e ]; - f1_E = (D.f[dirW ])[k1w ]; - f1_S = (D.f[dirN ])[k1n ]; - f1_N = (D.f[dirS ])[k1s ]; - f1_B = (D.f[dirT ])[k1t ]; - f1_T = (D.f[dirB ])[k1b ]; - f1_SW = (D.f[dirNE ])[k1ne ]; - f1_NE = (D.f[dirSW ])[k1sw ]; - f1_NW = (D.f[dirSE ])[k1se ]; - f1_SE = (D.f[dirNW ])[k1nw ]; - f1_BW = (D.f[dirTE ])[k1te ]; - f1_TE = (D.f[dirBW ])[k1bw ]; - f1_TW = (D.f[dirBE ])[k1be ]; - f1_BE = (D.f[dirTW ])[k1tw ]; - f1_BS = (D.f[dirTN ])[k1tn ]; - f1_TN = (D.f[dirBS ])[k1bs ]; - f1_TS = (D.f[dirBN ])[k1bn ]; - f1_BN = (D.f[dirTS ])[k1ts ]; - f1_ZERO = (D.f[dirZERO])[k1zero]; - f1_BSW = (D.f[dirTNE ])[k1tne ]; - f1_BNE = (D.f[dirTSW ])[k1tsw ]; - f1_BNW = (D.f[dirTSE ])[k1tse ]; - f1_BSE = (D.f[dirTNW ])[k1tnw ]; - f1_TSW = (D.f[dirBNE ])[k1bne ]; - f1_TNE = (D.f[dirBSW ])[k1bsw ]; - f1_TNW = (D.f[dirBSE ])[k1bse ]; - f1_TSE = (D.f[dirBNW ])[k1bnw ]; - - ////////////////////////////////////////////////////////////////////////// - real drho1 = f1_ZERO+f1_E+f1_W+f1_N+f1_S+f1_T+f1_B+f1_NE+f1_SW+f1_SE+f1_NW+f1_TE+f1_BW+f1_BE+f1_TW+f1_TN+f1_BS+f1_BN+f1_TS+ - f1_TNE+f1_TSW+f1_TSE+f1_TNW+f1_BNE+f1_BSW+f1_BSE+f1_BNW; - real vx1 = ((f1_TSE - f1_BNW) - (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) - (f1_TSW - f1_BNE)) + - ((f1_BE - f1_TW) + (f1_TE - f1_BW)) + ((f1_SE - f1_NW) + (f1_NE - f1_SW)) + - (f1_E - f1_W); + //////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions for neighboring node + //! + real f1_W = (dist.f[DIR_P00 ])[k1e ]; + real f1_E = (dist.f[DIR_M00 ])[k1w ]; + real f1_S = (dist.f[DIR_0P0 ])[k1n ]; + real f1_N = (dist.f[DIR_0M0 ])[k1s ]; + real f1_B = (dist.f[DIR_00P ])[k1t ]; + real f1_T = (dist.f[DIR_00M ])[k1b ]; + real f1_SW = (dist.f[DIR_PP0 ])[k1ne ]; + real f1_NE = (dist.f[DIR_MM0 ])[k1sw ]; + real f1_NW = (dist.f[DIR_PM0 ])[k1se ]; + real f1_SE = (dist.f[DIR_MP0 ])[k1nw ]; + real f1_BW = (dist.f[DIR_P0P ])[k1te ]; + real f1_TE = (dist.f[DIR_M0M ])[k1bw ]; + real f1_TW = (dist.f[DIR_P0M ])[k1be ]; + real f1_BE = (dist.f[DIR_M0P ])[k1tw ]; + real f1_BS = (dist.f[DIR_0PP ])[k1tn ]; + real f1_TN = (dist.f[DIR_0MM ])[k1bs ]; + real f1_TS = (dist.f[DIR_0PM ])[k1bn ]; + real f1_BN = (dist.f[DIR_0MP ])[k1ts ]; + real f1_ZERO = (dist.f[DIR_000])[k1zero]; + real f1_BSW = (dist.f[DIR_PPP ])[k1tne ]; + real f1_BNE = (dist.f[DIR_MMP ])[k1tsw ]; + real f1_BNW = (dist.f[DIR_PMP ])[k1tse ]; + real f1_BSE = (dist.f[DIR_MPP ])[k1tnw ]; + real f1_TSW = (dist.f[DIR_PPM ])[k1bne ]; + real f1_TNE = (dist.f[DIR_MMM ])[k1bsw ]; + real f1_TNW = (dist.f[DIR_PMM ])[k1bse ]; + real f1_TSE = (dist.f[DIR_MPM ])[k1bnw ]; + //////////////////////////////////////////////////////////////////////////////// + //! - Calculate macroscopic quantities (for neighboring node) + //! + real drho1 = f1_TSE + f1_TNW + f1_TNE + f1_TSW + f1_BSE + f1_BNW + f1_BNE + f1_BSW + + f1_BN + f1_TS + f1_TN + f1_BS + f1_BE + f1_TW + f1_TE + f1_BW + f1_SE + f1_NW + f1_NE + f1_SW + + f1_T + f1_B + f1_N + f1_S + f1_E + f1_W + ((dist.f[DIR_000])[kzero]); - real vx2 = (-(f1_TSE - f1_BNW) + (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) - (f1_TSW - f1_BNE)) + - ((f1_BN - f1_TS) + (f1_TN - f1_BS)) + (-(f1_SE - f1_NW) + (f1_NE - f1_SW)) + - (f1_N - f1_S); + real vx1 = (((f1_TSE - f1_BNW) - (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) - (f1_TSW - f1_BNE)) + + ((f1_BE - f1_TW) + (f1_TE - f1_BW)) + ((f1_SE - f1_NW) + (f1_NE - f1_SW)) + + (f1_E - f1_W)) / (c1o1 + drho1); - real vx3 = ((f1_TSE - f1_BNW) + (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) + (f1_TSW - f1_BNE)) + - (-(f1_BN - f1_TS) + (f1_TN - f1_BS)) + ((f1_TE - f1_BW) - (f1_BE - f1_TW)) + - (f1_T - f1_B); + real vx2 = ((-(f1_TSE - f1_BNW) + (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) - (f1_TSW - f1_BNE)) + + ((f1_BN - f1_TS) + (f1_TN - f1_BS)) + (-(f1_SE - f1_NW) + (f1_NE - f1_SW)) + + (f1_N - f1_S)) / (c1o1 + drho1); - vx1 /= (drho1+c1o1); - vx2 /= (drho1+c1o1); - vx3 /= (drho1+c1o1); + real vx3 = (((f1_TSE - f1_BNW) + (f1_TNW - f1_BSE)) + ((f1_TNE - f1_BSW) + (f1_TSW - f1_BNE)) + + (-(f1_BN - f1_TS) + (f1_TN - f1_BS)) + ((f1_TE - f1_BW) - (f1_BE - f1_TW)) + + (f1_T - f1_B)) / (c1o1 + drho1); - real cusq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); + real cusq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3); + //////////////////////////////////////////////////////////////////////////////// + //! subtract the equilibrium (eq) to obtain the non-equilibrium (neq) (for neighboring node) + //! f1_ZERO -= c8o27* (drho1-(drho1+c1o1)*cusq); f1_E -= c2o27* (drho1+(drho1+c1o1)*(c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cusq)); f1_W -= c2o27* (drho1+(drho1+c1o1)*(c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cusq)); @@ -1031,9 +993,15 @@ extern "C" __global__ void QPressDeviceNEQ27(real* rhoBC, f1_BNW -= c1o216*(drho1+(drho1+c1o1)*(c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq)); f1_BSE -= c1o216*(drho1+(drho1+c1o1)*(c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq)); f1_TNW -= c1o216*(drho1+(drho1+c1o1)*(c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq)); - - drho1 = rhoBC[k]; + //////////////////////////////////////////////////////////////////////////////// + //! redefine drho1 with rhoBClocal + //! + drho1 = rhoBClocal; + + //////////////////////////////////////////////////////////////////////////////// + //! add the equilibrium (eq), which is calculated with rhoBClocal (for neighboring node) + //! f1_ZERO += c8o27* (drho1-(drho1+c1o1)*cusq); f1_E += c2o27* (drho1+(drho1+c1o1)*(c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cusq)); f1_W += c2o27* (drho1+(drho1+c1o1)*(c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cusq)); @@ -1062,39 +1030,40 @@ extern "C" __global__ void QPressDeviceNEQ27(real* rhoBC, f1_BSE += c1o216*(drho1+(drho1+c1o1)*(c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq)); f1_TNW += c1o216*(drho1+(drho1+c1o1)*(c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq)); - //drho1 = (drho1 + rhoBC[k])/2.f; - //drho1 = drho1 - rhoBC[k]; ////////////////////////////////////////////////////////////////////////// __syncthreads(); - (D.f[dirE ])[ke ] = f1_W ; - (D.f[dirW ])[kw ] = f1_E ; - (D.f[dirN ])[kn ] = f1_S ; - (D.f[dirS ])[ks ] = f1_N ; - (D.f[dirT ])[kt ] = f1_B ; - (D.f[dirB ])[kb ] = f1_T ; - (D.f[dirNE ])[kne ] = f1_SW ; - (D.f[dirSW ])[ksw ] = f1_NE ; - (D.f[dirSE ])[kse ] = f1_NW ; - (D.f[dirNW ])[knw ] = f1_SE ; - (D.f[dirTE ])[kte ] = f1_BW ; - (D.f[dirBW ])[kbw ] = f1_TE ; - (D.f[dirBE ])[kbe ] = f1_TW ; - (D.f[dirTW ])[ktw ] = f1_BE ; - (D.f[dirTN ])[ktn ] = f1_BS ; - (D.f[dirBS ])[kbs ] = f1_TN ; - (D.f[dirBN ])[kbn ] = f1_TS ; - (D.f[dirTS ])[kts ] = f1_BN ; - (D.f[dirZERO])[kzero] = f1_ZERO; - (D.f[dirTNE ])[ktne ] = f1_BSW ; - (D.f[dirTSW ])[ktsw ] = f1_BNE ; - (D.f[dirTSE ])[ktse ] = f1_BNW ; - (D.f[dirTNW ])[ktnw ] = f1_BSE ; - (D.f[dirBNE ])[kbne ] = f1_TSW ; - (D.f[dirBSW ])[kbsw ] = f1_TNE ; - (D.f[dirBSE ])[kbse ] = f1_TNW ; - (D.f[dirBNW ])[kbnw ] = f1_TSE ; + //////////////////////////////////////////////////////////////////////////////// + //! write the new distributions to the bc nodes + //! + (dist.f[DIR_P00 ])[ke ] = f1_W ; + (dist.f[DIR_M00 ])[kw ] = f1_E ; + (dist.f[DIR_0P0 ])[kn ] = f1_S ; + (dist.f[DIR_0M0 ])[ks ] = f1_N ; + (dist.f[DIR_00P ])[kt ] = f1_B ; + (dist.f[DIR_00M ])[kb ] = f1_T ; + (dist.f[DIR_PP0 ])[kne ] = f1_SW ; + (dist.f[DIR_MM0 ])[ksw ] = f1_NE ; + (dist.f[DIR_PM0 ])[kse ] = f1_NW ; + (dist.f[DIR_MP0 ])[knw ] = f1_SE ; + (dist.f[DIR_P0P ])[kte ] = f1_BW ; + (dist.f[DIR_M0M ])[kbw ] = f1_TE ; + (dist.f[DIR_P0M ])[kbe ] = f1_TW ; + (dist.f[DIR_M0P ])[ktw ] = f1_BE ; + (dist.f[DIR_0PP ])[ktn ] = f1_BS ; + (dist.f[DIR_0MM ])[kbs ] = f1_TN ; + (dist.f[DIR_0PM ])[kbn ] = f1_TS ; + (dist.f[DIR_0MP ])[kts ] = f1_BN ; + (dist.f[DIR_000])[kzero] = f1_ZERO; + (dist.f[DIR_PPP ])[ktne ] = f1_BSW ; + (dist.f[DIR_MMP ])[ktsw ] = f1_BNE ; + (dist.f[DIR_PMP ])[ktse ] = f1_BNW ; + (dist.f[DIR_MPP ])[ktnw ] = f1_BSE ; + (dist.f[DIR_PPM ])[kbne ] = f1_TSW ; + (dist.f[DIR_MMM ])[kbsw ] = f1_TNE ; + (dist.f[DIR_PMM ])[kbse ] = f1_TNW ; + (dist.f[DIR_MPM ])[kbnw ] = f1_TSE ; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1138,7 +1107,7 @@ extern "C" __global__ void QPressDeviceNEQ27(real* rhoBC, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_BC_Press_East27( int nx, +__global__ void LB_BC_Press_East27( int nx, int ny, int tz, unsigned int* bcMatD, @@ -1147,7 +1116,7 @@ extern "C" __global__ void LB_BC_Press_East27( int nx, unsigned int* neighborZ, real* DD, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //thread-index int ty = blockIdx.x; @@ -1166,65 +1135,65 @@ extern "C" __global__ void LB_BC_Press_East27( int nx, if( bcMatD[k] == GEO_PRESS && bcMatD[k1] == GEO_FLUID) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -1343,66 +1312,66 @@ extern "C" __global__ void LB_BC_Press_East27( int nx, real f1_E,f1_W,f1_N,f1_S,f1_T,f1_B,f1_NE,f1_SW,f1_SE,f1_NW,f1_TE,f1_BW,f1_BE,f1_TW,f1_TN,f1_BS,f1_BN,f1_TS,f1_ZERO, f1_TNE,f1_TSW,f1_TSE,f1_TNW,f1_BNE,f1_BSW,f1_BSE,f1_BNW; - f1_W = (D.f[dirE ])[k1e ]; - f1_E = (D.f[dirW ])[k1w ]; - f1_S = (D.f[dirN ])[k1n ]; - f1_N = (D.f[dirS ])[k1s ]; - f1_B = (D.f[dirT ])[k1t ]; - f1_T = (D.f[dirB ])[k1b ]; - f1_SW = (D.f[dirNE ])[k1ne ]; - f1_NE = (D.f[dirSW ])[k1sw ]; - f1_NW = (D.f[dirSE ])[k1se ]; - f1_SE = (D.f[dirNW ])[k1nw ]; - f1_BW = (D.f[dirTE ])[k1te ]; - f1_TE = (D.f[dirBW ])[k1bw ]; - f1_TW = (D.f[dirBE ])[k1be ]; - f1_BE = (D.f[dirTW ])[k1tw ]; - f1_BS = (D.f[dirTN ])[k1tn ]; - f1_TN = (D.f[dirBS ])[k1bs ]; - f1_TS = (D.f[dirBN ])[k1bn ]; - f1_BN = (D.f[dirTS ])[k1ts ]; - f1_ZERO = (D.f[dirZERO])[k1zero]; - f1_BSW = (D.f[dirTNE ])[k1tne ]; - f1_BNE = (D.f[dirTSW ])[k1tsw ]; - f1_BNW = (D.f[dirTSE ])[k1tse ]; - f1_BSE = (D.f[dirTNW ])[k1tnw ]; - f1_TSW = (D.f[dirBNE ])[k1bne ]; - f1_TNE = (D.f[dirBSW ])[k1bsw ]; - f1_TNW = (D.f[dirBSE ])[k1bse ]; - f1_TSE = (D.f[dirBNW ])[k1bnw ]; + f1_W = (D.f[DIR_P00 ])[k1e ]; + f1_E = (D.f[DIR_M00 ])[k1w ]; + f1_S = (D.f[DIR_0P0 ])[k1n ]; + f1_N = (D.f[DIR_0M0 ])[k1s ]; + f1_B = (D.f[DIR_00P ])[k1t ]; + f1_T = (D.f[DIR_00M ])[k1b ]; + f1_SW = (D.f[DIR_PP0 ])[k1ne ]; + f1_NE = (D.f[DIR_MM0 ])[k1sw ]; + f1_NW = (D.f[DIR_PM0 ])[k1se ]; + f1_SE = (D.f[DIR_MP0 ])[k1nw ]; + f1_BW = (D.f[DIR_P0P ])[k1te ]; + f1_TE = (D.f[DIR_M0M ])[k1bw ]; + f1_TW = (D.f[DIR_P0M ])[k1be ]; + f1_BE = (D.f[DIR_M0P ])[k1tw ]; + f1_BS = (D.f[DIR_0PP ])[k1tn ]; + f1_TN = (D.f[DIR_0MM ])[k1bs ]; + f1_TS = (D.f[DIR_0PM ])[k1bn ]; + f1_BN = (D.f[DIR_0MP ])[k1ts ]; + f1_ZERO = (D.f[DIR_000])[k1zero]; + f1_BSW = (D.f[DIR_PPP ])[k1tne ]; + f1_BNE = (D.f[DIR_MMP ])[k1tsw ]; + f1_BNW = (D.f[DIR_PMP ])[k1tse ]; + f1_BSE = (D.f[DIR_MPP ])[k1tnw ]; + f1_TSW = (D.f[DIR_PPM ])[k1bne ]; + f1_TNE = (D.f[DIR_MMM ])[k1bsw ]; + f1_TNW = (D.f[DIR_PMM ])[k1bse ]; + f1_TSE = (D.f[DIR_MPM ])[k1bnw ]; real drho1 = f1_ZERO+f1_E+f1_W+f1_N+f1_S+f1_T+f1_B+f1_NE+f1_SW+f1_SE+f1_NW+f1_TE+f1_BW+f1_BE+f1_TW+f1_TN+f1_BS+f1_BN+f1_TS+ f1_TNE+f1_TSW+f1_TSE+f1_TNW+f1_BNE+f1_BSW+f1_BSE+f1_BNW; __syncthreads(); - (D.f[dirE ])[ke ] = f1_W -c2o27*drho1; - (D.f[dirW ])[kw ] = f1_E -c2o27*drho1; - (D.f[dirN ])[kn ] = f1_S -c2o27*drho1; - (D.f[dirS ])[ks ] = f1_N -c2o27*drho1; - (D.f[dirT ])[kt ] = f1_B -c2o27*drho1; - (D.f[dirB ])[kb ] = f1_T -c2o27*drho1; - (D.f[dirNE ])[kne ] = f1_SW -c1o54*drho1; - (D.f[dirSW ])[ksw ] = f1_NE -c1o54*drho1; - (D.f[dirSE ])[kse ] = f1_NW -c1o54*drho1; - (D.f[dirNW ])[knw ] = f1_SE -c1o54*drho1; - (D.f[dirTE ])[kte ] = f1_BW -c1o54*drho1; - (D.f[dirBW ])[kbw ] = f1_TE -c1o54*drho1; - (D.f[dirBE ])[kbe ] = f1_TW -c1o54*drho1; - (D.f[dirTW ])[ktw ] = f1_BE -c1o54*drho1; - (D.f[dirTN ])[ktn ] = f1_BS -c1o54*drho1; - (D.f[dirBS ])[kbs ] = f1_TN -c1o54*drho1; - (D.f[dirBN ])[kbn ] = f1_TS -c1o54*drho1; - (D.f[dirTS ])[kts ] = f1_BN -c1o54*drho1; - (D.f[dirZERO])[kzero] = f1_ZERO-c8o27*drho1; - (D.f[dirTNE ])[ktne ] = f1_BSW -c1o216*drho1; - (D.f[dirTSW ])[ktsw ] = f1_BNE -c1o216*drho1; - (D.f[dirTSE ])[ktse ] = f1_BNW -c1o216*drho1; - (D.f[dirTNW ])[ktnw ] = f1_BSE -c1o216*drho1; - (D.f[dirBNE ])[kbne ] = f1_TSW -c1o216*drho1; - (D.f[dirBSW ])[kbsw ] = f1_TNE -c1o216*drho1; - (D.f[dirBSE ])[kbse ] = f1_TNW -c1o216*drho1; - (D.f[dirBNW ])[kbnw ] = f1_TSE -c1o216*drho1; + (D.f[DIR_P00 ])[ke ] = f1_W -c2o27*drho1; + (D.f[DIR_M00 ])[kw ] = f1_E -c2o27*drho1; + (D.f[DIR_0P0 ])[kn ] = f1_S -c2o27*drho1; + (D.f[DIR_0M0 ])[ks ] = f1_N -c2o27*drho1; + (D.f[DIR_00P ])[kt ] = f1_B -c2o27*drho1; + (D.f[DIR_00M ])[kb ] = f1_T -c2o27*drho1; + (D.f[DIR_PP0 ])[kne ] = f1_SW -c1o54*drho1; + (D.f[DIR_MM0 ])[ksw ] = f1_NE -c1o54*drho1; + (D.f[DIR_PM0 ])[kse ] = f1_NW -c1o54*drho1; + (D.f[DIR_MP0 ])[knw ] = f1_SE -c1o54*drho1; + (D.f[DIR_P0P ])[kte ] = f1_BW -c1o54*drho1; + (D.f[DIR_M0M ])[kbw ] = f1_TE -c1o54*drho1; + (D.f[DIR_P0M ])[kbe ] = f1_TW -c1o54*drho1; + (D.f[DIR_M0P ])[ktw ] = f1_BE -c1o54*drho1; + (D.f[DIR_0PP ])[ktn ] = f1_BS -c1o54*drho1; + (D.f[DIR_0MM ])[kbs ] = f1_TN -c1o54*drho1; + (D.f[DIR_0PM ])[kbn ] = f1_TS -c1o54*drho1; + (D.f[DIR_0MP ])[kts ] = f1_BN -c1o54*drho1; + (D.f[DIR_000])[kzero] = f1_ZERO-c8o27*drho1; + (D.f[DIR_PPP ])[ktne ] = f1_BSW -c1o216*drho1; + (D.f[DIR_MMP ])[ktsw ] = f1_BNE -c1o216*drho1; + (D.f[DIR_PMP ])[ktse ] = f1_BNW -c1o216*drho1; + (D.f[DIR_MPP ])[ktnw ] = f1_BSE -c1o216*drho1; + (D.f[DIR_PPM ])[kbne ] = f1_TSW -c1o216*drho1; + (D.f[DIR_MMM ])[kbsw ] = f1_TNE -c1o216*drho1; + (D.f[DIR_PMM ])[kbse ] = f1_TNW -c1o216*drho1; + (D.f[DIR_MPM ])[kbnw ] = f1_TSE -c1o216*drho1; } __syncthreads(); } @@ -1447,81 +1416,78 @@ extern "C" __global__ void LB_BC_Press_East27( int nx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressDevice27(int inx, - int iny, - real* rhoBC, +__global__ void QPressDevice27(real* rhoBC, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1534,39 +1500,39 @@ extern "C" __global__ void QPressDevice27(int inx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -1601,32 +1567,32 @@ extern "C" __global__ void QPressDevice27(int inx, real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real q, vx1, vx2, vx3, drho; vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + @@ -1648,247 +1614,247 @@ extern "C" __global__ void QPressDevice27(int inx, drho = rhoBC[k]; //deltaRho = (rhoBC[k] + one) / (deltaRho + one); //////////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirW])[kw]=c2o27* (drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - //(D.f[dirE])[ke]=c2over27* (drho+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq); + (D.f[DIR_M00])[kw]=c2o27* (drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + //(D.f[DIR_P00])[ke]=c2over27* (drho+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq); } q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirE])[ke]=c2o27* (drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - //(D.f[dirW])[kw]=c2over27* (drho+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq); + (D.f[DIR_P00])[ke]=c2o27* (drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + //(D.f[DIR_M00])[kw]=c2over27* (drho+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq); } q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirS])[ks]=c2o27* (drho+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - //(D.f[dirN])[kn]=c2over27* (drho+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq); + (D.f[DIR_0M0])[ks]=c2o27* (drho+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + //(D.f[DIR_0P0])[kn]=c2over27* (drho+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq); } q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirN])[kn]=c2o27* (drho+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - //(D.f[dirS])[ks]=c2over27* (drho+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq); + (D.f[DIR_0P0])[kn]=c2o27* (drho+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + //(D.f[DIR_0M0])[ks]=c2over27* (drho+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq); } q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirB])[kb]=c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - //(D.f[dirT])[kt]=c2over27* (drho+three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq); + (D.f[DIR_00M])[kb]=c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + //(D.f[DIR_00P])[kt]=c2over27* (drho+three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq); } q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirT])[kt]=c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - //(D.f[dirB])[kb]=c2over27* (drho+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq); + (D.f[DIR_00P])[kt]=c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + //(D.f[DIR_00M])[kb]=c2over27* (drho+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq); } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirSW])[ksw]=c1o54* (drho+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - //(D.f[dirNE])[kne]=c1over54* (drho+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + (D.f[DIR_MM0])[ksw]=c1o54* (drho+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + //(D.f[DIR_PP0])[kne]=c1over54* (drho+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirNE])[kne]=c1o54* (drho+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - //(D.f[dirSW])[ksw]=c1over54* (drho+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + (D.f[DIR_PP0])[kne]=c1o54* (drho+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + //(D.f[DIR_MM0])[ksw]=c1over54* (drho+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirNW])[knw]=c1o54* (drho+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - //(D.f[dirSE])[kse]=c1over54* (drho+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + (D.f[DIR_MP0])[knw]=c1o54* (drho+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + //(D.f[DIR_PM0])[kse]=c1over54* (drho+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirSE])[kse]=c1o54* (drho+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - //(D.f[dirNW])[knw]=c1over54* (drho+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + (D.f[DIR_PM0])[kse]=c1o54* (drho+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + //(D.f[DIR_MP0])[knw]=c1over54* (drho+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBW])[kbw]=c1o54* (drho+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - //(D.f[dirTE])[kte]=c1over54* (drho+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + (D.f[DIR_M0M])[kbw]=c1o54* (drho+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + //(D.f[DIR_P0P])[kte]=c1over54* (drho+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTE])[kte]=c1o54* (drho+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - //(D.f[dirBW])[kbw]=c1over54* (drho+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + (D.f[DIR_P0P])[kte]=c1o54* (drho+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + //(D.f[DIR_M0M])[kbw]=c1over54* (drho+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTW])[ktw]=c1o54* (drho+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - //(D.f[dirBE])[kbe]=c1over54* (drho+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + (D.f[DIR_M0P])[ktw]=c1o54* (drho+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + //(D.f[DIR_P0M])[kbe]=c1over54* (drho+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBE])[kbe]=c1o54* (drho+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - //(D.f[dirTW])[ktw]=c1over54* (drho+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + (D.f[DIR_P0M])[kbe]=c1o54* (drho+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + //(D.f[DIR_M0P])[ktw]=c1over54* (drho+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBS])[kbs]=c1o54* (drho+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - //(D.f[dirTN])[ktn]=c1over54* (drho+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq); + (D.f[DIR_0MM])[kbs]=c1o54* (drho+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + //(D.f[DIR_0PP])[ktn]=c1over54* (drho+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq); } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTN])[ktn]=c1o54* (drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - //(D.f[dirBS])[kbs]=c1over54* (drho+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + (D.f[DIR_0PP])[ktn]=c1o54* (drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + //(D.f[DIR_0MM])[kbs]=c1over54* (drho+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTS])[kts]=c1o54* (drho+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - //(D.f[dirBN])[kbn]=c1over54* (drho+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq); + (D.f[DIR_0MP])[kts]=c1o54* (drho+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + //(D.f[DIR_0PM])[kbn]=c1over54* (drho+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq); } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBN])[kbn]=c1o54* (drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - //(D.f[dirTS])[kts]=c1over54* (drho+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + (D.f[DIR_0PM])[kbn]=c1o54* (drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + //(D.f[DIR_0MP])[kts]=c1over54* (drho+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBSW])[kbsw]=c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - //(D.f[dirTNE])[ktne]=c1over216*(drho+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + (D.f[DIR_MMM])[kbsw]=c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + //(D.f[DIR_PPP])[ktne]=c1over216*(drho+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTNE])[ktne]=c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - //(D.f[dirBSW])[kbsw]=c1over216*(drho+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + (D.f[DIR_PPP])[ktne]=c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + //(D.f[DIR_MMM])[kbsw]=c1over216*(drho+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTSW])[ktsw]=c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - //(D.f[dirBNE])[kbne]=c1over216*(drho+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + (D.f[DIR_MMP])[ktsw]=c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + //(D.f[DIR_PPM])[kbne]=c1over216*(drho+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBNE])[kbne]=c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - //(D.f[dirTSW])[ktsw]=c1over216*(drho+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + (D.f[DIR_PPM])[kbne]=c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + //(D.f[DIR_MMP])[ktsw]=c1over216*(drho+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBNW])[kbnw]=c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - //(D.f[dirTSE])[ktse]=c1over216*(drho+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + (D.f[DIR_MPM])[kbnw]=c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + //(D.f[DIR_PMP])[ktse]=c1over216*(drho+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTSE])[ktse]=c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - //(D.f[dirBNW])[kbnw]=c1over216*(drho+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + (D.f[DIR_PMP])[ktse]=c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + //(D.f[DIR_MPM])[kbnw]=c1over216*(drho+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTNW])[ktnw]=c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //(D.f[dirBSE])[kbse]=c1over216*(drho+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + (D.f[DIR_MPP])[ktnw]=c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + //(D.f[DIR_PMM])[kbse]=c1over216*(drho+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBSE])[kbse]=c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - //(D.f[dirTNW])[ktnw]=c1over216*(drho+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + (D.f[DIR_PMM])[kbse]=c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + //(D.f[DIR_MPP])[ktnw]=c1over216*(drho+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); } } } @@ -1933,81 +1899,81 @@ extern "C" __global__ void QPressDevice27(int inx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressDeviceAntiBB27( real* rhoBC, +__global__ void QPressDeviceAntiBB27( real* rhoBC, real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -2020,39 +1986,39 @@ extern "C" __global__ void QPressDeviceAntiBB27( real* rhoBC, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *kQ]; - q_dirW = &QQ[dirW *kQ]; - q_dirN = &QQ[dirN *kQ]; - q_dirS = &QQ[dirS *kQ]; - q_dirT = &QQ[dirT *kQ]; - q_dirB = &QQ[dirB *kQ]; - q_dirNE = &QQ[dirNE *kQ]; - q_dirSW = &QQ[dirSW *kQ]; - q_dirSE = &QQ[dirSE *kQ]; - q_dirNW = &QQ[dirNW *kQ]; - q_dirTE = &QQ[dirTE *kQ]; - q_dirBW = &QQ[dirBW *kQ]; - q_dirBE = &QQ[dirBE *kQ]; - q_dirTW = &QQ[dirTW *kQ]; - q_dirTN = &QQ[dirTN *kQ]; - q_dirBS = &QQ[dirBS *kQ]; - q_dirBN = &QQ[dirBN *kQ]; - q_dirTS = &QQ[dirTS *kQ]; - q_dirTNE = &QQ[dirTNE *kQ]; - q_dirTSW = &QQ[dirTSW *kQ]; - q_dirTSE = &QQ[dirTSE *kQ]; - q_dirTNW = &QQ[dirTNW *kQ]; - q_dirBNE = &QQ[dirBNE *kQ]; - q_dirBSW = &QQ[dirBSW *kQ]; - q_dirBSE = &QQ[dirBSE *kQ]; - q_dirBNW = &QQ[dirBNW *kQ]; + q_dirE = &QQ[DIR_P00 *numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 *numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 *numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 *numberOfBCnodes]; + q_dirT = &QQ[DIR_00P *numberOfBCnodes]; + q_dirB = &QQ[DIR_00M *numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 *numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 *numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 *numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 *numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P *numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M *numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M *numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P *numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP *numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM *numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM *numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP *numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP *numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP *numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP *numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP *numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM *numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM *numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM *numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM *numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -2087,33 +2053,33 @@ extern "C" __global__ void QPressDeviceAntiBB27( real* rhoBC, real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW, f_ZERO; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; - f_ZERO = (D.f[dirZERO])[kzero]; + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; + f_ZERO = (D.f[DIR_000])[kzero]; //////////////////////////////////////////////////////////////////////////////// //real vx1, vx2, vx3, drho; //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + @@ -2139,221 +2105,221 @@ extern "C" __global__ void QPressDeviceAntiBB27( real* rhoBC, real q; //deltaRho = (rhoBC[k] + one) / (deltaRho + one); //////////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirW])[kw]=f_W-c2o27*drho; + (D.f[DIR_M00])[kw]=f_W-c2o27*drho; } q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirE])[ke]=f_E-c2o27*drho; + (D.f[DIR_P00])[ke]=f_E-c2o27*drho; } q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirS])[ks]=f_S-c2o27*drho; + (D.f[DIR_0M0])[ks]=f_S-c2o27*drho; } q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirN])[kn]=f_N-c2o27*drho; + (D.f[DIR_0P0])[kn]=f_N-c2o27*drho; } q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirB])[kb]=f_B-c2o27*drho; + (D.f[DIR_00M])[kb]=f_B-c2o27*drho; } q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirT])[kt]=f_T-c2o27*drho; + (D.f[DIR_00P])[kt]=f_T-c2o27*drho; } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirSW])[ksw]=f_SW-c1o54*drho; + (D.f[DIR_MM0])[ksw]=f_SW-c1o54*drho; } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirNE])[kne]=f_NE-c1o54*drho; + (D.f[DIR_PP0])[kne]=f_NE-c1o54*drho; } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirNW])[knw]=f_NW-c1o54*drho; + (D.f[DIR_MP0])[knw]=f_NW-c1o54*drho; } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirSE])[kse]=f_SE-c1o54*drho; + (D.f[DIR_PM0])[kse]=f_SE-c1o54*drho; } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBW])[kbw]=f_BW-c1o54*drho; + (D.f[DIR_M0M])[kbw]=f_BW-c1o54*drho; } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTE])[kte]=f_TE-c1o54*drho; + (D.f[DIR_P0P])[kte]=f_TE-c1o54*drho; } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTW])[ktw]=f_TW-c1o54*drho; + (D.f[DIR_M0P])[ktw]=f_TW-c1o54*drho; } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBE])[kbe]=f_BE-c1o54*drho; + (D.f[DIR_P0M])[kbe]=f_BE-c1o54*drho; } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBS])[kbs]=f_BS-c1o54*drho; + (D.f[DIR_0MM])[kbs]=f_BS-c1o54*drho; } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTN])[ktn]=f_TN-c1o54*drho; + (D.f[DIR_0PP])[ktn]=f_TN-c1o54*drho; } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTS])[kts]=f_TS-c1o54*drho; + (D.f[DIR_0MP])[kts]=f_TS-c1o54*drho; } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBN])[kbn]=f_BN-c1o54*drho; + (D.f[DIR_0PM])[kbn]=f_BN-c1o54*drho; } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBSW])[kbsw]=f_BSW-c1o216*drho; + (D.f[DIR_MMM])[kbsw]=f_BSW-c1o216*drho; } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTNE])[ktne]=f_TNE-c1o216*drho; + (D.f[DIR_PPP])[ktne]=f_TNE-c1o216*drho; } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTSW])[ktsw]=f_TSW-c1o216*drho; + (D.f[DIR_MMP])[ktsw]=f_TSW-c1o216*drho; } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBNE])[kbne]=f_BNE-c1o216*drho; + (D.f[DIR_PPM])[kbne]=f_BNE-c1o216*drho; } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBNW])[kbnw]=f_BNW-c1o216*drho; + (D.f[DIR_MPM])[kbnw]=f_BNW-c1o216*drho; } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTSE])[ktse]=f_TSE-c1o216*drho; + (D.f[DIR_PMP])[ktse]=f_TSE-c1o216*drho; } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirTNW])[ktnw]=f_TNW-c1o216*drho; + (D.f[DIR_MPP])[ktnw]=f_TNW-c1o216*drho; } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { - (D.f[dirBSE])[kbse]=f_BSE-c1o216*drho; + (D.f[DIR_PMM])[kbse]=f_BSE-c1o216*drho; } } } @@ -2398,16 +2364,16 @@ extern "C" __global__ void QPressDeviceAntiBB27( real* rhoBC, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressDeviceFixBackflow27( real* rhoBC, +__global__ void QPressDeviceFixBackflow27( real* rhoBC, real* DD, int* k_Q, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -2420,7 +2386,7 @@ extern "C" __global__ void QPressDeviceFixBackflow27( real* rhoBC, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -2458,94 +2424,94 @@ extern "C" __global__ void QPressDeviceFixBackflow27( real* rhoBC, deltaRho = rhoBC[k]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (D.f[dirW])[kw] = c2o27 * deltaRho; - (D.f[dirE])[ke] = c2o27 * deltaRho; - (D.f[dirS])[ks] = c2o27 * deltaRho; - (D.f[dirN])[kn] = c2o27 * deltaRho; - (D.f[dirB])[kb] = c2o27 * deltaRho; - (D.f[dirT])[kt] = c2o27 * deltaRho; - (D.f[dirSW])[ksw] = c1o54 * deltaRho; - (D.f[dirNE])[kne] = c1o54 * deltaRho; - (D.f[dirNW])[knw] = c1o54 * deltaRho; - (D.f[dirSE])[kse] = c1o54 * deltaRho; - (D.f[dirBW])[kbw] = c1o54 * deltaRho; - (D.f[dirTE])[kte] = c1o54 * deltaRho; - (D.f[dirTW])[ktw] = c1o54 * deltaRho; - (D.f[dirBE])[kbe] = c1o54 * deltaRho; - (D.f[dirBS])[kbs] = c1o54 * deltaRho; - (D.f[dirTN])[ktn] = c1o54 * deltaRho; - (D.f[dirTS])[kts] = c1o54 * deltaRho; - (D.f[dirBN])[kbn] = c1o54 * deltaRho; - (D.f[dirBSW])[kbsw] = c1o216 * deltaRho; - (D.f[dirTNE])[ktne] = c1o216 * deltaRho; - (D.f[dirTSW])[ktsw] = c1o216 * deltaRho; - (D.f[dirBNE])[kbne] = c1o216 * deltaRho; - (D.f[dirBNW])[kbnw] = c1o216 * deltaRho; - (D.f[dirTSE])[ktse] = c1o216 * deltaRho; - (D.f[dirTNW])[ktnw] = c1o216 * deltaRho; - (D.f[dirBSE])[kbse] = c1o216 * deltaRho; - (D.f[dirZERO])[kzero] = c8o27 * deltaRho; + (D.f[DIR_M00])[kw] = c2o27 * deltaRho; + (D.f[DIR_P00])[ke] = c2o27 * deltaRho; + (D.f[DIR_0M0])[ks] = c2o27 * deltaRho; + (D.f[DIR_0P0])[kn] = c2o27 * deltaRho; + (D.f[DIR_00M])[kb] = c2o27 * deltaRho; + (D.f[DIR_00P])[kt] = c2o27 * deltaRho; + (D.f[DIR_MM0])[ksw] = c1o54 * deltaRho; + (D.f[DIR_PP0])[kne] = c1o54 * deltaRho; + (D.f[DIR_MP0])[knw] = c1o54 * deltaRho; + (D.f[DIR_PM0])[kse] = c1o54 * deltaRho; + (D.f[DIR_M0M])[kbw] = c1o54 * deltaRho; + (D.f[DIR_P0P])[kte] = c1o54 * deltaRho; + (D.f[DIR_M0P])[ktw] = c1o54 * deltaRho; + (D.f[DIR_P0M])[kbe] = c1o54 * deltaRho; + (D.f[DIR_0MM])[kbs] = c1o54 * deltaRho; + (D.f[DIR_0PP])[ktn] = c1o54 * deltaRho; + (D.f[DIR_0MP])[kts] = c1o54 * deltaRho; + (D.f[DIR_0PM])[kbn] = c1o54 * deltaRho; + (D.f[DIR_MMM])[kbsw] = c1o216 * deltaRho; + (D.f[DIR_PPP])[ktne] = c1o216 * deltaRho; + (D.f[DIR_MMP])[ktsw] = c1o216 * deltaRho; + (D.f[DIR_PPM])[kbne] = c1o216 * deltaRho; + (D.f[DIR_MPM])[kbnw] = c1o216 * deltaRho; + (D.f[DIR_PMP])[ktse] = c1o216 * deltaRho; + (D.f[DIR_MPP])[ktnw] = c1o216 * deltaRho; + (D.f[DIR_PMM])[kbse] = c1o216 * deltaRho; + (D.f[DIR_000])[kzero] = c8o27 * deltaRho; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -2589,16 +2555,16 @@ extern "C" __global__ void QPressDeviceFixBackflow27( real* rhoBC, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressDeviceDirDepBot27( real* rhoBC, +__global__ void QPressDeviceDirDepBot27( real* rhoBC, real* DD, int* k_Q, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -2611,7 +2577,7 @@ extern "C" __global__ void QPressDeviceDirDepBot27( real* rhoBC, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -2649,88 +2615,88 @@ extern "C" __global__ void QPressDeviceDirDepBot27( real* rhoBC, rho = rhoBC[k]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real f_E,f_W,f_N,f_S,f_T,f_NE,f_SW,f_SE,f_NW,f_TE,f_TW,f_TN,f_TS,f_ZERO,f_TNE,f_TSW,f_TSE,f_TNW;//, //f_B,f_BW,f_BE,f_BS,f_BN,f_BSW,f_BNE,f_BNW,f_BSE; - f_E = (D.f[dirE ])[ke ]; - f_W = (D.f[dirW ])[kw ]; - f_N = (D.f[dirN ])[kn ]; - f_S = (D.f[dirS ])[ks ]; - f_T = (D.f[dirT ])[kt ]; - f_NE = (D.f[dirNE ])[kne ]; - f_SW = (D.f[dirSW ])[ksw ]; - f_SE = (D.f[dirSE ])[kse ]; - f_NW = (D.f[dirNW ])[knw ]; - f_TE = (D.f[dirTE ])[kte ]; - f_TW = (D.f[dirTW ])[ktw ]; - f_TN = (D.f[dirTN ])[ktn ]; - f_TS = (D.f[dirTS ])[kts ]; - f_ZERO = (D.f[dirZERO])[kzero]; - f_TNE = (D.f[dirTNE ])[ktne ]; - f_TSW = (D.f[dirTSW ])[ktsw ]; - f_TSE = (D.f[dirTSE ])[ktse ]; - f_TNW = (D.f[dirTNW ])[ktnw ]; + f_E = (D.f[DIR_P00 ])[ke ]; + f_W = (D.f[DIR_M00 ])[kw ]; + f_N = (D.f[DIR_0P0 ])[kn ]; + f_S = (D.f[DIR_0M0 ])[ks ]; + f_T = (D.f[DIR_00P ])[kt ]; + f_NE = (D.f[DIR_PP0 ])[kne ]; + f_SW = (D.f[DIR_MM0 ])[ksw ]; + f_SE = (D.f[DIR_PM0 ])[kse ]; + f_NW = (D.f[DIR_MP0 ])[knw ]; + f_TE = (D.f[DIR_P0P ])[kte ]; + f_TW = (D.f[DIR_M0P ])[ktw ]; + f_TN = (D.f[DIR_0PP ])[ktn ]; + f_TS = (D.f[DIR_0MP ])[kts ]; + f_ZERO = (D.f[DIR_000])[kzero]; + f_TNE = (D.f[DIR_PPP ])[ktne ]; + f_TSW = (D.f[DIR_MMP ])[ktsw ]; + f_TSE = (D.f[DIR_PMP ])[ktse ]; + f_TNW = (D.f[DIR_MPP ])[ktnw ]; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //f_B = (four*rho- four*f_SW- eight*f_TSW-four*f_W- eight*f_TW- four*f_NW- eight*f_TNW-four*f_S- eight*f_TS-four*f_ZERO+ f_T-four*f_N- eight*f_TN- four*f_SE- eight*f_TSE-four*f_E- eight*f_TE- four*f_NE- eight*f_TNE)/nine; @@ -2750,44 +2716,44 @@ extern "C" __global__ void QPressDeviceDirDepBot27( real* rhoBC, //real cusq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - //(D.f[dirZERO])[kzero] = c8over27* (drho-cusq); - //(D.f[dirE])[ke] = c2over27* (drho+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cusq); - //(D.f[dirW])[kw] = c2over27* (drho+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cusq); - //(D.f[dirN])[kn] = c2over27* (drho+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cusq); - //(D.f[dirS])[ks] = c2over27* (drho+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cusq); - //(D.f[dirT])[kt] = c2over27* (drho+three*( vx3)+c9over2*( vx3)*( vx3)-cusq); - //(D.f[dirB])[kb] = c2over27* (drho+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cusq); - //(D.f[dirNE])[kne] = c1over54* (drho+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cusq); - //(D.f[dirSW])[ksw] = c1over54* (drho+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cusq); - //(D.f[dirSE])[kse] = c1over54* (drho+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cusq); - //(D.f[dirNW])[knw] = c1over54* (drho+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cusq); - //(D.f[dirTE])[kte] = c1over54* (drho+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cusq); - //(D.f[dirBW])[kbw] = c1over54* (drho+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cusq); - //(D.f[dirBE])[kbe] = c1over54* (drho+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cusq); - //(D.f[dirTW])[ktw] = c1over54* (drho+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cusq); - //(D.f[dirTN])[ktn] = c1over54* (drho+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cusq); - //(D.f[dirBS])[kbs] = c1over54* (drho+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cusq); - //(D.f[dirBN])[kbn] = c1over54* (drho+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cusq); - //(D.f[dirTS])[kts] = c1over54* (drho+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cusq); - //(D.f[dirTNE])[ktne] = c1over216*(drho+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cusq); - //(D.f[dirBSW])[kbsw] = c1over216*(drho+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cusq); - //(D.f[dirBNE])[kbne] = c1over216*(drho+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cusq); - //(D.f[dirTSW])[ktsw] = c1over216*(drho+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cusq); - //(D.f[dirTSE])[ktse] = c1over216*(drho+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cusq); - //(D.f[dirBNW])[kbnw] = c1over216*(drho+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq); - //(D.f[dirBSE])[kbse] = c1over216*(drho+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq); - //(D.f[dirTNW])[ktnw] = c1over216*(drho+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq); + //(D.f[DIR_000])[kzero] = c8over27* (drho-cusq); + //(D.f[DIR_P00])[ke] = c2over27* (drho+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cusq); + //(D.f[DIR_M00])[kw] = c2over27* (drho+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cusq); + //(D.f[DIR_0P0])[kn] = c2over27* (drho+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cusq); + //(D.f[DIR_0M0])[ks] = c2over27* (drho+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cusq); + //(D.f[DIR_00P])[kt] = c2over27* (drho+three*( vx3)+c9over2*( vx3)*( vx3)-cusq); + //(D.f[DIR_00M])[kb] = c2over27* (drho+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cusq); + //(D.f[DIR_PP0])[kne] = c1over54* (drho+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cusq); + //(D.f[DIR_MM0])[ksw] = c1over54* (drho+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cusq); + //(D.f[DIR_PM0])[kse] = c1over54* (drho+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cusq); + //(D.f[DIR_MP0])[knw] = c1over54* (drho+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cusq); + //(D.f[DIR_P0P])[kte] = c1over54* (drho+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cusq); + //(D.f[DIR_M0M])[kbw] = c1over54* (drho+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cusq); + //(D.f[DIR_P0M])[kbe] = c1over54* (drho+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cusq); + //(D.f[DIR_M0P])[ktw] = c1over54* (drho+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cusq); + //(D.f[DIR_0PP])[ktn] = c1over54* (drho+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cusq); + //(D.f[DIR_0MM])[kbs] = c1over54* (drho+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cusq); + //(D.f[DIR_0PM])[kbn] = c1over54* (drho+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cusq); + //(D.f[DIR_0MP])[kts] = c1over54* (drho+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cusq); + //(D.f[DIR_PPP])[ktne] = c1over216*(drho+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cusq); + //(D.f[DIR_MMM])[kbsw] = c1over216*(drho+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cusq); + //(D.f[DIR_PPM])[kbne] = c1over216*(drho+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cusq); + //(D.f[DIR_MMP])[ktsw] = c1over216*(drho+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cusq); + //(D.f[DIR_PMP])[ktse] = c1over216*(drho+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cusq); + //(D.f[DIR_MPM])[kbnw] = c1over216*(drho+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq); + //(D.f[DIR_PMM])[kbse] = c1over216*(drho+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq); + //(D.f[DIR_MPP])[ktnw] = c1over216*(drho+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq); real drho = f_ZERO+f_E+f_W+f_N+f_S+f_T+f_NE+f_SW+f_SE+f_NW+f_TE+f_TW+f_TN+f_TS+f_TNE+f_TSW+f_TSE+f_TNW; real dTop = f_T+f_TE+f_TW+f_TN+f_TS+f_TNE+f_TSW+f_TSE+f_TNW; - (D.f[dirB])[kb] = (f_T+c2o27)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c2o27; - (D.f[dirBW])[kbw] = (f_TW+c1o54)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o54; - (D.f[dirBE])[kbe] = (f_TE+c1o54)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o54; - (D.f[dirBS])[kbs] = (f_TS+c1o54)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o54; - (D.f[dirBN])[kbn] = (f_TN+c1o54)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o54; - (D.f[dirBSW])[kbsw] = (f_TSW+c1o216)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o216; - (D.f[dirBNE])[kbne] = (f_TNE+c1o216)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o216; - (D.f[dirBNW])[kbnw] = (f_TNW+c1o216)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o216; - (D.f[dirBSE])[kbse] = (f_TSE+c1o216)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o216; + (D.f[DIR_00M])[kb] = (f_T+c2o27)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c2o27; + (D.f[DIR_M0M])[kbw] = (f_TW+c1o54)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o54; + (D.f[DIR_P0M])[kbe] = (f_TE+c1o54)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o54; + (D.f[DIR_0MM])[kbs] = (f_TS+c1o54)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o54; + (D.f[DIR_0PM])[kbn] = (f_TN+c1o54)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o54; + (D.f[DIR_MMM])[kbsw] = (f_TSW+c1o216)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o216; + (D.f[DIR_PPM])[kbne] = (f_TNE+c1o216)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o216; + (D.f[DIR_MPM])[kbnw] = (f_TNW+c1o216)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o216; + (D.f[DIR_PMM])[kbse] = (f_TSE+c1o216)*(rho-drho+c1o1/c6o1)/(dTop+c1o1/c6o1)-c1o216; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -2831,17 +2797,17 @@ extern "C" __global__ void QPressDeviceDirDepBot27( real* rhoBC, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressNoRhoDevice27( real* rhoBC, +__global__ void QPressNoRhoDevice27( real* rhoBC, real* DD, int* k_Q, int* k_N, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -2854,7 +2820,7 @@ extern "C" __global__ void QPressNoRhoDevice27( real* rhoBC, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -2918,122 +2884,122 @@ extern "C" __global__ void QPressNoRhoDevice27( real* rhoBC, unsigned int k1bsw = neighborZ[k1sw]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real f1_E = (D.f[dirE ])[k1e ]; - real f1_W = (D.f[dirW ])[k1w ]; - real f1_N = (D.f[dirN ])[k1n ]; - real f1_S = (D.f[dirS ])[k1s ]; - real f1_T = (D.f[dirT ])[k1t ]; - real f1_B = (D.f[dirB ])[k1b ]; - real f1_NE = (D.f[dirNE ])[k1ne ]; - real f1_SW = (D.f[dirSW ])[k1sw ]; - real f1_SE = (D.f[dirSE ])[k1se ]; - real f1_NW = (D.f[dirNW ])[k1nw ]; - real f1_TE = (D.f[dirTE ])[k1te ]; - real f1_BW = (D.f[dirBW ])[k1bw ]; - real f1_BE = (D.f[dirBE ])[k1be ]; - real f1_TW = (D.f[dirTW ])[k1tw ]; - real f1_TN = (D.f[dirTN ])[k1tn ]; - real f1_BS = (D.f[dirBS ])[k1bs ]; - real f1_BN = (D.f[dirBN ])[k1bn ]; - real f1_TS = (D.f[dirTS ])[k1ts ]; - //real f1_ZERO = (D.f[dirZERO])[k1zero]; - real f1_TNE = (D.f[dirTNE ])[k1tne ]; - real f1_TSW = (D.f[dirTSW ])[k1tsw ]; - real f1_TSE = (D.f[dirTSE ])[k1tse ]; - real f1_TNW = (D.f[dirTNW ])[k1tnw ]; - real f1_BNE = (D.f[dirBNE ])[k1bne ]; - real f1_BSW = (D.f[dirBSW ])[k1bsw ]; - real f1_BSE = (D.f[dirBSE ])[k1bse ]; - real f1_BNW = (D.f[dirBNW ])[k1bnw ]; + real f1_E = (D.f[DIR_P00 ])[k1e ]; + real f1_W = (D.f[DIR_M00 ])[k1w ]; + real f1_N = (D.f[DIR_0P0 ])[k1n ]; + real f1_S = (D.f[DIR_0M0 ])[k1s ]; + real f1_T = (D.f[DIR_00P ])[k1t ]; + real f1_B = (D.f[DIR_00M ])[k1b ]; + real f1_NE = (D.f[DIR_PP0 ])[k1ne ]; + real f1_SW = (D.f[DIR_MM0 ])[k1sw ]; + real f1_SE = (D.f[DIR_PM0 ])[k1se ]; + real f1_NW = (D.f[DIR_MP0 ])[k1nw ]; + real f1_TE = (D.f[DIR_P0P ])[k1te ]; + real f1_BW = (D.f[DIR_M0M ])[k1bw ]; + real f1_BE = (D.f[DIR_P0M ])[k1be ]; + real f1_TW = (D.f[DIR_M0P ])[k1tw ]; + real f1_TN = (D.f[DIR_0PP ])[k1tn ]; + real f1_BS = (D.f[DIR_0MM ])[k1bs ]; + real f1_BN = (D.f[DIR_0PM ])[k1bn ]; + real f1_TS = (D.f[DIR_0MP ])[k1ts ]; + //real f1_ZERO = (D.f[DIR_000])[k1zero]; + real f1_TNE = (D.f[DIR_PPP ])[k1tne ]; + real f1_TSW = (D.f[DIR_MMP ])[k1tsw ]; + real f1_TSE = (D.f[DIR_PMP ])[k1tse ]; + real f1_TNW = (D.f[DIR_MPP ])[k1tnw ]; + real f1_BNE = (D.f[DIR_PPM ])[k1bne ]; + real f1_BSW = (D.f[DIR_MMM ])[k1bsw ]; + real f1_BSE = (D.f[DIR_PMM ])[k1bse ]; + real f1_BNW = (D.f[DIR_MPM ])[k1bnw ]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real f_E = (D.f[dirE ])[ke ]; - real f_W = (D.f[dirW ])[kw ]; - real f_N = (D.f[dirN ])[kn ]; - real f_S = (D.f[dirS ])[ks ]; - real f_T = (D.f[dirT ])[kt ]; - real f_B = (D.f[dirB ])[kb ]; - real f_NE = (D.f[dirNE ])[kne ]; - real f_SW = (D.f[dirSW ])[ksw ]; - real f_SE = (D.f[dirSE ])[kse ]; - real f_NW = (D.f[dirNW ])[knw ]; - real f_TE = (D.f[dirTE ])[kte ]; - real f_BW = (D.f[dirBW ])[kbw ]; - real f_BE = (D.f[dirBE ])[kbe ]; - real f_TW = (D.f[dirTW ])[ktw ]; - real f_TN = (D.f[dirTN ])[ktn ]; - real f_BS = (D.f[dirBS ])[kbs ]; - real f_BN = (D.f[dirBN ])[kbn ]; - real f_TS = (D.f[dirTS ])[kts ]; - //real f_ZERO = (D.f[dirZERO])[kzero]; - real f_TNE = (D.f[dirTNE ])[ktne ]; - real f_TSW = (D.f[dirTSW ])[ktsw ]; - real f_TSE = (D.f[dirTSE ])[ktse ]; - real f_TNW = (D.f[dirTNW ])[ktnw ]; - real f_BNE = (D.f[dirBNE ])[kbne ]; - real f_BSW = (D.f[dirBSW ])[kbsw ]; - real f_BSE = (D.f[dirBSE ])[kbse ]; - real f_BNW = (D.f[dirBNW ])[kbnw ]; + real f_E = (D.f[DIR_P00 ])[ke ]; + real f_W = (D.f[DIR_M00 ])[kw ]; + real f_N = (D.f[DIR_0P0 ])[kn ]; + real f_S = (D.f[DIR_0M0 ])[ks ]; + real f_T = (D.f[DIR_00P ])[kt ]; + real f_B = (D.f[DIR_00M ])[kb ]; + real f_NE = (D.f[DIR_PP0 ])[kne ]; + real f_SW = (D.f[DIR_MM0 ])[ksw ]; + real f_SE = (D.f[DIR_PM0 ])[kse ]; + real f_NW = (D.f[DIR_MP0 ])[knw ]; + real f_TE = (D.f[DIR_P0P ])[kte ]; + real f_BW = (D.f[DIR_M0M ])[kbw ]; + real f_BE = (D.f[DIR_P0M ])[kbe ]; + real f_TW = (D.f[DIR_M0P ])[ktw ]; + real f_TN = (D.f[DIR_0PP ])[ktn ]; + real f_BS = (D.f[DIR_0MM ])[kbs ]; + real f_BN = (D.f[DIR_0PM ])[kbn ]; + real f_TS = (D.f[DIR_0MP ])[kts ]; + //real f_ZERO = (D.f[DIR_000])[kzero]; + real f_TNE = (D.f[DIR_PPP ])[ktne ]; + real f_TSW = (D.f[DIR_MMP ])[ktsw ]; + real f_TSE = (D.f[DIR_PMP ])[ktse ]; + real f_TNW = (D.f[DIR_MPP ])[ktnw ]; + real f_BNE = (D.f[DIR_PPM ])[kbne ]; + real f_BSW = (D.f[DIR_MMM ])[kbsw ]; + real f_BSE = (D.f[DIR_PMM ])[kbse ]; + real f_BNW = (D.f[DIR_MPM ])[kbnw ]; ////////////////////////////////////////////////////////////////////////// //real vx1, vx2, vx3, drho; @@ -3042,10 +3008,10 @@ extern "C" __global__ void QPressNoRhoDevice27( real* rhoBC, //Dichte // drho1 = f1_TSE + f1_TNW + f1_TNE + f1_TSW + f1_BSE + f1_BNW + f1_BNE + f1_BSW + // f1_BN + f1_TS + f1_TN + f1_BS + f1_BE + f1_TW + f1_TE + f1_BW + f1_SE + f1_NW + f1_NE + f1_SW + - // f1_T + f1_B + f1_N + f1_S + f1_E + f1_W + ((D.f[dirZERO])[k1zero]); + // f1_T + f1_B + f1_N + f1_S + f1_E + f1_W + ((D.f[DIR_000])[k1zero]); // drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + // f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - // f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + // f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); ////////////////////////////////////////////////////////////////////////// //Ux @@ -3202,108 +3168,108 @@ extern "C" __global__ void QPressNoRhoDevice27( real* rhoBC, ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////// //__syncthreads(); // -X - //(D.f[dirE ])[ke ] = f_E ; - //(D.f[dirSE ])[kse ] = f_SE ; - //(D.f[dirNE ])[kne ] = f_NE ; - //(D.f[dirBE ])[kbe ] = f_BE ; - //(D.f[dirTE ])[kte ] = f_TE ; - //(D.f[dirTSE ])[ktse ] = f_TSE ; - //(D.f[dirTNE ])[ktne ] = f_TNE ; - //(D.f[dirBSE ])[kbse ] = f_BSE ; - //(D.f[dirBNE ])[kbne ] = f_BNE ; + //(D.f[DIR_P00 ])[ke ] = f_E ; + //(D.f[DIR_PM0 ])[kse ] = f_SE ; + //(D.f[DIR_PP0 ])[kne ] = f_NE ; + //(D.f[DIR_P0M ])[kbe ] = f_BE ; + //(D.f[DIR_P0P ])[kte ] = f_TE ; + //(D.f[DIR_PMP ])[ktse ] = f_TSE ; + //(D.f[DIR_PPP ])[ktne ] = f_TNE ; + //(D.f[DIR_PMM ])[kbse ] = f_BSE ; + //(D.f[DIR_PPM ])[kbne ] = f_BNE ; // X - (D.f[dirW ])[kw ] = f_W ; - (D.f[dirSW ])[ksw ] = f_SW ; - (D.f[dirNW ])[knw ] = f_NW ; - (D.f[dirBW ])[kbw ] = f_BW ; - (D.f[dirTW ])[ktw ] = f_TW ; - (D.f[dirTSW ])[ktsw ] = f_TSW ; - (D.f[dirTNW ])[ktnw ] = f_TNW ; - (D.f[dirBSW ])[kbsw ] = f_BSW ; - (D.f[dirBNW ])[kbnw ] = f_BNW ; + (D.f[DIR_M00 ])[kw ] = f_W ; + (D.f[DIR_MM0 ])[ksw ] = f_SW ; + (D.f[DIR_MP0 ])[knw ] = f_NW ; + (D.f[DIR_M0M ])[kbw ] = f_BW ; + (D.f[DIR_M0P ])[ktw ] = f_TW ; + (D.f[DIR_MMP ])[ktsw ] = f_TSW ; + (D.f[DIR_MPP ])[ktnw ] = f_TNW ; + (D.f[DIR_MMM ])[kbsw ] = f_BSW ; + (D.f[DIR_MPM ])[kbnw ] = f_BNW ; // Y - //(D.f[dirS ])[ks ] = f_S ; - //(D.f[dirSE ])[kse ] = f_SE ; - //(D.f[dirSW ])[ksw ] = f_SW ; - //(D.f[dirTS ])[kts ] = f_TS ; - //(D.f[dirBS ])[kbs ] = f_BS ; - //(D.f[dirTSE ])[ktse ] = f_TSE ; - //(D.f[dirTSW ])[ktsw ] = f_TSW ; - //(D.f[dirBSE ])[kbse ] = f_BSE ; - //(D.f[dirBSW ])[kbsw ] = f_BSW ; + //(D.f[DIR_0M0 ])[ks ] = f_S ; + //(D.f[DIR_PM0 ])[kse ] = f_SE ; + //(D.f[DIR_MM0 ])[ksw ] = f_SW ; + //(D.f[DIR_0MP ])[kts ] = f_TS ; + //(D.f[DIR_0MM ])[kbs ] = f_BS ; + //(D.f[DIR_PMP ])[ktse ] = f_TSE ; + //(D.f[DIR_MMP ])[ktsw ] = f_TSW ; + //(D.f[DIR_PMM ])[kbse ] = f_BSE ; + //(D.f[DIR_MMM ])[kbsw ] = f_BSW ; // Z - //(D.f[dirB ])[kb ] = f_B ; - //(D.f[dirBE ])[kbe ] = f_BE ; - //(D.f[dirBW ])[kbw ] = f_BW ; - //(D.f[dirBN ])[kbn ] = f_BN ; - //(D.f[dirBS ])[kbs ] = f_BS ; - //(D.f[dirBNE ])[kbne ] = f_BNE ; - //(D.f[dirBNW ])[kbnw ] = f_BNW ; - //(D.f[dirBSE ])[kbse ] = f_BSE ; - //(D.f[dirBSW ])[kbsw ] = f_BSW ; + //(D.f[DIR_00M ])[kb ] = f_B ; + //(D.f[DIR_P0M ])[kbe ] = f_BE ; + //(D.f[DIR_M0M ])[kbw ] = f_BW ; + //(D.f[DIR_0PM ])[kbn ] = f_BN ; + //(D.f[DIR_0MM ])[kbs ] = f_BS ; + //(D.f[DIR_PPM ])[kbne ] = f_BNE ; + //(D.f[DIR_MPM ])[kbnw ] = f_BNW ; + //(D.f[DIR_PMM ])[kbse ] = f_BSE ; + //(D.f[DIR_MMM ])[kbsw ] = f_BSW ; ////////////////////////////////////////////////////////////////////////// } } @@ -3348,17 +3314,17 @@ extern "C" __global__ void QPressNoRhoDevice27( real* rhoBC, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressDeviceOld27(real* rhoBC, +__global__ void QPressDeviceOld27(real* rhoBC, real* DD, int* k_Q, int* k_N, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -3371,7 +3337,7 @@ extern "C" __global__ void QPressDeviceOld27(real* rhoBC, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -3435,97 +3401,97 @@ extern "C" __global__ void QPressDeviceOld27(real* rhoBC, unsigned int k1bsw = neighborZ[k1sw]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real f1_E,f1_W,f1_N,f1_S,f1_T,f1_B,f1_NE,f1_SW,f1_SE,f1_NW,f1_TE,f1_BW,f1_BE,f1_TW,f1_TN,f1_BS,f1_BN,f1_TS,f1_ZERO, f1_TNE,f1_TSW,f1_TSE,f1_TNW,f1_BNE,f1_BSW,f1_BSE,f1_BNW; - f1_W = (D.f[dirE ])[k1e ]; - f1_E = (D.f[dirW ])[k1w ]; - f1_S = (D.f[dirN ])[k1n ]; - f1_N = (D.f[dirS ])[k1s ]; - f1_B = (D.f[dirT ])[k1t ]; - f1_T = (D.f[dirB ])[k1b ]; - f1_SW = (D.f[dirNE ])[k1ne ]; - f1_NE = (D.f[dirSW ])[k1sw ]; - f1_NW = (D.f[dirSE ])[k1se ]; - f1_SE = (D.f[dirNW ])[k1nw ]; - f1_BW = (D.f[dirTE ])[k1te ]; - f1_TE = (D.f[dirBW ])[k1bw ]; - f1_TW = (D.f[dirBE ])[k1be ]; - f1_BE = (D.f[dirTW ])[k1tw ]; - f1_BS = (D.f[dirTN ])[k1tn ]; - f1_TN = (D.f[dirBS ])[k1bs ]; - f1_TS = (D.f[dirBN ])[k1bn ]; - f1_BN = (D.f[dirTS ])[k1ts ]; - f1_ZERO = (D.f[dirZERO])[k1zero]; - f1_BSW = (D.f[dirTNE ])[k1tne ]; - f1_BNE = (D.f[dirTSW ])[k1tsw ]; - f1_BNW = (D.f[dirTSE ])[k1tse ]; - f1_BSE = (D.f[dirTNW ])[k1tnw ]; - f1_TSW = (D.f[dirBNE ])[k1bne ]; - f1_TNE = (D.f[dirBSW ])[k1bsw ]; - f1_TNW = (D.f[dirBSE ])[k1bse ]; - f1_TSE = (D.f[dirBNW ])[k1bnw ]; + f1_W = (D.f[DIR_P00 ])[k1e ]; + f1_E = (D.f[DIR_M00 ])[k1w ]; + f1_S = (D.f[DIR_0P0 ])[k1n ]; + f1_N = (D.f[DIR_0M0 ])[k1s ]; + f1_B = (D.f[DIR_00P ])[k1t ]; + f1_T = (D.f[DIR_00M ])[k1b ]; + f1_SW = (D.f[DIR_PP0 ])[k1ne ]; + f1_NE = (D.f[DIR_MM0 ])[k1sw ]; + f1_NW = (D.f[DIR_PM0 ])[k1se ]; + f1_SE = (D.f[DIR_MP0 ])[k1nw ]; + f1_BW = (D.f[DIR_P0P ])[k1te ]; + f1_TE = (D.f[DIR_M0M ])[k1bw ]; + f1_TW = (D.f[DIR_P0M ])[k1be ]; + f1_BE = (D.f[DIR_M0P ])[k1tw ]; + f1_BS = (D.f[DIR_0PP ])[k1tn ]; + f1_TN = (D.f[DIR_0MM ])[k1bs ]; + f1_TS = (D.f[DIR_0PM ])[k1bn ]; + f1_BN = (D.f[DIR_0MP ])[k1ts ]; + f1_ZERO = (D.f[DIR_000])[k1zero]; + f1_BSW = (D.f[DIR_PPP ])[k1tne ]; + f1_BNE = (D.f[DIR_MMP ])[k1tsw ]; + f1_BNW = (D.f[DIR_PMP ])[k1tse ]; + f1_BSE = (D.f[DIR_MPP ])[k1tnw ]; + f1_TSW = (D.f[DIR_PPM ])[k1bne ]; + f1_TNE = (D.f[DIR_MMM ])[k1bsw ]; + f1_TNW = (D.f[DIR_PMM ])[k1bse ]; + f1_TSE = (D.f[DIR_MPM ])[k1bnw ]; ////////////////////////////////////////////////////////////////////////// real drho1 = f1_ZERO+f1_E+f1_W+f1_N+f1_S+f1_T+f1_B+f1_NE+f1_SW+f1_SE+f1_NW+f1_TE+f1_BW+f1_BE+f1_TW+f1_TN+f1_BS+f1_BN+f1_TS+ @@ -3537,33 +3503,33 @@ extern "C" __global__ void QPressDeviceOld27(real* rhoBC, __syncthreads(); - (D.f[dirE ])[ke ] = f1_W -c2o27*drho1; // c1o100; // zero; // - (D.f[dirW ])[kw ] = f1_E -c2o27*drho1; // c1o100; // zero; // - (D.f[dirN ])[kn ] = f1_S -c2o27*drho1; // c1o100; // zero; // - (D.f[dirS ])[ks ] = f1_N -c2o27*drho1; // c1o100; // zero; // - (D.f[dirT ])[kt ] = f1_B -c2o27*drho1; // c1o100; // zero; // - (D.f[dirB ])[kb ] = f1_T -c2o27*drho1; // c1o100; // zero; // - (D.f[dirNE ])[kne ] = f1_SW -c1o54*drho1; // c1o100; // zero; // - (D.f[dirSW ])[ksw ] = f1_NE -c1o54*drho1; // c1o100; // zero; // - (D.f[dirSE ])[kse ] = f1_NW -c1o54*drho1; // c1o100; // zero; // - (D.f[dirNW ])[knw ] = f1_SE -c1o54*drho1; // c1o100; // zero; // - (D.f[dirTE ])[kte ] = f1_BW -c1o54*drho1; // c1o100; // zero; // - (D.f[dirBW ])[kbw ] = f1_TE -c1o54*drho1; // c1o100; // zero; // - (D.f[dirBE ])[kbe ] = f1_TW -c1o54*drho1; // c1o100; // zero; // - (D.f[dirTW ])[ktw ] = f1_BE -c1o54*drho1; // c1o100; // zero; // - (D.f[dirTN ])[ktn ] = f1_BS -c1o54*drho1; // c1o100; // zero; // - (D.f[dirBS ])[kbs ] = f1_TN -c1o54*drho1; // c1o100; // zero; // - (D.f[dirBN ])[kbn ] = f1_TS -c1o54*drho1; // c1o100; // zero; // - (D.f[dirTS ])[kts ] = f1_BN -c1o54*drho1; // c1o100; // zero; // - (D.f[dirZERO])[kzero] = f1_ZERO-c8o27*drho1; // c1o100; // zero; // - (D.f[dirTNE ])[ktne ] = f1_BSW -c1o216*drho1; // c1o100; // zero; // - (D.f[dirTSW ])[ktsw ] = f1_BNE -c1o216*drho1; // c1o100; // zero; // - (D.f[dirTSE ])[ktse ] = f1_BNW -c1o216*drho1; // c1o100; // zero; // - (D.f[dirTNW ])[ktnw ] = f1_BSE -c1o216*drho1; // c1o100; // zero; // - (D.f[dirBNE ])[kbne ] = f1_TSW -c1o216*drho1; // c1o100; // zero; // - (D.f[dirBSW ])[kbsw ] = f1_TNE -c1o216*drho1; // c1o100; // zero; // - (D.f[dirBSE ])[kbse ] = f1_TNW -c1o216*drho1; // c1o100; // zero; // - (D.f[dirBNW ])[kbnw ] = f1_TSE -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_P00 ])[ke ] = f1_W -c2o27*drho1; // c1o100; // zero; // + (D.f[DIR_M00 ])[kw ] = f1_E -c2o27*drho1; // c1o100; // zero; // + (D.f[DIR_0P0 ])[kn ] = f1_S -c2o27*drho1; // c1o100; // zero; // + (D.f[DIR_0M0 ])[ks ] = f1_N -c2o27*drho1; // c1o100; // zero; // + (D.f[DIR_00P ])[kt ] = f1_B -c2o27*drho1; // c1o100; // zero; // + (D.f[DIR_00M ])[kb ] = f1_T -c2o27*drho1; // c1o100; // zero; // + (D.f[DIR_PP0 ])[kne ] = f1_SW -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_MM0 ])[ksw ] = f1_NE -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_PM0 ])[kse ] = f1_NW -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_MP0 ])[knw ] = f1_SE -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_P0P ])[kte ] = f1_BW -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_M0M ])[kbw ] = f1_TE -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_P0M ])[kbe ] = f1_TW -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_M0P ])[ktw ] = f1_BE -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_0PP ])[ktn ] = f1_BS -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_0MM ])[kbs ] = f1_TN -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_0PM ])[kbn ] = f1_TS -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_0MP ])[kts ] = f1_BN -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_000])[kzero] = f1_ZERO-c8o27*drho1; // c1o100; // zero; // + (D.f[DIR_PPP ])[ktne ] = f1_BSW -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_MMP ])[ktsw ] = f1_BNE -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_PMP ])[ktse ] = f1_BNW -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_MPP ])[ktnw ] = f1_BSE -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_PPM ])[kbne ] = f1_TSW -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_MMM ])[kbsw ] = f1_TNE -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_PMM ])[kbse ] = f1_TNW -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_MPM ])[kbnw ] = f1_TSE -c1o216*drho1; // c1o100; // zero; // } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -3607,18 +3573,18 @@ extern "C" __global__ void QPressDeviceOld27(real* rhoBC, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressDeviceEQZ27(real* rhoBC, +__global__ void QPressDeviceEQZ27(real* rhoBC, real* DD, int* k_Q, int* k_N, real* kTestRE, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -3631,7 +3597,7 @@ extern "C" __global__ void QPressDeviceEQZ27(real* rhoBC, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -3695,155 +3661,155 @@ extern "C" __global__ void QPressDeviceEQZ27(real* rhoBC, unsigned int k1bsw = neighborZ[k1sw]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// // Distributions27 kDistTest; - // kDistTest.f[dirE ] = &kTestRE[dirE *kQ]; - // kDistTest.f[dirW ] = &kTestRE[dirW *kQ]; - // kDistTest.f[dirN ] = &kTestRE[dirN *kQ]; - // kDistTest.f[dirS ] = &kTestRE[dirS *kQ]; - // kDistTest.f[dirT ] = &kTestRE[dirT *kQ]; - // kDistTest.f[dirB ] = &kTestRE[dirB *kQ]; - // kDistTest.f[dirNE ] = &kTestRE[dirNE *kQ]; - // kDistTest.f[dirSW ] = &kTestRE[dirSW *kQ]; - // kDistTest.f[dirSE ] = &kTestRE[dirSE *kQ]; - // kDistTest.f[dirNW ] = &kTestRE[dirNW *kQ]; - // kDistTest.f[dirTE ] = &kTestRE[dirTE *kQ]; - // kDistTest.f[dirBW ] = &kTestRE[dirBW *kQ]; - // kDistTest.f[dirBE ] = &kTestRE[dirBE *kQ]; - // kDistTest.f[dirTW ] = &kTestRE[dirTW *kQ]; - // kDistTest.f[dirTN ] = &kTestRE[dirTN *kQ]; - // kDistTest.f[dirBS ] = &kTestRE[dirBS *kQ]; - // kDistTest.f[dirBN ] = &kTestRE[dirBN *kQ]; - // kDistTest.f[dirTS ] = &kTestRE[dirTS *kQ]; - // kDistTest.f[dirZERO] = &kTestRE[dirZERO*kQ]; - // kDistTest.f[dirTNE ] = &kTestRE[dirTNE *kQ]; - // kDistTest.f[dirTSW ] = &kTestRE[dirTSW *kQ]; - // kDistTest.f[dirTSE ] = &kTestRE[dirTSE *kQ]; - // kDistTest.f[dirTNW ] = &kTestRE[dirTNW *kQ]; - // kDistTest.f[dirBNE ] = &kTestRE[dirBNE *kQ]; - // kDistTest.f[dirBSW ] = &kTestRE[dirBSW *kQ]; - // kDistTest.f[dirBSE ] = &kTestRE[dirBSE *kQ]; - // kDistTest.f[dirBNW ] = &kTestRE[dirBNW *kQ]; + // kDistTest.f[DIR_P00 ] = &kTestRE[DIR_P00 *numberOfBCnodes]; + // kDistTest.f[DIR_M00 ] = &kTestRE[DIR_M00 *numberOfBCnodes]; + // kDistTest.f[DIR_0P0 ] = &kTestRE[DIR_0P0 *numberOfBCnodes]; + // kDistTest.f[DIR_0M0 ] = &kTestRE[DIR_0M0 *numberOfBCnodes]; + // kDistTest.f[DIR_00P ] = &kTestRE[DIR_00P *numberOfBCnodes]; + // kDistTest.f[DIR_00M ] = &kTestRE[DIR_00M *numberOfBCnodes]; + // kDistTest.f[DIR_PP0 ] = &kTestRE[DIR_PP0 *numberOfBCnodes]; + // kDistTest.f[DIR_MM0 ] = &kTestRE[DIR_MM0 *numberOfBCnodes]; + // kDistTest.f[DIR_PM0 ] = &kTestRE[DIR_PM0 *numberOfBCnodes]; + // kDistTest.f[DIR_MP0 ] = &kTestRE[DIR_MP0 *numberOfBCnodes]; + // kDistTest.f[DIR_P0P ] = &kTestRE[DIR_P0P *numberOfBCnodes]; + // kDistTest.f[DIR_M0M ] = &kTestRE[DIR_M0M *numberOfBCnodes]; + // kDistTest.f[DIR_P0M ] = &kTestRE[DIR_P0M *numberOfBCnodes]; + // kDistTest.f[DIR_M0P ] = &kTestRE[DIR_M0P *numberOfBCnodes]; + // kDistTest.f[DIR_0PP ] = &kTestRE[DIR_0PP *numberOfBCnodes]; + // kDistTest.f[DIR_0MM ] = &kTestRE[DIR_0MM *numberOfBCnodes]; + // kDistTest.f[DIR_0PM ] = &kTestRE[DIR_0PM *numberOfBCnodes]; + // kDistTest.f[DIR_0MP ] = &kTestRE[DIR_0MP *numberOfBCnodes]; + // kDistTest.f[DIR_000] = &kTestRE[DIR_000*numberOfBCnodes]; + // kDistTest.f[DIR_PPP ] = &kTestRE[DIR_PPP *numberOfBCnodes]; + // kDistTest.f[DIR_MMP ] = &kTestRE[DIR_MMP *numberOfBCnodes]; + // kDistTest.f[DIR_PMP ] = &kTestRE[DIR_PMP *numberOfBCnodes]; + // kDistTest.f[DIR_MPP ] = &kTestRE[DIR_MPP *numberOfBCnodes]; + // kDistTest.f[DIR_PPM ] = &kTestRE[DIR_PPM *numberOfBCnodes]; + // kDistTest.f[DIR_MMM ] = &kTestRE[DIR_MMM *numberOfBCnodes]; + // kDistTest.f[DIR_PMM ] = &kTestRE[DIR_PMM *numberOfBCnodes]; + // kDistTest.f[DIR_MPM ] = &kTestRE[DIR_MPM *numberOfBCnodes]; // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // //real f1_E,f1_W,f1_N,f1_S,f1_T,f1_B,f1_NE,f1_SW,f1_SE,f1_NW,f1_TE,f1_BW,f1_BE,f1_TW,f1_TN,f1_BS,f1_BN,f1_TS,f1_ZERO,f1_TNE,f1_TSW,f1_TSE,f1_TNW,f1_BNE,f1_BSW,f1_BSE,f1_BNW; - // //f1_W = (D.f[dirE ])[k1e ]; - // //f1_E = (D.f[dirW ])[k1w ]; - // //f1_S = (D.f[dirN ])[k1n ]; - // //f1_N = (D.f[dirS ])[k1s ]; - // //f1_B = (D.f[dirT ])[k1t ]; - // //f1_T = (D.f[dirB ])[k1b ]; - // //f1_SW = (D.f[dirNE ])[k1ne ]; - // //f1_NE = (D.f[dirSW ])[k1sw ]; - // //f1_NW = (D.f[dirSE ])[k1se ]; - // //f1_SE = (D.f[dirNW ])[k1nw ]; - // //f1_BW = (D.f[dirTE ])[k1te ]; - // //f1_TE = (D.f[dirBW ])[k1bw ]; - // //f1_TW = (D.f[dirBE ])[k1be ]; - // //f1_BE = (D.f[dirTW ])[k1tw ]; - // //f1_BS = (D.f[dirTN ])[k1tn ]; - // //f1_TN = (D.f[dirBS ])[k1bs ]; - // //f1_TS = (D.f[dirBN ])[k1bn ]; - // //f1_BN = (D.f[dirTS ])[k1ts ]; - // //f1_ZERO = (D.f[dirZERO])[k1zero]; - // //f1_BSW = (D.f[dirTNE ])[k1tne ]; - // //f1_BNE = (D.f[dirTSW ])[k1tsw ]; - // //f1_BNW = (D.f[dirTSE ])[k1tse ]; - // //f1_BSE = (D.f[dirTNW ])[k1tnw ]; - // //f1_TSW = (D.f[dirBNE ])[k1bne ]; - // //f1_TNE = (D.f[dirBSW ])[k1bsw ]; - // //f1_TNW = (D.f[dirBSE ])[k1bse ]; - // //f1_TSE = (D.f[dirBNW ])[k1bnw ]; + // //f1_W = (D.f[DIR_P00 ])[k1e ]; + // //f1_E = (D.f[DIR_M00 ])[k1w ]; + // //f1_S = (D.f[DIR_0P0 ])[k1n ]; + // //f1_N = (D.f[DIR_0M0 ])[k1s ]; + // //f1_B = (D.f[DIR_00P ])[k1t ]; + // //f1_T = (D.f[DIR_00M ])[k1b ]; + // //f1_SW = (D.f[DIR_PP0 ])[k1ne ]; + // //f1_NE = (D.f[DIR_MM0 ])[k1sw ]; + // //f1_NW = (D.f[DIR_PM0 ])[k1se ]; + // //f1_SE = (D.f[DIR_MP0 ])[k1nw ]; + // //f1_BW = (D.f[DIR_P0P ])[k1te ]; + // //f1_TE = (D.f[DIR_M0M ])[k1bw ]; + // //f1_TW = (D.f[DIR_P0M ])[k1be ]; + // //f1_BE = (D.f[DIR_M0P ])[k1tw ]; + // //f1_BS = (D.f[DIR_0PP ])[k1tn ]; + // //f1_TN = (D.f[DIR_0MM ])[k1bs ]; + // //f1_TS = (D.f[DIR_0PM ])[k1bn ]; + // //f1_BN = (D.f[DIR_0MP ])[k1ts ]; + // //f1_ZERO = (D.f[DIR_000])[k1zero]; + // //f1_BSW = (D.f[DIR_PPP ])[k1tne ]; + // //f1_BNE = (D.f[DIR_MMP ])[k1tsw ]; + // //f1_BNW = (D.f[DIR_PMP ])[k1tse ]; + // //f1_BSE = (D.f[DIR_MPP ])[k1tnw ]; + // //f1_TSW = (D.f[DIR_PPM ])[k1bne ]; + // //f1_TNE = (D.f[DIR_MMM ])[k1bsw ]; + // //f1_TNW = (D.f[DIR_PMM ])[k1bse ]; + // //f1_TSE = (D.f[DIR_MPM ])[k1bnw ]; // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // real f1_E,f1_W,f1_N,f1_S,f1_T,f1_B,f1_NE,f1_SW,f1_SE,f1_NW,f1_TE,f1_BW,f1_BE,f1_TW,f1_TN,f1_BS,f1_BN,f1_TS,f1_ZERO,f1_TNE,f1_TSW,f1_TSE,f1_TNW,f1_BNE,f1_BSW,f1_BSE,f1_BNW; - // f1_E = (D.f[dirE ])[k1e ]; - // f1_W = (D.f[dirW ])[k1w ]; - // f1_N = (D.f[dirN ])[k1n ]; - // f1_S = (D.f[dirS ])[k1s ]; - // f1_T = (D.f[dirT ])[k1t ]; - // f1_B = (D.f[dirB ])[k1b ]; - // f1_NE = (D.f[dirNE ])[k1ne ]; - // f1_SW = (D.f[dirSW ])[k1sw ]; - // f1_SE = (D.f[dirSE ])[k1se ]; - // f1_NW = (D.f[dirNW ])[k1nw ]; - // f1_TE = (D.f[dirTE ])[k1te ]; - // f1_BW = (D.f[dirBW ])[k1bw ]; - // f1_BE = (D.f[dirBE ])[k1be ]; - // f1_TW = (D.f[dirTW ])[k1tw ]; - // f1_TN = (D.f[dirTN ])[k1tn ]; - // f1_BS = (D.f[dirBS ])[k1bs ]; - // f1_BN = (D.f[dirBN ])[k1bn ]; - // f1_TS = (D.f[dirTS ])[k1ts ]; - // f1_ZERO = (D.f[dirZERO])[k1zero]; - // f1_TNE = (D.f[dirTNE ])[k1tne ]; - // f1_TSW = (D.f[dirTSW ])[k1tsw ]; - // f1_TSE = (D.f[dirTSE ])[k1tse ]; - // f1_TNW = (D.f[dirTNW ])[k1tnw ]; - // f1_BNE = (D.f[dirBNE ])[k1bne ]; - // f1_BSW = (D.f[dirBSW ])[k1bsw ]; - // f1_BSE = (D.f[dirBSE ])[k1bse ]; - // f1_BNW = (D.f[dirBNW ])[k1bnw ]; + // f1_E = (D.f[DIR_P00 ])[k1e ]; + // f1_W = (D.f[DIR_M00 ])[k1w ]; + // f1_N = (D.f[DIR_0P0 ])[k1n ]; + // f1_S = (D.f[DIR_0M0 ])[k1s ]; + // f1_T = (D.f[DIR_00P ])[k1t ]; + // f1_B = (D.f[DIR_00M ])[k1b ]; + // f1_NE = (D.f[DIR_PP0 ])[k1ne ]; + // f1_SW = (D.f[DIR_MM0 ])[k1sw ]; + // f1_SE = (D.f[DIR_PM0 ])[k1se ]; + // f1_NW = (D.f[DIR_MP0 ])[k1nw ]; + // f1_TE = (D.f[DIR_P0P ])[k1te ]; + // f1_BW = (D.f[DIR_M0M ])[k1bw ]; + // f1_BE = (D.f[DIR_P0M ])[k1be ]; + // f1_TW = (D.f[DIR_M0P ])[k1tw ]; + // f1_TN = (D.f[DIR_0PP ])[k1tn ]; + // f1_BS = (D.f[DIR_0MM ])[k1bs ]; + // f1_BN = (D.f[DIR_0PM ])[k1bn ]; + // f1_TS = (D.f[DIR_0MP ])[k1ts ]; + // f1_ZERO = (D.f[DIR_000])[k1zero]; + // f1_TNE = (D.f[DIR_PPP ])[k1tne ]; + // f1_TSW = (D.f[DIR_MMP ])[k1tsw ]; + // f1_TSE = (D.f[DIR_PMP ])[k1tse ]; + // f1_TNW = (D.f[DIR_MPP ])[k1tnw ]; + // f1_BNE = (D.f[DIR_PPM ])[k1bne ]; + // f1_BSW = (D.f[DIR_MMM ])[k1bsw ]; + // f1_BSE = (D.f[DIR_PMM ])[k1bse ]; + // f1_BNW = (D.f[DIR_MPM ])[k1bnw ]; // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////// @@ -3948,88 +3914,88 @@ extern "C" __global__ void QPressDeviceEQZ27(real* rhoBC, ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // based on BGK Plus Comp ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //double mfabb = (D.f[dirE ])[k1e ]; - //double mfcbb = (D.f[dirW ])[k1w ]; - //double mfbab = (D.f[dirN ])[k1n ]; - //double mfbcb = (D.f[dirS ])[k1s ]; - //double mfbba = (D.f[dirT ])[k1t ]; - //double mfbbc = (D.f[dirB ])[k1b ]; - //double mfaab = (D.f[dirNE ])[k1ne ]; - //double mfccb = (D.f[dirSW ])[k1sw ]; - //double mfacb = (D.f[dirSE ])[k1se ]; - //double mfcab = (D.f[dirNW ])[k1nw ]; - //double mfaba = (D.f[dirTE ])[k1te ]; - //double mfcbc = (D.f[dirBW ])[k1bw ]; - //double mfabc = (D.f[dirBE ])[k1be ]; - //double mfcba = (D.f[dirTW ])[k1tw ]; - //double mfbaa = (D.f[dirTN ])[k1tn ]; - //double mfbcc = (D.f[dirBS ])[k1bs ]; - //double mfbac = (D.f[dirBN ])[k1bn ]; - //double mfbca = (D.f[dirTS ])[k1ts ]; - //double mfbbb = (D.f[dirZERO])[k1zero]; - //double mfaaa = (D.f[dirTNE ])[k1tne ]; - //double mfcca = (D.f[dirTSW ])[k1tsw ]; - //double mfaca = (D.f[dirTSE ])[k1tse ]; - //double mfcaa = (D.f[dirTNW ])[k1tnw ]; - //double mfaac = (D.f[dirBNE ])[k1bne ]; - //double mfccc = (D.f[dirBSW ])[k1bsw ]; - //double mfacc = (D.f[dirBSE ])[k1bse ]; - //double mfcac = (D.f[dirBNW ])[k1bnw ]; - real mfabb = (D.f[dirE ])[k1e ]; - real mfcbb = (D.f[dirW ])[k1w ]; - real mfbab = (D.f[dirN ])[k1n ]; - real mfbcb = (D.f[dirS ])[k1s ]; - real mfbba = (D.f[dirT ])[k1t ]; - real mfbbc = (D.f[dirB ])[k1b ]; - real mfaab = (D.f[dirNE ])[k1ne ]; - real mfccb = (D.f[dirSW ])[k1sw ]; - real mfacb = (D.f[dirSE ])[k1se ]; - real mfcab = (D.f[dirNW ])[k1nw ]; - real mfaba = (D.f[dirTE ])[k1te ]; - real mfcbc = (D.f[dirBW ])[k1bw ]; - real mfabc = (D.f[dirBE ])[k1be ]; - real mfcba = (D.f[dirTW ])[k1tw ]; - real mfbaa = (D.f[dirTN ])[k1tn ]; - real mfbcc = (D.f[dirBS ])[k1bs ]; - real mfbac = (D.f[dirBN ])[k1bn ]; - real mfbca = (D.f[dirTS ])[k1ts ]; - real mfbbb = (D.f[dirZERO])[k1zero]; - real mfaaa = (D.f[dirTNE ])[k1tne ]; - real mfcca = (D.f[dirTSW ])[k1tsw ]; - real mfaca = (D.f[dirTSE ])[k1tse ]; - real mfcaa = (D.f[dirTNW ])[k1tnw ]; - real mfaac = (D.f[dirBNE ])[k1bne ]; - real mfccc = (D.f[dirBSW ])[k1bsw ]; - real mfacc = (D.f[dirBSE ])[k1bse ]; - real mfcac = (D.f[dirBNW ])[k1bnw ]; - - //real mfcbb = (D.f[dirE ])[ke ]; - //real mfabb = (D.f[dirW ])[kw ]; - //real mfbcb = (D.f[dirN ])[kn ]; - //real mfbab = (D.f[dirS ])[ks ]; - //real mfbbc = (D.f[dirT ])[kt ]; - //real mfbba = (D.f[dirB ])[kb ]; - //real mfccb = (D.f[dirNE ])[kne ]; - //real mfaab = (D.f[dirSW ])[ksw ]; - //real mfcab = (D.f[dirSE ])[kse ]; - //real mfacb = (D.f[dirNW ])[knw ]; - //real mfcbc = (D.f[dirTE ])[kte ]; - //real mfaba = (D.f[dirBW ])[kbw ]; - //real mfcba = (D.f[dirBE ])[kbe ]; - //real mfabc = (D.f[dirTW ])[ktw ]; - //real mfbcc = (D.f[dirTN ])[ktn ]; - //real mfbaa = (D.f[dirBS ])[kbs ]; - //real mfbca = (D.f[dirBN ])[kbn ]; - //real mfbac = (D.f[dirTS ])[kts ]; - //real mfbbb = (D.f[dirZERO])[kzero]; - //real mfccc = (D.f[dirTNE ])[ktne ]; - //real mfaac = (D.f[dirTSW ])[ktsw ]; - //real mfcac = (D.f[dirTSE ])[ktse ]; - //real mfacc = (D.f[dirTNW ])[ktnw ]; - //real mfcca = (D.f[dirBNE ])[kbne ]; - //real mfaaa = (D.f[dirBSW ])[kbsw ]; - //real mfcaa = (D.f[dirBSE ])[kbse ]; - //real mfaca = (D.f[dirBNW ])[kbnw ]; + //double mfabb = (D.f[DIR_P00 ])[k1e ]; + //double mfcbb = (D.f[DIR_M00 ])[k1w ]; + //double mfbab = (D.f[DIR_0P0 ])[k1n ]; + //double mfbcb = (D.f[DIR_0M0 ])[k1s ]; + //double mfbba = (D.f[DIR_00P ])[k1t ]; + //double mfbbc = (D.f[DIR_00M ])[k1b ]; + //double mfaab = (D.f[DIR_PP0 ])[k1ne ]; + //double mfccb = (D.f[DIR_MM0 ])[k1sw ]; + //double mfacb = (D.f[DIR_PM0 ])[k1se ]; + //double mfcab = (D.f[DIR_MP0 ])[k1nw ]; + //double mfaba = (D.f[DIR_P0P ])[k1te ]; + //double mfcbc = (D.f[DIR_M0M ])[k1bw ]; + //double mfabc = (D.f[DIR_P0M ])[k1be ]; + //double mfcba = (D.f[DIR_M0P ])[k1tw ]; + //double mfbaa = (D.f[DIR_0PP ])[k1tn ]; + //double mfbcc = (D.f[DIR_0MM ])[k1bs ]; + //double mfbac = (D.f[DIR_0PM ])[k1bn ]; + //double mfbca = (D.f[DIR_0MP ])[k1ts ]; + //double mfbbb = (D.f[DIR_000])[k1zero]; + //double mfaaa = (D.f[DIR_PPP ])[k1tne ]; + //double mfcca = (D.f[DIR_MMP ])[k1tsw ]; + //double mfaca = (D.f[DIR_PMP ])[k1tse ]; + //double mfcaa = (D.f[DIR_MPP ])[k1tnw ]; + //double mfaac = (D.f[DIR_PPM ])[k1bne ]; + //double mfccc = (D.f[DIR_MMM ])[k1bsw ]; + //double mfacc = (D.f[DIR_PMM ])[k1bse ]; + //double mfcac = (D.f[DIR_MPM ])[k1bnw ]; + real mfabb = (D.f[DIR_P00 ])[k1e ]; + real mfcbb = (D.f[DIR_M00 ])[k1w ]; + real mfbab = (D.f[DIR_0P0 ])[k1n ]; + real mfbcb = (D.f[DIR_0M0 ])[k1s ]; + real mfbba = (D.f[DIR_00P ])[k1t ]; + real mfbbc = (D.f[DIR_00M ])[k1b ]; + real mfaab = (D.f[DIR_PP0 ])[k1ne ]; + real mfccb = (D.f[DIR_MM0 ])[k1sw ]; + real mfacb = (D.f[DIR_PM0 ])[k1se ]; + real mfcab = (D.f[DIR_MP0 ])[k1nw ]; + real mfaba = (D.f[DIR_P0P ])[k1te ]; + real mfcbc = (D.f[DIR_M0M ])[k1bw ]; + real mfabc = (D.f[DIR_P0M ])[k1be ]; + real mfcba = (D.f[DIR_M0P ])[k1tw ]; + real mfbaa = (D.f[DIR_0PP ])[k1tn ]; + real mfbcc = (D.f[DIR_0MM ])[k1bs ]; + real mfbac = (D.f[DIR_0PM ])[k1bn ]; + real mfbca = (D.f[DIR_0MP ])[k1ts ]; + real mfbbb = (D.f[DIR_000])[k1zero]; + real mfaaa = (D.f[DIR_PPP ])[k1tne ]; + real mfcca = (D.f[DIR_MMP ])[k1tsw ]; + real mfaca = (D.f[DIR_PMP ])[k1tse ]; + real mfcaa = (D.f[DIR_MPP ])[k1tnw ]; + real mfaac = (D.f[DIR_PPM ])[k1bne ]; + real mfccc = (D.f[DIR_MMM ])[k1bsw ]; + real mfacc = (D.f[DIR_PMM ])[k1bse ]; + real mfcac = (D.f[DIR_MPM ])[k1bnw ]; + + //real mfcbb = (D.f[DIR_P00 ])[ke ]; + //real mfabb = (D.f[DIR_M00 ])[kw ]; + //real mfbcb = (D.f[DIR_0P0 ])[kn ]; + //real mfbab = (D.f[DIR_0M0 ])[ks ]; + //real mfbbc = (D.f[DIR_00P ])[kt ]; + //real mfbba = (D.f[DIR_00M ])[kb ]; + //real mfccb = (D.f[DIR_PP0 ])[kne ]; + //real mfaab = (D.f[DIR_MM0 ])[ksw ]; + //real mfcab = (D.f[DIR_PM0 ])[kse ]; + //real mfacb = (D.f[DIR_MP0 ])[knw ]; + //real mfcbc = (D.f[DIR_P0P ])[kte ]; + //real mfaba = (D.f[DIR_M0M ])[kbw ]; + //real mfcba = (D.f[DIR_P0M ])[kbe ]; + //real mfabc = (D.f[DIR_M0P ])[ktw ]; + //real mfbcc = (D.f[DIR_0PP ])[ktn ]; + //real mfbaa = (D.f[DIR_0MM ])[kbs ]; + //real mfbca = (D.f[DIR_0PM ])[kbn ]; + //real mfbac = (D.f[DIR_0MP ])[kts ]; + //real mfbbb = (D.f[DIR_000])[kzero]; + //real mfccc = (D.f[DIR_PPP ])[ktne ]; + //real mfaac = (D.f[DIR_MMP ])[ktsw ]; + //real mfcac = (D.f[DIR_PMP ])[ktse ]; + //real mfacc = (D.f[DIR_MPP ])[ktnw ]; + //real mfcca = (D.f[DIR_PPM ])[kbne ]; + //real mfaaa = (D.f[DIR_MMM ])[kbsw ]; + //real mfcaa = (D.f[DIR_PMM ])[kbse ]; + //real mfaca = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////////// //real rho = (((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + // (((mfbac+mfbca) + (mfbaa+mfbcc)) + ((mfabc+mfcba) + (mfaba+mfcbc)) + ((mfacb+mfcab) + (mfaab+mfccb))) + @@ -4056,61 +4022,61 @@ extern "C" __global__ void QPressDeviceEQZ27(real* rhoBC, //////////////////////////////////////////////////////////////////////////////////////// ////round off error test //if(vvx!=zero){ - // (kDistTest.f[dirE ])[k] = mfabb; - // (kDistTest.f[dirW ])[k] = mfcbb; - // (kDistTest.f[dirN ])[k] = mfbab; - // (kDistTest.f[dirS ])[k] = mfbcb; - // (kDistTest.f[dirT ])[k] = mfbba; - // (kDistTest.f[dirB ])[k] = mfbbc; - // (kDistTest.f[dirNE ])[k] = mfaab; - // (kDistTest.f[dirSW ])[k] = mfccb; - // (kDistTest.f[dirSE ])[k] = mfacb; - // (kDistTest.f[dirNW ])[k] = mfcab; - // (kDistTest.f[dirTE ])[k] = mfaba; - // (kDistTest.f[dirBW ])[k] = mfcbc; - // (kDistTest.f[dirBE ])[k] = mfabc; - // (kDistTest.f[dirTW ])[k] = mfcba; - // (kDistTest.f[dirTN ])[k] = mfbaa; - // (kDistTest.f[dirBS ])[k] = mfbcc; - // (kDistTest.f[dirBN ])[k] = mfbac; - // (kDistTest.f[dirTS ])[k] = mfbca; - // (kDistTest.f[dirZERO])[k] = KQK; - // (kDistTest.f[dirTNE ])[k] = mfaaa; - // (kDistTest.f[dirTSW ])[k] = mfcca; - // (kDistTest.f[dirTSE ])[k] = mfaca; - // (kDistTest.f[dirTNW ])[k] = mfcaa; - // (kDistTest.f[dirBNE ])[k] = mfaac; - // (kDistTest.f[dirBSW ])[k] = mfccc; - // (kDistTest.f[dirBSE ])[k] = mfacc; - // (kDistTest.f[dirBNW ])[k] = mfcac; + // (kDistTest.f[DIR_P00 ])[k] = mfabb; + // (kDistTest.f[DIR_M00 ])[k] = mfcbb; + // (kDistTest.f[DIR_0P0 ])[k] = mfbab; + // (kDistTest.f[DIR_0M0 ])[k] = mfbcb; + // (kDistTest.f[DIR_00P ])[k] = mfbba; + // (kDistTest.f[DIR_00M ])[k] = mfbbc; + // (kDistTest.f[DIR_PP0 ])[k] = mfaab; + // (kDistTest.f[DIR_MM0 ])[k] = mfccb; + // (kDistTest.f[DIR_PM0 ])[k] = mfacb; + // (kDistTest.f[DIR_MP0 ])[k] = mfcab; + // (kDistTest.f[DIR_P0P ])[k] = mfaba; + // (kDistTest.f[DIR_M0M ])[k] = mfcbc; + // (kDistTest.f[DIR_P0M ])[k] = mfabc; + // (kDistTest.f[DIR_M0P ])[k] = mfcba; + // (kDistTest.f[DIR_0PP ])[k] = mfbaa; + // (kDistTest.f[DIR_0MM ])[k] = mfbcc; + // (kDistTest.f[DIR_0PM ])[k] = mfbac; + // (kDistTest.f[DIR_0MP ])[k] = mfbca; + // (kDistTest.f[DIR_000])[k] = KQK; + // (kDistTest.f[DIR_PPP ])[k] = mfaaa; + // (kDistTest.f[DIR_MMP ])[k] = mfcca; + // (kDistTest.f[DIR_PMP ])[k] = mfaca; + // (kDistTest.f[DIR_MPP ])[k] = mfcaa; + // (kDistTest.f[DIR_PPM ])[k] = mfaac; + // (kDistTest.f[DIR_MMM ])[k] = mfccc; + // (kDistTest.f[DIR_PMM ])[k] = mfacc; + // (kDistTest.f[DIR_MPM ])[k] = mfcac; //}else{ - // (kDistTest.f[dirE ])[k] = zero; - // (kDistTest.f[dirW ])[k] = zero; - // (kDistTest.f[dirN ])[k] = zero; - // (kDistTest.f[dirS ])[k] = zero; - // (kDistTest.f[dirT ])[k] = zero; - // (kDistTest.f[dirB ])[k] = zero; - // (kDistTest.f[dirNE ])[k] = zero; - // (kDistTest.f[dirSW ])[k] = zero; - // (kDistTest.f[dirSE ])[k] = zero; - // (kDistTest.f[dirNW ])[k] = zero; - // (kDistTest.f[dirTE ])[k] = zero; - // (kDistTest.f[dirBW ])[k] = zero; - // (kDistTest.f[dirBE ])[k] = zero; - // (kDistTest.f[dirTW ])[k] = zero; - // (kDistTest.f[dirTN ])[k] = zero; - // (kDistTest.f[dirBS ])[k] = zero; - // (kDistTest.f[dirBN ])[k] = zero; - // (kDistTest.f[dirTS ])[k] = zero; - // (kDistTest.f[dirZERO])[k] = zero; - // (kDistTest.f[dirTNE ])[k] = zero; - // (kDistTest.f[dirTSW ])[k] = zero; - // (kDistTest.f[dirTSE ])[k] = zero; - // (kDistTest.f[dirTNW ])[k] = zero; - // (kDistTest.f[dirBNE ])[k] = zero; - // (kDistTest.f[dirBSW ])[k] = zero; - // (kDistTest.f[dirBSE ])[k] = zero; - // (kDistTest.f[dirBNW ])[k] = zero; + // (kDistTest.f[DIR_P00 ])[k] = zero; + // (kDistTest.f[DIR_M00 ])[k] = zero; + // (kDistTest.f[DIR_0P0 ])[k] = zero; + // (kDistTest.f[DIR_0M0 ])[k] = zero; + // (kDistTest.f[DIR_00P ])[k] = zero; + // (kDistTest.f[DIR_00M ])[k] = zero; + // (kDistTest.f[DIR_PP0 ])[k] = zero; + // (kDistTest.f[DIR_MM0 ])[k] = zero; + // (kDistTest.f[DIR_PM0 ])[k] = zero; + // (kDistTest.f[DIR_MP0 ])[k] = zero; + // (kDistTest.f[DIR_P0P ])[k] = zero; + // (kDistTest.f[DIR_M0M ])[k] = zero; + // (kDistTest.f[DIR_P0M ])[k] = zero; + // (kDistTest.f[DIR_M0P ])[k] = zero; + // (kDistTest.f[DIR_0PP ])[k] = zero; + // (kDistTest.f[DIR_0MM ])[k] = zero; + // (kDistTest.f[DIR_0PM ])[k] = zero; + // (kDistTest.f[DIR_0MP ])[k] = zero; + // (kDistTest.f[DIR_000])[k] = zero; + // (kDistTest.f[DIR_PPP ])[k] = zero; + // (kDistTest.f[DIR_MMP ])[k] = zero; + // (kDistTest.f[DIR_PMP ])[k] = zero; + // (kDistTest.f[DIR_MPP ])[k] = zero; + // (kDistTest.f[DIR_PPM ])[k] = zero; + // (kDistTest.f[DIR_MMM ])[k] = zero; + // (kDistTest.f[DIR_PMM ])[k] = zero; + // (kDistTest.f[DIR_MPM ])[k] = zero; //} ////////////////////////////////////////////////////////////////////////////////////// @@ -4200,151 +4166,151 @@ extern "C" __global__ void QPressDeviceEQZ27(real* rhoBC, //mfaca = OnoOver216Rho + OneOver216RhoPlusOne*three*(-(one*vvz) + vx2 - three*vvz*vx2 + vy2 - three*vvz*vy2 + three*vx2*vy2 - nine*vvz*vx2*vy2 + vz2 + three*vx2*vz2 + three*vy2*vz2 + nine*vx2*vy2*vz2 - one*vvy*(one + three*vx2)*(-one + three*vvz - three*vz2) + vvx*(one + three*vvy + three*vy2)*(-one + three*vvz - three*vz2)); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //if (evenOrOdd==true) + //if (isEvenTimestep==true) //{ - // D.f[dirE ] = &DD[dirE *size_Mat]; - // D.f[dirW ] = &DD[dirW *size_Mat]; - // D.f[dirN ] = &DD[dirN *size_Mat]; - // D.f[dirS ] = &DD[dirS *size_Mat]; - // D.f[dirT ] = &DD[dirT *size_Mat]; - // D.f[dirB ] = &DD[dirB *size_Mat]; - // D.f[dirNE ] = &DD[dirNE *size_Mat]; - // D.f[dirSW ] = &DD[dirSW *size_Mat]; - // D.f[dirSE ] = &DD[dirSE *size_Mat]; - // D.f[dirNW ] = &DD[dirNW *size_Mat]; - // D.f[dirTE ] = &DD[dirTE *size_Mat]; - // D.f[dirBW ] = &DD[dirBW *size_Mat]; - // D.f[dirBE ] = &DD[dirBE *size_Mat]; - // D.f[dirTW ] = &DD[dirTW *size_Mat]; - // D.f[dirTN ] = &DD[dirTN *size_Mat]; - // D.f[dirBS ] = &DD[dirBS *size_Mat]; - // D.f[dirBN ] = &DD[dirBN *size_Mat]; - // D.f[dirTS ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - // D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - // D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - // D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - // D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - // D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + // D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; //} //else //{ - // D.f[dirW ] = &DD[dirE *size_Mat]; - // D.f[dirE ] = &DD[dirW *size_Mat]; - // D.f[dirS ] = &DD[dirN *size_Mat]; - // D.f[dirN ] = &DD[dirS *size_Mat]; - // D.f[dirB ] = &DD[dirT *size_Mat]; - // D.f[dirT ] = &DD[dirB *size_Mat]; - // D.f[dirSW ] = &DD[dirNE *size_Mat]; - // D.f[dirNE ] = &DD[dirSW *size_Mat]; - // D.f[dirNW ] = &DD[dirSE *size_Mat]; - // D.f[dirSE ] = &DD[dirNW *size_Mat]; - // D.f[dirBW ] = &DD[dirTE *size_Mat]; - // D.f[dirTE ] = &DD[dirBW *size_Mat]; - // D.f[dirTW ] = &DD[dirBE *size_Mat]; - // D.f[dirBE ] = &DD[dirTW *size_Mat]; - // D.f[dirBS ] = &DD[dirTN *size_Mat]; - // D.f[dirTN ] = &DD[dirBS *size_Mat]; - // D.f[dirTS ] = &DD[dirBN *size_Mat]; - // D.f[dirBN ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - // D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - // D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - // D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - // D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - // D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + // D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; //} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //__syncthreads(); - (D.f[dirE ])[ke ] = mfabb;//mfcbb; - (D.f[dirW ])[kw ] = mfcbb;//mfabb; - (D.f[dirN ])[kn ] = mfbab;//mfbcb; - (D.f[dirS ])[ks ] = mfbcb;//mfbab; - (D.f[dirT ])[kt ] = mfbba;//mfbbc; - (D.f[dirB ])[kb ] = mfbbc;//mfbba; - (D.f[dirNE ])[kne ] = mfaab;//mfccb; - (D.f[dirSW ])[ksw ] = mfccb;//mfaab; - (D.f[dirSE ])[kse ] = mfacb;//mfcab; - (D.f[dirNW ])[knw ] = mfcab;//mfacb; - (D.f[dirTE ])[kte ] = mfaba;//mfcbc; - (D.f[dirBW ])[kbw ] = mfcbc;//mfaba; - (D.f[dirBE ])[kbe ] = mfabc;//mfcba; - (D.f[dirTW ])[ktw ] = mfcba;//mfabc; - (D.f[dirTN ])[ktn ] = mfbaa;//mfbcc; - (D.f[dirBS ])[kbs ] = mfbcc;//mfbaa; - (D.f[dirBN ])[kbn ] = mfbac;//mfbca; - (D.f[dirTS ])[kts ] = mfbca;//mfbac; - (D.f[dirZERO])[kzero] = mfbbb;//mfbbb; - (D.f[dirTNE ])[ktne ] = mfaaa;//mfccc; - (D.f[dirTSW ])[ktsw ] = mfcca;//mfaac; - (D.f[dirTSE ])[ktse ] = mfaca;//mfcac; - (D.f[dirTNW ])[ktnw ] = mfcaa;//mfacc; - (D.f[dirBNE ])[kbne ] = mfaac;//mfcca; - (D.f[dirBSW ])[kbsw ] = mfccc;//mfaaa; - (D.f[dirBSE ])[kbse ] = mfacc;//mfcaa; - (D.f[dirBNW ])[kbnw ] = mfcac;//mfaca; - //(D.f[dirE ])[ke ] = mfcbb; - //(D.f[dirW ])[kw ] = mfabb; - //(D.f[dirN ])[kn ] = mfbcb; - //(D.f[dirS ])[ks ] = mfbab; - //(D.f[dirT ])[kt ] = mfbbc; - //(D.f[dirB ])[kb ] = mfbba; - //(D.f[dirNE ])[kne ] = mfccb; - //(D.f[dirSW ])[ksw ] = mfaab; - //(D.f[dirSE ])[kse ] = mfcab; - //(D.f[dirNW ])[knw ] = mfacb; - //(D.f[dirTE ])[kte ] = mfcbc; - //(D.f[dirBW ])[kbw ] = mfaba; - //(D.f[dirBE ])[kbe ] = mfcba; - //(D.f[dirTW ])[ktw ] = mfabc; - //(D.f[dirTN ])[ktn ] = mfbcc; - //(D.f[dirBS ])[kbs ] = mfbaa; - //(D.f[dirBN ])[kbn ] = mfbca; - //(D.f[dirTS ])[kts ] = mfbac; - //(D.f[dirZERO])[kzero] = mfbbb; - //(D.f[dirTNE ])[ktne ] = mfccc; - //(D.f[dirTSW ])[ktsw ] = mfaac; - //(D.f[dirTSE ])[ktse ] = mfcac; - //(D.f[dirTNW ])[ktnw ] = mfacc; - //(D.f[dirBNE ])[kbne ] = mfcca; - //(D.f[dirBSW ])[kbsw ] = mfaaa; - //(D.f[dirBSE ])[kbse ] = mfcaa; - //(D.f[dirBNW ])[kbnw ] = mfaca; - - //(D.f[dirE ])[ke ] = fE ; //f1_E ; //fW; //fE ; - //(D.f[dirW ])[kw ] = fW ; //f1_W ; //fE; //fW ; - //(D.f[dirN ])[kn ] = fN ; //f1_N ; //fS; //fN ; - //(D.f[dirS ])[ks ] = fS ; //f1_S ; //fN; //fS ; - //(D.f[dirT ])[kt ] = fT ; //f1_T ; //fB; //fT ; - //(D.f[dirB ])[kb ] = fB ; //f1_B ; //fT; //fB ; - //(D.f[dirNE ])[kne ] = fNE; //f1_NE; //fSW; //fNE; - //(D.f[dirSW ])[ksw ] = fSW; //f1_SW; //fNE; //fSW; - //(D.f[dirSE ])[kse ] = fSE; //f1_SE; //fNW; //fSE; - //(D.f[dirNW ])[knw ] = fNW; //f1_NW; //fSE; //fNW; - //(D.f[dirTE ])[kte ] = fTE; //f1_TE; //fBW; //fTE; - //(D.f[dirBW ])[kbw ] = fBW; //f1_BW; //fTE; //fBW; - //(D.f[dirBE ])[kbe ] = fBE; //f1_BE; //fTW; //fBE; - //(D.f[dirTW ])[ktw ] = fTW; //f1_TW; //fBE; //fTW; - //(D.f[dirTN ])[ktn ] = fTN; //f1_TN; //fBS; //fTN; - //(D.f[dirBS ])[kbs ] = fBS; //f1_BS; //fTN; //fBS; - //(D.f[dirBN ])[kbn ] = fBN; //f1_BN; //fTS; //fBN; - //(D.f[dirTS ])[kts ] = fTS; //f1_TS; //fBN; //fTS; - //(D.f[dirZERO])[kzero] = fZERO;//f1_ZERO; //fZERO; //fZERO; - //(D.f[dirTNE ])[ktne ] = fTNE; //f1_TNE; //fBSW; //fTNE; - //(D.f[dirBSW ])[kbsw ] = fBSW; //f1_BSW; //fTNE; //fBSW; - //(D.f[dirBNE ])[kbne ] = fBNE; //f1_BNE; //fTSW; //fBNE; - //(D.f[dirTSW ])[ktsw ] = fTSW; //f1_TSW; //fBNE; //fTSW; - //(D.f[dirTSE ])[ktse ] = fTSE; //f1_TSE; //fBNW; //fTSE; - //(D.f[dirBNW ])[kbnw ] = fBNW; //f1_BNW; //fTSE; //fBNW; - //(D.f[dirBSE ])[kbse ] = fBSE; //f1_BSE; //fTNW; //fBSE; - //(D.f[dirTNW ])[ktnw ] = fTNW; //f1_TNW; //fBSE; //fTNW; + (D.f[DIR_P00 ])[ke ] = mfabb;//mfcbb; + (D.f[DIR_M00 ])[kw ] = mfcbb;//mfabb; + (D.f[DIR_0P0 ])[kn ] = mfbab;//mfbcb; + (D.f[DIR_0M0 ])[ks ] = mfbcb;//mfbab; + (D.f[DIR_00P ])[kt ] = mfbba;//mfbbc; + (D.f[DIR_00M ])[kb ] = mfbbc;//mfbba; + (D.f[DIR_PP0 ])[kne ] = mfaab;//mfccb; + (D.f[DIR_MM0 ])[ksw ] = mfccb;//mfaab; + (D.f[DIR_PM0 ])[kse ] = mfacb;//mfcab; + (D.f[DIR_MP0 ])[knw ] = mfcab;//mfacb; + (D.f[DIR_P0P ])[kte ] = mfaba;//mfcbc; + (D.f[DIR_M0M ])[kbw ] = mfcbc;//mfaba; + (D.f[DIR_P0M ])[kbe ] = mfabc;//mfcba; + (D.f[DIR_M0P ])[ktw ] = mfcba;//mfabc; + (D.f[DIR_0PP ])[ktn ] = mfbaa;//mfbcc; + (D.f[DIR_0MM ])[kbs ] = mfbcc;//mfbaa; + (D.f[DIR_0PM ])[kbn ] = mfbac;//mfbca; + (D.f[DIR_0MP ])[kts ] = mfbca;//mfbac; + (D.f[DIR_000])[kzero] = mfbbb;//mfbbb; + (D.f[DIR_PPP ])[ktne ] = mfaaa;//mfccc; + (D.f[DIR_MMP ])[ktsw ] = mfcca;//mfaac; + (D.f[DIR_PMP ])[ktse ] = mfaca;//mfcac; + (D.f[DIR_MPP ])[ktnw ] = mfcaa;//mfacc; + (D.f[DIR_PPM ])[kbne ] = mfaac;//mfcca; + (D.f[DIR_MMM ])[kbsw ] = mfccc;//mfaaa; + (D.f[DIR_PMM ])[kbse ] = mfacc;//mfcaa; + (D.f[DIR_MPM ])[kbnw ] = mfcac;//mfaca; + //(D.f[DIR_P00 ])[ke ] = mfcbb; + //(D.f[DIR_M00 ])[kw ] = mfabb; + //(D.f[DIR_0P0 ])[kn ] = mfbcb; + //(D.f[DIR_0M0 ])[ks ] = mfbab; + //(D.f[DIR_00P ])[kt ] = mfbbc; + //(D.f[DIR_00M ])[kb ] = mfbba; + //(D.f[DIR_PP0 ])[kne ] = mfccb; + //(D.f[DIR_MM0 ])[ksw ] = mfaab; + //(D.f[DIR_PM0 ])[kse ] = mfcab; + //(D.f[DIR_MP0 ])[knw ] = mfacb; + //(D.f[DIR_P0P ])[kte ] = mfcbc; + //(D.f[DIR_M0M ])[kbw ] = mfaba; + //(D.f[DIR_P0M ])[kbe ] = mfcba; + //(D.f[DIR_M0P ])[ktw ] = mfabc; + //(D.f[DIR_0PP ])[ktn ] = mfbcc; + //(D.f[DIR_0MM ])[kbs ] = mfbaa; + //(D.f[DIR_0PM ])[kbn ] = mfbca; + //(D.f[DIR_0MP ])[kts ] = mfbac; + //(D.f[DIR_000])[kzero] = mfbbb; + //(D.f[DIR_PPP ])[ktne ] = mfccc; + //(D.f[DIR_MMP ])[ktsw ] = mfaac; + //(D.f[DIR_PMP ])[ktse ] = mfcac; + //(D.f[DIR_MPP ])[ktnw ] = mfacc; + //(D.f[DIR_PPM ])[kbne ] = mfcca; + //(D.f[DIR_MMM ])[kbsw ] = mfaaa; + //(D.f[DIR_PMM ])[kbse ] = mfcaa; + //(D.f[DIR_MPM ])[kbnw ] = mfaca; + + //(D.f[DIR_P00 ])[ke ] = fE ; //f1_E ; //fW; //fE ; + //(D.f[DIR_M00 ])[kw ] = fW ; //f1_W ; //fE; //fW ; + //(D.f[DIR_0P0 ])[kn ] = fN ; //f1_N ; //fS; //fN ; + //(D.f[DIR_0M0 ])[ks ] = fS ; //f1_S ; //fN; //fS ; + //(D.f[DIR_00P ])[kt ] = fT ; //f1_T ; //fB; //fT ; + //(D.f[DIR_00M ])[kb ] = fB ; //f1_B ; //fT; //fB ; + //(D.f[DIR_PP0 ])[kne ] = fNE; //f1_NE; //fSW; //fNE; + //(D.f[DIR_MM0 ])[ksw ] = fSW; //f1_SW; //fNE; //fSW; + //(D.f[DIR_PM0 ])[kse ] = fSE; //f1_SE; //fNW; //fSE; + //(D.f[DIR_MP0 ])[knw ] = fNW; //f1_NW; //fSE; //fNW; + //(D.f[DIR_P0P ])[kte ] = fTE; //f1_TE; //fBW; //fTE; + //(D.f[DIR_M0M ])[kbw ] = fBW; //f1_BW; //fTE; //fBW; + //(D.f[DIR_P0M ])[kbe ] = fBE; //f1_BE; //fTW; //fBE; + //(D.f[DIR_M0P ])[ktw ] = fTW; //f1_TW; //fBE; //fTW; + //(D.f[DIR_0PP ])[ktn ] = fTN; //f1_TN; //fBS; //fTN; + //(D.f[DIR_0MM ])[kbs ] = fBS; //f1_BS; //fTN; //fBS; + //(D.f[DIR_0PM ])[kbn ] = fBN; //f1_BN; //fTS; //fBN; + //(D.f[DIR_0MP ])[kts ] = fTS; //f1_TS; //fBN; //fTS; + //(D.f[DIR_000])[kzero] = fZERO;//f1_ZERO; //fZERO; //fZERO; + //(D.f[DIR_PPP ])[ktne ] = fTNE; //f1_TNE; //fBSW; //fTNE; + //(D.f[DIR_MMM ])[kbsw ] = fBSW; //f1_BSW; //fTNE; //fBSW; + //(D.f[DIR_PPM ])[kbne ] = fBNE; //f1_BNE; //fTSW; //fBNE; + //(D.f[DIR_MMP ])[ktsw ] = fTSW; //f1_TSW; //fBNE; //fTSW; + //(D.f[DIR_PMP ])[ktse ] = fTSE; //f1_TSE; //fBNW; //fTSE; + //(D.f[DIR_MPM ])[kbnw ] = fBNW; //f1_BNW; //fTSE; //fBNW; + //(D.f[DIR_PMM ])[kbse ] = fBSE; //f1_BSE; //fTNW; //fBSE; + //(D.f[DIR_MPP ])[ktnw ] = fTNW; //f1_TNW; //fBSE; //fTNW; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -4388,14 +4354,14 @@ extern "C" __global__ void QPressDeviceEQZ27(real* rhoBC, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressDeviceZero27( real* DD, +__global__ void QPressDeviceZero27( real* DD, int* k_Q, - int kQ, + unsigned int numberOfBCnodes, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -4408,7 +4374,7 @@ extern "C" __global__ void QPressDeviceZero27( real* DD, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -4442,96 +4408,96 @@ extern "C" __global__ void QPressDeviceZero27( real* DD, unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //__syncthreads(); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE ])[ke ] =c0o1; - (D.f[dirW ])[kw ] =c0o1; - (D.f[dirN ])[kn ] =c0o1; - (D.f[dirS ])[ks ] =c0o1; - (D.f[dirT ])[kt ] =c0o1; - (D.f[dirB ])[kb ] =c0o1; - (D.f[dirNE ])[kne ] =c0o1; - (D.f[dirSW ])[ksw ] =c0o1; - (D.f[dirSE ])[kse ] =c0o1; - (D.f[dirNW ])[knw ] =c0o1; - (D.f[dirTE ])[kte ] =c0o1; - (D.f[dirBW ])[kbw ] =c0o1; - (D.f[dirBE ])[kbe ] =c0o1; - (D.f[dirTW ])[ktw ] =c0o1; - (D.f[dirTN ])[ktn ] =c0o1; - (D.f[dirBS ])[kbs ] =c0o1; - (D.f[dirBN ])[kbn ] =c0o1; - (D.f[dirTS ])[kts ] =c0o1; - (D.f[dirZERO])[kzero] =c0o1; - (D.f[dirTNE ])[ktne ] =c0o1; - (D.f[dirTSW ])[ktsw ] =c0o1; - (D.f[dirTSE ])[ktse ] =c0o1; - (D.f[dirTNW ])[ktnw ] =c0o1; - (D.f[dirBNE ])[kbne ] =c0o1; - (D.f[dirBSW ])[kbsw ] =c0o1; - (D.f[dirBSE ])[kbse ] =c0o1; - (D.f[dirBNW ])[kbnw ] =c0o1; + (D.f[DIR_P00 ])[ke ] =c0o1; + (D.f[DIR_M00 ])[kw ] =c0o1; + (D.f[DIR_0P0 ])[kn ] =c0o1; + (D.f[DIR_0M0 ])[ks ] =c0o1; + (D.f[DIR_00P ])[kt ] =c0o1; + (D.f[DIR_00M ])[kb ] =c0o1; + (D.f[DIR_PP0 ])[kne ] =c0o1; + (D.f[DIR_MM0 ])[ksw ] =c0o1; + (D.f[DIR_PM0 ])[kse ] =c0o1; + (D.f[DIR_MP0 ])[knw ] =c0o1; + (D.f[DIR_P0P ])[kte ] =c0o1; + (D.f[DIR_M0M ])[kbw ] =c0o1; + (D.f[DIR_P0M ])[kbe ] =c0o1; + (D.f[DIR_M0P ])[ktw ] =c0o1; + (D.f[DIR_0PP ])[ktn ] =c0o1; + (D.f[DIR_0MM ])[kbs ] =c0o1; + (D.f[DIR_0PM ])[kbn ] =c0o1; + (D.f[DIR_0MP ])[kts ] =c0o1; + (D.f[DIR_000])[kzero] =c0o1; + (D.f[DIR_PPP ])[ktne ] =c0o1; + (D.f[DIR_MMP ])[ktsw ] =c0o1; + (D.f[DIR_PMP ])[ktse ] =c0o1; + (D.f[DIR_MPP ])[ktnw ] =c0o1; + (D.f[DIR_PPM ])[kbne ] =c0o1; + (D.f[DIR_MMM ])[kbsw ] =c0o1; + (D.f[DIR_PMM ])[kbse ] =c0o1; + (D.f[DIR_MPM ])[kbnw ] =c0o1; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -4575,17 +4541,17 @@ extern "C" __global__ void QPressDeviceZero27( real* DD, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressDeviceFake27( real* rhoBC, +__global__ void QPressDeviceFake27( real* rhoBC, real* DD, int* k_Q, int* k_N, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -4598,7 +4564,7 @@ extern "C" __global__ void QPressDeviceFake27( real* rhoBC, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -4662,97 +4628,97 @@ extern "C" __global__ void QPressDeviceFake27( real* rhoBC, unsigned int k1bsw = neighborZ[k1sw]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real f1_E,f1_W,f1_N,f1_S,f1_T,f1_B,f1_NE,f1_SW,f1_SE,f1_NW,f1_TE,f1_BW,f1_BE,f1_TW,f1_TN,f1_BS,f1_BN,f1_TS,f1_ZERO, f1_TNE,f1_TSW,f1_TSE,f1_TNW,f1_BNE,f1_BSW,f1_BSE,f1_BNW; - f1_W = (D.f[dirE ])[k1e ]; - f1_E = (D.f[dirW ])[k1w ]; - f1_S = (D.f[dirN ])[k1n ]; - f1_N = (D.f[dirS ])[k1s ]; - f1_B = (D.f[dirT ])[k1t ]; - f1_T = (D.f[dirB ])[k1b ]; - f1_SW = (D.f[dirNE ])[k1ne ]; - f1_NE = (D.f[dirSW ])[k1sw ]; - f1_NW = (D.f[dirSE ])[k1se ]; - f1_SE = (D.f[dirNW ])[k1nw ]; - f1_BW = (D.f[dirTE ])[k1te ]; - f1_TE = (D.f[dirBW ])[k1bw ]; - f1_TW = (D.f[dirBE ])[k1be ]; - f1_BE = (D.f[dirTW ])[k1tw ]; - f1_BS = (D.f[dirTN ])[k1tn ]; - f1_TN = (D.f[dirBS ])[k1bs ]; - f1_TS = (D.f[dirBN ])[k1bn ]; - f1_BN = (D.f[dirTS ])[k1ts ]; - f1_ZERO = (D.f[dirZERO])[k1zero]; - f1_BSW = (D.f[dirTNE ])[k1tne ]; - f1_BNE = (D.f[dirTSW ])[k1tsw ]; - f1_BNW = (D.f[dirTSE ])[k1tse ]; - f1_BSE = (D.f[dirTNW ])[k1tnw ]; - f1_TSW = (D.f[dirBNE ])[k1bne ]; - f1_TNE = (D.f[dirBSW ])[k1bsw ]; - f1_TNW = (D.f[dirBSE ])[k1bse ]; - f1_TSE = (D.f[dirBNW ])[k1bnw ]; + f1_W = (D.f[DIR_P00 ])[k1e ]; + f1_E = (D.f[DIR_M00 ])[k1w ]; + f1_S = (D.f[DIR_0P0 ])[k1n ]; + f1_N = (D.f[DIR_0M0 ])[k1s ]; + f1_B = (D.f[DIR_00P ])[k1t ]; + f1_T = (D.f[DIR_00M ])[k1b ]; + f1_SW = (D.f[DIR_PP0 ])[k1ne ]; + f1_NE = (D.f[DIR_MM0 ])[k1sw ]; + f1_NW = (D.f[DIR_PM0 ])[k1se ]; + f1_SE = (D.f[DIR_MP0 ])[k1nw ]; + f1_BW = (D.f[DIR_P0P ])[k1te ]; + f1_TE = (D.f[DIR_M0M ])[k1bw ]; + f1_TW = (D.f[DIR_P0M ])[k1be ]; + f1_BE = (D.f[DIR_M0P ])[k1tw ]; + f1_BS = (D.f[DIR_0PP ])[k1tn ]; + f1_TN = (D.f[DIR_0MM ])[k1bs ]; + f1_TS = (D.f[DIR_0PM ])[k1bn ]; + f1_BN = (D.f[DIR_0MP ])[k1ts ]; + f1_ZERO = (D.f[DIR_000])[k1zero]; + f1_BSW = (D.f[DIR_PPP ])[k1tne ]; + f1_BNE = (D.f[DIR_MMP ])[k1tsw ]; + f1_BNW = (D.f[DIR_PMP ])[k1tse ]; + f1_BSE = (D.f[DIR_MPP ])[k1tnw ]; + f1_TSW = (D.f[DIR_PPM ])[k1bne ]; + f1_TNE = (D.f[DIR_MMM ])[k1bsw ]; + f1_TNW = (D.f[DIR_PMM ])[k1bse ]; + f1_TSE = (D.f[DIR_MPM ])[k1bnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3; @@ -4779,33 +4745,33 @@ extern "C" __global__ void QPressDeviceFake27( real* rhoBC, __syncthreads(); - (D.f[dirE ])[ke ] = c2o27* (rhoBC[k]+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - (D.f[dirW ])[kw ] = c2o27* (rhoBC[k]+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - (D.f[dirN ])[kn ] = c2o27* (rhoBC[k]+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - (D.f[dirS ])[ks ] = c2o27* (rhoBC[k]+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - (D.f[dirT ])[kt ] = c2o27* (rhoBC[k]+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - (D.f[dirB ])[kb ] = c2o27* (rhoBC[k]+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - (D.f[dirNE ])[kne ] = f1_SW -c1o54*drho1; // c1o100; // zero; // - (D.f[dirSW ])[ksw ] = f1_NE -c1o54*drho1; // c1o100; // zero; // - (D.f[dirSE ])[kse ] = f1_NW -c1o54*drho1; // c1o100; // zero; // - (D.f[dirNW ])[knw ] = f1_SE -c1o54*drho1; // c1o100; // zero; // - (D.f[dirTE ])[kte ] = f1_BW -c1o54*drho1; // c1o100; // zero; // - (D.f[dirBW ])[kbw ] = f1_TE -c1o54*drho1; // c1o100; // zero; // - (D.f[dirBE ])[kbe ] = f1_TW -c1o54*drho1; // c1o100; // zero; // - (D.f[dirTW ])[ktw ] = f1_BE -c1o54*drho1; // c1o100; // zero; // - (D.f[dirTN ])[ktn ] = f1_BS -c1o54*drho1; // c1o100; // zero; // - (D.f[dirBS ])[kbs ] = f1_TN -c1o54*drho1; // c1o100; // zero; // - (D.f[dirBN ])[kbn ] = f1_TS -c1o54*drho1; // c1o100; // zero; // - (D.f[dirTS ])[kts ] = f1_BN -c1o54*drho1; // c1o100; // zero; // - (D.f[dirZERO])[kzero] = f1_ZERO-c8o27*drho1; // c1o100; // zero; // - (D.f[dirTNE ])[ktne ] = f1_BSW -c1o216*drho1; // c1o100; // zero; // - (D.f[dirTSW ])[ktsw ] = f1_BNE -c1o216*drho1; // c1o100; // zero; // - (D.f[dirTSE ])[ktse ] = f1_BNW -c1o216*drho1; // c1o100; // zero; // - (D.f[dirTNW ])[ktnw ] = f1_BSE -c1o216*drho1; // c1o100; // zero; // - (D.f[dirBNE ])[kbne ] = f1_TSW -c1o216*drho1; // c1o100; // zero; // - (D.f[dirBSW ])[kbsw ] = f1_TNE -c1o216*drho1; // c1o100; // zero; // - (D.f[dirBSE ])[kbse ] = f1_TNW -c1o216*drho1; // c1o100; // zero; // - (D.f[dirBNW ])[kbnw ] = f1_TSE -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_P00 ])[ke ] = c2o27* (rhoBC[k]+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + (D.f[DIR_M00 ])[kw ] = c2o27* (rhoBC[k]+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + (D.f[DIR_0P0 ])[kn ] = c2o27* (rhoBC[k]+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + (D.f[DIR_0M0 ])[ks ] = c2o27* (rhoBC[k]+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + (D.f[DIR_00P ])[kt ] = c2o27* (rhoBC[k]+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + (D.f[DIR_00M ])[kb ] = c2o27* (rhoBC[k]+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + (D.f[DIR_PP0 ])[kne ] = f1_SW -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_MM0 ])[ksw ] = f1_NE -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_PM0 ])[kse ] = f1_NW -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_MP0 ])[knw ] = f1_SE -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_P0P ])[kte ] = f1_BW -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_M0M ])[kbw ] = f1_TE -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_P0M ])[kbe ] = f1_TW -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_M0P ])[ktw ] = f1_BE -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_0PP ])[ktn ] = f1_BS -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_0MM ])[kbs ] = f1_TN -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_0PM ])[kbn ] = f1_TS -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_0MP ])[kts ] = f1_BN -c1o54*drho1; // c1o100; // zero; // + (D.f[DIR_000])[kzero] = f1_ZERO-c8o27*drho1; // c1o100; // zero; // + (D.f[DIR_PPP ])[ktne ] = f1_BSW -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_MMP ])[ktsw ] = f1_BNE -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_PMP ])[ktse ] = f1_BNW -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_MPP ])[ktnw ] = f1_BSE -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_PPM ])[kbne ] = f1_TSW -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_MMM ])[kbsw ] = f1_TNE -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_PMM ])[kbse ] = f1_TNW -c1o216*drho1; // c1o100; // zero; // + (D.f[DIR_MPM ])[kbnw ] = f1_TSE -c1o216*drho1; // c1o100; // zero; // } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -4849,79 +4815,78 @@ extern "C" __global__ void QPressDeviceFake27( real* rhoBC, ////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QPressDevice27_IntBB(real* rho, +__global__ void QPressDevice27_IntBB(real* rho, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -4934,7 +4899,7 @@ extern "C" __global__ void QPressDevice27_IntBB(real* rho, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k < numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //real VeloX = vx[k]; @@ -4946,32 +4911,32 @@ extern "C" __global__ void QPressDevice27_IntBB(real* rho, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -5006,37 +4971,37 @@ extern "C" __global__ void QPressDevice27_IntBB(real* rho, real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -5054,69 +5019,69 @@ extern "C" __global__ void QPressDevice27_IntBB(real* rho, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Test - //(D.f[dirZERO])[k]=c1o10; + //(D.f[DIR_000])[k]=c1o10; real rhoDiff = drho - rho[k]; real VeloX = vx1; real VeloY = vx2; @@ -5127,182 +5092,182 @@ extern "C" __global__ void QPressDevice27_IntBB(real* rho, if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c9o2*( vx1 )*( vx1 )-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c2o27*(rhoDiff + c6o1*( VeloX )))/(c1o1+q); + (D.f[DIR_M00])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c2o27*(rhoDiff + c6o1*( VeloX )))/(c1o1+q); } q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c9o2*(-vx1 )*(-vx1 )-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c2o27*(rhoDiff + c6o1*(-VeloX )))/(c1o1+q); + (D.f[DIR_P00])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c2o27*(rhoDiff + c6o1*(-VeloX )))/(c1o1+q); } q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c9o2*( vx2 )*( vx2 )-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c2o27*(rhoDiff + c6o1*( VeloY )))/(c1o1+q); + (D.f[DIR_0M0])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c2o27*(rhoDiff + c6o1*( VeloY )))/(c1o1+q); } q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c9o2*( -vx2 )*( -vx2 )-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c2o27*(rhoDiff + c6o1*(-VeloY )))/(c1o1+q); + (D.f[DIR_0P0])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c2o27*(rhoDiff + c6o1*(-VeloY )))/(c1o1+q); } q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c9o2*( vx3)*( vx3)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c2o27*(rhoDiff + c6o1*( VeloZ )))/(c1o1+q); + (D.f[DIR_00M])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c2o27*(rhoDiff + c6o1*( VeloZ )))/(c1o1+q); } q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c9o2*( -vx3)*( -vx3)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c2o27*(rhoDiff + c6o1*(-VeloZ )))/(c1o1+q); + (D.f[DIR_00P])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c2o27*(rhoDiff + c6o1*(-VeloZ )))/(c1o1+q); } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c1o54*(rhoDiff + c6o1*(VeloX+VeloY)))/(c1o1+q); + (D.f[DIR_MM0])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c1o54*(rhoDiff + c6o1*(VeloX+VeloY)))/(c1o1+q); } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c1o54*(rhoDiff + c6o1*(-VeloX-VeloY)))/(c1o1+q); + (D.f[DIR_PP0])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c1o54*(rhoDiff + c6o1*(-VeloX-VeloY)))/(c1o1+q); } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c1o54*(rhoDiff + c6o1*( VeloX-VeloY)))/(c1o1+q); + (D.f[DIR_MP0])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c1o54*(rhoDiff + c6o1*( VeloX-VeloY)))/(c1o1+q); } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c1o54*(rhoDiff + c6o1*(-VeloX+VeloY)))/(c1o1+q); + (D.f[DIR_PM0])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c1o54*(rhoDiff + c6o1*(-VeloX+VeloY)))/(c1o1+q); } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c1o54*(rhoDiff + c6o1*( VeloX+VeloZ)))/(c1o1+q); + (D.f[DIR_M0M])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c1o54*(rhoDiff + c6o1*( VeloX+VeloZ)))/(c1o1+q); } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c1o54*(rhoDiff + c6o1*(-VeloX-VeloZ)))/(c1o1+q); + (D.f[DIR_P0P])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c1o54*(rhoDiff + c6o1*(-VeloX-VeloZ)))/(c1o1+q); } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c1o54*(rhoDiff + c6o1*( VeloX-VeloZ)))/(c1o1+q); + (D.f[DIR_M0P])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c1o54*(rhoDiff + c6o1*( VeloX-VeloZ)))/(c1o1+q); } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c1o54*(rhoDiff + c6o1*(-VeloX+VeloZ)))/(c1o1+q); + (D.f[DIR_P0M])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c1o54*(rhoDiff + c6o1*(-VeloX+VeloZ)))/(c1o1+q); } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c1o54*(rhoDiff + c6o1*( VeloY+VeloZ)))/(c1o1+q); + (D.f[DIR_0MM])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c1o54*(rhoDiff + c6o1*( VeloY+VeloZ)))/(c1o1+q); } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c1o54*(rhoDiff + c6o1*( -VeloY-VeloZ)))/(c1o1+q); + (D.f[DIR_0PP])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c1o54*(rhoDiff + c6o1*( -VeloY-VeloZ)))/(c1o1+q); } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c1o54*(rhoDiff + c6o1*( VeloY-VeloZ)))/(c1o1+q); + (D.f[DIR_0MP])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c1o54*(rhoDiff + c6o1*( VeloY-VeloZ)))/(c1o1+q); } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c1o54*(rhoDiff + c6o1*( -VeloY+VeloZ)))/(c1o1+q); + (D.f[DIR_0PM])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c1o54*(rhoDiff + c6o1*( -VeloY+VeloZ)))/(c1o1+q); } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c1o216*(rhoDiff + c6o1*( VeloX+VeloY+VeloZ)))/(c1o1+q); + (D.f[DIR_MMM])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c1o216*(rhoDiff + c6o1*( VeloX+VeloY+VeloZ)))/(c1o1+q); } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c1o216*(rhoDiff + c6o1*(-VeloX-VeloY-VeloZ)))/(c1o1+q); + (D.f[DIR_PPP])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c1o216*(rhoDiff + c6o1*(-VeloX-VeloY-VeloZ)))/(c1o1+q); } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c1o216*(rhoDiff + c6o1*( VeloX+VeloY-VeloZ)))/(c1o1+q); + (D.f[DIR_MMP])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c1o216*(rhoDiff + c6o1*( VeloX+VeloY-VeloZ)))/(c1o1+q); } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c1o216*(rhoDiff + c6o1*(-VeloX-VeloY+VeloZ)))/(c1o1+q); + (D.f[DIR_PPM])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c1o216*(rhoDiff + c6o1*(-VeloX-VeloY+VeloZ)))/(c1o1+q); } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c1o216*(rhoDiff + c6o1*( VeloX-VeloY+VeloZ)))/(c1o1+q); + (D.f[DIR_MPM])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c1o216*(rhoDiff + c6o1*( VeloX-VeloY+VeloZ)))/(c1o1+q); } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c1o216*(rhoDiff + c6o1*(-VeloX+VeloY-VeloZ)))/(c1o1+q); + (D.f[DIR_PMP])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c1o216*(rhoDiff + c6o1*(-VeloX+VeloY-VeloZ)))/(c1o1+q); } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c1o216*(rhoDiff + c6o1*( VeloX-VeloY-VeloZ)))/(c1o1+q); + (D.f[DIR_MPP])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c1o216*(rhoDiff + c6o1*( VeloX-VeloY-VeloZ)))/(c1o1+q); } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c1o216*(rhoDiff + c6o1*(-VeloX+VeloY+VeloZ)))/(c1o1+q); + (D.f[DIR_PMM])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c1o216*(rhoDiff + c6o1*(-VeloX+VeloY+VeloZ)))/(c1o1+q); } } } diff --git a/src/gpu/VirtualFluids_GPU/GPU/Random.cu b/src/gpu/VirtualFluids_GPU/GPU/Random.cu index 702021f8145f2456a0d405814615b56d7d575422..a605fbd42d2977e0f0b6e15aeb50f8c78654f31c 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/Random.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/Random.cu @@ -1,16 +1,18 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + //random numbers #include <curand.h> #include <curand_kernel.h> ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void initRandom(curandState* state) +__global__ void initRandom(curandState* state) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -34,7 +36,7 @@ extern "C" __global__ void initRandom(curandState* state) ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void generateRandomValues(curandState* state, real* randArray) +__global__ void generateRandomValues(curandState* state, real* randArray) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index diff --git a/src/gpu/VirtualFluids_GPU/GPU/SchlafferBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/SchlafferBCs27.cu index 9a28050cdb80d90de2746db83716dd52ece04ad6..8675780d26e63656b04fdfc1f9836b1eba8d1b87 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/SchlafferBCs27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/SchlafferBCs27.cu @@ -1,31 +1,33 @@ /* Device code */ -#include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; +// TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void PressSchlaff27(real* rhoBC, +__global__ void PressSchlaff27(real* rhoBC, real* DD, real* vx0, real* vy0, real* vz0, real* deltaVz0, - int* k_Q, - int* k_N, - int kQ, - real om1, + int* k_Q, + int* k_N, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index const unsigned nx = blockDim.x; const unsigned ny = gridDim.x; @@ -33,7 +35,7 @@ extern "C" __global__ void PressSchlaff27(real* rhoBC, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -67,96 +69,96 @@ extern "C" __global__ void PressSchlaff27(real* rhoBC, unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real f1_E,f1_W,f1_N,f1_S,f1_T,f1_B,f1_NE,f1_SW,f1_SE,f1_NW,f1_TE,f1_BW,f1_BE,f1_TW,f1_TN,f1_BS,f1_BN,f1_TS,f1_ZERO,f1_TNE,f1_TSW,f1_TSE,f1_TNW,f1_BNE,f1_BSW,f1_BSE,f1_BNW; - f1_E = (D.f[dirE ])[ke ]; - f1_W = (D.f[dirW ])[kw ]; - f1_N = (D.f[dirN ])[kn ]; - f1_S = (D.f[dirS ])[ks ]; - f1_T = (D.f[dirT ])[kt ]; - f1_B = (D.f[dirB ])[kb ]; - f1_NE = (D.f[dirNE ])[kne ]; - f1_SW = (D.f[dirSW ])[ksw ]; - f1_SE = (D.f[dirSE ])[kse ]; - f1_NW = (D.f[dirNW ])[knw ]; - f1_TE = (D.f[dirTE ])[kte ]; - f1_BW = (D.f[dirBW ])[kbw ]; - f1_BE = (D.f[dirBE ])[kbe ]; - f1_TW = (D.f[dirTW ])[ktw ]; - f1_TN = (D.f[dirTN ])[ktn ]; - f1_BS = (D.f[dirBS ])[kbs ]; - f1_BN = (D.f[dirBN ])[kbn ]; - f1_TS = (D.f[dirTS ])[kts ]; - f1_ZERO = (D.f[dirZERO])[kzero]; - f1_TNE = (D.f[dirTNE ])[ktne ]; - f1_TSW = (D.f[dirTSW ])[ktsw ]; - f1_TSE = (D.f[dirTSE ])[ktse ]; - f1_TNW = (D.f[dirTNW ])[ktnw ]; - f1_BNE = (D.f[dirBNE ])[kbne ]; - f1_BSW = (D.f[dirBSW ])[kbsw ]; - f1_BSE = (D.f[dirBSE ])[kbse ]; - f1_BNW = (D.f[dirBNW ])[kbnw ]; + f1_E = (D.f[DIR_P00 ])[ke ]; + f1_W = (D.f[DIR_M00 ])[kw ]; + f1_N = (D.f[DIR_0P0 ])[kn ]; + f1_S = (D.f[DIR_0M0 ])[ks ]; + f1_T = (D.f[DIR_00P ])[kt ]; + f1_B = (D.f[DIR_00M ])[kb ]; + f1_NE = (D.f[DIR_PP0 ])[kne ]; + f1_SW = (D.f[DIR_MM0 ])[ksw ]; + f1_SE = (D.f[DIR_PM0 ])[kse ]; + f1_NW = (D.f[DIR_MP0 ])[knw ]; + f1_TE = (D.f[DIR_P0P ])[kte ]; + f1_BW = (D.f[DIR_M0M ])[kbw ]; + f1_BE = (D.f[DIR_P0M ])[kbe ]; + f1_TW = (D.f[DIR_M0P ])[ktw ]; + f1_TN = (D.f[DIR_0PP ])[ktn ]; + f1_BS = (D.f[DIR_0MM ])[kbs ]; + f1_BN = (D.f[DIR_0PM ])[kbn ]; + f1_TS = (D.f[DIR_0MP ])[kts ]; + f1_ZERO = (D.f[DIR_000])[kzero]; + f1_TNE = (D.f[DIR_PPP ])[ktne ]; + f1_TSW = (D.f[DIR_MMP ])[ktsw ]; + f1_TSE = (D.f[DIR_PMP ])[ktse ]; + f1_TNW = (D.f[DIR_MPP ])[ktnw ]; + f1_BNE = (D.f[DIR_PPM ])[kbne ]; + f1_BSW = (D.f[DIR_MMM ])[kbsw ]; + f1_BSE = (D.f[DIR_PMM ])[kbse ]; + f1_BNW = (D.f[DIR_MPM ])[kbnw ]; ////////////////////////////////////////////////////////////////////////// real cs = c1o1/sqrt(c3o1); real csp1 = cs + c1o1; @@ -183,7 +185,7 @@ extern "C" __global__ void PressSchlaff27(real* rhoBC, real vs_z = relFac * (VZ+cs) * ( csp1 - sqrt(csp1Sq + c2o1*VZ - c2o1*temp) ); //old = relFac * cs * ( csp1 - sqrt(csp1Sq + two*VZ - two*temp) ); - // 3. Compute density of compensated velocity: + // 3. Compute density of compensated velocity: real tempDeltaV = deltaVz0[k]; real rholoc = temp - c1o1 * (VZ + tempDeltaV + vs_z); @@ -220,15 +222,15 @@ extern "C" __global__ void PressSchlaff27(real* rhoBC, deltaVz0[k] = tempDeltaV; - (D.f[dirB ])[kb ] = f1_B ; - (D.f[dirBW ])[kbw ] = f1_BW ; - (D.f[dirBE ])[kbe ] = f1_BE ; - (D.f[dirBS ])[kbs ] = f1_BS ; - (D.f[dirBN ])[kbn ] = f1_BN ; - (D.f[dirBNE ])[kbne ] = f1_BNE ; - (D.f[dirBSW ])[kbsw ] = f1_BSW ; - (D.f[dirBSE ])[kbse ] = f1_BSE ; - (D.f[dirBNW ])[kbnw ] = f1_BNW ; + (D.f[DIR_00M ])[kb ] = f1_B ; + (D.f[DIR_M0M ])[kbw ] = f1_BW ; + (D.f[DIR_P0M ])[kbe ] = f1_BE ; + (D.f[DIR_0MM ])[kbs ] = f1_BS ; + (D.f[DIR_0PM ])[kbn ] = f1_BN ; + (D.f[DIR_PPM ])[kbne ] = f1_BNE ; + (D.f[DIR_MMM ])[kbsw ] = f1_BSW ; + (D.f[DIR_PMM ])[kbse ] = f1_BSE ; + (D.f[DIR_MPM ])[kbnw ] = f1_BNW ; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -270,26 +272,26 @@ extern "C" __global__ void PressSchlaff27(real* rhoBC, - +// TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void VelSchlaff27( int t, +__global__ void VelSchlaff27( int t, real* DD, real* vz0, real* deltaVz0, - int* k_Q, - int* k_N, - int kQ, - real om1, + int* k_Q, + int* k_N, + int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int size_Mat, + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index const unsigned nx = blockDim.x; const unsigned ny = gridDim.x; @@ -297,7 +299,7 @@ extern "C" __global__ void VelSchlaff27( int t, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -331,124 +333,124 @@ extern "C" __global__ void VelSchlaff27( int t, unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real f1_E,f1_W,f1_N,f1_S,f1_T,f1_B,f1_NE,f1_SW,f1_SE,f1_NW,f1_TE,f1_BW,f1_BE,f1_TW,f1_TN,f1_BS,f1_BN,f1_TS,f1_ZERO, f1_TNE,f1_TSW,f1_TSE,f1_TNW,f1_BNE,f1_BSW,f1_BSE,f1_BNW; - f1_E = (D.f[dirE ])[ke ]; - f1_W = (D.f[dirW ])[kw ]; - f1_N = (D.f[dirN ])[kn ]; - f1_S = (D.f[dirS ])[ks ]; - f1_T = (D.f[dirT ])[kt ]; - f1_B = (D.f[dirB ])[kb ]; - f1_NE = (D.f[dirNE ])[kne ]; - f1_SW = (D.f[dirSW ])[ksw ]; - f1_SE = (D.f[dirSE ])[kse ]; - f1_NW = (D.f[dirNW ])[knw ]; - f1_TE = (D.f[dirTE ])[kte ]; - f1_BW = (D.f[dirBW ])[kbw ]; - f1_BE = (D.f[dirBE ])[kbe ]; - f1_TW = (D.f[dirTW ])[ktw ]; - f1_TN = (D.f[dirTN ])[ktn ]; - f1_BS = (D.f[dirBS ])[kbs ]; - f1_BN = (D.f[dirBN ])[kbn ]; - f1_TS = (D.f[dirTS ])[kts ]; - f1_ZERO = (D.f[dirZERO])[kzero]; - f1_TNE = (D.f[dirTNE ])[ktne ]; - f1_TSW = (D.f[dirTSW ])[ktsw ]; - f1_TSE = (D.f[dirTSE ])[ktse ]; - f1_TNW = (D.f[dirTNW ])[ktnw ]; - f1_BNE = (D.f[dirBNE ])[kbne ]; - f1_BSW = (D.f[dirBSW ])[kbsw ]; - f1_BSE = (D.f[dirBSE ])[kbse ]; - f1_BNW = (D.f[dirBNW ])[kbnw ]; - //f1_W = (D.f[dirE ])[ke ]; - //f1_E = (D.f[dirW ])[kw ]; - //f1_S = (D.f[dirN ])[kn ]; - //f1_N = (D.f[dirS ])[ks ]; - //f1_B = (D.f[dirT ])[kt ]; - //f1_T = (D.f[dirB ])[kb ]; - //f1_SW = (D.f[dirNE ])[kne ]; - //f1_NE = (D.f[dirSW ])[ksw ]; - //f1_NW = (D.f[dirSE ])[kse ]; - //f1_SE = (D.f[dirNW ])[knw ]; - //f1_BW = (D.f[dirTE ])[kte ]; - //f1_TE = (D.f[dirBW ])[kbw ]; - //f1_TW = (D.f[dirBE ])[kbe ]; - //f1_BE = (D.f[dirTW ])[ktw ]; - //f1_BS = (D.f[dirTN ])[ktn ]; - //f1_TN = (D.f[dirBS ])[kbs ]; - //f1_TS = (D.f[dirBN ])[kbn ]; - //f1_BN = (D.f[dirTS ])[kts ]; - //f1_ZERO = (D.f[dirZERO])[kzero]; - //f1_BSW = (D.f[dirTNE ])[ktne ]; - //f1_BNE = (D.f[dirTSW ])[ktsw ]; - //f1_BNW = (D.f[dirTSE ])[ktse ]; - //f1_BSE = (D.f[dirTNW ])[ktnw ]; - //f1_TSW = (D.f[dirBNE ])[kbne ]; - //f1_TNE = (D.f[dirBSW ])[kbsw ]; - //f1_TNW = (D.f[dirBSE ])[kbse ]; - //f1_TSE = (D.f[dirBNW ])[kbnw ]; + f1_E = (D.f[DIR_P00 ])[ke ]; + f1_W = (D.f[DIR_M00 ])[kw ]; + f1_N = (D.f[DIR_0P0 ])[kn ]; + f1_S = (D.f[DIR_0M0 ])[ks ]; + f1_T = (D.f[DIR_00P ])[kt ]; + f1_B = (D.f[DIR_00M ])[kb ]; + f1_NE = (D.f[DIR_PP0 ])[kne ]; + f1_SW = (D.f[DIR_MM0 ])[ksw ]; + f1_SE = (D.f[DIR_PM0 ])[kse ]; + f1_NW = (D.f[DIR_MP0 ])[knw ]; + f1_TE = (D.f[DIR_P0P ])[kte ]; + f1_BW = (D.f[DIR_M0M ])[kbw ]; + f1_BE = (D.f[DIR_P0M ])[kbe ]; + f1_TW = (D.f[DIR_M0P ])[ktw ]; + f1_TN = (D.f[DIR_0PP ])[ktn ]; + f1_BS = (D.f[DIR_0MM ])[kbs ]; + f1_BN = (D.f[DIR_0PM ])[kbn ]; + f1_TS = (D.f[DIR_0MP ])[kts ]; + f1_ZERO = (D.f[DIR_000])[kzero]; + f1_TNE = (D.f[DIR_PPP ])[ktne ]; + f1_TSW = (D.f[DIR_MMP ])[ktsw ]; + f1_TSE = (D.f[DIR_PMP ])[ktse ]; + f1_TNW = (D.f[DIR_MPP ])[ktnw ]; + f1_BNE = (D.f[DIR_PPM ])[kbne ]; + f1_BSW = (D.f[DIR_MMM ])[kbsw ]; + f1_BSE = (D.f[DIR_PMM ])[kbse ]; + f1_BNW = (D.f[DIR_MPM ])[kbnw ]; + //f1_W = (D.f[DIR_P00 ])[ke ]; + //f1_E = (D.f[DIR_M00 ])[kw ]; + //f1_S = (D.f[DIR_0P0 ])[kn ]; + //f1_N = (D.f[DIR_0M0 ])[ks ]; + //f1_B = (D.f[DIR_00P ])[kt ]; + //f1_T = (D.f[DIR_00M ])[kb ]; + //f1_SW = (D.f[DIR_PP0 ])[kne ]; + //f1_NE = (D.f[DIR_MM0 ])[ksw ]; + //f1_NW = (D.f[DIR_PM0 ])[kse ]; + //f1_SE = (D.f[DIR_MP0 ])[knw ]; + //f1_BW = (D.f[DIR_P0P ])[kte ]; + //f1_TE = (D.f[DIR_M0M ])[kbw ]; + //f1_TW = (D.f[DIR_P0M ])[kbe ]; + //f1_BE = (D.f[DIR_M0P ])[ktw ]; + //f1_BS = (D.f[DIR_0PP ])[ktn ]; + //f1_TN = (D.f[DIR_0MM ])[kbs ]; + //f1_TS = (D.f[DIR_0PM ])[kbn ]; + //f1_BN = (D.f[DIR_0MP ])[kts ]; + //f1_ZERO = (D.f[DIR_000])[kzero]; + //f1_BSW = (D.f[DIR_PPP ])[ktne ]; + //f1_BNE = (D.f[DIR_MMP ])[ktsw ]; + //f1_BNW = (D.f[DIR_PMP ])[ktse ]; + //f1_BSE = (D.f[DIR_MPP ])[ktnw ]; + //f1_TSW = (D.f[DIR_PPM ])[kbne ]; + //f1_TNE = (D.f[DIR_MMM ])[kbsw ]; + //f1_TNW = (D.f[DIR_PMM ])[kbse ]; + //f1_TSE = (D.f[DIR_MPM ])[kbnw ]; ////////////////////////////////////////////////////////////////////////// real cs = c1o1/sqrt(c3o1); real csp1 = cs + c1o1; @@ -462,7 +464,7 @@ extern "C" __global__ void VelSchlaff27( int t, // 6.2e-9 ~ 29.9 dB // 2.0e-7 ~ 60.1 dB /Vel // 2.0e-5 ~ 100.1 dB /press - real uSlimit = Op0000002; + real uSlimit = Op0000002; ////////////////////////////////////////////////////////////////////////// real VX = c0o1; real VY = c0o1; @@ -478,9 +480,9 @@ extern "C" __global__ void VelSchlaff27( int t, //} //else //{ - vs_z = relFac * (cs-VZ) * ( sqrt(csp1Sq - c2o1*VZ - c2o1*temp) - csp1 ); //old = relFac * cs * ( sqrt(csp1Sq - two*VZ - two*temp) - csp1 ); + vs_z = relFac * (cs-VZ) * ( sqrt(csp1Sq - c2o1*VZ - c2o1*temp) - csp1 ); //old = relFac * cs * ( sqrt(csp1Sq - two*VZ - two*temp) - csp1 ); //} - + // 3. Adapt Speed: real tempDeltaV = deltaVz0[k]; real dv = tempDeltaV + vs_z; @@ -520,64 +522,64 @@ extern "C" __global__ void VelSchlaff27( int t, f1_TNW = f1_BSE - c1o36 * (VX - VY - VZ); deltaVz0[k] = tempDeltaV; - (D.f[dirT ])[kt ] = f1_T ; - (D.f[dirTE ])[kte ] = f1_TE ; - (D.f[dirTW ])[ktw ] = f1_TW ; - (D.f[dirTN ])[ktn ] = f1_TN ; - (D.f[dirTS ])[kts ] = f1_TS ; - (D.f[dirTNE ])[ktne ] = f1_TNE; - (D.f[dirTSW ])[ktsw ] = f1_TSW; - (D.f[dirTSE ])[ktse ] = f1_TSE; - (D.f[dirTNW ])[ktnw ] = f1_TNW; - - //(D.f[dirB ])[kb ] = f1_B ; - //(D.f[dirBW ])[kbw ] = f1_BW ; - //(D.f[dirBE ])[kbe ] = f1_BE ; - //(D.f[dirBS ])[kbs ] = f1_BS ; - //(D.f[dirBN ])[kbn ] = f1_BN ; - //(D.f[dirBNE ])[kbne ] = f1_BNE ; - //(D.f[dirBSW ])[kbsw ] = f1_BSW ; - //(D.f[dirBSE ])[kbse ] = f1_BSE ; - //(D.f[dirBNW ])[kbnw ] = f1_BNW ; - - - //(D.f[dirT ])[kt ] = f1_B ; - //(D.f[dirTE ])[kte ] = f1_BW ; - //(D.f[dirTW ])[ktw ] = f1_BE ; - //(D.f[dirTN ])[ktn ] = f1_BS ; - //(D.f[dirTS ])[kts ] = f1_BN ; - //(D.f[dirTNE ])[ktne ] = f1_BSW; - //(D.f[dirTSW ])[ktsw ] = f1_BNE; - //(D.f[dirTSE ])[ktse ] = f1_BNW; - //(D.f[dirTNW ])[ktnw ] = f1_BSE; - - //(D.f[dirE ])[ke ] = f1_W -c2over27*drho1; - //(D.f[dirW ])[kw ] = f1_E -c2over27*drho1; - //(D.f[dirN ])[kn ] = f1_S -c2over27*drho1; - //(D.f[dirS ])[ks ] = f1_N -c2over27*drho1; - //(D.f[dirT ])[kt ] = f1_B -c2over27*drho1; - //(D.f[dirB ])[kb ] = f1_T -c2over27*drho1; - //(D.f[dirNE ])[kne ] = f1_SW -c1over54*drho1; - //(D.f[dirSW ])[ksw ] = f1_NE -c1over54*drho1; - //(D.f[dirSE ])[kse ] = f1_NW -c1over54*drho1; - //(D.f[dirNW ])[knw ] = f1_SE -c1over54*drho1; - //(D.f[dirTE ])[kte ] = f1_BW -c1over54*drho1; - //(D.f[dirBW ])[kbw ] = f1_TE -c1over54*drho1; - //(D.f[dirBE ])[kbe ] = f1_TW -c1over54*drho1; - //(D.f[dirTW ])[ktw ] = f1_BE -c1over54*drho1; - //(D.f[dirTN ])[ktn ] = f1_BS -c1over54*drho1; - //(D.f[dirBS ])[kbs ] = f1_TN -c1over54*drho1; - //(D.f[dirBN ])[kbn ] = f1_TS -c1over54*drho1; - //(D.f[dirTS ])[kts ] = f1_BN -c1over54*drho1; - //(D.f[dirZERO])[kzero] = f1_ZERO-c8over27*drho1; - //(D.f[dirTNE ])[ktne ] = f1_BSW -c1over216*drho1; - //(D.f[dirTSW ])[ktsw ] = f1_BNE -c1over216*drho1; - //(D.f[dirTSE ])[ktse ] = f1_BNW -c1over216*drho1; - //(D.f[dirTNW ])[ktnw ] = f1_BSE -c1over216*drho1; - //(D.f[dirBNE ])[kbne ] = f1_TSW -c1over216*drho1; - //(D.f[dirBSW ])[kbsw ] = f1_TNE -c1over216*drho1; - //(D.f[dirBSE ])[kbse ] = f1_TNW -c1over216*drho1; - //(D.f[dirBNW ])[kbnw ] = f1_TSE -c1over216*drho1; + (D.f[DIR_00P ])[kt ] = f1_T ; + (D.f[DIR_P0P ])[kte ] = f1_TE ; + (D.f[DIR_M0P ])[ktw ] = f1_TW ; + (D.f[DIR_0PP ])[ktn ] = f1_TN ; + (D.f[DIR_0MP ])[kts ] = f1_TS ; + (D.f[DIR_PPP ])[ktne ] = f1_TNE; + (D.f[DIR_MMP ])[ktsw ] = f1_TSW; + (D.f[DIR_PMP ])[ktse ] = f1_TSE; + (D.f[DIR_MPP ])[ktnw ] = f1_TNW; + + //(D.f[DIR_00M ])[kb ] = f1_B ; + //(D.f[DIR_M0M ])[kbw ] = f1_BW ; + //(D.f[DIR_P0M ])[kbe ] = f1_BE ; + //(D.f[DIR_0MM ])[kbs ] = f1_BS ; + //(D.f[DIR_0PM ])[kbn ] = f1_BN ; + //(D.f[DIR_PPM ])[kbne ] = f1_BNE ; + //(D.f[DIR_MMM ])[kbsw ] = f1_BSW ; + //(D.f[DIR_PMM ])[kbse ] = f1_BSE ; + //(D.f[DIR_MPM ])[kbnw ] = f1_BNW ; + + + //(D.f[DIR_00P ])[kt ] = f1_B ; + //(D.f[DIR_P0P ])[kte ] = f1_BW ; + //(D.f[DIR_M0P ])[ktw ] = f1_BE ; + //(D.f[DIR_0PP ])[ktn ] = f1_BS ; + //(D.f[DIR_0MP ])[kts ] = f1_BN ; + //(D.f[DIR_PPP ])[ktne ] = f1_BSW; + //(D.f[DIR_MMP ])[ktsw ] = f1_BNE; + //(D.f[DIR_PMP ])[ktse ] = f1_BNW; + //(D.f[DIR_MPP ])[ktnw ] = f1_BSE; + + //(D.f[DIR_P00 ])[ke ] = f1_W -c2over27*drho1; + //(D.f[DIR_M00 ])[kw ] = f1_E -c2over27*drho1; + //(D.f[DIR_0P0 ])[kn ] = f1_S -c2over27*drho1; + //(D.f[DIR_0M0 ])[ks ] = f1_N -c2over27*drho1; + //(D.f[DIR_00P ])[kt ] = f1_B -c2over27*drho1; + //(D.f[DIR_00M ])[kb ] = f1_T -c2over27*drho1; + //(D.f[DIR_PP0 ])[kne ] = f1_SW -c1over54*drho1; + //(D.f[DIR_MM0 ])[ksw ] = f1_NE -c1over54*drho1; + //(D.f[DIR_PM0 ])[kse ] = f1_NW -c1over54*drho1; + //(D.f[DIR_MP0 ])[knw ] = f1_SE -c1over54*drho1; + //(D.f[DIR_P0P ])[kte ] = f1_BW -c1over54*drho1; + //(D.f[DIR_M0M ])[kbw ] = f1_TE -c1over54*drho1; + //(D.f[DIR_P0M ])[kbe ] = f1_TW -c1over54*drho1; + //(D.f[DIR_M0P ])[ktw ] = f1_BE -c1over54*drho1; + //(D.f[DIR_0PP ])[ktn ] = f1_BS -c1over54*drho1; + //(D.f[DIR_0MM ])[kbs ] = f1_TN -c1over54*drho1; + //(D.f[DIR_0PM ])[kbn ] = f1_TS -c1over54*drho1; + //(D.f[DIR_0MP ])[kts ] = f1_BN -c1over54*drho1; + //(D.f[DIR_000])[kzero] = f1_ZERO-c8over27*drho1; + //(D.f[DIR_PPP ])[ktne ] = f1_BSW -c1over216*drho1; + //(D.f[DIR_MMP ])[ktsw ] = f1_BNE -c1over216*drho1; + //(D.f[DIR_PMP ])[ktse ] = f1_BNW -c1over216*drho1; + //(D.f[DIR_MPP ])[ktnw ] = f1_BSE -c1over216*drho1; + //(D.f[DIR_PPM ])[kbne ] = f1_TSW -c1over216*drho1; + //(D.f[DIR_MMM ])[kbsw ] = f1_TNE -c1over216*drho1; + //(D.f[DIR_PMM ])[kbse ] = f1_TNW -c1over216*drho1; + //(D.f[DIR_MPM ])[kbnw ] = f1_TSE -c1over216*drho1; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/GPU/SetForcing27.cu b/src/gpu/VirtualFluids_GPU/GPU/SetForcing27.cu index baad61888971dfcbaf6c04f8af60d09f9d433dd6..8dbf2c670a549f9a6afe581510205c31246b50cb 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/SetForcing27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/SetForcing27.cu @@ -1,12 +1,13 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void GetVeloforForcing27( real* DD, +__global__ void GetVeloforForcing27( real* DD, int* bcIndex, int nonAtBC, real* Vx, @@ -16,68 +17,68 @@ extern "C" __global__ void GetVeloforForcing27( real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -122,33 +123,33 @@ extern "C" __global__ void GetVeloforForcing27( real* DD, unsigned int ktne = KQK; unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[ke ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[kn ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[kt ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[kne ]; - real mfaab = (D.f[dirSW ])[ksw ]; - real mfcab = (D.f[dirSE ])[kse ]; - real mfacb = (D.f[dirNW ])[knw ]; - real mfcbc = (D.f[dirTE ])[kte ]; - real mfaba = (D.f[dirBW ])[kbw ]; - real mfcba = (D.f[dirBE ])[kbe ]; - real mfabc = (D.f[dirTW ])[ktw ]; - real mfbcc = (D.f[dirTN ])[ktn ]; - real mfbaa = (D.f[dirBS ])[kbs ]; - real mfbca = (D.f[dirBN ])[kbn ]; - real mfbac = (D.f[dirTS ])[kts ]; - real mfbbb = (D.f[dirZERO])[kzero]; - real mfccc = (D.f[dirTNE ])[ktne ]; - real mfaac = (D.f[dirTSW ])[ktsw ]; - real mfcac = (D.f[dirTSE ])[ktse ]; - real mfacc = (D.f[dirTNW ])[ktnw ]; - real mfcca = (D.f[dirBNE ])[kbne ]; - real mfaaa = (D.f[dirBSW ])[kbsw ]; - real mfcaa = (D.f[dirBSE ])[kbse ]; - real mfaca = (D.f[dirBNW ])[kbnw ]; + real mfcbb = (D.f[DIR_P00 ])[ke ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[kn ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[kt ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[kne ]; + real mfaab = (D.f[DIR_MM0 ])[ksw ]; + real mfcab = (D.f[DIR_PM0 ])[kse ]; + real mfacb = (D.f[DIR_MP0 ])[knw ]; + real mfcbc = (D.f[DIR_P0P ])[kte ]; + real mfaba = (D.f[DIR_M0M ])[kbw ]; + real mfcba = (D.f[DIR_P0M ])[kbe ]; + real mfabc = (D.f[DIR_M0P ])[ktw ]; + real mfbcc = (D.f[DIR_0PP ])[ktn ]; + real mfbaa = (D.f[DIR_0MM ])[kbs ]; + real mfbca = (D.f[DIR_0PM ])[kbn ]; + real mfbac = (D.f[DIR_0MP ])[kts ]; + real mfbbb = (D.f[DIR_000])[kzero]; + real mfccc = (D.f[DIR_PPP ])[ktne ]; + real mfaac = (D.f[DIR_MMP ])[ktsw ]; + real mfcac = (D.f[DIR_PMP ])[ktse ]; + real mfacc = (D.f[DIR_MPP ])[ktnw ]; + real mfcca = (D.f[DIR_PPM ])[kbne ]; + real mfaaa = (D.f[DIR_MMM ])[kbsw ]; + real mfcaa = (D.f[DIR_PMM ])[kbse ]; + real mfaca = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////////// real rho = (mfccc+mfaaa + mfaca+mfcac + mfacc+mfcaa + mfaac+mfcca + mfbac+mfbca + mfbaa+mfbcc + mfabc+mfcba + mfaba+mfcbc + mfacb+mfcab + mfaab+mfccb + diff --git a/src/gpu/VirtualFluids_GPU/GPU/SlipBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/SlipBCs27.cu index fc792a2c3a0f7438f4ee0882988a39f7260f21be..0079c927373e90c1e408d2c57ace0595bcfdff15 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/SlipBCs27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/SlipBCs27.cu @@ -1,82 +1,84 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" -#include <lbm/constants/NumericConstants.h> +#include "lbm/constants/D3Q27.h" +#include "lbm/constants/NumericConstants.h" +#include "KernelUtilities.h" using namespace vf::lbm::constant; +using namespace vf::lbm::dir; ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QSlipDevice27(real* DD, +__global__ void QSlipDevice27(real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -89,7 +91,7 @@ extern "C" __global__ void QSlipDevice27(real* DD, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<sizeQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, @@ -97,32 +99,32 @@ extern "C" __global__ void QSlipDevice27(real* DD, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -154,37 +156,37 @@ extern "C" __global__ void QSlipDevice27(real* DD, unsigned int ktne = KQK; unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; + real f_W = (D.f[DIR_P00 ])[ke ]; + real f_E = (D.f[DIR_M00 ])[kw ]; + real f_S = (D.f[DIR_0P0 ])[kn ]; + real f_N = (D.f[DIR_0M0 ])[ks ]; + real f_B = (D.f[DIR_00P ])[kt ]; + real f_T = (D.f[DIR_00M ])[kb ]; + real f_SW = (D.f[DIR_PP0 ])[kne ]; + real f_NE = (D.f[DIR_MM0 ])[ksw ]; + real f_NW = (D.f[DIR_PM0 ])[kse ]; + real f_SE = (D.f[DIR_MP0 ])[knw ]; + real f_BW = (D.f[DIR_P0P ])[kte ]; + real f_TE = (D.f[DIR_M0M ])[kbw ]; + real f_TW = (D.f[DIR_P0M ])[kbe ]; + real f_BE = (D.f[DIR_M0P ])[ktw ]; + real f_BS = (D.f[DIR_0PP ])[ktn ]; + real f_TN = (D.f[DIR_0MM ])[kbs ]; + real f_TS = (D.f[DIR_0PM ])[kbn ]; + real f_BN = (D.f[DIR_0MP ])[kts ]; + real f_BSW = (D.f[DIR_PPP ])[ktne ]; + real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + real f_BNW = (D.f[DIR_PMP ])[ktse ]; + real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + real f_TSW = (D.f[DIR_PPM ])[kbne ]; + real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + real f_TNW = (D.f[DIR_PMM ])[kbse ]; + real f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -202,69 +204,69 @@ extern "C" __global__ void QSlipDevice27(real* DD, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Test - //(D.f[dirZERO])[k]=c1o10; + //(D.f[DIR_000])[k]=c1o10; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real fac = c1o1;//c99o100; real VeloX = fac*vx1; @@ -282,8 +284,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, VeloZ = fac*vx3; x = true; feq=c2o27* (drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-feq*om1)/(c1o1-om1)+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ))/(c1o1+q); - //(D.f[dirW])[kw]=zero; + (D.f[DIR_M00])[kw]=(c1o1-q)/(c1o1+q)*(f_E-feq*om1)/(c1o1-om1)+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ))/(c1o1+q); + //(D.f[DIR_M00])[kw]=zero; } q = q_dirW[k]; @@ -294,8 +296,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, VeloZ = fac*vx3; x = true; feq=c2o27* (drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-feq*om1)/(c1o1-om1)+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ))/(c1o1+q); - //(D.f[dirE])[ke]=zero; + (D.f[DIR_P00])[ke]=(c1o1-q)/(c1o1+q)*(f_W-feq*om1)/(c1o1-om1)+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ))/(c1o1+q); + //(D.f[DIR_P00])[ke]=zero; } q = q_dirN[k]; @@ -306,8 +308,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, VeloZ = fac*vx3; y = true; feq=c2o27* (drho+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-feq*om1)/(c1o1-om1)+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ))/(c1o1+q); - //(D.f[dirS])[ks]=zero; + (D.f[DIR_0M0])[ks]=(c1o1-q)/(c1o1+q)*(f_N-feq*om1)/(c1o1-om1)+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ))/(c1o1+q); + //(D.f[DIR_0M0])[ks]=zero; } q = q_dirS[k]; @@ -318,8 +320,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, VeloZ = fac*vx3; y = true; feq=c2o27* (drho+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-feq*om1)/(c1o1-om1)+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ))/(c1o1+q); - //(D.f[dirN])[kn]=zero; + (D.f[DIR_0P0])[kn]=(c1o1-q)/(c1o1+q)*(f_S-feq*om1)/(c1o1-om1)+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ))/(c1o1+q); + //(D.f[DIR_0P0])[kn]=zero; } q = q_dirT[k]; @@ -330,8 +332,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, VeloZ = c0o1; z = true; feq=c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-feq*om1)/(c1o1-om1)+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ ))/(c1o1+q); - //(D.f[dirB])[kb]=one; + (D.f[DIR_00M])[kb]=(c1o1-q)/(c1o1+q)*(f_T-feq*om1)/(c1o1-om1)+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ ))/(c1o1+q); + //(D.f[DIR_00M])[kb]=one; } q = q_dirB[k]; @@ -342,8 +344,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, VeloZ = c0o1; z = true; feq=c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-feq*om1)/(c1o1-om1)+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ))/(c1o1+q); - //(D.f[dirT])[kt]=zero; + (D.f[DIR_00P])[kt]=(c1o1-q)/(c1o1+q)*(f_B-feq*om1)/(c1o1-om1)+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ))/(c1o1+q); + //(D.f[DIR_00P])[kt]=zero; } q = q_dirNE[k]; @@ -355,8 +357,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (x == true) VeloX = c0o1; if (y == true) VeloY = c0o1; feq=c1o54* (drho+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-feq*om1)/(c1o1-om1)+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY))/(c1o1+q); - //(D.f[dirSW])[ksw]=zero; + (D.f[DIR_MM0])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-feq*om1)/(c1o1-om1)+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY))/(c1o1+q); + //(D.f[DIR_MM0])[ksw]=zero; } q = q_dirSW[k]; @@ -368,8 +370,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (x == true) VeloX = c0o1; if (y == true) VeloY = c0o1; feq=c1o54* (drho+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-feq*om1)/(c1o1-om1)+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q); - //(D.f[dirNE])[kne]=zero; + (D.f[DIR_PP0])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-feq*om1)/(c1o1-om1)+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q); + //(D.f[DIR_PP0])[kne]=zero; } q = q_dirSE[k]; @@ -381,8 +383,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (x == true) VeloX = c0o1; if (y == true) VeloY = c0o1; feq=c1o54* (drho+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-feq*om1)/(c1o1-om1)+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q); - //(D.f[dirNW])[knw]=zero; + (D.f[DIR_MP0])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-feq*om1)/(c1o1-om1)+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q); + //(D.f[DIR_MP0])[knw]=zero; } q = q_dirNW[k]; @@ -394,8 +396,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (x == true) VeloX = c0o1; if (y == true) VeloY = c0o1; feq=c1o54* (drho+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-feq*om1)/(c1o1-om1)+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q); - //(D.f[dirSE])[kse]=zero; + (D.f[DIR_PM0])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-feq*om1)/(c1o1-om1)+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q); + //(D.f[DIR_PM0])[kse]=zero; } q = q_dirTE[k]; @@ -407,8 +409,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (x == true) VeloX = c0o1; if (z == true) VeloZ = c0o1; feq=c1o54* (drho+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-feq*om1)/(c1o1-om1)+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q); - //(D.f[dirBW])[kbw]=zero; + (D.f[DIR_M0M])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-feq*om1)/(c1o1-om1)+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q); + //(D.f[DIR_M0M])[kbw]=zero; } q = q_dirBW[k]; @@ -420,8 +422,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (x == true) VeloX = c0o1; if (z == true) VeloZ = c0o1; feq=c1o54* (drho+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-feq*om1)/(c1o1-om1)+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q); - //(D.f[dirTE])[kte]=zero; + (D.f[DIR_P0P])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-feq*om1)/(c1o1-om1)+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q); + //(D.f[DIR_P0P])[kte]=zero; } q = q_dirBE[k]; @@ -433,8 +435,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (x == true) VeloX = c0o1; if (z == true) VeloZ = c0o1; feq=c1o54* (drho+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-feq*om1)/(c1o1-om1)+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q); - //(D.f[dirTW])[ktw]=zero; + (D.f[DIR_M0P])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-feq*om1)/(c1o1-om1)+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q); + //(D.f[DIR_M0P])[ktw]=zero; } q = q_dirTW[k]; @@ -446,8 +448,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (x == true) VeloX = c0o1; if (z == true) VeloZ = c0o1; feq=c1o54* (drho+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-feq*om1)/(c1o1-om1)+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q); - //(D.f[dirBE])[kbe]=zero; + (D.f[DIR_P0M])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-feq*om1)/(c1o1-om1)+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q); + //(D.f[DIR_P0M])[kbe]=zero; } q = q_dirTN[k]; @@ -459,8 +461,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o54* (drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-feq*om1)/(c1o1-om1)+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBS])[kbs]=zero; + (D.f[DIR_0MM])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-feq*om1)/(c1o1-om1)+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_0MM])[kbs]=zero; } q = q_dirBS[k]; @@ -472,8 +474,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o54* (drho+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-feq*om1)/(c1o1-om1)+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTN])[ktn]=zero; + (D.f[DIR_0PP])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-feq*om1)/(c1o1-om1)+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_0PP])[ktn]=zero; } q = q_dirBN[k]; @@ -485,8 +487,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o54* (drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-feq*om1)/(c1o1-om1)+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTS])[kts]=zero; + (D.f[DIR_0MP])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-feq*om1)/(c1o1-om1)+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_0MP])[kts]=zero; } q = q_dirTS[k]; @@ -498,8 +500,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o54* (drho+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-feq*om1)/(c1o1-om1)+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBN])[kbn]=zero; + (D.f[DIR_0PM])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-feq*om1)/(c1o1-om1)+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_0PM])[kbn]=zero; } q = q_dirTNE[k]; @@ -512,8 +514,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-feq*om1)/(c1o1-om1)+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBSW])[kbsw]=zero; + (D.f[DIR_MMM])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-feq*om1)/(c1o1-om1)+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_MMM])[kbsw]=zero; } q = q_dirBSW[k]; @@ -526,8 +528,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-feq*om1)/(c1o1-om1)+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTNE])[ktne]=zero; + (D.f[DIR_PPP])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-feq*om1)/(c1o1-om1)+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_PPP])[ktne]=zero; } q = q_dirBNE[k]; @@ -540,8 +542,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-feq*om1)/(c1o1-om1)+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTSW])[ktsw]=zero; + (D.f[DIR_MMP])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-feq*om1)/(c1o1-om1)+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_MMP])[ktsw]=zero; } q = q_dirTSW[k]; @@ -554,8 +556,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-feq*om1)/(c1o1-om1)+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBNE])[kbne]=zero; + (D.f[DIR_PPM])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-feq*om1)/(c1o1-om1)+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_PPM])[kbne]=zero; } q = q_dirTSE[k]; @@ -568,8 +570,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-feq*om1)/(c1o1-om1)+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBNW])[kbnw]=zero; + (D.f[DIR_MPM])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-feq*om1)/(c1o1-om1)+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_MPM])[kbnw]=zero; } q = q_dirBNW[k]; @@ -582,8 +584,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-feq*om1)/(c1o1-om1)+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTSE])[ktse]=zero; + (D.f[DIR_PMP])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-feq*om1)/(c1o1-om1)+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_PMP])[ktse]=zero; } q = q_dirBSE[k]; @@ -596,8 +598,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-feq*om1)/(c1o1-om1)+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTNW])[ktnw]=zero; + (D.f[DIR_MPP])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-feq*om1)/(c1o1-om1)+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_MPP])[ktnw]=zero; } q = q_dirTNW[k]; @@ -610,8 +612,8 @@ extern "C" __global__ void QSlipDevice27(real* DD, if (y == true) VeloY = c0o1; if (z == true) VeloZ = c0o1; feq=c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-feq*om1)/(c1o1-om1)+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBSE])[kbse]=zero; + (D.f[DIR_PMM])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-feq*om1)/(c1o1-om1)+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_PMM])[kbse]=zero; } } } @@ -656,143 +658,580 @@ extern "C" __global__ void QSlipDevice27(real* DD, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QSlipDeviceComp27(real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) +__global__ void QSlipDeviceComp27( + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int numberOfLBnodes, + bool isEvenTimestep) { - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else + //! The slip boundary condition is executed in the following steps + //! + //////////////////////////////////////////////////////////////////////////////// + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + + if(k < numberOfBCnodes) { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - Set local subgrid distances (q's) + //! + SubgridDistances27 subgridD; + getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes); + + //////////////////////////////////////////////////////////////////////////////// + //! - Set neighbor indices (necessary for indirect addressing) + //! + unsigned int indexOfBCnode = subgridDistanceIndices[k]; + unsigned int kzero= indexOfBCnode; + unsigned int ke = indexOfBCnode; + unsigned int kw = neighborX[indexOfBCnode]; + unsigned int kn = indexOfBCnode; + unsigned int ks = neighborY[indexOfBCnode]; + unsigned int kt = indexOfBCnode; + unsigned int kb = neighborZ[indexOfBCnode]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = indexOfBCnode; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = indexOfBCnode; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = indexOfBCnode; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = indexOfBCnode; + unsigned int kbsw = neighborZ[ksw]; + + //////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions + //! + real f_W = (dist.f[DIR_P00 ])[ke ]; + real f_E = (dist.f[DIR_M00 ])[kw ]; + real f_S = (dist.f[DIR_0P0 ])[kn ]; + real f_N = (dist.f[DIR_0M0 ])[ks ]; + real f_B = (dist.f[DIR_00P ])[kt ]; + real f_T = (dist.f[DIR_00M ])[kb ]; + real f_SW = (dist.f[DIR_PP0 ])[kne ]; + real f_NE = (dist.f[DIR_MM0 ])[ksw ]; + real f_NW = (dist.f[DIR_PM0 ])[kse ]; + real f_SE = (dist.f[DIR_MP0 ])[knw ]; + real f_BW = (dist.f[DIR_P0P ])[kte ]; + real f_TE = (dist.f[DIR_M0M ])[kbw ]; + real f_TW = (dist.f[DIR_P0M ])[kbe ]; + real f_BE = (dist.f[DIR_M0P ])[ktw ]; + real f_BS = (dist.f[DIR_0PP ])[ktn ]; + real f_TN = (dist.f[DIR_0MM ])[kbs ]; + real f_TS = (dist.f[DIR_0PM ])[kbn ]; + real f_BN = (dist.f[DIR_0MP ])[kts ]; + real f_BSW = (dist.f[DIR_PPP ])[ktne ]; + real f_BNE = (dist.f[DIR_MMP ])[ktsw ]; + real f_BNW = (dist.f[DIR_PMP ])[ktse ]; + real f_BSE = (dist.f[DIR_MPP ])[ktnw ]; + real f_TSW = (dist.f[DIR_PPM ])[kbne ]; + real f_TNE = (dist.f[DIR_MMM ])[kbsw ]; + real f_TNW = (dist.f[DIR_PMM ])[kbse ]; + real f_TSE = (dist.f[DIR_MPM ])[kbnw ]; + + //////////////////////////////////////////////////////////////////////////////// + //! - Calculate macroscopic quantities + //! + real drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((dist.f[DIR_000])[kzero]); + + real vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) / (c1o1 + drho); + + real vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) / (c1o1 + drho); + + real vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) / (c1o1 + drho); + + real cu_sq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3) * (c1o1 + drho); + + //////////////////////////////////////////////////////////////////////////////// + //! - change the pointer to write the results in the correct array + //! + getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - Multiply the local velocities by the slipLength + //! + real slipLength = c1o1; + real VeloX = slipLength*vx1; + real VeloY = slipLength*vx2; + real VeloZ = slipLength*vx3; + + //////////////////////////////////////////////////////////////////////////////// + //! - Update distributions with subgrid distance (q) between zero and one + //! + real feq, q, velocityLB, velocityBC; + + bool x = false; + bool y = false; + bool z = false; + + q = (subgridD.q[DIR_P00])[k]; + if (q>=c0o1 && q<=c1o1) // only update distribution for q between zero and one + { + VeloX = c0o1; + x = true; + + velocityLB = vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloX; + (dist.f[DIR_M00])[kw] = getInterpolatedDistributionForVeloBC(q, f_E, f_W, feq, omega, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_M00])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = c0o1; + x = true; + + velocityLB = -vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloX; + (dist.f[DIR_P00])[ke] = getInterpolatedDistributionForVeloBC(q, f_W, f_E, feq, omega, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_0P0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = c0o1; + y = true; + + velocityLB = vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloY; + (dist.f[DIR_0M0])[ks] = getInterpolatedDistributionForVeloBC(q, f_N, f_S, feq, omega, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_0M0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = c0o1; + y = true; + + velocityLB = -vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloY; + (dist.f[DIR_0P0])[kn] = getInterpolatedDistributionForVeloBC(q, f_S, f_N, feq, omega, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_00P])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloZ = c0o1; + z = true; + + velocityLB = vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloZ; + (dist.f[DIR_00M])[kb] = getInterpolatedDistributionForVeloBC(q, f_T, f_B, feq, omega, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_00M])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloZ = c0o1; + z = true; + + velocityLB = -vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloZ; + (dist.f[DIR_00P])[kt] = getInterpolatedDistributionForVeloBC(q, f_B, f_T, feq, omega, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_PP0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX + VeloY; + (dist.f[DIR_MM0])[ksw] = getInterpolatedDistributionForVeloBC(q, f_NE, f_SW, feq, omega, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_MM0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = -vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX - VeloY; + (dist.f[DIR_PP0])[kne] = getInterpolatedDistributionForVeloBC(q, f_SW, f_NE, feq, omega, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_PM0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX - VeloY; + (dist.f[DIR_MP0])[knw] = getInterpolatedDistributionForVeloBC(q, f_SE, f_NW, feq, omega, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_MP0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = -vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX + VeloY; + (dist.f[DIR_PM0])[kse] = getInterpolatedDistributionForVeloBC(q, f_NW, f_SE, feq, omega, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_P0P])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX + VeloZ; + (dist.f[DIR_M0M])[kbw] = getInterpolatedDistributionForVeloBC(q, f_TE, f_BW, feq, omega, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_M0M])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX - VeloZ; + (dist.f[DIR_P0P])[kte] = getInterpolatedDistributionForVeloBC(q, f_BW, f_TE, feq, omega, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_P0M])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX - VeloZ; + (dist.f[DIR_M0P])[ktw] = getInterpolatedDistributionForVeloBC(q, f_BE, f_TW, feq, omega, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_M0P])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX + VeloZ; + (dist.f[DIR_P0M])[kbe] = getInterpolatedDistributionForVeloBC(q, f_TW, f_BE, feq, omega, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_0PP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloY + VeloZ; + (dist.f[DIR_0MM])[kbs] = getInterpolatedDistributionForVeloBC(q, f_TN, f_BS, feq, omega, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_0MM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloY - VeloZ; + (dist.f[DIR_0PP])[ktn] = getInterpolatedDistributionForVeloBC(q, f_BS, f_TN, feq, omega, velocityBC, c1o54); + } + + + q = (subgridD.q[DIR_0PM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloY - VeloZ; + (dist.f[DIR_0MP])[kts] = getInterpolatedDistributionForVeloBC(q, f_BN, f_TS, feq, omega, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_0MP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloY + VeloZ; + (dist.f[DIR_0PM])[kbn] = getInterpolatedDistributionForVeloBC(q, f_TS, f_BN, feq, omega, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_PPP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX + VeloY + VeloZ; + (dist.f[DIR_MMM])[kbsw] = getInterpolatedDistributionForVeloBC(q, f_TNE, f_BSW, feq, omega, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MMM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX - VeloY - VeloZ; + (dist.f[DIR_PPP])[ktne] = getInterpolatedDistributionForVeloBC(q, f_BSW, f_TNE, feq, omega, velocityBC, c1o216); + } + + + q = (subgridD.q[DIR_PPM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX + VeloY - VeloZ; + (dist.f[DIR_MMP])[ktsw] = getInterpolatedDistributionForVeloBC(q, f_BNE, f_TSW, feq, omega, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MMP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX - VeloY + VeloZ; + (dist.f[DIR_PPM])[kbne] = getInterpolatedDistributionForVeloBC(q, f_TSW, f_BNE, feq, omega, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_PMP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX - VeloY + VeloZ; + (dist.f[DIR_MPM])[kbnw] = getInterpolatedDistributionForVeloBC(q, f_TSE, f_BNW, feq, omega, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MPM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX + VeloY - VeloZ; + (dist.f[DIR_PMP])[ktse] = getInterpolatedDistributionForVeloBC(q, f_BNW, f_TSE, feq, omega, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_PMM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX - VeloY - VeloZ; + (dist.f[DIR_MPP])[ktnw] = getInterpolatedDistributionForVeloBC(q, f_BSE, f_TNW, feq, omega, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MPP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX + VeloY + VeloZ; + (dist.f[DIR_PMM])[kbse] = getInterpolatedDistributionForVeloBC(q, f_TNW, f_BSE, feq, omega, velocityBC, c1o216); + } } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +__global__ void BBSlipDeviceComp27( + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int numberOfLBnodes, + bool isEvenTimestep) +{ + //! The slip boundary condition is executed in the following steps + //! //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index const unsigned nx = blockDim.x; const unsigned ny = gridDim.x; const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - if(k<sizeQ) + if(k < numberOfBCnodes) { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep); + //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + //! - Set local subgrid distances (q's) + //! + SubgridDistances27 subgridD; + getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes); + //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; + //! - Set neighbor indices (necessary for indirect addressing) + //! + unsigned int indexOfBCnode = subgridDistanceIndices[k]; + unsigned int kzero= indexOfBCnode; + unsigned int ke = indexOfBCnode; + unsigned int kw = neighborX[indexOfBCnode]; + unsigned int kn = indexOfBCnode; + unsigned int ks = neighborY[indexOfBCnode]; + unsigned int kt = indexOfBCnode; + unsigned int kb = neighborZ[indexOfBCnode]; unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; + unsigned int kne = indexOfBCnode; unsigned int kse = ks; unsigned int knw = kw; unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; + unsigned int kte = indexOfBCnode; unsigned int kbe = kb; unsigned int ktw = kw; unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; + unsigned int ktn = indexOfBCnode; unsigned int kbn = kb; unsigned int kts = ks; unsigned int ktse = ks; @@ -801,524 +1240,2105 @@ extern "C" __global__ void QSlipDeviceComp27(real* DD, unsigned int kbse = kbs; unsigned int ktsw = ksw; unsigned int kbne = kb; - unsigned int ktne = KQK; + unsigned int ktne = indexOfBCnode; unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; + //! - Set local distributions + //! + real f_W = (dist.f[DIR_P00 ])[ke ]; + real f_E = (dist.f[DIR_M00 ])[kw ]; + real f_S = (dist.f[DIR_0P0 ])[kn ]; + real f_N = (dist.f[DIR_0M0 ])[ks ]; + real f_B = (dist.f[DIR_00P ])[kt ]; + real f_T = (dist.f[DIR_00M ])[kb ]; + real f_SW = (dist.f[DIR_PP0 ])[kne ]; + real f_NE = (dist.f[DIR_MM0 ])[ksw ]; + real f_NW = (dist.f[DIR_PM0 ])[kse ]; + real f_SE = (dist.f[DIR_MP0 ])[knw ]; + real f_BW = (dist.f[DIR_P0P ])[kte ]; + real f_TE = (dist.f[DIR_M0M ])[kbw ]; + real f_TW = (dist.f[DIR_P0M ])[kbe ]; + real f_BE = (dist.f[DIR_M0P ])[ktw ]; + real f_BS = (dist.f[DIR_0PP ])[ktn ]; + real f_TN = (dist.f[DIR_0MM ])[kbs ]; + real f_TS = (dist.f[DIR_0PM ])[kbn ]; + real f_BN = (dist.f[DIR_0MP ])[kts ]; + real f_BSW = (dist.f[DIR_PPP ])[ktne ]; + real f_BNE = (dist.f[DIR_MMP ])[ktsw ]; + real f_BNW = (dist.f[DIR_PMP ])[ktse ]; + real f_BSE = (dist.f[DIR_MPP ])[ktnw ]; + real f_TSW = (dist.f[DIR_PPM ])[kbne ]; + real f_TNE = (dist.f[DIR_MMM ])[kbsw ]; + real f_TNW = (dist.f[DIR_PMM ])[kbse ]; + real f_TSE = (dist.f[DIR_MPM ])[kbnw ]; + //////////////////////////////////////////////////////////////////////////////// - real vx1, vx2, vx3, drho, feq, q; - drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + //! - Calculate macroscopic quantities + //! + real drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((dist.f[DIR_000])[kzero]); - vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - (f_E - f_W)) / (c1o1 + drho); - + real vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) / (c1o1 + drho); - vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - (f_N - f_S)) / (c1o1 + drho); + real vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) / (c1o1 + drho); - vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - (f_T - f_B)) / (c1o1 + drho); + real vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) / (c1o1 + drho); - real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); + real cu_sq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3) * (c1o1 + drho); - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else + //////////////////////////////////////////////////////////////////////////////// + //! - change the pointer to write the results in the correct array + //! + getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - Multiply the local velocities by the slipLength + //! + real slipLength = c1o1; + real VeloX = slipLength*vx1; + real VeloY = slipLength*vx2; + real VeloZ = slipLength*vx3; + + //////////////////////////////////////////////////////////////////////////////// + //! - Update distributions with subgrid distance (q) between zero and one + //! + real q, velocityBC; + + bool x = false; + bool y = false; + bool z = false; + + q = (subgridD.q[DIR_P00])[k]; + if (q>=c0o1 && q<=c1o1) // only update distribution for q between zero and one { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + VeloX = c0o1; + x = true; + + velocityBC = VeloX; + (dist.f[DIR_M00])[kw] = getBounceBackDistributionForVeloBC(f_W, velocityBC, c2o27); } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real fac = c1o1;//c99o100; - real VeloX = fac*vx1; - real VeloY = fac*vx2; - real VeloZ = fac*vx3; - bool x = false; - bool y = false; - bool z = false; - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) + q = (subgridD.q[DIR_M00])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = c0o1; + x = true; + + velocityBC = -VeloX; + (dist.f[DIR_P00])[ke] = getBounceBackDistributionForVeloBC(f_E, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_0P0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = c0o1; + y = true; + + velocityBC = VeloY; + (dist.f[DIR_0M0])[ks] = getBounceBackDistributionForVeloBC(f_S, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_0M0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = c0o1; + y = true; + + velocityBC = -VeloY; + (dist.f[DIR_0P0])[kn] = getBounceBackDistributionForVeloBC(f_N, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_00P])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloZ = c0o1; + z = true; + + velocityBC = VeloZ; + (dist.f[DIR_00M])[kb] = getBounceBackDistributionForVeloBC(f_B, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_00M])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloZ = c0o1; + z = true; + + velocityBC = -VeloZ; + (dist.f[DIR_00P])[kt] = getBounceBackDistributionForVeloBC(f_T, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_PP0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityBC = VeloX + VeloY; + (dist.f[DIR_MM0])[ksw] = getBounceBackDistributionForVeloBC(f_SW, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_MM0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityBC = -VeloX - VeloY; + (dist.f[DIR_PP0])[kne] = getBounceBackDistributionForVeloBC(f_NE, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_PM0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityBC = VeloX - VeloY; + (dist.f[DIR_MP0])[knw] = getBounceBackDistributionForVeloBC(f_NW, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_MP0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityBC = -VeloX + VeloY; + (dist.f[DIR_PM0])[kse] = getBounceBackDistributionForVeloBC(f_SE, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_P0P])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = VeloX + VeloZ; + (dist.f[DIR_M0M])[kbw] = getBounceBackDistributionForVeloBC(f_BW, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_M0M])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = -VeloX - VeloZ; + (dist.f[DIR_P0P])[kte] = getBounceBackDistributionForVeloBC(f_TE, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_P0M])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = VeloX - VeloZ; + (dist.f[DIR_M0P])[ktw] = getBounceBackDistributionForVeloBC(f_TW, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_M0P])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = -VeloX + VeloZ; + (dist.f[DIR_P0M])[kbe] = getBounceBackDistributionForVeloBC(f_BE, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_0PP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = VeloY + VeloZ; + (dist.f[DIR_0MM])[kbs] = getBounceBackDistributionForVeloBC(f_BS, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_0MM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = -VeloY - VeloZ; + (dist.f[DIR_0PP])[ktn] = getBounceBackDistributionForVeloBC(f_TN, velocityBC, c1o54); + } + + + q = (subgridD.q[DIR_0PM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = VeloY - VeloZ; + (dist.f[DIR_0MP])[kts] = getBounceBackDistributionForVeloBC(f_TS, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_0MP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = -VeloY + VeloZ; + (dist.f[DIR_0PM])[kbn] = getBounceBackDistributionForVeloBC(f_BN, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_PPP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = VeloX + VeloY + VeloZ; + (dist.f[DIR_MMM])[kbsw] = getBounceBackDistributionForVeloBC(f_TNE, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MMM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = -VeloX - VeloY - VeloZ; + (dist.f[DIR_PPP])[ktne] = getBounceBackDistributionForVeloBC(f_TNE, velocityBC, c1o216); + } + + + q = (subgridD.q[DIR_PPM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = VeloX + VeloY - VeloZ; + (dist.f[DIR_MMP])[ktsw] = getBounceBackDistributionForVeloBC(f_TSW, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MMP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = -VeloX - VeloY + VeloZ; + (dist.f[DIR_PPM])[kbne] = getBounceBackDistributionForVeloBC(f_BNE, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_PMP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = VeloX - VeloY + VeloZ; + (dist.f[DIR_MPM])[kbnw] = getBounceBackDistributionForVeloBC(f_BNW, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MPM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = -VeloX + VeloY - VeloZ; + (dist.f[DIR_PMP])[ktse] = getBounceBackDistributionForVeloBC(f_TSE, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_PMM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = VeloX - VeloY - VeloZ; + (dist.f[DIR_MPP])[ktnw] = getBounceBackDistributionForVeloBC(f_TNW, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MPP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityBC = -VeloX + VeloY + VeloZ; + (dist.f[DIR_PMM])[kbse] = getBounceBackDistributionForVeloBC(f_BSE, velocityBC, c1o216); + } + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////////////// +__global__ void QSlipDeviceComp27TurbViscosity( + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* turbViscosity, + unsigned int numberOfLBnodes, + bool isEvenTimestep) +{ + //! The slip boundary condition is executed in the following steps + //! + //////////////////////////////////////////////////////////////////////////////// + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + + if(k < numberOfBCnodes) + { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - Set local subgrid distances (q's) + //! + SubgridDistances27 subgridD; + getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes); + + //////////////////////////////////////////////////////////////////////////////// + //! - Set neighbor indices (necessary for indirect addressing) + //! + unsigned int indexOfBCnode = subgridDistanceIndices[k]; + unsigned int kzero= indexOfBCnode; + unsigned int ke = indexOfBCnode; + unsigned int kw = neighborX[indexOfBCnode]; + unsigned int kn = indexOfBCnode; + unsigned int ks = neighborY[indexOfBCnode]; + unsigned int kt = indexOfBCnode; + unsigned int kb = neighborZ[indexOfBCnode]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = indexOfBCnode; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = indexOfBCnode; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = indexOfBCnode; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = indexOfBCnode; + unsigned int kbsw = neighborZ[ksw]; + + //////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions + //! + real f_W = (dist.f[DIR_P00 ])[ke ]; + real f_E = (dist.f[DIR_M00 ])[kw ]; + real f_S = (dist.f[DIR_0P0 ])[kn ]; + real f_N = (dist.f[DIR_0M0 ])[ks ]; + real f_B = (dist.f[DIR_00P ])[kt ]; + real f_T = (dist.f[DIR_00M ])[kb ]; + real f_SW = (dist.f[DIR_PP0 ])[kne ]; + real f_NE = (dist.f[DIR_MM0 ])[ksw ]; + real f_NW = (dist.f[DIR_PM0 ])[kse ]; + real f_SE = (dist.f[DIR_MP0 ])[knw ]; + real f_BW = (dist.f[DIR_P0P ])[kte ]; + real f_TE = (dist.f[DIR_M0M ])[kbw ]; + real f_TW = (dist.f[DIR_P0M ])[kbe ]; + real f_BE = (dist.f[DIR_M0P ])[ktw ]; + real f_BS = (dist.f[DIR_0PP ])[ktn ]; + real f_TN = (dist.f[DIR_0MM ])[kbs ]; + real f_TS = (dist.f[DIR_0PM ])[kbn ]; + real f_BN = (dist.f[DIR_0MP ])[kts ]; + real f_BSW = (dist.f[DIR_PPP ])[ktne ]; + real f_BNE = (dist.f[DIR_MMP ])[ktsw ]; + real f_BNW = (dist.f[DIR_PMP ])[ktse ]; + real f_BSE = (dist.f[DIR_MPP ])[ktnw ]; + real f_TSW = (dist.f[DIR_PPM ])[kbne ]; + real f_TNE = (dist.f[DIR_MMM ])[kbsw ]; + real f_TNW = (dist.f[DIR_PMM ])[kbse ]; + real f_TSE = (dist.f[DIR_MPM ])[kbnw ]; + + //////////////////////////////////////////////////////////////////////////////// + //! - Calculate macroscopic quantities + //! + real drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((dist.f[DIR_000])[kzero]); + + real vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) / (c1o1 + drho); + + real vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) / (c1o1 + drho); + + real vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) / (c1o1 + drho); + + real cu_sq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3) * (c1o1 + drho); + + //////////////////////////////////////////////////////////////////////////////// + //! - change the pointer to write the results in the correct array + //! + getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - compute local relaxation rate + //! + real om_turb = omega / (c1o1 + c3o1* omega* max(c0o1, turbViscosity[indexOfBCnode]) ); + + //////////////////////////////////////////////////////////////////////////////// + //! - Multiply the local velocities by the slipLength + //! + real slipLength = c1o1; + real VeloX = slipLength*vx1; + real VeloY = slipLength*vx2; + real VeloZ = slipLength*vx3; + + //////////////////////////////////////////////////////////////////////////////// + //! - Update distributions with subgrid distance (q) between zero and one + //! + real feq, q, velocityLB, velocityBC; + + bool x = false; + bool y = false; + bool z = false; + + q = (subgridD.q[DIR_P00])[k]; + if (q>=c0o1 && q<=c1o1) // only update distribution for q between zero and one + { + VeloX = c0o1; + x = true; + + velocityLB = vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloX; + (dist.f[DIR_M00])[kw] = getInterpolatedDistributionForVeloBC(q, f_E, f_W, feq, om_turb, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_M00])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = c0o1; + x = true; + + velocityLB = -vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloX; + (dist.f[DIR_P00])[ke] = getInterpolatedDistributionForVeloBC(q, f_W, f_E, feq, om_turb, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_0P0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = c0o1; + y = true; + + velocityLB = vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloY; + (dist.f[DIR_0M0])[ks] = getInterpolatedDistributionForVeloBC(q, f_N, f_S, feq, om_turb, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_0M0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = c0o1; + y = true; + + velocityLB = -vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloY; + (dist.f[DIR_0P0])[kn] = getInterpolatedDistributionForVeloBC(q, f_S, f_N, feq, om_turb, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_00P])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloZ = c0o1; + z = true; + + velocityLB = vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloZ; + (dist.f[DIR_00M])[kb] = getInterpolatedDistributionForVeloBC(q, f_T, f_B, feq, om_turb, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_00M])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloZ = c0o1; + z = true; + + velocityLB = -vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloZ; + (dist.f[DIR_00P])[kt] = getInterpolatedDistributionForVeloBC(q, f_B, f_T, feq, om_turb, velocityBC, c2o27); + } + + q = (subgridD.q[DIR_PP0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX + VeloY; + (dist.f[DIR_MM0])[ksw] = getInterpolatedDistributionForVeloBC(q, f_NE, f_SW, feq, om_turb, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_MM0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = -vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX - VeloY; + (dist.f[DIR_PP0])[kne] = getInterpolatedDistributionForVeloBC(q, f_SW, f_NE, feq, om_turb, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_PM0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX - VeloY; + (dist.f[DIR_MP0])[knw] = getInterpolatedDistributionForVeloBC(q, f_SE, f_NW, feq, om_turb, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_MP0])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = -vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX + VeloY; + (dist.f[DIR_PM0])[kse] = getInterpolatedDistributionForVeloBC(q, f_NW, f_SE, feq, om_turb, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_P0P])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX + VeloZ; + (dist.f[DIR_M0M])[kbw] = getInterpolatedDistributionForVeloBC(q, f_TE, f_BW, feq, om_turb, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_M0M])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX - VeloZ; + (dist.f[DIR_P0P])[kte] = getInterpolatedDistributionForVeloBC(q, f_BW, f_TE, feq, om_turb, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_P0M])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX - VeloZ; + (dist.f[DIR_M0P])[ktw] = getInterpolatedDistributionForVeloBC(q, f_BE, f_TW, feq, om_turb, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_M0P])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX + VeloZ; + (dist.f[DIR_P0M])[kbe] = getInterpolatedDistributionForVeloBC(q, f_TW, f_BE, feq, om_turb, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_0PP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloY + VeloZ; + (dist.f[DIR_0MM])[kbs] = getInterpolatedDistributionForVeloBC(q, f_TN, f_BS, feq, om_turb, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_0MM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloY - VeloZ; + (dist.f[DIR_0PP])[ktn] = getInterpolatedDistributionForVeloBC(q, f_BS, f_TN, feq, om_turb, velocityBC, c1o54); + } + + + q = (subgridD.q[DIR_0PM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloY - VeloZ; + (dist.f[DIR_0MP])[kts] = getInterpolatedDistributionForVeloBC(q, f_BN, f_TS, feq, om_turb, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_0MP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloY + VeloZ; + (dist.f[DIR_0PM])[kbn] = getInterpolatedDistributionForVeloBC(q, f_TS, f_BN, feq, om_turb, velocityBC, c1o54); + } + + q = (subgridD.q[DIR_PPP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX + VeloY + VeloZ; + (dist.f[DIR_MMM])[kbsw] = getInterpolatedDistributionForVeloBC(q, f_TNE, f_BSW, feq, om_turb, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MMM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX - VeloY - VeloZ; + (dist.f[DIR_PPP])[ktne] = getInterpolatedDistributionForVeloBC(q, f_BSW, f_TNE, feq, om_turb, velocityBC, c1o216); + } + + + q = (subgridD.q[DIR_PPM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX + VeloY - VeloZ; + (dist.f[DIR_MMP])[ktsw] = getInterpolatedDistributionForVeloBC(q, f_BNE, f_TSW, feq, om_turb, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MMP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX - VeloY + VeloZ; + (dist.f[DIR_PPM])[kbne] = getInterpolatedDistributionForVeloBC(q, f_TSW, f_BNE, feq, om_turb, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_PMP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX - VeloY + VeloZ; + (dist.f[DIR_MPM])[kbnw] = getInterpolatedDistributionForVeloBC(q, f_TSE, f_BNW, feq, om_turb, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MPM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX + VeloY - VeloZ; + (dist.f[DIR_PMP])[ktse] = getInterpolatedDistributionForVeloBC(q, f_BNW, f_TSE, feq, om_turb, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_PMM])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX - VeloY - VeloZ; + (dist.f[DIR_MPP])[ktnw] = getInterpolatedDistributionForVeloBC(q, f_BSE, f_TNW, feq, om_turb, velocityBC, c1o216); + } + + q = (subgridD.q[DIR_MPP])[k]; + if (q>=c0o1 && q<=c1o1) + { + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX + VeloY + VeloZ; + (dist.f[DIR_PMM])[kbse] = getInterpolatedDistributionForVeloBC(q, f_TNW, f_BSE, feq, om_turb, velocityBC, c1o216); + } + } +} + + +//////////////////////////////////////////////////////////////////////////// +__global__ void QSlipPressureDeviceComp27TurbViscosity( + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* turbViscosity, + unsigned int numberOfLBnodes, + bool isEvenTimestep) +{ + //! The slip boundary condition is executed in the following steps + //! + //////////////////////////////////////////////////////////////////////////////// + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + + if(k < numberOfBCnodes) + { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - Set local subgrid distances (q's) + //! + SubgridDistances27 subgridD; + getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes); + + //////////////////////////////////////////////////////////////////////////////// + //! - Set neighbor indices (necessary for indirect addressing) + //! + unsigned int indexOfBCnode = subgridDistanceIndices[k]; + unsigned int kzero= indexOfBCnode; + unsigned int ke = indexOfBCnode; + unsigned int kw = neighborX[indexOfBCnode]; + unsigned int kn = indexOfBCnode; + unsigned int ks = neighborY[indexOfBCnode]; + unsigned int kt = indexOfBCnode; + unsigned int kb = neighborZ[indexOfBCnode]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = indexOfBCnode; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = indexOfBCnode; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = indexOfBCnode; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = indexOfBCnode; + unsigned int kbsw = neighborZ[ksw]; + + //////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions + //! + real f_W = (dist.f[DIR_P00 ])[ke ]; + real f_E = (dist.f[DIR_M00 ])[kw ]; + real f_S = (dist.f[DIR_0P0 ])[kn ]; + real f_N = (dist.f[DIR_0M0 ])[ks ]; + real f_B = (dist.f[DIR_00P ])[kt ]; + real f_T = (dist.f[DIR_00M ])[kb ]; + real f_SW = (dist.f[DIR_PP0 ])[kne ]; + real f_NE = (dist.f[DIR_MM0 ])[ksw ]; + real f_NW = (dist.f[DIR_PM0 ])[kse ]; + real f_SE = (dist.f[DIR_MP0 ])[knw ]; + real f_BW = (dist.f[DIR_P0P ])[kte ]; + real f_TE = (dist.f[DIR_M0M ])[kbw ]; + real f_TW = (dist.f[DIR_P0M ])[kbe ]; + real f_BE = (dist.f[DIR_M0P ])[ktw ]; + real f_BS = (dist.f[DIR_0PP ])[ktn ]; + real f_TN = (dist.f[DIR_0MM ])[kbs ]; + real f_TS = (dist.f[DIR_0PM ])[kbn ]; + real f_BN = (dist.f[DIR_0MP ])[kts ]; + real f_BSW = (dist.f[DIR_PPP ])[ktne ]; + real f_BNE = (dist.f[DIR_MMP ])[ktsw ]; + real f_BNW = (dist.f[DIR_PMP ])[ktse ]; + real f_BSE = (dist.f[DIR_MPP ])[ktnw ]; + real f_TSW = (dist.f[DIR_PPM ])[kbne ]; + real f_TNE = (dist.f[DIR_MMM ])[kbsw ]; + real f_TNW = (dist.f[DIR_PMM ])[kbse ]; + real f_TSE = (dist.f[DIR_MPM ])[kbnw ]; + + //////////////////////////////////////////////////////////////////////////////// + //! - Calculate macroscopic quantities + //! + real drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((dist.f[DIR_000])[kzero]); + + real vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) / (c1o1 + drho); + + real vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) / (c1o1 + drho); + + real vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) / (c1o1 + drho); + + real cu_sq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3) * (c1o1 + drho); + + //////////////////////////////////////////////////////////////////////////////// + //! - change the pointer to write the results in the correct array + //! + getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - compute local relaxation rate + //! + real om_turb = omega / (c1o1 + c3o1* omega* max(c0o1, turbViscosity[indexOfBCnode]) ); + + //////////////////////////////////////////////////////////////////////////////// + //! - Multiply the local velocities by the slipLength + //! + real slipLength = c1o1; + real VeloX = slipLength*vx1; + real VeloY = slipLength*vx2; + real VeloZ = slipLength*vx3; + + //////////////////////////////////////////////////////////////////////////////// + //! - Update distributions with subgrid distance (q) between zero and one + //! + real feq, q, velocityLB, velocityBC; + + bool x = false; + bool y = false; + bool z = false; + + q = (subgridD.q[DIR_P00])[k]; + if (q>=c0o1 && q<=c1o1) // only update distribution for q between zero and one { - VeloX = c0o1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - x = true; - feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ))/(c1o1+q) - c2o27 * drho; - //feq=c2over27* (drho+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq); - //(D.f[dirW])[kw]=(one-q)/(one+q)*(f_E-feq*om1)/(one-om1)+(q*(f_E+f_W)-six*c2over27*( VeloX ))/(one+q); - //(D.f[dirW])[kw]=zero; + VeloX = c0o1; + x = true; + + velocityLB = vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloX; + (dist.f[DIR_M00])[kw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_E, f_W, feq, om_turb, drho, velocityBC, c2o27); } - q = q_dirW[k]; + q = (subgridD.q[DIR_M00])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = c0o1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - x = true; - feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ))/(c1o1+q) - c2o27 * drho; - //feq=c2over27* (drho+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq); - //(D.f[dirE])[ke]=(one-q)/(one+q)*(f_W-feq*om1)/(one-om1)+(q*(f_W+f_E)-six*c2over27*(-VeloX ))/(one+q); - //(D.f[dirE])[ke]=zero; + VeloX = c0o1; + x = true; + + velocityLB = -vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloX; + (dist.f[DIR_P00])[ke] = getInterpolatedDistributionForVeloWithPressureBC(q, f_W, f_E, feq, om_turb, drho, velocityBC, c2o27); } - q = q_dirN[k]; + q = (subgridD.q[DIR_0P0])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = c0o1; - VeloZ = fac*vx3; - y = true; - feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ))/(c1o1+q) - c2o27 * drho; - //feq=c2over27* (drho+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq); - //(D.f[dirS])[ks]=(one-q)/(one+q)*(f_N-feq*om1)/(one-om1)+(q*(f_N+f_S)-six*c2over27*( VeloY ))/(one+q); - //(D.f[dirS])[ks]=zero; + VeloY = c0o1; + y = true; + + velocityLB = vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloY; + (dist.f[DIR_0M0])[ks] = getInterpolatedDistributionForVeloWithPressureBC(q, f_N, f_S, feq, om_turb, drho, velocityBC, c2o27); } - q = q_dirS[k]; + q = (subgridD.q[DIR_0M0])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = c0o1; - VeloZ = fac*vx3; - y = true; - feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ))/(c1o1+q) - c2o27 * drho; - //feq=c2over27* (drho+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq); - //(D.f[dirN])[kn]=(one-q)/(one+q)*(f_S-feq*om1)/(one-om1)+(q*(f_S+f_N)-six*c2over27*(-VeloY ))/(one+q); - //(D.f[dirN])[kn]=zero; + VeloY = c0o1; + y = true; + + velocityLB = -vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloY; + (dist.f[DIR_0P0])[kn] = getInterpolatedDistributionForVeloWithPressureBC(q, f_S, f_N, feq, om_turb, drho, velocityBC, c2o27); } - q = q_dirT[k]; + q = (subgridD.q[DIR_00P])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = c0o1; - z = true; - feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ ))/(c1o1+q) - c2o27 * drho; - //feq=c2over27* (drho+three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq); - //(D.f[dirB])[kb]=(one-q)/(one+q)*(f_T-feq*om1)/(one-om1)+(q*(f_T+f_B)-six*c2over27*( VeloZ ))/(one+q); - //(D.f[dirB])[kb]=one; + VeloZ = c0o1; + z = true; + + velocityLB = vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloZ; + (dist.f[DIR_00M])[kb] = getInterpolatedDistributionForVeloWithPressureBC(q, f_T, f_B, feq, om_turb, drho, velocityBC, c2o27); } - q = q_dirB[k]; + q = (subgridD.q[DIR_00M])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = c0o1; - z = true; - feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ))/(c1o1+q) - c2o27 * drho; - //feq=c2over27* (drho+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq); - //(D.f[dirT])[kt]=(one-q)/(one+q)*(f_B-feq*om1)/(one-om1)+(q*(f_B+f_T)-six*c2over27*(-VeloZ ))/(one+q); - //(D.f[dirT])[kt]=zero; + VeloZ = c0o1; + z = true; + + velocityLB = -vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloZ; + (dist.f[DIR_00P])[kt] = getInterpolatedDistributionForVeloWithPressureBC(q, f_B, f_T, feq, om_turb, drho, velocityBC, c2o27); } - q = q_dirNE[k]; + q = (subgridD.q[DIR_PP0])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - //(D.f[dirSW])[ksw]=(one-q)/(one+q)*(f_NE-feq*om1)/(one-om1)+(q*(f_NE+f_SW)-six*c1over54*(VeloX+VeloY))/(one+q); - //(D.f[dirSW])[ksw]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX + VeloY; + (dist.f[DIR_MM0])[ksw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_NE, f_SW, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirSW[k]; + q = (subgridD.q[DIR_MM0])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - //(D.f[dirNE])[kne]=(one-q)/(one+q)*(f_SW-feq*om1)/(one-om1)+(q*(f_SW+f_NE)-six*c1over54*(-VeloX-VeloY))/(one+q); - //(D.f[dirNE])[kne]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = -vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX - VeloY; + (dist.f[DIR_PP0])[kne] = getInterpolatedDistributionForVeloWithPressureBC(q, f_SW, f_NE, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirSE[k]; + q = (subgridD.q[DIR_PM0])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - //(D.f[dirNW])[knw]=(one-q)/(one+q)*(f_SE-feq*om1)/(one-om1)+(q*(f_SE+f_NW)-six*c1over54*( VeloX-VeloY))/(one+q); - //(D.f[dirNW])[knw]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX - VeloY; + (dist.f[DIR_MP0])[knw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_SE, f_NW, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirNW[k]; + q = (subgridD.q[DIR_MP0])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - //(D.f[dirSE])[kse]=(one-q)/(one+q)*(f_NW-feq*om1)/(one-om1)+(q*(f_NW+f_SE)-six*c1over54*(-VeloX+VeloY))/(one+q); - //(D.f[dirSE])[kse]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + + velocityLB = -vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX + VeloY; + (dist.f[DIR_PM0])[kse] = getInterpolatedDistributionForVeloWithPressureBC(q, f_NW, f_SE, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirTE[k]; + q = (subgridD.q[DIR_P0P])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - //(D.f[dirBW])[kbw]=(one-q)/(one+q)*(f_TE-feq*om1)/(one-om1)+(q*(f_TE+f_BW)-six*c1over54*( VeloX+VeloZ))/(one+q); - //(D.f[dirBW])[kbw]=zero; + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX + VeloZ; + (dist.f[DIR_M0M])[kbw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TE, f_BW, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirBW[k]; + q = (subgridD.q[DIR_M0M])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - //(D.f[dirTE])[kte]=(one-q)/(one+q)*(f_BW-feq*om1)/(one-om1)+(q*(f_BW+f_TE)-six*c1over54*(-VeloX-VeloZ))/(one+q); - //(D.f[dirTE])[kte]=zero; + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX - VeloZ; + (dist.f[DIR_P0P])[kte] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BW, f_TE, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirBE[k]; + q = (subgridD.q[DIR_P0M])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - //(D.f[dirTW])[ktw]=(one-q)/(one+q)*(f_BE-feq*om1)/(one-om1)+(q*(f_BE+f_TW)-six*c1over54*( VeloX-VeloZ))/(one+q); - //(D.f[dirTW])[ktw]=zero; + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX - VeloZ; + (dist.f[DIR_M0P])[ktw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BE, f_TW, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirTW[k]; + q = (subgridD.q[DIR_M0P])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - //(D.f[dirBE])[kbe]=(one-q)/(one+q)*(f_TW-feq*om1)/(one-om1)+(q*(f_TW+f_BE)-six*c1over54*(-VeloX+VeloZ))/(one+q); - //(D.f[dirBE])[kbe]=zero; + VeloX = slipLength*vx1; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX + VeloZ; + (dist.f[DIR_P0M])[kbe] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TW, f_BE, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirTN[k]; + q = (subgridD.q[DIR_0PP])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq); - //(D.f[dirBS])[kbs]=(one-q)/(one+q)*(f_TN-feq*om1)/(one-om1)+(q*(f_TN+f_BS)-six*c1over54*( VeloY+VeloZ))/(one+q); - //(D.f[dirBS])[kbs]=zero; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloY + VeloZ; + (dist.f[DIR_0MM])[kbs] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TN, f_BS, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirBS[k]; + q = (subgridD.q[DIR_0MM])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - //(D.f[dirTN])[ktn]=(one-q)/(one+q)*(f_BS-feq*om1)/(one-om1)+(q*(f_BS+f_TN)-six*c1over54*( -VeloY-VeloZ))/(one+q); - //(D.f[dirTN])[ktn]=zero; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloY - VeloZ; + (dist.f[DIR_0PP])[ktn] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BS, f_TN, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirBN[k]; + + q = (subgridD.q[DIR_0PM])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq); - //(D.f[dirTS])[kts]=(one-q)/(one+q)*(f_BN-feq*om1)/(one-om1)+(q*(f_BN+f_TS)-six*c1over54*( VeloY-VeloZ))/(one+q); - //(D.f[dirTS])[kts]=zero; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloY - VeloZ; + (dist.f[DIR_0MP])[kts] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BN, f_TS, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirTS[k]; + q = (subgridD.q[DIR_0MP])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q) - c1o54 * drho; - //feq=c1over54* (drho+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - //(D.f[dirBN])[kbn]=(one-q)/(one+q)*(f_TS-feq*om1)/(one-om1)+(q*(f_TS+f_BN)-six*c1over54*( -VeloY+VeloZ))/(one+q); - //(D.f[dirBN])[kbn]=zero; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + + velocityLB = -vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloY + VeloZ; + (dist.f[DIR_0PM])[kbn] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TS, f_BN, feq, om_turb, drho, velocityBC, c1o54); } - q = q_dirTNE[k]; + q = (subgridD.q[DIR_PPP])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; - //feq=c1over216*(drho+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - //(D.f[dirBSW])[kbsw]=(one-q)/(one+q)*(f_TNE-feq*om1)/(one-om1)+(q*(f_TNE+f_BSW)-six*c1over216*( VeloX+VeloY+VeloZ))/(one+q); - //(D.f[dirBSW])[kbsw]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX + VeloY + VeloZ; + (dist.f[DIR_MMM])[kbsw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TNE, f_BSW, feq, om_turb, drho, velocityBC, c1o216); } - q = q_dirBSW[k]; + q = (subgridD.q[DIR_MMM])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; - //feq=c1over216*(drho+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - //(D.f[dirTNE])[ktne]=(one-q)/(one+q)*(f_BSW-feq*om1)/(one-om1)+(q*(f_BSW+f_TNE)-six*c1over216*(-VeloX-VeloY-VeloZ))/(one+q); - //(D.f[dirTNE])[ktne]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX - VeloY - VeloZ; + (dist.f[DIR_PPP])[ktne] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BSW, f_TNE, feq, om_turb, drho, velocityBC, c1o216); } - q = q_dirBNE[k]; + + q = (subgridD.q[DIR_PPM])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; - //feq=c1over216*(drho+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - //(D.f[dirTSW])[ktsw]=(one-q)/(one+q)*(f_BNE-feq*om1)/(one-om1)+(q*(f_BNE+f_TSW)-six*c1over216*( VeloX+VeloY-VeloZ))/(one+q); - //(D.f[dirTSW])[ktsw]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX + VeloY - VeloZ; + (dist.f[DIR_MMP])[ktsw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BNE, f_TSW, feq, om_turb, drho, velocityBC, c1o216); } - q = q_dirTSW[k]; + q = (subgridD.q[DIR_MMP])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; - //feq=c1over216*(drho+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - //(D.f[dirBNE])[kbne]=(one-q)/(one+q)*(f_TSW-feq*om1)/(one-om1)+(q*(f_TSW+f_BNE)-six*c1over216*(-VeloX-VeloY+VeloZ))/(one+q); - //(D.f[dirBNE])[kbne]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX - VeloY + VeloZ; + (dist.f[DIR_PPM])[kbne] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TSW, f_BNE, feq, om_turb, drho, velocityBC, c1o216); } - q = q_dirTSE[k]; + q = (subgridD.q[DIR_PMP])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; - //feq=c1over216*(drho+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - //(D.f[dirBNW])[kbnw]=(one-q)/(one+q)*(f_TSE-feq*om1)/(one-om1)+(q*(f_TSE+f_BNW)-six*c1over216*( VeloX-VeloY+VeloZ))/(one+q); - //(D.f[dirBNW])[kbnw]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX - VeloY + VeloZ; + (dist.f[DIR_MPM])[kbnw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TSE, f_BNW, feq, om_turb, drho, velocityBC, c1o216); } - q = q_dirBNW[k]; + q = (subgridD.q[DIR_MPM])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; - //feq=c1over216*(drho+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - //(D.f[dirTSE])[ktse]=(one-q)/(one+q)*(f_BNW-feq*om1)/(one-om1)+(q*(f_BNW+f_TSE)-six*c1over216*(-VeloX+VeloY-VeloZ))/(one+q); - //(D.f[dirTSE])[ktse]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX + VeloY - VeloZ; + (dist.f[DIR_PMP])[ktse] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BNW, f_TSE, feq, om_turb, drho, velocityBC, c1o216); } - q = q_dirBSE[k]; + q = (subgridD.q[DIR_PMM])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; - //feq=c1over216*(drho+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - //(D.f[dirTNW])[ktnw]=(one-q)/(one+q)*(f_BSE-feq*om1)/(one-om1)+(q*(f_BSE+f_TNW)-six*c1over216*( VeloX-VeloY-VeloZ))/(one+q); - //(D.f[dirTNW])[ktnw]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX - VeloY - VeloZ; + (dist.f[DIR_MPP])[ktnw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BSE, f_TNW, feq, om_turb, drho, velocityBC, c1o216); } - q = q_dirTNW[k]; + q = (subgridD.q[DIR_MPP])[k]; if (q>=c0o1 && q<=c1o1) { - VeloX = fac*vx1; - VeloY = fac*vx2; - VeloZ = fac*vx3; - if (x == true) VeloX = c0o1; - if (y == true) VeloY = c0o1; - if (z == true) VeloZ = c0o1; - feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; - //feq=c1over216*(drho+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - //(D.f[dirBSE])[kbse]=(one-q)/(one+q)*(f_TNW-feq*om1)/(one-om1)+(q*(f_TNW+f_BSE)-six*c1over216*(-VeloX+VeloY+VeloZ))/(one+q); - //(D.f[dirBSE])[kbse]=zero; + VeloX = slipLength*vx1; + VeloY = slipLength*vx2; + VeloZ = slipLength*vx3; + if (x == true) VeloX = c0o1; + if (y == true) VeloY = c0o1; + if (z == true) VeloZ = c0o1; + velocityLB = -vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX + VeloY + VeloZ; + (dist.f[DIR_PMM])[kbse] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TNW, f_BSE, feq, om_turb, drho, velocityBC, c1o216); } } } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// __global__ void QSlipDeviceComp27TurbViscosity(real* DD, +// int* k_Q, +// real* QQ, +// unsigned int numberOfBCnodes, +// real om1, +// unsigned int* neighborX, +// unsigned int* neighborY, +// unsigned int* neighborZ, +// real* turbViscosity, +// unsigned int size_Mat, +// bool isEvenTimestep) +// { +// Distributions27 D; +// if (isEvenTimestep==true) +// { +// D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; +// D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; +// D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; +// D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; +// D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; +// D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; +// D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; +// D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; +// D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; +// D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; +// D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; +// D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; +// D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; +// D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; +// D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; +// D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; +// D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; +// D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; +// D.f[DIR_000] = &DD[DIR_000*size_Mat]; +// D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; +// D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; +// D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; +// D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; +// D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; +// D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; +// D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; +// D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; +// } +// else +// { +// D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; +// D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; +// D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; +// D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; +// D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; +// D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; +// D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; +// D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; +// D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; +// D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; +// D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; +// D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; +// D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; +// D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; +// D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; +// D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; +// D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; +// D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; +// D.f[DIR_000] = &DD[DIR_000*size_Mat]; +// D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; +// D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; +// D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; +// D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; +// D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; +// D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; +// D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; +// D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; +// } +// //////////////////////////////////////////////////////////////////////////////// +// const unsigned x = threadIdx.x; // Globaler x-Index +// const unsigned y = blockIdx.x; // Globaler y-Index +// const unsigned z = blockIdx.y; // Globaler z-Index + +// const unsigned nx = blockDim.x; +// const unsigned ny = gridDim.x; + +// const unsigned k = nx*(ny*z + y) + x; +// ////////////////////////////////////////////////////////////////////////// + +// if(k<numberOfBCnodes) +// { +// //////////////////////////////////////////////////////////////////////////////// +// real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, +// *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, +// *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, +// *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, +// *q_dirBSE, *q_dirBNW; +// q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; +// q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; +// q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; +// q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; +// q_dirT = &QQ[DIR_00P * numberOfBCnodes]; +// q_dirB = &QQ[DIR_00M * numberOfBCnodes]; +// q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; +// q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; +// q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; +// q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; +// q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; +// q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; +// q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; +// q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; +// q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; +// q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; +// q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; +// q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; +// q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; +// q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; +// q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; +// q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; +// q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; +// q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; +// q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; +// q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; +// //////////////////////////////////////////////////////////////////////////////// +// //index +// unsigned int KQK = k_Q[k]; +// unsigned int kzero= KQK; +// unsigned int ke = KQK; +// unsigned int kw = neighborX[KQK]; +// unsigned int kn = KQK; +// unsigned int ks = neighborY[KQK]; +// unsigned int kt = KQK; +// unsigned int kb = neighborZ[KQK]; +// unsigned int ksw = neighborY[kw]; +// unsigned int kne = KQK; +// unsigned int kse = ks; +// unsigned int knw = kw; +// unsigned int kbw = neighborZ[kw]; +// unsigned int kte = KQK; +// unsigned int kbe = kb; +// unsigned int ktw = kw; +// unsigned int kbs = neighborZ[ks]; +// unsigned int ktn = KQK; +// unsigned int kbn = kb; +// unsigned int kts = ks; +// unsigned int ktse = ks; +// unsigned int kbnw = kbw; +// unsigned int ktnw = kw; +// unsigned int kbse = kbs; +// unsigned int ktsw = ksw; +// unsigned int kbne = kb; +// unsigned int ktne = KQK; +// unsigned int kbsw = neighborZ[ksw]; + +// //////////////////////////////////////////////////////////////////////////////// +// real f_W = (D.f[DIR_P00 ])[ke ]; +// real f_E = (D.f[DIR_M00 ])[kw ]; +// real f_S = (D.f[DIR_0P0 ])[kn ]; +// real f_N = (D.f[DIR_0M0 ])[ks ]; +// real f_B = (D.f[DIR_00P ])[kt ]; +// real f_T = (D.f[DIR_00M ])[kb ]; +// real f_SW = (D.f[DIR_PP0 ])[kne ]; +// real f_NE = (D.f[DIR_MM0 ])[ksw ]; +// real f_NW = (D.f[DIR_PM0 ])[kse ]; +// real f_SE = (D.f[DIR_MP0 ])[knw ]; +// real f_BW = (D.f[DIR_P0P ])[kte ]; +// real f_TE = (D.f[DIR_M0M ])[kbw ]; +// real f_TW = (D.f[DIR_P0M ])[kbe ]; +// real f_BE = (D.f[DIR_M0P ])[ktw ]; +// real f_BS = (D.f[DIR_0PP ])[ktn ]; +// real f_TN = (D.f[DIR_0MM ])[kbs ]; +// real f_TS = (D.f[DIR_0PM ])[kbn ]; +// real f_BN = (D.f[DIR_0MP ])[kts ]; +// real f_BSW = (D.f[DIR_PPP ])[ktne ]; +// real f_BNE = (D.f[DIR_MMP ])[ktsw ]; +// real f_BNW = (D.f[DIR_PMP ])[ktse ]; +// real f_BSE = (D.f[DIR_MPP ])[ktnw ]; +// real f_TSW = (D.f[DIR_PPM ])[kbne ]; +// real f_TNE = (D.f[DIR_MMM ])[kbsw ]; +// real f_TNW = (D.f[DIR_PMM ])[kbse ]; +// real f_TSE = (D.f[DIR_MPM ])[kbnw ]; +// //////////////////////////////////////////////////////////////////////////////// +// real vx1, vx2, vx3, drho, feq, q; +// drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + +// f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + +// f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); + +// vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + +// ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + +// (f_E - f_W)) / (c1o1 + drho); + + +// vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + +// ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + +// (f_N - f_S)) / (c1o1 + drho); + +// vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + +// (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + +// (f_T - f_B)) / (c1o1 + drho); + +// real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); + +// ////////////////////////////////////////////////////////////////////////// +// if (isEvenTimestep==false) +// { +// D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; +// D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; +// D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; +// D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; +// D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; +// D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; +// D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; +// D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; +// D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; +// D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; +// D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; +// D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; +// D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; +// D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; +// D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; +// D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; +// D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; +// D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; +// D.f[DIR_000] = &DD[DIR_000*size_Mat]; +// D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; +// D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; +// D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; +// D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; +// D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; +// D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; +// D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; +// D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; +// } +// else +// { +// D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; +// D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; +// D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; +// D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; +// D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; +// D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; +// D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; +// D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; +// D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; +// D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; +// D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; +// D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; +// D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; +// D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; +// D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; +// D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; +// D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; +// D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; +// D.f[DIR_000] = &DD[DIR_000*size_Mat]; +// D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; +// D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; +// D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; +// D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; +// D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; +// D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; +// D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; +// D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; +// } +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// //Test +// //(D.f[DIR_000])[k]=c1o10; +// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// real om_turb = om1 / (c1o1 + c3o1*om1*max(c0o1, turbViscosity[k_Q[k]])); + +// real fac = c1o1;//c99o100; +// real VeloX = fac*vx1; +// real VeloY = fac*vx2; +// real VeloZ = fac*vx3; +// bool x = false; +// bool y = false; +// bool z = false; + +// q = q_dirE[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = c0o1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// x = true; +// feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_M00])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ))/(c1o1+q) - c2o27 * drho; +// //feq=c2over27* (drho+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq); +// //(D.f[DIR_M00])[kw]=(one-q)/(one+q)*(f_E-feq*om1)/(one-om1)+(q*(f_E+f_W)-six*c2over27*( VeloX ))/(one+q); +// //(D.f[DIR_M00])[kw]=zero; +// } + +// q = q_dirW[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = c0o1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// x = true; +// feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_P00])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ))/(c1o1+q) - c2o27 * drho; +// //feq=c2over27* (drho+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq); +// //(D.f[DIR_P00])[ke]=(one-q)/(one+q)*(f_W-feq*om_turb)/(one-om_turb)+(q*(f_W+f_E)-six*c2over27*(-VeloX ))/(one+q); +// //(D.f[DIR_P00])[ke]=zero; +// } + +// q = q_dirN[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = c0o1; +// VeloZ = fac*vx3; +// y = true; +// feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_0M0])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ))/(c1o1+q) - c2o27 * drho; +// //feq=c2over27* (drho+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq); +// //(D.f[DIR_0M0])[ks]=(one-q)/(one+q)*(f_N-feq*om_turb)/(one-om_turb)+(q*(f_N+f_S)-six*c2over27*( VeloY ))/(one+q); +// //(D.f[DIR_0M0])[ks]=zero; +// } + +// q = q_dirS[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = c0o1; +// VeloZ = fac*vx3; +// y = true; +// feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_0P0])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ))/(c1o1+q) - c2o27 * drho; +// //feq=c2over27* (drho+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq); +// //(D.f[DIR_0P0])[kn]=(one-q)/(one+q)*(f_S-feq*om_turb)/(one-om_turb)+(q*(f_S+f_N)-six*c2over27*(-VeloY ))/(one+q); +// //(D.f[DIR_0P0])[kn]=zero; +// } + +// q = q_dirT[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = c0o1; +// z = true; +// feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_00M])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ ))/(c1o1+q) - c2o27 * drho; +// //feq=c2over27* (drho+three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq); +// //(D.f[DIR_00M])[kb]=(one-q)/(one+q)*(f_T-feq*om_turb)/(one-om_turb)+(q*(f_T+f_B)-six*c2over27*( VeloZ ))/(one+q); +// //(D.f[DIR_00M])[kb]=one; +// } + +// q = q_dirB[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = c0o1; +// z = true; +// feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_00P])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ))/(c1o1+q) - c2o27 * drho; +// //feq=c2over27* (drho+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq); +// //(D.f[DIR_00P])[kt]=(one-q)/(one+q)*(f_B-feq*om_turb)/(one-om_turb)+(q*(f_B+f_T)-six*c2over27*(-VeloZ ))/(one+q); +// //(D.f[DIR_00P])[kt]=zero; +// } + +// q = q_dirNE[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_MM0])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); +// //(D.f[DIR_MM0])[ksw]=(one-q)/(one+q)*(f_NE-feq*om_turb)/(one-om_turb)+(q*(f_NE+f_SW)-six*c1over54*(VeloX+VeloY))/(one+q); +// //(D.f[DIR_MM0])[ksw]=zero; +// } + +// q = q_dirSW[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_PP0])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); +// //(D.f[DIR_PP0])[kne]=(one-q)/(one+q)*(f_SW-feq*om_turb)/(one-om_turb)+(q*(f_SW+f_NE)-six*c1over54*(-VeloX-VeloY))/(one+q); +// //(D.f[DIR_PP0])[kne]=zero; +// } + +// q = q_dirSE[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_MP0])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); +// //(D.f[DIR_MP0])[knw]=(one-q)/(one+q)*(f_SE-feq*om_turb)/(one-om_turb)+(q*(f_SE+f_NW)-six*c1over54*( VeloX-VeloY))/(one+q); +// //(D.f[DIR_MP0])[knw]=zero; +// } + +// q = q_dirNW[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_PM0])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); +// //(D.f[DIR_PM0])[kse]=(one-q)/(one+q)*(f_NW-feq*om_turb)/(one-om_turb)+(q*(f_NW+f_SE)-six*c1over54*(-VeloX+VeloY))/(one+q); +// //(D.f[DIR_PM0])[kse]=zero; +// } + +// q = q_dirTE[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (z == true) VeloZ = c0o1; +// // if (k==10000) printf("AFTER x: %u \t y: %u \t z: %u \n VeloX: %f \t VeloY: %f \t VeloZ: %f \n\n", x,y,z, VeloX,VeloY,VeloZ); +// feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_M0M])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); +// //(D.f[DIR_M0M])[kbw]=(one-q)/(one+q)*(f_TE-feq*om_turb)/(one-om_turb)+(q*(f_TE+f_BW)-six*c1over54*( VeloX+VeloZ))/(one+q); +// //(D.f[DIR_M0M])[kbw]=zero; +// } + +// q = q_dirBW[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_P0P])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); +// //(D.f[DIR_P0P])[kte]=(one-q)/(one+q)*(f_BW-feq*om_turb)/(one-om_turb)+(q*(f_BW+f_TE)-six*c1over54*(-VeloX-VeloZ))/(one+q); +// //(D.f[DIR_P0P])[kte]=zero; +// } + +// q = q_dirBE[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_M0P])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); +// //(D.f[DIR_M0P])[ktw]=(one-q)/(one+q)*(f_BE-feq*om_turb)/(one-om_turb)+(q*(f_BE+f_TW)-six*c1over54*( VeloX-VeloZ))/(one+q); +// //(D.f[DIR_M0P])[ktw]=zero; +// } + +// q = q_dirTW[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_P0M])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); +// //(D.f[DIR_P0M])[kbe]=(one-q)/(one+q)*(f_TW-feq*om_turb)/(one-om_turb)+(q*(f_TW+f_BE)-six*c1over54*(-VeloX+VeloZ))/(one+q); +// //(D.f[DIR_P0M])[kbe]=zero; +// } + +// q = q_dirTN[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_0MM])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq); +// //(D.f[DIR_0MM])[kbs]=(one-q)/(one+q)*(f_TN-feq*om_turb)/(one-om_turb)+(q*(f_TN+f_BS)-six*c1over54*( VeloY+VeloZ))/(one+q); +// //(D.f[DIR_0MM])[kbs]=zero; +// } + +// q = q_dirBS[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_0PP])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); +// //(D.f[DIR_0PP])[ktn]=(one-q)/(one+q)*(f_BS-feq*om_turb)/(one-om_turb)+(q*(f_BS+f_TN)-six*c1over54*( -VeloY-VeloZ))/(one+q); +// //(D.f[DIR_0PP])[ktn]=zero; +// } + +// q = q_dirBN[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_0MP])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq); +// //(D.f[DIR_0MP])[kts]=(one-q)/(one+q)*(f_BN-feq*om_turb)/(one-om_turb)+(q*(f_BN+f_TS)-six*c1over54*( VeloY-VeloZ))/(one+q); +// //(D.f[DIR_0MP])[kts]=zero; +// } + +// q = q_dirTS[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_0PM])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q) - c1o54 * drho; +// //feq=c1over54* (drho+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); +// //(D.f[DIR_0PM])[kbn]=(one-q)/(one+q)*(f_TS-feq*om_turb)/(one-om_turb)+(q*(f_TS+f_BN)-six*c1over54*( -VeloY+VeloZ))/(one+q); +// //(D.f[DIR_0PM])[kbn]=zero; +// } + +// q = q_dirTNE[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_MMM])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; +// //feq=c1over216*(drho+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); +// //(D.f[DIR_MMM])[kbsw]=(one-q)/(one+q)*(f_TNE-feq*om_turb)/(one-om_turb)+(q*(f_TNE+f_BSW)-six*c1over216*( VeloX+VeloY+VeloZ))/(one+q); +// //(D.f[DIR_MMM])[kbsw]=zero; +// } + +// q = q_dirBSW[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_PPP])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; +// //feq=c1over216*(drho+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); +// //(D.f[DIR_PPP])[ktne]=(one-q)/(one+q)*(f_BSW-feq*om_turb)/(one-om_turb)+(q*(f_BSW+f_TNE)-six*c1over216*(-VeloX-VeloY-VeloZ))/(one+q); +// //(D.f[DIR_PPP])[ktne]=zero; +// } + +// q = q_dirBNE[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_MMP])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; +// //feq=c1over216*(drho+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); +// //(D.f[DIR_MMP])[ktsw]=(one-q)/(one+q)*(f_BNE-feq*om_turb)/(one-om_turb)+(q*(f_BNE+f_TSW)-six*c1over216*( VeloX+VeloY-VeloZ))/(one+q); +// //(D.f[DIR_MMP])[ktsw]=zero; +// } + +// q = q_dirTSW[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_PPM])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; +// //feq=c1over216*(drho+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); +// //(D.f[DIR_PPM])[kbne]=(one-q)/(one+q)*(f_TSW-feq*om_turb)/(one-om_turb)+(q*(f_TSW+f_BNE)-six*c1over216*(-VeloX-VeloY+VeloZ))/(one+q); +// //(D.f[DIR_PPM])[kbne]=zero; +// } + +// q = q_dirTSE[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_MPM])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; +// //feq=c1over216*(drho+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); +// //(D.f[DIR_MPM])[kbnw]=(one-q)/(one+q)*(f_TSE-feq*om_turb)/(one-om_turb)+(q*(f_TSE+f_BNW)-six*c1over216*( VeloX-VeloY+VeloZ))/(one+q); +// //(D.f[DIR_MPM])[kbnw]=zero; +// } + +// q = q_dirBNW[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_PMP])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; +// //feq=c1over216*(drho+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); +// //(D.f[DIR_PMP])[ktse]=(one-q)/(one+q)*(f_BNW-feq*om_turb)/(one-om_turb)+(q*(f_BNW+f_TSE)-six*c1over216*(-VeloX+VeloY-VeloZ))/(one+q); +// //(D.f[DIR_PMP])[ktse]=zero; +// } + +// q = q_dirBSE[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_MPP])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; +// //feq=c1over216*(drho+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); +// //(D.f[DIR_MPP])[ktnw]=(one-q)/(one+q)*(f_BSE-feq*om_turb)/(one-om_turb)+(q*(f_BSE+f_TNW)-six*c1over216*( VeloX-VeloY-VeloZ))/(one+q); +// //(D.f[DIR_MPP])[ktnw]=zero; +// } + +// q = q_dirTNW[k]; +// if (q>=c0o1 && q<=c1o1) +// { +// VeloX = fac*vx1; +// VeloY = fac*vx2; +// VeloZ = fac*vx3; +// if (x == true) VeloX = c0o1; +// if (y == true) VeloY = c0o1; +// if (z == true) VeloZ = c0o1; +// feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); +// (D.f[DIR_PMM])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om_turb)/(c1o1-om_turb))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; +// //feq=c1over216*(drho+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); +// //(D.f[DIR_PMM])[kbse]=(one-q)/(one+q)*(f_TNW-feq*om_turb)/(one-om_turb)+(q*(f_TNW+f_BSE)-six*c1over216*(-VeloX+VeloY+VeloZ))/(one+q); +// //(D.f[DIR_PMM])[kbse]=zero; +// } +// } +// } @@ -1358,10 +3378,10 @@ extern "C" __global__ void QSlipDeviceComp27(real* DD, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, +__global__ void QSlipGeomDeviceComp27(real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, + unsigned int numberOfBCnodes, real om1, real* NormalX, real* NormalY, @@ -1370,68 +3390,68 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1444,7 +3464,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<sizeQ) + if(k< numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, @@ -1452,128 +3472,128 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// real *nx_dirE, *nx_dirW, *nx_dirN, *nx_dirS, *nx_dirT, *nx_dirB, *nx_dirNE, *nx_dirSW, *nx_dirSE, *nx_dirNW, *nx_dirTE, *nx_dirBW, *nx_dirBE, *nx_dirTW, *nx_dirTN, *nx_dirBS, *nx_dirBN, *nx_dirTS, *nx_dirTNE, *nx_dirTSW, *nx_dirTSE, *nx_dirTNW, *nx_dirBNE, *nx_dirBSW, *nx_dirBSE, *nx_dirBNW; - nx_dirE = &NormalX[dirE *sizeQ]; - nx_dirW = &NormalX[dirW *sizeQ]; - nx_dirN = &NormalX[dirN *sizeQ]; - nx_dirS = &NormalX[dirS *sizeQ]; - nx_dirT = &NormalX[dirT *sizeQ]; - nx_dirB = &NormalX[dirB *sizeQ]; - nx_dirNE = &NormalX[dirNE *sizeQ]; - nx_dirSW = &NormalX[dirSW *sizeQ]; - nx_dirSE = &NormalX[dirSE *sizeQ]; - nx_dirNW = &NormalX[dirNW *sizeQ]; - nx_dirTE = &NormalX[dirTE *sizeQ]; - nx_dirBW = &NormalX[dirBW *sizeQ]; - nx_dirBE = &NormalX[dirBE *sizeQ]; - nx_dirTW = &NormalX[dirTW *sizeQ]; - nx_dirTN = &NormalX[dirTN *sizeQ]; - nx_dirBS = &NormalX[dirBS *sizeQ]; - nx_dirBN = &NormalX[dirBN *sizeQ]; - nx_dirTS = &NormalX[dirTS *sizeQ]; - nx_dirTNE = &NormalX[dirTNE *sizeQ]; - nx_dirTSW = &NormalX[dirTSW *sizeQ]; - nx_dirTSE = &NormalX[dirTSE *sizeQ]; - nx_dirTNW = &NormalX[dirTNW *sizeQ]; - nx_dirBNE = &NormalX[dirBNE *sizeQ]; - nx_dirBSW = &NormalX[dirBSW *sizeQ]; - nx_dirBSE = &NormalX[dirBSE *sizeQ]; - nx_dirBNW = &NormalX[dirBNW *sizeQ]; + nx_dirE = &NormalX[DIR_P00 * numberOfBCnodes]; + nx_dirW = &NormalX[DIR_M00 * numberOfBCnodes]; + nx_dirN = &NormalX[DIR_0P0 * numberOfBCnodes]; + nx_dirS = &NormalX[DIR_0M0 * numberOfBCnodes]; + nx_dirT = &NormalX[DIR_00P * numberOfBCnodes]; + nx_dirB = &NormalX[DIR_00M * numberOfBCnodes]; + nx_dirNE = &NormalX[DIR_PP0 * numberOfBCnodes]; + nx_dirSW = &NormalX[DIR_MM0 * numberOfBCnodes]; + nx_dirSE = &NormalX[DIR_PM0 * numberOfBCnodes]; + nx_dirNW = &NormalX[DIR_MP0 * numberOfBCnodes]; + nx_dirTE = &NormalX[DIR_P0P * numberOfBCnodes]; + nx_dirBW = &NormalX[DIR_M0M * numberOfBCnodes]; + nx_dirBE = &NormalX[DIR_P0M * numberOfBCnodes]; + nx_dirTW = &NormalX[DIR_M0P * numberOfBCnodes]; + nx_dirTN = &NormalX[DIR_0PP * numberOfBCnodes]; + nx_dirBS = &NormalX[DIR_0MM * numberOfBCnodes]; + nx_dirBN = &NormalX[DIR_0PM * numberOfBCnodes]; + nx_dirTS = &NormalX[DIR_0MP * numberOfBCnodes]; + nx_dirTNE = &NormalX[DIR_PPP * numberOfBCnodes]; + nx_dirTSW = &NormalX[DIR_MMP * numberOfBCnodes]; + nx_dirTSE = &NormalX[DIR_PMP * numberOfBCnodes]; + nx_dirTNW = &NormalX[DIR_MPP * numberOfBCnodes]; + nx_dirBNE = &NormalX[DIR_PPM * numberOfBCnodes]; + nx_dirBSW = &NormalX[DIR_MMM * numberOfBCnodes]; + nx_dirBSE = &NormalX[DIR_PMM * numberOfBCnodes]; + nx_dirBNW = &NormalX[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// real *ny_dirE, *ny_dirW, *ny_dirN, *ny_dirS, *ny_dirT, *ny_dirB, *ny_dirNE, *ny_dirSW, *ny_dirSE, *ny_dirNW, *ny_dirTE, *ny_dirBW, *ny_dirBE, *ny_dirTW, *ny_dirTN, *ny_dirBS, *ny_dirBN, *ny_dirTS, *ny_dirTNE, *ny_dirTSW, *ny_dirTSE, *ny_dirTNW, *ny_dirBNE, *ny_dirBSW, *ny_dirBSE, *ny_dirBNW; - ny_dirE = &NormalY[dirE *sizeQ]; - ny_dirW = &NormalY[dirW *sizeQ]; - ny_dirN = &NormalY[dirN *sizeQ]; - ny_dirS = &NormalY[dirS *sizeQ]; - ny_dirT = &NormalY[dirT *sizeQ]; - ny_dirB = &NormalY[dirB *sizeQ]; - ny_dirNE = &NormalY[dirNE *sizeQ]; - ny_dirSW = &NormalY[dirSW *sizeQ]; - ny_dirSE = &NormalY[dirSE *sizeQ]; - ny_dirNW = &NormalY[dirNW *sizeQ]; - ny_dirTE = &NormalY[dirTE *sizeQ]; - ny_dirBW = &NormalY[dirBW *sizeQ]; - ny_dirBE = &NormalY[dirBE *sizeQ]; - ny_dirTW = &NormalY[dirTW *sizeQ]; - ny_dirTN = &NormalY[dirTN *sizeQ]; - ny_dirBS = &NormalY[dirBS *sizeQ]; - ny_dirBN = &NormalY[dirBN *sizeQ]; - ny_dirTS = &NormalY[dirTS *sizeQ]; - ny_dirTNE = &NormalY[dirTNE *sizeQ]; - ny_dirTSW = &NormalY[dirTSW *sizeQ]; - ny_dirTSE = &NormalY[dirTSE *sizeQ]; - ny_dirTNW = &NormalY[dirTNW *sizeQ]; - ny_dirBNE = &NormalY[dirBNE *sizeQ]; - ny_dirBSW = &NormalY[dirBSW *sizeQ]; - ny_dirBSE = &NormalY[dirBSE *sizeQ]; - ny_dirBNW = &NormalY[dirBNW *sizeQ]; + ny_dirE = &NormalY[DIR_P00 * numberOfBCnodes]; + ny_dirW = &NormalY[DIR_M00 * numberOfBCnodes]; + ny_dirN = &NormalY[DIR_0P0 * numberOfBCnodes]; + ny_dirS = &NormalY[DIR_0M0 * numberOfBCnodes]; + ny_dirT = &NormalY[DIR_00P * numberOfBCnodes]; + ny_dirB = &NormalY[DIR_00M * numberOfBCnodes]; + ny_dirNE = &NormalY[DIR_PP0 * numberOfBCnodes]; + ny_dirSW = &NormalY[DIR_MM0 * numberOfBCnodes]; + ny_dirSE = &NormalY[DIR_PM0 * numberOfBCnodes]; + ny_dirNW = &NormalY[DIR_MP0 * numberOfBCnodes]; + ny_dirTE = &NormalY[DIR_P0P * numberOfBCnodes]; + ny_dirBW = &NormalY[DIR_M0M * numberOfBCnodes]; + ny_dirBE = &NormalY[DIR_P0M * numberOfBCnodes]; + ny_dirTW = &NormalY[DIR_M0P * numberOfBCnodes]; + ny_dirTN = &NormalY[DIR_0PP * numberOfBCnodes]; + ny_dirBS = &NormalY[DIR_0MM * numberOfBCnodes]; + ny_dirBN = &NormalY[DIR_0PM * numberOfBCnodes]; + ny_dirTS = &NormalY[DIR_0MP * numberOfBCnodes]; + ny_dirTNE = &NormalY[DIR_PPP * numberOfBCnodes]; + ny_dirTSW = &NormalY[DIR_MMP * numberOfBCnodes]; + ny_dirTSE = &NormalY[DIR_PMP * numberOfBCnodes]; + ny_dirTNW = &NormalY[DIR_MPP * numberOfBCnodes]; + ny_dirBNE = &NormalY[DIR_PPM * numberOfBCnodes]; + ny_dirBSW = &NormalY[DIR_MMM * numberOfBCnodes]; + ny_dirBSE = &NormalY[DIR_PMM * numberOfBCnodes]; + ny_dirBNW = &NormalY[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// real *nz_dirE, *nz_dirW, *nz_dirN, *nz_dirS, *nz_dirT, *nz_dirB, *nz_dirNE, *nz_dirSW, *nz_dirSE, *nz_dirNW, *nz_dirTE, *nz_dirBW, *nz_dirBE, *nz_dirTW, *nz_dirTN, *nz_dirBS, *nz_dirBN, *nz_dirTS, *nz_dirTNE, *nz_dirTSW, *nz_dirTSE, *nz_dirTNW, *nz_dirBNE, *nz_dirBSW, *nz_dirBSE, *nz_dirBNW; - nz_dirE = &NormalZ[dirE *sizeQ]; - nz_dirW = &NormalZ[dirW *sizeQ]; - nz_dirN = &NormalZ[dirN *sizeQ]; - nz_dirS = &NormalZ[dirS *sizeQ]; - nz_dirT = &NormalZ[dirT *sizeQ]; - nz_dirB = &NormalZ[dirB *sizeQ]; - nz_dirNE = &NormalZ[dirNE *sizeQ]; - nz_dirSW = &NormalZ[dirSW *sizeQ]; - nz_dirSE = &NormalZ[dirSE *sizeQ]; - nz_dirNW = &NormalZ[dirNW *sizeQ]; - nz_dirTE = &NormalZ[dirTE *sizeQ]; - nz_dirBW = &NormalZ[dirBW *sizeQ]; - nz_dirBE = &NormalZ[dirBE *sizeQ]; - nz_dirTW = &NormalZ[dirTW *sizeQ]; - nz_dirTN = &NormalZ[dirTN *sizeQ]; - nz_dirBS = &NormalZ[dirBS *sizeQ]; - nz_dirBN = &NormalZ[dirBN *sizeQ]; - nz_dirTS = &NormalZ[dirTS *sizeQ]; - nz_dirTNE = &NormalZ[dirTNE *sizeQ]; - nz_dirTSW = &NormalZ[dirTSW *sizeQ]; - nz_dirTSE = &NormalZ[dirTSE *sizeQ]; - nz_dirTNW = &NormalZ[dirTNW *sizeQ]; - nz_dirBNE = &NormalZ[dirBNE *sizeQ]; - nz_dirBSW = &NormalZ[dirBSW *sizeQ]; - nz_dirBSE = &NormalZ[dirBSE *sizeQ]; - nz_dirBNW = &NormalZ[dirBNW *sizeQ]; + nz_dirE = &NormalZ[DIR_P00 * numberOfBCnodes]; + nz_dirW = &NormalZ[DIR_M00 * numberOfBCnodes]; + nz_dirN = &NormalZ[DIR_0P0 * numberOfBCnodes]; + nz_dirS = &NormalZ[DIR_0M0 * numberOfBCnodes]; + nz_dirT = &NormalZ[DIR_00P * numberOfBCnodes]; + nz_dirB = &NormalZ[DIR_00M * numberOfBCnodes]; + nz_dirNE = &NormalZ[DIR_PP0 * numberOfBCnodes]; + nz_dirSW = &NormalZ[DIR_MM0 * numberOfBCnodes]; + nz_dirSE = &NormalZ[DIR_PM0 * numberOfBCnodes]; + nz_dirNW = &NormalZ[DIR_MP0 * numberOfBCnodes]; + nz_dirTE = &NormalZ[DIR_P0P * numberOfBCnodes]; + nz_dirBW = &NormalZ[DIR_M0M * numberOfBCnodes]; + nz_dirBE = &NormalZ[DIR_P0M * numberOfBCnodes]; + nz_dirTW = &NormalZ[DIR_M0P * numberOfBCnodes]; + nz_dirTN = &NormalZ[DIR_0PP * numberOfBCnodes]; + nz_dirBS = &NormalZ[DIR_0MM * numberOfBCnodes]; + nz_dirBN = &NormalZ[DIR_0PM * numberOfBCnodes]; + nz_dirTS = &NormalZ[DIR_0MP * numberOfBCnodes]; + nz_dirTNE = &NormalZ[DIR_PPP * numberOfBCnodes]; + nz_dirTSW = &NormalZ[DIR_MMP * numberOfBCnodes]; + nz_dirTSE = &NormalZ[DIR_PMP * numberOfBCnodes]; + nz_dirTNW = &NormalZ[DIR_MPP * numberOfBCnodes]; + nz_dirBNE = &NormalZ[DIR_PPM * numberOfBCnodes]; + nz_dirBSW = &NormalZ[DIR_MMM * numberOfBCnodes]; + nz_dirBSE = &NormalZ[DIR_PMM * numberOfBCnodes]; + nz_dirBNW = &NormalZ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -1605,37 +3625,37 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, unsigned int ktne = KQK; unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; + real f_W = (D.f[DIR_P00 ])[ke ]; + real f_E = (D.f[DIR_M00 ])[kw ]; + real f_S = (D.f[DIR_0P0 ])[kn ]; + real f_N = (D.f[DIR_0M0 ])[ks ]; + real f_B = (D.f[DIR_00P ])[kt ]; + real f_T = (D.f[DIR_00M ])[kb ]; + real f_SW = (D.f[DIR_PP0 ])[kne ]; + real f_NE = (D.f[DIR_MM0 ])[ksw ]; + real f_NW = (D.f[DIR_PM0 ])[kse ]; + real f_SE = (D.f[DIR_MP0 ])[knw ]; + real f_BW = (D.f[DIR_P0P ])[kte ]; + real f_TE = (D.f[DIR_M0M ])[kbw ]; + real f_TW = (D.f[DIR_P0M ])[kbe ]; + real f_BE = (D.f[DIR_M0P ])[ktw ]; + real f_BS = (D.f[DIR_0PP ])[ktn ]; + real f_TN = (D.f[DIR_0MM ])[kbs ]; + real f_TS = (D.f[DIR_0PM ])[kbn ]; + real f_BN = (D.f[DIR_0MP ])[kts ]; + real f_BSW = (D.f[DIR_PPP ])[ktne ]; + real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + real f_BNW = (D.f[DIR_PMP ])[ktse ]; + real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + real f_TSW = (D.f[DIR_PPM ])[kbne ]; + real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + real f_TNW = (D.f[DIR_PMM ])[kbse ]; + real f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -1653,65 +3673,65 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real VeloX = vx1; @@ -1733,11 +3753,11 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, //fac = fac * magS / (c1o3 * (one / om1 - c1o2)); // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //real *facAst = &QQ[dirZERO *sizeQ]; + //real *facAst = &QQ[DIR_000 * numberOfBCnodes]; //fac = fac * alpha + facAst[k] * (one - alpha); //facAst[k] = fac; - //(&QQ[dirZERO *sizeQ])[KQK] = fac; + //(&QQ[DIR_000 * numberOfBCnodes])[KQK] = fac; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////real uk = sqrtf(vx1*vx1 + vx2*vx2 + vx3*vx3); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1793,7 +3813,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, phi = fac / (q * fabs( nx_dirE[k]) + fac); VeloX *= phi; feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_M00])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ))/(c1o1+q) - c2o27 * drho; } q = q_dirW[k]; @@ -1807,7 +3827,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, phi = fac / (q * fabs(-nx_dirW[k]) + fac); VeloX *= phi; feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_P00])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ))/(c1o1+q) - c2o27 * drho; } q = q_dirN[k]; @@ -1821,7 +3841,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, phi = fac / (q * fabs( ny_dirN[k]) + fac); VeloY *= phi; feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_0M0])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ))/(c1o1+q) - c2o27 * drho; } q = q_dirS[k]; @@ -1835,7 +3855,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, phi = fac / (q * fabs(-ny_dirS[k]) + fac); VeloY *= phi; feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_0P0])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ))/(c1o1+q) - c2o27 * drho; } q = q_dirT[k]; @@ -1849,7 +3869,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, phi = fac / (q * fabs( nz_dirT[k]) + fac); VeloZ *= phi; feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ ))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_00M])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ ))/(c1o1+q) - c2o27 * drho; } q = q_dirB[k]; @@ -1863,7 +3883,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, phi = fac / (q * fabs(-nz_dirB[k]) + fac); VeloZ *= phi; feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_00P])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ))/(c1o1+q) - c2o27 * drho; } q = q_dirNE[k]; @@ -1879,7 +3899,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloX *= phi; VeloY *= phi; feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_MM0])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY))/(c1o1+q) - c1o54 * drho; } q = q_dirSW[k]; @@ -1895,7 +3915,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloX *= phi; VeloY *= phi; feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_PP0])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q) - c1o54 * drho; } q = q_dirSE[k]; @@ -1911,7 +3931,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloX *= phi; VeloY *= phi; feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_MP0])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q) - c1o54 * drho; } q = q_dirNW[k]; @@ -1927,7 +3947,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloX *= phi; VeloY *= phi; feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_PM0])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q) - c1o54 * drho; } q = q_dirTE[k]; @@ -1943,7 +3963,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloX *= phi; VeloZ *= phi; feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_M0M])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q) - c1o54 * drho; } q = q_dirBW[k]; @@ -1959,7 +3979,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloX *= phi; VeloZ *= phi; feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_P0P])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q) - c1o54 * drho; } q = q_dirBE[k]; @@ -1975,7 +3995,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloX *= phi; VeloZ *= phi; feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_M0P])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q) - c1o54 * drho; } q = q_dirTW[k]; @@ -1991,7 +4011,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloX *= phi; VeloZ *= phi; feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_P0M])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q) - c1o54 * drho; } q = q_dirTN[k]; @@ -2007,7 +4027,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_0MM])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q) - c1o54 * drho; } q = q_dirBS[k]; @@ -2023,7 +4043,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_0PP])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q) - c1o54 * drho; } q = q_dirBN[k]; @@ -2039,7 +4059,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_0MP])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q) - c1o54 * drho; } q = q_dirTS[k]; @@ -2055,7 +4075,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_0PM])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q) - c1o54 * drho; } q = q_dirTNE[k]; @@ -2073,7 +4093,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_MMM])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; } q = q_dirBSW[k]; @@ -2091,7 +4111,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_PPP])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; } q = q_dirBNE[k]; @@ -2109,7 +4129,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_MMP])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; } q = q_dirTSW[k]; @@ -2127,7 +4147,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_PPM])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; } q = q_dirTSE[k]; @@ -2145,7 +4165,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_MPM])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; } q = q_dirBNW[k]; @@ -2163,7 +4183,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_PMP])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; } q = q_dirBSE[k]; @@ -2181,7 +4201,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_MPP])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; } q = q_dirTNW[k]; @@ -2199,7 +4219,7 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, VeloY *= phi; VeloZ *= phi; feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_PMM])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; } } } @@ -2244,10 +4264,10 @@ extern "C" __global__ void QSlipGeomDeviceComp27(real* DD, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QSlipNormDeviceComp27(real* DD, +__global__ void QSlipNormDeviceComp27(real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, + unsigned int numberOfBCnodes, real om1, real* NormalX, real* NormalY, @@ -2256,68 +4276,68 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -2330,7 +4350,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<sizeQ) + if(k< numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, @@ -2338,128 +4358,128 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// real *nx_dirE, *nx_dirW, *nx_dirN, *nx_dirS, *nx_dirT, *nx_dirB, *nx_dirNE, *nx_dirSW, *nx_dirSE, *nx_dirNW, *nx_dirTE, *nx_dirBW, *nx_dirBE, *nx_dirTW, *nx_dirTN, *nx_dirBS, *nx_dirBN, *nx_dirTS, *nx_dirTNE, *nx_dirTSW, *nx_dirTSE, *nx_dirTNW, *nx_dirBNE, *nx_dirBSW, *nx_dirBSE, *nx_dirBNW; - nx_dirE = &NormalX[dirE *sizeQ]; - nx_dirW = &NormalX[dirW *sizeQ]; - nx_dirN = &NormalX[dirN *sizeQ]; - nx_dirS = &NormalX[dirS *sizeQ]; - nx_dirT = &NormalX[dirT *sizeQ]; - nx_dirB = &NormalX[dirB *sizeQ]; - nx_dirNE = &NormalX[dirNE *sizeQ]; - nx_dirSW = &NormalX[dirSW *sizeQ]; - nx_dirSE = &NormalX[dirSE *sizeQ]; - nx_dirNW = &NormalX[dirNW *sizeQ]; - nx_dirTE = &NormalX[dirTE *sizeQ]; - nx_dirBW = &NormalX[dirBW *sizeQ]; - nx_dirBE = &NormalX[dirBE *sizeQ]; - nx_dirTW = &NormalX[dirTW *sizeQ]; - nx_dirTN = &NormalX[dirTN *sizeQ]; - nx_dirBS = &NormalX[dirBS *sizeQ]; - nx_dirBN = &NormalX[dirBN *sizeQ]; - nx_dirTS = &NormalX[dirTS *sizeQ]; - nx_dirTNE = &NormalX[dirTNE *sizeQ]; - nx_dirTSW = &NormalX[dirTSW *sizeQ]; - nx_dirTSE = &NormalX[dirTSE *sizeQ]; - nx_dirTNW = &NormalX[dirTNW *sizeQ]; - nx_dirBNE = &NormalX[dirBNE *sizeQ]; - nx_dirBSW = &NormalX[dirBSW *sizeQ]; - nx_dirBSE = &NormalX[dirBSE *sizeQ]; - nx_dirBNW = &NormalX[dirBNW *sizeQ]; + nx_dirE = &NormalX[DIR_P00 * numberOfBCnodes]; + nx_dirW = &NormalX[DIR_M00 * numberOfBCnodes]; + nx_dirN = &NormalX[DIR_0P0 * numberOfBCnodes]; + nx_dirS = &NormalX[DIR_0M0 * numberOfBCnodes]; + nx_dirT = &NormalX[DIR_00P * numberOfBCnodes]; + nx_dirB = &NormalX[DIR_00M * numberOfBCnodes]; + nx_dirNE = &NormalX[DIR_PP0 * numberOfBCnodes]; + nx_dirSW = &NormalX[DIR_MM0 * numberOfBCnodes]; + nx_dirSE = &NormalX[DIR_PM0 * numberOfBCnodes]; + nx_dirNW = &NormalX[DIR_MP0 * numberOfBCnodes]; + nx_dirTE = &NormalX[DIR_P0P * numberOfBCnodes]; + nx_dirBW = &NormalX[DIR_M0M * numberOfBCnodes]; + nx_dirBE = &NormalX[DIR_P0M * numberOfBCnodes]; + nx_dirTW = &NormalX[DIR_M0P * numberOfBCnodes]; + nx_dirTN = &NormalX[DIR_0PP * numberOfBCnodes]; + nx_dirBS = &NormalX[DIR_0MM * numberOfBCnodes]; + nx_dirBN = &NormalX[DIR_0PM * numberOfBCnodes]; + nx_dirTS = &NormalX[DIR_0MP * numberOfBCnodes]; + nx_dirTNE = &NormalX[DIR_PPP * numberOfBCnodes]; + nx_dirTSW = &NormalX[DIR_MMP * numberOfBCnodes]; + nx_dirTSE = &NormalX[DIR_PMP * numberOfBCnodes]; + nx_dirTNW = &NormalX[DIR_MPP * numberOfBCnodes]; + nx_dirBNE = &NormalX[DIR_PPM * numberOfBCnodes]; + nx_dirBSW = &NormalX[DIR_MMM * numberOfBCnodes]; + nx_dirBSE = &NormalX[DIR_PMM * numberOfBCnodes]; + nx_dirBNW = &NormalX[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// real *ny_dirE, *ny_dirW, *ny_dirN, *ny_dirS, *ny_dirT, *ny_dirB, *ny_dirNE, *ny_dirSW, *ny_dirSE, *ny_dirNW, *ny_dirTE, *ny_dirBW, *ny_dirBE, *ny_dirTW, *ny_dirTN, *ny_dirBS, *ny_dirBN, *ny_dirTS, *ny_dirTNE, *ny_dirTSW, *ny_dirTSE, *ny_dirTNW, *ny_dirBNE, *ny_dirBSW, *ny_dirBSE, *ny_dirBNW; - ny_dirE = &NormalY[dirE *sizeQ]; - ny_dirW = &NormalY[dirW *sizeQ]; - ny_dirN = &NormalY[dirN *sizeQ]; - ny_dirS = &NormalY[dirS *sizeQ]; - ny_dirT = &NormalY[dirT *sizeQ]; - ny_dirB = &NormalY[dirB *sizeQ]; - ny_dirNE = &NormalY[dirNE *sizeQ]; - ny_dirSW = &NormalY[dirSW *sizeQ]; - ny_dirSE = &NormalY[dirSE *sizeQ]; - ny_dirNW = &NormalY[dirNW *sizeQ]; - ny_dirTE = &NormalY[dirTE *sizeQ]; - ny_dirBW = &NormalY[dirBW *sizeQ]; - ny_dirBE = &NormalY[dirBE *sizeQ]; - ny_dirTW = &NormalY[dirTW *sizeQ]; - ny_dirTN = &NormalY[dirTN *sizeQ]; - ny_dirBS = &NormalY[dirBS *sizeQ]; - ny_dirBN = &NormalY[dirBN *sizeQ]; - ny_dirTS = &NormalY[dirTS *sizeQ]; - ny_dirTNE = &NormalY[dirTNE *sizeQ]; - ny_dirTSW = &NormalY[dirTSW *sizeQ]; - ny_dirTSE = &NormalY[dirTSE *sizeQ]; - ny_dirTNW = &NormalY[dirTNW *sizeQ]; - ny_dirBNE = &NormalY[dirBNE *sizeQ]; - ny_dirBSW = &NormalY[dirBSW *sizeQ]; - ny_dirBSE = &NormalY[dirBSE *sizeQ]; - ny_dirBNW = &NormalY[dirBNW *sizeQ]; + ny_dirE = &NormalY[DIR_P00 * numberOfBCnodes]; + ny_dirW = &NormalY[DIR_M00 * numberOfBCnodes]; + ny_dirN = &NormalY[DIR_0P0 * numberOfBCnodes]; + ny_dirS = &NormalY[DIR_0M0 * numberOfBCnodes]; + ny_dirT = &NormalY[DIR_00P * numberOfBCnodes]; + ny_dirB = &NormalY[DIR_00M * numberOfBCnodes]; + ny_dirNE = &NormalY[DIR_PP0 * numberOfBCnodes]; + ny_dirSW = &NormalY[DIR_MM0 * numberOfBCnodes]; + ny_dirSE = &NormalY[DIR_PM0 * numberOfBCnodes]; + ny_dirNW = &NormalY[DIR_MP0 * numberOfBCnodes]; + ny_dirTE = &NormalY[DIR_P0P * numberOfBCnodes]; + ny_dirBW = &NormalY[DIR_M0M * numberOfBCnodes]; + ny_dirBE = &NormalY[DIR_P0M * numberOfBCnodes]; + ny_dirTW = &NormalY[DIR_M0P * numberOfBCnodes]; + ny_dirTN = &NormalY[DIR_0PP * numberOfBCnodes]; + ny_dirBS = &NormalY[DIR_0MM * numberOfBCnodes]; + ny_dirBN = &NormalY[DIR_0PM * numberOfBCnodes]; + ny_dirTS = &NormalY[DIR_0MP * numberOfBCnodes]; + ny_dirTNE = &NormalY[DIR_PPP * numberOfBCnodes]; + ny_dirTSW = &NormalY[DIR_MMP * numberOfBCnodes]; + ny_dirTSE = &NormalY[DIR_PMP * numberOfBCnodes]; + ny_dirTNW = &NormalY[DIR_MPP * numberOfBCnodes]; + ny_dirBNE = &NormalY[DIR_PPM * numberOfBCnodes]; + ny_dirBSW = &NormalY[DIR_MMM * numberOfBCnodes]; + ny_dirBSE = &NormalY[DIR_PMM * numberOfBCnodes]; + ny_dirBNW = &NormalY[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// real *nz_dirE, *nz_dirW, *nz_dirN, *nz_dirS, *nz_dirT, *nz_dirB, *nz_dirNE, *nz_dirSW, *nz_dirSE, *nz_dirNW, *nz_dirTE, *nz_dirBW, *nz_dirBE, *nz_dirTW, *nz_dirTN, *nz_dirBS, *nz_dirBN, *nz_dirTS, *nz_dirTNE, *nz_dirTSW, *nz_dirTSE, *nz_dirTNW, *nz_dirBNE, *nz_dirBSW, *nz_dirBSE, *nz_dirBNW; - nz_dirE = &NormalZ[dirE *sizeQ]; - nz_dirW = &NormalZ[dirW *sizeQ]; - nz_dirN = &NormalZ[dirN *sizeQ]; - nz_dirS = &NormalZ[dirS *sizeQ]; - nz_dirT = &NormalZ[dirT *sizeQ]; - nz_dirB = &NormalZ[dirB *sizeQ]; - nz_dirNE = &NormalZ[dirNE *sizeQ]; - nz_dirSW = &NormalZ[dirSW *sizeQ]; - nz_dirSE = &NormalZ[dirSE *sizeQ]; - nz_dirNW = &NormalZ[dirNW *sizeQ]; - nz_dirTE = &NormalZ[dirTE *sizeQ]; - nz_dirBW = &NormalZ[dirBW *sizeQ]; - nz_dirBE = &NormalZ[dirBE *sizeQ]; - nz_dirTW = &NormalZ[dirTW *sizeQ]; - nz_dirTN = &NormalZ[dirTN *sizeQ]; - nz_dirBS = &NormalZ[dirBS *sizeQ]; - nz_dirBN = &NormalZ[dirBN *sizeQ]; - nz_dirTS = &NormalZ[dirTS *sizeQ]; - nz_dirTNE = &NormalZ[dirTNE *sizeQ]; - nz_dirTSW = &NormalZ[dirTSW *sizeQ]; - nz_dirTSE = &NormalZ[dirTSE *sizeQ]; - nz_dirTNW = &NormalZ[dirTNW *sizeQ]; - nz_dirBNE = &NormalZ[dirBNE *sizeQ]; - nz_dirBSW = &NormalZ[dirBSW *sizeQ]; - nz_dirBSE = &NormalZ[dirBSE *sizeQ]; - nz_dirBNW = &NormalZ[dirBNW *sizeQ]; + nz_dirE = &NormalZ[DIR_P00 * numberOfBCnodes]; + nz_dirW = &NormalZ[DIR_M00 * numberOfBCnodes]; + nz_dirN = &NormalZ[DIR_0P0 * numberOfBCnodes]; + nz_dirS = &NormalZ[DIR_0M0 * numberOfBCnodes]; + nz_dirT = &NormalZ[DIR_00P * numberOfBCnodes]; + nz_dirB = &NormalZ[DIR_00M * numberOfBCnodes]; + nz_dirNE = &NormalZ[DIR_PP0 * numberOfBCnodes]; + nz_dirSW = &NormalZ[DIR_MM0 * numberOfBCnodes]; + nz_dirSE = &NormalZ[DIR_PM0 * numberOfBCnodes]; + nz_dirNW = &NormalZ[DIR_MP0 * numberOfBCnodes]; + nz_dirTE = &NormalZ[DIR_P0P * numberOfBCnodes]; + nz_dirBW = &NormalZ[DIR_M0M * numberOfBCnodes]; + nz_dirBE = &NormalZ[DIR_P0M * numberOfBCnodes]; + nz_dirTW = &NormalZ[DIR_M0P * numberOfBCnodes]; + nz_dirTN = &NormalZ[DIR_0PP * numberOfBCnodes]; + nz_dirBS = &NormalZ[DIR_0MM * numberOfBCnodes]; + nz_dirBN = &NormalZ[DIR_0PM * numberOfBCnodes]; + nz_dirTS = &NormalZ[DIR_0MP * numberOfBCnodes]; + nz_dirTNE = &NormalZ[DIR_PPP * numberOfBCnodes]; + nz_dirTSW = &NormalZ[DIR_MMP * numberOfBCnodes]; + nz_dirTSE = &NormalZ[DIR_PMP * numberOfBCnodes]; + nz_dirTNW = &NormalZ[DIR_MPP * numberOfBCnodes]; + nz_dirBNE = &NormalZ[DIR_PPM * numberOfBCnodes]; + nz_dirBSW = &NormalZ[DIR_MMM * numberOfBCnodes]; + nz_dirBSE = &NormalZ[DIR_PMM * numberOfBCnodes]; + nz_dirBNW = &NormalZ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -2491,37 +4511,37 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, unsigned int ktne = KQK; unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; + real f_W = (D.f[DIR_P00 ])[ke ]; + real f_E = (D.f[DIR_M00 ])[kw ]; + real f_S = (D.f[DIR_0P0 ])[kn ]; + real f_N = (D.f[DIR_0M0 ])[ks ]; + real f_B = (D.f[DIR_00P ])[kt ]; + real f_T = (D.f[DIR_00M ])[kb ]; + real f_SW = (D.f[DIR_PP0 ])[kne ]; + real f_NE = (D.f[DIR_MM0 ])[ksw ]; + real f_NW = (D.f[DIR_PM0 ])[kse ]; + real f_SE = (D.f[DIR_MP0 ])[knw ]; + real f_BW = (D.f[DIR_P0P ])[kte ]; + real f_TE = (D.f[DIR_M0M ])[kbw ]; + real f_TW = (D.f[DIR_P0M ])[kbe ]; + real f_BE = (D.f[DIR_M0P ])[ktw ]; + real f_BS = (D.f[DIR_0PP ])[ktn ]; + real f_TN = (D.f[DIR_0MM ])[kbs ]; + real f_TS = (D.f[DIR_0PM ])[kbn ]; + real f_BN = (D.f[DIR_0MP ])[kts ]; + real f_BSW = (D.f[DIR_PPP ])[ktne ]; + real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + real f_BNW = (D.f[DIR_PMP ])[ktse ]; + real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + real f_TSW = (D.f[DIR_PPM ])[kbne ]; + real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + real f_TNW = (D.f[DIR_PMM ])[kbse ]; + real f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -2539,65 +4559,65 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real VeloX = vx1; @@ -2619,11 +4639,11 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, fac = fac * magS / (c1o3 * (c1o1 / om1 - c1o2)); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real *facAst = &QQ[dirZERO *sizeQ]; + real *facAst = &QQ[DIR_000 * numberOfBCnodes]; fac = fac * alpha + facAst[k] * (c1o1 - alpha); facAst[k] = fac; - //(&QQ[dirZERO *sizeQ])[KQK] = fac; + //(&QQ[DIR_000 * numberOfBCnodes])[KQK] = fac; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////real uk = sqrtf(vx1*vx1 + vx2*vx2 + vx3*vx3); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -2685,7 +4705,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_M00])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W))/(c1o1+q) - c2o27 * drho; } q = q_dirW[k]; @@ -2700,7 +4720,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_P00])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E))/(c1o1+q) - c2o27 * drho; } q = q_dirN[k]; @@ -2715,7 +4735,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_0M0])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S))/(c1o1+q) - c2o27 * drho; } q = q_dirS[k]; @@ -2730,7 +4750,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_0P0])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N))/(c1o1+q) - c2o27 * drho; } q = q_dirT[k]; @@ -2745,7 +4765,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_00M])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B))/(c1o1+q) - c2o27 * drho; } q = q_dirB[k]; @@ -2760,7 +4780,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T))/(c1o1+q) - c2o27 * drho; + (D.f[DIR_00P])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T))/(c1o1+q) - c2o27 * drho; } q = q_dirNE[k]; @@ -2776,7 +4796,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_MM0])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW))/(c1o1+q) - c1o54 * drho; } q = q_dirSW[k]; @@ -2792,7 +4812,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_PP0])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE))/(c1o1+q) - c1o54 * drho; } q = q_dirSE[k]; @@ -2808,7 +4828,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_MP0])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW))/(c1o1+q) - c1o54 * drho; } q = q_dirNW[k]; @@ -2824,7 +4844,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_PM0])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE))/(c1o1+q) - c1o54 * drho; } q = q_dirTE[k]; @@ -2840,7 +4860,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_M0M])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW))/(c1o1+q) - c1o54 * drho; } q = q_dirBW[k]; @@ -2856,7 +4876,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_P0P])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE))/(c1o1+q) - c1o54 * drho; } q = q_dirBE[k]; @@ -2872,7 +4892,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_M0P])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW))/(c1o1+q) - c1o54 * drho; } q = q_dirTW[k]; @@ -2888,7 +4908,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_P0M])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE))/(c1o1+q) - c1o54 * drho; } q = q_dirTN[k]; @@ -2904,7 +4924,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_0MM])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS))/(c1o1+q) - c1o54 * drho; } q = q_dirBS[k]; @@ -2920,7 +4940,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_0PP])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN))/(c1o1+q) - c1o54 * drho; } q = q_dirBN[k]; @@ -2936,7 +4956,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_0MP])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS))/(c1o1+q) - c1o54 * drho; } q = q_dirTS[k]; @@ -2952,7 +4972,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN))/(c1o1+q) - c1o54 * drho; + (D.f[DIR_0PM])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN))/(c1o1+q) - c1o54 * drho; } q = q_dirTNE[k]; @@ -2971,7 +4991,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_MMM])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW))/(c1o1+q) - c1o216 * drho; } q = q_dirBSW[k]; @@ -2990,7 +5010,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_PPP])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE))/(c1o1+q) - c1o216 * drho; } q = q_dirBNE[k]; @@ -3009,7 +5029,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_MMP])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW))/(c1o1+q) - c1o216 * drho; } q = q_dirTSW[k]; @@ -3028,7 +5048,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_PPM])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE))/(c1o1+q) - c1o216 * drho; } q = q_dirTSE[k]; @@ -3047,7 +5067,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_MPM])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW))/(c1o1+q) - c1o216 * drho; } q = q_dirBNW[k]; @@ -3066,7 +5086,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_PMP])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE))/(c1o1+q) - c1o216 * drho; } q = q_dirBSE[k]; @@ -3085,7 +5105,7 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_MPP])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW))/(c1o1+q) - c1o216 * drho; } q = q_dirTNW[k]; @@ -3104,53 +5124,8 @@ extern "C" __global__ void QSlipNormDeviceComp27(real* DD, //tangential = (tangential > one) ? one:tangential; q = (q + qSlip)/(c1o1 + qSlip * (c1o1 - tangential) / (smallSingle + q)); feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE))/(c1o1+q) - c1o216 * drho; + (D.f[DIR_PMM])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE))/(c1o1+q) - c1o216 * drho; } } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - diff --git a/src/gpu/VirtualFluids_GPU/GPU/StressBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/StressBCs27.cu new file mode 100644 index 0000000000000000000000000000000000000000..74e2faa38638228aa5d499aa74226405ab109f7d --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/StressBCs27.cu @@ -0,0 +1,2435 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file StressBcs27.cu +//! \author Henrik Asmuth +//! \date 16/05/2022 +//! \brief Kernels for StressBC using the iMEM approach +//! +//! Both kernels prescribe a wall shear stress using the iMEM apprach (see, Asmuth et. al (2021), https://doi.org/10.1063/5.0065701) +//! QStressDeviceComp27 couples the iMEM to the single-node interpolated bounce-back. +//! BBStressDevice27 couples the iMEM to a simple bounce-back. +//! Note, that the iMEM function is currently only implemented for straight walls with z-normal and q=0.5. +//! Other wall models could be implemented in the iMEM by replacing the formulations from Monin-Obukhov similarity theory (MOST) +//! with other formulations, e.g., for smooth walls. +//! iMEM so far most extensively tested with BBStressDevice27, but QStressDeviceComp27 also seems to be stable and working. +//======================================================================================= + +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" +#include <lbm/constants/NumericConstants.h> +#include "KernelUtilities.h" + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + +////////////////////////////////////////////////////////////////////////////// +__host__ __device__ __forceinline__ void iMEM(uint k, uint kN, + real* _wallNormalX, real* _wallNormalY, real* _wallNormalZ, + real* vx, real* vy, real* vz, + real* vx_el, real* vy_el, real* vz_el, //!>mean (temporally filtered) velocities at exchange location + real* vx_w_mean, real* vy_w_mean, real* vz_w_mean, //!>mean (temporally filtered) velocities at wall-adjactent node + real vx_w_inst, real vy_w_inst, real vz_w_inst, //!>instantaneous velocities at wall-adjactent node + real rho, + int* samplingOffset, + real q, + real forceFactor, //!>e.g., 1.0 for simple-bounce back, or (1+q) for interpolated single-node bounce-back as in Geier et al (2015) + real eps, //!>filter constant in temporal averaging + real* z0, //!>aerodynamic roughness length + bool hasWallModelMonitor, + real* u_star_monitor, + real wallMomentumX, real wallMomentumY, real wallMomentumZ, + real& wallVelocityX, real& wallVelocityY, real&wallVelocityZ) +{ + real wallNormalX = _wallNormalX[k]; + real wallNormalY = _wallNormalY[k]; + real wallNormalZ = _wallNormalZ[k]; + + //Sample velocity at exchange location and filter temporally + real _vx_el = eps*vx[kN]+(1.0-eps)*vx_el[k]; + real _vy_el = eps*vy[kN]+(1.0-eps)*vy_el[k]; + real _vz_el = eps*vz[kN]+(1.0-eps)*vz_el[k]; + vx_el[k] = _vx_el; + vy_el[k] = _vy_el; + vz_el[k] = _vz_el; + + //filter velocity at wall-adjacent node + real _vx_w_mean = eps*vx_w_inst+(1.0-eps)*vx_w_mean[k]; + real _vy_w_mean = eps*vy_w_inst+(1.0-eps)*vy_w_mean[k]; + real _vz_w_mean = eps*vz_w_inst+(1.0-eps)*vz_w_mean[k]; + vx_w_mean[k] = _vx_w_mean; + vy_w_mean[k] = _vy_w_mean; + vz_w_mean[k] = _vz_w_mean; + + //Subtract wall-normal velocity components + real vDotN_el = _vx_el*wallNormalX + _vy_el*wallNormalY + _vz_el*wallNormalZ; + _vx_el -= vDotN_el*wallNormalX; + _vy_el -= vDotN_el*wallNormalY; + _vz_el -= vDotN_el*wallNormalZ; + real vMag_el = sqrt( _vx_el*_vx_el + _vy_el*_vy_el + _vz_el*_vz_el ); + + real vDotN_w_mean = _vx_w_mean*wallNormalX + _vy_w_mean*wallNormalY + _vz_w_mean*wallNormalZ; + _vx_w_mean -= vDotN_w_mean*wallNormalX; + _vy_w_mean -= vDotN_w_mean*wallNormalY; + _vz_w_mean -= vDotN_w_mean*wallNormalZ; + real vMag_w_mean = sqrt( _vx_w_mean*_vx_w_mean + _vy_w_mean*_vy_w_mean + _vz_w_mean*_vz_w_mean ); + + real vDotN_w = vx_w_inst*wallNormalX + vy_w_inst*wallNormalY + vz_w_inst*wallNormalZ; + real _vx_w = vx_w_inst-vDotN_w*wallNormalX; + real _vy_w = vy_w_inst-vDotN_w*wallNormalY; + real _vz_w = vz_w_inst-vDotN_w*wallNormalZ; + + //Compute wall shear stress tau_w via MOST + real z = (real)samplingOffset[k] + 0.5; //assuming q=0.5, could be replaced by wall distance via wall normal + real kappa = 0.4; + real u_star = vMag_el*kappa/(log(z/z0[k])); + if(hasWallModelMonitor) u_star_monitor[k] = u_star; + real tau_w = u_star*u_star; //Note: this is actually tau_w/rho + real A = 1.0; //wall area (obviously 1 for grid aligned walls, can come from grid builder later for complex geometries) + + //Scale wall shear stress with near wall velocity, i.e., Schumann-Grötzbach (SG) approach + real F_w_x = (tau_w*A) * (_vx_w/vMag_w_mean);//(_vx_el/vMag_el) + real F_w_y = (tau_w*A) * (_vy_w/vMag_w_mean);//(_vy_el/vMag_el) + real F_w_z = (tau_w*A) * (_vz_w/vMag_w_mean);//(_vz_el/vMag_el) + // ^^^^^^^^^^^^--- old alternative: do not scale SG-like but only set direction via velocity at exchange location + + //Momentum to be applied via wall velocity + real wallMomDotN = wallMomentumX*wallNormalX+wallMomentumY*wallNormalY+wallMomentumZ*wallNormalZ; + real F_x = F_w_x - ( wallMomentumX - wallMomDotN*wallNormalX )/rho; + real F_y = F_w_y - ( wallMomentumY - wallMomDotN*wallNormalY )/rho; + real F_z = F_w_z - ( wallMomentumZ - wallMomDotN*wallNormalZ )/rho; + + //Compute wall velocity and clip (clipping only necessary for initial boundary layer development) + real clipWallVelo = 2.0; + real clipVx = clipWallVelo*_vx_el; + real clipVy = clipWallVelo*_vy_el; + real clipVz = clipWallVelo*_vz_el; + + wallVelocityX = clipVx > -clipVx? min(clipVx, max(-clipVx, -3.0*F_x*forceFactor)): max(clipVx, min(-clipVx, -3.0*F_x*forceFactor)); + wallVelocityY = clipVy > -clipVy? min(clipVy, max(-clipVy, -3.0*F_y*forceFactor)): max(clipVy, min(-clipVy, -3.0*F_y*forceFactor)); + wallVelocityZ = clipVz > -clipVz? min(clipVz, max(-clipVz, -3.0*F_z*forceFactor)): max(clipVz, min(-clipVz, -3.0*F_z*forceFactor)); +} + +////////////////////////////////////////////////////////////////////////////// +__global__ void QStressDeviceComp27(real* DD, + int* k_Q, + int* k_N, + real* QQ, + unsigned int numberOfBCnodes, + real om1, + real* turbViscosity, + real* vx, + real* vy, + real* vz, + real* normalX, + real* normalY, + real* normalZ, + real* vx_el, + real* vy_el, + real* vz_el, + real* vx_w_mean, + real* vy_w_mean, + real* vz_w_mean, + int* samplingOffset, + real* z0, + bool hasWallModelMonitor, + real* u_star_monitor, + real* Fx_monitor, + real* Fy_monitor, + real* Fz_monitor, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + + Distributions27 D; + if (isEvenTimestep==true)//get right array of post coll f's + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k< numberOfBCnodes/*numberOfBCnodes*/) + { + //////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, + *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + *q_dirBSE, *q_dirBNW; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero= KQK; //get right adress of post-coll f's + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// + real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, + f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; + + f_W = (D.f[DIR_P00 ])[ke ]; //post-coll f's + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; + + //////////////////////////////////////////////////////////////////////////////// + real vx1, vx2, vx3, drho, feq, q; + drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); + + vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) / (c1o1 + drho); + + + vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) / (c1o1 + drho); + + vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) / (c1o1 + drho); + + real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); + + real om_turb = om1 / (c1o1 + c3o1*om1*max(c0o1, turbViscosity[k_Q[k]])); + ////////////////////////////////////////////////////////////////////////// + if (isEvenTimestep==false) //get adress where incoming f's should be written to + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Compute incoming f's with zero wall velocity + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + // incoming f's from bounce back + real f_E_in = 0.0, f_W_in = 0.0, f_N_in = 0.0, f_S_in = 0.0, f_T_in = 0.0, f_B_in = 0.0, f_NE_in = 0.0, f_SW_in = 0.0, f_SE_in = 0.0, f_NW_in = 0.0, f_TE_in = 0.0, f_BW_in = 0.0, f_BE_in = 0.0, f_TW_in = 0.0, f_TN_in = 0.0, f_BS_in = 0.0, f_BN_in = 0.0, f_TS_in = 0.0, f_TNE_in = 0.0, f_TSW_in = 0.0, f_TSE_in = 0.0, f_TNW_in = 0.0, f_BNE_in = 0.0, f_BSW_in = 0.0, f_BSE_in = 0.0, f_BNW_in = 0.0; + // momentum exchanged with wall at rest + real wallMomentumX = 0.0, wallMomentumY = 0.0, wallMomentumZ = 0.0; + real velocityLB = 0.0; + + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + f_W_in = getInterpolatedDistributionForNoSlipBC(q, f_E, f_W, feq, om_turb); + wallMomentumX += f_E+f_W_in; + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + f_E_in = getInterpolatedDistributionForNoSlipBC(q, f_W, f_E, feq, om_turb); + wallMomentumX -= f_W+f_E_in; + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + f_S_in = getInterpolatedDistributionForNoSlipBC(q, f_N, f_S, feq, om_turb); + wallMomentumY += f_N+f_S_in; + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + f_N_in = getInterpolatedDistributionForNoSlipBC(q, f_S, f_N, feq, om_turb); + wallMomentumY -= f_S+f_N_in; + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + f_B_in = getInterpolatedDistributionForNoSlipBC(q, f_T, f_B, feq, om_turb); + wallMomentumZ += f_T+f_B_in; + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + f_T_in = getInterpolatedDistributionForNoSlipBC(q, f_B, f_T, feq, om_turb); + wallMomentumZ -= f_B+f_T_in; + } + + q = q_dirNE[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_SW_in = getInterpolatedDistributionForNoSlipBC(q, f_NE, f_SW, feq, om_turb); + wallMomentumX += f_NE+f_SW_in; + wallMomentumY += f_NE+f_SW_in; + } + + q = q_dirSW[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_NE_in = getInterpolatedDistributionForNoSlipBC(q, f_SW, f_NE, feq, om_turb); + wallMomentumX -= f_SW+f_NE_in; + wallMomentumY -= f_SW+f_NE_in; + } + + q = q_dirSE[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_NW_in = getInterpolatedDistributionForNoSlipBC(q, f_SE, f_NW, feq, om_turb); + wallMomentumX += f_SE+f_NW_in; + wallMomentumY -= f_SE+f_NW_in; + } + + q = q_dirNW[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_SE_in = getInterpolatedDistributionForNoSlipBC(q, f_NW, f_SE, feq, om_turb); + wallMomentumX -= f_NW+f_SE_in; + wallMomentumY += f_NW+f_SE_in; + } + + q = q_dirTE[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_BW_in = getInterpolatedDistributionForNoSlipBC(q, f_TE, f_BW, feq, om_turb); + wallMomentumX += f_TE+f_BW_in; + wallMomentumZ += f_TE+f_BW_in; + } + + q = q_dirBW[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_TE_in = getInterpolatedDistributionForNoSlipBC(q, f_BW, f_TE, feq, om_turb); + wallMomentumX -= f_BW+f_TE_in; + wallMomentumZ -= f_BW+f_TE_in; + } + + q = q_dirBE[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_TW_in = getInterpolatedDistributionForNoSlipBC(q, f_BE, f_TW, feq, om_turb); + wallMomentumX += f_BE+f_TW_in; + wallMomentumZ -= f_BE+f_TW_in; + } + + q = q_dirTW[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_BE_in = getInterpolatedDistributionForNoSlipBC(q, f_TW, f_BE, feq, om_turb); + wallMomentumX -= f_TW+f_BE_in; + wallMomentumZ += f_TW+f_BE_in; + } + + q = q_dirTN[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_BS_in = getInterpolatedDistributionForNoSlipBC(q, f_TN, f_BS, feq, om_turb); + wallMomentumY += f_TN+f_BS_in; + wallMomentumZ += f_TN+f_BS_in; + } + + q = q_dirBS[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_TN_in = getInterpolatedDistributionForNoSlipBC(q, f_BS, f_TN, feq, om_turb); + wallMomentumY -= f_BS+f_TN_in; + wallMomentumZ -= f_BS+f_TN_in; + } + + q = q_dirBN[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_TS_in = getInterpolatedDistributionForNoSlipBC(q, f_BN, f_TS, feq, om_turb); + wallMomentumY += f_BN+f_TS_in; + wallMomentumZ -= f_BN+f_TS_in; + } + + q = q_dirTS[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + f_BN_in = getInterpolatedDistributionForNoSlipBC(q, f_TS, f_BN, feq, om_turb); + wallMomentumY -= f_TS+f_BN_in; + wallMomentumZ += f_TS+f_BN_in; + } + + q = q_dirTNE[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + f_BSW_in = getInterpolatedDistributionForNoSlipBC(q, f_TNE, f_BSW, feq, om_turb); + wallMomentumX += f_TNE+f_BSW_in; + wallMomentumY += f_TNE+f_BSW_in; + wallMomentumZ += f_TNE+f_BSW_in; + } + + q = q_dirBSW[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + f_TNE_in = getInterpolatedDistributionForNoSlipBC(q, f_BSW, f_TNE, feq, om_turb); + wallMomentumX -= f_BSW+f_TNE_in; + wallMomentumY -= f_BSW+f_TNE_in; + wallMomentumZ -= f_BSW+f_TNE_in; + } + + q = q_dirBNE[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + f_TSW_in = getInterpolatedDistributionForNoSlipBC(q, f_BNE, f_TSW, feq, om_turb); + wallMomentumX += f_BNE+f_TSW_in; + wallMomentumY += f_BNE+f_TSW_in; + wallMomentumZ -= f_BNE+f_TSW_in; + } + + q = q_dirTSW[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + f_BNE_in = getInterpolatedDistributionForNoSlipBC(q, f_TSW, f_BNE, feq, om_turb); + wallMomentumX -= f_TSW+f_BNE_in; + wallMomentumY -= f_TSW+f_BNE_in; + wallMomentumZ += f_TSW+f_BNE_in; + } + + q = q_dirTSE[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + f_BNW_in = getInterpolatedDistributionForNoSlipBC(q, f_TSE, f_BNW, feq, om_turb); + wallMomentumX += f_TSE+f_BNW_in; + wallMomentumY -= f_TSE+f_BNW_in; + wallMomentumZ += f_TSE+f_BNW_in; + } + + q = q_dirBNW[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + f_TSE_in = getInterpolatedDistributionForNoSlipBC(q, f_BNW, f_TSE, feq, om_turb); + wallMomentumX -= f_BNW+f_TSE_in; + wallMomentumY += f_BNW+f_TSE_in; + wallMomentumZ -= f_BNW+f_TSE_in; + } + + q = q_dirBSE[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + f_TNW_in = getInterpolatedDistributionForNoSlipBC(q, f_BSE, f_TNW, feq, om_turb); + wallMomentumX += f_BSE+f_TNW_in; + wallMomentumY -= f_BSE+f_TNW_in; + wallMomentumZ -= f_BSE+f_TNW_in; + } + + q = q_dirTNW[k]; + if (q>=c0o1 && q<=c1o1) + { + velocityLB = -vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + f_BSE_in = getInterpolatedDistributionForNoSlipBC(q, f_TNW, f_BSE, feq, om_turb); + wallMomentumX -= f_TNW+f_BSE_in; + wallMomentumY += f_TNW+f_BSE_in; + wallMomentumZ += f_TNW+f_BSE_in; + } + + // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // //Compute wall velocity + // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real VeloX=0.0, VeloY=0.0, VeloZ=0.0; + + q = 0.5f; + real eps = 0.001f; + + iMEM( k, k_N[k], + normalX, normalY, normalZ, + vx, vy, vz, + vx_el, vy_el, vz_el, + vx_w_mean, vy_w_mean, vz_w_mean, + vx1, vx2, vx3, + c1o1+drho, + samplingOffset, + q, + 1.0+q, + eps, + z0, + hasWallModelMonitor, + u_star_monitor, + wallMomentumX, wallMomentumY, wallMomentumZ, + VeloX, VeloY, VeloZ); + + // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // //Add wall velocity and write f's + // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_M00])[kw] = f_W_in - (c6o1*c2o27*( VeloX ))/(c1o1+q); + wallMomentumX += -(c6o1*c2o27*( VeloX ))/(c1o1+q); + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_P00])[ke] = f_E_in - (c6o1*c2o27*(-VeloX ))/(c1o1+q); + wallMomentumX -= - (c6o1*c2o27*(-VeloX ))/(c1o1+q); + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0M0])[ks] = f_S_in - (c6o1*c2o27*( VeloY ))/(c1o1+q); + wallMomentumY += - (c6o1*c2o27*( VeloY ))/(c1o1+q); + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0P0])[kn] = f_N_in - (c6o1*c2o27*(-VeloY ))/(c1o1+q); + wallMomentumY -= -(c6o1*c2o27*(-VeloY ))/(c1o1+q); + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_00M])[kb] = f_B_in - (c6o1*c2o27*( VeloZ ))/(c1o1+q); + wallMomentumZ += - (c6o1*c2o27*( VeloZ ))/(c1o1+q); + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_00P])[kt] = f_T_in - (c6o1*c2o27*(-VeloZ ))/(c1o1+q); + wallMomentumZ -= -(c6o1*c2o27*(-VeloZ ))/(c1o1+q); + } + + q = q_dirNE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MM0])[ksw] = f_SW_in - (c6o1*c1o54*(VeloX+VeloY))/(c1o1+q); + wallMomentumX += -(c6o1*c1o54*(VeloX+VeloY))/(c1o1+q); + wallMomentumY += -(c6o1*c1o54*(VeloX+VeloY))/(c1o1+q); + } + + q = q_dirSW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PP0])[kne] = f_NE_in - (c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q); + wallMomentumX -= - (c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q); + wallMomentumY -= - (c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q); + } + + q = q_dirSE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MP0])[knw] = f_NW_in - (c6o1*c1o54*( VeloX-VeloY))/(c1o1+q); + wallMomentumX += -(c6o1*c1o54*( VeloX-VeloY))/(c1o1+q); + wallMomentumY -= -(c6o1*c1o54*( VeloX-VeloY))/(c1o1+q); + } + + q = q_dirNW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PM0])[kse] = f_SE_in - (c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q); + wallMomentumX -= - (c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q); + wallMomentumY += - (c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q); + } + + q = q_dirTE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_M0M])[kbw] = f_BW_in - (c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q); + wallMomentumX += - (c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q); + wallMomentumZ += - (c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q); + } + + q = q_dirBW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_P0P])[kte] = f_TE_in - (c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q); + wallMomentumX -= - (c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q); + wallMomentumZ -= - (c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q); + } + + q = q_dirBE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_M0P])[ktw] = f_TW_in - (c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q); + wallMomentumX += - (c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q); + wallMomentumZ -= - (c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q); + } + + q = q_dirTW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_P0M])[kbe] = f_BE_in - (c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q); + wallMomentumX -= - (c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q); + wallMomentumZ += - (c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q); + } + + q = q_dirTN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0MM])[kbs] = f_BS_in - (c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q); + wallMomentumY += - (c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q); + wallMomentumZ += - (c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q); + } + + q = q_dirBS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0PP])[ktn] = f_TN_in - (c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q); + wallMomentumY -= - (c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q); + wallMomentumZ -= - (c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q); + } + + q = q_dirBN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0MP])[kts] = f_TS_in - (c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q); + wallMomentumY += - (c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q); + wallMomentumZ -= - (c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q); + } + + q = q_dirTS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0PM])[kbn] = f_BN_in - (c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q); + wallMomentumY -= - (c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q); + wallMomentumZ += - (c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q); + } + + q = q_dirTNE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MMM])[kbsw] = f_BSW_in - (c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q); + wallMomentumX += - (c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q); + wallMomentumY += - (c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q); + wallMomentumZ += - (c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q); + } + + q = q_dirBSW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PPP])[ktne] = f_TNE_in - (c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q); + wallMomentumX -= - (c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q); + wallMomentumY -= - (c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q); + wallMomentumZ -= - (c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q); + } + + q = q_dirBNE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MMP])[ktsw] = f_TSW_in - (c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q); + wallMomentumX += - (c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q); + wallMomentumY += - (c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q); + wallMomentumZ -= - (c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q); + } + + q = q_dirTSW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PPM])[kbne] = f_BNE_in - (c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q); + wallMomentumX -= - (c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q); + wallMomentumY -= - (c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q); + wallMomentumZ += - (c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q); + } + + q = q_dirTSE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MPM])[kbnw] = f_BNW_in - (c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q); + wallMomentumX += - (c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q); + wallMomentumY -= - (c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q); + wallMomentumZ += - (c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q); + } + + q = q_dirBNW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PMP])[ktse] = f_TSE_in - (c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q); + wallMomentumX -= - (c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q); + wallMomentumY += - (c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q); + wallMomentumZ -= - (c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q); + } + + q = q_dirBSE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MPP])[ktnw] = f_TNW_in - (c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q); + wallMomentumX += - (c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q); + wallMomentumY -= - (c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q); + wallMomentumZ -= - (c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q); + } + + q = q_dirTNW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PMM])[kbse] = f_BSE_in - (c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q); + wallMomentumX -= - (c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q); + wallMomentumY += - (c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q); + wallMomentumZ += - (c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q); + } + + if(hasWallModelMonitor) + { + Fx_monitor[k] = wallMomentumX; + Fy_monitor[k] = wallMomentumY; + Fz_monitor[k] = wallMomentumZ; + } + + } +} + +////////////////////////////////////////////////////////////////////////////// +__global__ void BBStressDevice27( real* DD, + int* k_Q, + int* k_N, + real* QQ, + unsigned int numberOfBCnodes, + real* vx, + real* vy, + real* vz, + real* normalX, + real* normalY, + real* normalZ, + real* vx_el, + real* vy_el, + real* vz_el, + real* vx_w_mean, + real* vy_w_mean, + real* vz_w_mean, + int* samplingOffset, + real* z0, + bool hasWallModelMonitor, + real* u_star_monitor, + real* Fx_monitor, + real* Fy_monitor, + real* Fz_monitor, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k< numberOfBCnodes) + { + //////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, + *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + *q_dirBSE, *q_dirBNW; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + + //////////////////////////////////////////////////////////////////////////////// + real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, + f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; + + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; + + //////////////////////////////////////////////////////////////////////////////// + real vx1, vx2, vx3, drho; + drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); + + vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) / (c1o1 + drho); + + + vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) / (c1o1 + drho); + + vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) / (c1o1 + drho); + + ////////////////////////////////////////////////////////////////////////// + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real f_E_in, f_W_in, f_N_in, f_S_in, f_T_in, f_B_in, f_NE_in, f_SW_in, f_SE_in, f_NW_in, f_TE_in, f_BW_in, f_BE_in, + f_TW_in, f_TN_in, f_BS_in, f_BN_in, f_TS_in, f_TNE_in, f_TSW_in, f_TSE_in, f_TNW_in, f_BNE_in, f_BSW_in, f_BSE_in, f_BNW_in; + + // momentum exchanged with wall at rest + real wallMomentumX = 0.0, wallMomentumY = 0.0, wallMomentumZ = 0.0; + + real q; + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_W_in=f_E; + wallMomentumX += f_E+f_W_in; + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_E_in=f_W; + wallMomentumX -= f_W+f_E_in; + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + f_S_in=f_N; + wallMomentumY += f_N+f_S_in; + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + f_N_in=f_S; + wallMomentumY -= f_S+f_N_in; + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + f_B_in=f_T; + wallMomentumZ += f_T+f_B_in; + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + f_T_in=f_B; + wallMomentumZ -= f_B+f_T_in; + } + + q = q_dirNE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_SW_in=f_NE; + wallMomentumX += f_NE+f_SW_in; + wallMomentumY += f_NE+f_SW_in; + } + + q = q_dirSW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_NE_in=f_SW; + wallMomentumX -= f_SW+f_NE_in; + wallMomentumY -= f_SW+f_NE_in; + } + + q = q_dirSE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_NW_in=f_SE; + wallMomentumX += f_SE+f_NW_in; + wallMomentumY -= f_SE+f_NW_in; + } + + q = q_dirNW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_SE_in=f_NW; + wallMomentumX -= f_NW+f_SE_in; + wallMomentumY += f_NW+f_SE_in; + } + + q = q_dirTE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BW_in=f_TE; + wallMomentumX += f_TE+f_BW_in; + wallMomentumZ += f_TE+f_BW_in; + } + + q = q_dirBW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TE_in=f_BW; + wallMomentumX -= f_BW+f_TE_in; + wallMomentumZ -= f_BW+f_TE_in; + } + + q = q_dirBE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TW_in=f_BE; + wallMomentumX += f_BE+f_TW_in; + wallMomentumZ -= f_BE+f_TW_in; + } + + q = q_dirTW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BE_in=f_TW; + wallMomentumX -= f_TW+f_BE_in; + wallMomentumZ += f_TW+f_BE_in; + } + + q = q_dirTN[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BS_in=f_TN; + wallMomentumY += f_TN+f_BS_in; + wallMomentumZ += f_TN+f_BS_in; + } + + q = q_dirBS[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TN_in=f_BS; + wallMomentumY -= f_BS+f_TN_in; + wallMomentumZ -= f_BS+f_TN_in; + } + + q = q_dirBN[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TS_in=f_BN; + wallMomentumY += f_BN+f_TS_in; + wallMomentumZ -= f_BN+f_TS_in; + } + + q = q_dirTS[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BN_in=f_TS; + wallMomentumY -= f_TS+f_BN_in; + wallMomentumZ += f_TS+f_BN_in; + } + + q = q_dirTNE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BSW_in=f_TNE; + wallMomentumX += f_TNE+f_BSW_in; + wallMomentumY += f_TNE+f_BSW_in; + wallMomentumZ += f_TNE+f_BSW_in; + } + + q = q_dirBSW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TNE_in=f_BSW; + wallMomentumX -= f_BSW+f_TNE_in; + wallMomentumY -= f_BSW+f_TNE_in; + wallMomentumZ -= f_BSW+f_TNE_in; + } + + q = q_dirBNE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TSW_in=f_BNE; + wallMomentumX += f_BNE+f_TSW_in; + wallMomentumY += f_BNE+f_TSW_in; + wallMomentumZ -= f_BNE+f_TSW_in; + } + + q = q_dirTSW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BNE_in=f_TSW; + wallMomentumX -= f_TSW+f_BNE_in; + wallMomentumY -= f_TSW+f_BNE_in; + wallMomentumZ += f_TSW+f_BNE_in; + } + + q = q_dirTSE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BNW_in=f_TSE; + wallMomentumX += f_TSE+f_BNW_in; + wallMomentumY -= f_TSE+f_BNW_in; + wallMomentumZ += f_TSE+f_BNW_in; + } + + q = q_dirBNW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TSE_in=f_BNW; + wallMomentumX -= f_BNW+f_TSE_in; + wallMomentumY += f_BNW+f_TSE_in; + wallMomentumZ -= f_BNW+f_TSE_in; + } + + q = q_dirBSE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TNW_in=f_BSE; + wallMomentumX += f_BSE+f_TNW_in; + wallMomentumY -= f_BSE+f_TNW_in; + wallMomentumZ -= f_BSE+f_TNW_in; + } + + q = q_dirTNW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BSE_in=f_TNW; + wallMomentumX -= f_TNW+f_BSE_in; + wallMomentumY += f_TNW+f_BSE_in; + wallMomentumZ += f_TNW+f_BSE_in; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // //Compute wall velocity + // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real VeloX=0.0, VeloY=0.0, VeloZ=0.0; + + q = 0.5f; + real eps = 0.001f; + + iMEM( k, k_N[k], + normalX, normalY, normalZ, + vx, vy, vz, + vx_el, vy_el, vz_el, + vx_w_mean, vy_w_mean, vz_w_mean, + vx1, vx2, vx3, + c1o1+drho, + samplingOffset, + q, + 1.0, + eps, + z0, + hasWallModelMonitor, + u_star_monitor, + wallMomentumX, wallMomentumY, wallMomentumZ, + VeloX, VeloY, VeloZ); + + // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // //Add wall velocity and write f's + // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_M00])[kw] = f_W_in - (c6o1*c2o27*( VeloX )); + wallMomentumX += -(c6o1*c2o27*( VeloX )); + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_P00])[ke] = f_E_in - (c6o1*c2o27*(-VeloX )); + wallMomentumX -= - (c6o1*c2o27*(-VeloX )); + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0M0])[ks] = f_S_in - (c6o1*c2o27*( VeloY )); + wallMomentumY += - (c6o1*c2o27*( VeloY )); + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0P0])[kn] = f_N_in - (c6o1*c2o27*(-VeloY )); + wallMomentumY -= -(c6o1*c2o27*(-VeloY )); + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_00M])[kb] = f_B_in - (c6o1*c2o27*( VeloZ )); + wallMomentumZ += - (c6o1*c2o27*( VeloZ )); + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_00P])[kt] = f_T_in - (c6o1*c2o27*(-VeloZ )); + wallMomentumZ -= -(c6o1*c2o27*(-VeloZ )); + } + + q = q_dirNE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MM0])[ksw] = f_SW_in - (c6o1*c1o54*(VeloX+VeloY)); + wallMomentumX += -(c6o1*c1o54*(VeloX+VeloY)); + wallMomentumY += -(c6o1*c1o54*(VeloX+VeloY)); + } + + q = q_dirSW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PP0])[kne] = f_NE_in - (c6o1*c1o54*(-VeloX-VeloY)); + wallMomentumX -= - (c6o1*c1o54*(-VeloX-VeloY)); + wallMomentumY -= - (c6o1*c1o54*(-VeloX-VeloY)); + } + + q = q_dirSE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MP0])[knw] = f_NW_in - (c6o1*c1o54*( VeloX-VeloY)); + wallMomentumX += -(c6o1*c1o54*( VeloX-VeloY)); + wallMomentumY -= -(c6o1*c1o54*( VeloX-VeloY)); + } + + q = q_dirNW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PM0])[kse] = f_SE_in - (c6o1*c1o54*(-VeloX+VeloY)); + wallMomentumX -= - (c6o1*c1o54*(-VeloX+VeloY)); + wallMomentumY += - (c6o1*c1o54*(-VeloX+VeloY)); + } + + q = q_dirTE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_M0M])[kbw] = f_BW_in - (c6o1*c1o54*( VeloX+VeloZ)); + wallMomentumX += - (c6o1*c1o54*( VeloX+VeloZ)); + wallMomentumZ += - (c6o1*c1o54*( VeloX+VeloZ)); + } + + q = q_dirBW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_P0P])[kte] = f_TE_in - (c6o1*c1o54*(-VeloX-VeloZ)); + wallMomentumX -= - (c6o1*c1o54*(-VeloX-VeloZ)); + wallMomentumZ -= - (c6o1*c1o54*(-VeloX-VeloZ)); + } + + q = q_dirBE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_M0P])[ktw] = f_TW_in - (c6o1*c1o54*( VeloX-VeloZ)); + wallMomentumX += - (c6o1*c1o54*( VeloX-VeloZ)); + wallMomentumZ -= - (c6o1*c1o54*( VeloX-VeloZ)); + } + + q = q_dirTW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_P0M])[kbe] = f_BE_in - (c6o1*c1o54*(-VeloX+VeloZ)); + wallMomentumX -= - (c6o1*c1o54*(-VeloX+VeloZ)); + wallMomentumZ += - (c6o1*c1o54*(-VeloX+VeloZ)); + } + + q = q_dirTN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0MM])[kbs] = f_BS_in - (c6o1*c1o54*( VeloY+VeloZ)); + wallMomentumY += - (c6o1*c1o54*( VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o54*( VeloY+VeloZ)); + } + + q = q_dirBS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0PP])[ktn] = f_TN_in - (c6o1*c1o54*( -VeloY-VeloZ)); + wallMomentumY -= - (c6o1*c1o54*( -VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o54*( -VeloY-VeloZ)); + } + + q = q_dirBN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0MP])[kts] = f_TS_in - (c6o1*c1o54*( VeloY-VeloZ)); + wallMomentumY += - (c6o1*c1o54*( VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o54*( VeloY-VeloZ)); + } + + q = q_dirTS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0PM])[kbn] = f_BN_in - (c6o1*c1o54*( -VeloY+VeloZ)); + wallMomentumY -= - (c6o1*c1o54*( -VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o54*( -VeloY+VeloZ)); + } + + q = q_dirTNE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MMM])[kbsw] = f_BSW_in - (c6o1*c1o216*( VeloX+VeloY+VeloZ)); + wallMomentumX += - (c6o1*c1o216*( VeloX+VeloY+VeloZ)); + wallMomentumY += - (c6o1*c1o216*( VeloX+VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o216*( VeloX+VeloY+VeloZ)); + } + + q = q_dirBSW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PPP])[ktne] = f_TNE_in - (c6o1*c1o216*(-VeloX-VeloY-VeloZ)); + wallMomentumX -= - (c6o1*c1o216*(-VeloX-VeloY-VeloZ)); + wallMomentumY -= - (c6o1*c1o216*(-VeloX-VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o216*(-VeloX-VeloY-VeloZ)); + } + + q = q_dirBNE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MMP])[ktsw] = f_TSW_in - (c6o1*c1o216*( VeloX+VeloY-VeloZ)); + wallMomentumX += - (c6o1*c1o216*( VeloX+VeloY-VeloZ)); + wallMomentumY += - (c6o1*c1o216*( VeloX+VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o216*( VeloX+VeloY-VeloZ)); + } + + q = q_dirTSW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PPM])[kbne] = f_BNE_in - (c6o1*c1o216*(-VeloX-VeloY+VeloZ)); + wallMomentumX -= - (c6o1*c1o216*(-VeloX-VeloY+VeloZ)); + wallMomentumY -= - (c6o1*c1o216*(-VeloX-VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o216*(-VeloX-VeloY+VeloZ)); + } + + q = q_dirTSE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MPM])[kbnw] = f_BNW_in - (c6o1*c1o216*( VeloX-VeloY+VeloZ)); + wallMomentumX += - (c6o1*c1o216*( VeloX-VeloY+VeloZ)); + wallMomentumY -= - (c6o1*c1o216*( VeloX-VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o216*( VeloX-VeloY+VeloZ)); + } + + q = q_dirBNW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PMP])[ktse] = f_TSE_in - (c6o1*c1o216*(-VeloX+VeloY-VeloZ)); + wallMomentumX -= - (c6o1*c1o216*(-VeloX+VeloY-VeloZ)); + wallMomentumY += - (c6o1*c1o216*(-VeloX+VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o216*(-VeloX+VeloY-VeloZ)); + } + + q = q_dirBSE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MPP])[ktnw] = f_TNW_in - (c6o1*c1o216*( VeloX-VeloY-VeloZ)); + wallMomentumX += - (c6o1*c1o216*( VeloX-VeloY-VeloZ)); + wallMomentumY -= - (c6o1*c1o216*( VeloX-VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o216*( VeloX-VeloY-VeloZ)); + } + + q = q_dirTNW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PMM])[kbse] = f_BSE_in - (c6o1*c1o216*(-VeloX+VeloY+VeloZ)); + wallMomentumX -= - (c6o1*c1o216*(-VeloX+VeloY+VeloZ)); + wallMomentumY += - (c6o1*c1o216*(-VeloX+VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o216*(-VeloX+VeloY+VeloZ)); + } + + if(hasWallModelMonitor) + { + Fx_monitor[k] = wallMomentumX; + Fy_monitor[k] = wallMomentumY; + Fz_monitor[k] = wallMomentumZ; + } + + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +__global__ void BBStressPressureDevice27( real* DD, + int* k_Q, + int* k_N, + real* QQ, + unsigned int numberOfBCnodes, + real* vx, + real* vy, + real* vz, + real* normalX, + real* normalY, + real* normalZ, + real* vx_el, + real* vy_el, + real* vz_el, + real* vx_w_mean, + real* vy_w_mean, + real* vz_w_mean, + int* samplingOffset, + real* z0, + bool hasWallModelMonitor, + real* u_star_monitor, + real* Fx_monitor, + real* Fy_monitor, + real* Fz_monitor, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + Distributions27 D; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + const unsigned x = threadIdx.x; // Globaler x-Index + const unsigned y = blockIdx.x; // Globaler y-Index + const unsigned z = blockIdx.y; // Globaler z-Index + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k = nx*(ny*z + y) + x; + ////////////////////////////////////////////////////////////////////////// + + if(k< numberOfBCnodes) + { + //////////////////////////////////////////////////////////////////////////////// + real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, + *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, + *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, + *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, + *q_dirBSE, *q_dirBNW; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; + //////////////////////////////////////////////////////////////////////////////// + //index + unsigned int KQK = k_Q[k]; + unsigned int kzero= KQK; + unsigned int ke = KQK; + unsigned int kw = neighborX[KQK]; + unsigned int kn = KQK; + unsigned int ks = neighborY[KQK]; + unsigned int kt = KQK; + unsigned int kb = neighborZ[KQK]; + unsigned int ksw = neighborY[kw]; + unsigned int kne = KQK; + unsigned int kse = ks; + unsigned int knw = kw; + unsigned int kbw = neighborZ[kw]; + unsigned int kte = KQK; + unsigned int kbe = kb; + unsigned int ktw = kw; + unsigned int kbs = neighborZ[ks]; + unsigned int ktn = KQK; + unsigned int kbn = kb; + unsigned int kts = ks; + unsigned int ktse = ks; + unsigned int kbnw = kbw; + unsigned int ktnw = kw; + unsigned int kbse = kbs; + unsigned int ktsw = ksw; + unsigned int kbne = kb; + unsigned int ktne = KQK; + unsigned int kbsw = neighborZ[ksw]; + + //////////////////////////////////////////////////////////////////////////////// + real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, + f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; + + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; + + //////////////////////////////////////////////////////////////////////////////// + real vx1, vx2, vx3, drho; + drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); + + vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) / (c1o1 + drho); + + + vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) / (c1o1 + drho); + + vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) / (c1o1 + drho); + + ////////////////////////////////////////////////////////////////////////// + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; + } + else + { + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real f_E_in, f_W_in, f_N_in, f_S_in, f_T_in, f_B_in, f_NE_in, f_SW_in, f_SE_in, f_NW_in, f_TE_in, f_BW_in, f_BE_in, + f_TW_in, f_TN_in, f_BS_in, f_BN_in, f_TS_in, f_TNE_in, f_TSW_in, f_TSE_in, f_TNW_in, f_BNE_in, f_BSW_in, f_BSE_in, f_BNW_in; + + // momentum exchanged with wall at rest + real wallMomentumX = 0.0, wallMomentumY = 0.0, wallMomentumZ = 0.0; + + real q; + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_W_in=f_E - c2o27 * drho; + wallMomentumX += f_E+f_W_in; + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_E_in=f_W - c2o27 * drho; + wallMomentumX -= f_W+f_E_in; + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + f_S_in=f_N - c2o27 * drho; + wallMomentumY += f_N+f_S_in; + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + f_N_in=f_S - c2o27 * drho; + wallMomentumY -= f_S+f_N_in; + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + f_B_in=f_T - c2o27 * drho; + wallMomentumZ += f_T+f_B_in; + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + f_T_in=f_B - c2o27 * drho; + wallMomentumZ -= f_B+f_T_in; + } + + q = q_dirNE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_SW_in=f_NE - c1o54 * drho; + wallMomentumX += f_NE+f_SW_in; + wallMomentumY += f_NE+f_SW_in; + } + + q = q_dirSW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_NE_in=f_SW - c1o54 * drho; + wallMomentumX -= f_SW+f_NE_in; + wallMomentumY -= f_SW+f_NE_in; + } + + q = q_dirSE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_NW_in=f_SE - c1o54 * drho; + wallMomentumX += f_SE+f_NW_in; + wallMomentumY -= f_SE+f_NW_in; + } + + q = q_dirNW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_SE_in=f_NW - c1o54 * drho; + wallMomentumX -= f_NW+f_SE_in; + wallMomentumY += f_NW+f_SE_in; + } + + q = q_dirTE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BW_in=f_TE - c1o54 * drho; + wallMomentumX += f_TE+f_BW_in; + wallMomentumZ += f_TE+f_BW_in; + } + + q = q_dirBW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TE_in=f_BW - c1o54 * drho; + wallMomentumX -= f_BW+f_TE_in; + wallMomentumZ -= f_BW+f_TE_in; + } + + q = q_dirBE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TW_in=f_BE - c1o54 * drho; + wallMomentumX += f_BE+f_TW_in; + wallMomentumZ -= f_BE+f_TW_in; + } + + q = q_dirTW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BE_in=f_TW - c1o54 * drho; + wallMomentumX -= f_TW+f_BE_in; + wallMomentumZ += f_TW+f_BE_in; + } + + q = q_dirTN[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BS_in=f_TN - c1o54 * drho; + wallMomentumY += f_TN+f_BS_in; + wallMomentumZ += f_TN+f_BS_in; + } + + q = q_dirBS[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TN_in=f_BS - c1o54 * drho; + wallMomentumY -= f_BS+f_TN_in; + wallMomentumZ -= f_BS+f_TN_in; + } + + q = q_dirBN[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TS_in=f_BN - c1o54 * drho; + wallMomentumY += f_BN+f_TS_in; + wallMomentumZ -= f_BN+f_TS_in; + } + + q = q_dirTS[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BN_in=f_TS - c1o54 * drho; + wallMomentumY -= f_TS+f_BN_in; + wallMomentumZ += f_TS+f_BN_in; + } + + q = q_dirTNE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BSW_in=f_TNE - c1o216 * drho; + wallMomentumX += f_TNE+f_BSW_in; + wallMomentumY += f_TNE+f_BSW_in; + wallMomentumZ += f_TNE+f_BSW_in; + } + + q = q_dirBSW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TNE_in=f_BSW - c1o216 * drho; + wallMomentumX -= f_BSW+f_TNE_in; + wallMomentumY -= f_BSW+f_TNE_in; + wallMomentumZ -= f_BSW+f_TNE_in; + } + + q = q_dirBNE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TSW_in=f_BNE - c1o216 * drho; + wallMomentumX += f_BNE+f_TSW_in; + wallMomentumY += f_BNE+f_TSW_in; + wallMomentumZ -= f_BNE+f_TSW_in; + } + + q = q_dirTSW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BNE_in=f_TSW - c1o216 * drho; + wallMomentumX -= f_TSW+f_BNE_in; + wallMomentumY -= f_TSW+f_BNE_in; + wallMomentumZ += f_TSW+f_BNE_in; + } + + q = q_dirTSE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BNW_in=f_TSE - c1o216 * drho; + wallMomentumX += f_TSE+f_BNW_in; + wallMomentumY -= f_TSE+f_BNW_in; + wallMomentumZ += f_TSE+f_BNW_in; + } + + q = q_dirBNW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TSE_in=f_BNW - c1o216 * drho; + wallMomentumX -= f_BNW+f_TSE_in; + wallMomentumY += f_BNW+f_TSE_in; + wallMomentumZ -= f_BNW+f_TSE_in; + } + + q = q_dirBSE[k]; + if (q>=c0o1 && q<=c1o1) + { + f_TNW_in=f_BSE - c1o216 * drho; + wallMomentumX += f_BSE+f_TNW_in; + wallMomentumY -= f_BSE+f_TNW_in; + wallMomentumZ -= f_BSE+f_TNW_in; + } + + q = q_dirTNW[k]; + if (q>=c0o1 && q<=c1o1) + { + f_BSE_in=f_TNW - c1o216 * drho; + wallMomentumX -= f_TNW+f_BSE_in; + wallMomentumY += f_TNW+f_BSE_in; + wallMomentumZ += f_TNW+f_BSE_in; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // //Compute wall velocity + // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real VeloX=0.0, VeloY=0.0, VeloZ=0.0; + + q = 0.5f; + real eps = 0.001f; + + iMEM( k, k_N[k], + normalX, normalY, normalZ, + vx, vy, vz, + vx_el, vy_el, vz_el, + vx_w_mean, vy_w_mean, vz_w_mean, + vx1, vx2, vx3, + c1o1+drho, + samplingOffset, + q, + 1.0, + eps, + z0, + hasWallModelMonitor, + u_star_monitor, + wallMomentumX, wallMomentumY, wallMomentumZ, + VeloX, VeloY, VeloZ); + + // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // //Add wall velocity and write f's + // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + q = q_dirE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_M00])[kw] = f_W_in - (c6o1*c2o27*( VeloX )); + wallMomentumX += -(c6o1*c2o27*( VeloX )); + } + + q = q_dirW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_P00])[ke] = f_E_in - (c6o1*c2o27*(-VeloX )); + wallMomentumX -= - (c6o1*c2o27*(-VeloX )); + } + + q = q_dirN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0M0])[ks] = f_S_in - (c6o1*c2o27*( VeloY )); + wallMomentumY += - (c6o1*c2o27*( VeloY )); + } + + q = q_dirS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0P0])[kn] = f_N_in - (c6o1*c2o27*(-VeloY )); + wallMomentumY -= -(c6o1*c2o27*(-VeloY )); + } + + q = q_dirT[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_00M])[kb] = f_B_in - (c6o1*c2o27*( VeloZ )); + wallMomentumZ += - (c6o1*c2o27*( VeloZ )); + } + + q = q_dirB[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_00P])[kt] = f_T_in - (c6o1*c2o27*(-VeloZ )); + wallMomentumZ -= -(c6o1*c2o27*(-VeloZ )); + } + + q = q_dirNE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MM0])[ksw] = f_SW_in - (c6o1*c1o54*(VeloX+VeloY)); + wallMomentumX += -(c6o1*c1o54*(VeloX+VeloY)); + wallMomentumY += -(c6o1*c1o54*(VeloX+VeloY)); + } + + q = q_dirSW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PP0])[kne] = f_NE_in - (c6o1*c1o54*(-VeloX-VeloY)); + wallMomentumX -= - (c6o1*c1o54*(-VeloX-VeloY)); + wallMomentumY -= - (c6o1*c1o54*(-VeloX-VeloY)); + } + + q = q_dirSE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MP0])[knw] = f_NW_in - (c6o1*c1o54*( VeloX-VeloY)); + wallMomentumX += -(c6o1*c1o54*( VeloX-VeloY)); + wallMomentumY -= -(c6o1*c1o54*( VeloX-VeloY)); + } + + q = q_dirNW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PM0])[kse] = f_SE_in - (c6o1*c1o54*(-VeloX+VeloY)); + wallMomentumX -= - (c6o1*c1o54*(-VeloX+VeloY)); + wallMomentumY += - (c6o1*c1o54*(-VeloX+VeloY)); + } + + q = q_dirTE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_M0M])[kbw] = f_BW_in - (c6o1*c1o54*( VeloX+VeloZ)); + wallMomentumX += - (c6o1*c1o54*( VeloX+VeloZ)); + wallMomentumZ += - (c6o1*c1o54*( VeloX+VeloZ)); + } + + q = q_dirBW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_P0P])[kte] = f_TE_in - (c6o1*c1o54*(-VeloX-VeloZ)); + wallMomentumX -= - (c6o1*c1o54*(-VeloX-VeloZ)); + wallMomentumZ -= - (c6o1*c1o54*(-VeloX-VeloZ)); + } + + q = q_dirBE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_M0P])[ktw] = f_TW_in - (c6o1*c1o54*( VeloX-VeloZ)); + wallMomentumX += - (c6o1*c1o54*( VeloX-VeloZ)); + wallMomentumZ -= - (c6o1*c1o54*( VeloX-VeloZ)); + } + + q = q_dirTW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_P0M])[kbe] = f_BE_in - (c6o1*c1o54*(-VeloX+VeloZ)); + wallMomentumX -= - (c6o1*c1o54*(-VeloX+VeloZ)); + wallMomentumZ += - (c6o1*c1o54*(-VeloX+VeloZ)); + } + + q = q_dirTN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0MM])[kbs] = f_BS_in - (c6o1*c1o54*( VeloY+VeloZ)); + wallMomentumY += - (c6o1*c1o54*( VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o54*( VeloY+VeloZ)); + } + + q = q_dirBS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0PP])[ktn] = f_TN_in - (c6o1*c1o54*( -VeloY-VeloZ)); + wallMomentumY -= - (c6o1*c1o54*( -VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o54*( -VeloY-VeloZ)); + } + + q = q_dirBN[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0MP])[kts] = f_TS_in - (c6o1*c1o54*( VeloY-VeloZ)); + wallMomentumY += - (c6o1*c1o54*( VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o54*( VeloY-VeloZ)); + } + + q = q_dirTS[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_0PM])[kbn] = f_BN_in - (c6o1*c1o54*( -VeloY+VeloZ)); + wallMomentumY -= - (c6o1*c1o54*( -VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o54*( -VeloY+VeloZ)); + } + + q = q_dirTNE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MMM])[kbsw] = f_BSW_in - (c6o1*c1o216*( VeloX+VeloY+VeloZ)); + wallMomentumX += - (c6o1*c1o216*( VeloX+VeloY+VeloZ)); + wallMomentumY += - (c6o1*c1o216*( VeloX+VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o216*( VeloX+VeloY+VeloZ)); + } + + q = q_dirBSW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PPP])[ktne] = f_TNE_in - (c6o1*c1o216*(-VeloX-VeloY-VeloZ)); + wallMomentumX -= - (c6o1*c1o216*(-VeloX-VeloY-VeloZ)); + wallMomentumY -= - (c6o1*c1o216*(-VeloX-VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o216*(-VeloX-VeloY-VeloZ)); + } + + q = q_dirBNE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MMP])[ktsw] = f_TSW_in - (c6o1*c1o216*( VeloX+VeloY-VeloZ)); + wallMomentumX += - (c6o1*c1o216*( VeloX+VeloY-VeloZ)); + wallMomentumY += - (c6o1*c1o216*( VeloX+VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o216*( VeloX+VeloY-VeloZ)); + } + + q = q_dirTSW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PPM])[kbne] = f_BNE_in - (c6o1*c1o216*(-VeloX-VeloY+VeloZ)); + wallMomentumX -= - (c6o1*c1o216*(-VeloX-VeloY+VeloZ)); + wallMomentumY -= - (c6o1*c1o216*(-VeloX-VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o216*(-VeloX-VeloY+VeloZ)); + } + + q = q_dirTSE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MPM])[kbnw] = f_BNW_in - (c6o1*c1o216*( VeloX-VeloY+VeloZ)); + wallMomentumX += - (c6o1*c1o216*( VeloX-VeloY+VeloZ)); + wallMomentumY -= - (c6o1*c1o216*( VeloX-VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o216*( VeloX-VeloY+VeloZ)); + } + + q = q_dirBNW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PMP])[ktse] = f_TSE_in - (c6o1*c1o216*(-VeloX+VeloY-VeloZ)); + wallMomentumX -= - (c6o1*c1o216*(-VeloX+VeloY-VeloZ)); + wallMomentumY += - (c6o1*c1o216*(-VeloX+VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o216*(-VeloX+VeloY-VeloZ)); + } + + q = q_dirBSE[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_MPP])[ktnw] = f_TNW_in - (c6o1*c1o216*( VeloX-VeloY-VeloZ)); + wallMomentumX += - (c6o1*c1o216*( VeloX-VeloY-VeloZ)); + wallMomentumY -= - (c6o1*c1o216*( VeloX-VeloY-VeloZ)); + wallMomentumZ -= - (c6o1*c1o216*( VeloX-VeloY-VeloZ)); + } + + q = q_dirTNW[k]; + if (q>=c0o1 && q<=c1o1) + { + (D.f[DIR_PMM])[kbse] = f_BSE_in - (c6o1*c1o216*(-VeloX+VeloY+VeloZ)); + wallMomentumX -= - (c6o1*c1o216*(-VeloX+VeloY+VeloZ)); + wallMomentumY += - (c6o1*c1o216*(-VeloX+VeloY+VeloZ)); + wallMomentumZ += - (c6o1*c1o216*(-VeloX+VeloY+VeloZ)); + } + + if(hasWallModelMonitor) + { + Fx_monitor[k] = wallMomentumX; + Fy_monitor[k] = wallMomentumY; + Fz_monitor[k] = wallMomentumZ; + } + + } +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/GPU/ThinWallBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/ThinWallBCs27.cu index 715a94cbf60e3f93737826da455fb232f1cd8f5d..55f810628f370976289d1492e9916d5d3fa0dbb8 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/ThinWallBCs27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/ThinWallBCs27.cu @@ -8,88 +8,88 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; ///////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVelDeviceCompThinWallsPartOne27( +__global__ void QVelDeviceCompThinWallsPartOne27( real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - uint sizeQ, - int kQ, + uint numberOfBCnodes, real om1, uint* neighborX, uint* neighborY, uint* neighborZ, uint size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -102,7 +102,7 @@ extern "C" __global__ void QVelDeviceCompThinWallsPartOne27( const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real VeloX = vx[k]; @@ -114,32 +114,32 @@ extern "C" __global__ void QVelDeviceCompThinWallsPartOne27( *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index uint KQK = k_Q[k]; @@ -174,37 +174,37 @@ extern "C" __global__ void QVelDeviceCompThinWallsPartOne27( real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -227,182 +227,182 @@ extern "C" __global__ void QVelDeviceCompThinWallsPartOne27( if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho + c9o2 * ( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw] = (c1o1 - q) / (c1o1 + q)*(f_E - f_W + (f_E + f_W - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_E + f_W) - c6o1*c2o27*(VeloX)) / (c1o1 + q); + (D.f[DIR_M00])[kw] = (c1o1 - q) / (c1o1 + q)*(f_E - f_W + (f_E + f_W - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_E + f_W) - c6o1*c2o27*(VeloX)) / (c1o1 + q); } q = q_dirW[k]; if (q >= c0o1 && q <= c1o1) { feq = c2o27* (drho + c9o2 * (-vx1)*(-vx1) * (c1o1 + drho) - cu_sq); - (D.f[dirE])[ke] = (c1o1 - q) / (c1o1 + q)*(f_W - f_E + (f_W + f_E - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_W + f_E) - c6o1*c2o27*(-VeloX)) / (c1o1 + q); + (D.f[DIR_P00])[ke] = (c1o1 - q) / (c1o1 + q)*(f_W - f_E + (f_W + f_E - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_W + f_E) - c6o1*c2o27*(-VeloX)) / (c1o1 + q); } q = q_dirN[k]; if (q >= c0o1 && q <= c1o1) { feq = c2o27* (drho + c9o2 * (vx2)*(vx2) * (c1o1 + drho) - cu_sq); - (D.f[dirS])[ks] = (c1o1 - q) / (c1o1 + q)*(f_N - f_S + (f_N + f_S - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_N + f_S) - c6o1*c2o27*(VeloY)) / (c1o1 + q); + (D.f[DIR_0M0])[ks] = (c1o1 - q) / (c1o1 + q)*(f_N - f_S + (f_N + f_S - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_N + f_S) - c6o1*c2o27*(VeloY)) / (c1o1 + q); } q = q_dirS[k]; if (q >= c0o1 && q <= c1o1) { feq = c2o27* (drho + c9o2 * (-vx2)*(-vx2) * (c1o1 + drho) - cu_sq); - (D.f[dirN])[kn] = (c1o1 - q) / (c1o1 + q)*(f_S - f_N + (f_S + f_N - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_S + f_N) - c6o1*c2o27*(-VeloY)) / (c1o1 + q); + (D.f[DIR_0P0])[kn] = (c1o1 - q) / (c1o1 + q)*(f_S - f_N + (f_S + f_N - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_S + f_N) - c6o1*c2o27*(-VeloY)) / (c1o1 + q); } q = q_dirT[k]; if (q >= c0o1 && q <= c1o1) { feq = c2o27* (drho + c9o2 * (vx3)*(vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirB])[kb] = (c1o1 - q) / (c1o1 + q)*(f_T - f_B + (f_T + f_B - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_T + f_B) - c6o1*c2o27*(VeloZ)) / (c1o1 + q); + (D.f[DIR_00M])[kb] = (c1o1 - q) / (c1o1 + q)*(f_T - f_B + (f_T + f_B - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_T + f_B) - c6o1*c2o27*(VeloZ)) / (c1o1 + q); } q = q_dirB[k]; if (q >= c0o1 && q <= c1o1) { feq = c2o27* (drho + c9o2 * (-vx3)*(-vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirT])[kt] = (c1o1 - q) / (c1o1 + q)*(f_B - f_T + (f_B + f_T - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_B + f_T) - c6o1*c2o27*(-VeloZ)) / (c1o1 + q); + (D.f[DIR_00P])[kt] = (c1o1 - q) / (c1o1 + q)*(f_B - f_T + (f_B + f_T - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_B + f_T) - c6o1*c2o27*(-VeloZ)) / (c1o1 + q); } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * ( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*( VeloX+VeloY))/(c1o1+q); + (D.f[DIR_MM0])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*( VeloX+VeloY))/(c1o1+q); } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * (-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q); + (D.f[DIR_PP0])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q); } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * ( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q); + (D.f[DIR_MP0])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q); } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * (-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q); + (D.f[DIR_PM0])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q); } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * ( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q); + (D.f[DIR_M0M])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q); } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * (-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q); + (D.f[DIR_P0P])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q); } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * ( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q); + (D.f[DIR_M0P])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q); } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * (-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q); + (D.f[DIR_P0M])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q); } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * ( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q); + (D.f[DIR_0MM])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q); } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * ( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*(-VeloY-VeloZ))/(c1o1+q); + (D.f[DIR_0PP])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*(-VeloY-VeloZ))/(c1o1+q); } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * ( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q); + (D.f[DIR_0MP])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q); } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho + c9o2 * ( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*(-VeloY+VeloZ))/(c1o1+q); + (D.f[DIR_0PM])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*(-VeloY+VeloZ))/(c1o1+q); } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho + c9o2 * ( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q); + (D.f[DIR_MMM])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q); } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho + c9o2 * (-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q); + (D.f[DIR_PPP])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q); } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho + c9o2 * ( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q); + (D.f[DIR_MMP])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q); } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho + c9o2 * (-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q); + (D.f[DIR_PPM])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q); } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho + c9o2 * ( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q); + (D.f[DIR_MPM])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q); } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho + c9o2 * (-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q); + (D.f[DIR_PMP])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q); } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho + c9o2 * ( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q); + (D.f[DIR_MPP])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q); } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho + c9o2 * (-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q); + (D.f[DIR_PMM])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q); } } } @@ -447,79 +447,78 @@ extern "C" __global__ void QVelDeviceCompThinWallsPartOne27( ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QDeviceCompThinWallsPartOne27( +__global__ void QDeviceCompThinWallsPartOne27( real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd == true) + if (isEvenTimestep == true) { - D.f[dirE] = &DD[dirE *size_Mat]; - D.f[dirW] = &DD[dirW *size_Mat]; - D.f[dirN] = &DD[dirN *size_Mat]; - D.f[dirS] = &DD[dirS *size_Mat]; - D.f[dirT] = &DD[dirT *size_Mat]; - D.f[dirB] = &DD[dirB *size_Mat]; - D.f[dirNE] = &DD[dirNE *size_Mat]; - D.f[dirSW] = &DD[dirSW *size_Mat]; - D.f[dirSE] = &DD[dirSE *size_Mat]; - D.f[dirNW] = &DD[dirNW *size_Mat]; - D.f[dirTE] = &DD[dirTE *size_Mat]; - D.f[dirBW] = &DD[dirBW *size_Mat]; - D.f[dirBE] = &DD[dirBE *size_Mat]; - D.f[dirTW] = &DD[dirTW *size_Mat]; - D.f[dirTN] = &DD[dirTN *size_Mat]; - D.f[dirBS] = &DD[dirBS *size_Mat]; - D.f[dirBN] = &DD[dirBN *size_Mat]; - D.f[dirTS] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE] = &DD[dirTNE *size_Mat]; - D.f[dirTSW] = &DD[dirTSW *size_Mat]; - D.f[dirTSE] = &DD[dirTSE *size_Mat]; - D.f[dirTNW] = &DD[dirTNW *size_Mat]; - D.f[dirBNE] = &DD[dirBNE *size_Mat]; - D.f[dirBSW] = &DD[dirBSW *size_Mat]; - D.f[dirBSE] = &DD[dirBSE *size_Mat]; - D.f[dirBNW] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DD[dirE *size_Mat]; - D.f[dirE] = &DD[dirW *size_Mat]; - D.f[dirS] = &DD[dirN *size_Mat]; - D.f[dirN] = &DD[dirS *size_Mat]; - D.f[dirB] = &DD[dirT *size_Mat]; - D.f[dirT] = &DD[dirB *size_Mat]; - D.f[dirSW] = &DD[dirNE *size_Mat]; - D.f[dirNE] = &DD[dirSW *size_Mat]; - D.f[dirNW] = &DD[dirSE *size_Mat]; - D.f[dirSE] = &DD[dirNW *size_Mat]; - D.f[dirBW] = &DD[dirTE *size_Mat]; - D.f[dirTE] = &DD[dirBW *size_Mat]; - D.f[dirTW] = &DD[dirBE *size_Mat]; - D.f[dirBE] = &DD[dirTW *size_Mat]; - D.f[dirBS] = &DD[dirTN *size_Mat]; - D.f[dirTN] = &DD[dirBS *size_Mat]; - D.f[dirTS] = &DD[dirBN *size_Mat]; - D.f[dirBN] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE] = &DD[dirBSW *size_Mat]; - D.f[dirTSW] = &DD[dirBNE *size_Mat]; - D.f[dirTSE] = &DD[dirBNW *size_Mat]; - D.f[dirTNW] = &DD[dirBSE *size_Mat]; - D.f[dirBNE] = &DD[dirTSW *size_Mat]; - D.f[dirBSW] = &DD[dirTNE *size_Mat]; - D.f[dirBSE] = &DD[dirTNW *size_Mat]; - D.f[dirBNW] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -532,7 +531,7 @@ extern "C" __global__ void QDeviceCompThinWallsPartOne27( const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if (k < kQ) + if (k < numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, @@ -540,32 +539,32 @@ extern "C" __global__ void QDeviceCompThinWallsPartOne27( *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -600,37 +599,37 @@ extern "C" __global__ void QDeviceCompThinWallsPartOne27( real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_W = (D.f[dirE])[ke]; - f_E = (D.f[dirW])[kw]; - f_S = (D.f[dirN])[kn]; - f_N = (D.f[dirS])[ks]; - f_B = (D.f[dirT])[kt]; - f_T = (D.f[dirB])[kb]; - f_SW = (D.f[dirNE])[kne]; - f_NE = (D.f[dirSW])[ksw]; - f_NW = (D.f[dirSE])[kse]; - f_SE = (D.f[dirNW])[knw]; - f_BW = (D.f[dirTE])[kte]; - f_TE = (D.f[dirBW])[kbw]; - f_TW = (D.f[dirBE])[kbe]; - f_BE = (D.f[dirTW])[ktw]; - f_BS = (D.f[dirTN])[ktn]; - f_TN = (D.f[dirBS])[kbs]; - f_TS = (D.f[dirBN])[kbn]; - f_BN = (D.f[dirTS])[kts]; - f_BSW = (D.f[dirTNE])[ktne]; - f_BNE = (D.f[dirTSW])[ktsw]; - f_BNW = (D.f[dirTSE])[ktse]; - f_BSE = (D.f[dirTNW])[ktnw]; - f_TSW = (D.f[dirBNE])[kbne]; - f_TNE = (D.f[dirBSW])[kbsw]; - f_TNW = (D.f[dirBSE])[kbse]; - f_TSE = (D.f[dirBNW])[kbnw]; + f_W = (D.f[DIR_P00])[ke]; + f_E = (D.f[DIR_M00])[kw]; + f_S = (D.f[DIR_0P0])[kn]; + f_N = (D.f[DIR_0M0])[ks]; + f_B = (D.f[DIR_00P])[kt]; + f_T = (D.f[DIR_00M])[kb]; + f_SW = (D.f[DIR_PP0])[kne]; + f_NE = (D.f[DIR_MM0])[ksw]; + f_NW = (D.f[DIR_PM0])[kse]; + f_SE = (D.f[DIR_MP0])[knw]; + f_BW = (D.f[DIR_P0P])[kte]; + f_TE = (D.f[DIR_M0M])[kbw]; + f_TW = (D.f[DIR_P0M])[kbe]; + f_BE = (D.f[DIR_M0P])[ktw]; + f_BS = (D.f[DIR_0PP])[ktn]; + f_TN = (D.f[DIR_0MM])[kbs]; + f_TS = (D.f[DIR_0PM])[kbn]; + f_BN = (D.f[DIR_0MP])[kts]; + f_BSW = (D.f[DIR_PPP])[ktne]; + f_BNE = (D.f[DIR_MMP])[ktsw]; + f_BNW = (D.f[DIR_PMP])[ktse]; + f_BSE = (D.f[DIR_MPP])[ktnw]; + f_TSW = (D.f[DIR_PPM])[kbne]; + f_TNE = (D.f[DIR_MMM])[kbsw]; + f_TNW = (D.f[DIR_PMM])[kbse]; + f_TSE = (D.f[DIR_MPM])[kbnw]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -653,182 +652,182 @@ extern "C" __global__ void QDeviceCompThinWallsPartOne27( if (q >= c0o1 && q <= c1o1) { feq = c2o27* (drho + c9o2*(vx1)*(vx1) * (c1o1 + drho) - cu_sq); - (D.f[dirW])[kw] = (c1o1 - q) / (c1o1 + q)*(f_E - f_W + (f_E + f_W - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_E + f_W)) / (c1o1 + q); + (D.f[DIR_M00])[kw] = (c1o1 - q) / (c1o1 + q)*(f_E - f_W + (f_E + f_W - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_E + f_W)) / (c1o1 + q); } q = q_dirW[k]; if (q >= c0o1 && q <= c1o1) { feq = c2o27* (drho + c9o2*(-vx1)*(-vx1) * (c1o1 + drho) - cu_sq); - (D.f[dirE])[ke] = (c1o1 - q) / (c1o1 + q)*(f_W - f_E + (f_W + f_E - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_W + f_E)) / (c1o1 + q); + (D.f[DIR_P00])[ke] = (c1o1 - q) / (c1o1 + q)*(f_W - f_E + (f_W + f_E - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_W + f_E)) / (c1o1 + q); } q = q_dirN[k]; if (q >= c0o1 && q <= c1o1) { feq = c2o27* (drho + c9o2*(vx2)*(vx2) * (c1o1 + drho) - cu_sq); - (D.f[dirS])[ks] = (c1o1 - q) / (c1o1 + q)*(f_N - f_S + (f_N + f_S - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_N + f_S)) / (c1o1 + q); + (D.f[DIR_0M0])[ks] = (c1o1 - q) / (c1o1 + q)*(f_N - f_S + (f_N + f_S - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_N + f_S)) / (c1o1 + q); } q = q_dirS[k]; if (q >= c0o1 && q <= c1o1) { feq = c2o27* (drho + c9o2*(-vx2)*(-vx2) * (c1o1 + drho) - cu_sq); - (D.f[dirN])[kn] = (c1o1 - q) / (c1o1 + q)*(f_S - f_N + (f_S + f_N - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_S + f_N)) / (c1o1 + q); + (D.f[DIR_0P0])[kn] = (c1o1 - q) / (c1o1 + q)*(f_S - f_N + (f_S + f_N - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_S + f_N)) / (c1o1 + q); } q = q_dirT[k]; if (q >= c0o1 && q <= c1o1) { feq = c2o27* (drho + c9o2*(vx3)*(vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirB])[kb] = (c1o1 - q) / (c1o1 + q)*(f_T - f_B + (f_T + f_B - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_T + f_B)) / (c1o1 + q); + (D.f[DIR_00M])[kb] = (c1o1 - q) / (c1o1 + q)*(f_T - f_B + (f_T + f_B - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_T + f_B)) / (c1o1 + q); } q = q_dirB[k]; if (q >= c0o1 && q <= c1o1) { feq = c2o27* (drho + c9o2*(-vx3)*(-vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirT])[kt] = (c1o1 - q) / (c1o1 + q)*(f_B - f_T + (f_B + f_T - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_B + f_T)) / (c1o1 + q); + (D.f[DIR_00P])[kt] = (c1o1 - q) / (c1o1 + q)*(f_B - f_T + (f_B + f_T - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_B + f_T)) / (c1o1 + q); } q = q_dirNE[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(vx1 + vx2)*(vx1 + vx2) * (c1o1 + drho) - cu_sq); - (D.f[dirSW])[ksw] = (c1o1 - q) / (c1o1 + q)*(f_NE - f_SW + (f_NE + f_SW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_NE + f_SW)) / (c1o1 + q); + (D.f[DIR_MM0])[ksw] = (c1o1 - q) / (c1o1 + q)*(f_NE - f_SW + (f_NE + f_SW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_NE + f_SW)) / (c1o1 + q); } q = q_dirSW[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(-vx1 - vx2)*(-vx1 - vx2) * (c1o1 + drho) - cu_sq); - (D.f[dirNE])[kne] = (c1o1 - q) / (c1o1 + q)*(f_SW - f_NE + (f_SW + f_NE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_SW + f_NE)) / (c1o1 + q); + (D.f[DIR_PP0])[kne] = (c1o1 - q) / (c1o1 + q)*(f_SW - f_NE + (f_SW + f_NE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_SW + f_NE)) / (c1o1 + q); } q = q_dirSE[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(vx1 - vx2)*(vx1 - vx2) * (c1o1 + drho) - cu_sq); - (D.f[dirNW])[knw] = (c1o1 - q) / (c1o1 + q)*(f_SE - f_NW + (f_SE + f_NW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_SE + f_NW)) / (c1o1 + q); + (D.f[DIR_MP0])[knw] = (c1o1 - q) / (c1o1 + q)*(f_SE - f_NW + (f_SE + f_NW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_SE + f_NW)) / (c1o1 + q); } q = q_dirNW[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(-vx1 + vx2)*(-vx1 + vx2) * (c1o1 + drho) - cu_sq); - (D.f[dirSE])[kse] = (c1o1 - q) / (c1o1 + q)*(f_NW - f_SE + (f_NW + f_SE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_NW + f_SE)) / (c1o1 + q); + (D.f[DIR_PM0])[kse] = (c1o1 - q) / (c1o1 + q)*(f_NW - f_SE + (f_NW + f_SE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_NW + f_SE)) / (c1o1 + q); } q = q_dirTE[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(vx1 + vx3)*(vx1 + vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirBW])[kbw] = (c1o1 - q) / (c1o1 + q)*(f_TE - f_BW + (f_TE + f_BW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TE + f_BW)) / (c1o1 + q); + (D.f[DIR_M0M])[kbw] = (c1o1 - q) / (c1o1 + q)*(f_TE - f_BW + (f_TE + f_BW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TE + f_BW)) / (c1o1 + q); } q = q_dirBW[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(-vx1 - vx3)*(-vx1 - vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirTE])[kte] = (c1o1 - q) / (c1o1 + q)*(f_BW - f_TE + (f_BW + f_TE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BW + f_TE)) / (c1o1 + q); + (D.f[DIR_P0P])[kte] = (c1o1 - q) / (c1o1 + q)*(f_BW - f_TE + (f_BW + f_TE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BW + f_TE)) / (c1o1 + q); } q = q_dirBE[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(vx1 - vx3)*(vx1 - vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirTW])[ktw] = (c1o1 - q) / (c1o1 + q)*(f_BE - f_TW + (f_BE + f_TW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BE + f_TW)) / (c1o1 + q); + (D.f[DIR_M0P])[ktw] = (c1o1 - q) / (c1o1 + q)*(f_BE - f_TW + (f_BE + f_TW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BE + f_TW)) / (c1o1 + q); } q = q_dirTW[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(-vx1 + vx3)*(-vx1 + vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirBE])[kbe] = (c1o1 - q) / (c1o1 + q)*(f_TW - f_BE + (f_TW + f_BE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TW + f_BE)) / (c1o1 + q); + (D.f[DIR_P0M])[kbe] = (c1o1 - q) / (c1o1 + q)*(f_TW - f_BE + (f_TW + f_BE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TW + f_BE)) / (c1o1 + q); } q = q_dirTN[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(vx2 + vx3)*(vx2 + vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirBS])[kbs] = (c1o1 - q) / (c1o1 + q)*(f_TN - f_BS + (f_TN + f_BS - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TN + f_BS)) / (c1o1 + q); + (D.f[DIR_0MM])[kbs] = (c1o1 - q) / (c1o1 + q)*(f_TN - f_BS + (f_TN + f_BS - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TN + f_BS)) / (c1o1 + q); } q = q_dirBS[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(-vx2 - vx3)*(-vx2 - vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirTN])[ktn] = (c1o1 - q) / (c1o1 + q)*(f_BS - f_TN + (f_BS + f_TN - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BS + f_TN)) / (c1o1 + q); + (D.f[DIR_0PP])[ktn] = (c1o1 - q) / (c1o1 + q)*(f_BS - f_TN + (f_BS + f_TN - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BS + f_TN)) / (c1o1 + q); } q = q_dirBN[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(vx2 - vx3)*(vx2 - vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirTS])[kts] = (c1o1 - q) / (c1o1 + q)*(f_BN - f_TS + (f_BN + f_TS - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BN + f_TS)) / (c1o1 + q); + (D.f[DIR_0MP])[kts] = (c1o1 - q) / (c1o1 + q)*(f_BN - f_TS + (f_BN + f_TS - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BN + f_TS)) / (c1o1 + q); } q = q_dirTS[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o54* (drho + c9o2*(-vx2 + vx3)*(-vx2 + vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirBN])[kbn] = (c1o1 - q) / (c1o1 + q)*(f_TS - f_BN + (f_TS + f_BN - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TS + f_BN)) / (c1o1 + q); + (D.f[DIR_0PM])[kbn] = (c1o1 - q) / (c1o1 + q)*(f_TS - f_BN + (f_TS + f_BN - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TS + f_BN)) / (c1o1 + q); } q = q_dirTNE[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o216*(drho + c9o2*(vx1 + vx2 + vx3)*(vx1 + vx2 + vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirBSW])[kbsw] = (c1o1 - q) / (c1o1 + q)*(f_TNE - f_BSW + (f_TNE + f_BSW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TNE + f_BSW)) / (c1o1 + q); + (D.f[DIR_MMM])[kbsw] = (c1o1 - q) / (c1o1 + q)*(f_TNE - f_BSW + (f_TNE + f_BSW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TNE + f_BSW)) / (c1o1 + q); } q = q_dirBSW[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o216*(drho + c9o2*(-vx1 - vx2 - vx3)*(-vx1 - vx2 - vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirTNE])[ktne] = (c1o1 - q) / (c1o1 + q)*(f_BSW - f_TNE + (f_BSW + f_TNE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BSW + f_TNE)) / (c1o1 + q); + (D.f[DIR_PPP])[ktne] = (c1o1 - q) / (c1o1 + q)*(f_BSW - f_TNE + (f_BSW + f_TNE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BSW + f_TNE)) / (c1o1 + q); } q = q_dirBNE[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o216*(drho + c9o2*(vx1 + vx2 - vx3)*(vx1 + vx2 - vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirTSW])[ktsw] = (c1o1 - q) / (c1o1 + q)*(f_BNE - f_TSW + (f_BNE + f_TSW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BNE + f_TSW)) / (c1o1 + q); + (D.f[DIR_MMP])[ktsw] = (c1o1 - q) / (c1o1 + q)*(f_BNE - f_TSW + (f_BNE + f_TSW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BNE + f_TSW)) / (c1o1 + q); } q = q_dirTSW[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o216*(drho + c9o2*(-vx1 - vx2 + vx3)*(-vx1 - vx2 + vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirBNE])[kbne] = (c1o1 - q) / (c1o1 + q)*(f_TSW - f_BNE + (f_TSW + f_BNE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TSW + f_BNE)) / (c1o1 + q); + (D.f[DIR_PPM])[kbne] = (c1o1 - q) / (c1o1 + q)*(f_TSW - f_BNE + (f_TSW + f_BNE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TSW + f_BNE)) / (c1o1 + q); } q = q_dirTSE[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o216*(drho + c9o2*(vx1 - vx2 + vx3)*(vx1 - vx2 + vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirBNW])[kbnw] = (c1o1 - q) / (c1o1 + q)*(f_TSE - f_BNW + (f_TSE + f_BNW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TSE + f_BNW)) / (c1o1 + q); + (D.f[DIR_MPM])[kbnw] = (c1o1 - q) / (c1o1 + q)*(f_TSE - f_BNW + (f_TSE + f_BNW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TSE + f_BNW)) / (c1o1 + q); } q = q_dirBNW[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o216*(drho + c9o2*(-vx1 + vx2 - vx3)*(-vx1 + vx2 - vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirTSE])[ktse] = (c1o1 - q) / (c1o1 + q)*(f_BNW - f_TSE + (f_BNW + f_TSE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BNW + f_TSE)) / (c1o1 + q); + (D.f[DIR_PMP])[ktse] = (c1o1 - q) / (c1o1 + q)*(f_BNW - f_TSE + (f_BNW + f_TSE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BNW + f_TSE)) / (c1o1 + q); } q = q_dirBSE[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o216*(drho + c9o2*(vx1 - vx2 - vx3)*(vx1 - vx2 - vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirTNW])[ktnw] = (c1o1 - q) / (c1o1 + q)*(f_BSE - f_TNW + (f_BSE + f_TNW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BSE + f_TNW)) / (c1o1 + q); + (D.f[DIR_MPP])[ktnw] = (c1o1 - q) / (c1o1 + q)*(f_BSE - f_TNW + (f_BSE + f_TNW - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_BSE + f_TNW)) / (c1o1 + q); } q = q_dirTNW[k]; if (q >= c0o1 && q <= c1o1) { feq = c1o216*(drho + c9o2*(-vx1 + vx2 + vx3)*(-vx1 + vx2 + vx3) * (c1o1 + drho) - cu_sq); - (D.f[dirBSE])[kbse] = (c1o1 - q) / (c1o1 + q)*(f_TNW - f_BSE + (f_TNW + f_BSE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TNW + f_BSE)) / (c1o1 + q); + (D.f[DIR_PMM])[kbse] = (c1o1 - q) / (c1o1 + q)*(f_TNW - f_BSE + (f_TNW + f_BSE - c2o1*feq*om1) / (c1o1 - om1))*c1o2 + (q*(f_TNW + f_BSE)) / (c1o1 + q); } } } @@ -873,19 +872,18 @@ extern "C" __global__ void QDeviceCompThinWallsPartOne27( ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QThinWallsPartTwo27( +__global__ void QThinWallsPartTwo27( real* DD, int* k_Q, real* QQ, - uint sizeQ, - int kQ, + uint numberOfBCnodes, uint* geom, uint* neighborX, uint* neighborY, uint* neighborZ, uint* neighborWSB, uint size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -898,7 +896,7 @@ extern "C" __global__ void QThinWallsPartTwo27( const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, @@ -906,32 +904,32 @@ extern "C" __global__ void QThinWallsPartTwo27( *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index uint KQK = k_Q[k]; @@ -980,125 +978,125 @@ extern "C" __global__ void QThinWallsPartTwo27( uint k0mp = neighborZ[k0m0]; // 0 -1 1 //////////////////////////////////////////////////////////////////////////////// Distributions27 D, DN; - if (evenOrOdd == true) + if (isEvenTimestep == true) { - D.f[dirE] = &DD[dirE *size_Mat]; - D.f[dirW] = &DD[dirW *size_Mat]; - D.f[dirN] = &DD[dirN *size_Mat]; - D.f[dirS] = &DD[dirS *size_Mat]; - D.f[dirT] = &DD[dirT *size_Mat]; - D.f[dirB] = &DD[dirB *size_Mat]; - D.f[dirNE] = &DD[dirNE *size_Mat]; - D.f[dirSW] = &DD[dirSW *size_Mat]; - D.f[dirSE] = &DD[dirSE *size_Mat]; - D.f[dirNW] = &DD[dirNW *size_Mat]; - D.f[dirTE] = &DD[dirTE *size_Mat]; - D.f[dirBW] = &DD[dirBW *size_Mat]; - D.f[dirBE] = &DD[dirBE *size_Mat]; - D.f[dirTW] = &DD[dirTW *size_Mat]; - D.f[dirTN] = &DD[dirTN *size_Mat]; - D.f[dirBS] = &DD[dirBS *size_Mat]; - D.f[dirBN] = &DD[dirBN *size_Mat]; - D.f[dirTS] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE] = &DD[dirTNE *size_Mat]; - D.f[dirTSW] = &DD[dirTSW *size_Mat]; - D.f[dirTSE] = &DD[dirTSE *size_Mat]; - D.f[dirTNW] = &DD[dirTNW *size_Mat]; - D.f[dirBNE] = &DD[dirBNE *size_Mat]; - D.f[dirBSW] = &DD[dirBSW *size_Mat]; - D.f[dirBSE] = &DD[dirBSE *size_Mat]; - D.f[dirBNW] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DD[dirE *size_Mat]; - D.f[dirE] = &DD[dirW *size_Mat]; - D.f[dirS] = &DD[dirN *size_Mat]; - D.f[dirN] = &DD[dirS *size_Mat]; - D.f[dirB] = &DD[dirT *size_Mat]; - D.f[dirT] = &DD[dirB *size_Mat]; - D.f[dirSW] = &DD[dirNE *size_Mat]; - D.f[dirNE] = &DD[dirSW *size_Mat]; - D.f[dirNW] = &DD[dirSE *size_Mat]; - D.f[dirSE] = &DD[dirNW *size_Mat]; - D.f[dirBW] = &DD[dirTE *size_Mat]; - D.f[dirTE] = &DD[dirBW *size_Mat]; - D.f[dirTW] = &DD[dirBE *size_Mat]; - D.f[dirBE] = &DD[dirTW *size_Mat]; - D.f[dirBS] = &DD[dirTN *size_Mat]; - D.f[dirTN] = &DD[dirBS *size_Mat]; - D.f[dirTS] = &DD[dirBN *size_Mat]; - D.f[dirBN] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE] = &DD[dirBSW *size_Mat]; - D.f[dirTSW] = &DD[dirBNE *size_Mat]; - D.f[dirTSE] = &DD[dirBNW *size_Mat]; - D.f[dirTNW] = &DD[dirBSE *size_Mat]; - D.f[dirBNE] = &DD[dirTSW *size_Mat]; - D.f[dirBSW] = &DD[dirTNE *size_Mat]; - D.f[dirBSE] = &DD[dirTNW *size_Mat]; - D.f[dirBNW] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM] = &DD[DIR_PMP *size_Mat]; } - if (evenOrOdd==false) + if (isEvenTimestep==false) { - DN.f[dirE ] = &DD[dirE *size_Mat]; - DN.f[dirW ] = &DD[dirW *size_Mat]; - DN.f[dirN ] = &DD[dirN *size_Mat]; - DN.f[dirS ] = &DD[dirS *size_Mat]; - DN.f[dirT ] = &DD[dirT *size_Mat]; - DN.f[dirB ] = &DD[dirB *size_Mat]; - DN.f[dirNE ] = &DD[dirNE *size_Mat]; - DN.f[dirSW ] = &DD[dirSW *size_Mat]; - DN.f[dirSE ] = &DD[dirSE *size_Mat]; - DN.f[dirNW ] = &DD[dirNW *size_Mat]; - DN.f[dirTE ] = &DD[dirTE *size_Mat]; - DN.f[dirBW ] = &DD[dirBW *size_Mat]; - DN.f[dirBE ] = &DD[dirBE *size_Mat]; - DN.f[dirTW ] = &DD[dirTW *size_Mat]; - DN.f[dirTN ] = &DD[dirTN *size_Mat]; - DN.f[dirBS ] = &DD[dirBS *size_Mat]; - DN.f[dirBN ] = &DD[dirBN *size_Mat]; - DN.f[dirTS ] = &DD[dirTS *size_Mat]; - DN.f[dirZERO] = &DD[dirZERO*size_Mat]; - DN.f[dirTNE ] = &DD[dirTNE *size_Mat]; - DN.f[dirTSW ] = &DD[dirTSW *size_Mat]; - DN.f[dirTSE ] = &DD[dirTSE *size_Mat]; - DN.f[dirTNW ] = &DD[dirTNW *size_Mat]; - DN.f[dirBNE ] = &DD[dirBNE *size_Mat]; - DN.f[dirBSW ] = &DD[dirBSW *size_Mat]; - DN.f[dirBSE ] = &DD[dirBSE *size_Mat]; - DN.f[dirBNW ] = &DD[dirBNW *size_Mat]; + DN.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + DN.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + DN.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + DN.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + DN.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + DN.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + DN.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + DN.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + DN.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + DN.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + DN.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + DN.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + DN.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + DN.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + DN.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + DN.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + DN.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + DN.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + DN.f[DIR_000] = &DD[DIR_000*size_Mat]; + DN.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + DN.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + DN.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + DN.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + DN.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + DN.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + DN.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + DN.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - DN.f[dirW ] = &DD[dirE *size_Mat]; - DN.f[dirE ] = &DD[dirW *size_Mat]; - DN.f[dirS ] = &DD[dirN *size_Mat]; - DN.f[dirN ] = &DD[dirS *size_Mat]; - DN.f[dirB ] = &DD[dirT *size_Mat]; - DN.f[dirT ] = &DD[dirB *size_Mat]; - DN.f[dirSW ] = &DD[dirNE *size_Mat]; - DN.f[dirNE ] = &DD[dirSW *size_Mat]; - DN.f[dirNW ] = &DD[dirSE *size_Mat]; - DN.f[dirSE ] = &DD[dirNW *size_Mat]; - DN.f[dirBW ] = &DD[dirTE *size_Mat]; - DN.f[dirTE ] = &DD[dirBW *size_Mat]; - DN.f[dirTW ] = &DD[dirBE *size_Mat]; - DN.f[dirBE ] = &DD[dirTW *size_Mat]; - DN.f[dirBS ] = &DD[dirTN *size_Mat]; - DN.f[dirTN ] = &DD[dirBS *size_Mat]; - DN.f[dirTS ] = &DD[dirBN *size_Mat]; - DN.f[dirBN ] = &DD[dirTS *size_Mat]; - DN.f[dirZERO] = &DD[dirZERO*size_Mat]; - DN.f[dirTNE ] = &DD[dirBSW *size_Mat]; - DN.f[dirTSW ] = &DD[dirBNE *size_Mat]; - DN.f[dirTSE ] = &DD[dirBNW *size_Mat]; - DN.f[dirTNW ] = &DD[dirBSE *size_Mat]; - DN.f[dirBNE ] = &DD[dirTSW *size_Mat]; - DN.f[dirBSW ] = &DD[dirTNE *size_Mat]; - DN.f[dirBSE ] = &DD[dirTNW *size_Mat]; - DN.f[dirBNW ] = &DD[dirTSE *size_Mat]; + DN.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + DN.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + DN.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + DN.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + DN.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + DN.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + DN.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + DN.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + DN.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + DN.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + DN.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + DN.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + DN.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + DN.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + DN.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + DN.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + DN.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + DN.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + DN.f[DIR_000] = &DD[DIR_000*size_Mat]; + DN.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + DN.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + DN.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + DN.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + DN.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + DN.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + DN.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + DN.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //directions allways exchange @@ -1108,32 +1106,32 @@ extern "C" __global__ void QThinWallsPartTwo27( //( 1 1 1) ( 1 0 0) ( 0 1 0) ( 0 0 1) ( 1 1 0) ( 1 0 1) ( 0 1 1) (-1 -1 1) (-1 1 -1) ( 1 -1 -1) (-1 1 0) (-1 0 1) ( 0 -1 1) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real q, tmp; - q = q_dirE[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kw ] < GEO_FLUID){tmp = (DN.f[dirW ])[kw ]; (DN.f[dirW ])[kw ]=(D.f[dirW ])[kw ]; (D.f[dirW ])[kw ]=tmp;}} - q = q_dirW[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirE ])[ke ]; (DN.f[dirE ])[ke ]=(D.f[dirE ])[ke ]; (D.f[dirE ])[ke ]=tmp;}} - q = q_dirN[k]; if (q>=c0o1 && q<=c1o1){ if (geom[ks ] < GEO_FLUID){tmp = (DN.f[dirS ])[ks ]; (DN.f[dirS ])[ks ]=(D.f[dirS ])[ks ]; (D.f[dirS ])[ks ]=tmp;}} - q = q_dirS[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirN ])[kn ]; (DN.f[dirN ])[kn ]=(D.f[dirN ])[kn ]; (D.f[dirN ])[kn ]=tmp;}} - q = q_dirT[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kb ] < GEO_FLUID){tmp = (DN.f[dirB ])[kb ]; (DN.f[dirB ])[kb ]=(D.f[dirB ])[kb ]; (D.f[dirB ])[kb ]=tmp;}} - q = q_dirB[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirT ])[kt ]; (DN.f[dirT ])[kt ]=(D.f[dirT ])[kt ]; (D.f[dirT ])[kt ]=tmp;}} - q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1){ if (geom[ksw ] < GEO_FLUID){tmp = (DN.f[dirSW ])[ksw ]; (DN.f[dirSW ])[ksw ]=(D.f[dirSW ])[ksw ]; (D.f[dirSW ])[ksw ]=tmp;}} - q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirNE ])[kne ]; (DN.f[dirNE ])[kne ]=(D.f[dirNE ])[kne ]; (D.f[dirNE ])[kne ]=tmp;}} - q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirNW ])[knw ]; (DN.f[dirNW ])[knw ]=(D.f[dirNW ])[knw ]; (D.f[dirNW ])[knw ]=tmp;}} - q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kmp0] < GEO_FLUID){tmp = (DN.f[dirSE ])[kse ]; (DN.f[dirSE ])[kse ]=(D.f[dirSE ])[kse ]; (D.f[dirSE ])[kse ]=tmp;}} - q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kbw ] < GEO_FLUID){tmp = (DN.f[dirBW ])[kbw ]; (DN.f[dirBW ])[kbw ]=(D.f[dirBW ])[kbw ]; (D.f[dirBW ])[kbw ]=tmp;}} - q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirTE ])[kte ]; (DN.f[dirTE ])[kte ]=(D.f[dirTE ])[kte ]; (D.f[dirTE ])[kte ]=tmp;}} - q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirTW ])[ktw ]; (DN.f[dirTW ])[ktw ]=(D.f[dirTW ])[ktw ]; (D.f[dirTW ])[ktw ]=tmp;}} - q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1){ if (geom[km0p] < GEO_FLUID){tmp = (DN.f[dirBE ])[kbe ]; (DN.f[dirBE ])[kbe ]=(D.f[dirBE ])[kbe ]; (D.f[dirBE ])[kbe ]=tmp;}} - q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kbs ] < GEO_FLUID){tmp = (DN.f[dirBS ])[kbs ]; (DN.f[dirBS ])[kbs ]=(D.f[dirBS ])[kbs ]; (D.f[dirBS ])[kbs ]=tmp;}} - q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirTN ])[ktn ]; (DN.f[dirTN ])[ktn ]=(D.f[dirTN ])[ktn ]; (D.f[dirTN ])[ktn ]=tmp;}} - q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirTS ])[kts ]; (DN.f[dirTS ])[kts ]=(D.f[dirTS ])[kts ]; (D.f[dirTS ])[kts ]=tmp;}} - q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1){ if (geom[k0mp] < GEO_FLUID){tmp = (DN.f[dirBN ])[kbn ]; (DN.f[dirBN ])[kbn ]=(D.f[dirBN ])[kbn ]; (D.f[dirBN ])[kbn ]=tmp;}} - q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kbsw] < GEO_FLUID){tmp = (DN.f[dirBSW])[kbsw]; (DN.f[dirBSW])[kbsw]=(D.f[dirBSW])[kbsw]; (D.f[dirBSW])[kbsw]=tmp;}} - q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirTNE])[ktne]; (DN.f[dirTNE])[ktne]=(D.f[dirTNE])[ktne]; (D.f[dirTNE])[ktne]=tmp;}} - q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirTSW])[ktsw]; (DN.f[dirTSW])[ktsw]=(D.f[dirTSW])[ktsw]; (D.f[dirTSW])[ktsw]=tmp;}} - q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kmmp] < GEO_FLUID){tmp = (DN.f[dirBNE])[kbne]; (DN.f[dirBNE])[kbne]=(D.f[dirBNE])[kbne]; (D.f[dirBNE])[kbne]=tmp;}} - q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirBNW])[kbnw]; (DN.f[dirBNW])[kbnw]=(D.f[dirBNW])[kbnw]; (D.f[dirBNW])[kbnw]=tmp;}} - q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kmpm] < GEO_FLUID){tmp = (DN.f[dirTSE])[ktse]; (DN.f[dirTSE])[ktse]=(D.f[dirTSE])[ktse]; (D.f[dirTSE])[ktse]=tmp;}} - q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kpmm] < GEO_FLUID){tmp = (DN.f[dirTNW])[ktnw]; (DN.f[dirTNW])[ktnw]=(D.f[dirTNW])[ktnw]; (D.f[dirTNW])[ktnw]=tmp;}} - q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[dirBSE])[kbse]; (DN.f[dirBSE])[kbse]=(D.f[dirBSE])[kbse]; (D.f[dirBSE])[kbse]=tmp;}} + q = q_dirE[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kw ] < GEO_FLUID){tmp = (DN.f[DIR_M00 ])[kw ]; (DN.f[DIR_M00 ])[kw ]=(D.f[DIR_M00 ])[kw ]; (D.f[DIR_M00 ])[kw ]=tmp;}} + q = q_dirW[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_P00 ])[ke ]; (DN.f[DIR_P00 ])[ke ]=(D.f[DIR_P00 ])[ke ]; (D.f[DIR_P00 ])[ke ]=tmp;}} + q = q_dirN[k]; if (q>=c0o1 && q<=c1o1){ if (geom[ks ] < GEO_FLUID){tmp = (DN.f[DIR_0M0 ])[ks ]; (DN.f[DIR_0M0 ])[ks ]=(D.f[DIR_0M0 ])[ks ]; (D.f[DIR_0M0 ])[ks ]=tmp;}} + q = q_dirS[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_0P0 ])[kn ]; (DN.f[DIR_0P0 ])[kn ]=(D.f[DIR_0P0 ])[kn ]; (D.f[DIR_0P0 ])[kn ]=tmp;}} + q = q_dirT[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kb ] < GEO_FLUID){tmp = (DN.f[DIR_00M ])[kb ]; (DN.f[DIR_00M ])[kb ]=(D.f[DIR_00M ])[kb ]; (D.f[DIR_00M ])[kb ]=tmp;}} + q = q_dirB[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_00P ])[kt ]; (DN.f[DIR_00P ])[kt ]=(D.f[DIR_00P ])[kt ]; (D.f[DIR_00P ])[kt ]=tmp;}} + q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1){ if (geom[ksw ] < GEO_FLUID){tmp = (DN.f[DIR_MM0 ])[ksw ]; (DN.f[DIR_MM0 ])[ksw ]=(D.f[DIR_MM0 ])[ksw ]; (D.f[DIR_MM0 ])[ksw ]=tmp;}} + q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_PP0 ])[kne ]; (DN.f[DIR_PP0 ])[kne ]=(D.f[DIR_PP0 ])[kne ]; (D.f[DIR_PP0 ])[kne ]=tmp;}} + q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_MP0 ])[knw ]; (DN.f[DIR_MP0 ])[knw ]=(D.f[DIR_MP0 ])[knw ]; (D.f[DIR_MP0 ])[knw ]=tmp;}} + q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kmp0] < GEO_FLUID){tmp = (DN.f[DIR_PM0 ])[kse ]; (DN.f[DIR_PM0 ])[kse ]=(D.f[DIR_PM0 ])[kse ]; (D.f[DIR_PM0 ])[kse ]=tmp;}} + q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kbw ] < GEO_FLUID){tmp = (DN.f[DIR_M0M ])[kbw ]; (DN.f[DIR_M0M ])[kbw ]=(D.f[DIR_M0M ])[kbw ]; (D.f[DIR_M0M ])[kbw ]=tmp;}} + q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_P0P ])[kte ]; (DN.f[DIR_P0P ])[kte ]=(D.f[DIR_P0P ])[kte ]; (D.f[DIR_P0P ])[kte ]=tmp;}} + q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_M0P ])[ktw ]; (DN.f[DIR_M0P ])[ktw ]=(D.f[DIR_M0P ])[ktw ]; (D.f[DIR_M0P ])[ktw ]=tmp;}} + q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1){ if (geom[km0p] < GEO_FLUID){tmp = (DN.f[DIR_P0M ])[kbe ]; (DN.f[DIR_P0M ])[kbe ]=(D.f[DIR_P0M ])[kbe ]; (D.f[DIR_P0M ])[kbe ]=tmp;}} + q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kbs ] < GEO_FLUID){tmp = (DN.f[DIR_0MM ])[kbs ]; (DN.f[DIR_0MM ])[kbs ]=(D.f[DIR_0MM ])[kbs ]; (D.f[DIR_0MM ])[kbs ]=tmp;}} + q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_0PP ])[ktn ]; (DN.f[DIR_0PP ])[ktn ]=(D.f[DIR_0PP ])[ktn ]; (D.f[DIR_0PP ])[ktn ]=tmp;}} + q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_0MP ])[kts ]; (DN.f[DIR_0MP ])[kts ]=(D.f[DIR_0MP ])[kts ]; (D.f[DIR_0MP ])[kts ]=tmp;}} + q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1){ if (geom[k0mp] < GEO_FLUID){tmp = (DN.f[DIR_0PM ])[kbn ]; (DN.f[DIR_0PM ])[kbn ]=(D.f[DIR_0PM ])[kbn ]; (D.f[DIR_0PM ])[kbn ]=tmp;}} + q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kbsw] < GEO_FLUID){tmp = (DN.f[DIR_MMM])[kbsw]; (DN.f[DIR_MMM])[kbsw]=(D.f[DIR_MMM])[kbsw]; (D.f[DIR_MMM])[kbsw]=tmp;}} + q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_PPP])[ktne]; (DN.f[DIR_PPP])[ktne]=(D.f[DIR_PPP])[ktne]; (D.f[DIR_PPP])[ktne]=tmp;}} + q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_MMP])[ktsw]; (DN.f[DIR_MMP])[ktsw]=(D.f[DIR_MMP])[ktsw]; (D.f[DIR_MMP])[ktsw]=tmp;}} + q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kmmp] < GEO_FLUID){tmp = (DN.f[DIR_PPM])[kbne]; (DN.f[DIR_PPM])[kbne]=(D.f[DIR_PPM])[kbne]; (D.f[DIR_PPM])[kbne]=tmp;}} + q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_MPM])[kbnw]; (DN.f[DIR_MPM])[kbnw]=(D.f[DIR_MPM])[kbnw]; (D.f[DIR_MPM])[kbnw]=tmp;}} + q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kmpm] < GEO_FLUID){tmp = (DN.f[DIR_PMP])[ktse]; (DN.f[DIR_PMP])[ktse]=(D.f[DIR_PMP])[ktse]; (D.f[DIR_PMP])[ktse]=tmp;}} + q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1){ if (geom[kpmm] < GEO_FLUID){tmp = (DN.f[DIR_MPP])[ktnw]; (DN.f[DIR_MPP])[ktnw]=(D.f[DIR_MPP])[ktnw]; (D.f[DIR_MPP])[ktnw]=tmp;}} + q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1){ {tmp = (DN.f[DIR_PMM])[kbse]; (DN.f[DIR_PMM])[kbse]=(D.f[DIR_PMM])[kbse]; (D.f[DIR_PMM])[kbse]=tmp;}} } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/GPU/TurbulenceIntensity.cu b/src/gpu/VirtualFluids_GPU/GPU/TurbulenceIntensity.cu new file mode 100644 index 0000000000000000000000000000000000000000..f8cf8ab13c39d55477bf006cd27f7943dcb5b53a --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/TurbulenceIntensity.cu @@ -0,0 +1,73 @@ +// _ ___ __ __________ _ __ ______________ __ +// | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ / ___/ __ / / / / +// | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ / /___/ /_/ / / / / +// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) / /_) / ____/ /__/ / +// |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ \____/_/ \_____/ +// +////////////////////////////////////////////////////////////////////////// + +/* Device code */ +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" +#include <lbm/constants/NumericConstants.h> + +#include "lbm/MacroscopicQuantities.h" +#include "../Kernel/Utilities/DistributionHelper.cuh" + + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + +////////////////////////////////////////////////////////////////////////////// +__global__ void CalcTurbulenceIntensity( + real* vxx, + real* vyy, + real* vzz, + real* vxy, + real* vxz, + real* vyz, + real* vx_mean, + real* vy_mean, + real* vz_mean, + real *distributions, + uint* typeOfGridNode, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + unsigned int size_Mat, + bool isEvenTimestep) +{ + const unsigned k = vf::gpu::getNodeIndex(); + + if (k >= size_Mat) + return; + + if (!vf::gpu::isValidFluidNode(typeOfGridNode[k])) + return; + + vf::gpu::DistributionWrapper distr_wrapper(distributions, size_Mat, isEvenTimestep, k, neighborX, neighborY, + neighborZ); + const auto &distribution = distr_wrapper.distribution; + + // analogue to LBCalcMacCompSP27 + real rho = vf::lbm::getDensity(distribution.f); + real vx = vf::lbm::getCompressibleVelocityX1(distribution.f, rho); + real vy = vf::lbm::getCompressibleVelocityX2(distribution.f, rho); + real vz = vf::lbm::getCompressibleVelocityX3(distribution.f, rho); + + + // compute subtotals: + // fluctuations + vxx[k] = vxx[k] + vx * vx; + vyy[k] = vyy[k] + vy * vy; + vzz[k] = vzz[k] + vz * vz; + vxy[k] = vxy[k] + vx * vy; + vxz[k] = vxz[k] + vx * vz; + vyz[k] = vyz[k] + vy * vz; + + // velocity (for mean velocity) + vx_mean[k] = vx_mean[k] + vx; + vy_mean[k] = vy_mean[k] + vy; + vz_mean[k] = vz_mean[k] + vz; +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityInlines.cuh b/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityInlines.cuh new file mode 100644 index 0000000000000000000000000000000000000000..eb301515527a9e8a3056676b0d4dffe8197c7dbe --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityInlines.cuh @@ -0,0 +1,61 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file TurbulentViscosity.h +//! \ingroup GPU +//! \author Henry Korb, Henrik Asmuth +//====================================================================================== + +#ifndef TURBULENT_VISCOSITY_INLINES_CUH_ +#define TURBULENT_VISCOSITY_INLINES_CUH_ + +#include <cuda.h> +#include <cuda_runtime.h> + +#include "LBM/LB.h" +#include <lbm/constants/NumericConstants.h> + +using namespace vf::lbm::constant; + +__inline__ __device__ real calcTurbulentViscositySmagorinsky(real Cs, real dxux, real dyuy, real dzuz, real Dxy, real Dxz , real Dyz) +{ + return Cs*Cs * sqrt( c2o1 * ( dxux*dxux + dyuy*dyuy + dzuz*dzuz ) + Dxy*Dxy + Dxz*Dxz + Dyz*Dyz ); +} + +__inline__ __device__ real calcTurbulentViscosityQR(real C, real dxux, real dyuy, real dzuz, real Dxy, real Dxz , real Dyz) +{ + // ! Verstappen's QR model + //! Second invariant of the strain-rate tensor + real Q = c1o2*( dxux*dxux + dyuy*dyuy + dzuz*dzuz ) + c1o4*( Dxy*Dxy + Dxz*Dxz + Dyz*Dyz); + //! Third invariant of the strain-rate tensor (determinant) + real R = - dxux*dyuy*dzuz - c1o4*( Dxy*Dxz*Dyz + dxux*Dyz*Dyz + dyuy*Dxz*Dxz + dzuz*Dxy*Dxy ); + + return C * max(R, c0o1) / Q; +} + +#endif //TURBULENT_VISCOSITY_H_e \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityKernels.cu b/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityKernels.cu new file mode 100644 index 0000000000000000000000000000000000000000..3719ca3712e6f63a77f62bf314af7d19eea01f4c --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityKernels.cu @@ -0,0 +1,125 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file TurbulentViscosityKernels.cu +//! \ingroup GPU +//! \author Henry Korb, Henrik Asmuth +//====================================================================================== + +#include "TurbulentViscosityKernels.h" +#include "lbm/constants/NumericConstants.h" +#include "Parameter/Parameter.h" +#include "cuda/CudaGrid.h" +#include <cuda_runtime.h> +#include <helper_cuda.h> +#include "LBM/LB.h" + +using namespace vf::lbm::constant; + +__host__ __device__ __forceinline__ void calcDerivatives(const uint& k, uint& kM, uint& kP, uint* typeOfGridNode, real* vx, real* vy, real* vz, real& dvx, real& dvy, real& dvz) +{ + bool fluidP = (typeOfGridNode[kP] == GEO_FLUID); + bool fluidM = (typeOfGridNode[kM] == GEO_FLUID); + real div = (fluidM & fluidP) ? c1o2 : c1o1; + + dvx = ((fluidP ? vx[kP] : vx[k])-(fluidM ? vx[kM] : vx[k]))*div; + dvy = ((fluidP ? vy[kP] : vy[k])-(fluidM ? vy[kM] : vy[k]))*div; + dvz = ((fluidP ? vz[kP] : vz[k])-(fluidM ? vz[kM] : vz[k]))*div; +} + +__global__ void calcAMD(real* vx, + real* vy, + real* vz, + real* turbulentViscosity, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + uint* neighborWSB, + uint* typeOfGridNode, + uint size_Mat, + real SGSConstant) +{ + + const uint x = threadIdx.x; + const uint y = blockIdx.x; + const uint z = blockIdx.y; + + const uint nx = blockDim.x; + const uint ny = gridDim.x; + + const uint k = nx*(ny*z + y) + x; + if(k >= size_Mat) return; + if(typeOfGridNode[k] != GEO_FLUID) return; + + uint kPx = neighborX[k]; + uint kPy = neighborY[k]; + uint kPz = neighborZ[k]; + uint kMxyz = neighborWSB[k]; + uint kMx = neighborZ[neighborY[kMxyz]]; + uint kMy = neighborZ[neighborX[kMxyz]]; + uint kMz = neighborY[neighborX[kMxyz]]; + + real dvxdx, dvxdy, dvxdz, + dvydx, dvydy, dvydz, + dvzdx, dvzdy, dvzdz; + + calcDerivatives(k, kMx, kPx, typeOfGridNode, vx, vy, vz, dvxdx, dvydx, dvzdx); + calcDerivatives(k, kMy, kPy, typeOfGridNode, vx, vy, vz, dvxdy, dvydy, dvzdy); + calcDerivatives(k, kMz, kPz, typeOfGridNode, vx, vy, vz, dvxdz, dvydz, dvzdz); + + real denominator = dvxdx*dvxdx + dvydx*dvydx + dvzdx*dvzdx + + dvxdy*dvxdy + dvydy*dvydy + dvzdy*dvzdy + + dvxdz*dvxdz + dvydz*dvydz + dvzdz*dvzdz; + real enumerator = (dvxdx*dvxdx + dvxdy*dvxdy + dvxdz*dvxdz) * dvxdx + + (dvydx*dvydx + dvydy*dvydy + dvydz*dvydz) * dvydy + + (dvzdx*dvzdx + dvzdy*dvzdy + dvzdz*dvzdz) * dvzdz + + (dvxdx*dvydx + dvxdy*dvydy + dvxdz*dvydz) * (dvxdy+dvydx) + + (dvxdx*dvzdx + dvxdy*dvzdy + dvxdz*dvzdz) * (dvxdz+dvzdx) + + (dvydx*dvzdx + dvydy*dvzdy + dvydz*dvzdz) * (dvydz+dvzdy); + + turbulentViscosity[k] = max(c0o1,-SGSConstant*enumerator)/denominator; +} + +void calcTurbulentViscosityAMD(Parameter* para, int level) +{ + vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, para->getParH(level)->numberOfNodes); + calcAMD<<<grid.grid, grid.threads>>>( + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->turbViscosity, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->neighborInverse, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->numberOfNodes, + para->getSGSConstant() + ); + getLastCudaError("calcAMD execution failed"); +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityKernels.h b/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityKernels.h new file mode 100644 index 0000000000000000000000000000000000000000..b227e680301cd4639d48a5cf3ce74f08eb7e1b9f --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityKernels.h @@ -0,0 +1,52 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file TurbulentViscosityKernels.h +//! \ingroup GPU +//! \author Henry Korb, Henrik Asmuth +//====================================================================================== + +#ifndef TURBULENT_VISCOSITY_KERNELS_H_ +#define TURBULENT_VISCOSITY_KERNELS_H_ + +#include <cuda.h> +#include <cuda_runtime.h> + +#include "LBM/LB.h" +#include "Core/DataTypes.h" +#include <lbm/constants/NumericConstants.h> + +using namespace vf::lbm::constant; + +class Parameter; + +void calcTurbulentViscosityAMD(Parameter* para, int level); + + + +#endif //TURBULENT_VISCOSITY_H_e \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/GPU/VelocityBCs27.cu b/src/gpu/VirtualFluids_GPU/GPU/VelocityBCs27.cu index e7f25874dca46df4a803f5c9e30a20bc480a3a10..05c85e8b546aeaa964b1dbb61cbf01dd9b82ca1a 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/VelocityBCs27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/VelocityBCs27.cu @@ -8,89 +8,89 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" -#include <lbm/constants/NumericConstants.h> +#include "lbm/constants/D3Q27.h" +#include "lbm/constants/NumericConstants.h" +#include "KernelUtilities.h" using namespace vf::lbm::constant; +using namespace vf::lbm::dir; ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVelDeviceCompPlusSlip27(int inx, - int iny, +__global__ void QVelDeviceCompPlusSlip27( real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -103,7 +103,7 @@ extern "C" __global__ void QVelDeviceCompPlusSlip27(int inx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if (k < kQ) + if (k < numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real VeloX = vx[k]; @@ -115,32 +115,32 @@ extern "C" __global__ void QVelDeviceCompPlusSlip27(int inx, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -175,37 +175,37 @@ extern "C" __global__ void QVelDeviceCompPlusSlip27(int inx, real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_W = (D.f[dirE])[ke]; - f_E = (D.f[dirW])[kw]; - f_S = (D.f[dirN])[kn]; - f_N = (D.f[dirS])[ks]; - f_B = (D.f[dirT])[kt]; - f_T = (D.f[dirB])[kb]; - f_SW = (D.f[dirNE])[kne]; - f_NE = (D.f[dirSW])[ksw]; - f_NW = (D.f[dirSE])[kse]; - f_SE = (D.f[dirNW])[knw]; - f_BW = (D.f[dirTE])[kte]; - f_TE = (D.f[dirBW])[kbw]; - f_TW = (D.f[dirBE])[kbe]; - f_BE = (D.f[dirTW])[ktw]; - f_BS = (D.f[dirTN])[ktn]; - f_TN = (D.f[dirBS])[kbs]; - f_TS = (D.f[dirBN])[kbn]; - f_BN = (D.f[dirTS])[kts]; - f_BSW = (D.f[dirTNE])[ktne]; - f_BNE = (D.f[dirTSW])[ktsw]; - f_BNW = (D.f[dirTSE])[ktse]; - f_BSE = (D.f[dirTNW])[ktnw]; - f_TSW = (D.f[dirBNE])[kbne]; - f_TNE = (D.f[dirBSW])[kbsw]; - f_TNW = (D.f[dirBSE])[kbse]; - f_TSE = (D.f[dirBNW])[kbnw]; + f_W = (D.f[DIR_P00])[ke]; + f_E = (D.f[DIR_M00])[kw]; + f_S = (D.f[DIR_0P0])[kn]; + f_N = (D.f[DIR_0M0])[ks]; + f_B = (D.f[DIR_00P])[kt]; + f_T = (D.f[DIR_00M])[kb]; + f_SW = (D.f[DIR_PP0])[kne]; + f_NE = (D.f[DIR_MM0])[ksw]; + f_NW = (D.f[DIR_PM0])[kse]; + f_SE = (D.f[DIR_MP0])[knw]; + f_BW = (D.f[DIR_P0P])[kte]; + f_TE = (D.f[DIR_M0M])[kbw]; + f_TW = (D.f[DIR_P0M])[kbe]; + f_BE = (D.f[DIR_M0P])[ktw]; + f_BS = (D.f[DIR_0PP])[ktn]; + f_TN = (D.f[DIR_0MM])[kbs]; + f_TS = (D.f[DIR_0PM])[kbn]; + f_BN = (D.f[DIR_0MP])[kts]; + f_BSW = (D.f[DIR_PPP])[ktne]; + f_BNE = (D.f[DIR_MMP])[ktsw]; + f_BNW = (D.f[DIR_PMP])[ktse]; + f_BSE = (D.f[DIR_MPP])[ktnw]; + f_TSW = (D.f[DIR_PPM])[kbne]; + f_TNE = (D.f[DIR_MMM])[kbsw]; + f_TNW = (D.f[DIR_PMM])[kbse]; + f_TSE = (D.f[DIR_MPM])[kbnw]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -223,69 +223,69 @@ extern "C" __global__ void QVelDeviceCompPlusSlip27(int inx, real cu_sq = c3o2*(vx1*vx1 + vx2*vx2 + vx3*vx3) * (c1o1 + drho); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd == false) + if (isEvenTimestep == false) { - D.f[dirE] = &DD[dirE *size_Mat]; - D.f[dirW] = &DD[dirW *size_Mat]; - D.f[dirN] = &DD[dirN *size_Mat]; - D.f[dirS] = &DD[dirS *size_Mat]; - D.f[dirT] = &DD[dirT *size_Mat]; - D.f[dirB] = &DD[dirB *size_Mat]; - D.f[dirNE] = &DD[dirNE *size_Mat]; - D.f[dirSW] = &DD[dirSW *size_Mat]; - D.f[dirSE] = &DD[dirSE *size_Mat]; - D.f[dirNW] = &DD[dirNW *size_Mat]; - D.f[dirTE] = &DD[dirTE *size_Mat]; - D.f[dirBW] = &DD[dirBW *size_Mat]; - D.f[dirBE] = &DD[dirBE *size_Mat]; - D.f[dirTW] = &DD[dirTW *size_Mat]; - D.f[dirTN] = &DD[dirTN *size_Mat]; - D.f[dirBS] = &DD[dirBS *size_Mat]; - D.f[dirBN] = &DD[dirBN *size_Mat]; - D.f[dirTS] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE] = &DD[dirTNE *size_Mat]; - D.f[dirTSW] = &DD[dirTSW *size_Mat]; - D.f[dirTSE] = &DD[dirTSE *size_Mat]; - D.f[dirTNW] = &DD[dirTNW *size_Mat]; - D.f[dirBNE] = &DD[dirBNE *size_Mat]; - D.f[dirBSW] = &DD[dirBSW *size_Mat]; - D.f[dirBSE] = &DD[dirBSE *size_Mat]; - D.f[dirBNW] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DD[dirE *size_Mat]; - D.f[dirE] = &DD[dirW *size_Mat]; - D.f[dirS] = &DD[dirN *size_Mat]; - D.f[dirN] = &DD[dirS *size_Mat]; - D.f[dirB] = &DD[dirT *size_Mat]; - D.f[dirT] = &DD[dirB *size_Mat]; - D.f[dirSW] = &DD[dirNE *size_Mat]; - D.f[dirNE] = &DD[dirSW *size_Mat]; - D.f[dirNW] = &DD[dirSE *size_Mat]; - D.f[dirSE] = &DD[dirNW *size_Mat]; - D.f[dirBW] = &DD[dirTE *size_Mat]; - D.f[dirTE] = &DD[dirBW *size_Mat]; - D.f[dirTW] = &DD[dirBE *size_Mat]; - D.f[dirBE] = &DD[dirTW *size_Mat]; - D.f[dirBS] = &DD[dirTN *size_Mat]; - D.f[dirTN] = &DD[dirBS *size_Mat]; - D.f[dirTS] = &DD[dirBN *size_Mat]; - D.f[dirBN] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE] = &DD[dirBSW *size_Mat]; - D.f[dirTSW] = &DD[dirBNE *size_Mat]; - D.f[dirTSE] = &DD[dirBNW *size_Mat]; - D.f[dirTNW] = &DD[dirBSE *size_Mat]; - D.f[dirBNE] = &DD[dirTSW *size_Mat]; - D.f[dirBSW] = &DD[dirTNE *size_Mat]; - D.f[dirBSE] = &DD[dirTNW *size_Mat]; - D.f[dirBNW] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Test - //(D.f[dirZERO])[k]=c1o10; + //(D.f[DIR_000])[k]=c1o10; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //ToDo anders Klammern @@ -307,208 +307,208 @@ extern "C" __global__ void QVelDeviceCompPlusSlip27(int inx, if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ))/(c1o1+q);// - c2over27 * drho; - //(D.f[dirW])[kw]=zero; + (D.f[DIR_M00])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ))/(c1o1+q);// - c2over27 * drho; + //(D.f[DIR_M00])[kw]=zero; } q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ))/(c1o1+q);// - c2over27 * drho; - //(D.f[dirE])[ke]=zero; + (D.f[DIR_P00])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ))/(c1o1+q);// - c2over27 * drho; + //(D.f[DIR_P00])[ke]=zero; } q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ))/(c1o1+q);// - c2over27 * drho; - //(D.f[dirS])[ks]=zero; + (D.f[DIR_0M0])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ))/(c1o1+q);// - c2over27 * drho; + //(D.f[DIR_0M0])[ks]=zero; } q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ))/(c1o1+q);// - c2over27 * drho; - //(D.f[dirN])[kn]=zero; + (D.f[DIR_0P0])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ))/(c1o1+q);// - c2over27 * drho; + //(D.f[DIR_0P0])[kn]=zero; } q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ ))/(c1o1+q);// - c2over27 * drho; - //(D.f[dirB])[kb]=one; + (D.f[DIR_00M])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ ))/(c1o1+q);// - c2over27 * drho; + //(D.f[DIR_00M])[kb]=one; } q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ))/(c1o1+q);// - c2over27 * drho; - //(D.f[dirT])[kt]=zero; + (D.f[DIR_00P])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ))/(c1o1+q);// - c2over27 * drho; + //(D.f[DIR_00P])[kt]=zero; } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirSW])[ksw]=zero; + (D.f[DIR_MM0])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_MM0])[ksw]=zero; } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirNE])[kne]=zero; + (D.f[DIR_PP0])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_PP0])[kne]=zero; } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirNW])[knw]=zero; + (D.f[DIR_MP0])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_MP0])[knw]=zero; } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirSE])[kse]=zero; + (D.f[DIR_PM0])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_PM0])[kse]=zero; } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirBW])[kbw]=zero; + (D.f[DIR_M0M])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_M0M])[kbw]=zero; } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirTE])[kte]=zero; + (D.f[DIR_P0P])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_P0P])[kte]=zero; } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirTW])[ktw]=zero; + (D.f[DIR_M0P])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_M0P])[ktw]=zero; } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirBE])[kbe]=zero; + (D.f[DIR_P0M])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_P0M])[kbe]=zero; } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirBS])[kbs]=zero; + (D.f[DIR_0MM])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_0MM])[kbs]=zero; } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirTN])[ktn]=zero; + (D.f[DIR_0PP])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_0PP])[ktn]=zero; } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirTS])[kts]=zero; + (D.f[DIR_0MP])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_0MP])[kts]=zero; } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q);// - c1over54 * drho; - //(D.f[dirBN])[kbn]=zero; + (D.f[DIR_0PM])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q);// - c1over54 * drho; + //(D.f[DIR_0PM])[kbn]=zero; } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q);// - c1over216 * drho; - //(D.f[dirBSW])[kbsw]=zero; + (D.f[DIR_MMM])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q);// - c1over216 * drho; + //(D.f[DIR_MMM])[kbsw]=zero; } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q);// - c1over216 * drho; - //(D.f[dirTNE])[ktne]=zero; + (D.f[DIR_PPP])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q);// - c1over216 * drho; + //(D.f[DIR_PPP])[ktne]=zero; } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q);// - c1over216 * drho; - //(D.f[dirTSW])[ktsw]=zero; + (D.f[DIR_MMP])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q);// - c1over216 * drho; + //(D.f[DIR_MMP])[ktsw]=zero; } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q);// - c1over216 * drho; - //(D.f[dirBNE])[kbne]=zero; + (D.f[DIR_PPM])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q);// - c1over216 * drho; + //(D.f[DIR_PPM])[kbne]=zero; } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q);// - c1over216 * drho; - //(D.f[dirBNW])[kbnw]=zero; + (D.f[DIR_MPM])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q);// - c1over216 * drho; + //(D.f[DIR_MPM])[kbnw]=zero; } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q);// - c1over216 * drho; - //(D.f[dirTSE])[ktse]=zero; + (D.f[DIR_PMP])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q);// - c1over216 * drho; + //(D.f[DIR_PMP])[ktse]=zero; } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q);// - c1over216 * drho; - //(D.f[dirTNW])[ktnw]=zero; + (D.f[DIR_MPP])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q);// - c1over216 * drho; + //(D.f[DIR_MPP])[ktnw]=zero; } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q);// - c1over216 * drho; - //(D.f[dirBSE])[kbse]=zero; + (D.f[DIR_PMM])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q);// - c1over216 * drho; + //(D.f[DIR_PMM])[kbse]=zero; } } } @@ -553,18 +553,18 @@ extern "C" __global__ void QVelDeviceCompPlusSlip27(int inx, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVeloDeviceEQ27(real* VeloX, +__global__ void QVeloDeviceEQ27(real* VeloX, real* VeloY, real* VeloZ, real* DD, int* k_Q, - int kQ, + int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -577,7 +577,7 @@ extern "C" __global__ void QVeloDeviceEQ27(real* VeloX, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //index @@ -611,97 +611,97 @@ extern "C" __global__ void QVeloDeviceEQ27(real* VeloX, unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // based on BGK Plus Comp ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[ke ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[kn ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[kt ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[kne ]; - real mfaab = (D.f[dirSW ])[ksw ]; - real mfcab = (D.f[dirSE ])[kse ]; - real mfacb = (D.f[dirNW ])[knw ]; - real mfcbc = (D.f[dirTE ])[kte ]; - real mfaba = (D.f[dirBW ])[kbw ]; - real mfcba = (D.f[dirBE ])[kbe ]; - real mfabc = (D.f[dirTW ])[ktw ]; - real mfbcc = (D.f[dirTN ])[ktn ]; - real mfbaa = (D.f[dirBS ])[kbs ]; - real mfbca = (D.f[dirBN ])[kbn ]; - real mfbac = (D.f[dirTS ])[kts ]; - real mfbbb = (D.f[dirZERO])[kzero]; - real mfccc = (D.f[dirTNE ])[ktne ]; - real mfaac = (D.f[dirTSW ])[ktsw ]; - real mfcac = (D.f[dirTSE ])[ktse ]; - real mfacc = (D.f[dirTNW ])[ktnw ]; - real mfcca = (D.f[dirBNE ])[kbne ]; - real mfaaa = (D.f[dirBSW ])[kbsw ]; - real mfcaa = (D.f[dirBSE ])[kbse ]; - real mfaca = (D.f[dirBNW ])[kbnw ]; + real mfcbb = (D.f[DIR_P00 ])[ke ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[kn ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[kt ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[kne ]; + real mfaab = (D.f[DIR_MM0 ])[ksw ]; + real mfcab = (D.f[DIR_PM0 ])[kse ]; + real mfacb = (D.f[DIR_MP0 ])[knw ]; + real mfcbc = (D.f[DIR_P0P ])[kte ]; + real mfaba = (D.f[DIR_M0M ])[kbw ]; + real mfcba = (D.f[DIR_P0M ])[kbe ]; + real mfabc = (D.f[DIR_M0P ])[ktw ]; + real mfbcc = (D.f[DIR_0PP ])[ktn ]; + real mfbaa = (D.f[DIR_0MM ])[kbs ]; + real mfbca = (D.f[DIR_0PM ])[kbn ]; + real mfbac = (D.f[DIR_0MP ])[kts ]; + real mfbbb = (D.f[DIR_000])[kzero]; + real mfccc = (D.f[DIR_PPP ])[ktne ]; + real mfaac = (D.f[DIR_MMP ])[ktsw ]; + real mfcac = (D.f[DIR_PMP ])[ktse ]; + real mfacc = (D.f[DIR_MPP ])[ktnw ]; + real mfcca = (D.f[DIR_PPM ])[kbne ]; + real mfaaa = (D.f[DIR_MMM ])[kbsw ]; + real mfcaa = (D.f[DIR_PMM ])[kbse ]; + real mfaca = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////////// real rho = (mfccc+mfaaa + mfaca+mfcac + mfacc+mfcaa + mfaac+mfcca + mfbac+mfbca + mfbaa+mfbcc + mfabc+mfcba + mfaba+mfcbc + mfacb+mfcab + mfaab+mfccb + @@ -763,33 +763,33 @@ extern "C" __global__ void QVeloDeviceEQ27(real* VeloX, mfcaa = -rho * XXc * YYa * ZZa - c1o216; mfaca = -rho * XXa * YYc * ZZa - c1o216; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE ])[ke ] = mfabb;//mfcbb; - (D.f[dirW ])[kw ] = mfcbb;//mfabb; - (D.f[dirN ])[kn ] = mfbab;//mfbcb; - (D.f[dirS ])[ks ] = mfbcb;//mfbab; - (D.f[dirT ])[kt ] = mfbba;//mfbbc; - (D.f[dirB ])[kb ] = mfbbc;//mfbba; - (D.f[dirNE ])[kne ] = mfaab;//mfccb; - (D.f[dirSW ])[ksw ] = mfccb;//mfaab; - (D.f[dirSE ])[kse ] = mfacb;//mfcab; - (D.f[dirNW ])[knw ] = mfcab;//mfacb; - (D.f[dirTE ])[kte ] = mfaba;//mfcbc; - (D.f[dirBW ])[kbw ] = mfcbc;//mfaba; - (D.f[dirBE ])[kbe ] = mfabc;//mfcba; - (D.f[dirTW ])[ktw ] = mfcba;//mfabc; - (D.f[dirTN ])[ktn ] = mfbaa;//mfbcc; - (D.f[dirBS ])[kbs ] = mfbcc;//mfbaa; - (D.f[dirBN ])[kbn ] = mfbac;//mfbca; - (D.f[dirTS ])[kts ] = mfbca;//mfbac; - (D.f[dirZERO])[kzero] = mfbbb;//mfbbb; - (D.f[dirTNE ])[ktne ] = mfaaa;//mfccc; - (D.f[dirTSW ])[ktsw ] = mfcca;//mfaac; - (D.f[dirTSE ])[ktse ] = mfaca;//mfcac; - (D.f[dirTNW ])[ktnw ] = mfcaa;//mfacc; - (D.f[dirBNE ])[kbne ] = mfaac;//mfcca; - (D.f[dirBSW ])[kbsw ] = mfccc;//mfaaa; - (D.f[dirBSE ])[kbse ] = mfacc;//mfcaa; - (D.f[dirBNW ])[kbnw ] = mfcac;//mfaca; + (D.f[DIR_P00 ])[ke ] = mfabb;//mfcbb; + (D.f[DIR_M00 ])[kw ] = mfcbb;//mfabb; + (D.f[DIR_0P0 ])[kn ] = mfbab;//mfbcb; + (D.f[DIR_0M0 ])[ks ] = mfbcb;//mfbab; + (D.f[DIR_00P ])[kt ] = mfbba;//mfbbc; + (D.f[DIR_00M ])[kb ] = mfbbc;//mfbba; + (D.f[DIR_PP0 ])[kne ] = mfaab;//mfccb; + (D.f[DIR_MM0 ])[ksw ] = mfccb;//mfaab; + (D.f[DIR_PM0 ])[kse ] = mfacb;//mfcab; + (D.f[DIR_MP0 ])[knw ] = mfcab;//mfacb; + (D.f[DIR_P0P ])[kte ] = mfaba;//mfcbc; + (D.f[DIR_M0M ])[kbw ] = mfcbc;//mfaba; + (D.f[DIR_P0M ])[kbe ] = mfabc;//mfcba; + (D.f[DIR_M0P ])[ktw ] = mfcba;//mfabc; + (D.f[DIR_0PP ])[ktn ] = mfbaa;//mfbcc; + (D.f[DIR_0MM ])[kbs ] = mfbcc;//mfbaa; + (D.f[DIR_0PM ])[kbn ] = mfbac;//mfbca; + (D.f[DIR_0MP ])[kts ] = mfbca;//mfbac; + (D.f[DIR_000])[kzero] = mfbbb;//mfbbb; + (D.f[DIR_PPP ])[ktne ] = mfaaa;//mfccc; + (D.f[DIR_MMP ])[ktsw ] = mfcca;//mfaac; + (D.f[DIR_PMP ])[ktse ] = mfaca;//mfcac; + (D.f[DIR_MPP ])[ktnw ] = mfcaa;//mfacc; + (D.f[DIR_PPM ])[kbne ] = mfaac;//mfcca; + (D.f[DIR_MMM ])[kbsw ] = mfccc;//mfaaa; + (D.f[DIR_PMM ])[kbse ] = mfacc;//mfcaa; + (D.f[DIR_MPM ])[kbnw ] = mfcac;//mfaca; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -833,7 +833,7 @@ extern "C" __global__ void QVeloDeviceEQ27(real* VeloX, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVeloStreetDeviceEQ27( +__global__ void QVeloStreetDeviceEQ27( real* veloXfraction, real* veloYfraction, int* naschVelo, @@ -845,7 +845,7 @@ extern "C" __global__ void QVeloStreetDeviceEQ27( uint* neighborY, uint* neighborZ, uint size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -892,97 +892,97 @@ extern "C" __global__ void QVeloStreetDeviceEQ27( unsigned int kbsw = neighborZ[ksw]; //////////////////////////////////////////////////////////////////////////////// Distributions27 D; - if (evenOrOdd == true) + if (isEvenTimestep == true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // based on BGK Plus Comp ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[ke ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[kn ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[kt ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[kne ]; - real mfaab = (D.f[dirSW ])[ksw ]; - real mfcab = (D.f[dirSE ])[kse ]; - real mfacb = (D.f[dirNW ])[knw ]; - real mfcbc = (D.f[dirTE ])[kte ]; - real mfaba = (D.f[dirBW ])[kbw ]; - real mfcba = (D.f[dirBE ])[kbe ]; - real mfabc = (D.f[dirTW ])[ktw ]; - real mfbcc = (D.f[dirTN ])[ktn ]; - real mfbaa = (D.f[dirBS ])[kbs ]; - real mfbca = (D.f[dirBN ])[kbn ]; - real mfbac = (D.f[dirTS ])[kts ]; - real mfbbb = (D.f[dirZERO])[kzero]; - real mfccc = (D.f[dirTNE ])[ktne ]; - real mfaac = (D.f[dirTSW ])[ktsw ]; - real mfcac = (D.f[dirTSE ])[ktse ]; - real mfacc = (D.f[dirTNW ])[ktnw ]; - real mfcca = (D.f[dirBNE ])[kbne ]; - real mfaaa = (D.f[dirBSW ])[kbsw ]; - real mfcaa = (D.f[dirBSE ])[kbse ]; - real mfaca = (D.f[dirBNW ])[kbnw ]; + real mfcbb = (D.f[DIR_P00 ])[ke ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[kn ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[kt ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[kne ]; + real mfaab = (D.f[DIR_MM0 ])[ksw ]; + real mfcab = (D.f[DIR_PM0 ])[kse ]; + real mfacb = (D.f[DIR_MP0 ])[knw ]; + real mfcbc = (D.f[DIR_P0P ])[kte ]; + real mfaba = (D.f[DIR_M0M ])[kbw ]; + real mfcba = (D.f[DIR_P0M ])[kbe ]; + real mfabc = (D.f[DIR_M0P ])[ktw ]; + real mfbcc = (D.f[DIR_0PP ])[ktn ]; + real mfbaa = (D.f[DIR_0MM ])[kbs ]; + real mfbca = (D.f[DIR_0PM ])[kbn ]; + real mfbac = (D.f[DIR_0MP ])[kts ]; + real mfbbb = (D.f[DIR_000])[kzero]; + real mfccc = (D.f[DIR_PPP ])[ktne ]; + real mfaac = (D.f[DIR_MMP ])[ktsw ]; + real mfcac = (D.f[DIR_PMP ])[ktse ]; + real mfacc = (D.f[DIR_MPP ])[ktnw ]; + real mfcca = (D.f[DIR_PPM ])[kbne ]; + real mfaaa = (D.f[DIR_MMM ])[kbsw ]; + real mfcaa = (D.f[DIR_PMM ])[kbse ]; + real mfaca = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////////// real rho = (mfccc + mfaaa + mfaca + mfcac + mfacc + mfcaa + mfaac + mfcca + mfbac + mfbca + mfbaa + mfbcc + mfabc + mfcba + mfaba + mfcbc + mfacb + mfcab + mfaab + mfccb + @@ -1049,33 +1049,33 @@ extern "C" __global__ void QVeloStreetDeviceEQ27( mfcaa = -rho * XXc * YYa * ZZa - c1o216; mfaca = -rho * XXa * YYc * ZZa - c1o216; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE ])[ke ] = mfabb;//mfcbb; - (D.f[dirW ])[kw ] = mfcbb;//mfabb; - (D.f[dirN ])[kn ] = mfbab;//mfbcb; - (D.f[dirS ])[ks ] = mfbcb;//mfbab; - (D.f[dirT ])[kt ] = mfbba;//mfbbc; - (D.f[dirB ])[kb ] = mfbbc;//mfbba; - (D.f[dirNE ])[kne ] = mfaab;//mfccb; - (D.f[dirSW ])[ksw ] = mfccb;//mfaab; - (D.f[dirSE ])[kse ] = mfacb;//mfcab; - (D.f[dirNW ])[knw ] = mfcab;//mfacb; - (D.f[dirTE ])[kte ] = mfaba;//mfcbc; - (D.f[dirBW ])[kbw ] = mfcbc;//mfaba; - (D.f[dirBE ])[kbe ] = mfabc;//mfcba; - (D.f[dirTW ])[ktw ] = mfcba;//mfabc; - (D.f[dirTN ])[ktn ] = mfbaa;//mfbcc; - (D.f[dirBS ])[kbs ] = mfbcc;//mfbaa; - (D.f[dirBN ])[kbn ] = mfbac;//mfbca; - (D.f[dirTS ])[kts ] = mfbca;//mfbac; - (D.f[dirZERO])[kzero] = mfbbb;//mfbbb; - (D.f[dirTNE ])[ktne ] = mfaaa;//mfccc; - (D.f[dirTSW ])[ktsw ] = mfcca;//mfaac; - (D.f[dirTSE ])[ktse ] = mfaca;//mfcac; - (D.f[dirTNW ])[ktnw ] = mfcaa;//mfacc; - (D.f[dirBNE ])[kbne ] = mfaac;//mfcca; - (D.f[dirBSW ])[kbsw ] = mfccc;//mfaaa; - (D.f[dirBSE ])[kbse ] = mfacc;//mfcaa; - (D.f[dirBNW ])[kbnw ] = mfcac;//mfaca; + (D.f[DIR_P00 ])[ke ] = mfabb;//mfcbb; + (D.f[DIR_M00 ])[kw ] = mfcbb;//mfabb; + (D.f[DIR_0P0 ])[kn ] = mfbab;//mfbcb; + (D.f[DIR_0M0 ])[ks ] = mfbcb;//mfbab; + (D.f[DIR_00P ])[kt ] = mfbba;//mfbbc; + (D.f[DIR_00M ])[kb ] = mfbbc;//mfbba; + (D.f[DIR_PP0 ])[kne ] = mfaab;//mfccb; + (D.f[DIR_MM0 ])[ksw ] = mfccb;//mfaab; + (D.f[DIR_PM0 ])[kse ] = mfacb;//mfcab; + (D.f[DIR_MP0 ])[knw ] = mfcab;//mfacb; + (D.f[DIR_P0P ])[kte ] = mfaba;//mfcbc; + (D.f[DIR_M0M ])[kbw ] = mfcbc;//mfaba; + (D.f[DIR_P0M ])[kbe ] = mfabc;//mfcba; + (D.f[DIR_M0P ])[ktw ] = mfcba;//mfabc; + (D.f[DIR_0PP ])[ktn ] = mfbaa;//mfbcc; + (D.f[DIR_0MM ])[kbs ] = mfbcc;//mfbaa; + (D.f[DIR_0PM ])[kbn ] = mfbac;//mfbca; + (D.f[DIR_0MP ])[kts ] = mfbca;//mfbac; + (D.f[DIR_000])[kzero] = mfbbb;//mfbbb; + (D.f[DIR_PPP ])[ktne ] = mfaaa;//mfccc; + (D.f[DIR_MMP ])[ktsw ] = mfcca;//mfaac; + (D.f[DIR_PMP ])[ktse ] = mfaca;//mfcac; + (D.f[DIR_MPP ])[ktnw ] = mfcaa;//mfacc; + (D.f[DIR_PPM ])[kbne ] = mfaac;//mfcca; + (D.f[DIR_MMM ])[kbsw ] = mfccc;//mfaaa; + (D.f[DIR_PMM ])[kbse ] = mfacc;//mfcaa; + (D.f[DIR_MPM ])[kbnw ] = mfcac;//mfaca; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1119,83 +1119,81 @@ extern "C" __global__ void QVeloStreetDeviceEQ27( ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVelDeviceIncompHighNu27(int inx, - int iny, +__global__ void QVelDeviceIncompHighNu27( real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1208,7 +1206,7 @@ extern "C" __global__ void QVelDeviceIncompHighNu27(int inx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real VeloX = vx[k]; @@ -1220,32 +1218,32 @@ extern "C" __global__ void QVelDeviceIncompHighNu27(int inx, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -1280,37 +1278,37 @@ extern "C" __global__ void QVelDeviceIncompHighNu27(int inx, real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_E = (D.f[dirE ])[ke ]; - f_W = (D.f[dirW ])[kw ]; - f_N = (D.f[dirN ])[kn ]; - f_S = (D.f[dirS ])[ks ]; - f_T = (D.f[dirT ])[kt ]; - f_B = (D.f[dirB ])[kb ]; - f_NE = (D.f[dirNE ])[kne ]; - f_SW = (D.f[dirSW ])[ksw ]; - f_SE = (D.f[dirSE ])[kse ]; - f_NW = (D.f[dirNW ])[knw ]; - f_TE = (D.f[dirTE ])[kte ]; - f_BW = (D.f[dirBW ])[kbw ]; - f_BE = (D.f[dirBE ])[kbe ]; - f_TW = (D.f[dirTW ])[ktw ]; - f_TN = (D.f[dirTN ])[ktn ]; - f_BS = (D.f[dirBS ])[kbs ]; - f_BN = (D.f[dirBN ])[kbn ]; - f_TS = (D.f[dirTS ])[kts ]; - f_TNE = (D.f[dirTNE ])[ktne ]; - f_TSW = (D.f[dirTSW ])[ktsw ]; - f_TSE = (D.f[dirTSE ])[ktse ]; - f_TNW = (D.f[dirTNW ])[ktnw ]; - f_BNE = (D.f[dirBNE ])[kbne ]; - f_BSW = (D.f[dirBSW ])[kbsw ]; - f_BSE = (D.f[dirBSE ])[kbse ]; - f_BNW = (D.f[dirBNW ])[kbnw ]; + f_E = (D.f[DIR_P00 ])[ke ]; + f_W = (D.f[DIR_M00 ])[kw ]; + f_N = (D.f[DIR_0P0 ])[kn ]; + f_S = (D.f[DIR_0M0 ])[ks ]; + f_T = (D.f[DIR_00P ])[kt ]; + f_B = (D.f[DIR_00M ])[kb ]; + f_NE = (D.f[DIR_PP0 ])[kne ]; + f_SW = (D.f[DIR_MM0 ])[ksw ]; + f_SE = (D.f[DIR_PM0 ])[kse ]; + f_NW = (D.f[DIR_MP0 ])[knw ]; + f_TE = (D.f[DIR_P0P ])[kte ]; + f_BW = (D.f[DIR_M0M ])[kbw ]; + f_BE = (D.f[DIR_P0M ])[kbe ]; + f_TW = (D.f[DIR_M0P ])[ktw ]; + f_TN = (D.f[DIR_0PP ])[ktn ]; + f_BS = (D.f[DIR_0MM ])[kbs ]; + f_BN = (D.f[DIR_0PM ])[kbn ]; + f_TS = (D.f[DIR_0MP ])[kts ]; + f_TNE = (D.f[DIR_PPP ])[ktne ]; + f_TSW = (D.f[DIR_MMP ])[ktsw ]; + f_TSE = (D.f[DIR_PMP ])[ktse ]; + f_TNW = (D.f[DIR_MPP ])[ktnw ]; + f_BNE = (D.f[DIR_PPM ])[kbne ]; + f_BSW = (D.f[DIR_MMM ])[kbsw ]; + f_BSE = (D.f[DIR_PMM ])[kbse ]; + f_BNW = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -1328,69 +1326,69 @@ extern "C" __global__ void QVelDeviceIncompHighNu27(int inx, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3);// * (one + drho); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Test - //(D.f[dirZERO])[k]=c1o10; + //(D.f[DIR_000])[k]=c1o10; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //ToDo anders Klammern @@ -1399,182 +1397,182 @@ extern "C" __global__ void QVelDeviceIncompHighNu27(int inx, if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) /** (one + drho)*/-cu_sq); - (D.f[dirW])[kw]=((c1o1 - q) * f_E + q * ((f_E + f_W) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloX )) / (q + c1o1) ; + (D.f[DIR_M00])[kw]=((c1o1 - q) * f_E + q * ((f_E + f_W) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloX )) / (q + c1o1) ; } q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) /** (one + drho)*/-cu_sq); - (D.f[dirE])[ke]=((c1o1 - q) * f_W + q * ((f_W + f_E) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloX )) / (q + c1o1) ; + (D.f[DIR_P00])[ke]=((c1o1 - q) * f_W + q * ((f_W + f_E) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloX )) / (q + c1o1) ; } q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirS])[ks]=((c1o1 - q) * f_N + q * ((f_N + f_S) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloY )) / (q + c1o1) ; + (D.f[DIR_0M0])[ks]=((c1o1 - q) * f_N + q * ((f_N + f_S) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloY )) / (q + c1o1) ; } q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirN])[kn]=((c1o1 - q) * f_S + q * ((f_S + f_N) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloY )) / (q + c1o1) ; + (D.f[DIR_0P0])[kn]=((c1o1 - q) * f_S + q * ((f_S + f_N) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloY )) / (q + c1o1) ; } q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) /** (one + drho)*/-cu_sq); - (D.f[dirB])[kb]=((c1o1 - q) * f_T + q * ((f_T + f_B) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloZ )) / (q + c1o1) ; + (D.f[DIR_00M])[kb]=((c1o1 - q) * f_T + q * ((f_T + f_B) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloZ )) / (q + c1o1) ; } q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) /** (one + drho)*/-cu_sq); - (D.f[dirT])[kt]=((c1o1 - q) * f_B + q * ((f_B + f_T) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloZ )) / (q + c1o1) ; + (D.f[DIR_00P])[kt]=((c1o1 - q) * f_B + q * ((f_B + f_T) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloZ )) / (q + c1o1) ; } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirSW])[ksw]=((c1o1 - q) * f_NE + q * ((f_NE + f_SW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloY)) / (q + c1o1) ; + (D.f[DIR_MM0])[ksw]=((c1o1 - q) * f_NE + q * ((f_NE + f_SW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloY)) / (q + c1o1) ; } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirNE])[kne]=((c1o1 - q) * f_SW + q * ((f_SW + f_NE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloY)) / (q + c1o1) ; + (D.f[DIR_PP0])[kne]=((c1o1 - q) * f_SW + q * ((f_SW + f_NE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloY)) / (q + c1o1) ; } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirNW])[knw]=((c1o1 - q) * f_SE + q * ((f_SE + f_NW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloY)) / (q + c1o1) ; + (D.f[DIR_MP0])[knw]=((c1o1 - q) * f_SE + q * ((f_SE + f_NW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloY)) / (q + c1o1) ; } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) /** (one + drho)*/-cu_sq); - (D.f[dirSE])[kse]=((c1o1 - q) * f_NW + q * ((f_NW + f_SE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloY)) / (q + c1o1) ; + (D.f[DIR_PM0])[kse]=((c1o1 - q) * f_NW + q * ((f_NW + f_SE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloY)) / (q + c1o1) ; } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBW])[kbw]=((c1o1 - q) * f_TE + q * ((f_TE + f_BW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloZ)) / (q + c1o1) ; + (D.f[DIR_M0M])[kbw]=((c1o1 - q) * f_TE + q * ((f_TE + f_BW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloZ)) / (q + c1o1) ; } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTE])[kte]=((c1o1 - q) * f_BW + q * ((f_BW + f_TE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloZ)) / (q + c1o1) ; + (D.f[DIR_P0P])[kte]=((c1o1 - q) * f_BW + q * ((f_BW + f_TE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloZ)) / (q + c1o1) ; } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTW])[ktw]=((c1o1 - q) * f_BE + q * ((f_BE + f_TW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloZ)) / (q + c1o1) ; + (D.f[DIR_M0P])[ktw]=((c1o1 - q) * f_BE + q * ((f_BE + f_TW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloZ)) / (q + c1o1) ; } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBE])[kbe]=((c1o1 - q) * f_TW + q * ((f_TW + f_BE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloZ)) / (q + c1o1) ; + (D.f[DIR_P0M])[kbe]=((c1o1 - q) * f_TW + q * ((f_TW + f_BE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloZ)) / (q + c1o1) ; } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBS])[kbs]=((c1o1 - q) * f_TN + q * ((f_TN + f_BS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_0MM])[kbs]=((c1o1 - q) * f_TN + q * ((f_TN + f_BS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY+VeloZ)) / (q + c1o1) ; } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTN])[ktn]=((c1o1 - q) * f_BS + q * ((f_BS + f_TN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_0PP])[ktn]=((c1o1 - q) * f_BS + q * ((f_BS + f_TN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTS])[kts]=((c1o1 - q) * f_BN + q * ((f_BN + f_TS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_0MP])[kts]=((c1o1 - q) * f_BN + q * ((f_BN + f_TS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBN])[kbn]=((c1o1 - q) * f_TS + q * ((f_TS + f_BN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_0PM])[kbn]=((c1o1 - q) * f_TS + q * ((f_TS + f_BN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY+VeloZ)) / (q + c1o1) ; } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBSW])[kbsw]=((c1o1 - q) * f_TNE + q * ((f_TNE + f_BSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_MMM])[kbsw]=((c1o1 - q) * f_TNE + q * ((f_TNE + f_BSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY+VeloZ)) / (q + c1o1) ; } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTNE])[ktne]=((c1o1 - q) * f_BSW + q * ((f_BSW + f_TNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_PPP])[ktne]=((c1o1 - q) * f_BSW + q * ((f_BSW + f_TNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTSW])[ktsw]=((c1o1 - q) * f_BNE + q * ((f_BNE + f_TSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_MMP])[ktsw]=((c1o1 - q) * f_BNE + q * ((f_BNE + f_TSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBNE])[kbne]=((c1o1 - q) * f_TSW + q * ((f_TSW + f_BNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_PPM])[kbne]=((c1o1 - q) * f_TSW + q * ((f_TSW + f_BNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY+VeloZ)) / (q + c1o1) ; } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBNW])[kbnw]=((c1o1 - q) * f_TSE + q * ((f_TSE + f_BNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_MPM])[kbnw]=((c1o1 - q) * f_TSE + q * ((f_TSE + f_BNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY+VeloZ)) / (q + c1o1) ; } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTSE])[ktse]=((c1o1 - q) * f_BNW + q * ((f_BNW + f_TSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_PMP])[ktse]=((c1o1 - q) * f_BNW + q * ((f_BNW + f_TSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) /** (one + drho)*/-cu_sq); - (D.f[dirTNW])[ktnw]=((c1o1 - q) * f_BSE + q * ((f_BSE + f_TNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY-VeloZ)) / (q + c1o1) ; + (D.f[DIR_MPP])[ktnw]=((c1o1 - q) * f_BSE + q * ((f_BSE + f_TNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY-VeloZ)) / (q + c1o1) ; } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) /** (one + drho)*/-cu_sq); - (D.f[dirBSE])[kbse]=((c1o1 - q) * f_TNW + q * ((f_TNW + f_BSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY+VeloZ)) / (q + c1o1) ; + (D.f[DIR_PMM])[kbse]=((c1o1 - q) * f_TNW + q * ((f_TNW + f_BSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY+VeloZ)) / (q + c1o1) ; } } } @@ -1619,83 +1617,81 @@ extern "C" __global__ void QVelDeviceIncompHighNu27(int inx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVelDeviceCompHighNu27( int inx, - int iny, +__global__ void QVelDeviceCompHighNu27( real* vx, real* vy, real* vz, - real* DD, - int* k_Q, + real* DD, + int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, - real om1, + unsigned int numberOfBCnodes, + real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -1708,7 +1704,7 @@ extern "C" __global__ void QVelDeviceCompHighNu27( int inx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real VeloX = vx[k]; @@ -1720,32 +1716,32 @@ extern "C" __global__ void QVelDeviceCompHighNu27( int inx, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -1780,63 +1776,63 @@ extern "C" __global__ void QVelDeviceCompHighNu27( int inx, real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_E = (D.f[dirE ])[ke ]; - f_W = (D.f[dirW ])[kw ]; - f_N = (D.f[dirN ])[kn ]; - f_S = (D.f[dirS ])[ks ]; - f_T = (D.f[dirT ])[kt ]; - f_B = (D.f[dirB ])[kb ]; - f_NE = (D.f[dirNE ])[kne ]; - f_SW = (D.f[dirSW ])[ksw ]; - f_SE = (D.f[dirSE ])[kse ]; - f_NW = (D.f[dirNW ])[knw ]; - f_TE = (D.f[dirTE ])[kte ]; - f_BW = (D.f[dirBW ])[kbw ]; - f_BE = (D.f[dirBE ])[kbe ]; - f_TW = (D.f[dirTW ])[ktw ]; - f_TN = (D.f[dirTN ])[ktn ]; - f_BS = (D.f[dirBS ])[kbs ]; - f_BN = (D.f[dirBN ])[kbn ]; - f_TS = (D.f[dirTS ])[kts ]; - f_TNE = (D.f[dirTNE ])[ktne ]; - f_TSW = (D.f[dirTSW ])[ktsw ]; - f_TSE = (D.f[dirTSE ])[ktse ]; - f_TNW = (D.f[dirTNW ])[ktnw ]; - f_BNE = (D.f[dirBNE ])[kbne ]; - f_BSW = (D.f[dirBSW ])[kbsw ]; - f_BSE = (D.f[dirBSE ])[kbse ]; - f_BNW = (D.f[dirBNW ])[kbnw ]; - //f_W = (D.f[dirE ])[ke ]; - //f_E = (D.f[dirW ])[kw ]; - //f_S = (D.f[dirN ])[kn ]; - //f_N = (D.f[dirS ])[ks ]; - //f_B = (D.f[dirT ])[kt ]; - //f_T = (D.f[dirB ])[kb ]; - //f_SW = (D.f[dirNE ])[kne ]; - //f_NE = (D.f[dirSW ])[ksw ]; - //f_NW = (D.f[dirSE ])[kse ]; - //f_SE = (D.f[dirNW ])[knw ]; - //f_BW = (D.f[dirTE ])[kte ]; - //f_TE = (D.f[dirBW ])[kbw ]; - //f_TW = (D.f[dirBE ])[kbe ]; - //f_BE = (D.f[dirTW ])[ktw ]; - //f_BS = (D.f[dirTN ])[ktn ]; - //f_TN = (D.f[dirBS ])[kbs ]; - //f_TS = (D.f[dirBN ])[kbn ]; - //f_BN = (D.f[dirTS ])[kts ]; - //f_BSW = (D.f[dirTNE ])[ktne ]; - //f_BNE = (D.f[dirTSW ])[ktsw ]; - //f_BNW = (D.f[dirTSE ])[ktse ]; - //f_BSE = (D.f[dirTNW ])[ktnw ]; - //f_TSW = (D.f[dirBNE ])[kbne ]; - //f_TNE = (D.f[dirBSW ])[kbsw ]; - //f_TNW = (D.f[dirBSE ])[kbse ]; - //f_TSE = (D.f[dirBNW ])[kbnw ]; + f_E = (D.f[DIR_P00 ])[ke ]; + f_W = (D.f[DIR_M00 ])[kw ]; + f_N = (D.f[DIR_0P0 ])[kn ]; + f_S = (D.f[DIR_0M0 ])[ks ]; + f_T = (D.f[DIR_00P ])[kt ]; + f_B = (D.f[DIR_00M ])[kb ]; + f_NE = (D.f[DIR_PP0 ])[kne ]; + f_SW = (D.f[DIR_MM0 ])[ksw ]; + f_SE = (D.f[DIR_PM0 ])[kse ]; + f_NW = (D.f[DIR_MP0 ])[knw ]; + f_TE = (D.f[DIR_P0P ])[kte ]; + f_BW = (D.f[DIR_M0M ])[kbw ]; + f_BE = (D.f[DIR_P0M ])[kbe ]; + f_TW = (D.f[DIR_M0P ])[ktw ]; + f_TN = (D.f[DIR_0PP ])[ktn ]; + f_BS = (D.f[DIR_0MM ])[kbs ]; + f_BN = (D.f[DIR_0PM ])[kbn ]; + f_TS = (D.f[DIR_0MP ])[kts ]; + f_TNE = (D.f[DIR_PPP ])[ktne ]; + f_TSW = (D.f[DIR_MMP ])[ktsw ]; + f_TSE = (D.f[DIR_PMP ])[ktse ]; + f_TNW = (D.f[DIR_MPP ])[ktnw ]; + f_BNE = (D.f[DIR_PPM ])[kbne ]; + f_BSW = (D.f[DIR_MMM ])[kbsw ]; + f_BSE = (D.f[DIR_PMM ])[kbse ]; + f_BNW = (D.f[DIR_MPM ])[kbnw ]; + //f_W = (D.f[DIR_P00 ])[ke ]; + //f_E = (D.f[DIR_M00 ])[kw ]; + //f_S = (D.f[DIR_0P0 ])[kn ]; + //f_N = (D.f[DIR_0M0 ])[ks ]; + //f_B = (D.f[DIR_00P ])[kt ]; + //f_T = (D.f[DIR_00M ])[kb ]; + //f_SW = (D.f[DIR_PP0 ])[kne ]; + //f_NE = (D.f[DIR_MM0 ])[ksw ]; + //f_NW = (D.f[DIR_PM0 ])[kse ]; + //f_SE = (D.f[DIR_MP0 ])[knw ]; + //f_BW = (D.f[DIR_P0P ])[kte ]; + //f_TE = (D.f[DIR_M0M ])[kbw ]; + //f_TW = (D.f[DIR_P0M ])[kbe ]; + //f_BE = (D.f[DIR_M0P ])[ktw ]; + //f_BS = (D.f[DIR_0PP ])[ktn ]; + //f_TN = (D.f[DIR_0MM ])[kbs ]; + //f_TS = (D.f[DIR_0PM ])[kbn ]; + //f_BN = (D.f[DIR_0MP ])[kts ]; + //f_BSW = (D.f[DIR_PPP ])[ktne ]; + //f_BNE = (D.f[DIR_MMP ])[ktsw ]; + //f_BNW = (D.f[DIR_PMP ])[ktse ]; + //f_BSE = (D.f[DIR_MPP ])[ktnw ]; + //f_TSW = (D.f[DIR_PPM ])[kbne ]; + //f_TNE = (D.f[DIR_MMM ])[kbsw ]; + //f_TNW = (D.f[DIR_PMM ])[kbse ]; + //f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -1854,69 +1850,69 @@ extern "C" __global__ void QVelDeviceCompHighNu27( int inx, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Test - //(D.f[dirZERO])[k]=c1o10; + //(D.f[DIR_000])[k]=c1o10; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //ToDo anders Klammern @@ -1925,234 +1921,234 @@ extern "C" __global__ void QVelDeviceCompHighNu27( int inx, if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw]=((c1o1 - q) * f_E + q * ((f_E + f_W) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloX )) / (q + c1o1) ; - //(D.f[dirW])[kw]=(one-q)/(one+q)*(f_E-f_W+(f_E+f_W-two*feq*om1)/(one-om1))*c1o2+(q*(f_E+f_W)-six*c2over27*( VeloX ))/(one+q) - c2over27 * drho; - //(D.f[dirW])[kw]=zero; + (D.f[DIR_M00])[kw]=((c1o1 - q) * f_E + q * ((f_E + f_W) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloX )) / (q + c1o1) ; + //(D.f[DIR_M00])[kw]=(one-q)/(one+q)*(f_E-f_W+(f_E+f_W-two*feq*om1)/(one-om1))*c1o2+(q*(f_E+f_W)-six*c2over27*( VeloX ))/(one+q) - c2over27 * drho; + //(D.f[DIR_M00])[kw]=zero; } q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirE])[ke]=((c1o1 - q) * f_W + q * ((f_W + f_E) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloX )) / (q + c1o1) ; - //(D.f[dirE])[ke]=(one-q)/(one+q)*(f_W-f_E+(f_W+f_E-two*feq*om1)/(one-om1))*c1o2+(q*(f_W+f_E)-six*c2over27*(-VeloX ))/(one+q) - c2over27 * drho; - //(D.f[dirE])[ke]=zero; + (D.f[DIR_P00])[ke]=((c1o1 - q) * f_W + q * ((f_W + f_E) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloX )) / (q + c1o1) ; + //(D.f[DIR_P00])[ke]=(one-q)/(one+q)*(f_W-f_E+(f_W+f_E-two*feq*om1)/(one-om1))*c1o2+(q*(f_W+f_E)-six*c2over27*(-VeloX ))/(one+q) - c2over27 * drho; + //(D.f[DIR_P00])[ke]=zero; } q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirS])[ks]=((c1o1 - q) * f_N + q * ((f_N + f_S) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloY )) / (q + c1o1) ; - //(D.f[dirS])[ks]=(one-q)/(one+q)*(f_N-f_S+(f_N+f_S-two*feq*om1)/(one-om1))*c1o2+(q*(f_N+f_S)-six*c2over27*( VeloY ))/(one+q) - c2over27 * drho; - //(D.f[dirS])[ks]=zero; + (D.f[DIR_0M0])[ks]=((c1o1 - q) * f_N + q * ((f_N + f_S) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloY )) / (q + c1o1) ; + //(D.f[DIR_0M0])[ks]=(one-q)/(one+q)*(f_N-f_S+(f_N+f_S-two*feq*om1)/(one-om1))*c1o2+(q*(f_N+f_S)-six*c2over27*( VeloY ))/(one+q) - c2over27 * drho; + //(D.f[DIR_0M0])[ks]=zero; } q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirN])[kn]=((c1o1 - q) * f_S + q * ((f_S + f_N) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloY )) / (q + c1o1) ; - //(D.f[dirN])[kn]=(one-q)/(one+q)*(f_S-f_N+(f_S+f_N-two*feq*om1)/(one-om1))*c1o2+(q*(f_S+f_N)-six*c2over27*(-VeloY ))/(one+q) - c2over27 * drho; - //(D.f[dirN])[kn]=zero; + (D.f[DIR_0P0])[kn]=((c1o1 - q) * f_S + q * ((f_S + f_N) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloY )) / (q + c1o1) ; + //(D.f[DIR_0P0])[kn]=(one-q)/(one+q)*(f_S-f_N+(f_S+f_N-two*feq*om1)/(one-om1))*c1o2+(q*(f_S+f_N)-six*c2over27*(-VeloY ))/(one+q) - c2over27 * drho; + //(D.f[DIR_0P0])[kn]=zero; } q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirB])[kb]=((c1o1 - q) * f_T + q * ((f_T + f_B) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloZ )) / (q + c1o1) ; - //(D.f[dirB])[kb]=(one-q)/(one+q)*(f_T-f_B+(f_T+f_B-two*feq*om1)/(one-om1))*c1o2+(q*(f_T+f_B)-six*c2over27*( VeloZ ))/(one+q) - c2over27 * drho; - //(D.f[dirB])[kb]=one; + (D.f[DIR_00M])[kb]=((c1o1 - q) * f_T + q * ((f_T + f_B) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*( VeloZ )) / (q + c1o1) ; + //(D.f[DIR_00M])[kb]=(one-q)/(one+q)*(f_T-f_B+(f_T+f_B-two*feq*om1)/(one-om1))*c1o2+(q*(f_T+f_B)-six*c2over27*( VeloZ ))/(one+q) - c2over27 * drho; + //(D.f[DIR_00M])[kb]=one; } q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirT])[kt]=((c1o1 - q) * f_B + q * ((f_B + f_T) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloZ )) / (q + c1o1) ; - //(D.f[dirT])[kt]=(one-q)/(one+q)*(f_B-f_T+(f_B+f_T-two*feq*om1)/(one-om1))*c1o2+(q*(f_B+f_T)-six*c2over27*(-VeloZ ))/(one+q) - c2over27 * drho; - //(D.f[dirT])[kt]=zero; + (D.f[DIR_00P])[kt]=((c1o1 - q) * f_B + q * ((f_B + f_T) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c2o27*(-VeloZ )) / (q + c1o1) ; + //(D.f[DIR_00P])[kt]=(one-q)/(one+q)*(f_B-f_T+(f_B+f_T-two*feq*om1)/(one-om1))*c1o2+(q*(f_B+f_T)-six*c2over27*(-VeloZ ))/(one+q) - c2over27 * drho; + //(D.f[DIR_00P])[kt]=zero; } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]=((c1o1 - q) * f_NE + q * ((f_NE + f_SW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloY)) / (q + c1o1) ; - //(D.f[dirSW])[ksw]=(one-q)/(one+q)*(f_NE-f_SW+(f_NE+f_SW-two*feq*om1)/(one-om1))*c1o2+(q*(f_NE+f_SW)-six*c1over54*(VeloX+VeloY))/(one+q) - c1over54 * drho; - //(D.f[dirSW])[ksw]=zero; + (D.f[DIR_MM0])[ksw]=((c1o1 - q) * f_NE + q * ((f_NE + f_SW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloY)) / (q + c1o1) ; + //(D.f[DIR_MM0])[ksw]=(one-q)/(one+q)*(f_NE-f_SW+(f_NE+f_SW-two*feq*om1)/(one-om1))*c1o2+(q*(f_NE+f_SW)-six*c1over54*(VeloX+VeloY))/(one+q) - c1over54 * drho; + //(D.f[DIR_MM0])[ksw]=zero; } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]=((c1o1 - q) * f_SW + q * ((f_SW + f_NE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloY)) / (q + c1o1) ; - //(D.f[dirNE])[kne]=(one-q)/(one+q)*(f_SW-f_NE+(f_SW+f_NE-two*feq*om1)/(one-om1))*c1o2+(q*(f_SW+f_NE)-six*c1over54*(-VeloX-VeloY))/(one+q) - c1over54 * drho; - //(D.f[dirNE])[kne]=zero; + (D.f[DIR_PP0])[kne]=((c1o1 - q) * f_SW + q * ((f_SW + f_NE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloY)) / (q + c1o1) ; + //(D.f[DIR_PP0])[kne]=(one-q)/(one+q)*(f_SW-f_NE+(f_SW+f_NE-two*feq*om1)/(one-om1))*c1o2+(q*(f_SW+f_NE)-six*c1over54*(-VeloX-VeloY))/(one+q) - c1over54 * drho; + //(D.f[DIR_PP0])[kne]=zero; } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]=((c1o1 - q) * f_SE + q * ((f_SE + f_NW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloY)) / (q + c1o1) ; - //(D.f[dirNW])[knw]=(one-q)/(one+q)*(f_SE-f_NW+(f_SE+f_NW-two*feq*om1)/(one-om1))*c1o2+(q*(f_SE+f_NW)-six*c1over54*( VeloX-VeloY))/(one+q) - c1over54 * drho; - //(D.f[dirNW])[knw]=zero; + (D.f[DIR_MP0])[knw]=((c1o1 - q) * f_SE + q * ((f_SE + f_NW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloY)) / (q + c1o1) ; + //(D.f[DIR_MP0])[knw]=(one-q)/(one+q)*(f_SE-f_NW+(f_SE+f_NW-two*feq*om1)/(one-om1))*c1o2+(q*(f_SE+f_NW)-six*c1over54*( VeloX-VeloY))/(one+q) - c1over54 * drho; + //(D.f[DIR_MP0])[knw]=zero; } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]=((c1o1 - q) * f_NW + q * ((f_NW + f_SE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloY)) / (q + c1o1) ; - //(D.f[dirSE])[kse]=(one-q)/(one+q)*(f_NW-f_SE+(f_NW+f_SE-two*feq*om1)/(one-om1))*c1o2+(q*(f_NW+f_SE)-six*c1over54*(-VeloX+VeloY))/(one+q) - c1over54 * drho; - //(D.f[dirSE])[kse]=zero; + (D.f[DIR_PM0])[kse]=((c1o1 - q) * f_NW + q * ((f_NW + f_SE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloY)) / (q + c1o1) ; + //(D.f[DIR_PM0])[kse]=(one-q)/(one+q)*(f_NW-f_SE+(f_NW+f_SE-two*feq*om1)/(one-om1))*c1o2+(q*(f_NW+f_SE)-six*c1over54*(-VeloX+VeloY))/(one+q) - c1over54 * drho; + //(D.f[DIR_PM0])[kse]=zero; } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]=((c1o1 - q) * f_TE + q * ((f_TE + f_BW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloZ)) / (q + c1o1) ; - //(D.f[dirBW])[kbw]=(one-q)/(one+q)*(f_TE-f_BW+(f_TE+f_BW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TE+f_BW)-six*c1over54*( VeloX+VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirBW])[kbw]=zero; + (D.f[DIR_M0M])[kbw]=((c1o1 - q) * f_TE + q * ((f_TE + f_BW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_M0M])[kbw]=(one-q)/(one+q)*(f_TE-f_BW+(f_TE+f_BW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TE+f_BW)-six*c1over54*( VeloX+VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_M0M])[kbw]=zero; } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]=((c1o1 - q) * f_BW + q * ((f_BW + f_TE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloZ)) / (q + c1o1) ; - //(D.f[dirTE])[kte]=(one-q)/(one+q)*(f_BW-f_TE+(f_BW+f_TE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BW+f_TE)-six*c1over54*(-VeloX-VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirTE])[kte]=zero; + (D.f[DIR_P0P])[kte]=((c1o1 - q) * f_BW + q * ((f_BW + f_TE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_P0P])[kte]=(one-q)/(one+q)*(f_BW-f_TE+(f_BW+f_TE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BW+f_TE)-six*c1over54*(-VeloX-VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_P0P])[kte]=zero; } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]=((c1o1 - q) * f_BE + q * ((f_BE + f_TW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloZ)) / (q + c1o1) ; - //(D.f[dirTW])[ktw]=(one-q)/(one+q)*(f_BE-f_TW+(f_BE+f_TW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BE+f_TW)-six*c1over54*( VeloX-VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirTW])[ktw]=zero; + (D.f[DIR_M0P])[ktw]=((c1o1 - q) * f_BE + q * ((f_BE + f_TW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloX-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_M0P])[ktw]=(one-q)/(one+q)*(f_BE-f_TW+(f_BE+f_TW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BE+f_TW)-six*c1over54*( VeloX-VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_M0P])[ktw]=zero; } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]=((c1o1 - q) * f_TW + q * ((f_TW + f_BE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloZ)) / (q + c1o1) ; - //(D.f[dirBE])[kbe]=(one-q)/(one+q)*(f_TW-f_BE+(f_TW+f_BE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TW+f_BE)-six*c1over54*(-VeloX+VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirBE])[kbe]=zero; + (D.f[DIR_P0M])[kbe]=((c1o1 - q) * f_TW + q * ((f_TW + f_BE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloX+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_P0M])[kbe]=(one-q)/(one+q)*(f_TW-f_BE+(f_TW+f_BE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TW+f_BE)-six*c1over54*(-VeloX+VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_P0M])[kbe]=zero; } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]=((c1o1 - q) * f_TN + q * ((f_TN + f_BS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBS])[kbs]=(one-q)/(one+q)*(f_TN-f_BS+(f_TN+f_BS-two*feq*om1)/(one-om1))*c1o2+(q*(f_TN+f_BS)-six*c1over54*( VeloY+VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirBS])[kbs]=zero; + (D.f[DIR_0MM])[kbs]=((c1o1 - q) * f_TN + q * ((f_TN + f_BS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_0MM])[kbs]=(one-q)/(one+q)*(f_TN-f_BS+(f_TN+f_BS-two*feq*om1)/(one-om1))*c1o2+(q*(f_TN+f_BS)-six*c1over54*( VeloY+VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_0MM])[kbs]=zero; } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]=((c1o1 - q) * f_BS + q * ((f_BS + f_TN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTN])[ktn]=(one-q)/(one+q)*(f_BS-f_TN+(f_BS+f_TN-two*feq*om1)/(one-om1))*c1o2+(q*(f_BS+f_TN)-six*c1over54*( -VeloY-VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirTN])[ktn]=zero; + (D.f[DIR_0PP])[ktn]=((c1o1 - q) * f_BS + q * ((f_BS + f_TN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_0PP])[ktn]=(one-q)/(one+q)*(f_BS-f_TN+(f_BS+f_TN-two*feq*om1)/(one-om1))*c1o2+(q*(f_BS+f_TN)-six*c1over54*( -VeloY-VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_0PP])[ktn]=zero; } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]=((c1o1 - q) * f_BN + q * ((f_BN + f_TS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTS])[kts]=(one-q)/(one+q)*(f_BN-f_TS+(f_BN+f_TS-two*feq*om1)/(one-om1))*c1o2+(q*(f_BN+f_TS)-six*c1over54*( VeloY-VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirTS])[kts]=zero; + (D.f[DIR_0MP])[kts]=((c1o1 - q) * f_BN + q * ((f_BN + f_TS) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*( VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_0MP])[kts]=(one-q)/(one+q)*(f_BN-f_TS+(f_BN+f_TS-two*feq*om1)/(one-om1))*c1o2+(q*(f_BN+f_TS)-six*c1over54*( VeloY-VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_0MP])[kts]=zero; } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]=((c1o1 - q) * f_TS + q * ((f_TS + f_BN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBN])[kbn]=(one-q)/(one+q)*(f_TS-f_BN+(f_TS+f_BN-two*feq*om1)/(one-om1))*c1o2+(q*(f_TS+f_BN)-six*c1over54*( -VeloY+VeloZ))/(one+q) - c1over54 * drho; - //(D.f[dirBN])[kbn]=zero; + (D.f[DIR_0PM])[kbn]=((c1o1 - q) * f_TS + q * ((f_TS + f_BN) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o54*(-VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_0PM])[kbn]=(one-q)/(one+q)*(f_TS-f_BN+(f_TS+f_BN-two*feq*om1)/(one-om1))*c1o2+(q*(f_TS+f_BN)-six*c1over54*( -VeloY+VeloZ))/(one+q) - c1over54 * drho; + //(D.f[DIR_0PM])[kbn]=zero; } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]=((c1o1 - q) * f_TNE + q * ((f_TNE + f_BSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBSW])[kbsw]=(one-q)/(one+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNE+f_BSW)-six*c1over216*( VeloX+VeloY+VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirBSW])[kbsw]=zero; + (D.f[DIR_MMM])[kbsw]=((c1o1 - q) * f_TNE + q * ((f_TNE + f_BSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_MMM])[kbsw]=(one-q)/(one+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNE+f_BSW)-six*c1over216*( VeloX+VeloY+VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_MMM])[kbsw]=zero; } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]=((c1o1 - q) * f_BSW + q * ((f_BSW + f_TNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTNE])[ktne]=(one-q)/(one+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSW+f_TNE)-six*c1over216*(-VeloX-VeloY-VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirTNE])[ktne]=zero; + (D.f[DIR_PPP])[ktne]=((c1o1 - q) * f_BSW + q * ((f_BSW + f_TNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_PPP])[ktne]=(one-q)/(one+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSW+f_TNE)-six*c1over216*(-VeloX-VeloY-VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_PPP])[ktne]=zero; } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]=((c1o1 - q) * f_BNE + q * ((f_BNE + f_TSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTSW])[ktsw]=(one-q)/(one+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNE+f_TSW)-six*c1over216*( VeloX+VeloY-VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirTSW])[ktsw]=zero; + (D.f[DIR_MMP])[ktsw]=((c1o1 - q) * f_BNE + q * ((f_BNE + f_TSW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX+VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_MMP])[ktsw]=(one-q)/(one+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNE+f_TSW)-six*c1over216*( VeloX+VeloY-VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_MMP])[ktsw]=zero; } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]=((c1o1 - q) * f_TSW + q * ((f_TSW + f_BNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBNE])[kbne]=(one-q)/(one+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSW+f_BNE)-six*c1over216*(-VeloX-VeloY+VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirBNE])[kbne]=zero; + (D.f[DIR_PPM])[kbne]=((c1o1 - q) * f_TSW + q * ((f_TSW + f_BNE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX-VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_PPM])[kbne]=(one-q)/(one+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSW+f_BNE)-six*c1over216*(-VeloX-VeloY+VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_PPM])[kbne]=zero; } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]=((c1o1 - q) * f_TSE + q * ((f_TSE + f_BNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBNW])[kbnw]=(one-q)/(one+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSE+f_BNW)-six*c1over216*( VeloX-VeloY+VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirBNW])[kbnw]=zero; + (D.f[DIR_MPM])[kbnw]=((c1o1 - q) * f_TSE + q * ((f_TSE + f_BNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_MPM])[kbnw]=(one-q)/(one+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSE+f_BNW)-six*c1over216*( VeloX-VeloY+VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_MPM])[kbnw]=zero; } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]=((c1o1 - q) * f_BNW + q * ((f_BNW + f_TSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTSE])[ktse]=(one-q)/(one+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNW+f_TSE)-six*c1over216*(-VeloX+VeloY-VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirTSE])[ktse]=zero; + (D.f[DIR_PMP])[ktse]=((c1o1 - q) * f_BNW + q * ((f_BNW + f_TSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_PMP])[ktse]=(one-q)/(one+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNW+f_TSE)-six*c1over216*(-VeloX+VeloY-VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_PMP])[ktse]=zero; } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]=((c1o1 - q) * f_BSE + q * ((f_BSE + f_TNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY-VeloZ)) / (q + c1o1) ; - //(D.f[dirTNW])[ktnw]=(one-q)/(one+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSE+f_TNW)-six*c1over216*( VeloX-VeloY-VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirTNW])[ktnw]=zero; + (D.f[DIR_MPP])[ktnw]=((c1o1 - q) * f_BSE + q * ((f_BSE + f_TNW) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*( VeloX-VeloY-VeloZ)) / (q + c1o1) ; + //(D.f[DIR_MPP])[ktnw]=(one-q)/(one+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSE+f_TNW)-six*c1over216*( VeloX-VeloY-VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_MPP])[ktnw]=zero; } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]=((c1o1 - q) * f_TNW + q * ((f_TNW + f_BSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY+VeloZ)) / (q + c1o1) ; - //(D.f[dirBSE])[kbse]=(one-q)/(one+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNW+f_BSE)-six*c1over216*(-VeloX+VeloY+VeloZ))/(one+q) - c1over216 * drho; - //(D.f[dirBSE])[kbse]=zero; + (D.f[DIR_PMM])[kbse]=((c1o1 - q) * f_TNW + q * ((f_TNW + f_BSE) * (c1o1 - om1) + om1 * c2o1 * feq) - c6o1*c1o216*(-VeloX+VeloY+VeloZ)) / (q + c1o1) ; + //(D.f[DIR_PMM])[kbse]=(one-q)/(one+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNW+f_BSE)-six*c1over216*(-VeloX+VeloY+VeloZ))/(one+q) - c1over216 * drho; + //(D.f[DIR_PMM])[kbse]=zero; } } } @@ -2197,136 +2193,67 @@ extern "C" __global__ void QVelDeviceCompHighNu27( int inx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVelDeviceCompZeroPress27( int inx, - int iny, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - //int kQ, - real om1, +__global__ void QVelDeviceCompZeroPress27( + real* velocityX, + real* velocityY, + real* velocityZ, + real* distribution, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int numberOfLBnodes, + bool isEvenTimestep) { - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index + ////////////////////////////////////////////////////////////////////////// + //! The velocity boundary condition is executed in the following steps + //! + //////////////////////////////////////////////////////////////////////////////// + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index const unsigned nx = blockDim.x; const unsigned ny = gridDim.x; const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - if(k<sizeQ/*kQ*/) + ////////////////////////////////////////////////////////////////////////// + //! - Run for all indices in size of boundary condition (numberOfBCnodes) + //! + if(k < numberOfBCnodes) { + + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + getPointersToDistributions(dist, distribution, numberOfLBnodes, isEvenTimestep); + //////////////////////////////////////////////////////////////////////////////// - real VeloX = vx[k]; - real VeloY = vy[k]; - real VeloZ = vz[k]; //(16.0*(u0*2.0)*bbx*bby*(grid_nx-bbx)*(grid_ny-bby))/(grid_nx*grid_nx*grid_ny*grid_ny) + //! - Set local velocities + //! + real VeloX = velocityX[k]; + real VeloY = velocityY[k]; + real VeloZ = velocityZ[k]; + + //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + //! - Set local subgrid distances (q's) + //! + SubgridDistances27 subgridD; + getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes); + //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; + //! - Set neighbor indices (necessary for indirect addressing) + //! + unsigned int KQK = subgridDistanceIndices[k]; unsigned int kzero= KQK; unsigned int ke = KQK; unsigned int kw = neighborX[KQK]; @@ -2354,331 +2281,299 @@ extern "C" __global__ void QVelDeviceCompZeroPress27( int inx, unsigned int kbne = kb; unsigned int ktne = KQK; unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, - f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// - real vx1, vx2, vx3, drho, feq, q; - drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + //! - Set local distributions + //! + real f_W = (dist.f[DIR_P00 ])[ke ]; + real f_E = (dist.f[DIR_M00 ])[kw ]; + real f_S = (dist.f[DIR_0P0 ])[kn ]; + real f_N = (dist.f[DIR_0M0 ])[ks ]; + real f_B = (dist.f[DIR_00P ])[kt ]; + real f_T = (dist.f[DIR_00M ])[kb ]; + real f_SW = (dist.f[DIR_PP0 ])[kne ]; + real f_NE = (dist.f[DIR_MM0 ])[ksw ]; + real f_NW = (dist.f[DIR_PM0 ])[kse ]; + real f_SE = (dist.f[DIR_MP0 ])[knw ]; + real f_BW = (dist.f[DIR_P0P ])[kte ]; + real f_TE = (dist.f[DIR_M0M ])[kbw ]; + real f_TW = (dist.f[DIR_P0M ])[kbe ]; + real f_BE = (dist.f[DIR_M0P ])[ktw ]; + real f_BS = (dist.f[DIR_0PP ])[ktn ]; + real f_TN = (dist.f[DIR_0MM ])[kbs ]; + real f_TS = (dist.f[DIR_0PM ])[kbn ]; + real f_BN = (dist.f[DIR_0MP ])[kts ]; + real f_BSW = (dist.f[DIR_PPP ])[ktne ]; + real f_BNE = (dist.f[DIR_MMP ])[ktsw ]; + real f_BNW = (dist.f[DIR_PMP ])[ktse ]; + real f_BSE = (dist.f[DIR_MPP ])[ktnw ]; + real f_TSW = (dist.f[DIR_PPM ])[kbne ]; + real f_TNE = (dist.f[DIR_MMM ])[kbsw ]; + real f_TNW = (dist.f[DIR_PMM ])[kbse ]; + real f_TSE = (dist.f[DIR_MPM ])[kbnw ]; - vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - (f_E - f_W)) / (c1o1 + drho); + //////////////////////////////////////////////////////////////////////////////// + //! - Calculate macroscopic quantities + //! + real drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((dist.f[DIR_000])[kzero]); + + real vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) / (c1o1 + drho); - vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - (f_N - f_S)) / (c1o1 + drho); - - vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - (f_T - f_B)) / (c1o1 + drho); + real vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) / (c1o1 + drho); + real vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) / (c1o1 + drho); + real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //ToDo anders Klammern + //////////////////////////////////////////////////////////////////////////////// + //! - change the pointer to write the results in the correct array + //! + getPointersToDistributions(dist, distribution, numberOfLBnodes, !isEvenTimestep); - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) + //////////////////////////////////////////////////////////////////////////////// + //! - Update distributions with subgrid distance (q) between zero and one + real feq, q, velocityLB, velocityBC; + q = (subgridD.q[DIR_P00])[k]; + if (q>=c0o1 && q<=c1o1) // only update distribution for q between zero and one { - feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ))/(c1o1+q) - c2o27 * drho; - //(D.f[dirW])[kw]=zero; + velocityLB = vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloX; + (dist.f[DIR_M00])[kw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_E, f_W, feq, omega, drho, velocityBC, c2o27); } - q = q_dirW[k]; + q = (subgridD.q[DIR_M00])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ))/(c1o1+q) - c2o27 * drho; - //(D.f[dirE])[ke]=zero; + velocityLB = -vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloX; + (dist.f[DIR_P00])[ke] = getInterpolatedDistributionForVeloWithPressureBC(q, f_W, f_E, feq, omega, drho, velocityBC, c2o27); } - q = q_dirN[k]; + q = (subgridD.q[DIR_0P0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ))/(c1o1+q) - c2o27 * drho; - //(D.f[dirS])[ks]=zero; + velocityLB = vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloY; + (dist.f[DIR_0M0])[ks] = getInterpolatedDistributionForVeloWithPressureBC(q, f_N, f_S, feq, omega, drho, velocityBC, c2o27); } - q = q_dirS[k]; + q = (subgridD.q[DIR_0M0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ))/(c1o1+q) - c2o27 * drho; - //(D.f[dirN])[kn]=zero; + velocityLB = -vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloY; + (dist.f[DIR_0P0])[kn] = getInterpolatedDistributionForVeloWithPressureBC(q, f_S, f_N, feq, omega, drho, velocityBC, c2o27); } - q = q_dirT[k]; + q = (subgridD.q[DIR_00P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ ))/(c1o1+q) - c2o27 * drho; - //(D.f[dirB])[kb]=one; + velocityLB = vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloZ; + (dist.f[DIR_00M])[kb] = getInterpolatedDistributionForVeloWithPressureBC(q, f_T, f_B, feq, omega, drho, velocityBC, c2o27); } - q = q_dirB[k]; + q = (subgridD.q[DIR_00M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ))/(c1o1+q) - c2o27 * drho; - //(D.f[dirT])[kt]=zero; + velocityLB = -vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloZ; + (dist.f[DIR_00P])[kt] = getInterpolatedDistributionForVeloWithPressureBC(q, f_B, f_T, feq, omega, drho, velocityBC, c2o27); } - q = q_dirNE[k]; + q = (subgridD.q[DIR_PP0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY))/(c1o1+q) - c1o54 * drho; - //(D.f[dirSW])[ksw]=zero; + velocityLB = vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX + VeloY; + (dist.f[DIR_MM0])[ksw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_NE, f_SW, feq, omega, drho, velocityBC, c1o54); } - q = q_dirSW[k]; + q = (subgridD.q[DIR_MM0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q) - c1o54 * drho; - //(D.f[dirNE])[kne]=zero; + velocityLB = -vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX - VeloY; + (dist.f[DIR_PP0])[kne] = getInterpolatedDistributionForVeloWithPressureBC(q, f_SW, f_NE, feq, omega, drho, velocityBC, c1o54); } - q = q_dirSE[k]; + q = (subgridD.q[DIR_PM0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q) - c1o54 * drho; - //(D.f[dirNW])[knw]=zero; + velocityLB = vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX - VeloY; + (dist.f[DIR_MP0])[knw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_SE, f_NW, feq, omega, drho, velocityBC, c1o54); } - q = q_dirNW[k]; + q = (subgridD.q[DIR_MP0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q) - c1o54 * drho; - //(D.f[dirSE])[kse]=zero; + velocityLB = -vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX + VeloY; + (dist.f[DIR_PM0])[kse] = getInterpolatedDistributionForVeloWithPressureBC(q, f_NW, f_SE, feq, omega, drho, velocityBC, c1o54); } - q = q_dirTE[k]; + q = (subgridD.q[DIR_P0P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q) - c1o54 * drho; - //(D.f[dirBW])[kbw]=zero; + velocityLB = vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX + VeloZ; + (dist.f[DIR_M0M])[kbw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TE, f_BW, feq, omega, drho, velocityBC, c1o54); } - q = q_dirBW[k]; + q = (subgridD.q[DIR_M0M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q) - c1o54 * drho; - //(D.f[dirTE])[kte]=zero; + velocityLB = -vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX - VeloZ; + (dist.f[DIR_P0P])[kte] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BW, f_TE, feq, omega, drho, velocityBC, c1o54); } - q = q_dirBE[k]; + q = (subgridD.q[DIR_P0M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q) - c1o54 * drho; - //(D.f[dirTW])[ktw]=zero; + velocityLB = vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX - VeloZ; + (dist.f[DIR_M0P])[ktw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BE, f_TW, feq, omega, drho, velocityBC, c1o54); } - q = q_dirTW[k]; + q = (subgridD.q[DIR_M0P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q) - c1o54 * drho; - //(D.f[dirBE])[kbe]=zero; + velocityLB = -vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX + VeloZ; + (dist.f[DIR_P0M])[kbe] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TW, f_BE, feq, omega, drho, velocityBC, c1o54); } - q = q_dirTN[k]; + q = (subgridD.q[DIR_0PP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q) - c1o54 * drho; - //(D.f[dirBS])[kbs]=zero; + velocityLB = vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloY + VeloZ; + (dist.f[DIR_0MM])[kbs] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TN, f_BS, feq, omega, drho, velocityBC, c1o54); } - q = q_dirBS[k]; + q = (subgridD.q[DIR_0MM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q) - c1o54 * drho; - //(D.f[dirTN])[ktn]=zero; + velocityLB = -vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloY - VeloZ; + (dist.f[DIR_0PP])[ktn] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BS, f_TN, feq, omega, drho, velocityBC, c1o54); } - q = q_dirBN[k]; + q = (subgridD.q[DIR_0PM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q) - c1o54 * drho; - //(D.f[dirTS])[kts]=zero; + velocityLB = vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloY - VeloZ; + (dist.f[DIR_0MP])[kts] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BN, f_TS, feq, omega, drho, velocityBC, c1o54); } - q = q_dirTS[k]; + q = (subgridD.q[DIR_0MP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q) - c1o54 * drho; - //(D.f[dirBN])[kbn]=zero; + velocityLB = -vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloY + VeloZ; + (dist.f[DIR_0PM])[kbn] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TS, f_BN, feq, omega, drho, velocityBC, c1o54); } - q = q_dirTNE[k]; + q = (subgridD.q[DIR_PPP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; - //(D.f[dirBSW])[kbsw]=zero; + velocityLB = vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX + VeloY + VeloZ; + (dist.f[DIR_MMM])[kbsw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TNE, f_BSW, feq, omega, drho, velocityBC, c1o216); } - q = q_dirBSW[k]; + q = (subgridD.q[DIR_MMM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; - //(D.f[dirTNE])[ktne]=zero; + velocityLB = -vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX - VeloY - VeloZ; + (dist.f[DIR_PPP])[ktne] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BSW, f_TNE, feq, omega, drho, velocityBC, c1o216); } - q = q_dirBNE[k]; + q = (subgridD.q[DIR_PPM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; - //(D.f[dirTSW])[ktsw]=zero; + velocityLB = vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX + VeloY - VeloZ; + (dist.f[DIR_MMP])[ktsw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BNE, f_TSW, feq, omega, drho, velocityBC, c1o216); } - q = q_dirTSW[k]; + q = (subgridD.q[DIR_MMP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; - //(D.f[dirBNE])[kbne]=zero; + velocityLB = -vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX - VeloY + VeloZ; + (dist.f[DIR_PPM])[kbne] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TSW, f_BNE, feq, omega, drho, velocityBC, c1o216); } - q = q_dirTSE[k]; + q = (subgridD.q[DIR_PMP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; - //(D.f[dirBNW])[kbnw]=zero; + velocityLB = vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX - VeloY + VeloZ; + (dist.f[DIR_MPM])[kbnw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TSE, f_BNW, feq, omega, drho, velocityBC, c1o216); } - q = q_dirBNW[k]; + q = (subgridD.q[DIR_MPM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; - //(D.f[dirTSE])[ktse]=zero; + velocityLB = -vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX + VeloY - VeloZ; + (dist.f[DIR_PMP])[ktse] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BNW, f_TSE, feq, omega, drho, velocityBC, c1o216); } - q = q_dirBSE[k]; + q = (subgridD.q[DIR_PMM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q) - c1o216 * drho; - //(D.f[dirTNW])[ktnw]=zero; + velocityLB = vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX - VeloY - VeloZ; + (dist.f[DIR_MPP])[ktnw] = getInterpolatedDistributionForVeloWithPressureBC(q, f_BSE, f_TNW, feq, omega, drho, velocityBC, c1o216); } - q = q_dirTNW[k]; + q = (subgridD.q[DIR_MPP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q) - c1o216 * drho; - //(D.f[dirBSE])[kbse]=zero; + velocityLB = -vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX + VeloY + VeloZ; + (dist.f[DIR_PMM])[kbse] = getInterpolatedDistributionForVeloWithPressureBC(q, f_TNW, f_BSE, feq, omega, drho, velocityBC, c1o216); } } } @@ -2720,10 +2615,11 @@ extern "C" __global__ void QVelDeviceCompZeroPress27( int inx, + ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVelDeviceCompZeroPress1h27( int inx, +__global__ void QVelDeviceCompZeroPress1h27( int inx, int iny, real* vx, real* vy, @@ -2731,8 +2627,7 @@ extern "C" __global__ void QVelDeviceCompZeroPress1h27( int inx, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, real Phi, real angularVelocity, @@ -2743,68 +2638,68 @@ extern "C" __global__ void QVelDeviceCompZeroPress1h27( int inx, real* coordY, real* coordZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -2817,7 +2712,7 @@ extern "C" __global__ void QVelDeviceCompZeroPress1h27( int inx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// //real VeloX = vx[k]; @@ -2843,32 +2738,32 @@ extern "C" __global__ void QVelDeviceCompZeroPress1h27( int inx, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -2900,65 +2795,65 @@ extern "C" __global__ void QVelDeviceCompZeroPress1h27( int inx, unsigned int ktne = KQK; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q, cu_sq; @@ -2975,182 +2870,182 @@ extern "C" __global__ void QVelDeviceCompZeroPress1h27( int inx, if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*( VeloXpur )+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw]= feq - c2o27 * drho; + (D.f[DIR_M00])[kw]= feq - c2o27 * drho; } q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*(-VeloXpur )+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirE])[ke]= feq - c2o27 * drho; + (D.f[DIR_P00])[ke]= feq - c2o27 * drho; } q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*( VeloYpur )+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirS])[ks]= feq - c2o27 * drho; + (D.f[DIR_0M0])[ks]= feq - c2o27 * drho; } q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*( -VeloYpur )+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirN])[kn]= feq - c2o27 * drho; + (D.f[DIR_0P0])[kn]= feq - c2o27 * drho; } q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirB])[kb]= feq - c2o27 * drho; + (D.f[DIR_00M])[kb]= feq - c2o27 * drho; } q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirT])[kt]= feq - c2o27 * drho; + (D.f[DIR_00P])[kt]= feq - c2o27 * drho; } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloXpur+VeloYpur )+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]= feq - c1o54 * drho; + (D.f[DIR_MM0])[ksw]= feq - c1o54 * drho; } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*(-VeloXpur-VeloYpur )+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]= feq - c1o54 * drho; + (D.f[DIR_PP0])[kne]= feq - c1o54 * drho; } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloXpur-VeloYpur )+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]= feq - c1o54 * drho; + (D.f[DIR_MP0])[knw]= feq - c1o54 * drho; } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*(-VeloXpur+VeloYpur )+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]= feq - c1o54 * drho; + (D.f[DIR_PM0])[kse]= feq - c1o54 * drho; } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloXpur +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]= feq - c1o54 * drho; + (D.f[DIR_M0M])[kbw]= feq - c1o54 * drho; } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*(-VeloXpur -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]= feq - c1o54 * drho; + (D.f[DIR_P0P])[kte]= feq - c1o54 * drho; } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloXpur -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]= feq - c1o54 * drho; + (D.f[DIR_M0P])[ktw]= feq - c1o54 * drho; } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*(-VeloXpur +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]= feq - c1o54 * drho; + (D.f[DIR_P0M])[kbe]= feq - c1o54 * drho; } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloYpur+vx3)+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]= feq - c1o54 * drho; + (D.f[DIR_0MM])[kbs]= feq - c1o54 * drho; } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( -VeloYpur-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]= feq - c1o54 * drho; + (D.f[DIR_0PP])[ktn]= feq - c1o54 * drho; } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloYpur-vx3)+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]= feq - c1o54 * drho; + (D.f[DIR_0MP])[kts]= feq - c1o54 * drho; } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( -VeloYpur+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]= feq - c1o54 * drho; + (D.f[DIR_0PM])[kbn]= feq - c1o54 * drho; } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*( VeloXpur+VeloYpur+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]= feq - c1o216 * drho; + (D.f[DIR_MMM])[kbsw]= feq - c1o216 * drho; } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*(-VeloXpur-VeloYpur-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]= feq - c1o216 * drho; + (D.f[DIR_PPP])[ktne]= feq - c1o216 * drho; } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*( VeloXpur+VeloYpur-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]= feq - c1o216 * drho; + (D.f[DIR_MMP])[ktsw]= feq - c1o216 * drho; } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*(-VeloXpur-VeloYpur+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]= feq - c1o216 * drho; + (D.f[DIR_PPM])[kbne]= feq - c1o216 * drho; } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*( VeloXpur-VeloYpur+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]= feq - c1o216 * drho; + (D.f[DIR_MPM])[kbnw]= feq - c1o216 * drho; } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*(-VeloXpur+VeloYpur-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]= feq - c1o216 * drho; + (D.f[DIR_PMP])[ktse]= feq - c1o216 * drho; } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*( VeloXpur-VeloYpur-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]= feq - c1o216 * drho; + (D.f[DIR_MPP])[ktnw]= feq - c1o216 * drho; } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*(-VeloXpur+VeloYpur+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]= feq - c1o216 * drho; + (D.f[DIR_PMM])[kbse]= feq - c1o216 * drho; } } } @@ -3195,7 +3090,7 @@ extern "C" __global__ void QVelDeviceCompZeroPress1h27( int inx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_BC_Vel_West_27( int nx, +__global__ void LB_BC_Vel_West_27( int nx, int ny, int nz, int itz, @@ -3205,7 +3100,7 @@ extern "C" __global__ void LB_BC_Vel_West_27( int nx, unsigned int* neighborZ, real* DD, unsigned int size_Mat, - bool evenOrOdd, + bool isEvenTimestep, real u0x, unsigned int grid_nx, unsigned int grid_ny, @@ -3228,65 +3123,65 @@ extern "C" __global__ void LB_BC_Vel_West_27( int nx, if( bcMatD[k] == GEO_VELO ) { Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==true) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -3405,33 +3300,33 @@ extern "C" __global__ void LB_BC_Vel_West_27( int nx, real f1_E,f1_W,f1_N,f1_S,f1_T,f1_B,f1_NE,f1_SW,f1_SE,f1_NW,f1_TE,f1_BW,f1_BE,f1_TW,f1_TN,f1_BS,f1_BN,f1_TS,f1_ZERO, f1_TNE,f1_TSW,f1_TSE,f1_TNW,f1_BNE,f1_BSW,f1_BSE,f1_BNW; - f1_W = (D.f[dirE ])[k1e ]; - f1_E = (D.f[dirW ])[k1w ]; - f1_S = (D.f[dirN ])[k1n ]; - f1_N = (D.f[dirS ])[k1s ]; - f1_B = (D.f[dirT ])[k1t ]; - f1_T = (D.f[dirB ])[k1b ]; - f1_SW = (D.f[dirNE ])[k1ne ]; - f1_NE = (D.f[dirSW ])[k1sw ]; - f1_NW = (D.f[dirSE ])[k1se ]; - f1_SE = (D.f[dirNW ])[k1nw ]; - f1_BW = (D.f[dirTE ])[k1te ]; - f1_TE = (D.f[dirBW ])[k1bw ]; - f1_TW = (D.f[dirBE ])[k1be ]; - f1_BE = (D.f[dirTW ])[k1tw ]; - f1_BS = (D.f[dirTN ])[k1tn ]; - f1_TN = (D.f[dirBS ])[k1bs ]; - f1_TS = (D.f[dirBN ])[k1bn ]; - f1_BN = (D.f[dirTS ])[k1ts ]; - f1_ZERO = (D.f[dirZERO])[k1zero]; - f1_BSW = (D.f[dirTNE ])[k1tne ]; - f1_BNE = (D.f[dirTSW ])[k1tsw ]; - f1_BNW = (D.f[dirTSE ])[k1tse ]; - f1_BSE = (D.f[dirTNW ])[k1tnw ]; - f1_TSW = (D.f[dirBNE ])[k1bne ]; - f1_TNE = (D.f[dirBSW ])[k1bsw ]; - f1_TNW = (D.f[dirBSE ])[k1bse ]; - f1_TSE = (D.f[dirBNW ])[k1bnw ]; + f1_W = (D.f[DIR_P00 ])[k1e ]; + f1_E = (D.f[DIR_M00 ])[k1w ]; + f1_S = (D.f[DIR_0P0 ])[k1n ]; + f1_N = (D.f[DIR_0M0 ])[k1s ]; + f1_B = (D.f[DIR_00P ])[k1t ]; + f1_T = (D.f[DIR_00M ])[k1b ]; + f1_SW = (D.f[DIR_PP0 ])[k1ne ]; + f1_NE = (D.f[DIR_MM0 ])[k1sw ]; + f1_NW = (D.f[DIR_PM0 ])[k1se ]; + f1_SE = (D.f[DIR_MP0 ])[k1nw ]; + f1_BW = (D.f[DIR_P0P ])[k1te ]; + f1_TE = (D.f[DIR_M0M ])[k1bw ]; + f1_TW = (D.f[DIR_P0M ])[k1be ]; + f1_BE = (D.f[DIR_M0P ])[k1tw ]; + f1_BS = (D.f[DIR_0PP ])[k1tn ]; + f1_TN = (D.f[DIR_0MM ])[k1bs ]; + f1_TS = (D.f[DIR_0PM ])[k1bn ]; + f1_BN = (D.f[DIR_0MP ])[k1ts ]; + f1_ZERO = (D.f[DIR_000])[k1zero]; + f1_BSW = (D.f[DIR_PPP ])[k1tne ]; + f1_BNE = (D.f[DIR_MMP ])[k1tsw ]; + f1_BNW = (D.f[DIR_PMP ])[k1tse ]; + f1_BSE = (D.f[DIR_MPP ])[k1tnw ]; + f1_TSW = (D.f[DIR_PPM ])[k1bne ]; + f1_TNE = (D.f[DIR_MMM ])[k1bsw ]; + f1_TNW = (D.f[DIR_PMM ])[k1bse ]; + f1_TSE = (D.f[DIR_MPM ])[k1bnw ]; real drho1 = f1_ZERO+f1_E+f1_W+f1_N+f1_S+f1_T+f1_B+f1_NE+f1_SW+f1_SE+f1_NW+f1_TE+f1_BW+f1_BE+f1_TW+f1_TN+f1_BS+f1_BN+f1_TS+ f1_TNE+f1_TSW+f1_TSE+f1_TNW+f1_BNE+f1_BSW+f1_BSE+f1_BNW; @@ -3447,33 +3342,33 @@ extern "C" __global__ void LB_BC_Vel_West_27( int nx, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D.f[dirZERO])[kzero] = c8o27* (drho-cu_sq); - (D.f[dirE ])[ke ] = c2o27* (drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - (D.f[dirW ])[kw ] = c2o27* (drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - (D.f[dirN ])[kn ] = c2o27* (drho+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - (D.f[dirS ])[ks ] = c2o27* (drho+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - (D.f[dirT ])[kt ] = c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - (D.f[dirB ])[kb ] = c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - (D.f[dirNE ])[kne ] = c1o54* (drho+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - (D.f[dirSW ])[ksw ] = c1o54* (drho+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - (D.f[dirSE ])[kse ] = c1o54* (drho+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - (D.f[dirNW ])[knw ] = c1o54* (drho+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - (D.f[dirTE ])[kte ] = c1o54* (drho+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - (D.f[dirBW ])[kbw ] = c1o54* (drho+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - (D.f[dirBE ])[kbe ] = c1o54* (drho+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - (D.f[dirTW ])[ktw ] = c1o54* (drho+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - (D.f[dirTN ])[ktn ] = c1o54* (drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - (D.f[dirBS ])[kbs ] = c1o54* (drho+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - (D.f[dirBN ])[kbn ] = c1o54* (drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - (D.f[dirTS ])[kts ] = c1o54* (drho+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - (D.f[dirTNE ])[ktne ] = c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - (D.f[dirBSW ])[kbsw ] = c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - (D.f[dirBNE ])[kbne ] = c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - (D.f[dirTSW ])[ktsw ] = c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - (D.f[dirTSE ])[ktse ] = c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - (D.f[dirBNW ])[kbnw ] = c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - (D.f[dirBSE ])[kbse ] = c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - (D.f[dirTNW ])[ktnw ] = c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + (D.f[DIR_000])[kzero] = c8o27* (drho-cu_sq); + (D.f[DIR_P00 ])[ke ] = c2o27* (drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + (D.f[DIR_M00 ])[kw ] = c2o27* (drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + (D.f[DIR_0P0 ])[kn ] = c2o27* (drho+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + (D.f[DIR_0M0 ])[ks ] = c2o27* (drho+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + (D.f[DIR_00P ])[kt ] = c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + (D.f[DIR_00M ])[kb ] = c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + (D.f[DIR_PP0 ])[kne ] = c1o54* (drho+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + (D.f[DIR_MM0 ])[ksw ] = c1o54* (drho+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + (D.f[DIR_PM0 ])[kse ] = c1o54* (drho+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + (D.f[DIR_MP0 ])[knw ] = c1o54* (drho+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + (D.f[DIR_P0P ])[kte ] = c1o54* (drho+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + (D.f[DIR_M0M ])[kbw ] = c1o54* (drho+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + (D.f[DIR_P0M ])[kbe ] = c1o54* (drho+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + (D.f[DIR_M0P ])[ktw ] = c1o54* (drho+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + (D.f[DIR_0PP ])[ktn ] = c1o54* (drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + (D.f[DIR_0MM ])[kbs ] = c1o54* (drho+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + (D.f[DIR_0PM ])[kbn ] = c1o54* (drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + (D.f[DIR_0MP ])[kts ] = c1o54* (drho+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + (D.f[DIR_PPP ])[ktne ] = c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + (D.f[DIR_MMM ])[kbsw ] = c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + (D.f[DIR_PPM ])[kbne ] = c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + (D.f[DIR_MMP ])[ktsw ] = c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + (D.f[DIR_PMP ])[ktse ] = c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + (D.f[DIR_MPM ])[kbnw ] = c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + (D.f[DIR_PMM ])[kbse ] = c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + (D.f[DIR_MPP ])[ktnw ] = c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); } __syncthreads(); } @@ -3518,282 +3413,154 @@ extern "C" __global__ void LB_BC_Vel_West_27( int nx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVelDevPlainBB27(real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) +__global__ void QVelDevPlainBB27( + real* velocityX, + real* velocityY, + real* velocityZ, + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + uint numberOfBCnodes, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + uint numberOfLBnodes, + bool isEvenTimestep) { - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } + ////////////////////////////////////////////////////////////////////////// + //! The velocity boundary condition is executed in the following steps + //! //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index const unsigned nx = blockDim.x; const unsigned ny = gridDim.x; const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + ////////////////////////////////////////////////////////////////////////// + // run for all indices in size of boundary condition (numberOfBCnodes) + if(k < numberOfBCnodes) { - //////////////////////////////////////////////////////////////////////////////// - real VeloX = vx[k]; - real VeloY = vy[k]; - real VeloZ = vz[k]; + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep); + //////////////////////////////////////////////////////////////////////////////// - real*q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + //! - Set local velocities + //! + real VeloX = velocityX[k]; + real VeloY = velocityY[k]; + real VeloZ = velocityZ[k]; + //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - //unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; - unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; - unsigned int kse = ks; - unsigned int knw = kw; - unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; - unsigned int kbe = kb; - unsigned int ktw = kw; - unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; - unsigned int kbn = kb; - unsigned int kts = ks; - unsigned int ktse = ks; - unsigned int kbnw = kbw; - unsigned int ktnw = kw; - unsigned int kbse = kbs; - unsigned int ktsw = ksw; - unsigned int kbne = kb; - unsigned int ktne = KQK; - unsigned int kbsw = neighborZ[ksw]; + //! - Set local subgrid distances (q's) + //! + SubgridDistances27 subgridD; + getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes); + //////////////////////////////////////////////////////////////////////////////// - + //! - Set neighbor indices (necessary for indirect addressing) + //! + uint indexOfBCnode = subgridDistanceIndices[k]; + uint ke = indexOfBCnode; + uint kw = neighborX[indexOfBCnode]; + uint kn = indexOfBCnode; + uint ks = neighborY[indexOfBCnode]; + uint kt = indexOfBCnode; + uint kb = neighborZ[indexOfBCnode]; + uint ksw = neighborY[kw]; + uint kne = indexOfBCnode; + uint kse = ks; + uint knw = kw; + uint kbw = neighborZ[kw]; + uint kte = indexOfBCnode; + uint kbe = kb; + uint ktw = kw; + uint kbs = neighborZ[ks]; + uint ktn = indexOfBCnode; + uint kbn = kb; + uint kts = ks; + uint ktse = ks; + uint kbnw = kbw; + uint ktnw = kw; + uint kbse = kbs; + uint ktsw = ksw; + uint kbne = kb; + uint ktne = indexOfBCnode; + uint kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions + //! + real f_W = (dist.f[DIR_P00 ])[ke ]; + real f_E = (dist.f[DIR_M00 ])[kw ]; + real f_S = (dist.f[DIR_0P0 ])[kn ]; + real f_N = (dist.f[DIR_0M0 ])[ks ]; + real f_B = (dist.f[DIR_00P ])[kt ]; + real f_T = (dist.f[DIR_00M ])[kb ]; + real f_SW = (dist.f[DIR_PP0 ])[kne ]; + real f_NE = (dist.f[DIR_MM0 ])[ksw ]; + real f_NW = (dist.f[DIR_PM0 ])[kse ]; + real f_SE = (dist.f[DIR_MP0 ])[knw ]; + real f_BW = (dist.f[DIR_P0P ])[kte ]; + real f_TE = (dist.f[DIR_M0M ])[kbw ]; + real f_TW = (dist.f[DIR_P0M ])[kbe ]; + real f_BE = (dist.f[DIR_M0P ])[ktw ]; + real f_BS = (dist.f[DIR_0PP ])[ktn ]; + real f_TN = (dist.f[DIR_0MM ])[kbs ]; + real f_TS = (dist.f[DIR_0PM ])[kbn ]; + real f_BN = (dist.f[DIR_0MP ])[kts ]; + real f_BSW = (dist.f[DIR_PPP ])[ktne ]; + real f_BNE = (dist.f[DIR_MMP ])[ktsw ]; + real f_BNW = (dist.f[DIR_PMP ])[ktse ]; + real f_BSE = (dist.f[DIR_MPP ])[ktnw ]; + real f_TSW = (dist.f[DIR_PPM ])[kbne ]; + real f_TNE = (dist.f[DIR_MMM ])[kbsw ]; + real f_TNW = (dist.f[DIR_PMM ])[kbse ]; + real f_TSE = (dist.f[DIR_MPM ])[kbnw ]; - //////////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////// - real q; - q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirW ])[kw ]=f_E - c6o1 * c2o27 * VeloX; - q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirE ])[ke ]=f_W + c6o1 * c2o27 * VeloX; - q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirS ])[ks ]=f_N - c6o1 * c2o27 * VeloY; - q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirN ])[kn ]=f_S + c6o1 * c2o27 * VeloY; - q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirB ])[kb ]=f_T - c6o1 * c2o27 * VeloZ; - q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirT ])[kt ]=f_B + c6o1 * c2o27 * VeloZ; - q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirSW ])[ksw ]=f_NE - c6o1 * c1o54 * VeloX - c1o54 * VeloY; - q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirNE ])[kne ]=f_SW + c6o1 * c1o54 * VeloX + c1o54 * VeloY; - q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirNW ])[knw ]=f_SE - c6o1 * c1o54 * VeloX + c1o54 * VeloY; - q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirSE ])[kse ]=f_NW + c6o1 * c1o54 * VeloX - c1o54 * VeloY; - q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBW ])[kbw ]=f_TE - c6o1 * c1o54 * VeloX - c1o54 * VeloZ; - q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTE ])[kte ]=f_BW + c6o1 * c1o54 * VeloX + c1o54 * VeloZ; - q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTW ])[ktw ]=f_BE - c6o1 * c1o54 * VeloX + c1o54 * VeloZ; - q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBE ])[kbe ]=f_TW + c6o1 * c1o54 * VeloX - c1o54 * VeloZ; - q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBS ])[kbs ]=f_TN - c6o1 * c1o54 * VeloY - c1o54 * VeloZ; - q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTN ])[ktn ]=f_BS + c6o1 * c1o54 * VeloY + c1o54 * VeloZ; - q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTS ])[kts ]=f_BN - c6o1 * c1o54 * VeloY + c1o54 * VeloZ; - q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBN ])[kbn ]=f_TS + c6o1 * c1o54 * VeloY - c1o54 * VeloZ; - q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBSW])[kbsw]=f_TNE - c6o1 * c1o216 * VeloX - c1o216 * VeloY - c1o216 * VeloZ; - q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTNE])[ktne]=f_BSW + c6o1 * c1o216 * VeloX + c1o216 * VeloY + c1o216 * VeloZ; - q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTSW])[ktsw]=f_BNE - c6o1 * c1o216 * VeloX - c1o216 * VeloY + c1o216 * VeloZ; - q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBNE])[kbne]=f_TSW + c6o1 * c1o216 * VeloX + c1o216 * VeloY - c1o216 * VeloZ; - q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBNW])[kbnw]=f_TSE - c6o1 * c1o216 * VeloX + c1o216 * VeloY - c1o216 * VeloZ; - q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTSE])[ktse]=f_BNW + c6o1 * c1o216 * VeloX - c1o216 * VeloY + c1o216 * VeloZ; - q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTNW])[ktnw]=f_BSE - c6o1 * c1o216 * VeloX + c1o216 * VeloY + c1o216 * VeloZ; - q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBSE])[kbse]=f_TNW + c6o1 * c1o216 * VeloX - c1o216 * VeloY - c1o216 * VeloZ; - //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //! - change the pointer to write the results in the correct array + //! + getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - rewrite distributions if there is a sub-grid distance (q) in same direction + real q; + q = (subgridD.q[DIR_P00 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_M00 ])[kw ]=f_E + c4o9 * (-VeloX); + q = (subgridD.q[DIR_M00 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_P00 ])[ke ]=f_W + c4o9 * ( VeloX); + q = (subgridD.q[DIR_0P0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0M0 ])[ks ]=f_N + c4o9 * (-VeloY); + q = (subgridD.q[DIR_0M0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0P0 ])[kn ]=f_S + c4o9 * ( VeloY); + q = (subgridD.q[DIR_00P ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_00M ])[kb ]=f_T + c4o9 * (-VeloZ); + q = (subgridD.q[DIR_00M ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_00P ])[kt ]=f_B + c4o9 * ( VeloZ); + q = (subgridD.q[DIR_PP0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MM0 ])[ksw ]=f_NE + c1o9 * (-VeloX - VeloY); + q = (subgridD.q[DIR_MM0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PP0 ])[kne ]=f_SW + c1o9 * ( VeloX + VeloY); + q = (subgridD.q[DIR_PM0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MP0 ])[knw ]=f_SE + c1o9 * (-VeloX + VeloY); + q = (subgridD.q[DIR_MP0 ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PM0 ])[kse ]=f_NW + c1o9 * ( VeloX - VeloY); + q = (subgridD.q[DIR_P0P ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_M0M ])[kbw ]=f_TE + c1o9 * (-VeloX - VeloZ); + q = (subgridD.q[DIR_M0M ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_P0P ])[kte ]=f_BW + c1o9 * ( VeloX + VeloZ); + q = (subgridD.q[DIR_P0M ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_M0P ])[ktw ]=f_BE + c1o9 * (-VeloX + VeloZ); + q = (subgridD.q[DIR_M0P ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_P0M ])[kbe ]=f_TW + c1o9 * ( VeloX - VeloZ); + q = (subgridD.q[DIR_0PP ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0MM ])[kbs ]=f_TN + c1o9 * (-VeloY - VeloZ); + q = (subgridD.q[DIR_0MM ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0PP ])[ktn ]=f_BS + c1o9 * ( VeloY + VeloZ); + q = (subgridD.q[DIR_0PM ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0MP ])[kts ]=f_BN + c1o9 * (-VeloY + VeloZ); + q = (subgridD.q[DIR_0MP ])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_0PM ])[kbn ]=f_TS + c1o9 * ( VeloY - VeloZ); + q = (subgridD.q[DIR_PPP])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MMM])[kbsw]=f_TNE + c1o36 * (-VeloX - VeloY - VeloZ); + q = (subgridD.q[DIR_MMM])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PPP])[ktne]=f_BSW + c1o36 * ( VeloX + VeloY + VeloZ); + q = (subgridD.q[DIR_PPM])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MMP])[ktsw]=f_BNE + c1o36 * (-VeloX - VeloY + VeloZ); + q = (subgridD.q[DIR_MMP])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PPM])[kbne]=f_TSW + c1o36 * ( VeloX + VeloY - VeloZ); + q = (subgridD.q[DIR_PMP])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MPM])[kbnw]=f_TSE + c1o36 * (-VeloX + VeloY - VeloZ); + q = (subgridD.q[DIR_MPM])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PMP])[ktse]=f_BNW + c1o36 * ( VeloX - VeloY + VeloZ); + q = (subgridD.q[DIR_PMM])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_MPP])[ktnw]=f_BSE + c1o36 * (-VeloX + VeloY + VeloZ); + q = (subgridD.q[DIR_MPP])[k]; if (q>=c0o1 && q<=c1o1) (dist.f[DIR_PMM])[kbse]=f_TNW + c1o36 * ( VeloX - VeloY - VeloZ); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -3837,81 +3604,80 @@ extern "C" __global__ void QVelDevPlainBB27(real* vx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVelDevCouhette27(real* vx, +__global__ void QVelDevCouette27(real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -3924,7 +3690,7 @@ extern "C" __global__ void QVelDevCouhette27(real* vx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real VeloX = vx[k]; @@ -3936,32 +3702,32 @@ extern "C" __global__ void QVelDevCouhette27(real* vx, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -3995,94 +3761,94 @@ extern "C" __global__ void QVelDevCouhette27(real* vx, //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// - real f_W = (D.f[dirE ])[ke ]; - real f_E = (D.f[dirW ])[kw ]; - real f_S = (D.f[dirN ])[kn ]; - real f_N = (D.f[dirS ])[ks ]; - real f_B = (D.f[dirT ])[kt ]; - real f_T = (D.f[dirB ])[kb ]; - real f_SW = (D.f[dirNE ])[kne ]; - real f_NE = (D.f[dirSW ])[ksw ]; - real f_NW = (D.f[dirSE ])[kse ]; - real f_SE = (D.f[dirNW ])[knw ]; - real f_BW = (D.f[dirTE ])[kte ]; - real f_TE = (D.f[dirBW ])[kbw ]; - real f_TW = (D.f[dirBE ])[kbe ]; - real f_BE = (D.f[dirTW ])[ktw ]; - real f_BS = (D.f[dirTN ])[ktn ]; - real f_TN = (D.f[dirBS ])[kbs ]; - real f_TS = (D.f[dirBN ])[kbn ]; - real f_BN = (D.f[dirTS ])[kts ]; - real f_BSW = (D.f[dirTNE ])[ktne ]; - real f_BNE = (D.f[dirTSW ])[ktsw ]; - real f_BNW = (D.f[dirTSE ])[ktse ]; - real f_BSE = (D.f[dirTNW ])[ktnw ]; - real f_TSW = (D.f[dirBNE ])[kbne ]; - real f_TNE = (D.f[dirBSW ])[kbsw ]; - real f_TNW = (D.f[dirBSE ])[kbse ]; - real f_TSE = (D.f[dirBNW ])[kbnw ]; + real f_W = (D.f[DIR_P00 ])[ke ]; + real f_E = (D.f[DIR_M00 ])[kw ]; + real f_S = (D.f[DIR_0P0 ])[kn ]; + real f_N = (D.f[DIR_0M0 ])[ks ]; + real f_B = (D.f[DIR_00P ])[kt ]; + real f_T = (D.f[DIR_00M ])[kb ]; + real f_SW = (D.f[DIR_PP0 ])[kne ]; + real f_NE = (D.f[DIR_MM0 ])[ksw ]; + real f_NW = (D.f[DIR_PM0 ])[kse ]; + real f_SE = (D.f[DIR_MP0 ])[knw ]; + real f_BW = (D.f[DIR_P0P ])[kte ]; + real f_TE = (D.f[DIR_M0M ])[kbw ]; + real f_TW = (D.f[DIR_P0M ])[kbe ]; + real f_BE = (D.f[DIR_M0P ])[ktw ]; + real f_BS = (D.f[DIR_0PP ])[ktn ]; + real f_TN = (D.f[DIR_0MM ])[kbs ]; + real f_TS = (D.f[DIR_0PM ])[kbn ]; + real f_BN = (D.f[DIR_0MP ])[kts ]; + real f_BSW = (D.f[DIR_PPP ])[ktne ]; + real f_BNE = (D.f[DIR_MMP ])[ktsw ]; + real f_BNW = (D.f[DIR_PMP ])[ktse ]; + real f_BSE = (D.f[DIR_MPP ])[ktnw ]; + real f_TSW = (D.f[DIR_PPM ])[kbne ]; + real f_TNE = (D.f[DIR_MMM ])[kbsw ]; + real f_TNW = (D.f[DIR_PMM ])[kbse ]; + real f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////// FlowDirection Y !!!!!!!!!! /////////////////////////////////// @@ -4097,63 +3863,63 @@ extern "C" __global__ void QVelDevCouhette27(real* vx, real ms=-c6o1; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //2nd order moment - real kxxMyyFromfcNEQ = c0o1;//-c3o2 * (f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE-(vx1*vx1-vx2*vx2)); //all E+W minus all N+S (no combinations of xy left) + real kxxMyyFromfcNEQ = c0o1;//-c3o2 * (f_BW+f_W+f_TW-f_BS-f_S-f_TS-f_BN-f_N-f_TN+f_BE+f_E+f_TE-(vx1*vx1-vx2*vx2)); //all DIR_P00+DIR_M00 minus all DIR_0P0+DIR_0M0 (no combinations of xy left) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //set distributions real q; - q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirW ])[kw ]=f_E + ms*c2o27 * VeloX; - q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirE ])[ke ]=f_W - ms*c2o27 * VeloX; - q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirS ])[ks ]=f_N + ms*c2o27 * VeloY; - q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirN ])[kn ]=f_S - ms*c2o27 * VeloY; - q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirB ])[kb ]=f_T + ms*c2o27 * VeloZ - c3o2*c2o27*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on; - q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirT ])[kt ]=f_B - ms*c2o27 * VeloZ; - q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirSW ])[ksw ]=f_NE + ms*c1o54 * VeloX + ms*c1o54 * VeloY; - q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirNE ])[kne ]=f_SW - ms*c1o54 * VeloX - ms*c1o54 * VeloY; - q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirNW ])[knw ]=f_SE + ms*c1o54 * VeloX - ms*c1o54 * VeloY; - q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirSE ])[kse ]=f_NW - ms*c1o54 * VeloX + ms*c1o54 * VeloY; - q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBW ])[kbw ]=f_TE + ms*c1o54 * VeloX + ms*c1o54 * VeloZ - c3o2*c1o54*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on-c1o12*kxxMyyFromfcNEQ; - q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTE ])[kte ]=f_BW - ms*c1o54 * VeloX - ms*c1o54 * VeloZ; - q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTW ])[ktw ]=f_BE + ms*c1o54 * VeloX - ms*c1o54 * VeloZ; - q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBE ])[kbe ]=f_TW - ms*c1o54 * VeloX + ms*c1o54 * VeloZ - c3o2*c1o54*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on-c1o12*kxxMyyFromfcNEQ; - q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBS ])[kbs ]=f_TN + ms*c1o54 * VeloY + ms*c1o54 * VeloZ + c3o1*c1o54*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on+c1o12*kxxMyyFromfcNEQ; - q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTN ])[ktn ]=f_BS - ms*c1o54 * VeloY - ms*c1o54 * VeloZ; - q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTS ])[kts ]=f_BN + ms*c1o54 * VeloY - ms*c1o54 * VeloZ; - q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBN ])[kbn ]=f_TS - ms*c1o54 * VeloY + ms*c1o54 * VeloZ + c3o1*c1o54*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on+c1o12*kxxMyyFromfcNEQ; - q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBSW])[kbsw]=f_TNE + ms*c1o216 * VeloX + ms*c1o216 * VeloY + ms*c1o216 * VeloZ + c3o1*c1o216*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on; - q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTNE])[ktne]=f_BSW - ms*c1o216 * VeloX - ms*c1o216 * VeloY - ms*c1o216 * VeloZ; - q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTSW])[ktsw]=f_BNE + ms*c1o216 * VeloX + ms*c1o216 * VeloY - ms*c1o216 * VeloZ; - q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBNE])[kbne]=f_TSW - ms*c1o216 * VeloX - ms*c1o216 * VeloY + ms*c1o216 * VeloZ + c3o1*c1o216*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on; - q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBNW])[kbnw]=f_TSE + ms*c1o216 * VeloX - ms*c1o216 * VeloY + ms*c1o216 * VeloZ + c3o1*c1o216*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on; - q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTSE])[ktse]=f_BNW - ms*c1o216 * VeloX + ms*c1o216 * VeloY - ms*c1o216 * VeloZ; - q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirTNW])[ktnw]=f_BSE + ms*c1o216 * VeloX - ms*c1o216 * VeloY - ms*c1o216 * VeloZ; - q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D.f[dirBSE])[kbse]=f_TNW - ms*c1o216 * VeloX + ms*c1o216 * VeloY + ms*c1o216 * VeloZ + c3o1*c1o216*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on; - //q = q_dirE[k]; if (q>=zero && q<=one) (D.f[dirW ])[kw ]=f_E + ms*c2over27 * VeloX; - // q = q_dirW[k]; if (q>=zero && q<=one) (D.f[dirE ])[ke ]=f_W - ms*c2over27 * VeloX; - // q = q_dirN[k]; if (q>=zero && q<=one) (D.f[dirS ])[ks ]=f_N + ms*c2over27 * VeloY; - // q = q_dirS[k]; if (q>=zero && q<=one) (D.f[dirN ])[kn ]=f_S - ms*c2over27 * VeloY; - //q = q_dirT[k]; if (q>=zero && q<=one) (D.f[dirB ])[kb ]=f_T + ms*c2over27 * VeloZ - c1o9*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; - // q = q_dirB[k]; if (q>=zero && q<=one) (D.f[dirT ])[kt ]=f_B - ms*c2over27 * VeloZ; - // q = q_dirNE[k]; if (q>=zero && q<=one) (D.f[dirSW ])[ksw ]=f_NE + ms*c1over54 * VeloX + ms*c1over54 * VeloY; - //q = q_dirSW[k]; if (q>=zero && q<=one) (D.f[dirNE ])[kne ]=f_SW - ms*c1over54 * VeloX - ms*c1over54 * VeloY; - //q = q_dirSE[k]; if (q>=zero && q<=one) (D.f[dirNW ])[knw ]=f_SE + ms*c1over54 * VeloX - ms*c1over54 * VeloY; - //q = q_dirNW[k]; if (q>=zero && q<=one) (D.f[dirSE ])[kse ]=f_NW - ms*c1over54 * VeloX + ms*c1over54 * VeloY; - //q = q_dirTE[k]; if (q>=zero && q<=one) (D.f[dirBW ])[kbw ]=f_TE + ms*c1over54 * VeloX + ms*c1over54 * VeloZ - c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; - //q = q_dirBW[k]; if (q>=zero && q<=one) (D.f[dirTE ])[kte ]=f_BW - ms*c1over54 * VeloX - ms*c1over54 * VeloZ; - //q = q_dirBE[k]; if (q>=zero && q<=one) (D.f[dirTW ])[ktw ]=f_BE + ms*c1over54 * VeloX - ms*c1over54 * VeloZ; - //q = q_dirTW[k]; if (q>=zero && q<=one) (D.f[dirBE ])[kbe ]=f_TW - ms*c1over54 * VeloX + ms*c1over54 * VeloZ - c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; - //q = q_dirTN[k]; if (q>=zero && q<=one) (D.f[dirBS ])[kbs ]=f_TN + ms*c1over54 * VeloY + ms*c1over54 * VeloZ + c1o2*c1o9*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; - //q = q_dirBS[k]; if (q>=zero && q<=one) (D.f[dirTN ])[ktn ]=f_BS - ms*c1over54 * VeloY - ms*c1over54 * VeloZ; - //q = q_dirBN[k]; if (q>=zero && q<=one) (D.f[dirTS ])[kts ]=f_BN + ms*c1over54 * VeloY - ms*c1over54 * VeloZ; - //q = q_dirTS[k]; if (q>=zero && q<=one) (D.f[dirBN ])[kbn ]=f_TS - ms*c1over54 * VeloY + ms*c1over54 * VeloZ + c1o2*c1o9*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; - // q = q_dirTNE[k]; if (q>=zero && q<=one) (D.f[dirBSW])[kbsw]=f_TNE + ms*c1over216 * VeloX + ms*c1over216 * VeloY + ms*c1over216 * VeloZ + c1o2*c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; - // q = q_dirBSW[k]; if (q>=zero && q<=one) (D.f[dirTNE])[ktne]=f_BSW - ms*c1over216 * VeloX - ms*c1over216 * VeloY - ms*c1over216 * VeloZ; - // q = q_dirBNE[k]; if (q>=zero && q<=one) (D.f[dirTSW])[ktsw]=f_BNE + ms*c1over216 * VeloX + ms*c1over216 * VeloY - ms*c1over216 * VeloZ; - // q = q_dirTSW[k]; if (q>=zero && q<=one) (D.f[dirBNE])[kbne]=f_TSW - ms*c1over216 * VeloX - ms*c1over216 * VeloY + ms*c1over216 * VeloZ + c1o2*c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; - // q = q_dirTSE[k]; if (q>=zero && q<=one) (D.f[dirBNW])[kbnw]=f_TSE + ms*c1over216 * VeloX - ms*c1over216 * VeloY + ms*c1over216 * VeloZ + c1o2*c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; - // q = q_dirBNW[k]; if (q>=zero && q<=one) (D.f[dirTSE])[ktse]=f_BNW - ms*c1over216 * VeloX + ms*c1over216 * VeloY - ms*c1over216 * VeloZ; - // q = q_dirBSE[k]; if (q>=zero && q<=one) (D.f[dirTNW])[ktnw]=f_BSE + ms*c1over216 * VeloX - ms*c1over216 * VeloY - ms*c1over216 * VeloZ; - // q = q_dirTNW[k]; if (q>=zero && q<=one) (D.f[dirBSE])[kbse]=f_TNW - ms*c1over216 * VeloX + ms*c1over216 * VeloY + ms*c1over216 * VeloZ + c1o2*c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; + q = q_dirE[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_M00 ])[kw ]=f_E + ms*c2o27 * VeloX; + q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_P00 ])[ke ]=f_W - ms*c2o27 * VeloX; + q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_0M0 ])[ks ]=f_N + ms*c2o27 * VeloY; + q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_0P0 ])[kn ]=f_S - ms*c2o27 * VeloY; + q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_00M ])[kb ]=f_T + ms*c2o27 * VeloZ - c3o2*c2o27*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on; + q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_00P ])[kt ]=f_B - ms*c2o27 * VeloZ; + q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_MM0 ])[ksw ]=f_NE + ms*c1o54 * VeloX + ms*c1o54 * VeloY; + q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_PP0 ])[kne ]=f_SW - ms*c1o54 * VeloX - ms*c1o54 * VeloY; + q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_MP0 ])[knw ]=f_SE + ms*c1o54 * VeloX - ms*c1o54 * VeloY; + q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_PM0 ])[kse ]=f_NW - ms*c1o54 * VeloX + ms*c1o54 * VeloY; + q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_M0M ])[kbw ]=f_TE + ms*c1o54 * VeloX + ms*c1o54 * VeloZ - c3o2*c1o54*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on-c1o12*kxxMyyFromfcNEQ; + q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_P0P ])[kte ]=f_BW - ms*c1o54 * VeloX - ms*c1o54 * VeloZ; + q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_M0P ])[ktw ]=f_BE + ms*c1o54 * VeloX - ms*c1o54 * VeloZ; + q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_P0M ])[kbe ]=f_TW - ms*c1o54 * VeloX + ms*c1o54 * VeloZ - c3o2*c1o54*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on-c1o12*kxxMyyFromfcNEQ; + q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_0MM ])[kbs ]=f_TN + ms*c1o54 * VeloY + ms*c1o54 * VeloZ + c3o1*c1o54*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on+c1o12*kxxMyyFromfcNEQ; + q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_0PP ])[ktn ]=f_BS - ms*c1o54 * VeloY - ms*c1o54 * VeloZ; + q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_0MP ])[kts ]=f_BN + ms*c1o54 * VeloY - ms*c1o54 * VeloZ; + q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_0PM ])[kbn ]=f_TS - ms*c1o54 * VeloY + ms*c1o54 * VeloZ + c3o1*c1o54*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on+c1o12*kxxMyyFromfcNEQ; + q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_MMM])[kbsw]=f_TNE + ms*c1o216 * VeloX + ms*c1o216 * VeloY + ms*c1o216 * VeloZ + c3o1*c1o216*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on; + q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_PPP])[ktne]=f_BSW - ms*c1o216 * VeloX - ms*c1o216 * VeloY - ms*c1o216 * VeloZ; + q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_MMP])[ktsw]=f_BNE + ms*c1o216 * VeloX + ms*c1o216 * VeloY - ms*c1o216 * VeloZ; + q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_PPM])[kbne]=f_TSW - ms*c1o216 * VeloX - ms*c1o216 * VeloY + ms*c1o216 * VeloZ + c3o1*c1o216*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on; + q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_MPM])[kbnw]=f_TSE + ms*c1o216 * VeloX - ms*c1o216 * VeloY + ms*c1o216 * VeloZ + c3o1*c1o216*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on; + q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_PMP])[ktse]=f_BNW - ms*c1o216 * VeloX + ms*c1o216 * VeloY - ms*c1o216 * VeloZ; + q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_MPP])[ktnw]=f_BSE + ms*c1o216 * VeloX - ms*c1o216 * VeloY - ms*c1o216 * VeloZ; + q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) (D.f[DIR_PMM])[kbse]=f_TNW - ms*c1o216 * VeloX + ms*c1o216 * VeloY + ms*c1o216 * VeloZ + c3o1*c1o216*((c2o1*VeloY-vx2)*(c2o1*VeloY-vx2)-vx2*vx2)*on; + //q = q_dirE[k]; if (q>=zero && q<=one) (D.f[DIR_M00 ])[kw ]=f_E + ms*c2over27 * VeloX; + // q = q_dirW[k]; if (q>=zero && q<=one) (D.f[DIR_P00 ])[ke ]=f_W - ms*c2over27 * VeloX; + // q = q_dirN[k]; if (q>=zero && q<=one) (D.f[DIR_0M0 ])[ks ]=f_N + ms*c2over27 * VeloY; + // q = q_dirS[k]; if (q>=zero && q<=one) (D.f[DIR_0P0 ])[kn ]=f_S - ms*c2over27 * VeloY; + //q = q_dirT[k]; if (q>=zero && q<=one) (D.f[DIR_00M ])[kb ]=f_T + ms*c2over27 * VeloZ - c1o9*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; + // q = q_dirB[k]; if (q>=zero && q<=one) (D.f[DIR_00P ])[kt ]=f_B - ms*c2over27 * VeloZ; + // q = q_dirNE[k]; if (q>=zero && q<=one) (D.f[DIR_MM0 ])[ksw ]=f_NE + ms*c1over54 * VeloX + ms*c1over54 * VeloY; + //q = q_dirSW[k]; if (q>=zero && q<=one) (D.f[DIR_PP0 ])[kne ]=f_SW - ms*c1over54 * VeloX - ms*c1over54 * VeloY; + //q = q_dirSE[k]; if (q>=zero && q<=one) (D.f[DIR_MP0 ])[knw ]=f_SE + ms*c1over54 * VeloX - ms*c1over54 * VeloY; + //q = q_dirNW[k]; if (q>=zero && q<=one) (D.f[DIR_PM0 ])[kse ]=f_NW - ms*c1over54 * VeloX + ms*c1over54 * VeloY; + //q = q_dirTE[k]; if (q>=zero && q<=one) (D.f[DIR_M0M ])[kbw ]=f_TE + ms*c1over54 * VeloX + ms*c1over54 * VeloZ - c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; + //q = q_dirBW[k]; if (q>=zero && q<=one) (D.f[DIR_P0P ])[kte ]=f_BW - ms*c1over54 * VeloX - ms*c1over54 * VeloZ; + //q = q_dirBE[k]; if (q>=zero && q<=one) (D.f[DIR_M0P ])[ktw ]=f_BE + ms*c1over54 * VeloX - ms*c1over54 * VeloZ; + //q = q_dirTW[k]; if (q>=zero && q<=one) (D.f[DIR_P0M ])[kbe ]=f_TW - ms*c1over54 * VeloX + ms*c1over54 * VeloZ - c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; + //q = q_dirTN[k]; if (q>=zero && q<=one) (D.f[DIR_0MM ])[kbs ]=f_TN + ms*c1over54 * VeloY + ms*c1over54 * VeloZ + c1o2*c1o9*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; + //q = q_dirBS[k]; if (q>=zero && q<=one) (D.f[DIR_0PP ])[ktn ]=f_BS - ms*c1over54 * VeloY - ms*c1over54 * VeloZ; + //q = q_dirBN[k]; if (q>=zero && q<=one) (D.f[DIR_0MP ])[kts ]=f_BN + ms*c1over54 * VeloY - ms*c1over54 * VeloZ; + //q = q_dirTS[k]; if (q>=zero && q<=one) (D.f[DIR_0PM ])[kbn ]=f_TS - ms*c1over54 * VeloY + ms*c1over54 * VeloZ + c1o2*c1o9*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; + // q = q_dirTNE[k]; if (q>=zero && q<=one) (D.f[DIR_MMM])[kbsw]=f_TNE + ms*c1over216 * VeloX + ms*c1over216 * VeloY + ms*c1over216 * VeloZ + c1o2*c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; + // q = q_dirBSW[k]; if (q>=zero && q<=one) (D.f[DIR_PPP])[ktne]=f_BSW - ms*c1over216 * VeloX - ms*c1over216 * VeloY - ms*c1over216 * VeloZ; + // q = q_dirBNE[k]; if (q>=zero && q<=one) (D.f[DIR_MMP])[ktsw]=f_BNE + ms*c1over216 * VeloX + ms*c1over216 * VeloY - ms*c1over216 * VeloZ; + // q = q_dirTSW[k]; if (q>=zero && q<=one) (D.f[DIR_PPM])[kbne]=f_TSW - ms*c1over216 * VeloX - ms*c1over216 * VeloY + ms*c1over216 * VeloZ + c1o2*c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; + // q = q_dirTSE[k]; if (q>=zero && q<=one) (D.f[DIR_MPM])[kbnw]=f_TSE + ms*c1over216 * VeloX - ms*c1over216 * VeloY + ms*c1over216 * VeloZ + c1o2*c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; + // q = q_dirBNW[k]; if (q>=zero && q<=one) (D.f[DIR_PMP])[ktse]=f_BNW - ms*c1over216 * VeloX + ms*c1over216 * VeloY - ms*c1over216 * VeloZ; + // q = q_dirBSE[k]; if (q>=zero && q<=one) (D.f[DIR_MPP])[ktnw]=f_BSE + ms*c1over216 * VeloX - ms*c1over216 * VeloY - ms*c1over216 * VeloZ; + // q = q_dirTNW[k]; if (q>=zero && q<=one) (D.f[DIR_PMM])[kbse]=f_TNW - ms*c1over216 * VeloX + ms*c1over216 * VeloY + ms*c1over216 * VeloZ + c1o2*c1o36*((two*VeloY-vx2)*(two*VeloY-vx2)-vx2*vx2)*on; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } } @@ -4198,7 +3964,7 @@ extern "C" __global__ void QVelDevCouhette27(real* vx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVelDev1h27( int inx, +__global__ void QVelDev1h27( int inx, int iny, real* vx, real* vy, @@ -4206,8 +3972,7 @@ extern "C" __global__ void QVelDev1h27( int inx, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, real Phi, real angularVelocity, @@ -4218,68 +3983,68 @@ extern "C" __global__ void QVelDev1h27( int inx, real* coordY, real* coordZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -4292,7 +4057,7 @@ extern "C" __global__ void QVelDev1h27( int inx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real VeloX = cosf(Phi)*vx[k] - sinf(Phi)*vy[k]; @@ -4314,32 +4079,32 @@ extern "C" __global__ void QVelDev1h27( int inx, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -4402,37 +4167,37 @@ extern "C" __global__ void QVelDev1h27( int inx, //real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, // f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - //f_W = (D.f[dirE ])[ke ]; - //f_E = (D.f[dirW ])[kw ]; - //f_S = (D.f[dirN ])[kn ]; - //f_N = (D.f[dirS ])[ks ]; - //f_B = (D.f[dirT ])[kt ]; - //f_T = (D.f[dirB ])[kb ]; - //f_SW = (D.f[dirNE ])[kne ]; - //f_NE = (D.f[dirSW ])[ksw ]; - //f_NW = (D.f[dirSE ])[kse ]; - //f_SE = (D.f[dirNW ])[knw ]; - //f_BW = (D.f[dirTE ])[kte ]; - //f_TE = (D.f[dirBW ])[kbw ]; - //f_TW = (D.f[dirBE ])[kbe ]; - //f_BE = (D.f[dirTW ])[ktw ]; - //f_BS = (D.f[dirTN ])[ktn ]; - //f_TN = (D.f[dirBS ])[kbs ]; - //f_TS = (D.f[dirBN ])[kbn ]; - //f_BN = (D.f[dirTS ])[kts ]; - //f_BSW = (D.f[dirTNE ])[ktne ]; - //f_BNE = (D.f[dirTSW ])[ktsw ]; - //f_BNW = (D.f[dirTSE ])[ktse ]; - //f_BSE = (D.f[dirTNW ])[ktnw ]; - //f_TSW = (D.f[dirBNE ])[kbne ]; - //f_TNE = (D.f[dirBSW ])[kbsw ]; - //f_TNW = (D.f[dirBSE ])[kbse ]; - //f_TSE = (D.f[dirBNW ])[kbnw ]; + //f_W = (D.f[DIR_P00 ])[ke ]; + //f_E = (D.f[DIR_M00 ])[kw ]; + //f_S = (D.f[DIR_0P0 ])[kn ]; + //f_N = (D.f[DIR_0M0 ])[ks ]; + //f_B = (D.f[DIR_00P ])[kt ]; + //f_T = (D.f[DIR_00M ])[kb ]; + //f_SW = (D.f[DIR_PP0 ])[kne ]; + //f_NE = (D.f[DIR_MM0 ])[ksw ]; + //f_NW = (D.f[DIR_PM0 ])[kse ]; + //f_SE = (D.f[DIR_MP0 ])[knw ]; + //f_BW = (D.f[DIR_P0P ])[kte ]; + //f_TE = (D.f[DIR_M0M ])[kbw ]; + //f_TW = (D.f[DIR_P0M ])[kbe ]; + //f_BE = (D.f[DIR_M0P ])[ktw ]; + //f_BS = (D.f[DIR_0PP ])[ktn ]; + //f_TN = (D.f[DIR_0MM ])[kbs ]; + //f_TS = (D.f[DIR_0PM ])[kbn ]; + //f_BN = (D.f[DIR_0MP ])[kts ]; + //f_BSW = (D.f[DIR_PPP ])[ktne ]; + //f_BNE = (D.f[DIR_MMP ])[ktsw ]; + //f_BNW = (D.f[DIR_PMP ])[ktse ]; + //f_BSE = (D.f[DIR_MPP ])[ktnw ]; + //f_TSW = (D.f[DIR_PPM ])[kbne ]; + //f_TNE = (D.f[DIR_MMM ])[kbsw ]; + //f_TNW = (D.f[DIR_PMM ])[kbse ]; + //f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real /*vx1, vx2,*/ vx3, drho, feq, q, cu_sq; //drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + // f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - // f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + // f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); //vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + // ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -4450,69 +4215,69 @@ extern "C" __global__ void QVelDev1h27( int inx, //cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) + if (isEvenTimestep==false) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Test - //(D.f[dirZERO])[k]=c1o10; + //(D.f[DIR_000])[k]=c1o10; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //ToDo anders Klammern @@ -4521,208 +4286,208 @@ extern "C" __global__ void QVelDev1h27( int inx, //if (q>=zero && q<=one) //{ // feq=c2over27* (drho/*+three*( vx1 )*/+c9over2*( vx1 )*( vx1 )-cu_sq); - // (D.f[dirW])[kw]=(one-q)/(one+q)*(f_E-f_W+(f_E+f_W-two*feq*om1)/(one-om1))*c1o2+(q*(f_E+f_W)-six*c2over27*( VeloX ))/(one+q); - // //(D.f[dirW])[kw]=zero; + // (D.f[DIR_M00])[kw]=(one-q)/(one+q)*(f_E-f_W+(f_E+f_W-two*feq*om1)/(one-om1))*c1o2+(q*(f_E+f_W)-six*c2over27*( VeloX ))/(one+q); + // //(D.f[DIR_M00])[kw]=zero; //} //q = q_dirW[k]; //if (q>=zero && q<=one) //{ // feq=c2over27* (drho/*+three*(-vx1 )*/+c9over2*(-vx1 )*(-vx1 )-cu_sq); - // (D.f[dirE])[ke]=(one-q)/(one+q)*(f_W-f_E+(f_W+f_E-two*feq*om1)/(one-om1))*c1o2+(q*(f_W+f_E)-six*c2over27*(-VeloX ))/(one+q); - // //(D.f[dirE])[ke]=zero; + // (D.f[DIR_P00])[ke]=(one-q)/(one+q)*(f_W-f_E+(f_W+f_E-two*feq*om1)/(one-om1))*c1o2+(q*(f_W+f_E)-six*c2over27*(-VeloX ))/(one+q); + // //(D.f[DIR_P00])[ke]=zero; //} //q = q_dirN[k]; //if (q>=zero && q<=one) //{ // feq=c2over27* (drho/*+three*( vx2 )*/+c9over2*( vx2 )*( vx2 )-cu_sq); - // (D.f[dirS])[ks]=(one-q)/(one+q)*(f_N-f_S+(f_N+f_S-two*feq*om1)/(one-om1))*c1o2+(q*(f_N+f_S)-six*c2over27*( VeloY ))/(one+q); - // //(D.f[dirS])[ks]=zero; + // (D.f[DIR_0M0])[ks]=(one-q)/(one+q)*(f_N-f_S+(f_N+f_S-two*feq*om1)/(one-om1))*c1o2+(q*(f_N+f_S)-six*c2over27*( VeloY ))/(one+q); + // //(D.f[DIR_0M0])[ks]=zero; //} //q = q_dirS[k]; //if (q>=zero && q<=one) //{ // feq=c2over27* (drho/*+three*( -vx2 )*/+c9over2*( -vx2 )*( -vx2 )-cu_sq); - // (D.f[dirN])[kn]=(one-q)/(one+q)*(f_S-f_N+(f_S+f_N-two*feq*om1)/(one-om1))*c1o2+(q*(f_S+f_N)-six*c2over27*(-VeloY ))/(one+q); - // //(D.f[dirN])[kn]=zero; + // (D.f[DIR_0P0])[kn]=(one-q)/(one+q)*(f_S-f_N+(f_S+f_N-two*feq*om1)/(one-om1))*c1o2+(q*(f_S+f_N)-six*c2over27*(-VeloY ))/(one+q); + // //(D.f[DIR_0P0])[kn]=zero; //} //q = q_dirT[k]; //if (q>=zero && q<=one) //{ // feq=c2over27* (drho/*+three*( vx3)*/+c9over2*( vx3)*( vx3)-cu_sq); - // (D.f[dirB])[kb]=(one-q)/(one+q)*(f_T-f_B+(f_T+f_B-two*feq*om1)/(one-om1))*c1o2+(q*(f_T+f_B)-six*c2over27*( VeloZ ))/(one+q); - // //(D.f[dirB])[kb]=one; + // (D.f[DIR_00M])[kb]=(one-q)/(one+q)*(f_T-f_B+(f_T+f_B-two*feq*om1)/(one-om1))*c1o2+(q*(f_T+f_B)-six*c2over27*( VeloZ ))/(one+q); + // //(D.f[DIR_00M])[kb]=one; //} //q = q_dirB[k]; //if (q>=zero && q<=one) //{ // feq=c2over27* (drho/*+three*( -vx3)*/+c9over2*( -vx3)*( -vx3)-cu_sq); - // (D.f[dirT])[kt]=(one-q)/(one+q)*(f_B-f_T+(f_B+f_T-two*feq*om1)/(one-om1))*c1o2+(q*(f_B+f_T)-six*c2over27*(-VeloZ ))/(one+q); - // //(D.f[dirT])[kt]=zero; + // (D.f[DIR_00P])[kt]=(one-q)/(one+q)*(f_B-f_T+(f_B+f_T-two*feq*om1)/(one-om1))*c1o2+(q*(f_B+f_T)-six*c2over27*(-VeloZ ))/(one+q); + // //(D.f[DIR_00P])[kt]=zero; //} //q = q_dirNE[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*( vx1+vx2 )*/+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - // (D.f[dirSW])[ksw]=(one-q)/(one+q)*(f_NE-f_SW+(f_NE+f_SW-two*feq*om1)/(one-om1))*c1o2+(q*(f_NE+f_SW)-six*c1over54*(VeloX+VeloY))/(one+q); - // //(D.f[dirSW])[ksw]=zero; + // (D.f[DIR_MM0])[ksw]=(one-q)/(one+q)*(f_NE-f_SW+(f_NE+f_SW-two*feq*om1)/(one-om1))*c1o2+(q*(f_NE+f_SW)-six*c1over54*(VeloX+VeloY))/(one+q); + // //(D.f[DIR_MM0])[ksw]=zero; //} //q = q_dirSW[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*(-vx1-vx2 )*/+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - // (D.f[dirNE])[kne]=(one-q)/(one+q)*(f_SW-f_NE+(f_SW+f_NE-two*feq*om1)/(one-om1))*c1o2+(q*(f_SW+f_NE)-six*c1over54*(-VeloX-VeloY))/(one+q); - // //(D.f[dirNE])[kne]=zero; + // (D.f[DIR_PP0])[kne]=(one-q)/(one+q)*(f_SW-f_NE+(f_SW+f_NE-two*feq*om1)/(one-om1))*c1o2+(q*(f_SW+f_NE)-six*c1over54*(-VeloX-VeloY))/(one+q); + // //(D.f[DIR_PP0])[kne]=zero; //} //q = q_dirSE[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*( vx1-vx2 )*/+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - // (D.f[dirNW])[knw]=(one-q)/(one+q)*(f_SE-f_NW+(f_SE+f_NW-two*feq*om1)/(one-om1))*c1o2+(q*(f_SE+f_NW)-six*c1over54*( VeloX-VeloY))/(one+q); - // //(D.f[dirNW])[knw]=zero; + // (D.f[DIR_MP0])[knw]=(one-q)/(one+q)*(f_SE-f_NW+(f_SE+f_NW-two*feq*om1)/(one-om1))*c1o2+(q*(f_SE+f_NW)-six*c1over54*( VeloX-VeloY))/(one+q); + // //(D.f[DIR_MP0])[knw]=zero; //} //q = q_dirNW[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*(-vx1+vx2 )*/+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - // (D.f[dirSE])[kse]=(one-q)/(one+q)*(f_NW-f_SE+(f_NW+f_SE-two*feq*om1)/(one-om1))*c1o2+(q*(f_NW+f_SE)-six*c1over54*(-VeloX+VeloY))/(one+q); - // //(D.f[dirSE])[kse]=zero; + // (D.f[DIR_PM0])[kse]=(one-q)/(one+q)*(f_NW-f_SE+(f_NW+f_SE-two*feq*om1)/(one-om1))*c1o2+(q*(f_NW+f_SE)-six*c1over54*(-VeloX+VeloY))/(one+q); + // //(D.f[DIR_PM0])[kse]=zero; //} //q = q_dirTE[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*( vx1 +vx3)*/+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - // (D.f[dirBW])[kbw]=(one-q)/(one+q)*(f_TE-f_BW+(f_TE+f_BW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TE+f_BW)-six*c1over54*( VeloX+VeloZ))/(one+q); - // //(D.f[dirBW])[kbw]=zero; + // (D.f[DIR_M0M])[kbw]=(one-q)/(one+q)*(f_TE-f_BW+(f_TE+f_BW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TE+f_BW)-six*c1over54*( VeloX+VeloZ))/(one+q); + // //(D.f[DIR_M0M])[kbw]=zero; //} //q = q_dirBW[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*(-vx1 -vx3)*/+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - // (D.f[dirTE])[kte]=(one-q)/(one+q)*(f_BW-f_TE+(f_BW+f_TE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BW+f_TE)-six*c1over54*(-VeloX-VeloZ))/(one+q); - // //(D.f[dirTE])[kte]=zero; + // (D.f[DIR_P0P])[kte]=(one-q)/(one+q)*(f_BW-f_TE+(f_BW+f_TE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BW+f_TE)-six*c1over54*(-VeloX-VeloZ))/(one+q); + // //(D.f[DIR_P0P])[kte]=zero; //} //q = q_dirBE[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*( vx1 -vx3)*/+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - // (D.f[dirTW])[ktw]=(one-q)/(one+q)*(f_BE-f_TW+(f_BE+f_TW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BE+f_TW)-six*c1over54*( VeloX-VeloZ))/(one+q); - // //(D.f[dirTW])[ktw]=zero; + // (D.f[DIR_M0P])[ktw]=(one-q)/(one+q)*(f_BE-f_TW+(f_BE+f_TW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BE+f_TW)-six*c1over54*( VeloX-VeloZ))/(one+q); + // //(D.f[DIR_M0P])[ktw]=zero; //} //q = q_dirTW[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*(-vx1 +vx3)*/+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - // (D.f[dirBE])[kbe]=(one-q)/(one+q)*(f_TW-f_BE+(f_TW+f_BE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TW+f_BE)-six*c1over54*(-VeloX+VeloZ))/(one+q); - // //(D.f[dirBE])[kbe]=zero; + // (D.f[DIR_P0M])[kbe]=(one-q)/(one+q)*(f_TW-f_BE+(f_TW+f_BE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TW+f_BE)-six*c1over54*(-VeloX+VeloZ))/(one+q); + // //(D.f[DIR_P0M])[kbe]=zero; //} //q = q_dirTN[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*( vx2+vx3)*/+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq); - // (D.f[dirBS])[kbs]=(one-q)/(one+q)*(f_TN-f_BS+(f_TN+f_BS-two*feq*om1)/(one-om1))*c1o2+(q*(f_TN+f_BS)-six*c1over54*( VeloY+VeloZ))/(one+q); - // //(D.f[dirBS])[kbs]=zero; + // (D.f[DIR_0MM])[kbs]=(one-q)/(one+q)*(f_TN-f_BS+(f_TN+f_BS-two*feq*om1)/(one-om1))*c1o2+(q*(f_TN+f_BS)-six*c1over54*( VeloY+VeloZ))/(one+q); + // //(D.f[DIR_0MM])[kbs]=zero; //} //q = q_dirBS[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*( -vx2-vx3)*/+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - // (D.f[dirTN])[ktn]=(one-q)/(one+q)*(f_BS-f_TN+(f_BS+f_TN-two*feq*om1)/(one-om1))*c1o2+(q*(f_BS+f_TN)-six*c1over54*( -VeloY-VeloZ))/(one+q); - // //(D.f[dirTN])[ktn]=zero; + // (D.f[DIR_0PP])[ktn]=(one-q)/(one+q)*(f_BS-f_TN+(f_BS+f_TN-two*feq*om1)/(one-om1))*c1o2+(q*(f_BS+f_TN)-six*c1over54*( -VeloY-VeloZ))/(one+q); + // //(D.f[DIR_0PP])[ktn]=zero; //} //q = q_dirBN[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*( vx2-vx3)*/+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq); - // (D.f[dirTS])[kts]=(one-q)/(one+q)*(f_BN-f_TS+(f_BN+f_TS-two*feq*om1)/(one-om1))*c1o2+(q*(f_BN+f_TS)-six*c1over54*( VeloY-VeloZ))/(one+q); - // //(D.f[dirTS])[kts]=zero; + // (D.f[DIR_0MP])[kts]=(one-q)/(one+q)*(f_BN-f_TS+(f_BN+f_TS-two*feq*om1)/(one-om1))*c1o2+(q*(f_BN+f_TS)-six*c1over54*( VeloY-VeloZ))/(one+q); + // //(D.f[DIR_0MP])[kts]=zero; //} //q = q_dirTS[k]; //if (q>=zero && q<=one) //{ // feq=c1over54* (drho/*+three*( -vx2+vx3)*/+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - // (D.f[dirBN])[kbn]=(one-q)/(one+q)*(f_TS-f_BN+(f_TS+f_BN-two*feq*om1)/(one-om1))*c1o2+(q*(f_TS+f_BN)-six*c1over54*( -VeloY+VeloZ))/(one+q); - // //(D.f[dirBN])[kbn]=zero; + // (D.f[DIR_0PM])[kbn]=(one-q)/(one+q)*(f_TS-f_BN+(f_TS+f_BN-two*feq*om1)/(one-om1))*c1o2+(q*(f_TS+f_BN)-six*c1over54*( -VeloY+VeloZ))/(one+q); + // //(D.f[DIR_0PM])[kbn]=zero; //} //q = q_dirTNE[k]; //if (q>=zero && q<=one) //{ // feq=c1over216*(drho/*+three*( vx1+vx2+vx3)*/+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - // (D.f[dirBSW])[kbsw]=(one-q)/(one+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNE+f_BSW)-six*c1over216*( VeloX+VeloY+VeloZ))/(one+q); - // //(D.f[dirBSW])[kbsw]=zero; + // (D.f[DIR_MMM])[kbsw]=(one-q)/(one+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNE+f_BSW)-six*c1over216*( VeloX+VeloY+VeloZ))/(one+q); + // //(D.f[DIR_MMM])[kbsw]=zero; //} //q = q_dirBSW[k]; //if (q>=zero && q<=one) //{ // feq=c1over216*(drho/*+three*(-vx1-vx2-vx3)*/+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - // (D.f[dirTNE])[ktne]=(one-q)/(one+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSW+f_TNE)-six*c1over216*(-VeloX-VeloY-VeloZ))/(one+q); - // //(D.f[dirTNE])[ktne]=zero; + // (D.f[DIR_PPP])[ktne]=(one-q)/(one+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSW+f_TNE)-six*c1over216*(-VeloX-VeloY-VeloZ))/(one+q); + // //(D.f[DIR_PPP])[ktne]=zero; //} //q = q_dirBNE[k]; //if (q>=zero && q<=one) //{ // feq=c1over216*(drho/*+three*( vx1+vx2-vx3)*/+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - // (D.f[dirTSW])[ktsw]=(one-q)/(one+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNE+f_TSW)-six*c1over216*( VeloX+VeloY-VeloZ))/(one+q); - // //(D.f[dirTSW])[ktsw]=zero; + // (D.f[DIR_MMP])[ktsw]=(one-q)/(one+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNE+f_TSW)-six*c1over216*( VeloX+VeloY-VeloZ))/(one+q); + // //(D.f[DIR_MMP])[ktsw]=zero; //} //q = q_dirTSW[k]; //if (q>=zero && q<=one) //{ // feq=c1over216*(drho/*+three*(-vx1-vx2+vx3)*/+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - // (D.f[dirBNE])[kbne]=(one-q)/(one+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSW+f_BNE)-six*c1over216*(-VeloX-VeloY+VeloZ))/(one+q); - // //(D.f[dirBNE])[kbne]=zero; + // (D.f[DIR_PPM])[kbne]=(one-q)/(one+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSW+f_BNE)-six*c1over216*(-VeloX-VeloY+VeloZ))/(one+q); + // //(D.f[DIR_PPM])[kbne]=zero; //} //q = q_dirTSE[k]; //if (q>=zero && q<=one) //{ // feq=c1over216*(drho/*+three*( vx1-vx2+vx3)*/+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - // (D.f[dirBNW])[kbnw]=(one-q)/(one+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSE+f_BNW)-six*c1over216*( VeloX-VeloY+VeloZ))/(one+q); - // //(D.f[dirBNW])[kbnw]=zero; + // (D.f[DIR_MPM])[kbnw]=(one-q)/(one+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSE+f_BNW)-six*c1over216*( VeloX-VeloY+VeloZ))/(one+q); + // //(D.f[DIR_MPM])[kbnw]=zero; //} //q = q_dirBNW[k]; //if (q>=zero && q<=one) //{ // feq=c1over216*(drho/*+three*(-vx1+vx2-vx3)*/+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - // (D.f[dirTSE])[ktse]=(one-q)/(one+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNW+f_TSE)-six*c1over216*(-VeloX+VeloY-VeloZ))/(one+q); - // //(D.f[dirTSE])[ktse]=zero; + // (D.f[DIR_PMP])[ktse]=(one-q)/(one+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNW+f_TSE)-six*c1over216*(-VeloX+VeloY-VeloZ))/(one+q); + // //(D.f[DIR_PMP])[ktse]=zero; //} //q = q_dirBSE[k]; //if (q>=zero && q<=one) //{ // feq=c1over216*(drho/*+three*( vx1-vx2-vx3)*/+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - // (D.f[dirTNW])[ktnw]=(one-q)/(one+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSE+f_TNW)-six*c1over216*( VeloX-VeloY-VeloZ))/(one+q); - // //(D.f[dirTNW])[ktnw]=zero; + // (D.f[DIR_MPP])[ktnw]=(one-q)/(one+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSE+f_TNW)-six*c1over216*( VeloX-VeloY-VeloZ))/(one+q); + // //(D.f[DIR_MPP])[ktnw]=zero; //} //q = q_dirTNW[k]; //if (q>=zero && q<=one) //{ // feq=c1over216*(drho/*+three*(-vx1+vx2+vx3)*/+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - // (D.f[dirBSE])[kbse]=(one-q)/(one+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNW+f_BSE)-six*c1over216*(-VeloX+VeloY+VeloZ))/(one+q); - // //(D.f[dirBSE])[kbse]=zero; + // (D.f[DIR_PMM])[kbse]=(one-q)/(one+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNW+f_BSE)-six*c1over216*(-VeloX+VeloY+VeloZ))/(one+q); + // //(D.f[DIR_PMM])[kbse]=zero; //} ///////// equilibrium BC @@ -4735,208 +4500,208 @@ extern "C" __global__ void QVelDev1h27( int inx, if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*( VeloXpur )+c9o2*( VeloX )*( VeloX )-cu_sq); - (D.f[dirW])[kw]=feq; - //(D.f[dirW])[kw]=zero; + (D.f[DIR_M00])[kw]=feq; + //(D.f[DIR_M00])[kw]=zero; } q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*(-VeloXpur )+c9o2*(-VeloX )*(-VeloX )-cu_sq); - (D.f[dirE])[ke]=feq; - //(D.f[dirE])[ke]=zero; + (D.f[DIR_P00])[ke]=feq; + //(D.f[DIR_P00])[ke]=zero; } q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*( VeloYpur )+c9o2*( VeloY )*( VeloY )-cu_sq); - (D.f[dirS])[ks]=feq; - //(D.f[dirS])[ks]=zero; + (D.f[DIR_0M0])[ks]=feq; + //(D.f[DIR_0M0])[ks]=zero; } q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*( -VeloYpur )+c9o2*( -VeloY )*( -VeloY )-cu_sq); - (D.f[dirN])[kn]=feq; - //(D.f[dirN])[kn]=zero; + (D.f[DIR_0P0])[kn]=feq; + //(D.f[DIR_0P0])[kn]=zero; } q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - (D.f[dirB])[kb]=feq; - //(D.f[dirB])[kb]=one; + (D.f[DIR_00M])[kb]=feq; + //(D.f[DIR_00M])[kb]=one; } q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - (D.f[dirT])[kt]=feq; - //(D.f[dirT])[kt]=zero; + (D.f[DIR_00P])[kt]=feq; + //(D.f[DIR_00P])[kt]=zero; } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloXpur+VeloYpur )+c9o2*( VeloX+VeloY )*( VeloX+VeloY )-cu_sq); - (D.f[dirSW])[ksw]=feq; - //(D.f[dirSW])[ksw]=zero; + (D.f[DIR_MM0])[ksw]=feq; + //(D.f[DIR_MM0])[ksw]=zero; } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*(-VeloXpur-VeloYpur )+c9o2*(-VeloX-VeloY )*(-VeloX-VeloY )-cu_sq); - (D.f[dirNE])[kne]=feq; - //(D.f[dirNE])[kne]=zero; + (D.f[DIR_PP0])[kne]=feq; + //(D.f[DIR_PP0])[kne]=zero; } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloXpur-VeloYpur )+c9o2*( VeloX-VeloY )*( VeloX-VeloY )-cu_sq); - (D.f[dirNW])[knw]=feq; - //(D.f[dirNW])[knw]=zero; + (D.f[DIR_MP0])[knw]=feq; + //(D.f[DIR_MP0])[knw]=zero; } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*(-VeloXpur+VeloYpur )+c9o2*(-VeloX+VeloY )*(-VeloX+VeloY )-cu_sq); - (D.f[dirSE])[kse]=feq; - //(D.f[dirSE])[kse]=zero; + (D.f[DIR_PM0])[kse]=feq; + //(D.f[DIR_PM0])[kse]=zero; } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloXpur +vx3)+c9o2*( VeloX +vx3)*( VeloX +vx3)-cu_sq); - (D.f[dirBW])[kbw]=feq; - //(D.f[dirBW])[kbw]=zero; + (D.f[DIR_M0M])[kbw]=feq; + //(D.f[DIR_M0M])[kbw]=zero; } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*(-VeloXpur -vx3)+c9o2*(-VeloX -vx3)*(-VeloX -vx3)-cu_sq); - (D.f[dirTE])[kte]=feq; - //(D.f[dirTE])[kte]=zero; + (D.f[DIR_P0P])[kte]=feq; + //(D.f[DIR_P0P])[kte]=zero; } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloXpur -vx3)+c9o2*( VeloX -vx3)*( VeloX -vx3)-cu_sq); - (D.f[dirTW])[ktw]=feq; - //(D.f[dirTW])[ktw]=zero; + (D.f[DIR_M0P])[ktw]=feq; + //(D.f[DIR_M0P])[ktw]=zero; } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*(-VeloXpur +vx3)+c9o2*(-VeloX +vx3)*(-VeloX +vx3)-cu_sq); - (D.f[dirBE])[kbe]=feq; - //(D.f[dirBE])[kbe]=zero; + (D.f[DIR_P0M])[kbe]=feq; + //(D.f[DIR_P0M])[kbe]=zero; } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloYpur+vx3)+c9o2*( VeloY+vx3)*( VeloY+vx3)-cu_sq); - (D.f[dirBS])[kbs]=feq; - //(D.f[dirBS])[kbs]=zero; + (D.f[DIR_0MM])[kbs]=feq; + //(D.f[DIR_0MM])[kbs]=zero; } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( -VeloYpur-vx3)+c9o2*( -VeloY-vx3)*( -VeloY-vx3)-cu_sq); - (D.f[dirTN])[ktn]=feq; - //(D.f[dirTN])[ktn]=zero; + (D.f[DIR_0PP])[ktn]=feq; + //(D.f[DIR_0PP])[ktn]=zero; } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( VeloYpur-vx3)+c9o2*( VeloY-vx3)*( VeloY-vx3)-cu_sq); - (D.f[dirTS])[kts]=feq; - //(D.f[dirTS])[kts]=zero; + (D.f[DIR_0MP])[kts]=feq; + //(D.f[DIR_0MP])[kts]=zero; } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho+c3o1*( -VeloYpur+vx3)+c9o2*( -VeloY+vx3)*( -VeloY+vx3)-cu_sq); - (D.f[dirBN])[kbn]=feq; - //(D.f[dirBN])[kbn]=zero; + (D.f[DIR_0PM])[kbn]=feq; + //(D.f[DIR_0PM])[kbn]=zero; } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*( VeloXpur+VeloYpur+vx3)+c9o2*( VeloX+VeloY+vx3)*( VeloX+VeloY+vx3)-cu_sq); - (D.f[dirBSW])[kbsw]=feq; - //(D.f[dirBSW])[kbsw]=zero; + (D.f[DIR_MMM])[kbsw]=feq; + //(D.f[DIR_MMM])[kbsw]=zero; } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*(-VeloXpur-VeloYpur-vx3)+c9o2*(-VeloX-VeloY-vx3)*(-VeloX-VeloY-vx3)-cu_sq); - (D.f[dirTNE])[ktne]=feq; - //(D.f[dirTNE])[ktne]=zero; + (D.f[DIR_PPP])[ktne]=feq; + //(D.f[DIR_PPP])[ktne]=zero; } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*( VeloXpur+VeloYpur-vx3)+c9o2*( VeloX+VeloY-vx3)*( VeloX+VeloY-vx3)-cu_sq); - (D.f[dirTSW])[ktsw]=feq; - //(D.f[dirTSW])[ktsw]=zero; + (D.f[DIR_MMP])[ktsw]=feq; + //(D.f[DIR_MMP])[ktsw]=zero; } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*(-VeloXpur-VeloYpur+vx3)+c9o2*(-VeloX-VeloY+vx3)*(-VeloX-VeloY+vx3)-cu_sq); - (D.f[dirBNE])[kbne]=feq; - //(D.f[dirBNE])[kbne]=zero; + (D.f[DIR_PPM])[kbne]=feq; + //(D.f[DIR_PPM])[kbne]=zero; } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*( VeloXpur-VeloYpur+vx3)+c9o2*( VeloX-VeloY+vx3)*( VeloX-VeloY+vx3)-cu_sq); - (D.f[dirBNW])[kbnw]=feq; - //(D.f[dirBNW])[kbnw]=zero; + (D.f[DIR_MPM])[kbnw]=feq; + //(D.f[DIR_MPM])[kbnw]=zero; } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*(-VeloXpur+VeloYpur-vx3)+c9o2*(-VeloX+VeloY-vx3)*(-VeloX+VeloY-vx3)-cu_sq); - (D.f[dirTSE])[ktse]=feq; - //(D.f[dirTSE])[ktse]=zero; + (D.f[DIR_PMP])[ktse]=feq; + //(D.f[DIR_PMP])[ktse]=zero; } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*( VeloXpur-VeloYpur-vx3)+c9o2*( VeloX-VeloY-vx3)*( VeloX-VeloY-vx3)-cu_sq); - (D.f[dirTNW])[ktnw]=feq; - //(D.f[dirTNW])[ktnw]=zero; + (D.f[DIR_MPP])[ktnw]=feq; + //(D.f[DIR_MPP])[ktnw]=zero; } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho+c3o1*(-VeloXpur+VeloYpur+vx3)+c9o2*(-VeloX+VeloY+vx3)*(-VeloX+VeloY+vx3)-cu_sq); - (D.f[dirBSE])[kbse]=feq; - //(D.f[dirBSE])[kbse]=zero; + (D.f[DIR_PMM])[kbse]=feq; + //(D.f[DIR_PMM])[kbse]=zero; } } @@ -4982,153 +4747,82 @@ extern "C" __global__ void QVelDev1h27( int inx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVelDeviceComp27(int inx, - int iny, - real* vx, - real* vy, - real* vz, - real* DD, - int* k_Q, - real* QQ, - unsigned int sizeQ, - int kQ, - real om1, +__global__ void QVelDeviceComp27( + real* velocityX, + real* velocityY, + real* velocityZ, + real* distributions, + int* subgridDistanceIndices, + real* subgridDistances, + unsigned int numberOfBCnodes, + real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, - unsigned int size_Mat, - bool evenOrOdd) + unsigned int numberOfLBnodes, + bool isEvenTimestep) { - Distributions27 D; - if (evenOrOdd==true) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } + ////////////////////////////////////////////////////////////////////////// + //! The velocity boundary condition is executed in the following steps + //! //////////////////////////////////////////////////////////////////////////////// - const unsigned x = threadIdx.x; // Globaler x-Index - const unsigned y = blockIdx.x; // Globaler y-Index - const unsigned z = blockIdx.y; // Globaler z-Index + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; // global x-index + const unsigned y = blockIdx.x; // global y-index + const unsigned z = blockIdx.y; // global z-index const unsigned nx = blockDim.x; const unsigned ny = gridDim.x; const unsigned k = nx*(ny*z + y) + x; - ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + ////////////////////////////////////////////////////////////////////////// + //! - Run for all indices in size of boundary condition (numberOfBCnodes) + //! + if(k < numberOfBCnodes) { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on timestep is based on the esoteric twist algorithm \ref + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist; + getPointersToDistributions(dist, distributions, numberOfLBnodes, isEvenTimestep); + //////////////////////////////////////////////////////////////////////////////// - real VeloX = vx[k]; - real VeloY = vy[k]; - real VeloZ = vz[k]; //(16.0*(u0*2.0)*bbx*bby*(grid_nx-bbx)*(grid_ny-bby))/(grid_nx*grid_nx*grid_ny*grid_ny) + //! - Set local velocities + //! + real VeloX = velocityX[k]; + real VeloY = velocityY[k]; + real VeloZ = velocityZ[k]; + //////////////////////////////////////////////////////////////////////////////// - real *q_dirE, *q_dirW, *q_dirN, *q_dirS, *q_dirT, *q_dirB, - *q_dirNE, *q_dirSW, *q_dirSE, *q_dirNW, *q_dirTE, *q_dirBW, - *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, - *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, - *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + //! - Set local subgrid distances (q's) + //! + SubgridDistances27 subgridD; + getPointersToSubgridDistances(subgridD, subgridDistances, numberOfBCnodes); + //////////////////////////////////////////////////////////////////////////////// - //index - unsigned int KQK = k_Q[k]; - unsigned int kzero= KQK; - unsigned int ke = KQK; - unsigned int kw = neighborX[KQK]; - unsigned int kn = KQK; - unsigned int ks = neighborY[KQK]; - unsigned int kt = KQK; - unsigned int kb = neighborZ[KQK]; + //! - Set neighbor indices (necessary for indirect addressing) + //! + unsigned int indexOfBCnode = subgridDistanceIndices[k]; + unsigned int kzero= indexOfBCnode; + unsigned int ke = indexOfBCnode; + unsigned int kw = neighborX[indexOfBCnode]; + unsigned int kn = indexOfBCnode; + unsigned int ks = neighborY[indexOfBCnode]; + unsigned int kt = indexOfBCnode; + unsigned int kb = neighborZ[indexOfBCnode]; unsigned int ksw = neighborY[kw]; - unsigned int kne = KQK; + unsigned int kne = indexOfBCnode; unsigned int kse = ks; unsigned int knw = kw; unsigned int kbw = neighborZ[kw]; - unsigned int kte = KQK; + unsigned int kte = indexOfBCnode; unsigned int kbe = kb; unsigned int ktw = kw; unsigned int kbs = neighborZ[ks]; - unsigned int ktn = KQK; + unsigned int ktn = indexOfBCnode; unsigned int kbn = kb; unsigned int kts = ks; unsigned int ktse = ks; @@ -5137,333 +4831,301 @@ extern "C" __global__ void QVelDeviceComp27(int inx, unsigned int kbse = kbs; unsigned int ktsw = ksw; unsigned int kbne = kb; - unsigned int ktne = KQK; + unsigned int ktne = indexOfBCnode; unsigned int kbsw = neighborZ[ksw]; - //////////////////////////////////////////////////////////////////////////////// - real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, - f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// - real vx1, vx2, vx3, drho, feq, q; - drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + - f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + //! - Set local distributions + //! + real f_W = (dist.f[DIR_P00 ])[ke ]; + real f_E = (dist.f[DIR_M00 ])[kw ]; + real f_S = (dist.f[DIR_0P0 ])[kn ]; + real f_N = (dist.f[DIR_0M0 ])[ks ]; + real f_B = (dist.f[DIR_00P ])[kt ]; + real f_T = (dist.f[DIR_00M ])[kb ]; + real f_SW = (dist.f[DIR_PP0 ])[kne ]; + real f_NE = (dist.f[DIR_MM0 ])[ksw ]; + real f_NW = (dist.f[DIR_PM0 ])[kse ]; + real f_SE = (dist.f[DIR_MP0 ])[knw ]; + real f_BW = (dist.f[DIR_P0P ])[kte ]; + real f_TE = (dist.f[DIR_M0M ])[kbw ]; + real f_TW = (dist.f[DIR_P0M ])[kbe ]; + real f_BE = (dist.f[DIR_M0P ])[ktw ]; + real f_BS = (dist.f[DIR_0PP ])[ktn ]; + real f_TN = (dist.f[DIR_0MM ])[kbs ]; + real f_TS = (dist.f[DIR_0PM ])[kbn ]; + real f_BN = (dist.f[DIR_0MP ])[kts ]; + real f_BSW = (dist.f[DIR_PPP ])[ktne ]; + real f_BNE = (dist.f[DIR_MMP ])[ktsw ]; + real f_BNW = (dist.f[DIR_PMP ])[ktse ]; + real f_BSE = (dist.f[DIR_MPP ])[ktnw ]; + real f_TSW = (dist.f[DIR_PPM ])[kbne ]; + real f_TNE = (dist.f[DIR_MMM ])[kbsw ]; + real f_TNW = (dist.f[DIR_PMM ])[kbse ]; + real f_TSE = (dist.f[DIR_MPM ])[kbnw ]; - vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + - (f_E - f_W)) / (c1o1 + drho); - + //////////////////////////////////////////////////////////////////////////////// + //! - Calculate macroscopic quantities + //! + real drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + + f_T + f_B + f_N + f_S + f_E + f_W + ((dist.f[DIR_000])[kzero]); - vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + - ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + - (f_N - f_S)) / (c1o1 + drho); + real vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + + (f_E - f_W)) / (c1o1 + drho); - vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + - (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + - (f_T - f_B)) / (c1o1 + drho); + real vx2 = ((-(f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + + ((f_BN - f_TS) + (f_TN - f_BS)) + (-(f_SE - f_NW) + (f_NE - f_SW)) + + (f_N - f_S)) / (c1o1 + drho); - real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3) * (c1o1 + drho); + real vx3 = (((f_TSE - f_BNW) + (f_TNW - f_BSE)) + ((f_TNE - f_BSW) + (f_TSW - f_BNE)) + + (-(f_BN - f_TS) + (f_TN - f_BS)) + ((f_TE - f_BW) - (f_BE - f_TW)) + + (f_T - f_B)) / (c1o1 + drho); - ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; - } - else - { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //(D.f[dirZERO])[k]=c1o10; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real cu_sq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3) * (c1o1 + drho); - //ToDo anders Klammern + //////////////////////////////////////////////////////////////////////////////// + //! - change the pointer to write the results in the correct array + //! + getPointersToDistributions(dist, distributions, numberOfLBnodes, !isEvenTimestep); - q = q_dirE[k]; - if (q>=c0o1 && q<=c1o1) + //////////////////////////////////////////////////////////////////////////////// + //! - Update distributions with subgrid distance (q) between zero and one + //! + real feq, q, velocityLB, velocityBC; + q = (subgridD.q[DIR_P00])[k]; + if (q>=c0o1 && q<=c1o1) // only update distribution for q between zero and one { - feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ) /** (one + drho)*/)/(c1o1+q);// - c2over27 * drho; - //(D.f[dirW])[kw]=zero; + velocityLB = vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloX; + (dist.f[DIR_M00])[kw] = getInterpolatedDistributionForVeloBC(q, f_E, f_W, feq, omega, velocityBC, c2o27); } - q = q_dirW[k]; + q = (subgridD.q[DIR_M00])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 ) * (c1o1 + drho)-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ) /** (one + drho)*/)/(c1o1+q);// - c2over27 * drho; - //(D.f[dirE])[ke]=zero; + velocityLB = -vx1; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloX; + (dist.f[DIR_P00])[ke] = getInterpolatedDistributionForVeloBC(q, f_W, f_E, feq, omega, velocityBC, c2o27); } - q = q_dirN[k]; + q = (subgridD.q[DIR_0P0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ) /** (one + drho)*/)/(c1o1+q);// - c2over27 * drho; - //(D.f[dirS])[ks]=zero; + velocityLB = vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloY; + (dist.f[DIR_0M0])[ks] = getInterpolatedDistributionForVeloBC(q, f_N, f_S, feq, omega, velocityBC, c2o27); } - q = q_dirS[k]; + q = (subgridD.q[DIR_0M0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ) /** (one + drho)*/)/(c1o1+q);// - c2over27 * drho; - //(D.f[dirN])[kn]=zero; + velocityLB = -vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloY; + (dist.f[DIR_0P0])[kn] = getInterpolatedDistributionForVeloBC(q, f_S, f_N, feq, omega, velocityBC, c2o27); } - q = q_dirT[k]; + q = (subgridD.q[DIR_00P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ )/* * (one + drho)*/)/(c1o1+q);// - c2over27 * drho; - //(D.f[dirB])[kb]=one; + velocityLB = vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = VeloZ; + (dist.f[DIR_00M])[kb] = getInterpolatedDistributionForVeloBC(q, f_T, f_B, feq, omega, velocityBC, c2o27); } - q = q_dirB[k]; + q = (subgridD.q[DIR_00M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ) /** (one + drho)*/)/(c1o1+q);// - c2over27 * drho; - //(D.f[dirT])[kt]=zero; + velocityLB = -vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c2o27); + velocityBC = -VeloZ; + (dist.f[DIR_00P])[kt] = getInterpolatedDistributionForVeloBC(q, f_B, f_T, feq, omega, velocityBC, c2o27); } - q = q_dirNE[k]; + q = (subgridD.q[DIR_PP0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirSW])[ksw]=zero; + velocityLB = vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX + VeloY; + (dist.f[DIR_MM0])[ksw] = getInterpolatedDistributionForVeloBC(q, f_NE, f_SW, feq, omega, velocityBC, c1o54); } - q = q_dirSW[k]; + q = (subgridD.q[DIR_MM0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirNE])[kne]=zero; + velocityLB = -vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX - VeloY; + (dist.f[DIR_PP0])[kne] = getInterpolatedDistributionForVeloBC(q, f_SW, f_NE, feq, omega, velocityBC, c1o54); } - q = q_dirSE[k]; + q = (subgridD.q[DIR_PM0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirNW])[knw]=zero; + velocityLB = vx1 - vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX - VeloY; + (dist.f[DIR_MP0])[knw] = getInterpolatedDistributionForVeloBC(q, f_SE, f_NW, feq, omega, velocityBC, c1o54); } - q = q_dirNW[k]; + q = (subgridD.q[DIR_MP0])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 ) * (c1o1 + drho)-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirSE])[kse]=zero; + velocityLB = -vx1 + vx2; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX + VeloY; + (dist.f[DIR_PM0])[kse] = getInterpolatedDistributionForVeloBC(q, f_NW, f_SE, feq, omega, velocityBC, c1o54); } - q = q_dirTE[k]; + q = (subgridD.q[DIR_P0P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirBW])[kbw]=zero; + velocityLB = vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX + VeloZ; + (dist.f[DIR_M0M])[kbw] = getInterpolatedDistributionForVeloBC(q, f_TE, f_BW, feq, omega, velocityBC, c1o54); } - q = q_dirBW[k]; + q = (subgridD.q[DIR_M0M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirTE])[kte]=zero; + velocityLB = -vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX - VeloZ; + (dist.f[DIR_P0P])[kte] = getInterpolatedDistributionForVeloBC(q, f_BW, f_TE, feq, omega, velocityBC, c1o54); } - q = q_dirBE[k]; + q = (subgridD.q[DIR_P0M])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirTW])[ktw]=zero; + velocityLB = vx1 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloX - VeloZ; + (dist.f[DIR_M0P])[ktw] = getInterpolatedDistributionForVeloBC(q, f_BE, f_TW, feq, omega, velocityBC, c1o54); } - q = q_dirTW[k]; + q = (subgridD.q[DIR_M0P])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirBE])[kbe]=zero; + velocityLB = -vx1 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloX + VeloZ; + (dist.f[DIR_P0M])[kbe] = getInterpolatedDistributionForVeloBC(q, f_TW, f_BE, feq, omega, velocityBC, c1o54); } - q = q_dirTN[k]; + q = (subgridD.q[DIR_0PP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirBS])[kbs]=zero; + velocityLB = vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloY + VeloZ; + (dist.f[DIR_0MM])[kbs] = getInterpolatedDistributionForVeloBC(q, f_TN, f_BS, feq, omega, velocityBC, c1o54); } - q = q_dirBS[k]; + q = (subgridD.q[DIR_0MM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirTN])[ktn]=zero; + velocityLB = -vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloY - VeloZ; + (dist.f[DIR_0PP])[ktn] = getInterpolatedDistributionForVeloBC(q, f_BS, f_TN, feq, omega, velocityBC, c1o54); } - q = q_dirBN[k]; + q = (subgridD.q[DIR_0PM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirTS])[kts]=zero; + velocityLB = vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = VeloY - VeloZ; + (dist.f[DIR_0MP])[kts] = getInterpolatedDistributionForVeloBC(q, f_BN, f_TS, feq, omega, velocityBC, c1o54); } - q = q_dirTS[k]; + q = (subgridD.q[DIR_0MP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over54 * drho; - //(D.f[dirBN])[kbn]=zero; + velocityLB = -vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o54); + velocityBC = -VeloY + VeloZ; + (dist.f[DIR_0PM])[kbn] = getInterpolatedDistributionForVeloBC(q, f_TS, f_BN, feq, omega, velocityBC, c1o54); } - q = q_dirTNE[k]; + q = (subgridD.q[DIR_PPP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over216 * drho; - //(D.f[dirBSW])[kbsw]=zero; + velocityLB = vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX + VeloY + VeloZ; + (dist.f[DIR_MMM])[kbsw] = getInterpolatedDistributionForVeloBC(q, f_TNE, f_BSW, feq, omega, velocityBC, c1o216); } - q = q_dirBSW[k]; + q = (subgridD.q[DIR_MMM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over216 * drho; - //(D.f[dirTNE])[ktne]=zero; + velocityLB = -vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX - VeloY - VeloZ; + (dist.f[DIR_PPP])[ktne] = getInterpolatedDistributionForVeloBC(q, f_BSW, f_TNE, feq, omega, velocityBC, c1o216); } - q = q_dirBNE[k]; + q = (subgridD.q[DIR_PPM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over216 * drho; - //(D.f[dirTSW])[ktsw]=zero; + velocityLB = vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX + VeloY - VeloZ; + (dist.f[DIR_MMP])[ktsw] = getInterpolatedDistributionForVeloBC(q, f_BNE, f_TSW, feq, omega, velocityBC, c1o216); } - q = q_dirTSW[k]; + q = (subgridD.q[DIR_MMP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over216 * drho; - //(D.f[dirBNE])[kbne]=zero; + velocityLB = -vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX - VeloY + VeloZ; + (dist.f[DIR_PPM])[kbne] = getInterpolatedDistributionForVeloBC(q, f_TSW, f_BNE, feq, omega, velocityBC, c1o216); } - q = q_dirTSE[k]; + q = (subgridD.q[DIR_PMP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over216 * drho; - //(D.f[dirBNW])[kbnw]=zero; + velocityLB = vx1 - vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX - VeloY + VeloZ; + (dist.f[DIR_MPM])[kbnw] = getInterpolatedDistributionForVeloBC(q, f_TSE, f_BNW, feq, omega, velocityBC, c1o216); } - q = q_dirBNW[k]; + q = (subgridD.q[DIR_MPM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over216 * drho; - //(D.f[dirTSE])[ktse]=zero; + velocityLB = -vx1 + vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX + VeloY - VeloZ; + (dist.f[DIR_PMP])[ktse] = getInterpolatedDistributionForVeloBC(q, f_BNW, f_TSE, feq, omega, velocityBC, c1o216); } - q = q_dirBSE[k]; + q = (subgridD.q[DIR_PMM])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over216 * drho; - //(D.f[dirTNW])[ktnw]=zero; + velocityLB = vx1 - vx2 - vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = VeloX - VeloY - VeloZ; + (dist.f[DIR_MPP])[ktnw] = getInterpolatedDistributionForVeloBC(q, f_BSE, f_TNW, feq, omega, velocityBC, c1o216); } - q = q_dirTNW[k]; + q = (subgridD.q[DIR_MPP])[k]; if (q>=c0o1 && q<=c1o1) { - feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (c1o1 + drho)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ) /** (one + drho)*/)/(c1o1+q);// - c1over216 * drho; - //(D.f[dirBSE])[kbse]=zero; + velocityLB = -vx1 + vx2 + vx3; + feq = getEquilibriumForBC(drho, velocityLB, cu_sq, c1o216); + velocityBC = -VeloX + VeloY + VeloZ; + (dist.f[DIR_PMM])[kbse] = getInterpolatedDistributionForVeloBC(q, f_TNW, f_BSE, feq, omega, velocityBC, c1o216); } } } @@ -5508,7 +5170,7 @@ extern "C" __global__ void QVelDeviceComp27(int inx, ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void QVelDevice27(int inx, +__global__ void QVelDevice27(int inx, int iny, real* vx, real* vy, @@ -5516,75 +5178,74 @@ extern "C" __global__ void QVelDevice27(int inx, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -5597,7 +5258,7 @@ extern "C" __global__ void QVelDevice27(int inx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real VeloX = vx[k]; @@ -5609,32 +5270,32 @@ extern "C" __global__ void QVelDevice27(int inx, *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, *q_dirBSE, *q_dirBNW; - q_dirE = &QQ[dirE *sizeQ]; - q_dirW = &QQ[dirW *sizeQ]; - q_dirN = &QQ[dirN *sizeQ]; - q_dirS = &QQ[dirS *sizeQ]; - q_dirT = &QQ[dirT *sizeQ]; - q_dirB = &QQ[dirB *sizeQ]; - q_dirNE = &QQ[dirNE *sizeQ]; - q_dirSW = &QQ[dirSW *sizeQ]; - q_dirSE = &QQ[dirSE *sizeQ]; - q_dirNW = &QQ[dirNW *sizeQ]; - q_dirTE = &QQ[dirTE *sizeQ]; - q_dirBW = &QQ[dirBW *sizeQ]; - q_dirBE = &QQ[dirBE *sizeQ]; - q_dirTW = &QQ[dirTW *sizeQ]; - q_dirTN = &QQ[dirTN *sizeQ]; - q_dirBS = &QQ[dirBS *sizeQ]; - q_dirBN = &QQ[dirBN *sizeQ]; - q_dirTS = &QQ[dirTS *sizeQ]; - q_dirTNE = &QQ[dirTNE *sizeQ]; - q_dirTSW = &QQ[dirTSW *sizeQ]; - q_dirTSE = &QQ[dirTSE *sizeQ]; - q_dirTNW = &QQ[dirTNW *sizeQ]; - q_dirBNE = &QQ[dirBNE *sizeQ]; - q_dirBSW = &QQ[dirBSW *sizeQ]; - q_dirBSE = &QQ[dirBSE *sizeQ]; - q_dirBNW = &QQ[dirBNW *sizeQ]; + q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -5697,37 +5358,37 @@ extern "C" __global__ void QVelDevice27(int inx, real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// real vx1, vx2, vx3, drho, feq, q; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = ((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -5745,69 +5406,69 @@ extern "C" __global__ void QVelDevice27(int inx, real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); ////////////////////////////////////////////////////////////////////////// - if (evenOrOdd==false) - { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + if (isEvenTimestep==false) + { + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Test - //(D.f[dirZERO])[k]=c1o10; + //(D.f[DIR_000])[k]=c1o10; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //ToDo anders Klammern @@ -5816,208 +5477,208 @@ extern "C" __global__ void QVelDevice27(int inx, if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx1 )*/+c9o2*( vx1 )*( vx1 )-cu_sq); - (D.f[dirW])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ))/(c1o1+q); - //(D.f[dirW])[kw]=zero; + (D.f[DIR_M00])[kw]=(c1o1-q)/(c1o1+q)*(f_E-f_W+(f_E+f_W-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_E+f_W)-c6o1*c2o27*( VeloX ))/(c1o1+q); + //(D.f[DIR_M00])[kw]=zero; } q = q_dirW[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*(-vx1 )*/+c9o2*(-vx1 )*(-vx1 )-cu_sq); - (D.f[dirE])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ))/(c1o1+q); - //(D.f[dirE])[ke]=zero; + (D.f[DIR_P00])[ke]=(c1o1-q)/(c1o1+q)*(f_W-f_E+(f_W+f_E-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_W+f_E)-c6o1*c2o27*(-VeloX ))/(c1o1+q); + //(D.f[DIR_P00])[ke]=zero; } q = q_dirN[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx2 )*/+c9o2*( vx2 )*( vx2 )-cu_sq); - (D.f[dirS])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ))/(c1o1+q); - //(D.f[dirS])[ks]=zero; + (D.f[DIR_0M0])[ks]=(c1o1-q)/(c1o1+q)*(f_N-f_S+(f_N+f_S-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_N+f_S)-c6o1*c2o27*( VeloY ))/(c1o1+q); + //(D.f[DIR_0M0])[ks]=zero; } q = q_dirS[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx2 )*/+c9o2*( -vx2 )*( -vx2 )-cu_sq); - (D.f[dirN])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ))/(c1o1+q); - //(D.f[dirN])[kn]=zero; + (D.f[DIR_0P0])[kn]=(c1o1-q)/(c1o1+q)*(f_S-f_N+(f_S+f_N-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_S+f_N)-c6o1*c2o27*(-VeloY ))/(c1o1+q); + //(D.f[DIR_0P0])[kn]=zero; } q = q_dirT[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( vx3)*/+c9o2*( vx3)*( vx3)-cu_sq); - (D.f[dirB])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ ))/(c1o1+q); - //(D.f[dirB])[kb]=one; + (D.f[DIR_00M])[kb]=(c1o1-q)/(c1o1+q)*(f_T-f_B+(f_T+f_B-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_T+f_B)-c6o1*c2o27*( VeloZ ))/(c1o1+q); + //(D.f[DIR_00M])[kb]=one; } q = q_dirB[k]; if (q>=c0o1 && q<=c1o1) { feq=c2o27* (drho/*+three*( -vx3)*/+c9o2*( -vx3)*( -vx3)-cu_sq); - (D.f[dirT])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ))/(c1o1+q); - //(D.f[dirT])[kt]=zero; + (D.f[DIR_00P])[kt]=(c1o1-q)/(c1o1+q)*(f_B-f_T+(f_B+f_T-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_B+f_T)-c6o1*c2o27*(-VeloZ ))/(c1o1+q); + //(D.f[DIR_00P])[kt]=zero; } q = q_dirNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1+vx2 )*/+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - (D.f[dirSW])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY))/(c1o1+q); - //(D.f[dirSW])[ksw]=zero; + (D.f[DIR_MM0])[ksw]=(c1o1-q)/(c1o1+q)*(f_NE-f_SW+(f_NE+f_SW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NE+f_SW)-c6o1*c1o54*(VeloX+VeloY))/(c1o1+q); + //(D.f[DIR_MM0])[ksw]=zero; } q = q_dirSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1-vx2 )*/+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - (D.f[dirNE])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q); - //(D.f[dirNE])[kne]=zero; + (D.f[DIR_PP0])[kne]=(c1o1-q)/(c1o1+q)*(f_SW-f_NE+(f_SW+f_NE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SW+f_NE)-c6o1*c1o54*(-VeloX-VeloY))/(c1o1+q); + //(D.f[DIR_PP0])[kne]=zero; } q = q_dirSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1-vx2 )*/+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - (D.f[dirNW])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q); - //(D.f[dirNW])[knw]=zero; + (D.f[DIR_MP0])[knw]=(c1o1-q)/(c1o1+q)*(f_SE-f_NW+(f_SE+f_NW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_SE+f_NW)-c6o1*c1o54*( VeloX-VeloY))/(c1o1+q); + //(D.f[DIR_MP0])[knw]=zero; } q = q_dirNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1+vx2 )*/+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - (D.f[dirSE])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q); - //(D.f[dirSE])[kse]=zero; + (D.f[DIR_PM0])[kse]=(c1o1-q)/(c1o1+q)*(f_NW-f_SE+(f_NW+f_SE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_NW+f_SE)-c6o1*c1o54*(-VeloX+VeloY))/(c1o1+q); + //(D.f[DIR_PM0])[kse]=zero; } q = q_dirTE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 +vx3)*/+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - (D.f[dirBW])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q); - //(D.f[dirBW])[kbw]=zero; + (D.f[DIR_M0M])[kbw]=(c1o1-q)/(c1o1+q)*(f_TE-f_BW+(f_TE+f_BW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TE+f_BW)-c6o1*c1o54*( VeloX+VeloZ))/(c1o1+q); + //(D.f[DIR_M0M])[kbw]=zero; } q = q_dirBW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 -vx3)*/+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - (D.f[dirTE])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q); - //(D.f[dirTE])[kte]=zero; + (D.f[DIR_P0P])[kte]=(c1o1-q)/(c1o1+q)*(f_BW-f_TE+(f_BW+f_TE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BW+f_TE)-c6o1*c1o54*(-VeloX-VeloZ))/(c1o1+q); + //(D.f[DIR_P0P])[kte]=zero; } q = q_dirBE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx1 -vx3)*/+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - (D.f[dirTW])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q); - //(D.f[dirTW])[ktw]=zero; + (D.f[DIR_M0P])[ktw]=(c1o1-q)/(c1o1+q)*(f_BE-f_TW+(f_BE+f_TW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BE+f_TW)-c6o1*c1o54*( VeloX-VeloZ))/(c1o1+q); + //(D.f[DIR_M0P])[ktw]=zero; } q = q_dirTW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*(-vx1 +vx3)*/+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - (D.f[dirBE])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q); - //(D.f[dirBE])[kbe]=zero; + (D.f[DIR_P0M])[kbe]=(c1o1-q)/(c1o1+q)*(f_TW-f_BE+(f_TW+f_BE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TW+f_BE)-c6o1*c1o54*(-VeloX+VeloZ))/(c1o1+q); + //(D.f[DIR_P0M])[kbe]=zero; } q = q_dirTN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2+vx3)*/+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - (D.f[dirBS])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBS])[kbs]=zero; + (D.f[DIR_0MM])[kbs]=(c1o1-q)/(c1o1+q)*(f_TN-f_BS+(f_TN+f_BS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TN+f_BS)-c6o1*c1o54*( VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_0MM])[kbs]=zero; } q = q_dirBS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2-vx3)*/+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - (D.f[dirTN])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTN])[ktn]=zero; + (D.f[DIR_0PP])[ktn]=(c1o1-q)/(c1o1+q)*(f_BS-f_TN+(f_BS+f_TN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BS+f_TN)-c6o1*c1o54*( -VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_0PP])[ktn]=zero; } q = q_dirBN[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( vx2-vx3)*/+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - (D.f[dirTS])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTS])[kts]=zero; + (D.f[DIR_0MP])[kts]=(c1o1-q)/(c1o1+q)*(f_BN-f_TS+(f_BN+f_TS-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BN+f_TS)-c6o1*c1o54*( VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_0MP])[kts]=zero; } q = q_dirTS[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o54* (drho/*+three*( -vx2+vx3)*/+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - (D.f[dirBN])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBN])[kbn]=zero; + (D.f[DIR_0PM])[kbn]=(c1o1-q)/(c1o1+q)*(f_TS-f_BN+(f_TS+f_BN-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TS+f_BN)-c6o1*c1o54*( -VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_0PM])[kbn]=zero; } q = q_dirTNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2+vx3)*/+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - (D.f[dirBSW])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBSW])[kbsw]=zero; + (D.f[DIR_MMM])[kbsw]=(c1o1-q)/(c1o1+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNE+f_BSW)-c6o1*c1o216*( VeloX+VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_MMM])[kbsw]=zero; } q = q_dirBSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2-vx3)*/+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - (D.f[dirTNE])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTNE])[ktne]=zero; + (D.f[DIR_PPP])[ktne]=(c1o1-q)/(c1o1+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSW+f_TNE)-c6o1*c1o216*(-VeloX-VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_PPP])[ktne]=zero; } q = q_dirBNE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1+vx2-vx3)*/+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - (D.f[dirTSW])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTSW])[ktsw]=zero; + (D.f[DIR_MMP])[ktsw]=(c1o1-q)/(c1o1+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNE+f_TSW)-c6o1*c1o216*( VeloX+VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_MMP])[ktsw]=zero; } q = q_dirTSW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1-vx2+vx3)*/+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - (D.f[dirBNE])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBNE])[kbne]=zero; + (D.f[DIR_PPM])[kbne]=(c1o1-q)/(c1o1+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSW+f_BNE)-c6o1*c1o216*(-VeloX-VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_PPM])[kbne]=zero; } q = q_dirTSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2+vx3)*/+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - (D.f[dirBNW])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBNW])[kbnw]=zero; + (D.f[DIR_MPM])[kbnw]=(c1o1-q)/(c1o1+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TSE+f_BNW)-c6o1*c1o216*( VeloX-VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_MPM])[kbnw]=zero; } q = q_dirBNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2-vx3)*/+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - (D.f[dirTSE])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTSE])[ktse]=zero; + (D.f[DIR_PMP])[ktse]=(c1o1-q)/(c1o1+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BNW+f_TSE)-c6o1*c1o216*(-VeloX+VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_PMP])[ktse]=zero; } q = q_dirBSE[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*( vx1-vx2-vx3)*/+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - (D.f[dirTNW])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q); - //(D.f[dirTNW])[ktnw]=zero; + (D.f[DIR_MPP])[ktnw]=(c1o1-q)/(c1o1+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_BSE+f_TNW)-c6o1*c1o216*( VeloX-VeloY-VeloZ))/(c1o1+q); + //(D.f[DIR_MPP])[ktnw]=zero; } q = q_dirTNW[k]; if (q>=c0o1 && q<=c1o1) { feq=c1o216*(drho/*+three*(-vx1+vx2+vx3)*/+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); - (D.f[dirBSE])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q); - //(D.f[dirBSE])[kbse]=zero; + (D.f[DIR_PMM])[kbse]=(c1o1-q)/(c1o1+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-c2o1*feq*om1)/(c1o1-om1))*c1o2+(q*(f_TNW+f_BSE)-c6o1*c1o216*(-VeloX+VeloY+VeloZ))/(c1o1+q); + //(D.f[DIR_PMM])[kbse]=zero; } } } @@ -6062,7 +5723,7 @@ extern "C" __global__ void QVelDevice27(int inx, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void PropellerBC(unsigned int* neighborX, +__global__ void PropellerBC(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, real* rho, @@ -6093,63 +5754,63 @@ extern "C" __global__ void PropellerBC(unsigned int* neighborX, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; } ////////////////////////////////////////////////////////////////////////// unsigned int KQK = k_Q[k]; @@ -6197,59 +5858,59 @@ extern "C" __global__ void PropellerBC(unsigned int* neighborX, real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW, f_ZERO; - f_ZERO= (D.f[dirZERO])[kzero]; - f_E = (D.f[dirE ])[ke ]; - f_W = (D.f[dirW ])[kw ]; - f_N = (D.f[dirN ])[kn ]; - f_S = (D.f[dirS ])[ks ]; - f_T = (D.f[dirT ])[kt ]; - f_B = (D.f[dirB ])[kb ]; - f_NE = (D.f[dirNE ])[kne ]; - f_SW = (D.f[dirSW ])[ksw ]; - f_SE = (D.f[dirSE ])[kse ]; - f_NW = (D.f[dirNW ])[knw ]; - f_TE = (D.f[dirTE ])[kte ]; - f_BW = (D.f[dirBW ])[kbw ]; - f_BE = (D.f[dirBE ])[kbe ]; - f_TW = (D.f[dirTW ])[ktw ]; - f_TN = (D.f[dirTN ])[ktn ]; - f_BS = (D.f[dirBS ])[kbs ]; - f_BN = (D.f[dirBN ])[kbn ]; - f_TS = (D.f[dirTS ])[kts ]; - f_TNE = (D.f[dirTNE ])[ktne ]; - f_BSW = (D.f[dirBSW ])[kbsw ]; - f_BNE = (D.f[dirBNE ])[kbne ]; - f_TSW = (D.f[dirTSW ])[ktsw ]; - f_TSE = (D.f[dirTSE ])[ktse ]; - f_BNW = (D.f[dirBNW ])[kbnw ]; - f_BSE = (D.f[dirBSE ])[kbse ]; - f_TNW = (D.f[dirTNW ])[ktnw ]; - //f_W = (D.f[dirE ])[ke ]; - //f_E = (D.f[dirW ])[kw ]; - //f_S = (D.f[dirN ])[kn ]; - //f_N = (D.f[dirS ])[ks ]; - //f_B = (D.f[dirT ])[kt ]; - //f_T = (D.f[dirB ])[kb ]; - //f_SW = (D.f[dirNE ])[kne ]; - //f_NE = (D.f[dirSW ])[ksw ]; - //f_NW = (D.f[dirSE ])[kse ]; - //f_SE = (D.f[dirNW ])[knw ]; - //f_BW = (D.f[dirTE ])[kte ]; - //f_TE = (D.f[dirBW ])[kbw ]; - //f_TW = (D.f[dirBE ])[kbe ]; - //f_BE = (D.f[dirTW ])[ktw ]; - //f_BS = (D.f[dirTN ])[ktn ]; - //f_TN = (D.f[dirBS ])[kbs ]; - //f_TS = (D.f[dirBN ])[kbn ]; - //f_BN = (D.f[dirTS ])[kts ]; - //f_BSW = (D.f[dirTNE ])[ktne ]; - //f_TNE = (D.f[dirBSW ])[kbsw ]; - //f_TSW = (D.f[dirBNE ])[kbne ]; - //f_BNE = (D.f[dirTSW ])[ktsw ]; - //f_BNW = (D.f[dirTSE ])[ktse ]; - //f_TSE = (D.f[dirBNW ])[kbnw ]; - //f_TNW = (D.f[dirBSE ])[kbse ]; - //f_BSE = (D.f[dirTNW ])[ktnw ]; + f_ZERO= (D.f[DIR_000])[kzero]; + f_E = (D.f[DIR_P00 ])[ke ]; + f_W = (D.f[DIR_M00 ])[kw ]; + f_N = (D.f[DIR_0P0 ])[kn ]; + f_S = (D.f[DIR_0M0 ])[ks ]; + f_T = (D.f[DIR_00P ])[kt ]; + f_B = (D.f[DIR_00M ])[kb ]; + f_NE = (D.f[DIR_PP0 ])[kne ]; + f_SW = (D.f[DIR_MM0 ])[ksw ]; + f_SE = (D.f[DIR_PM0 ])[kse ]; + f_NW = (D.f[DIR_MP0 ])[knw ]; + f_TE = (D.f[DIR_P0P ])[kte ]; + f_BW = (D.f[DIR_M0M ])[kbw ]; + f_BE = (D.f[DIR_P0M ])[kbe ]; + f_TW = (D.f[DIR_M0P ])[ktw ]; + f_TN = (D.f[DIR_0PP ])[ktn ]; + f_BS = (D.f[DIR_0MM ])[kbs ]; + f_BN = (D.f[DIR_0PM ])[kbn ]; + f_TS = (D.f[DIR_0MP ])[kts ]; + f_TNE = (D.f[DIR_PPP ])[ktne ]; + f_BSW = (D.f[DIR_MMM ])[kbsw ]; + f_BNE = (D.f[DIR_PPM ])[kbne ]; + f_TSW = (D.f[DIR_MMP ])[ktsw ]; + f_TSE = (D.f[DIR_PMP ])[ktse ]; + f_BNW = (D.f[DIR_MPM ])[kbnw ]; + f_BSE = (D.f[DIR_PMM ])[kbse ]; + f_TNW = (D.f[DIR_MPP ])[ktnw ]; + //f_W = (D.f[DIR_P00 ])[ke ]; + //f_E = (D.f[DIR_M00 ])[kw ]; + //f_S = (D.f[DIR_0P0 ])[kn ]; + //f_N = (D.f[DIR_0M0 ])[ks ]; + //f_B = (D.f[DIR_00P ])[kt ]; + //f_T = (D.f[DIR_00M ])[kb ]; + //f_SW = (D.f[DIR_PP0 ])[kne ]; + //f_NE = (D.f[DIR_MM0 ])[ksw ]; + //f_NW = (D.f[DIR_PM0 ])[kse ]; + //f_SE = (D.f[DIR_MP0 ])[knw ]; + //f_BW = (D.f[DIR_P0P ])[kte ]; + //f_TE = (D.f[DIR_M0M ])[kbw ]; + //f_TW = (D.f[DIR_P0M ])[kbe ]; + //f_BE = (D.f[DIR_M0P ])[ktw ]; + //f_BS = (D.f[DIR_0PP ])[ktn ]; + //f_TN = (D.f[DIR_0MM ])[kbs ]; + //f_TS = (D.f[DIR_0PM ])[kbn ]; + //f_BN = (D.f[DIR_0MP ])[kts ]; + //f_BSW = (D.f[DIR_PPP ])[ktne ]; + //f_TNE = (D.f[DIR_MMM ])[kbsw ]; + //f_TSW = (D.f[DIR_PPM ])[kbne ]; + //f_BNE = (D.f[DIR_MMP ])[ktsw ]; + //f_BNW = (D.f[DIR_PMP ])[ktse ]; + //f_TSE = (D.f[DIR_MPM ])[kbnw ]; + //f_TNW = (D.f[DIR_PMM ])[kbse ]; + //f_BSE = (D.f[DIR_MPP ])[ktnw ]; ////////////////////////////////////////////////////////////////////////////////// real vxo1, vxo2, vxo3, drho; drho = /*zero;*/f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + @@ -6330,89 +5991,89 @@ extern "C" __global__ void PropellerBC(unsigned int* neighborX, f_BSE = f_BSE + ((c1o1+drho) * (- c1o216*(c3o1*( vxo1-vxo2-vxo3)+c9o2*( vxo1-vxo2-vxo3)*( vxo1-vxo2-vxo3)-cusq) + c1o216*(c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq2))); f_TNW = f_TNW + ((c1o1+drho) * (- c1o216*(c3o1*(-vxo1+vxo2+vxo3)+c9o2*(-vxo1+vxo2+vxo3)*(-vxo1+vxo2+vxo3)-cusq) + c1o216*(c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq2))); - (D.f[dirZERO])[kzero] = f_ZERO; - (D.f[dirE ])[ke ] = f_E ; // f_W ;// - (D.f[dirW ])[kw ] = f_W ; // f_E ;// - (D.f[dirN ])[kn ] = f_N ; // f_S ;// - (D.f[dirS ])[ks ] = f_S ; // f_N ;// - (D.f[dirT ])[kt ] = f_T ; // f_B ;// - (D.f[dirB ])[kb ] = f_B ; // f_T ;// - (D.f[dirNE ])[kne ] = f_NE ; // f_SW ;// - (D.f[dirSW ])[ksw ] = f_SW ; // f_NE ;// - (D.f[dirSE ])[kse ] = f_SE ; // f_NW ;// - (D.f[dirNW ])[knw ] = f_NW ; // f_SE ;// - (D.f[dirTE ])[kte ] = f_TE ; // f_BW ;// - (D.f[dirBW ])[kbw ] = f_BW ; // f_TE ;// - (D.f[dirBE ])[kbe ] = f_BE ; // f_TW ;// - (D.f[dirTW ])[ktw ] = f_TW ; // f_BE ;// - (D.f[dirTN ])[ktn ] = f_TN ; // f_BS ;// - (D.f[dirBS ])[kbs ] = f_BS ; // f_TN ;// - (D.f[dirBN ])[kbn ] = f_BN ; // f_TS ;// - (D.f[dirTS ])[kts ] = f_TS ; // f_BN ;// - (D.f[dirTNE ])[ktne ] = f_TNE ; // f_BSW ;// - (D.f[dirBSW ])[kbsw ] = f_BSW ; // f_BNE ;// - (D.f[dirBNE ])[kbne ] = f_BNE ; // f_BNW ;// - (D.f[dirTSW ])[ktsw ] = f_TSW ; // f_BSE ;// - (D.f[dirTSE ])[ktse ] = f_TSE ; // f_TSW ;// - (D.f[dirBNW ])[kbnw ] = f_BNW ; // f_TNE ;// - (D.f[dirBSE ])[kbse ] = f_BSE ; // f_TNW ;// - (D.f[dirTNW ])[ktnw ] = f_TNW ; // f_TSE ;// + (D.f[DIR_000])[kzero] = f_ZERO; + (D.f[DIR_P00 ])[ke ] = f_E ; // f_W ;// + (D.f[DIR_M00 ])[kw ] = f_W ; // f_E ;// + (D.f[DIR_0P0 ])[kn ] = f_N ; // f_S ;// + (D.f[DIR_0M0 ])[ks ] = f_S ; // f_N ;// + (D.f[DIR_00P ])[kt ] = f_T ; // f_B ;// + (D.f[DIR_00M ])[kb ] = f_B ; // f_T ;// + (D.f[DIR_PP0 ])[kne ] = f_NE ; // f_SW ;// + (D.f[DIR_MM0 ])[ksw ] = f_SW ; // f_NE ;// + (D.f[DIR_PM0 ])[kse ] = f_SE ; // f_NW ;// + (D.f[DIR_MP0 ])[knw ] = f_NW ; // f_SE ;// + (D.f[DIR_P0P ])[kte ] = f_TE ; // f_BW ;// + (D.f[DIR_M0M ])[kbw ] = f_BW ; // f_TE ;// + (D.f[DIR_P0M ])[kbe ] = f_BE ; // f_TW ;// + (D.f[DIR_M0P ])[ktw ] = f_TW ; // f_BE ;// + (D.f[DIR_0PP ])[ktn ] = f_TN ; // f_BS ;// + (D.f[DIR_0MM ])[kbs ] = f_BS ; // f_TN ;// + (D.f[DIR_0PM ])[kbn ] = f_BN ; // f_TS ;// + (D.f[DIR_0MP ])[kts ] = f_TS ; // f_BN ;// + (D.f[DIR_PPP ])[ktne ] = f_TNE ; // f_BSW ;// + (D.f[DIR_MMM ])[kbsw ] = f_BSW ; // f_BNE ;// + (D.f[DIR_PPM ])[kbne ] = f_BNE ; // f_BNW ;// + (D.f[DIR_MMP ])[ktsw ] = f_TSW ; // f_BSE ;// + (D.f[DIR_PMP ])[ktse ] = f_TSE ; // f_TSW ;// + (D.f[DIR_MPM ])[kbnw ] = f_BNW ; // f_TNE ;// + (D.f[DIR_PMM ])[kbse ] = f_BSE ; // f_TNW ;// + (D.f[DIR_MPP ])[ktnw ] = f_TNW ; // f_TSE ;// ////////////////////////////////////////////////////////////////////////// - ////(D.f[dirZERO])[kzero] = c8over27* (drho-cu_sq); - //(D.f[dirE ])[ke ] = three*c2over27* ( vx1 ); //six - //(D.f[dirW ])[kw ] = three*c2over27* (-vx1 ); //six - //(D.f[dirN ])[kn ] = three*c2over27* ( vx2 ); //six - //(D.f[dirS ])[ks ] = three*c2over27* ( -vx2 ); //six - //(D.f[dirT ])[kt ] = three*c2over27* ( vx3); //six - //(D.f[dirB ])[kb ] = three*c2over27* ( -vx3); //six - //(D.f[dirNE ])[kne ] = three*c1over54* ( vx1+vx2 ); //six - //(D.f[dirSW ])[ksw ] = three*c1over54* (-vx1-vx2 ); //six - //(D.f[dirSE ])[kse ] = three*c1over54* ( vx1-vx2 ); //six - //(D.f[dirNW ])[knw ] = three*c1over54* (-vx1+vx2 ); //six - //(D.f[dirTE ])[kte ] = three*c1over54* ( vx1 +vx3); //six - //(D.f[dirBW ])[kbw ] = three*c1over54* (-vx1 -vx3); //six - //(D.f[dirBE ])[kbe ] = three*c1over54* ( vx1 -vx3); //six - //(D.f[dirTW ])[ktw ] = three*c1over54* (-vx1 +vx3); //six - //(D.f[dirTN ])[ktn ] = three*c1over54* ( vx2+vx3); //six - //(D.f[dirBS ])[kbs ] = three*c1over54* ( -vx2-vx3); //six - //(D.f[dirBN ])[kbn ] = three*c1over54* ( vx2-vx3); //six - //(D.f[dirTS ])[kts ] = three*c1over54* ( -vx2+vx3); //six - //(D.f[dirTNE ])[ktne ] = three*c1over216*( vx1+vx2+vx3); //six - //(D.f[dirBSW ])[kbsw ] = three*c1over216*(-vx1-vx2-vx3); //six - //(D.f[dirBNE ])[kbne ] = three*c1over216*( vx1+vx2-vx3); //six - //(D.f[dirTSW ])[ktsw ] = three*c1over216*(-vx1-vx2+vx3); //six - //(D.f[dirTSE ])[ktse ] = three*c1over216*( vx1-vx2+vx3); //six - //(D.f[dirBNW ])[kbnw ] = three*c1over216*(-vx1+vx2-vx3); //six - //(D.f[dirBSE ])[kbse ] = three*c1over216*( vx1-vx2-vx3); //six - //(D.f[dirTNW ])[ktnw ] = three*c1over216*(-vx1+vx2+vx3); //six - //(D.f[dirZERO])[kzero] = c8over27* (drho-cu_sq); - //(D.f[dirE ])[ke ] = c2over27* (drho+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq); - //(D.f[dirW ])[kw ] = c2over27* (drho+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq); - //(D.f[dirN ])[kn ] = c2over27* (drho+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq); - //(D.f[dirS ])[ks ] = c2over27* (drho+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq); - //(D.f[dirT ])[kt ] = c2over27* (drho+three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq); - //(D.f[dirB ])[kb ] = c2over27* (drho+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq); - //(D.f[dirNE ])[kne ] = c1over54* (drho+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - //(D.f[dirSW ])[ksw ] = c1over54* (drho+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - //(D.f[dirSE ])[kse ] = c1over54* (drho+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - //(D.f[dirNW ])[knw ] = c1over54* (drho+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - //(D.f[dirTE ])[kte ] = c1over54* (drho+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - //(D.f[dirBW ])[kbw ] = c1over54* (drho+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - //(D.f[dirBE ])[kbe ] = c1over54* (drho+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - //(D.f[dirTW ])[ktw ] = c1over54* (drho+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - //(D.f[dirTN ])[ktn ] = c1over54* (drho+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq); - //(D.f[dirBS ])[kbs ] = c1over54* (drho+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - //(D.f[dirBN ])[kbn ] = c1over54* (drho+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq); - //(D.f[dirTS ])[kts ] = c1over54* (drho+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - //(D.f[dirTNE ])[ktne ] = c1over216*(drho+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - //(D.f[dirBSW ])[kbsw ] = c1over216*(drho+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - //(D.f[dirBNE ])[kbne ] = c1over216*(drho+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - //(D.f[dirTSW ])[ktsw ] = c1over216*(drho+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - //(D.f[dirTSE ])[ktse ] = c1over216*(drho+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - //(D.f[dirBNW ])[kbnw ] = c1over216*(drho+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - //(D.f[dirBSE ])[kbse ] = c1over216*(drho+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - //(D.f[dirTNW ])[ktnw ] = c1over216*(drho+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + ////(D.f[DIR_000])[kzero] = c8over27* (drho-cu_sq); + //(D.f[DIR_P00 ])[ke ] = three*c2over27* ( vx1 ); //six + //(D.f[DIR_M00 ])[kw ] = three*c2over27* (-vx1 ); //six + //(D.f[DIR_0P0 ])[kn ] = three*c2over27* ( vx2 ); //six + //(D.f[DIR_0M0 ])[ks ] = three*c2over27* ( -vx2 ); //six + //(D.f[DIR_00P ])[kt ] = three*c2over27* ( vx3); //six + //(D.f[DIR_00M ])[kb ] = three*c2over27* ( -vx3); //six + //(D.f[DIR_PP0 ])[kne ] = three*c1over54* ( vx1+vx2 ); //six + //(D.f[DIR_MM0 ])[ksw ] = three*c1over54* (-vx1-vx2 ); //six + //(D.f[DIR_PM0 ])[kse ] = three*c1over54* ( vx1-vx2 ); //six + //(D.f[DIR_MP0 ])[knw ] = three*c1over54* (-vx1+vx2 ); //six + //(D.f[DIR_P0P ])[kte ] = three*c1over54* ( vx1 +vx3); //six + //(D.f[DIR_M0M ])[kbw ] = three*c1over54* (-vx1 -vx3); //six + //(D.f[DIR_P0M ])[kbe ] = three*c1over54* ( vx1 -vx3); //six + //(D.f[DIR_M0P ])[ktw ] = three*c1over54* (-vx1 +vx3); //six + //(D.f[DIR_0PP ])[ktn ] = three*c1over54* ( vx2+vx3); //six + //(D.f[DIR_0MM ])[kbs ] = three*c1over54* ( -vx2-vx3); //six + //(D.f[DIR_0PM ])[kbn ] = three*c1over54* ( vx2-vx3); //six + //(D.f[DIR_0MP ])[kts ] = three*c1over54* ( -vx2+vx3); //six + //(D.f[DIR_PPP ])[ktne ] = three*c1over216*( vx1+vx2+vx3); //six + //(D.f[DIR_MMM ])[kbsw ] = three*c1over216*(-vx1-vx2-vx3); //six + //(D.f[DIR_PPM ])[kbne ] = three*c1over216*( vx1+vx2-vx3); //six + //(D.f[DIR_MMP ])[ktsw ] = three*c1over216*(-vx1-vx2+vx3); //six + //(D.f[DIR_PMP ])[ktse ] = three*c1over216*( vx1-vx2+vx3); //six + //(D.f[DIR_MPM ])[kbnw ] = three*c1over216*(-vx1+vx2-vx3); //six + //(D.f[DIR_PMM ])[kbse ] = three*c1over216*( vx1-vx2-vx3); //six + //(D.f[DIR_MPP ])[ktnw ] = three*c1over216*(-vx1+vx2+vx3); //six + //(D.f[DIR_000])[kzero] = c8over27* (drho-cu_sq); + //(D.f[DIR_P00 ])[ke ] = c2over27* (drho+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq); + //(D.f[DIR_M00 ])[kw ] = c2over27* (drho+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cu_sq); + //(D.f[DIR_0P0 ])[kn ] = c2over27* (drho+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cu_sq); + //(D.f[DIR_0M0 ])[ks ] = c2over27* (drho+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cu_sq); + //(D.f[DIR_00P ])[kt ] = c2over27* (drho+three*( vx3)+c9over2*( vx3)*( vx3)-cu_sq); + //(D.f[DIR_00M ])[kb ] = c2over27* (drho+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cu_sq); + //(D.f[DIR_PP0 ])[kne ] = c1over54* (drho+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + //(D.f[DIR_MM0 ])[ksw ] = c1over54* (drho+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + //(D.f[DIR_PM0 ])[kse ] = c1over54* (drho+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + //(D.f[DIR_MP0 ])[knw ] = c1over54* (drho+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + //(D.f[DIR_P0P ])[kte ] = c1over54* (drho+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + //(D.f[DIR_M0M ])[kbw ] = c1over54* (drho+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + //(D.f[DIR_P0M ])[kbe ] = c1over54* (drho+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + //(D.f[DIR_M0P ])[ktw ] = c1over54* (drho+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + //(D.f[DIR_0PP ])[ktn ] = c1over54* (drho+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cu_sq); + //(D.f[DIR_0MM ])[kbs ] = c1over54* (drho+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + //(D.f[DIR_0PM ])[kbn ] = c1over54* (drho+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cu_sq); + //(D.f[DIR_0MP ])[kts ] = c1over54* (drho+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + //(D.f[DIR_PPP ])[ktne ] = c1over216*(drho+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + //(D.f[DIR_MMM ])[kbsw ] = c1over216*(drho+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + //(D.f[DIR_PPM ])[kbne ] = c1over216*(drho+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + //(D.f[DIR_MMP ])[ktsw ] = c1over216*(drho+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + //(D.f[DIR_PMP ])[ktse ] = c1over216*(drho+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + //(D.f[DIR_MPM ])[kbnw ] = c1over216*(drho+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + //(D.f[DIR_PMM ])[kbse ] = c1over216*(drho+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + //(D.f[DIR_MPP ])[ktnw ] = c1over216*(drho+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); } } } diff --git a/src/gpu/VirtualFluids_GPU/GPU/WaleCumulant27.cu b/src/gpu/VirtualFluids_GPU/GPU/WaleCumulant27.cu index e911a716ce74c3f4ff8c323a733269dc7d260dc7..16028e2f9f87716f43ed60f82ed513289e381b7c 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/WaleCumulant27.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/WaleCumulant27.cu @@ -1,15 +1,17 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + #include "math.h" //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27( +__global__ void LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27( real omega_in, unsigned int* bcMatD, unsigned int* neighborX, @@ -48,63 +50,63 @@ extern "C" __global__ void LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27( Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -118,33 +120,33 @@ extern "C" __global__ void LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27( unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k]; - real mfabb = (D.f[dirW])[kw]; - real mfbcb = (D.f[dirN])[k]; - real mfbab = (D.f[dirS])[ks]; - real mfbbc = (D.f[dirT])[k]; - real mfbba = (D.f[dirB])[kb]; - real mfccb = (D.f[dirNE])[k]; - real mfaab = (D.f[dirSW])[ksw]; - real mfcab = (D.f[dirSE])[ks]; - real mfacb = (D.f[dirNW])[kw]; - real mfcbc = (D.f[dirTE])[k]; - real mfaba = (D.f[dirBW])[kbw]; - real mfcba = (D.f[dirBE])[kb]; - real mfabc = (D.f[dirTW])[kw]; - real mfbcc = (D.f[dirTN])[k]; - real mfbaa = (D.f[dirBS])[kbs]; - real mfbca = (D.f[dirBN])[kb]; - real mfbac = (D.f[dirTS])[ks]; - real mfbbb = (D.f[dirZERO])[k]; - real mfccc = (D.f[dirTNE])[k]; - real mfaac = (D.f[dirTSW])[ksw]; - real mfcac = (D.f[dirTSE])[ks]; - real mfacc = (D.f[dirTNW])[kw]; - real mfcca = (D.f[dirBNE])[kb]; - real mfaaa = (D.f[dirBSW])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs]; - real mfaca = (D.f[dirBNW])[kbw]; + real mfcbb = (D.f[DIR_P00])[k]; + real mfabb = (D.f[DIR_M00])[kw]; + real mfbcb = (D.f[DIR_0P0])[k]; + real mfbab = (D.f[DIR_0M0])[ks]; + real mfbbc = (D.f[DIR_00P])[k]; + real mfbba = (D.f[DIR_00M])[kb]; + real mfccb = (D.f[DIR_PP0])[k]; + real mfaab = (D.f[DIR_MM0])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks]; + real mfacb = (D.f[DIR_MP0])[kw]; + real mfcbc = (D.f[DIR_P0P])[k]; + real mfaba = (D.f[DIR_M0M])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb]; + real mfabc = (D.f[DIR_M0P])[kw]; + real mfbcc = (D.f[DIR_0PP])[k]; + real mfbaa = (D.f[DIR_0MM])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb]; + real mfbac = (D.f[DIR_0MP])[ks]; + real mfbbb = (D.f[DIR_000])[k]; + real mfccc = (D.f[DIR_PPP])[k]; + real mfaac = (D.f[DIR_MMP])[ksw]; + real mfcac = (D.f[DIR_PMP])[ks]; + real mfacc = (D.f[DIR_MPP])[kw]; + real mfcca = (D.f[DIR_PPM])[kb]; + real mfaaa = (D.f[DIR_MMM])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs]; + real mfaca = (D.f[DIR_MPM])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -1005,33 +1007,33 @@ extern "C" __global__ void LB_Kernel_WaleBySoniMalav_Cum_AA2016_Comp_SP_27( //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb; - (D.f[dirW])[kw] = mfcbb; - (D.f[dirN])[k] = mfbab; - (D.f[dirS])[ks] = mfbcb; - (D.f[dirT])[k] = mfbba; - (D.f[dirB])[kb] = mfbbc; - (D.f[dirNE])[k] = mfaab; - (D.f[dirSW])[ksw] = mfccb; - (D.f[dirSE])[ks] = mfacb; - (D.f[dirNW])[kw] = mfcab; - (D.f[dirTE])[k] = mfaba; - (D.f[dirBW])[kbw] = mfcbc; - (D.f[dirBE])[kb] = mfabc; - (D.f[dirTW])[kw] = mfcba; - (D.f[dirTN])[k] = mfbaa; - (D.f[dirBS])[kbs] = mfbcc; - (D.f[dirBN])[kb] = mfbac; - (D.f[dirTS])[ks] = mfbca; - (D.f[dirZERO])[k] = mfbbb; - (D.f[dirTNE])[k] = mfaaa; - (D.f[dirTSE])[ks] = mfaca; - (D.f[dirBNE])[kb] = mfaac; - (D.f[dirBSE])[kbs] = mfacc; - (D.f[dirTNW])[kw] = mfcaa; - (D.f[dirTSW])[ksw] = mfcca; - (D.f[dirBNW])[kbw] = mfcac; - (D.f[dirBSW])[kbsw] = mfccc; + (D.f[DIR_P00])[k] = mfabb; + (D.f[DIR_M00])[kw] = mfcbb; + (D.f[DIR_0P0])[k] = mfbab; + (D.f[DIR_0M0])[ks] = mfbcb; + (D.f[DIR_00P])[k] = mfbba; + (D.f[DIR_00M])[kb] = mfbbc; + (D.f[DIR_PP0])[k] = mfaab; + (D.f[DIR_MM0])[ksw] = mfccb; + (D.f[DIR_PM0])[ks] = mfacb; + (D.f[DIR_MP0])[kw] = mfcab; + (D.f[DIR_P0P])[k] = mfaba; + (D.f[DIR_M0M])[kbw] = mfcbc; + (D.f[DIR_P0M])[kb] = mfabc; + (D.f[DIR_M0P])[kw] = mfcba; + (D.f[DIR_0PP])[k] = mfbaa; + (D.f[DIR_0MM])[kbs] = mfbcc; + (D.f[DIR_0PM])[kb] = mfbac; + (D.f[DIR_0MP])[ks] = mfbca; + (D.f[DIR_000])[k] = mfbbb; + (D.f[DIR_PPP])[k] = mfaaa; + (D.f[DIR_PMP])[ks] = mfaca; + (D.f[DIR_PPM])[kb] = mfaac; + (D.f[DIR_PMM])[kbs] = mfacc; + (D.f[DIR_MPP])[kw] = mfcaa; + (D.f[DIR_MMP])[ksw] = mfcca; + (D.f[DIR_MPM])[kbw] = mfcac; + (D.f[DIR_MMM])[kbsw] = mfccc; //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/GPU/WallFunction.cu b/src/gpu/VirtualFluids_GPU/GPU/WallFunction.cu index 20ef490ceb6224aef693ec0374d457fd2a4b9cde..d48fa80fd14ce15f4a380ed46403654b43c805e8 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/WallFunction.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/WallFunction.cu @@ -1,89 +1,88 @@ /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; ////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void WallFunction27(int inx, - int iny, +__global__ void WallFunction27( real* vx, real* vy, real* vz, real* DD, int* k_Q, real* QQ, - unsigned int sizeQ, - int kQ, + unsigned int numberOfBCnodes, real om1, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int size_Mat, - bool evenOrOdd) + bool isEvenTimestep) { Distributions27 D; - if (evenOrOdd==true) + if (isEvenTimestep==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index @@ -96,7 +95,7 @@ extern "C" __global__ void WallFunction27(int inx, const unsigned k = nx*(ny*z + y) + x; ////////////////////////////////////////////////////////////////////////// - if(k<kQ) + if(k<numberOfBCnodes) { //////////////////////////////////////////////////////////////////////////////// real VeloX = vx[k]; @@ -108,32 +107,32 @@ extern "C" __global__ void WallFunction27(int inx, // *q_dirBE, *q_dirTW, *q_dirTN, *q_dirBS, *q_dirBN, *q_dirTS, // *q_dirTNE, *q_dirTSW, *q_dirTSE, *q_dirTNW, *q_dirBNE, *q_dirBSW, // *q_dirBSE, *q_dirBNW; - //q_dirE = &QQ[dirE *sizeQ]; - //q_dirW = &QQ[dirW *sizeQ]; - //q_dirN = &QQ[dirN *sizeQ]; - //q_dirS = &QQ[dirS *sizeQ]; - //q_dirT = &QQ[dirT *sizeQ]; - //q_dirB = &QQ[dirB *sizeQ]; - //q_dirNE = &QQ[dirNE *sizeQ]; - //q_dirSW = &QQ[dirSW *sizeQ]; - //q_dirSE = &QQ[dirSE *sizeQ]; - //q_dirNW = &QQ[dirNW *sizeQ]; - //q_dirTE = &QQ[dirTE *sizeQ]; - //q_dirBW = &QQ[dirBW *sizeQ]; - //q_dirBE = &QQ[dirBE *sizeQ]; - //q_dirTW = &QQ[dirTW *sizeQ]; - //q_dirTN = &QQ[dirTN *sizeQ]; - //q_dirBS = &QQ[dirBS *sizeQ]; - //q_dirBN = &QQ[dirBN *sizeQ]; - //q_dirTS = &QQ[dirTS *sizeQ]; - //q_dirTNE = &QQ[dirTNE *sizeQ]; - //q_dirTSW = &QQ[dirTSW *sizeQ]; - //q_dirTSE = &QQ[dirTSE *sizeQ]; - //q_dirTNW = &QQ[dirTNW *sizeQ]; - //q_dirBNE = &QQ[dirBNE *sizeQ]; - //q_dirBSW = &QQ[dirBSW *sizeQ]; - //q_dirBSE = &QQ[dirBSE *sizeQ]; - //q_dirBNW = &QQ[dirBNW *sizeQ]; + //q_dirE = &QQ[DIR_P00 * numberOfBCnodes]; + //q_dirW = &QQ[DIR_M00 * numberOfBCnodes]; + //q_dirN = &QQ[DIR_0P0 * numberOfBCnodes]; + //q_dirS = &QQ[DIR_0M0 * numberOfBCnodes]; + //q_dirT = &QQ[DIR_00P * numberOfBCnodes]; + //q_dirB = &QQ[DIR_00M * numberOfBCnodes]; + //q_dirNE = &QQ[DIR_PP0 * numberOfBCnodes]; + //q_dirSW = &QQ[DIR_MM0 * numberOfBCnodes]; + //q_dirSE = &QQ[DIR_PM0 * numberOfBCnodes]; + //q_dirNW = &QQ[DIR_MP0 * numberOfBCnodes]; + //q_dirTE = &QQ[DIR_P0P * numberOfBCnodes]; + //q_dirBW = &QQ[DIR_M0M * numberOfBCnodes]; + //q_dirBE = &QQ[DIR_P0M * numberOfBCnodes]; + //q_dirTW = &QQ[DIR_M0P * numberOfBCnodes]; + //q_dirTN = &QQ[DIR_0PP * numberOfBCnodes]; + //q_dirBS = &QQ[DIR_0MM * numberOfBCnodes]; + //q_dirBN = &QQ[DIR_0PM * numberOfBCnodes]; + //q_dirTS = &QQ[DIR_0MP * numberOfBCnodes]; + //q_dirTNE = &QQ[DIR_PPP * numberOfBCnodes]; + //q_dirTSW = &QQ[DIR_MMP * numberOfBCnodes]; + //q_dirTSE = &QQ[DIR_PMP * numberOfBCnodes]; + //q_dirTNW = &QQ[DIR_MPP * numberOfBCnodes]; + //q_dirBNE = &QQ[DIR_PPM * numberOfBCnodes]; + //q_dirBSW = &QQ[DIR_MMM * numberOfBCnodes]; + //q_dirBSE = &QQ[DIR_PMM * numberOfBCnodes]; + //q_dirBNW = &QQ[DIR_MPM * numberOfBCnodes]; //////////////////////////////////////////////////////////////////////////////// //index unsigned int KQK = k_Q[k]; @@ -168,38 +167,38 @@ extern "C" __global__ void WallFunction27(int inx, real f_E, f_W, f_N, f_S, f_T, f_B, f_NE, f_SW, f_SE, f_NW, f_TE, f_BW, f_BE, f_TW, f_TN, f_BS, f_BN, f_TS, f_TNE, f_TSW, f_TSE, f_TNW, f_BNE, f_BSW, f_BSE, f_BNW; - f_W = (D.f[dirE ])[ke ]; - f_E = (D.f[dirW ])[kw ]; - f_S = (D.f[dirN ])[kn ]; - f_N = (D.f[dirS ])[ks ]; - f_B = (D.f[dirT ])[kt ]; - f_T = (D.f[dirB ])[kb ]; - f_SW = (D.f[dirNE ])[kne ]; - f_NE = (D.f[dirSW ])[ksw ]; - f_NW = (D.f[dirSE ])[kse ]; - f_SE = (D.f[dirNW ])[knw ]; - f_BW = (D.f[dirTE ])[kte ]; - f_TE = (D.f[dirBW ])[kbw ]; - f_TW = (D.f[dirBE ])[kbe ]; - f_BE = (D.f[dirTW ])[ktw ]; - f_BS = (D.f[dirTN ])[ktn ]; - f_TN = (D.f[dirBS ])[kbs ]; - f_TS = (D.f[dirBN ])[kbn ]; - f_BN = (D.f[dirTS ])[kts ]; - f_BSW = (D.f[dirTNE ])[ktne ]; - f_BNE = (D.f[dirTSW ])[ktsw ]; - f_BNW = (D.f[dirTSE ])[ktse ]; - f_BSE = (D.f[dirTNW ])[ktnw ]; - f_TSW = (D.f[dirBNE ])[kbne ]; - f_TNE = (D.f[dirBSW ])[kbsw ]; - f_TNW = (D.f[dirBSE ])[kbse ]; - f_TSE = (D.f[dirBNW ])[kbnw ]; + f_W = (D.f[DIR_P00 ])[ke ]; + f_E = (D.f[DIR_M00 ])[kw ]; + f_S = (D.f[DIR_0P0 ])[kn ]; + f_N = (D.f[DIR_0M0 ])[ks ]; + f_B = (D.f[DIR_00P ])[kt ]; + f_T = (D.f[DIR_00M ])[kb ]; + f_SW = (D.f[DIR_PP0 ])[kne ]; + f_NE = (D.f[DIR_MM0 ])[ksw ]; + f_NW = (D.f[DIR_PM0 ])[kse ]; + f_SE = (D.f[DIR_MP0 ])[knw ]; + f_BW = (D.f[DIR_P0P ])[kte ]; + f_TE = (D.f[DIR_M0M ])[kbw ]; + f_TW = (D.f[DIR_P0M ])[kbe ]; + f_BE = (D.f[DIR_M0P ])[ktw ]; + f_BS = (D.f[DIR_0PP ])[ktn ]; + f_TN = (D.f[DIR_0MM ])[kbs ]; + f_TS = (D.f[DIR_0PM ])[kbn ]; + f_BN = (D.f[DIR_0MP ])[kts ]; + f_BSW = (D.f[DIR_PPP ])[ktne ]; + f_BNE = (D.f[DIR_MMP ])[ktsw ]; + f_BNW = (D.f[DIR_PMP ])[ktse ]; + f_BSE = (D.f[DIR_MPP ])[ktnw ]; + f_TSW = (D.f[DIR_PPM ])[kbne ]; + f_TNE = (D.f[DIR_MMM ])[kbsw ]; + f_TNW = (D.f[DIR_PMM ])[kbse ]; + f_TSE = (D.f[DIR_MPM ])[kbnw ]; //////////////////////////////////////////////////////////////////////////////// // real vx2, vx3, feq, q; real vx1, drho; drho = f_TSE + f_TNW + f_TNE + f_TSW + f_BSE + f_BNW + f_BNE + f_BSW + f_BN + f_TS + f_TN + f_BS + f_BE + f_TW + f_TE + f_BW + f_SE + f_NW + f_NE + f_SW + - f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[dirZERO])[kzero]); + f_T + f_B + f_N + f_S + f_E + f_W + ((D.f[DIR_000])[kzero]); vx1 = (((f_TSE - f_BNW) - (f_TNW - f_BSE)) + ((f_TNE - f_BSW) - (f_TSW - f_BNE)) + ((f_BE - f_TW) + (f_TE - f_BW)) + ((f_SE - f_NW) + (f_NE - f_SW)) + @@ -233,69 +232,69 @@ extern "C" __global__ void WallFunction27(int inx, //vz[k] = 0.01; //Test...muss wieder raus // ////////////////////////////////////////////////////////////////////////// - // if (evenOrOdd==false) + // if (isEvenTimestep==false) // { - // D.f[dirE ] = &DD[dirE *size_Mat]; - // D.f[dirW ] = &DD[dirW *size_Mat]; - // D.f[dirN ] = &DD[dirN *size_Mat]; - // D.f[dirS ] = &DD[dirS *size_Mat]; - // D.f[dirT ] = &DD[dirT *size_Mat]; - // D.f[dirB ] = &DD[dirB *size_Mat]; - // D.f[dirNE ] = &DD[dirNE *size_Mat]; - // D.f[dirSW ] = &DD[dirSW *size_Mat]; - // D.f[dirSE ] = &DD[dirSE *size_Mat]; - // D.f[dirNW ] = &DD[dirNW *size_Mat]; - // D.f[dirTE ] = &DD[dirTE *size_Mat]; - // D.f[dirBW ] = &DD[dirBW *size_Mat]; - // D.f[dirBE ] = &DD[dirBE *size_Mat]; - // D.f[dirTW ] = &DD[dirTW *size_Mat]; - // D.f[dirTN ] = &DD[dirTN *size_Mat]; - // D.f[dirBS ] = &DD[dirBS *size_Mat]; - // D.f[dirBN ] = &DD[dirBN *size_Mat]; - // D.f[dirTS ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - // D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - // D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - // D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - // D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - // D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + // D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; // } // else // { - // D.f[dirW ] = &DD[dirE *size_Mat]; - // D.f[dirE ] = &DD[dirW *size_Mat]; - // D.f[dirS ] = &DD[dirN *size_Mat]; - // D.f[dirN ] = &DD[dirS *size_Mat]; - // D.f[dirB ] = &DD[dirT *size_Mat]; - // D.f[dirT ] = &DD[dirB *size_Mat]; - // D.f[dirSW ] = &DD[dirNE *size_Mat]; - // D.f[dirNE ] = &DD[dirSW *size_Mat]; - // D.f[dirNW ] = &DD[dirSE *size_Mat]; - // D.f[dirSE ] = &DD[dirNW *size_Mat]; - // D.f[dirBW ] = &DD[dirTE *size_Mat]; - // D.f[dirTE ] = &DD[dirBW *size_Mat]; - // D.f[dirTW ] = &DD[dirBE *size_Mat]; - // D.f[dirBE ] = &DD[dirTW *size_Mat]; - // D.f[dirBS ] = &DD[dirTN *size_Mat]; - // D.f[dirTN ] = &DD[dirBS *size_Mat]; - // D.f[dirTS ] = &DD[dirBN *size_Mat]; - // D.f[dirBN ] = &DD[dirTS *size_Mat]; - // D.f[dirZERO] = &DD[dirZERO*size_Mat]; - // D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - // D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - // D.f[dirTSE ] = &DD[dirBNW *size_Mat]; - // D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - // D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - // D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - // D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - // D.f[dirBNW ] = &DD[dirTSE *size_Mat]; + // D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + // D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + // D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + // D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + // D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + // D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + // D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + // D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + // D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + // D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + // D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + // D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + // D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + // D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + // D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + // D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + // D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + // D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + // D.f[DIR_000] = &DD[DIR_000*size_Mat]; + // D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + // D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + // D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; + // D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + // D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + // D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + // D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + // D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; // } // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // //Test - // //(D.f[dirZERO])[k]=c1o10; + // //(D.f[DIR_000])[k]=c1o10; // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////ToDo anders Klammern @@ -304,208 +303,208 @@ extern "C" __global__ void WallFunction27(int inx, // if (q>=zero && q<=one) // { // feq=c2over27* (drho/*+three*( vx1 )*/+c9over2*( vx1 )*( vx1 ) * (one + drho)-cu_sq); - // (D.f[dirW])[kw]=(one-q)/(one+q)*(f_E-f_W+(f_E+f_W-two*feq*om1)/(one-om1))*c1o2+(q*(f_E+f_W)-six*c2over27*( VeloX ))/(one+q);// - c2over27 * drho; - // //(D.f[dirW])[kw]=zero; + // (D.f[DIR_M00])[kw]=(one-q)/(one+q)*(f_E-f_W+(f_E+f_W-two*feq*om1)/(one-om1))*c1o2+(q*(f_E+f_W)-six*c2over27*( VeloX ))/(one+q);// - c2over27 * drho; + // //(D.f[DIR_M00])[kw]=zero; // } // q = q_dirW[k]; // if (q>=zero && q<=one) // { // feq=c2over27* (drho/*+three*(-vx1 )*/+c9over2*(-vx1 )*(-vx1 ) * (one + drho)-cu_sq); - // (D.f[dirE])[ke]=(one-q)/(one+q)*(f_W-f_E+(f_W+f_E-two*feq*om1)/(one-om1))*c1o2+(q*(f_W+f_E)-six*c2over27*(-VeloX ))/(one+q);// - c2over27 * drho; - // //(D.f[dirE])[ke]=zero; + // (D.f[DIR_P00])[ke]=(one-q)/(one+q)*(f_W-f_E+(f_W+f_E-two*feq*om1)/(one-om1))*c1o2+(q*(f_W+f_E)-six*c2over27*(-VeloX ))/(one+q);// - c2over27 * drho; + // //(D.f[DIR_P00])[ke]=zero; // } // q = q_dirN[k]; // if (q>=zero && q<=one) // { // feq=c2over27* (drho/*+three*( vx2 )*/+c9over2*( vx2 )*( vx2 ) * (one + drho)-cu_sq); - // (D.f[dirS])[ks]=(one-q)/(one+q)*(f_N-f_S+(f_N+f_S-two*feq*om1)/(one-om1))*c1o2+(q*(f_N+f_S)-six*c2over27*( VeloY ))/(one+q);// - c2over27 * drho; - // //(D.f[dirS])[ks]=zero; + // (D.f[DIR_0M0])[ks]=(one-q)/(one+q)*(f_N-f_S+(f_N+f_S-two*feq*om1)/(one-om1))*c1o2+(q*(f_N+f_S)-six*c2over27*( VeloY ))/(one+q);// - c2over27 * drho; + // //(D.f[DIR_0M0])[ks]=zero; // } // q = q_dirS[k]; // if (q>=zero && q<=one) // { // feq=c2over27* (drho/*+three*( -vx2 )*/+c9over2*( -vx2 )*( -vx2 ) * (one + drho)-cu_sq); - // (D.f[dirN])[kn]=(one-q)/(one+q)*(f_S-f_N+(f_S+f_N-two*feq*om1)/(one-om1))*c1o2+(q*(f_S+f_N)-six*c2over27*(-VeloY ))/(one+q);// - c2over27 * drho; - // //(D.f[dirN])[kn]=zero; + // (D.f[DIR_0P0])[kn]=(one-q)/(one+q)*(f_S-f_N+(f_S+f_N-two*feq*om1)/(one-om1))*c1o2+(q*(f_S+f_N)-six*c2over27*(-VeloY ))/(one+q);// - c2over27 * drho; + // //(D.f[DIR_0P0])[kn]=zero; // } // q = q_dirT[k]; // if (q>=zero && q<=one) // { // feq=c2over27* (drho/*+three*( vx3)*/+c9over2*( vx3)*( vx3) * (one + drho)-cu_sq); - // (D.f[dirB])[kb]=(one-q)/(one+q)*(f_T-f_B+(f_T+f_B-two*feq*om1)/(one-om1))*c1o2+(q*(f_T+f_B)-six*c2over27*( VeloZ ))/(one+q);// - c2over27 * drho; - // //(D.f[dirB])[kb]=one; + // (D.f[DIR_00M])[kb]=(one-q)/(one+q)*(f_T-f_B+(f_T+f_B-two*feq*om1)/(one-om1))*c1o2+(q*(f_T+f_B)-six*c2over27*( VeloZ ))/(one+q);// - c2over27 * drho; + // //(D.f[DIR_00M])[kb]=one; // } // q = q_dirB[k]; // if (q>=zero && q<=one) // { // feq=c2over27* (drho/*+three*( -vx3)*/+c9over2*( -vx3)*( -vx3) * (one + drho)-cu_sq); - // (D.f[dirT])[kt]=(one-q)/(one+q)*(f_B-f_T+(f_B+f_T-two*feq*om1)/(one-om1))*c1o2+(q*(f_B+f_T)-six*c2over27*(-VeloZ ))/(one+q);// - c2over27 * drho; - // //(D.f[dirT])[kt]=zero; + // (D.f[DIR_00P])[kt]=(one-q)/(one+q)*(f_B-f_T+(f_B+f_T-two*feq*om1)/(one-om1))*c1o2+(q*(f_B+f_T)-six*c2over27*(-VeloZ ))/(one+q);// - c2over27 * drho; + // //(D.f[DIR_00P])[kt]=zero; // } // q = q_dirNE[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*( vx1+vx2 )*/+c9over2*( vx1+vx2 )*( vx1+vx2 ) * (one + drho)-cu_sq); - // (D.f[dirSW])[ksw]=(one-q)/(one+q)*(f_NE-f_SW+(f_NE+f_SW-two*feq*om1)/(one-om1))*c1o2+(q*(f_NE+f_SW)-six*c1over54*(VeloX+VeloY))/(one+q);// - c1over54 * drho; - // //(D.f[dirSW])[ksw]=zero; + // (D.f[DIR_MM0])[ksw]=(one-q)/(one+q)*(f_NE-f_SW+(f_NE+f_SW-two*feq*om1)/(one-om1))*c1o2+(q*(f_NE+f_SW)-six*c1over54*(VeloX+VeloY))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_MM0])[ksw]=zero; // } // q = q_dirSW[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*(-vx1-vx2 )*/+c9over2*(-vx1-vx2 )*(-vx1-vx2 ) * (one + drho)-cu_sq); - // (D.f[dirNE])[kne]=(one-q)/(one+q)*(f_SW-f_NE+(f_SW+f_NE-two*feq*om1)/(one-om1))*c1o2+(q*(f_SW+f_NE)-six*c1over54*(-VeloX-VeloY))/(one+q);// - c1over54 * drho; - // //(D.f[dirNE])[kne]=zero; + // (D.f[DIR_PP0])[kne]=(one-q)/(one+q)*(f_SW-f_NE+(f_SW+f_NE-two*feq*om1)/(one-om1))*c1o2+(q*(f_SW+f_NE)-six*c1over54*(-VeloX-VeloY))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_PP0])[kne]=zero; // } // q = q_dirSE[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*( vx1-vx2 )*/+c9over2*( vx1-vx2 )*( vx1-vx2 ) * (one + drho)-cu_sq); - // (D.f[dirNW])[knw]=(one-q)/(one+q)*(f_SE-f_NW+(f_SE+f_NW-two*feq*om1)/(one-om1))*c1o2+(q*(f_SE+f_NW)-six*c1over54*( VeloX-VeloY))/(one+q);// - c1over54 * drho; - // //(D.f[dirNW])[knw]=zero; + // (D.f[DIR_MP0])[knw]=(one-q)/(one+q)*(f_SE-f_NW+(f_SE+f_NW-two*feq*om1)/(one-om1))*c1o2+(q*(f_SE+f_NW)-six*c1over54*( VeloX-VeloY))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_MP0])[knw]=zero; // } // q = q_dirNW[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*(-vx1+vx2 )*/+c9over2*(-vx1+vx2 )*(-vx1+vx2 ) * (one + drho)-cu_sq); - // (D.f[dirSE])[kse]=(one-q)/(one+q)*(f_NW-f_SE+(f_NW+f_SE-two*feq*om1)/(one-om1))*c1o2+(q*(f_NW+f_SE)-six*c1over54*(-VeloX+VeloY))/(one+q);// - c1over54 * drho; - // //(D.f[dirSE])[kse]=zero; + // (D.f[DIR_PM0])[kse]=(one-q)/(one+q)*(f_NW-f_SE+(f_NW+f_SE-two*feq*om1)/(one-om1))*c1o2+(q*(f_NW+f_SE)-six*c1over54*(-VeloX+VeloY))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_PM0])[kse]=zero; // } // q = q_dirTE[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*( vx1 +vx3)*/+c9over2*( vx1 +vx3)*( vx1 +vx3) * (one + drho)-cu_sq); - // (D.f[dirBW])[kbw]=(one-q)/(one+q)*(f_TE-f_BW+(f_TE+f_BW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TE+f_BW)-six*c1over54*( VeloX+VeloZ))/(one+q);// - c1over54 * drho; - // //(D.f[dirBW])[kbw]=zero; + // (D.f[DIR_M0M])[kbw]=(one-q)/(one+q)*(f_TE-f_BW+(f_TE+f_BW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TE+f_BW)-six*c1over54*( VeloX+VeloZ))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_M0M])[kbw]=zero; // } // q = q_dirBW[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*(-vx1 -vx3)*/+c9over2*(-vx1 -vx3)*(-vx1 -vx3) * (one + drho)-cu_sq); - // (D.f[dirTE])[kte]=(one-q)/(one+q)*(f_BW-f_TE+(f_BW+f_TE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BW+f_TE)-six*c1over54*(-VeloX-VeloZ))/(one+q);// - c1over54 * drho; - // //(D.f[dirTE])[kte]=zero; + // (D.f[DIR_P0P])[kte]=(one-q)/(one+q)*(f_BW-f_TE+(f_BW+f_TE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BW+f_TE)-six*c1over54*(-VeloX-VeloZ))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_P0P])[kte]=zero; // } // q = q_dirBE[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*( vx1 -vx3)*/+c9over2*( vx1 -vx3)*( vx1 -vx3) * (one + drho)-cu_sq); - // (D.f[dirTW])[ktw]=(one-q)/(one+q)*(f_BE-f_TW+(f_BE+f_TW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BE+f_TW)-six*c1over54*( VeloX-VeloZ))/(one+q);// - c1over54 * drho; - // //(D.f[dirTW])[ktw]=zero; + // (D.f[DIR_M0P])[ktw]=(one-q)/(one+q)*(f_BE-f_TW+(f_BE+f_TW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BE+f_TW)-six*c1over54*( VeloX-VeloZ))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_M0P])[ktw]=zero; // } // q = q_dirTW[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*(-vx1 +vx3)*/+c9over2*(-vx1 +vx3)*(-vx1 +vx3) * (one + drho)-cu_sq); - // (D.f[dirBE])[kbe]=(one-q)/(one+q)*(f_TW-f_BE+(f_TW+f_BE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TW+f_BE)-six*c1over54*(-VeloX+VeloZ))/(one+q);// - c1over54 * drho; - // //(D.f[dirBE])[kbe]=zero; + // (D.f[DIR_P0M])[kbe]=(one-q)/(one+q)*(f_TW-f_BE+(f_TW+f_BE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TW+f_BE)-six*c1over54*(-VeloX+VeloZ))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_P0M])[kbe]=zero; // } // q = q_dirTN[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*( vx2+vx3)*/+c9over2*( vx2+vx3)*( vx2+vx3) * (one + drho)-cu_sq); - // (D.f[dirBS])[kbs]=(one-q)/(one+q)*(f_TN-f_BS+(f_TN+f_BS-two*feq*om1)/(one-om1))*c1o2+(q*(f_TN+f_BS)-six*c1over54*( VeloY+VeloZ))/(one+q);// - c1over54 * drho; - // //(D.f[dirBS])[kbs]=zero; + // (D.f[DIR_0MM])[kbs]=(one-q)/(one+q)*(f_TN-f_BS+(f_TN+f_BS-two*feq*om1)/(one-om1))*c1o2+(q*(f_TN+f_BS)-six*c1over54*( VeloY+VeloZ))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_0MM])[kbs]=zero; // } // q = q_dirBS[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*( -vx2-vx3)*/+c9over2*( -vx2-vx3)*( -vx2-vx3) * (one + drho)-cu_sq); - // (D.f[dirTN])[ktn]=(one-q)/(one+q)*(f_BS-f_TN+(f_BS+f_TN-two*feq*om1)/(one-om1))*c1o2+(q*(f_BS+f_TN)-six*c1over54*( -VeloY-VeloZ))/(one+q);// - c1over54 * drho; - // //(D.f[dirTN])[ktn]=zero; + // (D.f[DIR_0PP])[ktn]=(one-q)/(one+q)*(f_BS-f_TN+(f_BS+f_TN-two*feq*om1)/(one-om1))*c1o2+(q*(f_BS+f_TN)-six*c1over54*( -VeloY-VeloZ))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_0PP])[ktn]=zero; // } // q = q_dirBN[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*( vx2-vx3)*/+c9over2*( vx2-vx3)*( vx2-vx3) * (one + drho)-cu_sq); - // (D.f[dirTS])[kts]=(one-q)/(one+q)*(f_BN-f_TS+(f_BN+f_TS-two*feq*om1)/(one-om1))*c1o2+(q*(f_BN+f_TS)-six*c1over54*( VeloY-VeloZ))/(one+q);// - c1over54 * drho; - // //(D.f[dirTS])[kts]=zero; + // (D.f[DIR_0MP])[kts]=(one-q)/(one+q)*(f_BN-f_TS+(f_BN+f_TS-two*feq*om1)/(one-om1))*c1o2+(q*(f_BN+f_TS)-six*c1over54*( VeloY-VeloZ))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_0MP])[kts]=zero; // } // q = q_dirTS[k]; // if (q>=zero && q<=one) // { // feq=c1over54* (drho/*+three*( -vx2+vx3)*/+c9over2*( -vx2+vx3)*( -vx2+vx3) * (one + drho)-cu_sq); - // (D.f[dirBN])[kbn]=(one-q)/(one+q)*(f_TS-f_BN+(f_TS+f_BN-two*feq*om1)/(one-om1))*c1o2+(q*(f_TS+f_BN)-six*c1over54*( -VeloY+VeloZ))/(one+q);// - c1over54 * drho; - // //(D.f[dirBN])[kbn]=zero; + // (D.f[DIR_0PM])[kbn]=(one-q)/(one+q)*(f_TS-f_BN+(f_TS+f_BN-two*feq*om1)/(one-om1))*c1o2+(q*(f_TS+f_BN)-six*c1over54*( -VeloY+VeloZ))/(one+q);// - c1over54 * drho; + // //(D.f[DIR_0PM])[kbn]=zero; // } // q = q_dirTNE[k]; // if (q>=zero && q<=one) // { // feq=c1over216*(drho/*+three*( vx1+vx2+vx3)*/+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3) * (one + drho)-cu_sq); - // (D.f[dirBSW])[kbsw]=(one-q)/(one+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNE+f_BSW)-six*c1over216*( VeloX+VeloY+VeloZ))/(one+q);// - c1over216 * drho; - // //(D.f[dirBSW])[kbsw]=zero; + // (D.f[DIR_MMM])[kbsw]=(one-q)/(one+q)*(f_TNE-f_BSW+(f_TNE+f_BSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNE+f_BSW)-six*c1over216*( VeloX+VeloY+VeloZ))/(one+q);// - c1over216 * drho; + // //(D.f[DIR_MMM])[kbsw]=zero; // } // q = q_dirBSW[k]; // if (q>=zero && q<=one) // { // feq=c1over216*(drho/*+three*(-vx1-vx2-vx3)*/+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3) * (one + drho)-cu_sq); - // (D.f[dirTNE])[ktne]=(one-q)/(one+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSW+f_TNE)-six*c1over216*(-VeloX-VeloY-VeloZ))/(one+q);// - c1over216 * drho; - // //(D.f[dirTNE])[ktne]=zero; + // (D.f[DIR_PPP])[ktne]=(one-q)/(one+q)*(f_BSW-f_TNE+(f_BSW+f_TNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSW+f_TNE)-six*c1over216*(-VeloX-VeloY-VeloZ))/(one+q);// - c1over216 * drho; + // //(D.f[DIR_PPP])[ktne]=zero; // } // q = q_dirBNE[k]; // if (q>=zero && q<=one) // { // feq=c1over216*(drho/*+three*( vx1+vx2-vx3)*/+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3) * (one + drho)-cu_sq); - // (D.f[dirTSW])[ktsw]=(one-q)/(one+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNE+f_TSW)-six*c1over216*( VeloX+VeloY-VeloZ))/(one+q);// - c1over216 * drho; - // //(D.f[dirTSW])[ktsw]=zero; + // (D.f[DIR_MMP])[ktsw]=(one-q)/(one+q)*(f_BNE-f_TSW+(f_BNE+f_TSW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNE+f_TSW)-six*c1over216*( VeloX+VeloY-VeloZ))/(one+q);// - c1over216 * drho; + // //(D.f[DIR_MMP])[ktsw]=zero; // } // q = q_dirTSW[k]; // if (q>=zero && q<=one) // { // feq=c1over216*(drho/*+three*(-vx1-vx2+vx3)*/+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3) * (one + drho)-cu_sq); - // (D.f[dirBNE])[kbne]=(one-q)/(one+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSW+f_BNE)-six*c1over216*(-VeloX-VeloY+VeloZ))/(one+q);// - c1over216 * drho; - // //(D.f[dirBNE])[kbne]=zero; + // (D.f[DIR_PPM])[kbne]=(one-q)/(one+q)*(f_TSW-f_BNE+(f_TSW+f_BNE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSW+f_BNE)-six*c1over216*(-VeloX-VeloY+VeloZ))/(one+q);// - c1over216 * drho; + // //(D.f[DIR_PPM])[kbne]=zero; // } // q = q_dirTSE[k]; // if (q>=zero && q<=one) // { // feq=c1over216*(drho/*+three*( vx1-vx2+vx3)*/+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3) * (one + drho)-cu_sq); - // (D.f[dirBNW])[kbnw]=(one-q)/(one+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSE+f_BNW)-six*c1over216*( VeloX-VeloY+VeloZ))/(one+q);// - c1over216 * drho; - // //(D.f[dirBNW])[kbnw]=zero; + // (D.f[DIR_MPM])[kbnw]=(one-q)/(one+q)*(f_TSE-f_BNW+(f_TSE+f_BNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_TSE+f_BNW)-six*c1over216*( VeloX-VeloY+VeloZ))/(one+q);// - c1over216 * drho; + // //(D.f[DIR_MPM])[kbnw]=zero; // } // q = q_dirBNW[k]; // if (q>=zero && q<=one) // { // feq=c1over216*(drho/*+three*(-vx1+vx2-vx3)*/+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3) * (one + drho)-cu_sq); - // (D.f[dirTSE])[ktse]=(one-q)/(one+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNW+f_TSE)-six*c1over216*(-VeloX+VeloY-VeloZ))/(one+q);// - c1over216 * drho; - // //(D.f[dirTSE])[ktse]=zero; + // (D.f[DIR_PMP])[ktse]=(one-q)/(one+q)*(f_BNW-f_TSE+(f_BNW+f_TSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_BNW+f_TSE)-six*c1over216*(-VeloX+VeloY-VeloZ))/(one+q);// - c1over216 * drho; + // //(D.f[DIR_PMP])[ktse]=zero; // } // q = q_dirBSE[k]; // if (q>=zero && q<=one) // { // feq=c1over216*(drho/*+three*( vx1-vx2-vx3)*/+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3) * (one + drho)-cu_sq); - // (D.f[dirTNW])[ktnw]=(one-q)/(one+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSE+f_TNW)-six*c1over216*( VeloX-VeloY-VeloZ))/(one+q);// - c1over216 * drho; - // //(D.f[dirTNW])[ktnw]=zero; + // (D.f[DIR_MPP])[ktnw]=(one-q)/(one+q)*(f_BSE-f_TNW+(f_BSE+f_TNW-two*feq*om1)/(one-om1))*c1o2+(q*(f_BSE+f_TNW)-six*c1over216*( VeloX-VeloY-VeloZ))/(one+q);// - c1over216 * drho; + // //(D.f[DIR_MPP])[ktnw]=zero; // } // q = q_dirTNW[k]; // if (q>=zero && q<=one) // { // feq=c1over216*(drho/*+three*(-vx1+vx2+vx3)*/+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3) * (one + drho)-cu_sq); - // (D.f[dirBSE])[kbse]=(one-q)/(one+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNW+f_BSE)-six*c1over216*(-VeloX+VeloY+VeloZ))/(one+q);// - c1over216 * drho; - // //(D.f[dirBSE])[kbse]=zero; + // (D.f[DIR_PMM])[kbse]=(one-q)/(one+q)*(f_TNW-f_BSE+(f_TNW+f_BSE-two*feq*om1)/(one-om1))*c1o2+(q*(f_TNW+f_BSE)-six*c1over216*(-VeloX+VeloY+VeloZ))/(one+q);// - c1over216 * drho; + // //(D.f[DIR_PMM])[kbse]=zero; // } } } diff --git a/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp b/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp index e2b7b34d75e901a468ae7f222ca9e0490cdbf4f8..2c85de9e3ec57d50a66fde2c49d3e703676fbf04 100644 --- a/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp +++ b/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp @@ -39,34 +39,34 @@ #include "Temperature/FindTemperature.h" -void initLattice(SPtr<Parameter> para, SPtr<PreProcessor> preProcessor, SPtr<CudaMemoryManager> cudaManager) +void initLattice(SPtr<Parameter> para, SPtr<PreProcessor> preProcessor, SPtr<CudaMemoryManager> cudaMemoryManager) { for (int lev = para->getFine(); lev >= para->getCoarse(); lev--) { preProcessor->init(para, lev); CalcMacCompSP27( - para->getParD(lev)->vx_SP, para->getParD(lev)->vy_SP, para->getParD(lev)->vz_SP, para->getParD(lev)->rho_SP, - para->getParD(lev)->press_SP, para->getParD(lev)->geoSP, para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, para->getParD(lev)->neighborZ_SP, para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->numberofthreads, para->getParD(lev)->d0SP.f[0], para->getParD(lev)->evenOrOdd); + para->getParD(lev)->velocityX, para->getParD(lev)->velocityY, para->getParD(lev)->velocityZ, para->getParD(lev)->rho, + para->getParD(lev)->pressure, para->getParD(lev)->typeOfGridNode, para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, para->getParD(lev)->neighborZ, para->getParD(lev)->numberOfNodes, + para->getParD(lev)->numberofthreads, para->getParD(lev)->distributions.f[0], para->getParD(lev)->isEvenTimestep); if (para->getCalcMedian()) { constexpr uint tdiff = 1; CalcMacMedSP27(para->getParD(lev)->vx_SP_Med, para->getParD(lev)->vy_SP_Med, para->getParD(lev)->vz_SP_Med, - para->getParD(lev)->rho_SP_Med, para->getParD(lev)->press_SP_Med, para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, tdiff, para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->numberofthreads, para->getParD(lev)->evenOrOdd); + para->getParD(lev)->rho_SP_Med, para->getParD(lev)->press_SP_Med, para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, tdiff, para->getParD(lev)->numberOfNodes, + para->getParD(lev)->numberofthreads, para->getParD(lev)->isEvenTimestep); } // advection - diffusion if (para->getDiffOn()) { - cudaManager->cudaAllocConc(lev); + cudaMemoryManager->cudaAllocConcentration(lev); - for (unsigned int i = 0; i < para->getParH(lev)->size_Mat_SP; i++) { + for (unsigned int i = 0; i < para->getParH(lev)->numberOfNodes; i++) { para->getParH(lev)->Conc[i] = para->getTemperatureInit(); } - initTemperatur(para.get(), cudaManager.get(), lev); + initTemperatur(para.get(), cudaMemoryManager.get(), lev); } } } diff --git a/src/gpu/VirtualFluids_GPU/Init/InitLattice.h b/src/gpu/VirtualFluids_GPU/Init/InitLattice.h index e69386b78f607a861d56f5dbca657ea482971e12..512543348fae69ea9dfe03ca5300e45a650b7099 100644 --- a/src/gpu/VirtualFluids_GPU/Init/InitLattice.h +++ b/src/gpu/VirtualFluids_GPU/Init/InitLattice.h @@ -39,6 +39,6 @@ class Parameter; class PreProcessor; class CudaMemoryManager; -void initLattice(SPtr<Parameter> para, SPtr<PreProcessor> preProcessor, SPtr<CudaMemoryManager> cudaManager); +void initLattice(SPtr<Parameter> para, SPtr<PreProcessor> preProcessor, SPtr<CudaMemoryManager> cudaMemoryManager); #endif diff --git a/src/gpu/VirtualFluids_GPU/Init/PositionReader.cpp b/src/gpu/VirtualFluids_GPU/Init/PositionReader.cpp index 034016b8177394f698ba71252a148bb71655d210..4e5a862d3fd1ed19109073aae0fe4c731f7f3e91 100644 --- a/src/gpu/VirtualFluids_GPU/Init/PositionReader.cpp +++ b/src/gpu/VirtualFluids_GPU/Init/PositionReader.cpp @@ -3,7 +3,7 @@ #include "Parameter/Parameter.h" #include <basics/utilities/UbFileInputASCII.h> - +using namespace vf::lbm::dir; ////////////////////////////////////////////////////////////////////////// void PositionReader::readFilePropellerCylinderForAlloc(Parameter* para) @@ -15,15 +15,15 @@ void PositionReader::readFilePropellerCylinderForAlloc(Parameter* para) for (int level = 0; level < maxlevel; level++) { - para->getParH(level)->QPropeller.kQ = in.readInteger(); - para->getParD(level)->QPropeller.kQ = para->getParH(level)->QPropeller.kQ; + para->getParH(level)->propellerBC.numberOfBCnodes = in.readInteger(); + para->getParD(level)->propellerBC.numberOfBCnodes = para->getParH(level)->propellerBC.numberOfBCnodes; in.readLine(); if (level == para->getFine()) { - for(int u=0; u<para->getParH(level)->QPropeller.kQ; u++) + for(uint u=0; u<para->getParH(level)->propellerBC.numberOfBCnodes; u++) { test = in.readInteger(); - if (para->getParH(level)->geoSP[test] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[test] == GEO_FLUID) { count++; } @@ -55,7 +55,7 @@ void PositionReader::readFilePropellerCylinderForAlloc(Parameter* para) } else { - for(int u=0; u<para->getParH(level)->QPropeller.kQ; u++) + for(uint u=0; u<para->getParH(level)->propellerBC.numberOfBCnodes; u++) { in.readInteger(); in.readDouble(); @@ -64,8 +64,8 @@ void PositionReader::readFilePropellerCylinderForAlloc(Parameter* para) in.readLine(); } } - para->getParH(level)->QPropeller.kQ = count; - para->getParD(level)->QPropeller.kQ = para->getParH(level)->QPropeller.kQ; + para->getParH(level)->propellerBC.numberOfBCnodes = count; + para->getParD(level)->propellerBC.numberOfBCnodes = para->getParH(level)->propellerBC.numberOfBCnodes; } } ////////////////////////////////////////////////////////////////////////// @@ -89,13 +89,13 @@ void PositionReader::readFilePropellerCylinder(Parameter* para) { test = in.readInteger(); //////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[test] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[test] == GEO_FLUID) { - para->getParH(level)->QPropeller.k[count] = test; - para->getParH(level)->QPropeller.Vx[count] = (real)in.readDouble(); - para->getParH(level)->QPropeller.Vy[count] = (real)in.readDouble(); - para->getParH(level)->QPropeller.Vz[count] = (real)in.readDouble(); - para->getParH(level)->QPropeller.RhoBC[count] = 0.0f; + para->getParH(level)->propellerBC.k[count] = test; + para->getParH(level)->propellerBC.Vx[count] = (real)in.readDouble(); + para->getParH(level)->propellerBC.Vy[count] = (real)in.readDouble(); + para->getParH(level)->propellerBC.Vz[count] = (real)in.readDouble(); + para->getParH(level)->propellerBC.RhoBC[count] = 0.0f; count++; } else @@ -104,13 +104,13 @@ void PositionReader::readFilePropellerCylinder(Parameter* para) in.readDouble(); in.readDouble(); } - //para->getParH(level)->QPropeller.k[count] = test; - //para->getParH(level)->QPropeller.Vx[count] = (real)in.readDouble(); - //para->getParH(level)->QPropeller.Vy[count] = (real)in.readDouble(); - //para->getParH(level)->QPropeller.Vz[count] = (real)in.readDouble(); - //para->getParH(level)->QPropeller.Vx[count] = 0.07f; - //para->getParH(level)->QPropeller.Vy[count] = 0.0f; - //para->getParH(level)->QPropeller.Vz[count] = 0.0f; + //para->getParH(level)->propellerBC.k[count] = test; + //para->getParH(level)->propellerBC.Vx[count] = (real)in.readDouble(); + //para->getParH(level)->propellerBC.Vy[count] = (real)in.readDouble(); + //para->getParH(level)->propellerBC.Vz[count] = (real)in.readDouble(); + //para->getParH(level)->propellerBC.Vx[count] = 0.07f; + //para->getParH(level)->propellerBC.Vy[count] = 0.0f; + //para->getParH(level)->propellerBC.Vz[count] = 0.0f; in.readLine(); } } @@ -136,44 +136,44 @@ void PositionReader::definePropellerQs(Parameter* para) { ////////////////////////////////////////////////////////////////// //preprocessing - real* QQ = para->getParH(para->getFine())->QPropeller.q27[0]; - unsigned int sizeQ = para->getParH(para->getFine())->QPropeller.kQ; + real* QQ = para->getParH(para->getFine())->propellerBC.q27[0]; + unsigned int sizeQ = para->getParH(para->getFine())->propellerBC.numberOfBCnodes; QforBoundaryConditions Q; - Q.q27[dirE ] = &QQ[dirE *sizeQ]; - Q.q27[dirW ] = &QQ[dirW *sizeQ]; - Q.q27[dirN ] = &QQ[dirN *sizeQ]; - Q.q27[dirS ] = &QQ[dirS *sizeQ]; - Q.q27[dirT ] = &QQ[dirT *sizeQ]; - Q.q27[dirB ] = &QQ[dirB *sizeQ]; - Q.q27[dirNE ] = &QQ[dirNE *sizeQ]; - Q.q27[dirSW ] = &QQ[dirSW *sizeQ]; - Q.q27[dirSE ] = &QQ[dirSE *sizeQ]; - Q.q27[dirNW ] = &QQ[dirNW *sizeQ]; - Q.q27[dirTE ] = &QQ[dirTE *sizeQ]; - Q.q27[dirBW ] = &QQ[dirBW *sizeQ]; - Q.q27[dirBE ] = &QQ[dirBE *sizeQ]; - Q.q27[dirTW ] = &QQ[dirTW *sizeQ]; - Q.q27[dirTN ] = &QQ[dirTN *sizeQ]; - Q.q27[dirBS ] = &QQ[dirBS *sizeQ]; - Q.q27[dirBN ] = &QQ[dirBN *sizeQ]; - Q.q27[dirTS ] = &QQ[dirTS *sizeQ]; - Q.q27[dirZERO] = &QQ[dirZERO*sizeQ]; - Q.q27[dirTNE ] = &QQ[dirTNE *sizeQ]; - Q.q27[dirTSW ] = &QQ[dirTSW *sizeQ]; - Q.q27[dirTSE ] = &QQ[dirTSE *sizeQ]; - Q.q27[dirTNW ] = &QQ[dirTNW *sizeQ]; - Q.q27[dirBNE ] = &QQ[dirBNE *sizeQ]; - Q.q27[dirBSW ] = &QQ[dirBSW *sizeQ]; - Q.q27[dirBSE ] = &QQ[dirBSE *sizeQ]; - Q.q27[dirBNW ] = &QQ[dirBNW *sizeQ]; + Q.q27[DIR_P00 ] = &QQ[DIR_P00 *sizeQ]; + Q.q27[DIR_M00 ] = &QQ[DIR_M00 *sizeQ]; + Q.q27[DIR_0P0 ] = &QQ[DIR_0P0 *sizeQ]; + Q.q27[DIR_0M0 ] = &QQ[DIR_0M0 *sizeQ]; + Q.q27[DIR_00P ] = &QQ[DIR_00P *sizeQ]; + Q.q27[DIR_00M ] = &QQ[DIR_00M *sizeQ]; + Q.q27[DIR_PP0 ] = &QQ[DIR_PP0 *sizeQ]; + Q.q27[DIR_MM0 ] = &QQ[DIR_MM0 *sizeQ]; + Q.q27[DIR_PM0 ] = &QQ[DIR_PM0 *sizeQ]; + Q.q27[DIR_MP0 ] = &QQ[DIR_MP0 *sizeQ]; + Q.q27[DIR_P0P ] = &QQ[DIR_P0P *sizeQ]; + Q.q27[DIR_M0M ] = &QQ[DIR_M0M *sizeQ]; + Q.q27[DIR_P0M ] = &QQ[DIR_P0M *sizeQ]; + Q.q27[DIR_M0P ] = &QQ[DIR_M0P *sizeQ]; + Q.q27[DIR_0PP ] = &QQ[DIR_0PP *sizeQ]; + Q.q27[DIR_0MM ] = &QQ[DIR_0MM *sizeQ]; + Q.q27[DIR_0PM ] = &QQ[DIR_0PM *sizeQ]; + Q.q27[DIR_0MP ] = &QQ[DIR_0MP *sizeQ]; + Q.q27[DIR_000] = &QQ[DIR_000*sizeQ]; + Q.q27[DIR_PPP ] = &QQ[DIR_PPP *sizeQ]; + Q.q27[DIR_MMP ] = &QQ[DIR_MMP *sizeQ]; + Q.q27[DIR_PMP ] = &QQ[DIR_PMP *sizeQ]; + Q.q27[DIR_MPP ] = &QQ[DIR_MPP *sizeQ]; + Q.q27[DIR_PPM ] = &QQ[DIR_PPM *sizeQ]; + Q.q27[DIR_MMM ] = &QQ[DIR_MMM *sizeQ]; + Q.q27[DIR_PMM ] = &QQ[DIR_PMM *sizeQ]; + Q.q27[DIR_MPM ] = &QQ[DIR_MPM *sizeQ]; ////////////////////////////////////////////////////////////////// - for(int u=0; u<para->getParH(para->getFine())->QPropeller.kQ; u++) + for(uint u=0; u<para->getParH(para->getFine())->propellerBC.numberOfBCnodes; u++) { - for (int dir = dirE; dir<=dirBSW; dir++) + for (int dir = DIR_P00; dir<=DIR_MMM; dir++) { - if ((dir==dirE) || - (dir==dirNE) || (dir==dirSE) || (dir==dirTE) || (dir==dirBE) || - (dir==dirTNE)|| (dir==dirBNE)|| (dir==dirTSE)|| (dir==dirBSE)) + if ((dir==DIR_P00) || + (dir==DIR_PP0) || (dir==DIR_PM0) || (dir==DIR_P0P) || (dir==DIR_P0M) || + (dir==DIR_PPP)|| (dir==DIR_PPM)|| (dir==DIR_PMP)|| (dir==DIR_PMM)) { Q.q27[dir][u] = 1.0f; } diff --git a/src/gpu/VirtualFluids_GPU/Init/VfReader.cpp b/src/gpu/VirtualFluids_GPU/Init/VfReader.cpp index aa94cb658764c4648e30811255312afd26c92cc4..46f6254f7cf2e8ce53ee6f47d69db76405b52dd6 100644 --- a/src/gpu/VirtualFluids_GPU/Init/VfReader.cpp +++ b/src/gpu/VirtualFluids_GPU/Init/VfReader.cpp @@ -6,20 +6,20 @@ #include "GPU/CudaMemoryManager.h" //////////////////////////////////////////////////////////////////////////////// -void readPropellerCylinder(Parameter* para, CudaMemoryManager* cudaManager) +void readPropellerCylinder(Parameter* para, CudaMemoryManager* cudaMemoryManager) { PositionReader::readFilePropellerCylinderForAlloc(para); - cudaManager->cudaAllocVeloPropeller(para->getFine()); + cudaMemoryManager->cudaAllocVeloPropeller(para->getFine()); PositionReader::readFilePropellerCylinder(para); //PositionReader::definePropellerQs(para); - cudaManager->cudaCopyVeloPropeller(para->getFine()); + cudaMemoryManager->cudaCopyVeloPropeller(para->getFine()); } //////////////////////////////////////////////////////////////////////////////// -void readMeasurePoints(Parameter* para, CudaMemoryManager* cudaManager) +void readMeasurePoints(Parameter* para, CudaMemoryManager* cudaMemoryManager) { //read measure points from file PositionReader::readMeasurePoints(para); @@ -42,7 +42,7 @@ void readMeasurePoints(Parameter* para, CudaMemoryManager* cudaManager) printf("Level: %d, numberOfValuesMP: %d, memSizeIntkMP: %d, memSizerealkMP: %d\n",lev,para->getParH(lev)->numberOfValuesMP,para->getParH(lev)->memSizeIntkMP, para->getParD(lev)->memSizerealkMP); - cudaManager->cudaAllocMeasurePointsIndex(lev); + cudaMemoryManager->cudaAllocMeasurePointsIndex(lev); //loop over all measure points per level for(int index = 0; index < (int)para->getParH(lev)->MP.size(); index++) @@ -61,7 +61,7 @@ void readMeasurePoints(Parameter* para, CudaMemoryManager* cudaManager) } //copy indices-arrays - cudaManager->cudaCopyMeasurePointsIndex(lev); + cudaMemoryManager->cudaCopyMeasurePointsIndex(lev); } } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/Init/VfReader.h b/src/gpu/VirtualFluids_GPU/Init/VfReader.h index c7d95e8e769b5b7536c471af90073c314f5b3e94..f8f792375f58edd61b9ec4e876245ad3a334dd81 100644 --- a/src/gpu/VirtualFluids_GPU/Init/VfReader.h +++ b/src/gpu/VirtualFluids_GPU/Init/VfReader.h @@ -6,8 +6,8 @@ class CudaMemoryManager; class Parameter; -void readPropellerCylinder(Parameter* para, CudaMemoryManager* cudaManager); +void readPropellerCylinder(Parameter* para, CudaMemoryManager* cudaMemoryManager); -void readMeasurePoints(Parameter* para, CudaMemoryManager* cudaManager); +void readMeasurePoints(Parameter* para, CudaMemoryManager* cudaMemoryManager); #endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernel.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernel.h index 4b54277ddd405eb619191895065af9bb3b780063..9f9f7539bc5a1e28612d956ca32234c5a3589f8a 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernel.h +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernel.h @@ -13,6 +13,7 @@ class Kernel public: virtual ~Kernel() = default; virtual void run() = 0; + virtual void runOnIndices(const unsigned int *indices, unsigned int size_indices, int stream = -1) = 0; //if stream == -1: run on default stream virtual bool checkParameter() = 0; virtual std::vector<PreProcessorType> getPreProcessorTypes() = 0; diff --git a/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.cpp b/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.cpp index 5e4c5aa08e37e88008da13466bfeed6893ec94f6..630aaf7339afc2907ab6bfbf65bd5fc55f75e215 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.cpp +++ b/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.cpp @@ -2,8 +2,13 @@ #include "Kernel/Utilities/CheckParameterStrategy/CheckParameterStrategy.h" -bool KernelImp::checkParameter() -{ + +void KernelImp::runOnIndices(const unsigned int *indices, unsigned int size_indices, int stream) +{ + printf("Method not implemented for this Kernel \n"); +} + +bool KernelImp::checkParameter() { return checkStrategy->checkParameter(para); } @@ -22,6 +27,10 @@ void KernelImp::setCheckParameterStrategy(std::shared_ptr<CheckParameterStrategy this->checkStrategy = strategy; } +bool KernelImp::getKernelUsesFluidNodeIndices(){ + return this->kernelUsesFluidNodeIndices; +} + KernelImp::KernelImp(std::shared_ptr<Parameter> para, int level) : para(para), level(level) {} KernelImp::KernelImp() {} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.h b/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.h index 47f689b7b3c88a6c7591454909cc6875384908c1..0141ddda7e9579cc84148d26727ed81c084ea0c5 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.h +++ b/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.h @@ -14,12 +14,14 @@ class KernelImp : public Kernel { public: virtual void run() = 0; + virtual void runOnIndices(const unsigned int *indices, unsigned int size_indices, int stream = -1); bool checkParameter(); std::vector<PreProcessorType> getPreProcessorTypes(); KernelGroup getKernelGroup(); void setCheckParameterStrategy(std::shared_ptr<CheckParameterStrategy> strategy); + bool getKernelUsesFluidNodeIndices(); protected: KernelImp(std::shared_ptr<Parameter> para, int level); @@ -32,6 +34,8 @@ protected: KernelGroup myKernelGroup; vf::cuda::CudaGrid cudaGrid; + + bool kernelUsesFluidNodeIndices = false; }; #endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27.cu index 6ff679a25856f0da4f78520fccc9ac545b7377f7..51b9e4537fa0857e9302aa638ae7729fa9adcdbe 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27.cu @@ -10,7 +10,7 @@ std::shared_ptr<ADComp27> ADComp27::getNewInstance(std::shared_ptr<Parameter> pa void ADComp27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,14 +29,14 @@ void ADComp27::run() dim3 threads(numberOfThreads, 1, 1); LB_KERNEL_AD_COMP_27 << < grid, threads >> >( para->getParD(level)->diffusivity, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->d27.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_ThS27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27_Device.cu index 3ad149064a7f7a52a514f66066d179897591eb7f..b4c1236300bbb49fe2df1b3f458f506e989e142b 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_KERNEL_AD_COMP_27(real diffusivity, +__global__ void LB_KERNEL_AD_COMP_27(real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -37,125 +38,125 @@ extern "C" __global__ void LB_KERNEL_AD_COMP_27(real diffusivity, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } Distributions27 D27; if (EvenOrOdd == true) { - D27.f[dirE] = &DD27[dirE *size_Mat]; - D27.f[dirW] = &DD27[dirW *size_Mat]; - D27.f[dirN] = &DD27[dirN *size_Mat]; - D27.f[dirS] = &DD27[dirS *size_Mat]; - D27.f[dirT] = &DD27[dirT *size_Mat]; - D27.f[dirB] = &DD27[dirB *size_Mat]; - D27.f[dirNE] = &DD27[dirNE *size_Mat]; - D27.f[dirSW] = &DD27[dirSW *size_Mat]; - D27.f[dirSE] = &DD27[dirSE *size_Mat]; - D27.f[dirNW] = &DD27[dirNW *size_Mat]; - D27.f[dirTE] = &DD27[dirTE *size_Mat]; - D27.f[dirBW] = &DD27[dirBW *size_Mat]; - D27.f[dirBE] = &DD27[dirBE *size_Mat]; - D27.f[dirTW] = &DD27[dirTW *size_Mat]; - D27.f[dirTN] = &DD27[dirTN *size_Mat]; - D27.f[dirBS] = &DD27[dirBS *size_Mat]; - D27.f[dirBN] = &DD27[dirBN *size_Mat]; - D27.f[dirTS] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW] = &DD27[dirBNW *size_Mat]; + D27.f[DIR_P00] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM] = &DD27[DIR_MPM *size_Mat]; } else { - D27.f[dirW] = &DD27[dirE *size_Mat]; - D27.f[dirE] = &DD27[dirW *size_Mat]; - D27.f[dirS] = &DD27[dirN *size_Mat]; - D27.f[dirN] = &DD27[dirS *size_Mat]; - D27.f[dirB] = &DD27[dirT *size_Mat]; - D27.f[dirT] = &DD27[dirB *size_Mat]; - D27.f[dirSW] = &DD27[dirNE *size_Mat]; - D27.f[dirNE] = &DD27[dirSW *size_Mat]; - D27.f[dirNW] = &DD27[dirSE *size_Mat]; - D27.f[dirSE] = &DD27[dirNW *size_Mat]; - D27.f[dirBW] = &DD27[dirTE *size_Mat]; - D27.f[dirTE] = &DD27[dirBW *size_Mat]; - D27.f[dirTW] = &DD27[dirBE *size_Mat]; - D27.f[dirBE] = &DD27[dirTW *size_Mat]; - D27.f[dirBS] = &DD27[dirTN *size_Mat]; - D27.f[dirTN] = &DD27[dirBS *size_Mat]; - D27.f[dirTS] = &DD27[dirBN *size_Mat]; - D27.f[dirBN] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirBSW] = &DD27[dirTNE *size_Mat]; - D27.f[dirBNE] = &DD27[dirTSW *size_Mat]; - D27.f[dirBNW] = &DD27[dirTSE *size_Mat]; - D27.f[dirBSE] = &DD27[dirTNW *size_Mat]; - D27.f[dirTSW] = &DD27[dirBNE *size_Mat]; - D27.f[dirTNE] = &DD27[dirBSW *size_Mat]; - D27.f[dirTNW] = &DD27[dirBSE *size_Mat]; - D27.f[dirTSE] = &DD27[dirBNW *size_Mat]; + D27.f[DIR_M00] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_MMM] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PPM] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MPM] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_PMM] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MMP] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PPP] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MPP] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PMP] = &DD27[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -168,61 +169,61 @@ extern "C" __global__ void LB_KERNEL_AD_COMP_27(real diffusivity, unsigned int kbs = neighborZ[ks]; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real fW = (D.f[dirE])[k];//ke - real fE = (D.f[dirW])[kw]; - real fS = (D.f[dirN])[k];//kn - real fN = (D.f[dirS])[ks]; - real fB = (D.f[dirT])[k];//kt - real fT = (D.f[dirB])[kb]; - real fSW = (D.f[dirNE])[k];//kne - real fNE = (D.f[dirSW])[ksw]; - real fNW = (D.f[dirSE])[ks];//kse - real fSE = (D.f[dirNW])[kw];//knw - real fBW = (D.f[dirTE])[k];//kte - real fTE = (D.f[dirBW])[kbw]; - real fTW = (D.f[dirBE])[kb];//kbe - real fBE = (D.f[dirTW])[kw];//ktw - real fBS = (D.f[dirTN])[k];//ktn - real fTN = (D.f[dirBS])[kbs]; - real fTS = (D.f[dirBN])[kb];//kbn - real fBN = (D.f[dirTS])[ks];//kts - real fZERO = (D.f[dirZERO])[k];//kzero - real fBSW = (D.f[dirTNE])[k];//ktne - real fBNE = (D.f[dirTSW])[ksw];//ktsw - real fBNW = (D.f[dirTSE])[ks];//ktse - real fBSE = (D.f[dirTNW])[kw];//ktnw - real fTSW = (D.f[dirBNE])[kb];//kbne - real fTNE = (D.f[dirBSW])[kbsw]; - real fTNW = (D.f[dirBSE])[kbs];//kbse - real fTSE = (D.f[dirBNW])[kbw];//kbnw + real fW = (D.f[DIR_P00])[k];//ke + real fE = (D.f[DIR_M00])[kw]; + real fS = (D.f[DIR_0P0])[k];//kn + real fN = (D.f[DIR_0M0])[ks]; + real fB = (D.f[DIR_00P])[k];//kt + real fT = (D.f[DIR_00M])[kb]; + real fSW = (D.f[DIR_PP0])[k];//kne + real fNE = (D.f[DIR_MM0])[ksw]; + real fNW = (D.f[DIR_PM0])[ks];//kse + real fSE = (D.f[DIR_MP0])[kw];//knw + real fBW = (D.f[DIR_P0P])[k];//kte + real fTE = (D.f[DIR_M0M])[kbw]; + real fTW = (D.f[DIR_P0M])[kb];//kbe + real fBE = (D.f[DIR_M0P])[kw];//ktw + real fBS = (D.f[DIR_0PP])[k];//ktn + real fTN = (D.f[DIR_0MM])[kbs]; + real fTS = (D.f[DIR_0PM])[kb];//kbn + real fBN = (D.f[DIR_0MP])[ks];//kts + real fZERO = (D.f[DIR_000])[k];//kzero + real fBSW = (D.f[DIR_PPP])[k];//ktne + real fBNE = (D.f[DIR_MMP])[ksw];//ktsw + real fBNW = (D.f[DIR_PMP])[ks];//ktse + real fBSE = (D.f[DIR_MPP])[kw];//ktnw + real fTSW = (D.f[DIR_PPM])[kb];//kbne + real fTNE = (D.f[DIR_MMM])[kbsw]; + real fTNW = (D.f[DIR_PMM])[kbs];//kbse + real fTSE = (D.f[DIR_MPM])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D27.f[dirE])[k]; - real mfabb = (D27.f[dirW])[kw]; - real mfbcb = (D27.f[dirN])[k]; - real mfbab = (D27.f[dirS])[ks]; - real mfbbc = (D27.f[dirT])[k]; - real mfbba = (D27.f[dirB])[kb]; - real mfccb = (D27.f[dirNE])[k]; - real mfaab = (D27.f[dirSW])[ksw]; - real mfcab = (D27.f[dirSE])[ks]; - real mfacb = (D27.f[dirNW])[kw]; - real mfcbc = (D27.f[dirTE])[k]; - real mfaba = (D27.f[dirBW])[kbw]; - real mfcba = (D27.f[dirBE])[kb]; - real mfabc = (D27.f[dirTW])[kw]; - real mfbcc = (D27.f[dirTN])[k]; - real mfbaa = (D27.f[dirBS])[kbs]; - real mfbca = (D27.f[dirBN])[kb]; - real mfbac = (D27.f[dirTS])[ks]; - real mfbbb = (D27.f[dirZERO])[k]; - real mfccc = (D27.f[dirTNE])[k]; - real mfaac = (D27.f[dirTSW])[ksw]; - real mfcac = (D27.f[dirTSE])[ks]; - real mfacc = (D27.f[dirTNW])[kw]; - real mfcca = (D27.f[dirBNE])[kb]; - real mfaaa = (D27.f[dirBSW])[kbsw]; - real mfcaa = (D27.f[dirBSE])[kbs]; - real mfaca = (D27.f[dirBNW])[kbw]; + real mfcbb = (D27.f[DIR_P00])[k]; + real mfabb = (D27.f[DIR_M00])[kw]; + real mfbcb = (D27.f[DIR_0P0])[k]; + real mfbab = (D27.f[DIR_0M0])[ks]; + real mfbbc = (D27.f[DIR_00P])[k]; + real mfbba = (D27.f[DIR_00M])[kb]; + real mfccb = (D27.f[DIR_PP0])[k]; + real mfaab = (D27.f[DIR_MM0])[ksw]; + real mfcab = (D27.f[DIR_PM0])[ks]; + real mfacb = (D27.f[DIR_MP0])[kw]; + real mfcbc = (D27.f[DIR_P0P])[k]; + real mfaba = (D27.f[DIR_M0M])[kbw]; + real mfcba = (D27.f[DIR_P0M])[kb]; + real mfabc = (D27.f[DIR_M0P])[kw]; + real mfbcc = (D27.f[DIR_0PP])[k]; + real mfbaa = (D27.f[DIR_0MM])[kbs]; + real mfbca = (D27.f[DIR_0PM])[kb]; + real mfbac = (D27.f[DIR_0MP])[ks]; + real mfbbb = (D27.f[DIR_000])[k]; + real mfccc = (D27.f[DIR_PPP])[k]; + real mfaac = (D27.f[DIR_MMP])[ksw]; + real mfcac = (D27.f[DIR_PMP])[ks]; + real mfacc = (D27.f[DIR_MPP])[kw]; + real mfcca = (D27.f[DIR_PPM])[kb]; + real mfaaa = (D27.f[DIR_MMM])[kbsw]; + real mfcaa = (D27.f[DIR_PMM])[kbs]; + real mfaca = (D27.f[DIR_MPM])[kbw]; //////////////////////////////////////////////////////////////////////////////////// //Conc real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + @@ -772,33 +773,33 @@ extern "C" __global__ void LB_KERNEL_AD_COMP_27(real diffusivity, //////////////////////////////////////////////////////////////////////////////////// - (D27.f[dirE])[k] = mfabb; - (D27.f[dirW])[kw] = mfcbb; - (D27.f[dirN])[k] = mfbab; - (D27.f[dirS])[ks] = mfbcb; - (D27.f[dirT])[k] = mfbba; - (D27.f[dirB])[kb] = mfbbc; - (D27.f[dirNE])[k] = mfaab; - (D27.f[dirSW])[ksw] = mfccb; - (D27.f[dirSE])[ks] = mfacb; - (D27.f[dirNW])[kw] = mfcab; - (D27.f[dirTE])[k] = mfaba; - (D27.f[dirBW])[kbw] = mfcbc; - (D27.f[dirBE])[kb] = mfabc; - (D27.f[dirTW])[kw] = mfcba; - (D27.f[dirTN])[k] = mfbaa; - (D27.f[dirBS])[kbs] = mfbcc; - (D27.f[dirBN])[kb] = mfbac; - (D27.f[dirTS])[ks] = mfbca; - (D27.f[dirZERO])[k] = mfbbb; - (D27.f[dirTNE])[k] = mfaaa; - (D27.f[dirTSE])[ks] = mfaca; - (D27.f[dirBNE])[kb] = mfaac; - (D27.f[dirBSE])[kbs] = mfacc; - (D27.f[dirTNW])[kw] = mfcaa; - (D27.f[dirTSW])[ksw] = mfcca; - (D27.f[dirBNW])[kbw] = mfcac; - (D27.f[dirBSW])[kbsw] = mfccc; + (D27.f[DIR_P00])[k] = mfabb; + (D27.f[DIR_M00])[kw] = mfcbb; + (D27.f[DIR_0P0])[k] = mfbab; + (D27.f[DIR_0M0])[ks] = mfbcb; + (D27.f[DIR_00P])[k] = mfbba; + (D27.f[DIR_00M])[kb] = mfbbc; + (D27.f[DIR_PP0])[k] = mfaab; + (D27.f[DIR_MM0])[ksw] = mfccb; + (D27.f[DIR_PM0])[ks] = mfacb; + (D27.f[DIR_MP0])[kw] = mfcab; + (D27.f[DIR_P0P])[k] = mfaba; + (D27.f[DIR_M0M])[kbw] = mfcbc; + (D27.f[DIR_P0M])[kb] = mfabc; + (D27.f[DIR_M0P])[kw] = mfcba; + (D27.f[DIR_0PP])[k] = mfbaa; + (D27.f[DIR_0MM])[kbs] = mfbcc; + (D27.f[DIR_0PM])[kb] = mfbac; + (D27.f[DIR_0MP])[ks] = mfbca; + (D27.f[DIR_000])[k] = mfbbb; + (D27.f[DIR_PPP])[k] = mfaaa; + (D27.f[DIR_PMP])[ks] = mfaca; + (D27.f[DIR_PPM])[kb] = mfaac; + (D27.f[DIR_PMM])[kbs] = mfacc; + (D27.f[DIR_MPP])[kw] = mfcaa; + (D27.f[DIR_MMP])[ksw] = mfcca; + (D27.f[DIR_MPM])[kbw] = mfcac; + (D27.f[DIR_MMM])[kbsw] = mfccc; //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27_Device.cuh index e96bccd492e57cbfb23298e2587648881d9d980c..a5482a10ca15fc3f27245acbe8b47a06d9f917f0 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_KERNEL_AD_COMP_27(real diffusivity, +__global__ void LB_KERNEL_AD_COMP_27(real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7.cu index 39af3c25f6a850275e9f6f871af15d6c53909a40..ab9b0c444513455e0498d79614575e87c2afb6a0 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7.cu @@ -10,7 +10,7 @@ std::shared_ptr<ADComp7> ADComp7::getNewInstance(std::shared_ptr<Parameter> para void ADComp7::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,14 +29,14 @@ void ADComp7::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_AD_Comp_7 << < grid, threads >> >( para->getParD(level)->diffusivity, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->d7.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD7.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_ThS7 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7_Device.cu index d5de82af54673e4e50af7c5639759ac9f1b105a0..52ab9ba6e968ec2293f0a1c4959323c43f328206 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7_Device.cu @@ -1,11 +1,13 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + #include "math.h" -extern "C" __global__ void LB_Kernel_AD_Comp_7(real diffusivity, +__global__ void LB_Kernel_AD_Comp_7(real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -37,63 +39,63 @@ extern "C" __global__ void LB_Kernel_AD_Comp_7(real diffusivity, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } Distributions7 D7; @@ -128,60 +130,60 @@ extern "C" __global__ void LB_Kernel_AD_Comp_7(real diffusivity, unsigned int kbs = neighborZ[ks]; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real fW = (D.f[dirE])[k];//ke - real fE = (D.f[dirW])[kw]; - real fS = (D.f[dirN])[k];//kn - real fN = (D.f[dirS])[ks]; - real fB = (D.f[dirT])[k];//kt - real fT = (D.f[dirB])[kb]; - real fSW = (D.f[dirNE])[k];//kne - real fNE = (D.f[dirSW])[ksw]; - real fNW = (D.f[dirSE])[ks];//kse - real fSE = (D.f[dirNW])[kw];//knw - real fBW = (D.f[dirTE])[k];//kte - real fTE = (D.f[dirBW])[kbw]; - real fTW = (D.f[dirBE])[kb];//kbe - real fBE = (D.f[dirTW])[kw];//ktw - real fBS = (D.f[dirTN])[k];//ktn - real fTN = (D.f[dirBS])[kbs]; - real fTS = (D.f[dirBN])[kb];//kbn - real fBN = (D.f[dirTS])[ks];//kts - real fZERO = (D.f[dirZERO])[k];//kzero - real fBSW = (D.f[dirTNE])[k];//ktne - real fBNE = (D.f[dirTSW])[ksw];//ktsw - real fBNW = (D.f[dirTSE])[ks];//ktse - real fBSE = (D.f[dirTNW])[kw];//ktnw - real fTSW = (D.f[dirBNE])[kb];//kbne - real fTNE = (D.f[dirBSW])[kbsw]; - real fTNW = (D.f[dirBSE])[kbs];//kbse - real fTSE = (D.f[dirBNW])[kbw];//kbnw - //real fE = (D.f[dirE ])[k ];//ke - //real fW = (D.f[dirW ])[kw ]; - //real fN = (D.f[dirN ])[k ];//kn - //real fS = (D.f[dirS ])[ks ]; - //real fT = (D.f[dirT ])[k ];//kt - //real fB = (D.f[dirB ])[kb ]; - //real fNE = (D.f[dirNE ])[k ];//kne - //real fSW = (D.f[dirSW ])[ksw]; - //real fSE = (D.f[dirSE ])[ks ];//kse - //real fNW = (D.f[dirNW ])[kw ];//knw - //real fTE = (D.f[dirTE ])[k ];//kte - //real fBW = (D.f[dirBW ])[kbw]; - //real fBE = (D.f[dirBE ])[kb ];//kbe - //real fTW = (D.f[dirTW ])[kw ];//ktw - //real fTN = (D.f[dirTN ])[k ];//ktn - //real fBS = (D.f[dirBS ])[kbs]; - //real fBN = (D.f[dirBN ])[kb ];//kbn - //real fTS = (D.f[dirTS ])[ks ];//kts - //real fZERO = (D.f[dirZERO])[k ];//kzero - //real fTNE = (D.f[dirTNE ])[k ];//ktne - //real fTSW = (D.f[dirTSW ])[ksw];//ktsw - //real fTSE = (D.f[dirTSE ])[ks ];//ktse - //real fTNW = (D.f[dirTNW ])[kw ];//ktnw - //real fBNE = (D.f[dirBNE ])[kb ];//kbne - //real fBSW = (D.f[dirBSW ])[kbsw]; - //real fBSE = (D.f[dirBSE ])[kbs];//kbse - //real fBNW = (D.f[dirBNW ])[kbw];//kbnw + real fW = (D.f[DIR_P00])[k];//ke + real fE = (D.f[DIR_M00])[kw]; + real fS = (D.f[DIR_0P0])[k];//kn + real fN = (D.f[DIR_0M0])[ks]; + real fB = (D.f[DIR_00P])[k];//kt + real fT = (D.f[DIR_00M])[kb]; + real fSW = (D.f[DIR_PP0])[k];//kne + real fNE = (D.f[DIR_MM0])[ksw]; + real fNW = (D.f[DIR_PM0])[ks];//kse + real fSE = (D.f[DIR_MP0])[kw];//knw + real fBW = (D.f[DIR_P0P])[k];//kte + real fTE = (D.f[DIR_M0M])[kbw]; + real fTW = (D.f[DIR_P0M])[kb];//kbe + real fBE = (D.f[DIR_M0P])[kw];//ktw + real fBS = (D.f[DIR_0PP])[k];//ktn + real fTN = (D.f[DIR_0MM])[kbs]; + real fTS = (D.f[DIR_0PM])[kb];//kbn + real fBN = (D.f[DIR_0MP])[ks];//kts + real fZERO = (D.f[DIR_000])[k];//kzero + real fBSW = (D.f[DIR_PPP])[k];//ktne + real fBNE = (D.f[DIR_MMP])[ksw];//ktsw + real fBNW = (D.f[DIR_PMP])[ks];//ktse + real fBSE = (D.f[DIR_MPP])[kw];//ktnw + real fTSW = (D.f[DIR_PPM])[kb];//kbne + real fTNE = (D.f[DIR_MMM])[kbsw]; + real fTNW = (D.f[DIR_PMM])[kbs];//kbse + real fTSE = (D.f[DIR_MPM])[kbw];//kbnw + //real fE = (D.f[DIR_P00 ])[k ];//ke + //real fW = (D.f[DIR_M00 ])[kw ]; + //real fN = (D.f[DIR_0P0 ])[k ];//kn + //real fS = (D.f[DIR_0M0 ])[ks ]; + //real fT = (D.f[DIR_00P ])[k ];//kt + //real fB = (D.f[DIR_00M ])[kb ]; + //real fNE = (D.f[DIR_PP0 ])[k ];//kne + //real fSW = (D.f[DIR_MM0 ])[ksw]; + //real fSE = (D.f[DIR_PM0 ])[ks ];//kse + //real fNW = (D.f[DIR_MP0 ])[kw ];//knw + //real fTE = (D.f[DIR_P0P ])[k ];//kte + //real fBW = (D.f[DIR_M0M ])[kbw]; + //real fBE = (D.f[DIR_P0M ])[kb ];//kbe + //real fTW = (D.f[DIR_M0P ])[kw ];//ktw + //real fTN = (D.f[DIR_0PP ])[k ];//ktn + //real fBS = (D.f[DIR_0MM ])[kbs]; + //real fBN = (D.f[DIR_0PM ])[kb ];//kbn + //real fTS = (D.f[DIR_0MP ])[ks ];//kts + //real fZERO = (D.f[DIR_000])[k ];//kzero + //real fTNE = (D.f[DIR_PPP ])[k ];//ktne + //real fTSW = (D.f[DIR_MMP ])[ksw];//ktsw + //real fTSE = (D.f[DIR_PMP ])[ks ];//ktse + //real fTNW = (D.f[DIR_MPP ])[kw ];//ktnw + //real fBNE = (D.f[DIR_PPM ])[kb ];//kbne + //real fBSW = (D.f[DIR_MMM ])[kbsw]; + //real fBSE = (D.f[DIR_PMM ])[kbs];//kbse + //real fBNW = (D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////// real f7ZERO = (D7.f[0])[k]; real f7E = (D7.f[1])[k]; diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7_Device.cuh index 01e64563499a3a4d0a515beee7c95cba75949640..bea40443ab619fb08b4c5656105c7792c4f11bd1 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_AD_Comp_7(real diffusivity, +__global__ void LB_Kernel_AD_Comp_7(real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27.cu index 942582797f452cf9661db48590a7a8b7ef7fc81f..4ad8a4678ae2e4025a90f639ae366311a247e4b3 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27.cu @@ -10,7 +10,7 @@ std::shared_ptr<ADIncomp27> ADIncomp27::getNewInstance(std::shared_ptr<Parameter void ADIncomp27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,14 +29,14 @@ void ADIncomp27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_AD_Incomp_27 << < grid, threads >> >( para->getParD(level)->diffusivity, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->d27.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_AD_Incomp_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27_Device.cu index d9586b2eb599c451226482c1d3502104ad864d8f..e686825ed100417110b02360876dec076553d7de 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_AD_Incomp_27(real diffusivity, +__global__ void LB_Kernel_AD_Incomp_27(real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -37,125 +38,125 @@ extern "C" __global__ void LB_Kernel_AD_Incomp_27(real diffusivity, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } Distributions27 D27; if (EvenOrOdd == true) { - D27.f[dirE] = &DD27[dirE *size_Mat]; - D27.f[dirW] = &DD27[dirW *size_Mat]; - D27.f[dirN] = &DD27[dirN *size_Mat]; - D27.f[dirS] = &DD27[dirS *size_Mat]; - D27.f[dirT] = &DD27[dirT *size_Mat]; - D27.f[dirB] = &DD27[dirB *size_Mat]; - D27.f[dirNE] = &DD27[dirNE *size_Mat]; - D27.f[dirSW] = &DD27[dirSW *size_Mat]; - D27.f[dirSE] = &DD27[dirSE *size_Mat]; - D27.f[dirNW] = &DD27[dirNW *size_Mat]; - D27.f[dirTE] = &DD27[dirTE *size_Mat]; - D27.f[dirBW] = &DD27[dirBW *size_Mat]; - D27.f[dirBE] = &DD27[dirBE *size_Mat]; - D27.f[dirTW] = &DD27[dirTW *size_Mat]; - D27.f[dirTN] = &DD27[dirTN *size_Mat]; - D27.f[dirBS] = &DD27[dirBS *size_Mat]; - D27.f[dirBN] = &DD27[dirBN *size_Mat]; - D27.f[dirTS] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW] = &DD27[dirBNW *size_Mat]; + D27.f[DIR_P00] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM] = &DD27[DIR_MPM *size_Mat]; } else { - D27.f[dirW] = &DD27[dirE *size_Mat]; - D27.f[dirE] = &DD27[dirW *size_Mat]; - D27.f[dirS] = &DD27[dirN *size_Mat]; - D27.f[dirN] = &DD27[dirS *size_Mat]; - D27.f[dirB] = &DD27[dirT *size_Mat]; - D27.f[dirT] = &DD27[dirB *size_Mat]; - D27.f[dirSW] = &DD27[dirNE *size_Mat]; - D27.f[dirNE] = &DD27[dirSW *size_Mat]; - D27.f[dirNW] = &DD27[dirSE *size_Mat]; - D27.f[dirSE] = &DD27[dirNW *size_Mat]; - D27.f[dirBW] = &DD27[dirTE *size_Mat]; - D27.f[dirTE] = &DD27[dirBW *size_Mat]; - D27.f[dirTW] = &DD27[dirBE *size_Mat]; - D27.f[dirBE] = &DD27[dirTW *size_Mat]; - D27.f[dirBS] = &DD27[dirTN *size_Mat]; - D27.f[dirTN] = &DD27[dirBS *size_Mat]; - D27.f[dirTS] = &DD27[dirBN *size_Mat]; - D27.f[dirBN] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirBSW] = &DD27[dirTNE *size_Mat]; - D27.f[dirBNE] = &DD27[dirTSW *size_Mat]; - D27.f[dirBNW] = &DD27[dirTSE *size_Mat]; - D27.f[dirBSE] = &DD27[dirTNW *size_Mat]; - D27.f[dirTSW] = &DD27[dirBNE *size_Mat]; - D27.f[dirTNE] = &DD27[dirBSW *size_Mat]; - D27.f[dirTNW] = &DD27[dirBSE *size_Mat]; - D27.f[dirTSE] = &DD27[dirBNW *size_Mat]; + D27.f[DIR_M00] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_MMM] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PPM] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MPM] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_PMM] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MMP] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PPP] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MPP] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PMP] = &DD27[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -168,61 +169,61 @@ extern "C" __global__ void LB_Kernel_AD_Incomp_27(real diffusivity, unsigned int kbs = neighborZ[ks]; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real fW = (D.f[dirE])[k];//ke - real fE = (D.f[dirW])[kw]; - real fS = (D.f[dirN])[k];//kn - real fN = (D.f[dirS])[ks]; - real fB = (D.f[dirT])[k];//kt - real fT = (D.f[dirB])[kb]; - real fSW = (D.f[dirNE])[k];//kne - real fNE = (D.f[dirSW])[ksw]; - real fNW = (D.f[dirSE])[ks];//kse - real fSE = (D.f[dirNW])[kw];//knw - real fBW = (D.f[dirTE])[k];//kte - real fTE = (D.f[dirBW])[kbw]; - real fTW = (D.f[dirBE])[kb];//kbe - real fBE = (D.f[dirTW])[kw];//ktw - real fBS = (D.f[dirTN])[k];//ktn - real fTN = (D.f[dirBS])[kbs]; - real fTS = (D.f[dirBN])[kb];//kbn - real fBN = (D.f[dirTS])[ks];//kts - //real fZERO = (D.f[dirZERO])[k];//kzero - real fBSW = (D.f[dirTNE])[k];//ktne - real fBNE = (D.f[dirTSW])[ksw];//ktsw - real fBNW = (D.f[dirTSE])[ks];//ktse - real fBSE = (D.f[dirTNW])[kw];//ktnw - real fTSW = (D.f[dirBNE])[kb];//kbne - real fTNE = (D.f[dirBSW])[kbsw]; - real fTNW = (D.f[dirBSE])[kbs];//kbse - real fTSE = (D.f[dirBNW])[kbw];//kbnw + real fW = (D.f[DIR_P00])[k];//ke + real fE = (D.f[DIR_M00])[kw]; + real fS = (D.f[DIR_0P0])[k];//kn + real fN = (D.f[DIR_0M0])[ks]; + real fB = (D.f[DIR_00P])[k];//kt + real fT = (D.f[DIR_00M])[kb]; + real fSW = (D.f[DIR_PP0])[k];//kne + real fNE = (D.f[DIR_MM0])[ksw]; + real fNW = (D.f[DIR_PM0])[ks];//kse + real fSE = (D.f[DIR_MP0])[kw];//knw + real fBW = (D.f[DIR_P0P])[k];//kte + real fTE = (D.f[DIR_M0M])[kbw]; + real fTW = (D.f[DIR_P0M])[kb];//kbe + real fBE = (D.f[DIR_M0P])[kw];//ktw + real fBS = (D.f[DIR_0PP])[k];//ktn + real fTN = (D.f[DIR_0MM])[kbs]; + real fTS = (D.f[DIR_0PM])[kb];//kbn + real fBN = (D.f[DIR_0MP])[ks];//kts + //real fZERO = (D.f[DIR_000])[k];//kzero + real fBSW = (D.f[DIR_PPP])[k];//ktne + real fBNE = (D.f[DIR_MMP])[ksw];//ktsw + real fBNW = (D.f[DIR_PMP])[ks];//ktse + real fBSE = (D.f[DIR_MPP])[kw];//ktnw + real fTSW = (D.f[DIR_PPM])[kb];//kbne + real fTNE = (D.f[DIR_MMM])[kbsw]; + real fTNW = (D.f[DIR_PMM])[kbs];//kbse + real fTSE = (D.f[DIR_MPM])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////// - //real f27E = (D27.f[dirE ])[k ];//ke - //real f27W = (D27.f[dirW ])[kw ]; - //real f27N = (D27.f[dirN ])[k ];//kn - //real f27S = (D27.f[dirS ])[ks ]; - //real f27T = (D27.f[dirT ])[k ];//kt - //real f27B = (D27.f[dirB ])[kb ]; - //real f27NE = (D27.f[dirNE ])[k ];//kne - //real f27SW = (D27.f[dirSW ])[ksw]; - //real f27SE = (D27.f[dirSE ])[ks ];//kse - //real f27NW = (D27.f[dirNW ])[kw ];//knw - //real f27TE = (D27.f[dirTE ])[k ];//kte - //real f27BW = (D27.f[dirBW ])[kbw]; - //real f27BE = (D27.f[dirBE ])[kb ];//kbe - //real f27TW = (D27.f[dirTW ])[kw ];//ktw - //real f27TN = (D27.f[dirTN ])[k ];//ktn - //real f27BS = (D27.f[dirBS ])[kbs]; - //real f27BN = (D27.f[dirBN ])[kb ];//kbn - //real f27TS = (D27.f[dirTS ])[ks ];//kts - //real f27ZERO = (D27.f[dirZERO])[k ];//kzero - //real f27TNE = (D27.f[dirTNE ])[k ];//ktne - //real f27TSW = (D27.f[dirTSW ])[ksw];//ktsw - //real f27TSE = (D27.f[dirTSE ])[ks ];//ktse - //real f27TNW = (D27.f[dirTNW ])[kw ];//ktnw - //real f27BNE = (D27.f[dirBNE ])[kb ];//kbne - //real f27BSW = (D27.f[dirBSW ])[kbsw]; - //real f27BSE = (D27.f[dirBSE ])[kbs];//kbse - //real f27BNW = (D27.f[dirBNW ])[kbw];//kbnw + //real f27E = (D27.f[DIR_P00 ])[k ];//ke + //real f27W = (D27.f[DIR_M00 ])[kw ]; + //real f27N = (D27.f[DIR_0P0 ])[k ];//kn + //real f27S = (D27.f[DIR_0M0 ])[ks ]; + //real f27T = (D27.f[DIR_00P ])[k ];//kt + //real f27B = (D27.f[DIR_00M ])[kb ]; + //real f27NE = (D27.f[DIR_PP0 ])[k ];//kne + //real f27SW = (D27.f[DIR_MM0 ])[ksw]; + //real f27SE = (D27.f[DIR_PM0 ])[ks ];//kse + //real f27NW = (D27.f[DIR_MP0 ])[kw ];//knw + //real f27TE = (D27.f[DIR_P0P ])[k ];//kte + //real f27BW = (D27.f[DIR_M0M ])[kbw]; + //real f27BE = (D27.f[DIR_P0M ])[kb ];//kbe + //real f27TW = (D27.f[DIR_M0P ])[kw ];//ktw + //real f27TN = (D27.f[DIR_0PP ])[k ];//ktn + //real f27BS = (D27.f[DIR_0MM ])[kbs]; + //real f27BN = (D27.f[DIR_0PM ])[kb ];//kbn + //real f27TS = (D27.f[DIR_0MP ])[ks ];//kts + //real f27ZERO = (D27.f[DIR_000])[k ];//kzero + //real f27TNE = (D27.f[DIR_PPP ])[k ];//ktne + //real f27TSW = (D27.f[DIR_MMP ])[ksw];//ktsw + //real f27TSE = (D27.f[DIR_PMP ])[ks ];//ktse + //real f27TNW = (D27.f[DIR_MPP ])[kw ];//ktnw + //real f27BNE = (D27.f[DIR_PPM ])[kb ];//kbne + //real f27BSW = (D27.f[DIR_MMM ])[kbsw]; + //real f27BSE = (D27.f[DIR_PMM ])[kbs];//kbse + //real f27BNW = (D27.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////// //real vx1 = ((fTNE-fBSW)+(fBNE-fTSW)+(fTSE-fBNW)+(fBSE-fTNW) +(fNE-fSW)+(fSE-fNW)+(fTE-fBW)+(fBE-fTW)+(fE-fW)); //real vx2 = ((fTNE-fBSW)+(fBNE-fTSW)+(fBNW-fTSE)+(fTNW-fBSE) +(fNE-fSW)+(fNW-fSE)+(fTN-fBS)+(fBN-fTS)+(fN-fS)); @@ -230,33 +231,33 @@ extern "C" __global__ void LB_Kernel_AD_Incomp_27(real diffusivity, //////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D27.f[dirE])[k]; - real mfabb = (D27.f[dirW])[kw]; - real mfbcb = (D27.f[dirN])[k]; - real mfbab = (D27.f[dirS])[ks]; - real mfbbc = (D27.f[dirT])[k]; - real mfbba = (D27.f[dirB])[kb]; - real mfccb = (D27.f[dirNE])[k]; - real mfaab = (D27.f[dirSW])[ksw]; - real mfcab = (D27.f[dirSE])[ks]; - real mfacb = (D27.f[dirNW])[kw]; - real mfcbc = (D27.f[dirTE])[k]; - real mfaba = (D27.f[dirBW])[kbw]; - real mfcba = (D27.f[dirBE])[kb]; - real mfabc = (D27.f[dirTW])[kw]; - real mfbcc = (D27.f[dirTN])[k]; - real mfbaa = (D27.f[dirBS])[kbs]; - real mfbca = (D27.f[dirBN])[kb]; - real mfbac = (D27.f[dirTS])[ks]; - real mfbbb = (D27.f[dirZERO])[k]; - real mfccc = (D27.f[dirTNE])[k]; - real mfaac = (D27.f[dirTSW])[ksw]; - real mfcac = (D27.f[dirTSE])[ks]; - real mfacc = (D27.f[dirTNW])[kw]; - real mfcca = (D27.f[dirBNE])[kb]; - real mfaaa = (D27.f[dirBSW])[kbsw]; - real mfcaa = (D27.f[dirBSE])[kbs]; - real mfaca = (D27.f[dirBNW])[kbw]; + real mfcbb = (D27.f[DIR_P00])[k]; + real mfabb = (D27.f[DIR_M00])[kw]; + real mfbcb = (D27.f[DIR_0P0])[k]; + real mfbab = (D27.f[DIR_0M0])[ks]; + real mfbbc = (D27.f[DIR_00P])[k]; + real mfbba = (D27.f[DIR_00M])[kb]; + real mfccb = (D27.f[DIR_PP0])[k]; + real mfaab = (D27.f[DIR_MM0])[ksw]; + real mfcab = (D27.f[DIR_PM0])[ks]; + real mfacb = (D27.f[DIR_MP0])[kw]; + real mfcbc = (D27.f[DIR_P0P])[k]; + real mfaba = (D27.f[DIR_M0M])[kbw]; + real mfcba = (D27.f[DIR_P0M])[kb]; + real mfabc = (D27.f[DIR_M0P])[kw]; + real mfbcc = (D27.f[DIR_0PP])[k]; + real mfbaa = (D27.f[DIR_0MM])[kbs]; + real mfbca = (D27.f[DIR_0PM])[kb]; + real mfbac = (D27.f[DIR_0MP])[ks]; + real mfbbb = (D27.f[DIR_000])[k]; + real mfccc = (D27.f[DIR_PPP])[k]; + real mfaac = (D27.f[DIR_MMP])[ksw]; + real mfcac = (D27.f[DIR_PMP])[ks]; + real mfacc = (D27.f[DIR_MPP])[kw]; + real mfcca = (D27.f[DIR_PPM])[kb]; + real mfaaa = (D27.f[DIR_MMM])[kbsw]; + real mfcaa = (D27.f[DIR_PMM])[kbs]; + real mfaca = (D27.f[DIR_MPM])[kbw]; //////////////////////////////////////////////////////////////////////////////////// //Conc real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + @@ -300,33 +301,33 @@ extern "C" __global__ void LB_Kernel_AD_Incomp_27(real diffusivity, // (f27E+f27W)+(f27N+f27S)+(f27T+f27B)+f27ZERO; //real cusq = c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - //(D27.f[ dirE ])[k ] = f27W *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cusq); - //(D27.f[ dirW ])[kw ] = f27E *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cusq); - //(D27.f[ dirN ])[k ] = f27S *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cusq); - //(D27.f[ dirS ])[ks ] = f27N *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cusq); - //(D27.f[ dirT ])[k ] = f27B *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cusq); - //(D27.f[ dirB ])[kb ] = f27T *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*( vx3)+c9over2*( vx3)*( vx3)-cusq); - //(D27.f[ dirNE ])[k ] = f27SW *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cusq); - //(D27.f[ dirSW ])[ksw ] = f27NE *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cusq); - //(D27.f[ dirSE ])[ks ] = f27NW *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cusq); - //(D27.f[ dirNW ])[kw ] = f27SE *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cusq); - //(D27.f[ dirTE ])[k ] = f27BW *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cusq); - //(D27.f[ dirBW ])[kbw ] = f27TE *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cusq); - //(D27.f[ dirBE ])[kb ] = f27TW *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cusq); - //(D27.f[ dirTW ])[kw ] = f27BE *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cusq); - //(D27.f[ dirTN ])[k ] = f27BS *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cusq); - //(D27.f[ dirBS ])[kbs ] = f27TN *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cusq); - //(D27.f[ dirBN ])[kb ] = f27TS *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cusq); - //(D27.f[ dirTS ])[ks ] = f27BN *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cusq); - //(D27.f[ dirZERO])[k ] = f27ZERO *(one-omegaD)+omegaD* c8over27* ConcD*(one-cusq); - //(D27.f[ dirTNE ])[k ] = f27BSW *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cusq); - //(D27.f[ dirTSE ])[ks ] = f27BNW *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq); - //(D27.f[ dirBNE ])[kb ] = f27TSW *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cusq); - //(D27.f[ dirBSE ])[kbs ] = f27TNW *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq); - //(D27.f[ dirTNW ])[kw ] = f27BSE *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq); - //(D27.f[ dirTSW ])[ksw ] = f27BNE *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cusq); - //(D27.f[ dirBNW ])[kbw ] = f27TSE *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cusq); - //(D27.f[ dirBSW ])[kbsw] = f27TNE *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cusq); + //(D27.f[ DIR_P00 ])[k ] = f27W *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*(-vx1 )+c9over2*(-vx1 )*(-vx1 )-cusq); + //(D27.f[ DIR_M00 ])[kw ] = f27E *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cusq); + //(D27.f[ DIR_0P0 ])[k ] = f27S *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*( -vx2 )+c9over2*( -vx2 )*( -vx2 )-cusq); + //(D27.f[ DIR_0M0 ])[ks ] = f27N *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*( vx2 )+c9over2*( vx2 )*( vx2 )-cusq); + //(D27.f[ DIR_00P ])[k ] = f27B *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*( -vx3)+c9over2*( -vx3)*( -vx3)-cusq); + //(D27.f[ DIR_00M ])[kb ] = f27T *(one-omegaD)+omegaD* c2over27* ConcD*(one+three*( vx3)+c9over2*( vx3)*( vx3)-cusq); + //(D27.f[ DIR_PP0 ])[k ] = f27SW *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*(-vx1-vx2 )+c9over2*(-vx1-vx2 )*(-vx1-vx2 )-cusq); + //(D27.f[ DIR_MM0 ])[ksw ] = f27NE *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx1+vx2 )+c9over2*( vx1+vx2 )*( vx1+vx2 )-cusq); + //(D27.f[ DIR_PM0 ])[ks ] = f27NW *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*(-vx1+vx2 )+c9over2*(-vx1+vx2 )*(-vx1+vx2 )-cusq); + //(D27.f[ DIR_MP0 ])[kw ] = f27SE *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx1-vx2 )+c9over2*( vx1-vx2 )*( vx1-vx2 )-cusq); + //(D27.f[ DIR_P0P ])[k ] = f27BW *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*(-vx1 -vx3)+c9over2*(-vx1 -vx3)*(-vx1 -vx3)-cusq); + //(D27.f[ DIR_M0M ])[kbw ] = f27TE *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx1 +vx3)+c9over2*( vx1 +vx3)*( vx1 +vx3)-cusq); + //(D27.f[ DIR_P0M ])[kb ] = f27TW *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*(-vx1 +vx3)+c9over2*(-vx1 +vx3)*(-vx1 +vx3)-cusq); + //(D27.f[ DIR_M0P ])[kw ] = f27BE *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx1 -vx3)+c9over2*( vx1 -vx3)*( vx1 -vx3)-cusq); + //(D27.f[ DIR_0PP ])[k ] = f27BS *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( -vx2-vx3)+c9over2*( -vx2-vx3)*( -vx2-vx3)-cusq); + //(D27.f[ DIR_0MM ])[kbs ] = f27TN *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx2+vx3)+c9over2*( vx2+vx3)*( vx2+vx3)-cusq); + //(D27.f[ DIR_0PM ])[kb ] = f27TS *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( -vx2+vx3)+c9over2*( -vx2+vx3)*( -vx2+vx3)-cusq); + //(D27.f[ DIR_0MP ])[ks ] = f27BN *(one-omegaD)+omegaD* c1over54* ConcD*(one+three*( vx2-vx3)+c9over2*( vx2-vx3)*( vx2-vx3)-cusq); + //(D27.f[ DIR_000])[k ] = f27ZERO *(one-omegaD)+omegaD* c8over27* ConcD*(one-cusq); + //(D27.f[ DIR_PPP ])[k ] = f27BSW *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*(-vx1-vx2-vx3)+c9over2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cusq); + //(D27.f[ DIR_PMP ])[ks ] = f27BNW *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*(-vx1+vx2-vx3)+c9over2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cusq); + //(D27.f[ DIR_PPM ])[kb ] = f27TSW *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*(-vx1-vx2+vx3)+c9over2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cusq); + //(D27.f[ DIR_PMM ])[kbs ] = f27TNW *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cusq); + //(D27.f[ DIR_MPP ])[kw ] = f27BSE *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cusq); + //(D27.f[ DIR_MMP ])[ksw ] = f27BNE *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*( vx1+vx2-vx3)+c9over2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cusq); + //(D27.f[ DIR_MPM ])[kbw ] = f27TSE *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*( vx1-vx2+vx3)+c9over2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cusq); + //(D27.f[ DIR_MMM ])[kbsw] = f27TNE *(one-omegaD)+omegaD* c1over216*ConcD*(one+three*( vx1+vx2+vx3)+c9over2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cusq); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real oMdrho = c0o1;//one; // comp special @@ -860,33 +861,33 @@ extern "C" __global__ void LB_Kernel_AD_Incomp_27(real diffusivity, //////////////////////////////////////////////////////////////////////////////////// - (D27.f[dirE])[k] = mfabb; - (D27.f[dirW])[kw] = mfcbb; - (D27.f[dirN])[k] = mfbab; - (D27.f[dirS])[ks] = mfbcb; - (D27.f[dirT])[k] = mfbba; - (D27.f[dirB])[kb] = mfbbc; - (D27.f[dirNE])[k] = mfaab; - (D27.f[dirSW])[ksw] = mfccb; - (D27.f[dirSE])[ks] = mfacb; - (D27.f[dirNW])[kw] = mfcab; - (D27.f[dirTE])[k] = mfaba; - (D27.f[dirBW])[kbw] = mfcbc; - (D27.f[dirBE])[kb] = mfabc; - (D27.f[dirTW])[kw] = mfcba; - (D27.f[dirTN])[k] = mfbaa; - (D27.f[dirBS])[kbs] = mfbcc; - (D27.f[dirBN])[kb] = mfbac; - (D27.f[dirTS])[ks] = mfbca; - (D27.f[dirZERO])[k] = mfbbb; - (D27.f[dirTNE])[k] = mfaaa; - (D27.f[dirTSE])[ks] = mfaca; - (D27.f[dirBNE])[kb] = mfaac; - (D27.f[dirBSE])[kbs] = mfacc; - (D27.f[dirTNW])[kw] = mfcaa; - (D27.f[dirTSW])[ksw] = mfcca; - (D27.f[dirBNW])[kbw] = mfcac; - (D27.f[dirBSW])[kbsw] = mfccc; + (D27.f[DIR_P00])[k] = mfabb; + (D27.f[DIR_M00])[kw] = mfcbb; + (D27.f[DIR_0P0])[k] = mfbab; + (D27.f[DIR_0M0])[ks] = mfbcb; + (D27.f[DIR_00P])[k] = mfbba; + (D27.f[DIR_00M])[kb] = mfbbc; + (D27.f[DIR_PP0])[k] = mfaab; + (D27.f[DIR_MM0])[ksw] = mfccb; + (D27.f[DIR_PM0])[ks] = mfacb; + (D27.f[DIR_MP0])[kw] = mfcab; + (D27.f[DIR_P0P])[k] = mfaba; + (D27.f[DIR_M0M])[kbw] = mfcbc; + (D27.f[DIR_P0M])[kb] = mfabc; + (D27.f[DIR_M0P])[kw] = mfcba; + (D27.f[DIR_0PP])[k] = mfbaa; + (D27.f[DIR_0MM])[kbs] = mfbcc; + (D27.f[DIR_0PM])[kb] = mfbac; + (D27.f[DIR_0MP])[ks] = mfbca; + (D27.f[DIR_000])[k] = mfbbb; + (D27.f[DIR_PPP])[k] = mfaaa; + (D27.f[DIR_PMP])[ks] = mfaca; + (D27.f[DIR_PPM])[kb] = mfaac; + (D27.f[DIR_PMM])[kbs] = mfacc; + (D27.f[DIR_MPP])[kw] = mfcaa; + (D27.f[DIR_MMP])[ksw] = mfcca; + (D27.f[DIR_MPM])[kbw] = mfcac; + (D27.f[DIR_MMM])[kbsw] = mfccc; //////////////////////////////////////////////////////////////////////////////////// } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27_Device.cuh index 9833a2bcdd0b13cbf229f97e43eced4c87009242..a6d94de4fadb9a93a9e5fed63d87731b12ec2a07 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_AD_Incomp_27(real diffusivity, +__global__ void LB_Kernel_AD_Incomp_27(real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7.cu index bcb396621bcbf1dc2180022636b54db905e26ce1..27da776eb7612307fa4f9af2886594fc0c75d90b 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7.cu @@ -10,7 +10,7 @@ std::shared_ptr<ADIncomp7> ADIncomp7::getNewInstance(std::shared_ptr<Parameter> void ADIncomp7::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,14 +29,14 @@ void ADIncomp7::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_AD_Incomp_7 << < grid, threads >> >( para->getParD(level)->diffusivity, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->d7.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD7.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_AD_Incomp_7 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7_Device.cu index 7ae4535d028b4da4fe53681219ef90705f990d06..d49b0b48d20d976076a52f804d485b68da55348e 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_AD_Incomp_7(real diffusivity, +__global__ void LB_Kernel_AD_Incomp_7(real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -37,63 +38,63 @@ extern "C" __global__ void LB_Kernel_AD_Incomp_7(real diffusivity, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } Distributions7 D7; @@ -128,60 +129,60 @@ extern "C" __global__ void LB_Kernel_AD_Incomp_7(real diffusivity, unsigned int kbs = neighborZ[ks]; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real fW = (D.f[dirE])[k];//ke - real fE = (D.f[dirW])[kw]; - real fS = (D.f[dirN])[k];//kn - real fN = (D.f[dirS])[ks]; - real fB = (D.f[dirT])[k];//kt - real fT = (D.f[dirB])[kb]; - real fSW = (D.f[dirNE])[k];//kne - real fNE = (D.f[dirSW])[ksw]; - real fNW = (D.f[dirSE])[ks];//kse - real fSE = (D.f[dirNW])[kw];//knw - real fBW = (D.f[dirTE])[k];//kte - real fTE = (D.f[dirBW])[kbw]; - real fTW = (D.f[dirBE])[kb];//kbe - real fBE = (D.f[dirTW])[kw];//ktw - real fBS = (D.f[dirTN])[k];//ktn - real fTN = (D.f[dirBS])[kbs]; - real fTS = (D.f[dirBN])[kb];//kbn - real fBN = (D.f[dirTS])[ks];//kts - //real fZERO = (D.f[dirZERO])[k];//kzero - real fBSW = (D.f[dirTNE])[k];//ktne - real fBNE = (D.f[dirTSW])[ksw];//ktsw - real fBNW = (D.f[dirTSE])[ks];//ktse - real fBSE = (D.f[dirTNW])[kw];//ktnw - real fTSW = (D.f[dirBNE])[kb];//kbne - real fTNE = (D.f[dirBSW])[kbsw]; - real fTNW = (D.f[dirBSE])[kbs];//kbse - real fTSE = (D.f[dirBNW])[kbw];//kbnw - //real fE = (D.f[dirE ])[k ];//ke - //real fW = (D.f[dirW ])[kw ]; - //real fN = (D.f[dirN ])[k ];//kn - //real fS = (D.f[dirS ])[ks ]; - //real fT = (D.f[dirT ])[k ];//kt - //real fB = (D.f[dirB ])[kb ]; - //real fNE = (D.f[dirNE ])[k ];//kne - //real fSW = (D.f[dirSW ])[ksw]; - //real fSE = (D.f[dirSE ])[ks ];//kse - //real fNW = (D.f[dirNW ])[kw ];//knw - //real fTE = (D.f[dirTE ])[k ];//kte - //real fBW = (D.f[dirBW ])[kbw]; - //real fBE = (D.f[dirBE ])[kb ];//kbe - //real fTW = (D.f[dirTW ])[kw ];//ktw - //real fTN = (D.f[dirTN ])[k ];//ktn - //real fBS = (D.f[dirBS ])[kbs]; - //real fBN = (D.f[dirBN ])[kb ];//kbn - //real fTS = (D.f[dirTS ])[ks ];//kts - //real fZERO = (D.f[dirZERO])[k ];//kzero - //real fTNE = (D.f[dirTNE ])[k ];//ktne - //real fTSW = (D.f[dirTSW ])[ksw];//ktsw - //real fTSE = (D.f[dirTSE ])[ks ];//ktse - //real fTNW = (D.f[dirTNW ])[kw ];//ktnw - //real fBNE = (D.f[dirBNE ])[kb ];//kbne - //real fBSW = (D.f[dirBSW ])[kbsw]; - //real fBSE = (D.f[dirBSE ])[kbs];//kbse - //real fBNW = (D.f[dirBNW ])[kbw];//kbnw + real fW = (D.f[DIR_P00])[k];//ke + real fE = (D.f[DIR_M00])[kw]; + real fS = (D.f[DIR_0P0])[k];//kn + real fN = (D.f[DIR_0M0])[ks]; + real fB = (D.f[DIR_00P])[k];//kt + real fT = (D.f[DIR_00M])[kb]; + real fSW = (D.f[DIR_PP0])[k];//kne + real fNE = (D.f[DIR_MM0])[ksw]; + real fNW = (D.f[DIR_PM0])[ks];//kse + real fSE = (D.f[DIR_MP0])[kw];//knw + real fBW = (D.f[DIR_P0P])[k];//kte + real fTE = (D.f[DIR_M0M])[kbw]; + real fTW = (D.f[DIR_P0M])[kb];//kbe + real fBE = (D.f[DIR_M0P])[kw];//ktw + real fBS = (D.f[DIR_0PP])[k];//ktn + real fTN = (D.f[DIR_0MM])[kbs]; + real fTS = (D.f[DIR_0PM])[kb];//kbn + real fBN = (D.f[DIR_0MP])[ks];//kts + //real fZERO = (D.f[DIR_000])[k];//kzero + real fBSW = (D.f[DIR_PPP])[k];//ktne + real fBNE = (D.f[DIR_MMP])[ksw];//ktsw + real fBNW = (D.f[DIR_PMP])[ks];//ktse + real fBSE = (D.f[DIR_MPP])[kw];//ktnw + real fTSW = (D.f[DIR_PPM])[kb];//kbne + real fTNE = (D.f[DIR_MMM])[kbsw]; + real fTNW = (D.f[DIR_PMM])[kbs];//kbse + real fTSE = (D.f[DIR_MPM])[kbw];//kbnw + //real fE = (D.f[DIR_P00 ])[k ];//ke + //real fW = (D.f[DIR_M00 ])[kw ]; + //real fN = (D.f[DIR_0P0 ])[k ];//kn + //real fS = (D.f[DIR_0M0 ])[ks ]; + //real fT = (D.f[DIR_00P ])[k ];//kt + //real fB = (D.f[DIR_00M ])[kb ]; + //real fNE = (D.f[DIR_PP0 ])[k ];//kne + //real fSW = (D.f[DIR_MM0 ])[ksw]; + //real fSE = (D.f[DIR_PM0 ])[ks ];//kse + //real fNW = (D.f[DIR_MP0 ])[kw ];//knw + //real fTE = (D.f[DIR_P0P ])[k ];//kte + //real fBW = (D.f[DIR_M0M ])[kbw]; + //real fBE = (D.f[DIR_P0M ])[kb ];//kbe + //real fTW = (D.f[DIR_M0P ])[kw ];//ktw + //real fTN = (D.f[DIR_0PP ])[k ];//ktn + //real fBS = (D.f[DIR_0MM ])[kbs]; + //real fBN = (D.f[DIR_0PM ])[kb ];//kbn + //real fTS = (D.f[DIR_0MP ])[ks ];//kts + //real fZERO = (D.f[DIR_000])[k ];//kzero + //real fTNE = (D.f[DIR_PPP ])[k ];//ktne + //real fTSW = (D.f[DIR_MMP ])[ksw];//ktsw + //real fTSE = (D.f[DIR_PMP ])[ks ];//ktse + //real fTNW = (D.f[DIR_MPP ])[kw ];//ktnw + //real fBNE = (D.f[DIR_PPM ])[kb ];//kbne + //real fBSW = (D.f[DIR_MMM ])[kbsw]; + //real fBSE = (D.f[DIR_PMM ])[kbs];//kbse + //real fBNW = (D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////// real f7ZERO = (D7.f[0])[k]; real f7E = (D7.f[1])[k]; diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7_Device.cuh index fe489784861839d778d65e9ddf14ed449a9ad7e0..25a17ddbd7038635a2beb2c39212822cbf762034 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_AD_Incomp_7(real diffusivity, +__global__ void LB_Kernel_AD_Incomp_7(real diffusivity, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27.cu index 3d35074a21fc7828a9c8fa05c23be6b7d0bbef1f..d2f9f60890379d07ecc3d04f4a54d59a0754907a 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27.cu @@ -11,7 +11,7 @@ std::shared_ptr<BGKCompSP27> BGKCompSP27::getNewInstance(std::shared_ptr<Paramet void BGKCompSP27::run() { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -29,13 +29,13 @@ void BGKCompSP27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_BGK_Comp_SP_27 << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_BGK_Comp_SP_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cu index c40397041a70ad99525bc2947724ed8de1b7121a..09196d13e94a2404ba280e8a8e9394f0a79e8211 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cu @@ -1,12 +1,13 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_BGK_Comp_SP_27( real omega, +__global__ void LB_Kernel_BGK_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -37,63 +38,63 @@ extern "C" __global__ void LB_Kernel_BGK_Comp_SP_27( real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -126,33 +127,33 @@ extern "C" __global__ void LB_Kernel_BGK_Comp_SP_27( real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real fE = (D.f[dirE])[k];//ke - real fW = (D.f[dirW])[kw]; - real fN = (D.f[dirN])[k];//kn - real fS = (D.f[dirS])[ks]; - real fT = (D.f[dirT])[k];//kt - real fB = (D.f[dirB])[kb]; - real fNE = (D.f[dirNE])[k];//kne - real fSW = (D.f[dirSW])[ksw]; - real fSE = (D.f[dirSE])[ks];//kse - real fNW = (D.f[dirNW])[kw];//knw - real fTE = (D.f[dirTE])[k];//kte - real fBW = (D.f[dirBW])[kbw]; - real fBE = (D.f[dirBE])[kb];//kbe - real fTW = (D.f[dirTW])[kw];//ktw - real fTN = (D.f[dirTN])[k];//ktn - real fBS = (D.f[dirBS])[kbs]; - real fBN = (D.f[dirBN])[kb];//kbn - real fTS = (D.f[dirTS])[ks];//kts - real fZERO = (D.f[dirZERO])[k];//kzero - real fTNE = (D.f[dirTNE])[k];//ktne - real fTSW = (D.f[dirTSW])[ksw];//ktsw - real fTSE = (D.f[dirTSE])[ks];//ktse - real fTNW = (D.f[dirTNW])[kw];//ktnw - real fBNE = (D.f[dirBNE])[kb];//kbne - real fBSW = (D.f[dirBSW])[kbsw]; - real fBSE = (D.f[dirBSE])[kbs];//kbse - real fBNW = (D.f[dirBNW])[kbw];//kbnw + real fE = (D.f[DIR_P00])[k];//ke + real fW = (D.f[DIR_M00])[kw]; + real fN = (D.f[DIR_0P0])[k];//kn + real fS = (D.f[DIR_0M0])[ks]; + real fT = (D.f[DIR_00P])[k];//kt + real fB = (D.f[DIR_00M])[kb]; + real fNE = (D.f[DIR_PP0])[k];//kne + real fSW = (D.f[DIR_MM0])[ksw]; + real fSE = (D.f[DIR_PM0])[ks];//kse + real fNW = (D.f[DIR_MP0])[kw];//knw + real fTE = (D.f[DIR_P0P])[k];//kte + real fBW = (D.f[DIR_M0M])[kbw]; + real fBE = (D.f[DIR_P0M])[kb];//kbe + real fTW = (D.f[DIR_M0P])[kw];//ktw + real fTN = (D.f[DIR_0PP])[k];//ktn + real fBS = (D.f[DIR_0MM])[kbs]; + real fBN = (D.f[DIR_0PM])[kb];//kbn + real fTS = (D.f[DIR_0MP])[ks];//kts + real fZERO = (D.f[DIR_000])[k];//kzero + real fTNE = (D.f[DIR_PPP])[k];//ktne + real fTSW = (D.f[DIR_MMP])[ksw];//ktsw + real fTSE = (D.f[DIR_PMP])[ks];//ktse + real fTNW = (D.f[DIR_MPP])[kw];//ktnw + real fBNE = (D.f[DIR_PPM])[kb];//kbne + real fBSW = (D.f[DIR_MMM])[kbsw]; + real fBSE = (D.f[DIR_PMM])[kbs];//kbse + real fBNW = (D.f[DIR_MPM])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////// real drho = (fTNE + fBSW) + (fTSW + fBNE) + (fTSE + fBNW) + (fTNW + fBSE) + (fNE + fSW) + (fNW + fSE) + (fTE + fBW) + (fBE + fTW) + (fTN + fBS) + (fBN + fTS) + (fE + fW) + (fN + fS) + (fT + fB) + fZERO; real rho = drho + c1o1; @@ -209,33 +210,33 @@ extern "C" __global__ void LB_Kernel_BGK_Comp_SP_27( real omega, ////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = fW; - (D.f[dirW])[kw] = fE; - (D.f[dirN])[k] = fS; - (D.f[dirS])[ks] = fN; - (D.f[dirT])[k] = fB; - (D.f[dirB])[kb] = fT; - (D.f[dirNE])[k] = fSW; - (D.f[dirSW])[ksw] = fNE; - (D.f[dirSE])[ks] = fNW; - (D.f[dirNW])[kw] = fSE; - (D.f[dirTE])[k] = fBW; - (D.f[dirBW])[kbw] = fTE; - (D.f[dirBE])[kb] = fTW; - (D.f[dirTW])[kw] = fBE; - (D.f[dirTN])[k] = fBS; - (D.f[dirBS])[kbs] = fTN; - (D.f[dirBN])[kb] = fTS; - (D.f[dirTS])[ks] = fBN; - (D.f[dirZERO])[k] = fZERO; - (D.f[dirTNE])[k] = fBSW; - (D.f[dirTSE])[ks] = fBNW; - (D.f[dirBNE])[kb] = fTSW; - (D.f[dirBSE])[kbs] = fTNW; - (D.f[dirTNW])[kw] = fBSE; - (D.f[dirTSW])[ksw] = fBNE; - (D.f[dirBNW])[kbw] = fTSE; - (D.f[dirBSW])[kbsw] = fTNE; + (D.f[DIR_P00])[k] = fW; + (D.f[DIR_M00])[kw] = fE; + (D.f[DIR_0P0])[k] = fS; + (D.f[DIR_0M0])[ks] = fN; + (D.f[DIR_00P])[k] = fB; + (D.f[DIR_00M])[kb] = fT; + (D.f[DIR_PP0])[k] = fSW; + (D.f[DIR_MM0])[ksw] = fNE; + (D.f[DIR_PM0])[ks] = fNW; + (D.f[DIR_MP0])[kw] = fSE; + (D.f[DIR_P0P])[k] = fBW; + (D.f[DIR_M0M])[kbw] = fTE; + (D.f[DIR_P0M])[kb] = fTW; + (D.f[DIR_M0P])[kw] = fBE; + (D.f[DIR_0PP])[k] = fBS; + (D.f[DIR_0MM])[kbs] = fTN; + (D.f[DIR_0PM])[kb] = fTS; + (D.f[DIR_0MP])[ks] = fBN; + (D.f[DIR_000])[k] = fZERO; + (D.f[DIR_PPP])[k] = fBSW; + (D.f[DIR_PMP])[ks] = fBNW; + (D.f[DIR_PPM])[kb] = fTSW; + (D.f[DIR_PMM])[kbs] = fTNW; + (D.f[DIR_MPP])[kw] = fBSE; + (D.f[DIR_MMP])[ksw] = fBNE; + (D.f[DIR_MPM])[kbw] = fTSE; + (D.f[DIR_MMM])[kbsw] = fTNE; ////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cuh index fb6ef2eea656f29e9e788ca80dbf8aef801055d5..59a5240862ed92a9ea3e9187c503ee9233da7e5a 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_BGK_Comp_SP_27( real omega, +__global__ void LB_Kernel_BGK_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27.cu index 3923f088e939710fd261e92f20e62dd3fc8fe306..beebda2437ca4e7385ab812b9106edabe213227e 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27.cu @@ -11,7 +11,7 @@ std::shared_ptr<BGKPlusCompSP27> BGKPlusCompSP27::getNewInstance(std::shared_ptr void BGKPlusCompSP27::run() { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -29,13 +29,13 @@ void BGKPlusCompSP27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_BGK_Plus_Comp_SP_27 << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], size_Mat, - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_BGK_Plus_Comp_SP_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cu index 25138592cc9d602e66f0b22ae565fadcce44f27d..325f65ece9baddf88adc91baa753bdfc4bd0eced 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_BGK_Plus_Comp_SP_27( +__global__ void LB_Kernel_BGK_Plus_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -37,63 +38,63 @@ extern "C" __global__ void LB_Kernel_BGK_Plus_Comp_SP_27( Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -126,33 +127,33 @@ extern "C" __global__ void LB_Kernel_BGK_Plus_Comp_SP_27( //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// //slow //real oMdrho = one - ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + @@ -792,33 +793,33 @@ extern "C" __global__ void LB_Kernel_BGK_Plus_Comp_SP_27( //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cuh index 82e41dd80ab03e0d7ce8cee854fffa009c7fefee..9e991ffa4b16e0df78fe23f6ee5a1e0678919cd7 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_BGK_Plus_Comp_SP_27( real omega, +__global__ void LB_Kernel_BGK_Plus_Comp_SP_27( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKUnified/BGKUnified.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKUnified/BGKUnified.cu index b86af5f876286599146190a1244a5bf21e2948fd..3d7f6fb9a8980454ebc83c51c7dd8865688fa166 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKUnified/BGKUnified.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKUnified/BGKUnified.cu @@ -25,21 +25,21 @@ BGKUnified::BGKUnified(std::shared_ptr<Parameter> para, int level) myKernelGroup = BasicKernel; - this->cudaGrid = cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->size_Mat_SP); + this->cudaGrid = cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); } void BGKUnified::run() { GPUKernelParameter kernelParameter{ para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - (int)para->getParD(level)->size_Mat_SP, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + (int)para->getParD(level)->numberOfNodes, nullptr, /* forces not used in bgk kernel */ - para->getParD(level)->evenOrOdd }; + para->getParD(level)->isEvenTimestep }; auto lambda = [] __device__(lbm::KernelParameter parameter) { return lbm::bgk(parameter); diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27.cu index a8abe7a72ab957f7ba3691481cc7913f0f619d6c..eca3a9953024e44fd91e7f9f98956e4329574d09 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27.cu @@ -10,7 +10,7 @@ std::shared_ptr<CascadeCompSP27> CascadeCompSP27::getNewInstance(std::shared_ptr void CascadeCompSP27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,13 +29,13 @@ void CascadeCompSP27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_Cascade_Comp_SP_27 << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_Cascade_Comp_SP_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cu index b024c2627235ffdbd34fa8234b88497b083074cf..3f69fa47288343fbdd91e77dbb7f154501349098 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_Cascade_Comp_SP_27(real omega, +__global__ void LB_Kernel_Cascade_Comp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -36,63 +37,63 @@ extern "C" __global__ void LB_Kernel_Cascade_Comp_SP_27(real omega, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -125,33 +126,33 @@ extern "C" __global__ void LB_Kernel_Cascade_Comp_SP_27(real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ];//[ke ]; - real mfabb = (D.f[dirW ])[kw ];//[kw ]; - real mfbcb = (D.f[dirN ])[k ];//[kn ]; - real mfbab = (D.f[dirS ])[ks ];//[ks ]; - real mfbbc = (D.f[dirT ])[k ];//[kt ]; - real mfbba = (D.f[dirB ])[kb ];//[kb ]; - real mfccb = (D.f[dirNE ])[k ];//[kne ]; - real mfaab = (D.f[dirSW ])[ksw];//[ksw ]; - real mfcab = (D.f[dirSE ])[ks ];//[kse ]; - real mfacb = (D.f[dirNW ])[kw ];//[knw ]; - real mfcbc = (D.f[dirTE ])[k ];//[kte ]; - real mfaba = (D.f[dirBW ])[kbw];//[kbw ]; - real mfcba = (D.f[dirBE ])[kb ];//[kbe ]; - real mfabc = (D.f[dirTW ])[kw ];//[ktw ]; - real mfbcc = (D.f[dirTN ])[k ];//[ktn ]; - real mfbaa = (D.f[dirBS ])[kbs];//[kbs ]; - real mfbca = (D.f[dirBN ])[kb ];//[kbn ]; - real mfbac = (D.f[dirTS ])[ks ];//[kts ]; - real mfbbb = (D.f[dirZERO])[k ];//[kzero]; - real mfccc = (D.f[dirTNE ])[k ];//[ktne ]; - real mfaac = (D.f[dirTSW ])[ksw];//[ktsw ]; - real mfcac = (D.f[dirTSE ])[ks ];//[ktse ]; - real mfacc = (D.f[dirTNW ])[kw ];//[ktnw ]; - real mfcca = (D.f[dirBNE ])[kb ];//[kbne ]; - real mfaaa = (D.f[dirBSW ])[kbsw];//[kbsw ] - real mfcaa = (D.f[dirBSE ])[kbs];//[kbse ]; - real mfaca = (D.f[dirBNW ])[kbw];//[kbnw ]; + real mfcbb = (D.f[DIR_P00 ])[k ];//[ke ]; + real mfabb = (D.f[DIR_M00 ])[kw ];//[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ];//[kn ]; + real mfbab = (D.f[DIR_0M0 ])[ks ];//[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ];//[kt ]; + real mfbba = (D.f[DIR_00M ])[kb ];//[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ];//[kne ]; + real mfaab = (D.f[DIR_MM0 ])[ksw];//[ksw ]; + real mfcab = (D.f[DIR_PM0 ])[ks ];//[kse ]; + real mfacb = (D.f[DIR_MP0 ])[kw ];//[knw ]; + real mfcbc = (D.f[DIR_P0P ])[k ];//[kte ]; + real mfaba = (D.f[DIR_M0M ])[kbw];//[kbw ]; + real mfcba = (D.f[DIR_P0M ])[kb ];//[kbe ]; + real mfabc = (D.f[DIR_M0P ])[kw ];//[ktw ]; + real mfbcc = (D.f[DIR_0PP ])[k ];//[ktn ]; + real mfbaa = (D.f[DIR_0MM ])[kbs];//[kbs ]; + real mfbca = (D.f[DIR_0PM ])[kb ];//[kbn ]; + real mfbac = (D.f[DIR_0MP ])[ks ];//[kts ]; + real mfbbb = (D.f[DIR_000])[k ];//[kzero]; + real mfccc = (D.f[DIR_PPP ])[k ];//[ktne ]; + real mfaac = (D.f[DIR_MMP ])[ksw];//[ktsw ]; + real mfcac = (D.f[DIR_PMP ])[ks ];//[ktse ]; + real mfacc = (D.f[DIR_MPP ])[kw ];//[ktnw ]; + real mfcca = (D.f[DIR_PPM ])[kb ];//[kbne ]; + real mfaaa = (D.f[DIR_MMM ])[kbsw];//[kbsw ] + real mfcaa = (D.f[DIR_PMM ])[kbs];//[kbse ]; + real mfaca = (D.f[DIR_MPM ])[kbw];//[kbnw ]; //////////////////////////////////////////////////////////////////////////////////// real rho = (mfccc+mfaaa + mfaca+mfcac + mfacc+mfcaa + mfaac+mfcca + mfbac+mfbca + mfbaa+mfbcc + mfabc+mfcba + mfaba+mfcbc + mfacb+mfcab + mfaab+mfccb + @@ -732,33 +733,33 @@ extern "C" __global__ void LB_Kernel_Cascade_Comp_SP_27(real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[ dirE ])[k ] = mfabb; - (D.f[ dirW ])[kw ] = mfcbb; - (D.f[ dirN ])[k ] = mfbab; - (D.f[ dirS ])[ks ] = mfbcb; - (D.f[ dirT ])[k ] = mfbba; - (D.f[ dirB ])[kb ] = mfbbc; - (D.f[ dirNE ])[k ] = mfaab; - (D.f[ dirSW ])[ksw ] = mfccb; - (D.f[ dirSE ])[ks ] = mfacb; - (D.f[ dirNW ])[kw ] = mfcab; - (D.f[ dirTE ])[k ] = mfaba; - (D.f[ dirBW ])[kbw ] = mfcbc; - (D.f[ dirBE ])[kb ] = mfabc; - (D.f[ dirTW ])[kw ] = mfcba; - (D.f[ dirTN ])[k ] = mfbaa; - (D.f[ dirBS ])[kbs ] = mfbcc; - (D.f[ dirBN ])[kb ] = mfbac; - (D.f[ dirTS ])[ks ] = mfbca; - (D.f[ dirZERO])[k ] = mfbbb; - (D.f[ dirTNE ])[k ] = mfaaa; - (D.f[ dirTSE ])[ks ] = mfaca; - (D.f[ dirBNE ])[kb ] = mfaac; - (D.f[ dirBSE ])[kbs ] = mfacc; - (D.f[ dirTNW ])[kw ] = mfcaa; - (D.f[ dirTSW ])[ksw ] = mfcca; - (D.f[ dirBNW ])[kbw ] = mfcac; - (D.f[ dirBSW ])[kbsw] = mfccc; + (D.f[ DIR_P00 ])[k ] = mfabb; + (D.f[ DIR_M00 ])[kw ] = mfcbb; + (D.f[ DIR_0P0 ])[k ] = mfbab; + (D.f[ DIR_0M0 ])[ks ] = mfbcb; + (D.f[ DIR_00P ])[k ] = mfbba; + (D.f[ DIR_00M ])[kb ] = mfbbc; + (D.f[ DIR_PP0 ])[k ] = mfaab; + (D.f[ DIR_MM0 ])[ksw ] = mfccb; + (D.f[ DIR_PM0 ])[ks ] = mfacb; + (D.f[ DIR_MP0 ])[kw ] = mfcab; + (D.f[ DIR_P0P ])[k ] = mfaba; + (D.f[ DIR_M0M ])[kbw ] = mfcbc; + (D.f[ DIR_P0M ])[kb ] = mfabc; + (D.f[ DIR_M0P ])[kw ] = mfcba; + (D.f[ DIR_0PP ])[k ] = mfbaa; + (D.f[ DIR_0MM ])[kbs ] = mfbcc; + (D.f[ DIR_0PM ])[kb ] = mfbac; + (D.f[ DIR_0MP ])[ks ] = mfbca; + (D.f[ DIR_000])[k ] = mfbbb; + (D.f[ DIR_PPP ])[k ] = mfaaa; + (D.f[ DIR_PMP ])[ks ] = mfaca; + (D.f[ DIR_PPM ])[kb ] = mfaac; + (D.f[ DIR_PMM ])[kbs ] = mfacc; + (D.f[ DIR_MPP ])[kw ] = mfcaa; + (D.f[ DIR_MMP ])[ksw ] = mfcca; + (D.f[ DIR_MPM ])[kbw ] = mfcac; + (D.f[ DIR_MMM ])[kbsw] = mfccc; //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cuh index 6c9f8852ae7b0aab2b82897cb5f1905f780b983d..8a49bd02af3ab420b42bc257e8668dd3ff9eca2c 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_Cascade_Comp_SP_27(real s9, +__global__ void LB_Kernel_Cascade_Comp_SP_27(real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27.cu index ace81e2ed69bf4e60d9da3893672f3b007633c67..3f45c7ea71c385f948eac2e052a8d970010c413d 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27.cu @@ -10,7 +10,7 @@ std::shared_ptr<CumulantCompSP27> CumulantCompSP27::getNewInstance(std::shared_p void CumulantCompSP27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,13 +29,13 @@ void CumulantCompSP27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_Cum_Comp_SP_27 << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_Kum_Comp_SP_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cu index e76926b49b44eecd4b42a074e529d6f4af2936ea..ad2ffdf4170d98125e6758c0e2f548122093cea6 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_Cum_Comp_SP_27(real omega, +__global__ void LB_Kernel_Cum_Comp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -36,63 +37,63 @@ extern "C" __global__ void LB_Kernel_Cum_Comp_SP_27(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -125,42 +126,42 @@ extern "C" __global__ void LB_Kernel_Cum_Comp_SP_27(real omega, unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real E = (D.f[dirE])[ke];// + c2over27 ; - real W = (D.f[dirW])[kw];// + c2over27 ; - real N = (D.f[dirN])[kn];// + c2over27 ; - real S = (D.f[dirS])[ks];// + c2over27 ; - real F = (D.f[dirT])[kt];// + c2over27 ; - real B = (D.f[dirB])[kb];// + c2over27 ; - real Ne = (D.f[dirNE])[kne];// + c1over54 ; - real Sw = (D.f[dirSW])[ksw];// + c1over54 ; - real Se = (D.f[dirSE])[kse];// + c1over54 ; - real Nw = (D.f[dirNW])[knw];// + c1over54 ; - real Ef = (D.f[dirTE])[kte];// + c1over54 ; - real Wb = (D.f[dirBW])[kbw];// + c1over54 ; - real Eb = (D.f[dirBE])[kbe];// + c1over54 ; - real Wf = (D.f[dirTW])[ktw];// + c1over54 ; - real Nf = (D.f[dirTN])[ktn];// + c1over54 ; - real Sb = (D.f[dirBS])[kbs];// + c1over54 ; - real Nb = (D.f[dirBN])[kbn];// + c1over54 ; - real Sf = (D.f[dirTS])[kts];// + c1over54 ; - real R = (D.f[dirZERO])[kzero];// + c8over27 ; - real Nef = (D.f[dirTNE])[ktne];// + c1over216; - real Swf = (D.f[dirTSW])[ktsw];// + c1over216; - real Sef = (D.f[dirTSE])[ktse];// + c1over216; - real Nwf = (D.f[dirTNW])[ktnw];// + c1over216; - real Neb = (D.f[dirBNE])[kbne];// + c1over216; - real Swb = (D.f[dirBSW])[kbsw];// + c1over216; - real Seb = (D.f[dirBSE])[kbse];// + c1over216; - real Nwb = (D.f[dirBNW])[kbnw];// + c1over216; + real f_E = (D.f[DIR_P00])[ke];// + c2over27 ; + real f_W = (D.f[DIR_M00])[kw];// + c2over27 ; + real f_N = (D.f[DIR_0P0])[kn];// + c2over27 ; + real f_S = (D.f[DIR_0M0])[ks];// + c2over27 ; + real f_T = (D.f[DIR_00P])[kt];// + c2over27 ; + real f_B = (D.f[DIR_00M])[kb];// + c2over27 ; + real f_NE = (D.f[DIR_PP0])[kne];// + c1over54 ; + real f_SS = (D.f[DIR_MM0])[ksw];// + c1over54 ; + real f_SE = (D.f[DIR_PM0])[kse];// + c1over54 ; + real f_NW = (D.f[DIR_MP0])[knw];// + c1over54 ; + real f_TE = (D.f[DIR_P0P])[kte];// + c1over54 ; + real f_BW = (D.f[DIR_M0M])[kbw];// + c1over54 ; + real f_EB = (D.f[DIR_P0M])[kbe];// + c1over54 ; + real f_TW = (D.f[DIR_M0P])[ktw];// + c1over54 ; + real f_TN = (D.f[DIR_0PP])[ktn];// + c1over54 ; + real f_BS = (D.f[DIR_0MM])[kbs];// + c1over54 ; + real f_BN = (D.f[DIR_0PM])[kbn];// + c1over54 ; + real f_TS = (D.f[DIR_0MP])[kts];// + c1over54 ; + real f_R = (D.f[DIR_000])[kzero];// + c8over27 ; + real f_TNE = (D.f[DIR_PPP])[ktne];// + c1over216; + real f_TSW = (D.f[DIR_MMP])[ktsw];// + c1over216; + real f_TSE = (D.f[DIR_PMP])[ktse];// + c1over216; + real f_TNW = (D.f[DIR_MPP])[ktnw];// + c1over216; + real f_BNE = (D.f[DIR_PPM])[kbne];// + c1over216; + real f_BSW = (D.f[DIR_MMM])[kbsw];// + c1over216; + real f_BSE = (D.f[DIR_PMM])[kbse];// + c1over216; + real f_BNW = (D.f[DIR_MPM])[kbnw];// + c1over216; //////////////////////////////////////////////////////////////////////////////////// real fx = c0o1; real fy = c0o1; real fz = c0o1; //////////////////////////////////////////////////////////////////////////////////// - real rho = Nw + W + Sw + S + Se + E + Ne + N + R + Nf + Nb + Sf + Sb + Ef + Eb + Wf + Wb + Nwf + Nwb + Nef + Neb + Swf + Swb + Sef + Seb + F + B + c1o1;// ACHTUNG ne EINS !!!!!!!! - real pix = (Ne + E + Se + Ef + Eb - Nw - W - Sw - Wf - Wb + Nef + Neb + Sef + Seb - Nwf - Nwb - Swf - Swb); - real piy = (Ne + N + Nw + Nf + Nb - Se - S - Sw - Sf - Sb + Nef + Neb + Nwf + Nwb - Sef - Seb - Swf - Swb); - real piz = (Nf + Sf + Wf + Ef + F - Nb - Sb - Wb - Eb - B + Nef + Nwf + Sef + Swf - Neb - Nwb - Seb - Swb); + real rho = f_NW + f_W + f_SS + f_S + f_SE + f_E + f_NE + f_N + f_R + f_TN + f_BN + f_TS + f_BS + f_TE + f_EB + f_TW + f_BW + f_TNW + f_BNW + f_TNE + f_BNE + f_TSW + f_BSW + f_TSE + f_BSE + f_T + f_B + c1o1;// ACHTUNG ne EINS !!!!!!!! + real pix = (f_NE + f_E + f_SE + f_TE + f_EB - f_NW - f_W - f_SS - f_TW - f_BW + f_TNE + f_BNE + f_TSE + f_BSE - f_TNW - f_BNW - f_TSW - f_BSW); + real piy = (f_NE + f_N + f_NW + f_TN + f_BN - f_SE - f_S - f_SS - f_TS - f_BS + f_TNE + f_BNE + f_TNW + f_BNW - f_TSE - f_BSE - f_TSW - f_BSW); + real piz = (f_TN + f_TS + f_TW + f_TE + f_T - f_BN - f_BS - f_BW - f_EB - f_B + f_TNE + f_TNW + f_TSE + f_TSW - f_BNE - f_BNW - f_BSE - f_BSW); real vvx = pix / rho + fx; real vvy = piy / rho + fy; real vvz = piz / rho + fz; @@ -168,33 +169,33 @@ extern "C" __global__ void LB_Kernel_Cum_Comp_SP_27(real omega, real vy2 = vvy*vvy; real vz2 = vvz*vvz; //////////////////////////////////////////////////////////////////////////////////// - real mfaaa = Swb; - real mfaab = Sw; - real mfaac = Swf; - real mfaba = Wb; - real mfabb = W; - real mfabc = Wf; - real mfbaa = Sb; - real mfbab = S; - real mfbac = Sf; - real mfbba = B; - real mfbbb = R; - real mfbbc = F; - real mfaca = Nwb; - real mfacb = Nw; - real mfacc = Nwf; - real mfcaa = Seb; - real mfcab = Se; - real mfcac = Sef; - real mfcca = Neb; - real mfccb = Ne; - real mfccc = Nef; - real mfbca = Nb; - real mfbcb = N; - real mfbcc = Nf; - real mfcba = Eb; - real mfcbb = E; - real mfcbc = Ef; + real mfaaa = f_BSW; + real mfaab = f_SS; + real mfaac = f_TSW; + real mfaba = f_BW; + real mfabb = f_W; + real mfabc = f_TW; + real mfbaa = f_BS; + real mfbab = f_S; + real mfbac = f_TS; + real mfbba = f_B; + real mfbbb = f_R; + real mfbbc = f_T; + real mfaca = f_BNW; + real mfacb = f_NW; + real mfacc = f_TNW; + real mfcaa = f_BSE; + real mfcab = f_SE; + real mfcac = f_TSE; + real mfcca = f_BNE; + real mfccb = f_NE; + real mfccc = f_TNE; + real mfbca = f_BN; + real mfbcb = f_N; + real mfbcc = f_TN; + real mfcba = f_EB; + real mfcbb = f_E; + real mfcbc = f_TE; real m0, m1, m2; real wadjust; real qudricLimit = c1o100; @@ -873,33 +874,33 @@ extern "C" __global__ void LB_Kernel_Cum_Comp_SP_27(real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[ke] = mfabb;// - c2over27 ;// - (D.f[dirW])[kw] = mfcbb;// - c2over27 ; - (D.f[dirN])[kn] = mfbab;// - c2over27 ; - (D.f[dirS])[ks] = mfbcb;// - c2over27 ; - (D.f[dirT])[kt] = mfbba;// - c2over27 ; - (D.f[dirB])[kb] = mfbbc;// - c2over27 ; - (D.f[dirNE])[kne] = mfaab;// - c1over54 ; - (D.f[dirSW])[ksw] = mfccb;// - c1over54 ; - (D.f[dirSE])[kse] = mfacb;// - c1over54 ; - (D.f[dirNW])[knw] = mfcab;// - c1over54 ; - (D.f[dirTE])[kte] = mfaba;// - c1over54 ; - (D.f[dirBW])[kbw] = mfcbc;// - c1over54 ; - (D.f[dirBE])[kbe] = mfabc;// - c1over54 ; - (D.f[dirTW])[ktw] = mfcba;// - c1over54 ; - (D.f[dirTN])[ktn] = mfbaa;// - c1over54 ; - (D.f[dirBS])[kbs] = mfbcc;// - c1over54 ; - (D.f[dirBN])[kbn] = mfbac;// - c1over54 ; - (D.f[dirTS])[kts] = mfbca;// - c1over54 ; - (D.f[dirZERO])[kzero] = mfbbb;// - c8over27 ; - (D.f[dirTNE])[ktne] = mfaaa;// - c1over216; - (D.f[dirTSE])[ktse] = mfaca;// - c1over216; - (D.f[dirBNE])[kbne] = mfaac;// - c1over216; - (D.f[dirBSE])[kbse] = mfacc;// - c1over216; - (D.f[dirTNW])[ktnw] = mfcaa;// - c1over216; - (D.f[dirTSW])[ktsw] = mfcca;// - c1over216; - (D.f[dirBNW])[kbnw] = mfcac;// - c1over216; - (D.f[dirBSW])[kbsw] = mfccc;// - c1over216; + (D.f[DIR_P00])[ke] = mfabb;// - c2over27 ;// + (D.f[DIR_M00])[kw] = mfcbb;// - c2over27 ; + (D.f[DIR_0P0])[kn] = mfbab;// - c2over27 ; + (D.f[DIR_0M0])[ks] = mfbcb;// - c2over27 ; + (D.f[DIR_00P])[kt] = mfbba;// - c2over27 ; + (D.f[DIR_00M])[kb] = mfbbc;// - c2over27 ; + (D.f[DIR_PP0])[kne] = mfaab;// - c1over54 ; + (D.f[DIR_MM0])[ksw] = mfccb;// - c1over54 ; + (D.f[DIR_PM0])[kse] = mfacb;// - c1over54 ; + (D.f[DIR_MP0])[knw] = mfcab;// - c1over54 ; + (D.f[DIR_P0P])[kte] = mfaba;// - c1over54 ; + (D.f[DIR_M0M])[kbw] = mfcbc;// - c1over54 ; + (D.f[DIR_P0M])[kbe] = mfabc;// - c1over54 ; + (D.f[DIR_M0P])[ktw] = mfcba;// - c1over54 ; + (D.f[DIR_0PP])[ktn] = mfbaa;// - c1over54 ; + (D.f[DIR_0MM])[kbs] = mfbcc;// - c1over54 ; + (D.f[DIR_0PM])[kbn] = mfbac;// - c1over54 ; + (D.f[DIR_0MP])[kts] = mfbca;// - c1over54 ; + (D.f[DIR_000])[kzero] = mfbbb;// - c8over27 ; + (D.f[DIR_PPP])[ktne] = mfaaa;// - c1over216; + (D.f[DIR_PMP])[ktse] = mfaca;// - c1over216; + (D.f[DIR_PPM])[kbne] = mfaac;// - c1over216; + (D.f[DIR_PMM])[kbse] = mfacc;// - c1over216; + (D.f[DIR_MPP])[ktnw] = mfcaa;// - c1over216; + (D.f[DIR_MMP])[ktsw] = mfcca;// - c1over216; + (D.f[DIR_MPM])[kbnw] = mfcac;// - c1over216; + (D.f[DIR_MMM])[kbsw] = mfccc;// - c1over216; //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cuh index 7146787201baf348c84b593772185dfa4d1cd506..cf6a926698e4082383b04c5f1e2d886c6dca6380 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_Cum_Comp_SP_27(real s9, +__global__ void LB_Kernel_Cum_Comp_SP_27(real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.cu index 4316a8272296e0d6dd4526f590e2f1acdbbb5358..9a84df86e41b3fdff75c2ebf580813afc5ee3feb 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.cu @@ -12,7 +12,7 @@ std::shared_ptr<CumulantAll4CompSP27> CumulantAll4CompSP27::getNewInstance(std:: void CumulantAll4CompSP27::run() { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -30,16 +30,16 @@ void CumulantAll4CompSP27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_Cumulant_D3Q27All4 << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], size_Mat, level, para->getForcesDev(), para->getQuadricLimitersDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_Cumulant_D3Q27All4 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cu index 599892c2fb170e3cba2b12356cbfbf1497a94edd..681dbff2ba37a1e0de56341b39cc2dec791f656b 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cu @@ -1,13 +1,14 @@ #include "CumulantAll4CompSP27_Device.cuh" #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, +__global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -41,63 +42,63 @@ extern "C" __global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -159,33 +160,33 @@ extern "C" __global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, //unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -596,9 +597,9 @@ extern "C" __global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, real O6 = c1o1; //////////////////////////////////////////////////////////// - real A = (c4o1 * omega * omega + c2o1 * omega * OxxPyyPzz * (omega - c6o1) + OxxPyyPzz * OxxPyyPzz * (omega * (c10o1 - c3o1 * omega) - c4o1)) / + real factorA = (c4o1 * omega * omega + c2o1 * omega * OxxPyyPzz * (omega - c6o1) + OxxPyyPzz * OxxPyyPzz * (omega * (c10o1 - c3o1 * omega) - c4o1)) / ((omega - OxxPyyPzz) * (OxxPyyPzz * (c2o1 + c3o1 * omega) - c8o1 * omega)); - real B = (c4o1 * omega * OxxPyyPzz * (c9o1 * omega - c16o1) - c4o1 * omega * omega - c2o1 * OxxPyyPzz * OxxPyyPzz * (c2o1 + c9o1 * omega * (omega - c2o1))) / + real factorB = (c4o1 * omega * OxxPyyPzz * (c9o1 * omega - c16o1) - c4o1 * omega * omega - c2o1 * OxxPyyPzz * OxxPyyPzz * (c2o1 + c9o1 * omega * (omega - c2o1))) / (c3o1 * (omega - OxxPyyPzz) * (OxxPyyPzz * (c2o1 + c3o1 * omega) - c8o1 * omega)); @@ -613,9 +614,9 @@ extern "C" __global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, real CUMacc = mfacc - (((mfaac * mfaca + c2o1 * mfabb * mfabb) + c1o3 * (mfaac + mfaca)) / rho - c1o9*(drho / rho)); //5. - real CUMbcc = mfbcc - ((mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac)*(c1o1 + rho*c6o1*B / (c2o1 + c3o1 * B))) / rho; - real CUMcbc = mfcbc - ((mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc)*(c1o1 + rho*c6o1*B / (c2o1 + c3o1 * B))) / rho; - real CUMccb = mfccb - ((mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab)*(c1o1 + rho*c6o1*B / (c2o1 + c3o1 * B))) / rho; + real CUMbcc = mfbcc - ((mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac)*(c1o1 + rho*c6o1*factorB / (c2o1 + c3o1 * factorB))) / rho; + real CUMcbc = mfcbc - ((mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc)*(c1o1 + rho*c6o1*factorB / (c2o1 + c3o1 * factorB))) / rho; + real CUMccb = mfccb - ((mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab)*(c1o1 + rho*c6o1*factorB / (c2o1 + c3o1 * factorB))) / rho; real scaleD2 = (-c27o1 * omega*(omega - OxxPyyPzz)*(c2o1 * OxxPyyPzz + omega*(-c8o1 + c3o1 * OxxPyyPzz))*(-c4o1 * OxxPyyPzz + omega*(-c2o1 + c3o1 * OxxPyyPzz))*O5) / @@ -791,12 +792,12 @@ extern "C" __global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, //CUMbbc = -O4*(one / omega - c1o2)*Dxy*c1o3 *(four + twentyeight*omega - fourteen*omega*omega) / (six - twentyone*omega + fiveteen*omega*omega) + (one - O4) * (CUMbbc); //CUMbcb = -O4*(one / omega - c1o2)*Dxz*c1o3 *(four + twentyeight*omega - fourteen*omega*omega) / (six - twentyone*omega + fiveteen*omega*omega) + (one - O4) * (CUMbcb); //CUMcbb = -O4*(one / omega - c1o2)*Dyz*c1o3 *(four + twentyeight*omega - fourteen*omega*omega) / (six - twentyone*omega + fiveteen*omega*omega) + (one - O4) * (CUMcbb); - CUMacc = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMacc); - CUMcac = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMcac); - CUMcca = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * A + (c1o1 - O4) * (CUMcca); - CUMbbc = -O4 * (c1o1 / omega - c1o2) * Dxy * c1o3 * B + (c1o1 - O4) * (CUMbbc); - CUMbcb = -O4 * (c1o1 / omega - c1o2) * Dxz * c1o3 * B + (c1o1 - O4) * (CUMbcb); - CUMcbb = -O4 * (c1o1 / omega - c1o2) * Dyz * c1o3 * B + (c1o1 - O4) * (CUMcbb); + CUMacc = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMacc); + CUMcac = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMcac); + CUMcca = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * factorA + (c1o1 - O4) * (CUMcca); + CUMbbc = -O4 * (c1o1 / omega - c1o2) * Dxy * c1o3 * factorB + (c1o1 - O4) * (CUMbbc); + CUMbcb = -O4 * (c1o1 / omega - c1o2) * Dxz * c1o3 * factorB + (c1o1 - O4) * (CUMbcb); + CUMcbb = -O4 * (c1o1 / omega - c1o2) * Dyz * c1o3 * factorB + (c1o1 - O4) * (CUMcbb); ////////////////////////////////////////////////////////////////////////// @@ -821,9 +822,9 @@ extern "C" __global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, mfacc = CUMacc + (((mfaac * mfaca + c2o1 * mfabb * mfabb) + c1o3 * (mfaac + mfaca)) / rho - c1o9*(drho / rho)); //5. - mfbcc = CUMbcc + ((mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac)*(c1o1 + rho*c6o1*B / (c2o1 + c3o1 * B))) / rho; - mfcbc = CUMcbc + ((mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc)*(c1o1 + rho*c6o1*B / (c2o1 + c3o1 * B))) / rho; - mfccb = CUMccb + ((mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab)*(c1o1 + rho*c6o1*B / (c2o1 + c3o1 * B))) / rho; + mfbcc = CUMbcc + ((mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac)*(c1o1 + rho*c6o1*factorB / (c2o1 + c3o1 * factorB))) / rho; + mfcbc = CUMcbc + ((mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc)*(c1o1 + rho*c6o1*factorB / (c2o1 + c3o1 * factorB))) / rho; + mfccb = CUMccb + ((mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab)*(c1o1 + rho*c6o1*factorB / (c2o1 + c3o1 * factorB))) / rho; //6. @@ -1060,33 +1061,33 @@ extern "C" __global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cuh index 27f981228c1e2be8e29d176d0a234534c1e61b5b..5f23194d561d106cf2493c36199444f8da15efd7 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, +__global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp.cu index 01cc11cbba3d4e25fff3cd9f676c4a89b61e94d1..1b6ba1a2278b68f085a4b7df699b7ca230811f39 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp.cu @@ -12,7 +12,7 @@ std::shared_ptr<CumulantK15Comp> CumulantK15Comp::getNewInstance(std::shared_ptr void CumulantK15Comp::run() { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -30,15 +30,15 @@ void CumulantK15Comp::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_CumulantK15Comp <<< grid, threads >>>(para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], size_Mat, level, para->getForcesDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_CumulantK15Comp execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cu index 7349be5847c2ea936f7d999a4ce91aee02c17973..93d57d6c9871d66537f25b9188467d46e3b3d05c 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_CumulantK15Comp(real omega, +__global__ void LB_Kernel_CumulantK15Comp(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -38,63 +39,63 @@ extern "C" __global__ void LB_Kernel_CumulantK15Comp(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -155,33 +156,33 @@ extern "C" __global__ void LB_Kernel_CumulantK15Comp(real omega, //unsigned int ktne = k; //unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -1241,33 +1242,33 @@ extern "C" __global__ void LB_Kernel_CumulantK15Comp(real omega, ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb; mfbbb += drho - drhoPost; //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cuh index 208fbec553507812bfe4339577734292b248c027..149aab34a16673ddd707427c222a56cf18d127ca 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_CumulantK15Comp( real omega, +__global__ void LB_Kernel_CumulantK15Comp( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp.cu index 47111369449058e5b70c736be939f051a8e749c0..188984d001f89d72c967dd6390ca10ae5d2eab32 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp.cu @@ -10,7 +10,7 @@ std::shared_ptr<CumulantK15BulkComp> CumulantK15BulkComp::getNewInstance(std::sh void CumulantK15BulkComp::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,15 +29,15 @@ void CumulantK15BulkComp::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_CumulantK15BulkComp <<< grid, threads >>>(para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, level, para->getForcesDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_CumulantK15BulkComp execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cu index 986e8163964bef6a62f1884f4e949f0b590ab859..d2a2f61df902cfd7c5ef52b09f8e7738a108615e 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_CumulantK15BulkComp(real omega, +__global__ void LB_Kernel_CumulantK15BulkComp(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -38,63 +39,63 @@ extern "C" __global__ void LB_Kernel_CumulantK15BulkComp(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -155,33 +156,33 @@ extern "C" __global__ void LB_Kernel_CumulantK15BulkComp(real omega, //unsigned int ktne = k; //unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -911,33 +912,33 @@ extern "C" __global__ void LB_Kernel_CumulantK15BulkComp(real omega, //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cuh index caeb68e3077393bc786a022eeb3c60e6d0a3c059..e1d60ab0a181b88fba81bdb5ff649d7971c235a7 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cuh @@ -5,7 +5,7 @@ #include <curand.h> -extern "C" __global__ void LB_Kernel_CumulantK15BulkComp(real omega, +__global__ void LB_Kernel_CumulantK15BulkComp(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp.cu index 3979503b78f9057a12401fbe9cfe0d737ec5455a..d28c077031ff9125d1cbc1187def1d1d8fe4d6e8 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp.cu @@ -10,7 +10,7 @@ std::shared_ptr<CumulantK15SpongeComp> CumulantK15SpongeComp::getNewInstance(std void CumulantK15SpongeComp::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,16 +29,16 @@ void CumulantK15SpongeComp::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_CumulantK15SpongeComp <<< grid, threads >>>( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->coordX_SP, - para->getParD(level)->coordY_SP, - para->getParD(level)->coordZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->coordinateX, + para->getParD(level)->coordinateY, + para->getParD(level)->coordinateZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_CumulantK15SpongeComp execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cu index c8be85d2ef05725b12a4b2e37bd262c430717723..c2144d324aa3378e8fc9fc5b511bbed385b48a84 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_CumulantK15SpongeComp(real omegaIn, +__global__ void LB_Kernel_CumulantK15SpongeComp(real omegaIn, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -39,63 +40,63 @@ extern "C" __global__ void LB_Kernel_CumulantK15SpongeComp(real omegaIn, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -128,33 +129,33 @@ extern "C" __global__ void LB_Kernel_CumulantK15SpongeComp(real omegaIn, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k]; - real mfabb = (D.f[dirW])[kw]; - real mfbcb = (D.f[dirN])[k]; - real mfbab = (D.f[dirS])[ks]; - real mfbbc = (D.f[dirT])[k]; - real mfbba = (D.f[dirB])[kb]; - real mfccb = (D.f[dirNE])[k]; - real mfaab = (D.f[dirSW])[ksw]; - real mfcab = (D.f[dirSE])[ks]; - real mfacb = (D.f[dirNW])[kw]; - real mfcbc = (D.f[dirTE])[k]; - real mfaba = (D.f[dirBW])[kbw]; - real mfcba = (D.f[dirBE])[kb]; - real mfabc = (D.f[dirTW])[kw]; - real mfbcc = (D.f[dirTN])[k]; - real mfbaa = (D.f[dirBS])[kbs]; - real mfbca = (D.f[dirBN])[kb]; - real mfbac = (D.f[dirTS])[ks]; - real mfbbb = (D.f[dirZERO])[k]; - real mfccc = (D.f[dirTNE])[k]; - real mfaac = (D.f[dirTSW])[ksw]; - real mfcac = (D.f[dirTSE])[ks]; - real mfacc = (D.f[dirTNW])[kw]; - real mfcca = (D.f[dirBNE])[kb]; - real mfaaa = (D.f[dirBSW])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs]; - real mfaca = (D.f[dirBNW])[kbw]; + real mfcbb = (D.f[DIR_P00])[k]; + real mfabb = (D.f[DIR_M00])[kw]; + real mfbcb = (D.f[DIR_0P0])[k]; + real mfbab = (D.f[DIR_0M0])[ks]; + real mfbbc = (D.f[DIR_00P])[k]; + real mfbba = (D.f[DIR_00M])[kb]; + real mfccb = (D.f[DIR_PP0])[k]; + real mfaab = (D.f[DIR_MM0])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks]; + real mfacb = (D.f[DIR_MP0])[kw]; + real mfcbc = (D.f[DIR_P0P])[k]; + real mfaba = (D.f[DIR_M0M])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb]; + real mfabc = (D.f[DIR_M0P])[kw]; + real mfbcc = (D.f[DIR_0PP])[k]; + real mfbaa = (D.f[DIR_0MM])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb]; + real mfbac = (D.f[DIR_0MP])[ks]; + real mfbbb = (D.f[DIR_000])[k]; + real mfccc = (D.f[DIR_PPP])[k]; + real mfaac = (D.f[DIR_MMP])[ksw]; + real mfcac = (D.f[DIR_PMP])[ks]; + real mfacc = (D.f[DIR_MPP])[kw]; + real mfcca = (D.f[DIR_PPM])[kb]; + real mfaaa = (D.f[DIR_MMM])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs]; + real mfaca = (D.f[DIR_MPM])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -892,33 +893,33 @@ extern "C" __global__ void LB_Kernel_CumulantK15SpongeComp(real omegaIn, //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb; - (D.f[dirW])[kw] = mfcbb; - (D.f[dirN])[k] = mfbab; - (D.f[dirS])[ks] = mfbcb; - (D.f[dirT])[k] = mfbba; - (D.f[dirB])[kb] = mfbbc; - (D.f[dirNE])[k] = mfaab; - (D.f[dirSW])[ksw] = mfccb; - (D.f[dirSE])[ks] = mfacb; - (D.f[dirNW])[kw] = mfcab; - (D.f[dirTE])[k] = mfaba; - (D.f[dirBW])[kbw] = mfcbc; - (D.f[dirBE])[kb] = mfabc; - (D.f[dirTW])[kw] = mfcba; - (D.f[dirTN])[k] = mfbaa; - (D.f[dirBS])[kbs] = mfbcc; - (D.f[dirBN])[kb] = mfbac; - (D.f[dirTS])[ks] = mfbca; - (D.f[dirZERO])[k] = mfbbb; - (D.f[dirTNE])[k] = mfaaa; - (D.f[dirTSE])[ks] = mfaca; - (D.f[dirBNE])[kb] = mfaac; - (D.f[dirBSE])[kbs] = mfacc; - (D.f[dirTNW])[kw] = mfcaa; - (D.f[dirTSW])[ksw] = mfcca; - (D.f[dirBNW])[kbw] = mfcac; - (D.f[dirBSW])[kbsw] = mfccc; + (D.f[DIR_P00])[k] = mfabb; + (D.f[DIR_M00])[kw] = mfcbb; + (D.f[DIR_0P0])[k] = mfbab; + (D.f[DIR_0M0])[ks] = mfbcb; + (D.f[DIR_00P])[k] = mfbba; + (D.f[DIR_00M])[kb] = mfbbc; + (D.f[DIR_PP0])[k] = mfaab; + (D.f[DIR_MM0])[ksw] = mfccb; + (D.f[DIR_PM0])[ks] = mfacb; + (D.f[DIR_MP0])[kw] = mfcab; + (D.f[DIR_P0P])[k] = mfaba; + (D.f[DIR_M0M])[kbw] = mfcbc; + (D.f[DIR_P0M])[kb] = mfabc; + (D.f[DIR_M0P])[kw] = mfcba; + (D.f[DIR_0PP])[k] = mfbaa; + (D.f[DIR_0MM])[kbs] = mfbcc; + (D.f[DIR_0PM])[kb] = mfbac; + (D.f[DIR_0MP])[ks] = mfbca; + (D.f[DIR_000])[k] = mfbbb; + (D.f[DIR_PPP])[k] = mfaaa; + (D.f[DIR_PMP])[ks] = mfaca; + (D.f[DIR_PPM])[kb] = mfaac; + (D.f[DIR_PMM])[kbs] = mfacc; + (D.f[DIR_MPP])[kw] = mfcaa; + (D.f[DIR_MMP])[ksw] = mfcca; + (D.f[DIR_MPM])[kbw] = mfcac; + (D.f[DIR_MMM])[kbsw] = mfccc; //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cuh index a55ec0ada7e0a05d05285bc29406d1a497467a54..3a526112e56947a77d5ac337052d62e95dd4e578 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_CumulantK15SpongeComp(real omega, +__global__ void LB_Kernel_CumulantK15SpongeComp(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Unified/CumulantK15Unified.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Unified/CumulantK15Unified.cu index 50f8d32f06ad25a4ab9d6f43ce5d908570d9b332..0b72b46cf25f331172be4abb8dded6d8e5e2b9c5 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Unified/CumulantK15Unified.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Unified/CumulantK15Unified.cu @@ -25,20 +25,20 @@ CumulantK15Unified::CumulantK15Unified(std::shared_ptr<Parameter> para, int leve myKernelGroup = BasicKernel; - this->cudaGrid = cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->size_Mat_SP); + this->cudaGrid = cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); } void CumulantK15Unified::run() { GPUKernelParameter kernelParameter{ para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - (int)para->getParD(level)->size_Mat_SP, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + (int)para->getParD(level)->numberOfNodes, para->getParD(level)->forcing, - para->getParD(level)->evenOrOdd }; + para->getParD(level)->isEvenTimestep }; auto lambda = [] __device__(lbm::KernelParameter parameter) { return lbm::cumulantChimera(parameter, lbm::setRelaxationRatesK15); diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp.cu index 86704c6143c2d48ee070dad58e12f49036dea43d..b176b94d07e7f280d738a797d5bd853095e3caed 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp.cu @@ -2,6 +2,7 @@ #include "Parameter/Parameter.h" #include "CumulantK17Comp_Device.cuh" +#include "cuda/CudaGrid.h" std::shared_ptr<CumulantK17Comp> CumulantK17Comp::getNewInstance(std::shared_ptr<Parameter> para, int level) { @@ -10,44 +11,23 @@ std::shared_ptr<CumulantK17Comp> CumulantK17Comp::getNewInstance(std::shared_ptr void CumulantK17Comp::run() { - int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; - - int Grid = (size_Mat / numberOfThreads) + 1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid / Grid1) + 1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 grid(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1); - - LB_Kernel_CumulantK17Comp <<< grid, threads >>>(para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, + LB_Kernel_CumulantK17Comp <<< cudaGrid.grid, cudaGrid.threads >>>(para->getParD(level)->omega, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, level, para->getForcesDev(), para->getQuadricLimitersDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_CumulantK17Comp execution failed"); } -CumulantK17Comp::CumulantK17Comp(std::shared_ptr<Parameter> para, int level) +CumulantK17Comp::CumulantK17Comp(std::shared_ptr<Parameter> para, int level): KernelImp(para, level) { - this->para = para; - this->level = level; - myPreProcessorTypes.push_back(InitCompSP27); - myKernelGroup = BasicKernel; + this->cudaGrid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp_Device.cu index 4c20e465596a747389743b6658edecc9b3887f33..7cf27aa883cbfd3a0e4a0a36fa61649a62d06eeb 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp_Device.cu @@ -1,12 +1,13 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_CumulantK17Comp(real omega, +__global__ void LB_Kernel_CumulantK17Comp(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -40,63 +41,63 @@ extern "C" __global__ void LB_Kernel_CumulantK17Comp(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -157,33 +158,33 @@ extern "C" __global__ void LB_Kernel_CumulantK17Comp(real omega, //unsigned int ktne = k; //unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -727,8 +728,8 @@ extern "C" __global__ void LB_Kernel_CumulantK17Comp(real omega, // wadjust = O4+(one-O4)*abs(CUMcbb)/(abs(CUMcbb)+qudricLimit); //CUMcbb += wadjust * (-CUMcbb); ////////////////////////////////////////////////////////////////////////// - real A = (c4o1 + c2o1*omega - c3o1*omega*omega) / (c2o1 - c7o1*omega + c5o1*omega*omega); - real B = (c4o1 + c28o1*omega - c14o1*omega*omega) / (c6o1 - c21o1*omega + c15o1*omega*omega); + real factorA = (c4o1 + c2o1*omega - c3o1*omega*omega) / (c2o1 - c7o1*omega + c5o1*omega*omega); + real factorB = (c4o1 + c28o1*omega - c14o1*omega*omega) / (c6o1 - c21o1*omega + c15o1*omega*omega); ////////////////////////////////////////////////////////////////////////// //ohne limiter //CUMacc += O4 * (-CUMacc); @@ -737,12 +738,12 @@ extern "C" __global__ void LB_Kernel_CumulantK17Comp(real omega, //CUMbbc += O4 * (-CUMbbc); //CUMbcb += O4 * (-CUMbcb); //CUMcbb += O4 * (-CUMcbb); - CUMacc = -O4*(c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMacc); - CUMcac = -O4*(c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMcac); - CUMcca = -O4*(c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * A + (c1o1 - O4) * (CUMcca); - CUMbbc = -O4*(c1o1 / omega - c1o2) * Dxy * c1o3 * B + (c1o1 - O4) * (CUMbbc); - CUMbcb = -O4*(c1o1 / omega - c1o2) * Dxz * c1o3 * B + (c1o1 - O4) * (CUMbcb); - CUMcbb = -O4*(c1o1 / omega - c1o2) * Dyz * c1o3 * B + (c1o1 - O4) * (CUMcbb); + CUMacc = -O4*(c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMacc); + CUMcac = -O4*(c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMcac); + CUMcca = -O4*(c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * factorA + (c1o1 - O4) * (CUMcca); + CUMbbc = -O4*(c1o1 / omega - c1o2) * Dxy * c1o3 * factorB + (c1o1 - O4) * (CUMbbc); + CUMbcb = -O4*(c1o1 / omega - c1o2) * Dxz * c1o3 * factorB + (c1o1 - O4) * (CUMbcb); + CUMcbb = -O4*(c1o1 / omega - c1o2) * Dyz * c1o3 * factorB + (c1o1 - O4) * (CUMcbb); ////////////////////////////////////////////////////////////////////////// @@ -1006,33 +1007,33 @@ extern "C" __global__ void LB_Kernel_CumulantK17Comp(real omega, //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp_Device.cuh index 4e6fea77b1e0364b5f56d2fd560d245f60343fe1..f44842057d554498b0b5d4c733e2425e524a3b75 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_CumulantK17Comp( real omega, +__global__ void LB_Kernel_CumulantK17Comp( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.cu index a3d52747f84fa83eac484e370c1becaa56362ecc..72d13282fc604dddcfa84682425a7a1829855ea0 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.cu @@ -18,16 +18,16 @@ void CumulantK17BulkComp::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_CumulantK17BulkComp << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, level, para->getForcesDev(), para->getQuadricLimitersDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_CumulantK17BulkComp execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cu index 0e10a2d9540fd00d231f3d27ea4bf535949b8838..cec04116ae4b411b1b3816ff4a8cab606c92491e 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_CumulantK17BulkComp(real omega, +__global__ void LB_Kernel_CumulantK17BulkComp(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -39,63 +40,63 @@ extern "C" __global__ void LB_Kernel_CumulantK17BulkComp(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -128,33 +129,33 @@ extern "C" __global__ void LB_Kernel_CumulantK17BulkComp(real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -595,9 +596,9 @@ extern "C" __global__ void LB_Kernel_CumulantK17BulkComp(real omega, //4. ////////////////////////////////////////////////////////////////////////// //mit limiter - real A = (c4o1 * omega * omega + c2o1 * omega * OxxPyyPzz * (omega - c6o1) + OxxPyyPzz * OxxPyyPzz * (omega * (c10o1 - c3o1 * omega) - c4o1)) / + real factorA = (c4o1 * omega * omega + c2o1 * omega * OxxPyyPzz * (omega - c6o1) + OxxPyyPzz * OxxPyyPzz * (omega * (c10o1 - c3o1 * omega) - c4o1)) / ((omega - OxxPyyPzz) * (OxxPyyPzz * (c2o1 + c3o1 * omega) - c8o1 * omega)); - real B = (c4o1 * omega * OxxPyyPzz * (c9o1 * omega - c16o1) - c4o1 * omega * omega - c2o1 * OxxPyyPzz * OxxPyyPzz * (c2o1 + c9o1 * omega * (omega - c2o1))) / + real factorB = (c4o1 * omega * OxxPyyPzz * (c9o1 * omega - c16o1) - c4o1 * omega * omega - c2o1 * OxxPyyPzz * OxxPyyPzz * (c2o1 + c9o1 * omega * (omega - c2o1))) / (c3o1 * (omega - OxxPyyPzz) * (OxxPyyPzz * (c2o1 + c3o1 * omega) - c8o1 * omega)); ////////////////////////////////////////////////////////////////////////// //ohne limiter @@ -615,12 +616,12 @@ extern "C" __global__ void LB_Kernel_CumulantK17BulkComp(real omega, //CUMbcb = -O4*(one/omega-c1o2)*Dxz*c1o3 *(four+twentyeight*omega-fourteen*omega*omega)/(six-twentyone*omega+fiveteen*omega*omega)+(one-O4) * (CUMbcb); //CUMcbb = -O4*(one/omega-c1o2)*Dyz*c1o3 *(four+twentyeight*omega-fourteen*omega*omega)/(six-twentyone*omega+fiveteen*omega*omega)+(one-O4) * (CUMcbb); //with bulk viscosity - CUMacc = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMacc); - CUMcac = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMcac); - CUMcca = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * A + (c1o1 - O4) * (CUMcca); - CUMbbc = -O4 * (c1o1 / omega - c1o2) * Dxy * c1o3 * B + (c1o1 - O4) * (CUMbbc); - CUMbcb = -O4 * (c1o1 / omega - c1o2) * Dxz * c1o3 * B + (c1o1 - O4) * (CUMbcb); - CUMcbb = -O4 * (c1o1 / omega - c1o2) * Dyz * c1o3 * B + (c1o1 - O4) * (CUMcbb); + CUMacc = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMacc); + CUMcac = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMcac); + CUMcca = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * factorA + (c1o1 - O4) * (CUMcca); + CUMbbc = -O4 * (c1o1 / omega - c1o2) * Dxy * c1o3 * factorB + (c1o1 - O4) * (CUMbbc); + CUMbcb = -O4 * (c1o1 / omega - c1o2) * Dxz * c1o3 * factorB + (c1o1 - O4) * (CUMbcb); + CUMcbb = -O4 * (c1o1 / omega - c1o2) * Dyz * c1o3 * factorB + (c1o1 - O4) * (CUMcbb); ////////////////////////////////////////////////////////////////////////// @@ -885,33 +886,33 @@ extern "C" __global__ void LB_Kernel_CumulantK17BulkComp(real omega, //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cuh index d7f1f263be6664a6d39c57c98ba63699da662c2b..04448787256cb1cfeef46c5d9b7146918e6a4c38 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_CumulantK17BulkComp(real omega, +__global__ void LB_Kernel_CumulantK17BulkComp(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.cu index e6ab61260b2c20ea5aec868ed70d714a066f2539..6ef6b40d3b7079579f54ca68734deb274d0c1c3a 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.cu @@ -24,7 +24,7 @@ CumulantK17Unified::CumulantK17Unified(std::shared_ptr<Parameter> para, int leve myKernelGroup = BasicKernel; - this->cudaGrid = cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->size_Mat_SP); + this->cudaGrid = cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); } @@ -32,14 +32,14 @@ CumulantK17Unified::CumulantK17Unified(std::shared_ptr<Parameter> para, int leve void CumulantK17Unified::run() { GPUKernelParameter kernelParameter{ para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - (int)para->getParD(level)->size_Mat_SP, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + (int)para->getParD(level)->numberOfNodes, para->getParD(level)->forcing, - para->getParD(level)->evenOrOdd }; + para->getParD(level)->isEvenTimestep }; auto lambda = [] __device__(lbm::KernelParameter parameter) { return lbm::cumulantChimera(parameter, lbm::setRelaxationRatesK17); diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.cu index b97b2778440b7d1ab32b3d0e9bb002a48df03134..bc058881e2a013effa417a149cf7a17bce646c6f 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.cu @@ -2,6 +2,7 @@ #include "Parameter/Parameter.h" #include "CumulantK17CompChim_Device.cuh" +#include "cuda/CudaGrid.h" std::shared_ptr<CumulantK17CompChim> CumulantK17CompChim::getNewInstance(std::shared_ptr<Parameter> para, int level) { @@ -10,32 +11,14 @@ std::shared_ptr<CumulantK17CompChim> CumulantK17CompChim::getNewInstance(std::sh void CumulantK17CompChim::run() { - int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; - - int Grid = (size_Mat / numberOfThreads) + 1; - int Grid1, Grid2; - if (Grid>512) - { - Grid1 = 512; - Grid2 = (Grid / Grid1) + 1; - } - else - { - Grid1 = 1; - Grid2 = Grid; - } - dim3 grid(Grid1, Grid2); - dim3 threads(numberOfThreads, 1, 1); - - LB_Kernel_CumulantK17CompChim <<< grid, threads >>>( + LB_Kernel_CumulantK17CompChim <<< cudaGrid.grid, cudaGrid.threads >>>( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, level, para->getIsBodyForce(), para->getForcesDev(), @@ -43,16 +26,13 @@ void CumulantK17CompChim::run() para->getParD(level)->forceY_SP, para->getParD(level)->forceZ_SP, para->getQuadricLimitersDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_CumulantK17CompChim execution failed"); } -CumulantK17CompChim::CumulantK17CompChim(std::shared_ptr<Parameter> para, int level) +CumulantK17CompChim::CumulantK17CompChim(std::shared_ptr<Parameter> para, int level): KernelImp(para, level) { - this->para = para; - this->level = level; - myPreProcessorTypes.push_back(InitCompSP27); - myKernelGroup = BasicKernel; + this->cudaGrid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cu index 2b26cd2b608fb2237002d9471f518a89d78ca32b..3eea267e55fee45111fb11cf1258559e2c3c63f2 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cu @@ -32,14 +32,15 @@ //======================================================================================= /* Device code */ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; -#include "Kernel/ChimeraTransformation.h" +using namespace vf::lbm::dir; +#include "Kernel/Utilities/ChimeraTransformation.h" //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Kernel_CumulantK17CompChim( +__global__ void LB_Kernel_CumulantK17CompChim( real omega, uint* typeOfGridNode, uint* neighborX, @@ -65,7 +66,7 @@ extern "C" __global__ void LB_Kernel_CumulantK17CompChim( //! The cumulant kernel is executed in the following steps //! //////////////////////////////////////////////////////////////////////////////// - //! - Get node index coordinates from thredIdx, blockIdx, blockDim and gridDim. + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. //! const unsigned x = threadIdx.x; const unsigned y = blockIdx.x; @@ -87,61 +88,61 @@ extern "C" __global__ void LB_Kernel_CumulantK17CompChim( //! Distributions27 dist; if (isEvenTimestep) { - dist.f[dirE] = &distributions[dirE * size_Mat]; - dist.f[dirW] = &distributions[dirW * size_Mat]; - dist.f[dirN] = &distributions[dirN * size_Mat]; - dist.f[dirS] = &distributions[dirS * size_Mat]; - dist.f[dirT] = &distributions[dirT * size_Mat]; - dist.f[dirB] = &distributions[dirB * size_Mat]; - dist.f[dirNE] = &distributions[dirNE * size_Mat]; - dist.f[dirSW] = &distributions[dirSW * size_Mat]; - dist.f[dirSE] = &distributions[dirSE * size_Mat]; - dist.f[dirNW] = &distributions[dirNW * size_Mat]; - dist.f[dirTE] = &distributions[dirTE * size_Mat]; - dist.f[dirBW] = &distributions[dirBW * size_Mat]; - dist.f[dirBE] = &distributions[dirBE * size_Mat]; - dist.f[dirTW] = &distributions[dirTW * size_Mat]; - dist.f[dirTN] = &distributions[dirTN * size_Mat]; - dist.f[dirBS] = &distributions[dirBS * size_Mat]; - dist.f[dirBN] = &distributions[dirBN * size_Mat]; - dist.f[dirTS] = &distributions[dirTS * size_Mat]; - dist.f[dirZERO] = &distributions[dirZERO * size_Mat]; - dist.f[dirTNE] = &distributions[dirTNE * size_Mat]; - dist.f[dirTSW] = &distributions[dirTSW * size_Mat]; - dist.f[dirTSE] = &distributions[dirTSE * size_Mat]; - dist.f[dirTNW] = &distributions[dirTNW * size_Mat]; - dist.f[dirBNE] = &distributions[dirBNE * size_Mat]; - dist.f[dirBSW] = &distributions[dirBSW * size_Mat]; - dist.f[dirBSE] = &distributions[dirBSE * size_Mat]; - dist.f[dirBNW] = &distributions[dirBNW * size_Mat]; + dist.f[DIR_P00] = &distributions[DIR_P00 * size_Mat]; + dist.f[DIR_M00] = &distributions[DIR_M00 * size_Mat]; + dist.f[DIR_0P0] = &distributions[DIR_0P0 * size_Mat]; + dist.f[DIR_0M0] = &distributions[DIR_0M0 * size_Mat]; + dist.f[DIR_00P] = &distributions[DIR_00P * size_Mat]; + dist.f[DIR_00M] = &distributions[DIR_00M * size_Mat]; + dist.f[DIR_PP0] = &distributions[DIR_PP0 * size_Mat]; + dist.f[DIR_MM0] = &distributions[DIR_MM0 * size_Mat]; + dist.f[DIR_PM0] = &distributions[DIR_PM0 * size_Mat]; + dist.f[DIR_MP0] = &distributions[DIR_MP0 * size_Mat]; + dist.f[DIR_P0P] = &distributions[DIR_P0P * size_Mat]; + dist.f[DIR_M0M] = &distributions[DIR_M0M * size_Mat]; + dist.f[DIR_P0M] = &distributions[DIR_P0M * size_Mat]; + dist.f[DIR_M0P] = &distributions[DIR_M0P * size_Mat]; + dist.f[DIR_0PP] = &distributions[DIR_0PP * size_Mat]; + dist.f[DIR_0MM] = &distributions[DIR_0MM * size_Mat]; + dist.f[DIR_0PM] = &distributions[DIR_0PM * size_Mat]; + dist.f[DIR_0MP] = &distributions[DIR_0MP * size_Mat]; + dist.f[DIR_000] = &distributions[DIR_000 * size_Mat]; + dist.f[DIR_PPP] = &distributions[DIR_PPP * size_Mat]; + dist.f[DIR_MMP] = &distributions[DIR_MMP * size_Mat]; + dist.f[DIR_PMP] = &distributions[DIR_PMP * size_Mat]; + dist.f[DIR_MPP] = &distributions[DIR_MPP * size_Mat]; + dist.f[DIR_PPM] = &distributions[DIR_PPM * size_Mat]; + dist.f[DIR_MMM] = &distributions[DIR_MMM * size_Mat]; + dist.f[DIR_PMM] = &distributions[DIR_PMM * size_Mat]; + dist.f[DIR_MPM] = &distributions[DIR_MPM * size_Mat]; } else { - dist.f[dirW] = &distributions[dirE * size_Mat]; - dist.f[dirE] = &distributions[dirW * size_Mat]; - dist.f[dirS] = &distributions[dirN * size_Mat]; - dist.f[dirN] = &distributions[dirS * size_Mat]; - dist.f[dirB] = &distributions[dirT * size_Mat]; - dist.f[dirT] = &distributions[dirB * size_Mat]; - dist.f[dirSW] = &distributions[dirNE * size_Mat]; - dist.f[dirNE] = &distributions[dirSW * size_Mat]; - dist.f[dirNW] = &distributions[dirSE * size_Mat]; - dist.f[dirSE] = &distributions[dirNW * size_Mat]; - dist.f[dirBW] = &distributions[dirTE * size_Mat]; - dist.f[dirTE] = &distributions[dirBW * size_Mat]; - dist.f[dirTW] = &distributions[dirBE * size_Mat]; - dist.f[dirBE] = &distributions[dirTW * size_Mat]; - dist.f[dirBS] = &distributions[dirTN * size_Mat]; - dist.f[dirTN] = &distributions[dirBS * size_Mat]; - dist.f[dirTS] = &distributions[dirBN * size_Mat]; - dist.f[dirBN] = &distributions[dirTS * size_Mat]; - dist.f[dirZERO] = &distributions[dirZERO * size_Mat]; - dist.f[dirBSW] = &distributions[dirTNE * size_Mat]; - dist.f[dirBNE] = &distributions[dirTSW * size_Mat]; - dist.f[dirBNW] = &distributions[dirTSE * size_Mat]; - dist.f[dirBSE] = &distributions[dirTNW * size_Mat]; - dist.f[dirTSW] = &distributions[dirBNE * size_Mat]; - dist.f[dirTNE] = &distributions[dirBSW * size_Mat]; - dist.f[dirTNW] = &distributions[dirBSE * size_Mat]; - dist.f[dirTSE] = &distributions[dirBNW * size_Mat]; + dist.f[DIR_M00] = &distributions[DIR_P00 * size_Mat]; + dist.f[DIR_P00] = &distributions[DIR_M00 * size_Mat]; + dist.f[DIR_0M0] = &distributions[DIR_0P0 * size_Mat]; + dist.f[DIR_0P0] = &distributions[DIR_0M0 * size_Mat]; + dist.f[DIR_00M] = &distributions[DIR_00P * size_Mat]; + dist.f[DIR_00P] = &distributions[DIR_00M * size_Mat]; + dist.f[DIR_MM0] = &distributions[DIR_PP0 * size_Mat]; + dist.f[DIR_PP0] = &distributions[DIR_MM0 * size_Mat]; + dist.f[DIR_MP0] = &distributions[DIR_PM0 * size_Mat]; + dist.f[DIR_PM0] = &distributions[DIR_MP0 * size_Mat]; + dist.f[DIR_M0M] = &distributions[DIR_P0P * size_Mat]; + dist.f[DIR_P0P] = &distributions[DIR_M0M * size_Mat]; + dist.f[DIR_M0P] = &distributions[DIR_P0M * size_Mat]; + dist.f[DIR_P0M] = &distributions[DIR_M0P * size_Mat]; + dist.f[DIR_0MM] = &distributions[DIR_0PP * size_Mat]; + dist.f[DIR_0PP] = &distributions[DIR_0MM * size_Mat]; + dist.f[DIR_0MP] = &distributions[DIR_0PM * size_Mat]; + dist.f[DIR_0PM] = &distributions[DIR_0MP * size_Mat]; + dist.f[DIR_000] = &distributions[DIR_000 * size_Mat]; + dist.f[DIR_MMM] = &distributions[DIR_PPP * size_Mat]; + dist.f[DIR_PPM] = &distributions[DIR_MMP * size_Mat]; + dist.f[DIR_MPM] = &distributions[DIR_PMP * size_Mat]; + dist.f[DIR_PMM] = &distributions[DIR_MPP * size_Mat]; + dist.f[DIR_MMP] = &distributions[DIR_PPM * size_Mat]; + dist.f[DIR_PPP] = &distributions[DIR_MMM * size_Mat]; + dist.f[DIR_MPP] = &distributions[DIR_PMM * size_Mat]; + dist.f[DIR_PMP] = &distributions[DIR_MPM * size_Mat]; } //////////////////////////////////////////////////////////////////////////////// //! - Set neighbor indices (necessary for indirect addressing) @@ -155,33 +156,33 @@ extern "C" __global__ void LB_Kernel_CumulantK17CompChim( //////////////////////////////////////////////////////////////////////////////////// //! - Set local distributions //! - real mfcbb = (dist.f[dirE])[k]; - real mfabb = (dist.f[dirW])[kw]; - real mfbcb = (dist.f[dirN])[k]; - real mfbab = (dist.f[dirS])[ks]; - real mfbbc = (dist.f[dirT])[k]; - real mfbba = (dist.f[dirB])[kb]; - real mfccb = (dist.f[dirNE])[k]; - real mfaab = (dist.f[dirSW])[ksw]; - real mfcab = (dist.f[dirSE])[ks]; - real mfacb = (dist.f[dirNW])[kw]; - real mfcbc = (dist.f[dirTE])[k]; - real mfaba = (dist.f[dirBW])[kbw]; - real mfcba = (dist.f[dirBE])[kb]; - real mfabc = (dist.f[dirTW])[kw]; - real mfbcc = (dist.f[dirTN])[k]; - real mfbaa = (dist.f[dirBS])[kbs]; - real mfbca = (dist.f[dirBN])[kb]; - real mfbac = (dist.f[dirTS])[ks]; - real mfbbb = (dist.f[dirZERO])[k]; - real mfccc = (dist.f[dirTNE])[k]; - real mfaac = (dist.f[dirTSW])[ksw]; - real mfcac = (dist.f[dirTSE])[ks]; - real mfacc = (dist.f[dirTNW])[kw]; - real mfcca = (dist.f[dirBNE])[kb]; - real mfaaa = (dist.f[dirBSW])[kbsw]; - real mfcaa = (dist.f[dirBSE])[kbs]; - real mfaca = (dist.f[dirBNW])[kbw]; + real mfcbb = (dist.f[DIR_P00])[k]; + real mfabb = (dist.f[DIR_M00])[kw]; + real mfbcb = (dist.f[DIR_0P0])[k]; + real mfbab = (dist.f[DIR_0M0])[ks]; + real mfbbc = (dist.f[DIR_00P])[k]; + real mfbba = (dist.f[DIR_00M])[kb]; + real mfccb = (dist.f[DIR_PP0])[k]; + real mfaab = (dist.f[DIR_MM0])[ksw]; + real mfcab = (dist.f[DIR_PM0])[ks]; + real mfacb = (dist.f[DIR_MP0])[kw]; + real mfcbc = (dist.f[DIR_P0P])[k]; + real mfaba = (dist.f[DIR_M0M])[kbw]; + real mfcba = (dist.f[DIR_P0M])[kb]; + real mfabc = (dist.f[DIR_M0P])[kw]; + real mfbcc = (dist.f[DIR_0PP])[k]; + real mfbaa = (dist.f[DIR_0MM])[kbs]; + real mfbca = (dist.f[DIR_0PM])[kb]; + real mfbac = (dist.f[DIR_0MP])[ks]; + real mfbbb = (dist.f[DIR_000])[k]; + real mfccc = (dist.f[DIR_PPP])[k]; + real mfaac = (dist.f[DIR_MMP])[ksw]; + real mfcac = (dist.f[DIR_PMP])[ks]; + real mfacc = (dist.f[DIR_MPP])[kw]; + real mfcca = (dist.f[DIR_PPM])[kb]; + real mfaaa = (dist.f[DIR_MMM])[kbsw]; + real mfcaa = (dist.f[DIR_PMM])[kbs]; + real mfaca = (dist.f[DIR_MPM])[kbw]; //////////////////////////////////////////////////////////////////////////////////// //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), @@ -329,13 +330,13 @@ extern "C" __global__ void LB_Kernel_CumulantK17CompChim( real O6 = c1o1; //////////////////////////////////////////////////////////////////////////////////// - //! - A and B: parameters for fourth order convergence of the diffusion term according to Eq. (114) and (115) + //! - A and DIR_00M: parameters for fourth order convergence of the diffusion term according to Eq. (115) and (116) //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> with simplifications assuming \f$ \omega_2 = 1.0 \f$ (modify for //! different bulk viscosity). //! - real A = (c4o1 + c2o1 * omega - c3o1 * omega * omega) / (c2o1 - c7o1 * omega + c5o1 * omega * omega); - real B = (c4o1 + c28o1 * omega - c14o1 * omega * omega) / (c6o1 - c21o1 * omega + c15o1 * omega * omega); + real factorA = (c4o1 + c2o1 * omega - c3o1 * omega * omega) / (c2o1 - c7o1 * omega + c5o1 * omega * omega); + real factorB = (c4o1 + c28o1 * omega - c14o1 * omega * omega) / (c6o1 - c21o1 * omega + c15o1 * omega * omega); //////////////////////////////////////////////////////////////////////////////////// //! - Compute cumulants from central moments according to Eq. (20)-(23) in @@ -492,12 +493,12 @@ extern "C" __global__ void LB_Kernel_CumulantK17CompChim( //! to Eq. (43)-(48) <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> //! - CUMacc = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMacc); - CUMcac = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMcac); - CUMcca = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * A + (c1o1 - O4) * (CUMcca); - CUMbbc = -O4 * (c1o1 / omega - c1o2) * Dxy * c1o3 * B + (c1o1 - O4) * (CUMbbc); - CUMbcb = -O4 * (c1o1 / omega - c1o2) * Dxz * c1o3 * B + (c1o1 - O4) * (CUMbcb); - CUMcbb = -O4 * (c1o1 / omega - c1o2) * Dyz * c1o3 * B + (c1o1 - O4) * (CUMcbb); + CUMacc = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMacc); + CUMcac = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMcac); + CUMcca = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * factorA + (c1o1 - O4) * (CUMcca); + CUMbbc = -O4 * (c1o1 / omega - c1o2) * Dxy * c1o3 * factorB + (c1o1 - O4) * (CUMbbc); + CUMbcb = -O4 * (c1o1 / omega - c1o2) * Dxz * c1o3 * factorB + (c1o1 - O4) * (CUMbcb); + CUMcbb = -O4 * (c1o1 / omega - c1o2) * Dyz * c1o3 * factorB + (c1o1 - O4) * (CUMcbb); ////////////////////////////////////////////////////////////////////////// // 5. @@ -622,32 +623,32 @@ extern "C" __global__ void LB_Kernel_CumulantK17CompChim( //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), //! DOI:10.3390/computation5020019 ]</b></a> //! - (dist.f[dirE])[k] = mfabb; - (dist.f[dirW])[kw] = mfcbb; - (dist.f[dirN])[k] = mfbab; - (dist.f[dirS])[ks] = mfbcb; - (dist.f[dirT])[k] = mfbba; - (dist.f[dirB])[kb] = mfbbc; - (dist.f[dirNE])[k] = mfaab; - (dist.f[dirSW])[ksw] = mfccb; - (dist.f[dirSE])[ks] = mfacb; - (dist.f[dirNW])[kw] = mfcab; - (dist.f[dirTE])[k] = mfaba; - (dist.f[dirBW])[kbw] = mfcbc; - (dist.f[dirBE])[kb] = mfabc; - (dist.f[dirTW])[kw] = mfcba; - (dist.f[dirTN])[k] = mfbaa; - (dist.f[dirBS])[kbs] = mfbcc; - (dist.f[dirBN])[kb] = mfbac; - (dist.f[dirTS])[ks] = mfbca; - (dist.f[dirZERO])[k] = mfbbb; - (dist.f[dirTNE])[k] = mfaaa; - (dist.f[dirTSE])[ks] = mfaca; - (dist.f[dirBNE])[kb] = mfaac; - (dist.f[dirBSE])[kbs] = mfacc; - (dist.f[dirTNW])[kw] = mfcaa; - (dist.f[dirTSW])[ksw] = mfcca; - (dist.f[dirBNW])[kbw] = mfcac; - (dist.f[dirBSW])[kbsw] = mfccc; + (dist.f[DIR_P00])[k] = mfabb; + (dist.f[DIR_M00])[kw] = mfcbb; + (dist.f[DIR_0P0])[k] = mfbab; + (dist.f[DIR_0M0])[ks] = mfbcb; + (dist.f[DIR_00P])[k] = mfbba; + (dist.f[DIR_00M])[kb] = mfbbc; + (dist.f[DIR_PP0])[k] = mfaab; + (dist.f[DIR_MM0])[ksw] = mfccb; + (dist.f[DIR_PM0])[ks] = mfacb; + (dist.f[DIR_MP0])[kw] = mfcab; + (dist.f[DIR_P0P])[k] = mfaba; + (dist.f[DIR_M0M])[kbw] = mfcbc; + (dist.f[DIR_P0M])[kb] = mfabc; + (dist.f[DIR_M0P])[kw] = mfcba; + (dist.f[DIR_0PP])[k] = mfbaa; + (dist.f[DIR_0MM])[kbs] = mfbcc; + (dist.f[DIR_0PM])[kb] = mfbac; + (dist.f[DIR_0MP])[ks] = mfbca; + (dist.f[DIR_000])[k] = mfbbb; + (dist.f[DIR_PPP])[k] = mfaaa; + (dist.f[DIR_PMP])[ks] = mfaca; + (dist.f[DIR_PPM])[kb] = mfaac; + (dist.f[DIR_PMM])[kbs] = mfacc; + (dist.f[DIR_MPP])[kw] = mfcaa; + (dist.f[DIR_MMP])[ksw] = mfcca; + (dist.f[DIR_MPM])[kbw] = mfcac; + (dist.f[DIR_MMM])[kbsw] = mfccc; } } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cuh index 1d42d65f020dd7393321498666a298630883f6ad..a480278652ca3bae0122d33b2655e2210d203727 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_CumulantK17CompChim( +__global__ void LB_Kernel_CumulantK17CompChim( real omega, uint* typeOfGridNode, uint* neighborX, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesigned.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesigned.cu new file mode 100644 index 0000000000000000000000000000000000000000..8c06b7117c8b1ef62b932a76bf5de0be2ae99b1c --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesigned.cu @@ -0,0 +1,61 @@ +#include "CumulantK17CompChimRedesigned.h" + +#include "Parameter/Parameter.h" +#include "Parameter/CudaStreamManager.h" +#include "CumulantK17CompChimRedesigned_Device.cuh" + +#include <cuda.h> + +std::shared_ptr<CumulantK17CompChimRedesigned> CumulantK17CompChimRedesigned::getNewInstance(std::shared_ptr<Parameter> para, + int level) +{ + return std::shared_ptr<CumulantK17CompChimRedesigned>(new CumulantK17CompChimRedesigned(para, level)); +} + +void CumulantK17CompChimRedesigned::run() +{ + LB_Kernel_CumulantK17CompChimRedesigned <<< cudaGrid.grid, cudaGrid.threads >>>( + para->getParD(level)->omega, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + level, + para->getForcesDev(), + para->getQuadricLimitersDev(), + para->getParD(level)->isEvenTimestep, + para->getParD(level)->fluidNodeIndices, + para->getParD(level)->numberOfFluidNodes); + getLastCudaError("LB_Kernel_CumulantK17CompChim execution failed"); +} + +void CumulantK17CompChimRedesigned::runOnIndices(const unsigned int *indices, unsigned int size_indices, int streamIndex) +{ + cudaStream_t stream = (streamIndex == -1) ? CU_STREAM_LEGACY : para->getStreamManager()->getStream(streamIndex); + + LB_Kernel_CumulantK17CompChimRedesigned<<< cudaGrid.grid, cudaGrid.threads, 0, stream>>>( + para->getParD(level)->omega, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + level, + para->getForcesDev(), + para->getQuadricLimitersDev(), + para->getParD(level)->isEvenTimestep, + indices, + size_indices); + getLastCudaError("LB_Kernel_CumulantK17CompChim execution failed"); + +} + +CumulantK17CompChimRedesigned::CumulantK17CompChimRedesigned(std::shared_ptr<Parameter> para, int level): KernelImp(para, level) +{ + myPreProcessorTypes.push_back(InitCompSP27); + myKernelGroup = BasicKernel; + this->cudaGrid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); + this->kernelUsesFluidNodeIndices = true; +} + diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesigned.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesigned.h new file mode 100644 index 0000000000000000000000000000000000000000..4658075de330665fdba88a5ec8149a9b476d5ac7 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesigned.h @@ -0,0 +1,18 @@ +#ifndef CUMULANT_K17_COMP_CHIM_REDESIGN_H +#define CUMULANT_K17_COMP_CHIM_REDESIGN_H + +#include "Kernel/KernelImp.h" + +class CumulantK17CompChimRedesigned : public KernelImp +{ +public: + static std::shared_ptr<CumulantK17CompChimRedesigned> getNewInstance(std::shared_ptr<Parameter> para, int level); + void run() override; + void runOnIndices(const unsigned int *indices, unsigned int size_indices, int stream = -1) override; + +private: + CumulantK17CompChimRedesigned(); + CumulantK17CompChimRedesigned(std::shared_ptr<Parameter> para, int level); +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesignedDevice.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesignedDevice.cu new file mode 100644 index 0000000000000000000000000000000000000000..db8caf1b23c2087a4c5c76886fb4530bc6272a1d --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesignedDevice.cu @@ -0,0 +1,603 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file Cumulant27chimStream.cu +//! \ingroup GPU +//! \author Martin Schoenherr, Anna Wellmann +//======================================================================================= +/* Device code */ +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" +#include <lbm/constants/NumericConstants.h> +#include "Kernel/Utilities/DistributionHelper.cuh" + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; +#include "Kernel/Utilities/ChimeraTransformation.h" + +//////////////////////////////////////////////////////////////////////////////// +__global__ void LB_Kernel_CumulantK17CompChimRedesigned( + real omega, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + real* distributions, + unsigned long numberOfLBnodes, + int level, + real* forces, + real* quadricLimiters, + bool isEvenTimestep, + const uint *fluidNodeIndices, + uint numberOfFluidNodes) +{ + ////////////////////////////////////////////////////////////////////////// + //! Cumulant K17 Kernel is based on \ref + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> and \ref <a href="https://doi.org/10.1016/j.jcp.2017.07.004"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.07.004 ]</b></a> + //! + //! The cumulant kernel is executed in the following steps + //! + //////////////////////////////////////////////////////////////////////////////// + //! - Get the thread index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned kThread = vf::gpu::getNodeIndex(); + + ////////////////////////////////////////////////////////////////////////// + //! - Return for non-fluid nodes + if (kThread >= numberOfFluidNodes) + return; + + //////////////////////////////////////////////////////////////////////////////// + //! - Get the node index from the array containing all indices of fluid nodes + //! + const unsigned k_000 = fluidNodeIndices[kThread]; + + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on + //! timestep is based on the esoteric twist algorithm \ref <a + //! href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), + //! DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist = vf::gpu::getDistributionReferences27(distributions, numberOfLBnodes, isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - Set neighbor indices (necessary for indirect addressing) + //! + uint k_M00 = neighborX[k_000]; + uint k_0M0 = neighborY[k_000]; + uint k_00M = neighborZ[k_000]; + uint k_MM0 = neighborY[k_M00]; + uint k_M0M = neighborZ[k_M00]; + uint k_0MM = neighborZ[k_0M0]; + uint k_MMM = neighborZ[k_MM0]; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions (f's): + //! + real f_000 = (dist.f[DIR_000])[k_000]; + real f_P00 = (dist.f[DIR_P00])[k_000]; + real f_M00 = (dist.f[DIR_M00])[k_M00]; + real f_0P0 = (dist.f[DIR_0P0])[k_000]; + real f_0M0 = (dist.f[DIR_0M0])[k_0M0]; + real f_00P = (dist.f[DIR_00P])[k_000]; + real f_00M = (dist.f[DIR_00M])[k_00M]; + real f_PP0 = (dist.f[DIR_PP0])[k_000]; + real f_MM0 = (dist.f[DIR_MM0])[k_MM0]; + real f_PM0 = (dist.f[DIR_PM0])[k_0M0]; + real f_MP0 = (dist.f[DIR_MP0])[k_M00]; + real f_P0P = (dist.f[DIR_P0P])[k_000]; + real f_M0M = (dist.f[DIR_M0M])[k_M0M]; + real f_P0M = (dist.f[DIR_P0M])[k_00M]; + real f_M0P = (dist.f[DIR_M0P])[k_M00]; + real f_0PP = (dist.f[DIR_0PP])[k_000]; + real f_0MM = (dist.f[DIR_0MM])[k_0MM]; + real f_0PM = (dist.f[DIR_0PM])[k_00M]; + real f_0MP = (dist.f[DIR_0MP])[k_0M0]; + real f_PPP = (dist.f[DIR_PPP])[k_000]; + real f_MPP = (dist.f[DIR_MPP])[k_M00]; + real f_PMP = (dist.f[DIR_PMP])[k_0M0]; + real f_MMP = (dist.f[DIR_MMP])[k_MM0]; + real f_PPM = (dist.f[DIR_PPM])[k_00M]; + real f_MPM = (dist.f[DIR_MPM])[k_M0M]; + real f_PMM = (dist.f[DIR_PMM])[k_0MM]; + real f_MMM = (dist.f[DIR_MMM])[k_MMM]; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Define aliases to use the same variable for the moments (m's): + //! + real& m_111 = f_000; + real& m_211 = f_P00; + real& m_011 = f_M00; + real& m_121 = f_0P0; + real& m_101 = f_0M0; + real& m_112 = f_00P; + real& m_110 = f_00M; + real& m_221 = f_PP0; + real& m_001 = f_MM0; + real& m_201 = f_PM0; + real& m_021 = f_MP0; + real& m_212 = f_P0P; + real& m_010 = f_M0M; + real& m_210 = f_P0M; + real& m_012 = f_M0P; + real& m_122 = f_0PP; + real& m_100 = f_0MM; + real& m_120 = f_0PM; + real& m_102 = f_0MP; + real& m_222 = f_PPP; + real& m_022 = f_MPP; + real& m_202 = f_PMP; + real& m_002 = f_MMP; + real& m_220 = f_PPM; + real& m_020 = f_MPM; + real& m_200 = f_PMM; + real& m_000 = f_MMM; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + real drho = ((((f_PPP + f_MMM) + (f_MPM + f_PMP)) + ((f_MPP + f_PMM) + (f_MMP + f_PPM))) + + (((f_0MP + f_0PM) + (f_0MM + f_0PP)) + ((f_M0P + f_P0M) + (f_M0M + f_P0P)) + + ((f_MP0 + f_PM0) + (f_MM0 + f_PP0))) + + ((f_M00 + f_P00) + (f_0M0 + f_0P0) + (f_00M + f_00P))) + + f_000; + + real oneOverRho = c1o1 / (c1o1 + drho); + + real vvx = ((((f_PPP - f_MMM) + (f_PMP - f_MPM)) + ((f_PMM - f_MPP) + (f_PPM - f_MMP))) + + (((f_P0M - f_M0P) + (f_P0P - f_M0M)) + ((f_PM0 - f_MP0) + (f_PP0 - f_MM0))) + (f_P00 - f_M00)) * + oneOverRho; + real vvy = ((((f_PPP - f_MMM) + (f_MPM - f_PMP)) + ((f_MPP - f_PMM) + (f_PPM - f_MMP))) + + (((f_0PM - f_0MP) + (f_0PP - f_0MM)) + ((f_MP0 - f_PM0) + (f_PP0 - f_MM0))) + (f_0P0 - f_0M0)) * + oneOverRho; + real vvz = ((((f_PPP - f_MMM) + (f_PMP - f_MPM)) + ((f_MPP - f_PMM) + (f_MMP - f_PPM))) + + (((f_0MP - f_0PM) + (f_0PP - f_0MM)) + ((f_M0P - f_P0M) + (f_P0P - f_M0M))) + (f_00P - f_00M)) * + oneOverRho; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + real factor = c1o1; + // The factor has to be scaled for each level to get the correct acceleration. + for (size_t i = 1; i <= level; i++) { + factor *= c2o1; + } + real fx = forces[0] / factor; + real fy = forces[1] / factor; + real fz = forces[2] / factor; + vvx += fx * c1o2; + vvy += fy * c1o2; + vvz += fz * c1o2; + //////////////////////////////////////////////////////////////////////////////////// + // calculate the square of velocities for this lattice node + real vx2 = vvx * vvx; + real vy2 = vvy * vvy; + real vz2 = vvz * vvz; + //////////////////////////////////////////////////////////////////////////////////// + //! - Set relaxation limiters for third order cumulants to default value \f$ \lambda=0.001 \f$ according to + //! section 6 in \ref <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + real quadricLimitP = quadricLimiters[0]; + real quadricLimitM = quadricLimiters[1]; + real quadricLimitD = quadricLimiters[2]; + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (6)-(14) in \ref <a + //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + forwardInverseChimeraWithK(f_MMM, f_MM0, f_MMP, vvz, vz2, c36o1, c1o36); + forwardInverseChimeraWithK(f_M0M, f_M00, f_M0P, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(f_MPM, f_MP0, f_MPP, vvz, vz2, c36o1, c1o36); + forwardInverseChimeraWithK(f_0MM, f_0M0, f_0MP, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(f_00M, f_000, f_00P, vvz, vz2, c9o4, c4o9); + forwardInverseChimeraWithK(f_0PM, f_0P0, f_0PP, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(f_PMM, f_PM0, f_PMP, vvz, vz2, c36o1, c1o36); + forwardInverseChimeraWithK(f_P0M, f_P00, f_P0P, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(f_PPM, f_PP0, f_PPP, vvz, vz2, c36o1, c1o36); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + forwardInverseChimeraWithK(f_MMM, f_M0M, f_MPM, vvy, vy2, c6o1, c1o6); + forwardChimera( f_MM0, f_M00, f_MP0, vvy, vy2); + forwardInverseChimeraWithK(f_MMP, f_M0P, f_MPP, vvy, vy2, c18o1, c1o18); + forwardInverseChimeraWithK(f_0MM, f_00M, f_0PM, vvy, vy2, c3o2, c2o3); + forwardChimera( f_0M0, f_000, f_0P0, vvy, vy2); + forwardInverseChimeraWithK(f_0MP, f_00P, f_0PP, vvy, vy2, c9o2, c2o9); + forwardInverseChimeraWithK(f_PMM, f_P0M, f_PPM, vvy, vy2, c6o1, c1o6); + forwardChimera( f_PM0, f_P00, f_PP0, vvy, vy2); + forwardInverseChimeraWithK(f_PMP, f_P0P, f_PPP, vvy, vy2, c18o1, c1o18); + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + forwardInverseChimeraWithK(f_MMM, f_0MM, f_PMM, vvx, vx2, c1o1, c1o1); + forwardChimera( f_M0M, f_00M, f_P0M, vvx, vx2); + forwardInverseChimeraWithK(f_MPM, f_0PM, f_PPM, vvx, vx2, c3o1, c1o3); + forwardChimera( f_MM0, f_0M0, f_PM0, vvx, vx2); + forwardChimera( f_M00, f_000, f_P00, vvx, vx2); + forwardChimera( f_MP0, f_0P0, f_PP0, vvx, vx2); + forwardInverseChimeraWithK(f_MMP, f_0MP, f_PMP, vvx, vx2, c3o1, c1o3); + forwardChimera( f_M0P, f_00P, f_P0P, vvx, vx2); + forwardInverseChimeraWithK(f_MPP, f_0PP, f_PPP, vvx, vx2, c3o1, c1o9); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Setting relaxation rates for non-hydrodynamic cumulants (default values). Variable names and equations + //! according to <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! => [NAME IN PAPER]=[NAME IN CODE]=[DEFAULT VALUE]. + //! - Trace of second order cumulants \f$ C_{200}+C_{020}+C_{002} \f$ used to adjust bulk + //! viscosity:\f$\omega_2=OxxPyyPzz=1.0 \f$. + //! - Third order cumulants \f$ C_{120}+C_{102}, C_{210}+C_{012}, C_{201}+C_{021} \f$: \f$ \omega_3=OxyyPxzz + //! \f$ set according to Eq. (111) with simplifications assuming \f$ \omega_2=1.0\f$. + //! - Third order cumulants \f$ C_{120}-C_{102}, C_{210}-C_{012}, C_{201}-C_{021} \f$: \f$ \omega_4 = OxyyMxzz + //! \f$ set according to Eq. (112) with simplifications assuming \f$ \omega_2 = 1.0\f$. + //! - Third order cumulants \f$ C_{111} \f$: \f$ \omega_5 = Oxyz \f$ set according to Eq. (113) with + //! simplifications assuming \f$ \omega_2 = 1.0\f$ (modify for different bulk viscosity). + //! - Fourth order cumulants \f$ C_{220}, C_{202}, C_{022}, C_{211}, C_{121}, C_{112} \f$: for simplification + //! all set to the same default value \f$ \omega_6=\omega_7=\omega_8=O4=1.0 \f$. + //! - Fifth order cumulants \f$ C_{221}, C_{212}, C_{122}\f$: \f$\omega_9=O5=1.0\f$. + //! - Sixth order cumulant \f$ C_{222}\f$: \f$\omega_{10}=O6=1.0\f$. + //! + //////////////////////////////////////////////////////////// + // 2. + real OxxPyyPzz = c1o1; + //////////////////////////////////////////////////////////// + // 3. + real OxyyPxzz = c8o1 * (-c2o1 + omega) * (c1o1 + c2o1 * omega) / (-c8o1 - c14o1 * omega + c7o1 * omega * omega); + real OxyyMxzz = c8o1 * (-c2o1 + omega) * (-c7o1 + c4o1 * omega) / (c56o1 - c50o1 * omega + c9o1 * omega * omega); + real Oxyz = c24o1 * (-c2o1 + omega) * (-c2o1 - c7o1 * omega + c3o1 * omega * omega) / + (c48o1 + c152o1 * omega - c130o1 * omega * omega + c29o1 * omega * omega * omega); + //////////////////////////////////////////////////////////// + // 4. + real O4 = c1o1; + //////////////////////////////////////////////////////////// + // 5. + real O5 = c1o1; + //////////////////////////////////////////////////////////// + // 6. + real O6 = c1o1; + + //////////////////////////////////////////////////////////////////////////////////// + //! - A and B: parameters for fourth order convergence of the diffusion term according to Eq. (115) and (116) + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> with simplifications assuming \f$ \omega_2 = 1.0 \f$ (modify for + //! different bulk viscosity). + //! + real factorA = (c4o1 + c2o1 * omega - c3o1 * omega * omega) / (c2o1 - c7o1 * omega + c5o1 * omega * omega); + real factorB = (c4o1 + c28o1 * omega - c14o1 * omega * omega) / (c6o1 - c21o1 * omega + c15o1 * omega * omega); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute cumulants (c's) from central moments according to Eq. (20)-(23) in + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + //////////////////////////////////////////////////////////// + // 4. + real c_211 = m_211 - ((m_200 + c1o3) * m_011 + c2o1 * m_110 * m_101) * oneOverRho; + real c_121 = m_121 - ((m_020 + c1o3) * m_101 + c2o1 * m_110 * m_011) * oneOverRho; + real c_112 = m_112 - ((m_002 + c1o3) * m_110 + c2o1 * m_101 * m_011) * oneOverRho; + + real c_220 = m_220 - (((m_200 * m_020 + c2o1 * m_110 * m_110) + c1o3 * (m_200 + m_020)) * oneOverRho - c1o9 * (drho * oneOverRho)); + real c_202 = m_202 - (((m_200 * m_002 + c2o1 * m_101 * m_101) + c1o3 * (m_200 + m_002)) * oneOverRho - c1o9 * (drho * oneOverRho)); + real c_022 = m_022 - (((m_002 * m_020 + c2o1 * m_011 * m_011) + c1o3 * (m_002 + m_020)) * oneOverRho - c1o9 * (drho * oneOverRho)); + //////////////////////////////////////////////////////////// + // 5. + real c_122 = + m_122 - ((m_002 * m_120 + m_020 * m_102 + c4o1 * m_011 * m_111 + c2o1 * (m_101 * m_021 + m_110 * m_012)) + + c1o3 * (m_120 + m_102)) * + oneOverRho; + real c_212 = + m_212 - ((m_002 * m_210 + m_200 * m_012 + c4o1 * m_101 * m_111 + c2o1 * (m_011 * m_201 + m_110 * m_102)) + + c1o3 * (m_210 + m_012)) * + oneOverRho; + real c_221 = + m_221 - ((m_200 * m_021 + m_020 * m_201 + c4o1 * m_110 * m_111 + c2o1 * (m_101 * m_120 + m_011 * m_210)) + + c1o3 * (m_021 + m_201)) * + oneOverRho; + //////////////////////////////////////////////////////////// + // 6. + real c_222 = m_222 + ((-c4o1 * m_111 * m_111 - (m_200 * m_022 + m_020 * m_202 + m_002 * m_220) - + c4o1 * (m_011 * m_211 + m_101 * m_121 + m_110 * m_112) - + c2o1 * (m_120 * m_102 + m_210 * m_012 + m_201 * m_021)) * + oneOverRho + + (c4o1 * (m_101 * m_101 * m_020 + m_011 * m_011 * m_200 + m_110 * m_110 * m_002) + + c2o1 * (m_200 * m_020 * m_002) + c16o1 * m_110 * m_101 * m_011) * + oneOverRho * oneOverRho - + c1o3 * (m_022 + m_202 + m_220) * oneOverRho - c1o9 * (m_200 + m_020 + m_002) * oneOverRho + + (c2o1 * (m_101 * m_101 + m_011 * m_011 + m_110 * m_110) + + (m_002 * m_020 + m_002 * m_200 + m_020 * m_200) + c1o3 * (m_002 + m_020 + m_200)) * + oneOverRho * oneOverRho * c2o3 + + c1o27 * ((drho * drho - drho) * oneOverRho * oneOverRho)); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute linear combinations of second and third order cumulants + //! + //////////////////////////////////////////////////////////// + // 2. + real mxxPyyPzz = m_200 + m_020 + m_002; + real mxxMyy = m_200 - m_020; + real mxxMzz = m_200 - m_002; + //////////////////////////////////////////////////////////// + // 3. + real mxxyPyzz = m_210 + m_012; + real mxxyMyzz = m_210 - m_012; + + real mxxzPyyz = m_201 + m_021; + real mxxzMyyz = m_201 - m_021; + + real mxyyPxzz = m_120 + m_102; + real mxyyMxzz = m_120 - m_102; + + //////////////////////////////////////////////////////////////////////////////////// + // incl. correction + //////////////////////////////////////////////////////////// + //! - Compute velocity gradients from second order cumulants according to Eq. (27)-(32) + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> Further explanations of the correction in viscosity in Appendix H of + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> Note that the division by rho is omitted here as we need rho times + //! the gradients later. + //! + real Dxy = -c3o1 * omega * m_110; + real Dxz = -c3o1 * omega * m_101; + real Dyz = -c3o1 * omega * m_011; + real dxux = c1o2 * (-omega) * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (m_000 - mxxPyyPzz); + real dyuy = dxux + omega * c3o2 * mxxMyy; + real dzuz = dxux + omega * c3o2 * mxxMzz; + //////////////////////////////////////////////////////////// + //! - Relaxation of second order cumulants with correction terms according to Eq. (33)-(35) in + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + mxxPyyPzz += OxxPyyPzz * (m_000 - mxxPyyPzz) - c3o1 * (c1o1 - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); + mxxMyy += omega * (-mxxMyy) - c3o1 * (c1o1 + c1o2 * (-omega)) * (vx2 * dxux - vy2 * dyuy); + mxxMzz += omega * (-mxxMzz) - c3o1 * (c1o1 + c1o2 * (-omega)) * (vx2 * dxux - vz2 * dzuz); + ////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////////// + ////no correction + // mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz); + // mxxMyy += -(-omega) * (-mxxMyy); + // mxxMzz += -(-omega) * (-mxxMzz); + ////////////////////////////////////////////////////////////////////////// + + m_011 += omega * (-m_011); + m_101 += omega * (-m_101); + m_110 += omega * (-m_110); + + ////////////////////////////////////////////////////////////////////////// + //! - Relaxation of third order cumulants including limiter according to Eq. (116)-(123) + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + ////////////////////////////////////////////////////////////////////////// + // incl. limiter + real wadjust = Oxyz + (c1o1 - Oxyz) * abs(m_111) / (abs(m_111) + quadricLimitD); + m_111 += wadjust * (-m_111); + wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxxyPyzz) / (abs(mxxyPyzz) + quadricLimitP); + mxxyPyzz += wadjust * (-mxxyPyzz); + wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxxyMyzz) / (abs(mxxyMyzz) + quadricLimitM); + mxxyMyzz += wadjust * (-mxxyMyzz); + wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxxzPyyz) / (abs(mxxzPyyz) + quadricLimitP); + mxxzPyyz += wadjust * (-mxxzPyyz); + wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxxzMyyz) / (abs(mxxzMyyz) + quadricLimitM); + mxxzMyyz += wadjust * (-mxxzMyyz); + wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxyyPxzz) / (abs(mxyyPxzz) + quadricLimitP); + mxyyPxzz += wadjust * (-mxyyPxzz); + wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxyyMxzz) / (abs(mxyyMxzz) + quadricLimitM); + mxyyMxzz += wadjust * (-mxyyMxzz); + ////////////////////////////////////////////////////////////////////////// + // no limiter + // mfbbb += OxyyMxzz * (-mfbbb); + // mxxyPyzz += OxyyPxzz * (-mxxyPyzz); + // mxxyMyzz += OxyyMxzz * (-mxxyMyzz); + // mxxzPyyz += OxyyPxzz * (-mxxzPyyz); + // mxxzMyyz += OxyyMxzz * (-mxxzMyyz); + // mxyyPxzz += OxyyPxzz * (-mxyyPxzz); + // mxyyMxzz += OxyyMxzz * (-mxyyMxzz); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute inverse linear combinations of second and third order cumulants + //! + m_200 = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); + m_020 = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz); + m_002 = c1o3 * (mxxMyy - c2o1 * mxxMzz + mxxPyyPzz); + + m_210 = ( mxxyMyzz + mxxyPyzz) * c1o2; + m_012 = (-mxxyMyzz + mxxyPyzz) * c1o2; + m_201 = ( mxxzMyyz + mxxzPyyz) * c1o2; + m_021 = (-mxxzMyyz + mxxzPyyz) * c1o2; + m_120 = ( mxyyMxzz + mxyyPxzz) * c1o2; + m_102 = (-mxyyMxzz + mxyyPxzz) * c1o2; + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // 4. + // no limiter + //! - Relax fourth order cumulants to modified equilibrium for fourth order convergence of diffusion according + //! to Eq. (43)-(48) <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + c_022 = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * factorA + (c1o1 - O4) * (c_022); + c_202 = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * factorA + (c1o1 - O4) * (c_202); + c_220 = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * factorA + (c1o1 - O4) * (c_220); + c_112 = -O4 * (c1o1 / omega - c1o2) * Dxy * c1o3 * factorB + (c1o1 - O4) * (c_112); + c_121 = -O4 * (c1o1 / omega - c1o2) * Dxz * c1o3 * factorB + (c1o1 - O4) * (c_121); + c_211 = -O4 * (c1o1 / omega - c1o2) * Dyz * c1o3 * factorB + (c1o1 - O4) * (c_211); + + ////////////////////////////////////////////////////////////////////////// + // 5. + c_122 += O5 * (-c_122); + c_212 += O5 * (-c_212); + c_221 += O5 * (-c_221); + + ////////////////////////////////////////////////////////////////////////// + // 6. + c_222 += O6 * (-c_222); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute central moments from post collision cumulants according to Eq. (53)-(56) in + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + + ////////////////////////////////////////////////////////////////////////// + // 4. + m_211 = c_211 + c1o3 * ((c3o1 * m_200 + c1o1) * m_011 + c6o1 * m_110 * m_101) * oneOverRho; + m_121 = c_121 + c1o3 * ((c3o1 * m_020 + c1o1) * m_101 + c6o1 * m_110 * m_011) * oneOverRho; + m_112 = c_112 + c1o3 * ((c3o1 * m_002 + c1o1) * m_110 + c6o1 * m_101 * m_011) * oneOverRho; + + m_220 = + c_220 + (((m_200 * m_020 + c2o1 * m_110 * m_110) * c9o1 + c3o1 * (m_200 + m_020)) * oneOverRho - (drho * oneOverRho)) * c1o9; + m_202 = + c_202 + (((m_200 * m_002 + c2o1 * m_101 * m_101) * c9o1 + c3o1 * (m_200 + m_002)) * oneOverRho - (drho * oneOverRho)) * c1o9; + m_022 = + c_022 + (((m_002 * m_020 + c2o1 * m_011 * m_011) * c9o1 + c3o1 * (m_002 + m_020)) * oneOverRho - (drho * oneOverRho)) * c1o9; + + ////////////////////////////////////////////////////////////////////////// + // 5. + m_122 = c_122 + c1o3 * + (c3o1 * (m_002 * m_120 + m_020 * m_102 + c4o1 * m_011 * m_111 + c2o1 * (m_101 * m_021 + m_110 * m_012)) + + (m_120 + m_102)) * oneOverRho; + m_212 = c_212 + c1o3 * + (c3o1 * (m_002 * m_210 + m_200 * m_012 + c4o1 * m_101 * m_111 + c2o1 * (m_011 * m_201 + m_110 * m_102)) + + (m_210 + m_012)) * oneOverRho; + m_221 = c_221 + c1o3 * + (c3o1 * (m_200 * m_021 + m_020 * m_201 + c4o1 * m_110 * m_111 + c2o1 * (m_101 * m_120 + m_011 * m_210)) + + (m_021 + m_201)) * oneOverRho; + + ////////////////////////////////////////////////////////////////////////// + // 6. + m_222 = c_222 - ((-c4o1 * m_111 * m_111 - (m_200 * m_022 + m_020 * m_202 + m_002 * m_220) - + c4o1 * (m_011 * m_211 + m_101 * m_121 + m_110 * m_112) - + c2o1 * (m_120 * m_102 + m_210 * m_012 + m_201 * m_021)) * + oneOverRho + + (c4o1 * (m_101 * m_101 * m_020 + m_011 * m_011 * m_200 + m_110 * m_110 * m_002) + + c2o1 * (m_200 * m_020 * m_002) + c16o1 * m_110 * m_101 * m_011) * + oneOverRho * oneOverRho - + c1o3 * (m_022 + m_202 + m_220) * oneOverRho - c1o9 * (m_200 + m_020 + m_002) * oneOverRho + + (c2o1 * (m_101 * m_101 + m_011 * m_011 + m_110 * m_110) + + (m_002 * m_020 + m_002 * m_200 + m_020 * m_200) + c1o3 * (m_002 + m_020 + m_200)) * + oneOverRho * oneOverRho * c2o3 + + c1o27 * ((drho * drho - drho) * oneOverRho * oneOverRho)); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Add acceleration (body force) to first order cumulants according to Eq. (85)-(87) in + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + m_100 = -m_100; + m_010 = -m_010; + m_001 = -m_001; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (88)-(96) in <a + //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + backwardInverseChimeraWithK(m_000, m_100, m_200, vvx, vx2, c1o1, c1o1); + backwardChimera( m_010, m_110, m_210, vvx, vx2); + backwardInverseChimeraWithK(m_020, m_120, m_220, vvx, vx2, c3o1, c1o3); + backwardChimera( m_001, m_101, m_201, vvx, vx2); + backwardChimera( m_011, m_111, m_211, vvx, vx2); + backwardChimera( m_021, m_121, m_221, vvx, vx2); + backwardInverseChimeraWithK(m_002, m_102, m_202, vvx, vx2, c3o1, c1o3); + backwardChimera( m_012, m_112, m_212, vvx, vx2); + backwardInverseChimeraWithK(m_022, m_122, m_222, vvx, vx2, c9o1, c1o9); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithK(m_000, m_010, m_020, vvy, vy2, c6o1, c1o6); + backwardChimera( m_001, m_011, m_021, vvy, vy2); + backwardInverseChimeraWithK(m_002, m_012, m_022, vvy, vy2, c18o1, c1o18); + backwardInverseChimeraWithK(m_100, m_110, m_120, vvy, vy2, c3o2, c2o3); + backwardChimera( m_101, m_111, m_121, vvy, vy2); + backwardInverseChimeraWithK(m_102, m_112, m_122, vvy, vy2, c9o2, c2o9); + backwardInverseChimeraWithK(m_200, m_210, m_220, vvy, vy2, c6o1, c1o6); + backwardChimera( m_201, m_211, m_221, vvy, vy2); + backwardInverseChimeraWithK(m_202, m_212, m_222, vvy, vy2, c18o1, c1o18); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithK(m_000, m_001, m_002, vvz, vz2, c36o1, c1o36); + backwardInverseChimeraWithK(m_010, m_011, m_012, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(m_020, m_021, m_022, vvz, vz2, c36o1, c1o36); + backwardInverseChimeraWithK(m_100, m_101, m_102, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(m_110, m_111, m_112, vvz, vz2, c9o4, c4o9); + backwardInverseChimeraWithK(m_120, m_121, m_122, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(m_200, m_201, m_202, vvz, vz2, c36o1, c1o36); + backwardInverseChimeraWithK(m_210, m_211, m_212, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(m_220, m_221, m_222, vvz, vz2, c36o1, c1o36); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Write distributions: style of reading and writing the distributions from/to + //! stored arrays dependent on timestep is based on the esoteric twist algorithm + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), + //! DOI:10.3390/computation5020019 ]</b></a> + //! + (dist.f[DIR_P00])[k_000] = f_M00; + (dist.f[DIR_M00])[k_M00] = f_P00; + (dist.f[DIR_0P0])[k_000] = f_0M0; + (dist.f[DIR_0M0])[k_0M0] = f_0P0; + (dist.f[DIR_00P])[k_000] = f_00M; + (dist.f[DIR_00M])[k_00M] = f_00P; + (dist.f[DIR_PP0])[k_000] = f_MM0; + (dist.f[DIR_MM0])[k_MM0] = f_PP0; + (dist.f[DIR_PM0])[k_0M0] = f_MP0; + (dist.f[DIR_MP0])[k_M00] = f_PM0; + (dist.f[DIR_P0P])[k_000] = f_M0M; + (dist.f[DIR_M0M])[k_M0M] = f_P0P; + (dist.f[DIR_P0M])[k_00M] = f_M0P; + (dist.f[DIR_M0P])[k_M00] = f_P0M; + (dist.f[DIR_0PP])[k_000] = f_0MM; + (dist.f[DIR_0MM])[k_0MM] = f_0PP; + (dist.f[DIR_0PM])[k_00M] = f_0MP; + (dist.f[DIR_0MP])[k_0M0] = f_0PM; + (dist.f[DIR_000])[k_000] = f_000; + (dist.f[DIR_PPP])[k_000] = f_MMM; + (dist.f[DIR_PMP])[k_0M0] = f_MPM; + (dist.f[DIR_PPM])[k_00M] = f_MMP; + (dist.f[DIR_PMM])[k_0MM] = f_MPP; + (dist.f[DIR_MPP])[k_M00] = f_PMM; + (dist.f[DIR_MMP])[k_MM0] = f_PPM; + (dist.f[DIR_MPM])[k_M0M] = f_PMP; + (dist.f[DIR_MMM])[k_MMM] = f_PPP; +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesigned_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesigned_Device.cuh new file mode 100644 index 0000000000000000000000000000000000000000..00628efc76447a09504d2fd32a26a63a4d611c66 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesigned_Device.cuh @@ -0,0 +1,20 @@ +#ifndef LB_Kernel_CUMULANT_K17_COMP_CHIM_REDESIGN_H +#define LB_Kernel_CUMULANT_K17_COMP_CHIM_REDESIGN_H + +#include <DataTypes.h> +#include <curand.h> + +__global__ void LB_Kernel_CumulantK17CompChimRedesigned( + real omega, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + real* distributions, + unsigned long numberOfLBnodes, + int level, + real* forces, + real* quadricLimiters, + bool isEvenTimestep, + const uint* fluidNodeIndices, + uint numberOfFluidNodes); +#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStream.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStream.cu new file mode 100644 index 0000000000000000000000000000000000000000..6fae9f6d4845019afd363790eea0ee17c69a060f --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStream.cu @@ -0,0 +1,61 @@ +#include "CumulantK17CompChimStream.h" + +#include "Parameter/Parameter.h" +#include "Parameter/CudaStreamManager.h" +#include "CumulantK17CompChimStream_Device.cuh" + +#include <cuda.h> + +std::shared_ptr<CumulantK17CompChimStream> CumulantK17CompChimStream::getNewInstance(std::shared_ptr<Parameter> para, + int level) +{ + return std::shared_ptr<CumulantK17CompChimStream>(new CumulantK17CompChimStream(para, level)); +} + +void CumulantK17CompChimStream::run() +{ + LB_Kernel_CumulantK17CompChimStream <<< cudaGrid.grid, cudaGrid.threads >>>( + para->getParD(level)->omega, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + level, + para->getForcesDev(), + para->getQuadricLimitersDev(), + para->getParD(level)->isEvenTimestep, + para->getParD(level)->fluidNodeIndices, + para->getParD(level)->numberOfFluidNodes); + getLastCudaError("LB_Kernel_CumulantK17CompChim execution failed"); +} + +void CumulantK17CompChimStream::runOnIndices(const unsigned int *indices, unsigned int size_indices, int streamIndex) +{ + cudaStream_t stream = (streamIndex == -1) ? CU_STREAM_LEGACY : para->getStreamManager()->getStream(streamIndex); + + LB_Kernel_CumulantK17CompChimStream<<< cudaGrid.grid, cudaGrid.threads, 0, stream>>>( + para->getParD(level)->omega, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + level, + para->getForcesDev(), + para->getQuadricLimitersDev(), + para->getParD(level)->isEvenTimestep, + indices, + size_indices); + getLastCudaError("LB_Kernel_CumulantK17CompChim execution failed"); + +} + +CumulantK17CompChimStream::CumulantK17CompChimStream(std::shared_ptr<Parameter> para, int level): KernelImp(para, level) +{ + myPreProcessorTypes.push_back(InitCompSP27); + myKernelGroup = BasicKernel; + this->cudaGrid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); + this->kernelUsesFluidNodeIndices = true; +} + diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStream.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStream.h new file mode 100644 index 0000000000000000000000000000000000000000..325826e04c893b7c56b7f00bb2503a4eb1fda441 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStream.h @@ -0,0 +1,18 @@ +#ifndef CUMULANT_K17_COMP_CHIM_SPARSE_H +#define CUMULANT_K17_COMP_CHIM_SPARSE_H + +#include "Kernel/KernelImp.h" + +class CumulantK17CompChimStream : public KernelImp +{ +public: + static std::shared_ptr<CumulantK17CompChimStream> getNewInstance(std::shared_ptr<Parameter> para, int level); + void run() override; + void runOnIndices(const unsigned int *indices, unsigned int size_indices, int stream = -1) override; + +private: + CumulantK17CompChimStream(); + CumulantK17CompChimStream(std::shared_ptr<Parameter> para, int level); +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStreamDevice.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStreamDevice.cu new file mode 100644 index 0000000000000000000000000000000000000000..830fcc6c328f2ecd0f626539040868696065065f --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStreamDevice.cu @@ -0,0 +1,640 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file Cumulant27chimStream.cu +//! \ingroup GPU +//! \author Martin Schoenherr, Anna Wellmann +//======================================================================================= +/* Device code */ +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" +#include <lbm/constants/NumericConstants.h> + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; +#include "Kernel/Utilities/ChimeraTransformation.h" + +//////////////////////////////////////////////////////////////////////////////// +__global__ void LB_Kernel_CumulantK17CompChimStream( + real omega, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + real* distributions, + unsigned long size_Mat, + int level, + real* forces, + real* quadricLimiters, + bool isEvenTimestep, + const uint *fluidNodeIndices, + uint numberOfFluidNodes) +{ + ////////////////////////////////////////////////////////////////////////// + //! Cumulant K17 Kernel is based on \ref + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> and \ref <a href="https://doi.org/10.1016/j.jcp.2017.07.004"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.07.004 ]</b></a> + //! + //! The cumulant kernel is executed in the following steps + //! + //////////////////////////////////////////////////////////////////////////////// + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned x = threadIdx.x; + const unsigned y = blockIdx.x; + const unsigned z = blockIdx.y; + + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + + const unsigned k_thread = nx * (ny * z + y) + x; + + ////////////////////////////////////////////////////////////////////////// + // run for all indices in fluidNodeIndices + if (k_thread < numberOfFluidNodes) { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on + //! timestep is based on the esoteric twist algorithm \ref <a + //! href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), + //! DOI:10.3390/computation5020019 ]</b></a> + + const unsigned k = fluidNodeIndices[k_thread]; + + Distributions27 dist; + if (isEvenTimestep) { + dist.f[DIR_P00] = &distributions[DIR_P00 * size_Mat]; + dist.f[DIR_M00] = &distributions[DIR_M00 * size_Mat]; + dist.f[DIR_0P0] = &distributions[DIR_0P0 * size_Mat]; + dist.f[DIR_0M0] = &distributions[DIR_0M0 * size_Mat]; + dist.f[DIR_00P] = &distributions[DIR_00P * size_Mat]; + dist.f[DIR_00M] = &distributions[DIR_00M * size_Mat]; + dist.f[DIR_PP0] = &distributions[DIR_PP0 * size_Mat]; + dist.f[DIR_MM0] = &distributions[DIR_MM0 * size_Mat]; + dist.f[DIR_PM0] = &distributions[DIR_PM0 * size_Mat]; + dist.f[DIR_MP0] = &distributions[DIR_MP0 * size_Mat]; + dist.f[DIR_P0P] = &distributions[DIR_P0P * size_Mat]; + dist.f[DIR_M0M] = &distributions[DIR_M0M * size_Mat]; + dist.f[DIR_P0M] = &distributions[DIR_P0M * size_Mat]; + dist.f[DIR_M0P] = &distributions[DIR_M0P * size_Mat]; + dist.f[DIR_0PP] = &distributions[DIR_0PP * size_Mat]; + dist.f[DIR_0MM] = &distributions[DIR_0MM * size_Mat]; + dist.f[DIR_0PM] = &distributions[DIR_0PM * size_Mat]; + dist.f[DIR_0MP] = &distributions[DIR_0MP * size_Mat]; + dist.f[DIR_000] = &distributions[DIR_000 * size_Mat]; + dist.f[DIR_PPP] = &distributions[DIR_PPP * size_Mat]; + dist.f[DIR_MMP] = &distributions[DIR_MMP * size_Mat]; + dist.f[DIR_PMP] = &distributions[DIR_PMP * size_Mat]; + dist.f[DIR_MPP] = &distributions[DIR_MPP * size_Mat]; + dist.f[DIR_PPM] = &distributions[DIR_PPM * size_Mat]; + dist.f[DIR_MMM] = &distributions[DIR_MMM * size_Mat]; + dist.f[DIR_PMM] = &distributions[DIR_PMM * size_Mat]; + dist.f[DIR_MPM] = &distributions[DIR_MPM * size_Mat]; + } else { + dist.f[DIR_M00] = &distributions[DIR_P00 * size_Mat]; + dist.f[DIR_P00] = &distributions[DIR_M00 * size_Mat]; + dist.f[DIR_0M0] = &distributions[DIR_0P0 * size_Mat]; + dist.f[DIR_0P0] = &distributions[DIR_0M0 * size_Mat]; + dist.f[DIR_00M] = &distributions[DIR_00P * size_Mat]; + dist.f[DIR_00P] = &distributions[DIR_00M * size_Mat]; + dist.f[DIR_MM0] = &distributions[DIR_PP0 * size_Mat]; + dist.f[DIR_PP0] = &distributions[DIR_MM0 * size_Mat]; + dist.f[DIR_MP0] = &distributions[DIR_PM0 * size_Mat]; + dist.f[DIR_PM0] = &distributions[DIR_MP0 * size_Mat]; + dist.f[DIR_M0M] = &distributions[DIR_P0P * size_Mat]; + dist.f[DIR_P0P] = &distributions[DIR_M0M * size_Mat]; + dist.f[DIR_M0P] = &distributions[DIR_P0M * size_Mat]; + dist.f[DIR_P0M] = &distributions[DIR_M0P * size_Mat]; + dist.f[DIR_0MM] = &distributions[DIR_0PP * size_Mat]; + dist.f[DIR_0PP] = &distributions[DIR_0MM * size_Mat]; + dist.f[DIR_0MP] = &distributions[DIR_0PM * size_Mat]; + dist.f[DIR_0PM] = &distributions[DIR_0MP * size_Mat]; + dist.f[DIR_000] = &distributions[DIR_000 * size_Mat]; + dist.f[DIR_MMM] = &distributions[DIR_PPP * size_Mat]; + dist.f[DIR_PPM] = &distributions[DIR_MMP * size_Mat]; + dist.f[DIR_MPM] = &distributions[DIR_PMP * size_Mat]; + dist.f[DIR_PMM] = &distributions[DIR_MPP * size_Mat]; + dist.f[DIR_MMP] = &distributions[DIR_PPM * size_Mat]; + dist.f[DIR_PPP] = &distributions[DIR_MMM * size_Mat]; + dist.f[DIR_MPP] = &distributions[DIR_PMM * size_Mat]; + dist.f[DIR_PMP] = &distributions[DIR_MPM * size_Mat]; + } + //////////////////////////////////////////////////////////////////////////////// + //! - Set neighbor indices (necessary for indirect addressing) + uint kw = neighborX[k]; + uint ks = neighborY[k]; + uint kb = neighborZ[k]; + uint ksw = neighborY[kw]; + uint kbw = neighborZ[kw]; + uint kbs = neighborZ[ks]; + uint kbsw = neighborZ[ksw]; + //////////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions + //! + real mfcbb = (dist.f[DIR_P00])[k]; + real mfabb = (dist.f[DIR_M00])[kw]; + real mfbcb = (dist.f[DIR_0P0])[k]; + real mfbab = (dist.f[DIR_0M0])[ks]; + real mfbbc = (dist.f[DIR_00P])[k]; + real mfbba = (dist.f[DIR_00M])[kb]; + real mfccb = (dist.f[DIR_PP0])[k]; + real mfaab = (dist.f[DIR_MM0])[ksw]; + real mfcab = (dist.f[DIR_PM0])[ks]; + real mfacb = (dist.f[DIR_MP0])[kw]; + real mfcbc = (dist.f[DIR_P0P])[k]; + real mfaba = (dist.f[DIR_M0M])[kbw]; + real mfcba = (dist.f[DIR_P0M])[kb]; + real mfabc = (dist.f[DIR_M0P])[kw]; + real mfbcc = (dist.f[DIR_0PP])[k]; + real mfbaa = (dist.f[DIR_0MM])[kbs]; + real mfbca = (dist.f[DIR_0PM])[kb]; + real mfbac = (dist.f[DIR_0MP])[ks]; + real mfbbb = (dist.f[DIR_000])[k]; + real mfccc = (dist.f[DIR_PPP])[k]; + real mfaac = (dist.f[DIR_MMP])[ksw]; + real mfcac = (dist.f[DIR_PMP])[ks]; + real mfacc = (dist.f[DIR_MPP])[kw]; + real mfcca = (dist.f[DIR_PPM])[kb]; + real mfaaa = (dist.f[DIR_MMM])[kbsw]; + real mfcaa = (dist.f[DIR_PMM])[kbs]; + real mfaca = (dist.f[DIR_MPM])[kbw]; + //////////////////////////////////////////////////////////////////////////////////// + //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + + ((mfacb + mfcab) + (mfaab + mfccb))) + + ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + + mfbbb; + + real rho = c1o1 + drho; + real OOrho = c1o1 / rho; + + real vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + + (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + (mfcbb - mfabb)) * + OOrho; + real vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + + (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + (mfbcb - mfbab)) * + OOrho; + real vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) + + (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) + (mfbbc - mfbba)) * + OOrho; + //////////////////////////////////////////////////////////////////////////////////// + //! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + real factor = c1o1; + for (size_t i = 1; i <= level; i++) { + factor *= c2o1; + } + real fx = forces[0] / factor; + real fy = forces[1] / factor; + real fz = forces[2] / factor; + vvx += fx * c1o2; + vvy += fy * c1o2; + vvz += fz * c1o2; + //////////////////////////////////////////////////////////////////////////////////// + // calculate the square of velocities for this lattice node + real vx2 = vvx * vvx; + real vy2 = vvy * vvy; + real vz2 = vvz * vvz; + //////////////////////////////////////////////////////////////////////////////////// + //! - Set relaxation limiters for third order cumulants to default value \f$ \lambda=0.001 \f$ according to + //! section 6 in \ref <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + real wadjust; + real qudricLimitP = quadricLimiters[0]; + real qudricLimitM = quadricLimiters[1]; + real qudricLimitD = quadricLimiters[2]; + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (6)-(14) in \ref <a + //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + forwardInverseChimeraWithK(mfaaa, mfaab, mfaac, vvz, vz2, c36o1, c1o36); + forwardInverseChimeraWithK(mfaba, mfabb, mfabc, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(mfaca, mfacb, mfacc, vvz, vz2, c36o1, c1o36); + forwardInverseChimeraWithK(mfbaa, mfbab, mfbac, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(mfbba, mfbbb, mfbbc, vvz, vz2, c9o4, c4o9); + forwardInverseChimeraWithK(mfbca, mfbcb, mfbcc, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(mfcaa, mfcab, mfcac, vvz, vz2, c36o1, c1o36); + forwardInverseChimeraWithK(mfcba, mfcbb, mfcbc, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(mfcca, mfccb, mfccc, vvz, vz2, c36o1, c1o36); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + forwardInverseChimeraWithK(mfaaa, mfaba, mfaca, vvy, vy2, c6o1, c1o6); + forwardChimera(mfaab, mfabb, mfacb, vvy, vy2); + forwardInverseChimeraWithK(mfaac, mfabc, mfacc, vvy, vy2, c18o1, c1o18); + forwardInverseChimeraWithK(mfbaa, mfbba, mfbca, vvy, vy2, c3o2, c2o3); + forwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2); + forwardInverseChimeraWithK(mfbac, mfbbc, mfbcc, vvy, vy2, c9o2, c2o9); + forwardInverseChimeraWithK(mfcaa, mfcba, mfcca, vvy, vy2, c6o1, c1o6); + forwardChimera(mfcab, mfcbb, mfccb, vvy, vy2); + forwardInverseChimeraWithK(mfcac, mfcbc, mfccc, vvy, vy2, c18o1, c1o18); + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + forwardInverseChimeraWithK(mfaaa, mfbaa, mfcaa, vvx, vx2, c1o1, c1o1); + forwardChimera(mfaba, mfbba, mfcba, vvx, vx2); + forwardInverseChimeraWithK(mfaca, mfbca, mfcca, vvx, vx2, c3o1, c1o3); + forwardChimera(mfaab, mfbab, mfcab, vvx, vx2); + forwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2); + forwardChimera(mfacb, mfbcb, mfccb, vvx, vx2); + forwardInverseChimeraWithK(mfaac, mfbac, mfcac, vvx, vx2, c3o1, c1o3); + forwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2); + forwardInverseChimeraWithK(mfacc, mfbcc, mfccc, vvx, vx2, c3o1, c1o9); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Setting relaxation rates for non-hydrodynamic cumulants (default values). Variable names and equations + //! according to <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! => [NAME IN PAPER]=[NAME IN CODE]=[DEFAULT VALUE]. + //! - Trace of second order cumulants \f$ C_{200}+C_{020}+C_{002} \f$ used to adjust bulk + //! viscosity:\f$\omega_2=OxxPyyPzz=1.0 \f$. + //! - Third order cumulants \f$ C_{120}+C_{102}, C_{210}+C_{012}, C_{201}+C_{021} \f$: \f$ \omega_3=OxyyPxzz + //! \f$ set according to Eq. (111) with simplifications assuming \f$ \omega_2=1.0\f$. + //! - Third order cumulants \f$ C_{120}-C_{102}, C_{210}-C_{012}, C_{201}-C_{021} \f$: \f$ \omega_4 = OxyyMxzz + //! \f$ set according to Eq. (112) with simplifications assuming \f$ \omega_2 = 1.0\f$. + //! - Third order cumulants \f$ C_{111} \f$: \f$ \omega_5 = Oxyz \f$ set according to Eq. (113) with + //! simplifications assuming \f$ \omega_2 = 1.0\f$ (modify for different bulk viscosity). + //! - Fourth order cumulants \f$ C_{220}, C_{202}, C_{022}, C_{211}, C_{121}, C_{112} \f$: for simplification + //! all set to the same default value \f$ \omega_6=\omega_7=\omega_8=O4=1.0 \f$. + //! - Fifth order cumulants \f$ C_{221}, C_{212}, C_{122}\f$: \f$\omega_9=O5=1.0\f$. + //! - Sixth order cumulant \f$ C_{222}\f$: \f$\omega_{10}=O6=1.0\f$. + //! + //////////////////////////////////////////////////////////// + // 2. + real OxxPyyPzz = c1o1; + //////////////////////////////////////////////////////////// + // 3. + real OxyyPxzz = c8o1 * (-c2o1 + omega) * (c1o1 + c2o1 * omega) / (-c8o1 - c14o1 * omega + c7o1 * omega * omega); + real OxyyMxzz = + c8o1 * (-c2o1 + omega) * (-c7o1 + c4o1 * omega) / (c56o1 - c50o1 * omega + c9o1 * omega * omega); + real Oxyz = c24o1 * (-c2o1 + omega) * (-c2o1 - c7o1 * omega + c3o1 * omega * omega) / + (c48o1 + c152o1 * omega - c130o1 * omega * omega + c29o1 * omega * omega * omega); + //////////////////////////////////////////////////////////// + // 4. + real O4 = c1o1; + //////////////////////////////////////////////////////////// + // 5. + real O5 = c1o1; + //////////////////////////////////////////////////////////// + // 6. + real O6 = c1o1; + + //////////////////////////////////////////////////////////////////////////////////// + //! - A and DIR_00M: parameters for fourth order convergence of the diffusion term according to Eq. (115) and (116) + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> with simplifications assuming \f$ \omega_2 = 1.0 \f$ (modify for + //! different bulk viscosity). + //! + real factorA = (c4o1 + c2o1 * omega - c3o1 * omega * omega) / (c2o1 - c7o1 * omega + c5o1 * omega * omega); + real factorB = (c4o1 + c28o1 * omega - c14o1 * omega * omega) / (c6o1 - c21o1 * omega + c15o1 * omega * omega); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute cumulants from central moments according to Eq. (20)-(23) in + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + //////////////////////////////////////////////////////////// + // 4. + real CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + c2o1 * mfbba * mfbab) * OOrho; + real CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + c2o1 * mfbba * mfabb) * OOrho; + real CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + c2o1 * mfbab * mfabb) * OOrho; + + real CUMcca = + mfcca - (((mfcaa * mfaca + c2o1 * mfbba * mfbba) + c1o3 * (mfcaa + mfaca)) * OOrho - c1o9 * (drho * OOrho)); + real CUMcac = + mfcac - (((mfcaa * mfaac + c2o1 * mfbab * mfbab) + c1o3 * (mfcaa + mfaac)) * OOrho - c1o9 * (drho * OOrho)); + real CUMacc = + mfacc - (((mfaac * mfaca + c2o1 * mfabb * mfabb) + c1o3 * (mfaac + mfaca)) * OOrho - c1o9 * (drho * OOrho)); + //////////////////////////////////////////////////////////// + // 5. + real CUMbcc = + mfbcc - ((mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + + c1o3 * (mfbca + mfbac)) * + OOrho; + real CUMcbc = + mfcbc - ((mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + + c1o3 * (mfcba + mfabc)) * + OOrho; + real CUMccb = + mfccb - ((mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + + c1o3 * (mfacb + mfcab)) * + OOrho; + //////////////////////////////////////////////////////////// + // 6. + real CUMccc = mfccc + ((-c4o1 * mfbbb * mfbbb - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) - + c4o1 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc) - + c2o1 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) * + OOrho + + (c4o1 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) + + c2o1 * (mfcaa * mfaca * mfaac) + c16o1 * mfbba * mfbab * mfabb) * + OOrho * OOrho - + c1o3 * (mfacc + mfcac + mfcca) * OOrho - c1o9 * (mfcaa + mfaca + mfaac) * OOrho + + (c2o1 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) + + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa) + c1o3 * (mfaac + mfaca + mfcaa)) * + OOrho * OOrho * c2o3 + + c1o27 * ((drho * drho - drho) * OOrho * OOrho)); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute linear combinations of second and third order cumulants + //! + //////////////////////////////////////////////////////////// + // 2. + real mxxPyyPzz = mfcaa + mfaca + mfaac; + real mxxMyy = mfcaa - mfaca; + real mxxMzz = mfcaa - mfaac; + //////////////////////////////////////////////////////////// + // 3. + real mxxyPyzz = mfcba + mfabc; + real mxxyMyzz = mfcba - mfabc; + + real mxxzPyyz = mfcab + mfacb; + real mxxzMyyz = mfcab - mfacb; + + real mxyyPxzz = mfbca + mfbac; + real mxyyMxzz = mfbca - mfbac; + + //////////////////////////////////////////////////////////////////////////////////// + // incl. correction + //////////////////////////////////////////////////////////// + //! - Compute velocity gradients from second order cumulants according to Eq. (27)-(32) + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> Further explanations of the correction in viscosity in Appendix H of + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> Note that the division by rho is omitted here as we need rho times + //! the gradients later. + //! + real Dxy = -c3o1 * omega * mfbba; + real Dxz = -c3o1 * omega * mfbab; + real Dyz = -c3o1 * omega * mfabb; + real dxux = c1o2 * (-omega) * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (mfaaa - mxxPyyPzz); + real dyuy = dxux + omega * c3o2 * mxxMyy; + real dzuz = dxux + omega * c3o2 * mxxMzz; + //////////////////////////////////////////////////////////// + //! - Relaxation of second order cumulants with correction terms according to Eq. (33)-(35) in + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + mxxPyyPzz += + OxxPyyPzz * (mfaaa - mxxPyyPzz) - c3o1 * (c1o1 - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); + mxxMyy += omega * (-mxxMyy) - c3o1 * (c1o1 + c1o2 * (-omega)) * (vx2 * dxux - vy2 * dyuy); + mxxMzz += omega * (-mxxMzz) - c3o1 * (c1o1 + c1o2 * (-omega)) * (vx2 * dxux - vz2 * dzuz); + + //////////////////////////////////////////////////////////////////////////////////// + ////no correction + // mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz); + // mxxMyy += -(-omega) * (-mxxMyy); + // mxxMzz += -(-omega) * (-mxxMzz); + ////////////////////////////////////////////////////////////////////////// + mfabb += omega * (-mfabb); + mfbab += omega * (-mfbab); + mfbba += omega * (-mfbba); + + //////////////////////////////////////////////////////////////////////////////////// + // relax + ////////////////////////////////////////////////////////////////////////// + // incl. limiter + //! - Relaxation of third order cumulants including limiter according to Eq. (116)-(123) + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + wadjust = Oxyz + (c1o1 - Oxyz) * abs(mfbbb) / (abs(mfbbb) + qudricLimitD); + mfbbb += wadjust * (-mfbbb); + wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxxyPyzz) / (abs(mxxyPyzz) + qudricLimitP); + mxxyPyzz += wadjust * (-mxxyPyzz); + wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxxyMyzz) / (abs(mxxyMyzz) + qudricLimitM); + mxxyMyzz += wadjust * (-mxxyMyzz); + wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxxzPyyz) / (abs(mxxzPyyz) + qudricLimitP); + mxxzPyyz += wadjust * (-mxxzPyyz); + wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxxzMyyz) / (abs(mxxzMyyz) + qudricLimitM); + mxxzMyyz += wadjust * (-mxxzMyyz); + wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxyyPxzz) / (abs(mxyyPxzz) + qudricLimitP); + mxyyPxzz += wadjust * (-mxyyPxzz); + wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxyyMxzz) / (abs(mxyyMxzz) + qudricLimitM); + mxyyMxzz += wadjust * (-mxyyMxzz); + ////////////////////////////////////////////////////////////////////////// + // no limiter + // mfbbb += OxyyMxzz * (-mfbbb); + // mxxyPyzz += OxyyPxzz * (-mxxyPyzz); + // mxxyMyzz += OxyyMxzz * (-mxxyMyzz); + // mxxzPyyz += OxyyPxzz * (-mxxzPyyz); + // mxxzMyyz += OxyyMxzz * (-mxxzMyyz); + // mxyyPxzz += OxyyPxzz * (-mxyyPxzz); + // mxyyMxzz += OxyyMxzz * (-mxyyMxzz); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute inverse linear combinations of second and third order cumulants + //! + mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); + mfaca = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz); + mfaac = c1o3 * (mxxMyy - c2o1 * mxxMzz + mxxPyyPzz); + + mfcba = (mxxyMyzz + mxxyPyzz) * c1o2; + mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2; + mfcab = (mxxzMyyz + mxxzPyyz) * c1o2; + mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2; + mfbca = (mxyyMxzz + mxyyPxzz) * c1o2; + mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2; + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // 4. + // no limiter + //! - Relax fourth order cumulants to modified equilibrium for fourth order convergence of diffusion according + //! to Eq. (43)-(48) <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + CUMacc = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMacc); + CUMcac = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMcac); + CUMcca = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * factorA + (c1o1 - O4) * (CUMcca); + CUMbbc = -O4 * (c1o1 / omega - c1o2) * Dxy * c1o3 * factorB + (c1o1 - O4) * (CUMbbc); + CUMbcb = -O4 * (c1o1 / omega - c1o2) * Dxz * c1o3 * factorB + (c1o1 - O4) * (CUMbcb); + CUMcbb = -O4 * (c1o1 / omega - c1o2) * Dyz * c1o3 * factorB + (c1o1 - O4) * (CUMcbb); + + ////////////////////////////////////////////////////////////////////////// + // 5. + CUMbcc += O5 * (-CUMbcc); + CUMcbc += O5 * (-CUMcbc); + CUMccb += O5 * (-CUMccb); + + ////////////////////////////////////////////////////////////////////////// + // 6. + CUMccc += O6 * (-CUMccc); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute central moments from post collision cumulants according to Eq. (53)-(56) in + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + + ////////////////////////////////////////////////////////////////////////// + // 4. + mfcbb = CUMcbb + c1o3 * ((c3o1 * mfcaa + c1o1) * mfabb + c6o1 * mfbba * mfbab) * OOrho; + mfbcb = CUMbcb + c1o3 * ((c3o1 * mfaca + c1o1) * mfbab + c6o1 * mfbba * mfabb) * OOrho; + mfbbc = CUMbbc + c1o3 * ((c3o1 * mfaac + c1o1) * mfbba + c6o1 * mfbab * mfabb) * OOrho; + + mfcca = + CUMcca + + (((mfcaa * mfaca + c2o1 * mfbba * mfbba) * c9o1 + c3o1 * (mfcaa + mfaca)) * OOrho - (drho * OOrho)) * c1o9; + mfcac = + CUMcac + + (((mfcaa * mfaac + c2o1 * mfbab * mfbab) * c9o1 + c3o1 * (mfcaa + mfaac)) * OOrho - (drho * OOrho)) * c1o9; + mfacc = + CUMacc + + (((mfaac * mfaca + c2o1 * mfabb * mfabb) * c9o1 + c3o1 * (mfaac + mfaca)) * OOrho - (drho * OOrho)) * c1o9; + + ////////////////////////////////////////////////////////////////////////// + // 5. + mfbcc = CUMbcc + c1o3 * + (c3o1 * (mfaac * mfbca + mfaca * mfbac + c4o1 * mfabb * mfbbb + + c2o1 * (mfbab * mfacb + mfbba * mfabc)) + + (mfbca + mfbac)) * + OOrho; + mfcbc = CUMcbc + c1o3 * + (c3o1 * (mfaac * mfcba + mfcaa * mfabc + c4o1 * mfbab * mfbbb + + c2o1 * (mfabb * mfcab + mfbba * mfbac)) + + (mfcba + mfabc)) * + OOrho; + mfccb = CUMccb + c1o3 * + (c3o1 * (mfcaa * mfacb + mfaca * mfcab + c4o1 * mfbba * mfbbb + + c2o1 * (mfbab * mfbca + mfabb * mfcba)) + + (mfacb + mfcab)) * + OOrho; + + ////////////////////////////////////////////////////////////////////////// + // 6. + mfccc = CUMccc - ((-c4o1 * mfbbb * mfbbb - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) - + c4o1 * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc) - + c2o1 * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) * + OOrho + + (c4o1 * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) + + c2o1 * (mfcaa * mfaca * mfaac) + c16o1 * mfbba * mfbab * mfabb) * + OOrho * OOrho - + c1o3 * (mfacc + mfcac + mfcca) * OOrho - c1o9 * (mfcaa + mfaca + mfaac) * OOrho + + (c2o1 * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) + + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa) + c1o3 * (mfaac + mfaca + mfcaa)) * + OOrho * OOrho * c2o3 + + c1o27 * ((drho * drho - drho) * OOrho * OOrho)); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Add acceleration (body force) to first order cumulants according to Eq. (85)-(87) in + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + mfbaa = -mfbaa; + mfaba = -mfaba; + mfaab = -mfaab; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (88)-(96) in <a + //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + backwardInverseChimeraWithK(mfaaa, mfbaa, mfcaa, vvx, vx2, c1o1, c1o1); + backwardChimera(mfaba, mfbba, mfcba, vvx, vx2); + backwardInverseChimeraWithK(mfaca, mfbca, mfcca, vvx, vx2, c3o1, c1o3); + backwardChimera(mfaab, mfbab, mfcab, vvx, vx2); + backwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2); + backwardChimera(mfacb, mfbcb, mfccb, vvx, vx2); + backwardInverseChimeraWithK(mfaac, mfbac, mfcac, vvx, vx2, c3o1, c1o3); + backwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2); + backwardInverseChimeraWithK(mfacc, mfbcc, mfccc, vvx, vx2, c9o1, c1o9); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithK(mfaaa, mfaba, mfaca, vvy, vy2, c6o1, c1o6); + backwardChimera(mfaab, mfabb, mfacb, vvy, vy2); + backwardInverseChimeraWithK(mfaac, mfabc, mfacc, vvy, vy2, c18o1, c1o18); + backwardInverseChimeraWithK(mfbaa, mfbba, mfbca, vvy, vy2, c3o2, c2o3); + backwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2); + backwardInverseChimeraWithK(mfbac, mfbbc, mfbcc, vvy, vy2, c9o2, c2o9); + backwardInverseChimeraWithK(mfcaa, mfcba, mfcca, vvy, vy2, c6o1, c1o6); + backwardChimera(mfcab, mfcbb, mfccb, vvy, vy2); + backwardInverseChimeraWithK(mfcac, mfcbc, mfccc, vvy, vy2, c18o1, c1o18); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithK(mfaaa, mfaab, mfaac, vvz, vz2, c36o1, c1o36); + backwardInverseChimeraWithK(mfaba, mfabb, mfabc, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(mfaca, mfacb, mfacc, vvz, vz2, c36o1, c1o36); + backwardInverseChimeraWithK(mfbaa, mfbab, mfbac, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(mfbba, mfbbb, mfbbc, vvz, vz2, c9o4, c4o9); + backwardInverseChimeraWithK(mfbca, mfbcb, mfbcc, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(mfcaa, mfcab, mfcac, vvz, vz2, c36o1, c1o36); + backwardInverseChimeraWithK(mfcba, mfcbb, mfcbc, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(mfcca, mfccb, mfccc, vvz, vz2, c36o1, c1o36); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Write distributions: style of reading and writing the distributions from/to + //! stored arrays dependent on timestep is based on the esoteric twist algorithm + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), + //! DOI:10.3390/computation5020019 ]</b></a> + //! + (dist.f[DIR_P00])[k] = mfabb; + (dist.f[DIR_M00])[kw] = mfcbb; + (dist.f[DIR_0P0])[k] = mfbab; + (dist.f[DIR_0M0])[ks] = mfbcb; + (dist.f[DIR_00P])[k] = mfbba; + (dist.f[DIR_00M])[kb] = mfbbc; + (dist.f[DIR_PP0])[k] = mfaab; + (dist.f[DIR_MM0])[ksw] = mfccb; + (dist.f[DIR_PM0])[ks] = mfacb; + (dist.f[DIR_MP0])[kw] = mfcab; + (dist.f[DIR_P0P])[k] = mfaba; + (dist.f[DIR_M0M])[kbw] = mfcbc; + (dist.f[DIR_P0M])[kb] = mfabc; + (dist.f[DIR_M0P])[kw] = mfcba; + (dist.f[DIR_0PP])[k] = mfbaa; + (dist.f[DIR_0MM])[kbs] = mfbcc; + (dist.f[DIR_0PM])[kb] = mfbac; + (dist.f[DIR_0MP])[ks] = mfbca; + (dist.f[DIR_000])[k] = mfbbb; + (dist.f[DIR_PPP])[k] = mfaaa; + (dist.f[DIR_PMP])[ks] = mfaca; + (dist.f[DIR_PPM])[kb] = mfaac; + (dist.f[DIR_PMM])[kbs] = mfacc; + (dist.f[DIR_MPP])[kw] = mfcaa; + (dist.f[DIR_MMP])[ksw] = mfcca; + (dist.f[DIR_MPM])[kbw] = mfcac; + (dist.f[DIR_MMM])[kbsw] = mfccc; + } +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStream_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStream_Device.cuh new file mode 100644 index 0000000000000000000000000000000000000000..f74192c0423ba9dc96820d7f46eecb9d49a39ed4 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStream_Device.cuh @@ -0,0 +1,20 @@ +#ifndef LB_Kernel_CUMULANT_K17_COMP_CHIM_SPARSE_H +#define LB_Kernel_CUMULANT_K17_COMP_CHIM_SPARSE_H + +#include <DataTypes.h> +#include <curand.h> + +__global__ void LB_Kernel_CumulantK17CompChimStream( + real omega, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + real* distributions, + unsigned long size_Mat, + int level, + real* forces, + real* quadricLimiters, + bool isEvenTimestep, + const uint* fluidNodeIndices, + uint numberOfFluidNodes); +#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.cu index f5b9bbe63cda87d11f1639b9688e9f5799f2511e..54af306039585f3beb39b05f2f2e0a96ae784e12 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.cu @@ -12,7 +12,7 @@ std::shared_ptr<CumulantK18Comp> CumulantK18Comp::getNewInstance(std::shared_ptr void CumulantK18Comp::run() { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -30,17 +30,17 @@ void CumulantK18Comp::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_CumulantK18Comp << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], para->getParD(level)->g6.g[0], - para->getParD(level)->size_Mat_SP, + para->getParD(level)->numberOfNodes, level, para->getForcesDev(), para->getQuadricLimitersDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_CumulantK18Comp execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cu index 8d5b10b1ecf7076147dec425823233ba97fa11b8..bb42d113e47ce28f153ac295f2d9a934dd1b213a 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_CumulantK18Comp( +__global__ void LB_Kernel_CumulantK18Comp( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -41,83 +42,83 @@ extern "C" __global__ void LB_Kernel_CumulantK18Comp( Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } Distributions6 G; if (EvenOrOdd == true) { - G.g[dirE] = &G6[dirE *size_Mat]; - G.g[dirW] = &G6[dirW *size_Mat]; - G.g[dirN] = &G6[dirN *size_Mat]; - G.g[dirS] = &G6[dirS *size_Mat]; - G.g[dirT] = &G6[dirT *size_Mat]; - G.g[dirB] = &G6[dirB *size_Mat]; + G.g[DIR_P00] = &G6[DIR_P00 *size_Mat]; + G.g[DIR_M00] = &G6[DIR_M00 *size_Mat]; + G.g[DIR_0P0] = &G6[DIR_0P0 *size_Mat]; + G.g[DIR_0M0] = &G6[DIR_0M0 *size_Mat]; + G.g[DIR_00P] = &G6[DIR_00P *size_Mat]; + G.g[DIR_00M] = &G6[DIR_00M *size_Mat]; } else { - G.g[dirW] = &G6[dirE *size_Mat]; - G.g[dirE] = &G6[dirW *size_Mat]; - G.g[dirS] = &G6[dirN *size_Mat]; - G.g[dirN] = &G6[dirS *size_Mat]; - G.g[dirB] = &G6[dirT *size_Mat]; - G.g[dirT] = &G6[dirB *size_Mat]; + G.g[DIR_M00] = &G6[DIR_P00 *size_Mat]; + G.g[DIR_P00] = &G6[DIR_M00 *size_Mat]; + G.g[DIR_0M0] = &G6[DIR_0P0 *size_Mat]; + G.g[DIR_0P0] = &G6[DIR_0M0 *size_Mat]; + G.g[DIR_00M] = &G6[DIR_00P *size_Mat]; + G.g[DIR_00P] = &G6[DIR_00M *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -151,43 +152,43 @@ extern "C" __global__ void LB_Kernel_CumulantK18Comp( unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mgcbb = (G.g[dirE])[k]; - real mgabb = (G.g[dirW])[kw]; - real mgbcb = (G.g[dirN])[k]; - real mgbab = (G.g[dirS])[ks]; - real mgbbc = (G.g[dirT])[k]; - real mgbba = (G.g[dirB])[kb]; + real mgcbb = (G.g[DIR_P00])[k]; + real mgabb = (G.g[DIR_M00])[kw]; + real mgbcb = (G.g[DIR_0P0])[k]; + real mgbab = (G.g[DIR_0M0])[ks]; + real mgbbc = (G.g[DIR_00P])[k]; + real mgbba = (G.g[DIR_00M])[kb]; real dxxux = c1o2 * (-mgcbb + mgabb); real dyyuy = c1o2 * (-mgbcb + mgbab); real dzzuz = c1o2 * (-mgbbc + mgbba); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k]; - real mfabb = (D.f[dirW])[kw]; - real mfbcb = (D.f[dirN])[k]; - real mfbab = (D.f[dirS])[ks]; - real mfbbc = (D.f[dirT])[k]; - real mfbba = (D.f[dirB])[kb]; - real mfccb = (D.f[dirNE])[k]; - real mfaab = (D.f[dirSW])[ksw]; - real mfcab = (D.f[dirSE])[ks]; - real mfacb = (D.f[dirNW])[kw]; - real mfcbc = (D.f[dirTE])[k]; - real mfaba = (D.f[dirBW])[kbw]; - real mfcba = (D.f[dirBE])[kb]; - real mfabc = (D.f[dirTW])[kw]; - real mfbcc = (D.f[dirTN])[k]; - real mfbaa = (D.f[dirBS])[kbs]; - real mfbca = (D.f[dirBN])[kb]; - real mfbac = (D.f[dirTS])[ks]; - real mfbbb = (D.f[dirZERO])[k]; - real mfccc = (D.f[dirTNE])[k]; - real mfaac = (D.f[dirTSW])[ksw]; - real mfcac = (D.f[dirTSE])[ks]; - real mfacc = (D.f[dirTNW])[kw]; - real mfcca = (D.f[dirBNE])[kb]; - real mfaaa = (D.f[dirBSW])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs]; - real mfaca = (D.f[dirBNW])[kbw]; + real mfcbb = (D.f[DIR_P00])[k]; + real mfabb = (D.f[DIR_M00])[kw]; + real mfbcb = (D.f[DIR_0P0])[k]; + real mfbab = (D.f[DIR_0M0])[ks]; + real mfbbc = (D.f[DIR_00P])[k]; + real mfbba = (D.f[DIR_00M])[kb]; + real mfccb = (D.f[DIR_PP0])[k]; + real mfaab = (D.f[DIR_MM0])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks]; + real mfacb = (D.f[DIR_MP0])[kw]; + real mfcbc = (D.f[DIR_P0P])[k]; + real mfaba = (D.f[DIR_M0M])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb]; + real mfabc = (D.f[DIR_M0P])[kw]; + real mfbcc = (D.f[DIR_0PP])[k]; + real mfbaa = (D.f[DIR_0MM])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb]; + real mfbac = (D.f[DIR_0MP])[ks]; + real mfbbb = (D.f[DIR_000])[k]; + real mfccc = (D.f[DIR_PPP])[k]; + real mfaac = (D.f[DIR_MMP])[ksw]; + real mfcac = (D.f[DIR_PMP])[ks]; + real mfacc = (D.f[DIR_MPP])[kw]; + real mfcca = (D.f[DIR_PPM])[kb]; + real mfaaa = (D.f[DIR_MMM])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs]; + real mfaca = (D.f[DIR_MPM])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -914,41 +915,41 @@ extern "C" __global__ void LB_Kernel_CumulantK18Comp( //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb; - (D.f[dirW])[kw] = mfcbb; - (D.f[dirN])[k] = mfbab; - (D.f[dirS])[ks] = mfbcb; - (D.f[dirT])[k] = mfbba; - (D.f[dirB])[kb] = mfbbc; - (D.f[dirNE])[k] = mfaab; - (D.f[dirSW])[ksw] = mfccb; - (D.f[dirSE])[ks] = mfacb; - (D.f[dirNW])[kw] = mfcab; - (D.f[dirTE])[k] = mfaba; - (D.f[dirBW])[kbw] = mfcbc; - (D.f[dirBE])[kb] = mfabc; - (D.f[dirTW])[kw] = mfcba; - (D.f[dirTN])[k] = mfbaa; - (D.f[dirBS])[kbs] = mfbcc; - (D.f[dirBN])[kb] = mfbac; - (D.f[dirTS])[ks] = mfbca; - (D.f[dirZERO])[k] = mfbbb; - (D.f[dirTNE])[k] = mfaaa; - (D.f[dirTSE])[ks] = mfaca; - (D.f[dirBNE])[kb] = mfaac; - (D.f[dirBSE])[kbs] = mfacc; - (D.f[dirTNW])[kw] = mfcaa; - (D.f[dirTSW])[ksw] = mfcca; - (D.f[dirBNW])[kbw] = mfcac; - (D.f[dirBSW])[kbsw] = mfccc; - //////////////////////////////////////////////////////////////////////////////////// - - (G.g[dirE])[k] = mgabb; - (G.g[dirW])[kw] = mgcbb; - (G.g[dirN])[k] = mgbab; - (G.g[dirS])[ks] = mgbcb; - (G.g[dirT])[k] = mgbba; - (G.g[dirB])[kb] = mgbbc; + (D.f[DIR_P00])[k] = mfabb; + (D.f[DIR_M00])[kw] = mfcbb; + (D.f[DIR_0P0])[k] = mfbab; + (D.f[DIR_0M0])[ks] = mfbcb; + (D.f[DIR_00P])[k] = mfbba; + (D.f[DIR_00M])[kb] = mfbbc; + (D.f[DIR_PP0])[k] = mfaab; + (D.f[DIR_MM0])[ksw] = mfccb; + (D.f[DIR_PM0])[ks] = mfacb; + (D.f[DIR_MP0])[kw] = mfcab; + (D.f[DIR_P0P])[k] = mfaba; + (D.f[DIR_M0M])[kbw] = mfcbc; + (D.f[DIR_P0M])[kb] = mfabc; + (D.f[DIR_M0P])[kw] = mfcba; + (D.f[DIR_0PP])[k] = mfbaa; + (D.f[DIR_0MM])[kbs] = mfbcc; + (D.f[DIR_0PM])[kb] = mfbac; + (D.f[DIR_0MP])[ks] = mfbca; + (D.f[DIR_000])[k] = mfbbb; + (D.f[DIR_PPP])[k] = mfaaa; + (D.f[DIR_PMP])[ks] = mfaca; + (D.f[DIR_PPM])[kb] = mfaac; + (D.f[DIR_PMM])[kbs] = mfacc; + (D.f[DIR_MPP])[kw] = mfcaa; + (D.f[DIR_MMP])[ksw] = mfcca; + (D.f[DIR_MPM])[kbw] = mfcac; + (D.f[DIR_MMM])[kbsw] = mfccc; + //////////////////////////////////////////////////////////////////////////////////// + + (G.g[DIR_P00])[k] = mgabb; + (G.g[DIR_M00])[kw] = mgcbb; + (G.g[DIR_0P0])[k] = mgbab; + (G.g[DIR_0M0])[ks] = mgbcb; + (G.g[DIR_00P])[k] = mgbba; + (G.g[DIR_00M])[kb] = mgbbc; } } } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cuh index 1d2358370ecd9baabacdda345973324e7e2382f7..60a15145e3c117cadb7485f2899ba768b10eb0c1 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_CumulantK18Comp( real omega, +__global__ void LB_Kernel_CumulantK18Comp( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp.cu index 086a8e2055b4ea65c6c25402971ff99aa1b10d9d..0c1778dc39496c6564dedcbe1f6e818bee147191 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp.cu @@ -12,7 +12,7 @@ std::shared_ptr<CumulantK20Comp> CumulantK20Comp::getNewInstance(std::shared_ptr void CumulantK20Comp::run() { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -30,17 +30,17 @@ void CumulantK20Comp::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_CumulantK20Comp << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], para->getParD(level)->g6.g[0], - para->getParD(level)->size_Mat_SP, + para->getParD(level)->numberOfNodes, level, para->getForcesDev(), para->getQuadricLimitersDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_CumulantK20Comp execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cu index 959a9e6d748deed1f2b509ae86b65f4ebbbdc1c1..c805fc293aeb8b182bb0e01df82b584da69d0175 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_CumulantK20Comp( +__global__ void LB_Kernel_CumulantK20Comp( real omega, unsigned int* bcMatD, unsigned int* neighborX, @@ -41,83 +42,83 @@ extern "C" __global__ void LB_Kernel_CumulantK20Comp( Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } Distributions6 G; if (EvenOrOdd == true) { - G.g[dirE] = &G6[dirE *size_Mat]; - G.g[dirW] = &G6[dirW *size_Mat]; - G.g[dirN] = &G6[dirN *size_Mat]; - G.g[dirS] = &G6[dirS *size_Mat]; - G.g[dirT] = &G6[dirT *size_Mat]; - G.g[dirB] = &G6[dirB *size_Mat]; + G.g[DIR_P00] = &G6[DIR_P00 *size_Mat]; + G.g[DIR_M00] = &G6[DIR_M00 *size_Mat]; + G.g[DIR_0P0] = &G6[DIR_0P0 *size_Mat]; + G.g[DIR_0M0] = &G6[DIR_0M0 *size_Mat]; + G.g[DIR_00P] = &G6[DIR_00P *size_Mat]; + G.g[DIR_00M] = &G6[DIR_00M *size_Mat]; } else { - G.g[dirW] = &G6[dirE *size_Mat]; - G.g[dirE] = &G6[dirW *size_Mat]; - G.g[dirS] = &G6[dirN *size_Mat]; - G.g[dirN] = &G6[dirS *size_Mat]; - G.g[dirB] = &G6[dirT *size_Mat]; - G.g[dirT] = &G6[dirB *size_Mat]; + G.g[DIR_M00] = &G6[DIR_P00 *size_Mat]; + G.g[DIR_P00] = &G6[DIR_M00 *size_Mat]; + G.g[DIR_0M0] = &G6[DIR_0P0 *size_Mat]; + G.g[DIR_0P0] = &G6[DIR_0M0 *size_Mat]; + G.g[DIR_00M] = &G6[DIR_00P *size_Mat]; + G.g[DIR_00P] = &G6[DIR_00M *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -150,43 +151,43 @@ extern "C" __global__ void LB_Kernel_CumulantK20Comp( //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mgcbb = (G.g[dirE])[k]; - real mgabb = (G.g[dirW])[kw]; - real mgbcb = (G.g[dirN])[k]; - real mgbab = (G.g[dirS])[ks]; - real mgbbc = (G.g[dirT])[k]; - real mgbba = (G.g[dirB])[kb]; + real mgcbb = (G.g[DIR_P00])[k]; + real mgabb = (G.g[DIR_M00])[kw]; + real mgbcb = (G.g[DIR_0P0])[k]; + real mgbab = (G.g[DIR_0M0])[ks]; + real mgbbc = (G.g[DIR_00P])[k]; + real mgbba = (G.g[DIR_00M])[kb]; real dxuxdxux = c1o2 * (-mgcbb + mgabb); real dyuydyuy = c1o2 * (-mgbcb + mgbab); real dzuzdzuz = c1o2 * (-mgbbc + mgbba); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k]; - real mfabb = (D.f[dirW])[kw]; - real mfbcb = (D.f[dirN])[k]; - real mfbab = (D.f[dirS])[ks]; - real mfbbc = (D.f[dirT])[k]; - real mfbba = (D.f[dirB])[kb]; - real mfccb = (D.f[dirNE])[k]; - real mfaab = (D.f[dirSW])[ksw]; - real mfcab = (D.f[dirSE])[ks]; - real mfacb = (D.f[dirNW])[kw]; - real mfcbc = (D.f[dirTE])[k]; - real mfaba = (D.f[dirBW])[kbw]; - real mfcba = (D.f[dirBE])[kb]; - real mfabc = (D.f[dirTW])[kw]; - real mfbcc = (D.f[dirTN])[k]; - real mfbaa = (D.f[dirBS])[kbs]; - real mfbca = (D.f[dirBN])[kb]; - real mfbac = (D.f[dirTS])[ks]; - real mfbbb = (D.f[dirZERO])[k]; - real mfccc = (D.f[dirTNE])[k]; - real mfaac = (D.f[dirTSW])[ksw]; - real mfcac = (D.f[dirTSE])[ks]; - real mfacc = (D.f[dirTNW])[kw]; - real mfcca = (D.f[dirBNE])[kb]; - real mfaaa = (D.f[dirBSW])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs]; - real mfaca = (D.f[dirBNW])[kbw]; + real mfcbb = (D.f[DIR_P00])[k]; + real mfabb = (D.f[DIR_M00])[kw]; + real mfbcb = (D.f[DIR_0P0])[k]; + real mfbab = (D.f[DIR_0M0])[ks]; + real mfbbc = (D.f[DIR_00P])[k]; + real mfbba = (D.f[DIR_00M])[kb]; + real mfccb = (D.f[DIR_PP0])[k]; + real mfaab = (D.f[DIR_MM0])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks]; + real mfacb = (D.f[DIR_MP0])[kw]; + real mfcbc = (D.f[DIR_P0P])[k]; + real mfaba = (D.f[DIR_M0M])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb]; + real mfabc = (D.f[DIR_M0P])[kw]; + real mfbcc = (D.f[DIR_0PP])[k]; + real mfbaa = (D.f[DIR_0MM])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb]; + real mfbac = (D.f[DIR_0MP])[ks]; + real mfbbb = (D.f[DIR_000])[k]; + real mfccc = (D.f[DIR_PPP])[k]; + real mfaac = (D.f[DIR_MMP])[ksw]; + real mfcac = (D.f[DIR_PMP])[ks]; + real mfacc = (D.f[DIR_MPP])[kw]; + real mfcca = (D.f[DIR_PPM])[kb]; + real mfaaa = (D.f[DIR_MMM])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs]; + real mfaca = (D.f[DIR_MPM])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -918,41 +919,41 @@ extern "C" __global__ void LB_Kernel_CumulantK20Comp( //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb; - (D.f[dirW])[kw] = mfcbb; - (D.f[dirN])[k] = mfbab; - (D.f[dirS])[ks] = mfbcb; - (D.f[dirT])[k] = mfbba; - (D.f[dirB])[kb] = mfbbc; - (D.f[dirNE])[k] = mfaab; - (D.f[dirSW])[ksw] = mfccb; - (D.f[dirSE])[ks] = mfacb; - (D.f[dirNW])[kw] = mfcab; - (D.f[dirTE])[k] = mfaba; - (D.f[dirBW])[kbw] = mfcbc; - (D.f[dirBE])[kb] = mfabc; - (D.f[dirTW])[kw] = mfcba; - (D.f[dirTN])[k] = mfbaa; - (D.f[dirBS])[kbs] = mfbcc; - (D.f[dirBN])[kb] = mfbac; - (D.f[dirTS])[ks] = mfbca; - (D.f[dirZERO])[k] = mfbbb; - (D.f[dirTNE])[k] = mfaaa; - (D.f[dirTSE])[ks] = mfaca; - (D.f[dirBNE])[kb] = mfaac; - (D.f[dirBSE])[kbs] = mfacc; - (D.f[dirTNW])[kw] = mfcaa; - (D.f[dirTSW])[ksw] = mfcca; - (D.f[dirBNW])[kbw] = mfcac; - (D.f[dirBSW])[kbsw] = mfccc; - //////////////////////////////////////////////////////////////////////////////////// - - (G.g[dirE])[k] = mgabb; - (G.g[dirW])[kw] = mgcbb; - (G.g[dirN])[k] = mgbab; - (G.g[dirS])[ks] = mgbcb; - (G.g[dirT])[k] = mgbba; - (G.g[dirB])[kb] = mgbbc; + (D.f[DIR_P00])[k] = mfabb; + (D.f[DIR_M00])[kw] = mfcbb; + (D.f[DIR_0P0])[k] = mfbab; + (D.f[DIR_0M0])[ks] = mfbcb; + (D.f[DIR_00P])[k] = mfbba; + (D.f[DIR_00M])[kb] = mfbbc; + (D.f[DIR_PP0])[k] = mfaab; + (D.f[DIR_MM0])[ksw] = mfccb; + (D.f[DIR_PM0])[ks] = mfacb; + (D.f[DIR_MP0])[kw] = mfcab; + (D.f[DIR_P0P])[k] = mfaba; + (D.f[DIR_M0M])[kbw] = mfcbc; + (D.f[DIR_P0M])[kb] = mfabc; + (D.f[DIR_M0P])[kw] = mfcba; + (D.f[DIR_0PP])[k] = mfbaa; + (D.f[DIR_0MM])[kbs] = mfbcc; + (D.f[DIR_0PM])[kb] = mfbac; + (D.f[DIR_0MP])[ks] = mfbca; + (D.f[DIR_000])[k] = mfbbb; + (D.f[DIR_PPP])[k] = mfaaa; + (D.f[DIR_PMP])[ks] = mfaca; + (D.f[DIR_PPM])[kb] = mfaac; + (D.f[DIR_PMM])[kbs] = mfacc; + (D.f[DIR_MPP])[kw] = mfcaa; + (D.f[DIR_MMP])[ksw] = mfcca; + (D.f[DIR_MPM])[kbw] = mfcac; + (D.f[DIR_MMM])[kbsw] = mfccc; + //////////////////////////////////////////////////////////////////////////////////// + + (G.g[DIR_P00])[k] = mgabb; + (G.g[DIR_M00])[kw] = mgcbb; + (G.g[DIR_0P0])[k] = mgbab; + (G.g[DIR_0M0])[ks] = mgbcb; + (G.g[DIR_00P])[k] = mgbba; + (G.g[DIR_00M])[kb] = mgbbc; } } } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cuh index f6280969d1f501f69cbf912fca07b14cbe458b25..17691f621b5a46d29556d71304195f4a346a7ec6 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_CumulantK20Comp( real omega, +__global__ void LB_Kernel_CumulantK20Comp( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27.cu index 00a7acce6a39aa14010348d127b1bc39351b99cc..be94791572f739fb2eef7c049702caeedb6641fc 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27.cu @@ -10,7 +10,7 @@ std::shared_ptr<MRTCompSP27> MRTCompSP27::getNewInstance(std::shared_ptr<Paramet void MRTCompSP27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,13 +29,13 @@ void MRTCompSP27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_MRT_Comp_SP_27 << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_MRT_Comp_SP_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cu index 9bde8228fdab4a572496bb1e0478efe2cd9dedfa..a9aefa2d62a962766470c93a62adeefa4f19570e 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_MRT_Comp_SP_27(real omega, +__global__ void LB_Kernel_MRT_Comp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -36,63 +37,63 @@ extern "C" __global__ void LB_Kernel_MRT_Comp_SP_27(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -125,33 +126,33 @@ extern "C" __global__ void LB_Kernel_MRT_Comp_SP_27(real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// real rho = (mfccc + mfaaa + mfaca + mfcac + mfacc + mfcaa + mfaac + mfcca + mfbac + mfbca + mfbaa + mfbcc + mfabc + mfcba + mfaba + mfcbc + mfacb + mfcab + mfaab + mfccb + @@ -738,33 +739,33 @@ extern "C" __global__ void LB_Kernel_MRT_Comp_SP_27(real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cuh index 39b7562a28c39df06b9fe06a431001939c33deb6..947ce68259432efe87af84fd9986916e62521397 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_MRT_Comp_SP_27(real omega, +__global__ void LB_Kernel_MRT_Comp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/RunLBMKernel.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/RunLBMKernel.cuh index ecfdb8e38bc5da02a473b6f2e67340963ed8b38a..558b4f333e7c92b372a5097aa4917dd6d1230a34 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/RunLBMKernel.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/RunLBMKernel.cuh @@ -41,7 +41,7 @@ __global__ void runKernel(KernelFunctor kernel, GPUKernelParameter kernelParamet DistributionWrapper distributionWrapper { kernelParameter.distributions, - kernelParameter.size_Mat, + (unsigned int)kernelParameter.size_Mat, kernelParameter.isEvenTimestep, k, kernelParameter.neighborX, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27.cu index 7e87a8a806db969536ceee93433ee68653adbc76..81655fac9cfd0b562ba60a5ee289fb64da5c1fba 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27.cu @@ -10,7 +10,7 @@ std::shared_ptr<BGKIncompSP27> BGKIncompSP27::getNewInstance(std::shared_ptr<Par void BGKIncompSP27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,13 +29,13 @@ void BGKIncompSP27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_BGK_Incomp_SP_27 << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_BGK_SP_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cu index 138b17170fc80b6f30c48f19111032d760915293..9a94006b8a1be745fc2bcfdd80e454152347139d 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_BGK_Incomp_SP_27(real omega, +__global__ void LB_Kernel_BGK_Incomp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -36,63 +37,63 @@ extern "C" __global__ void LB_Kernel_BGK_Incomp_SP_27(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -125,33 +126,33 @@ extern "C" __global__ void LB_Kernel_BGK_Incomp_SP_27(real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real fE = (D.f[dirE])[k];//ke - real fW = (D.f[dirW])[kw]; - real fN = (D.f[dirN])[k];//kn - real fS = (D.f[dirS])[ks]; - real fT = (D.f[dirT])[k];//kt - real fB = (D.f[dirB])[kb]; - real fNE = (D.f[dirNE])[k];//kne - real fSW = (D.f[dirSW])[ksw]; - real fSE = (D.f[dirSE])[ks];//kse - real fNW = (D.f[dirNW])[kw];//knw - real fTE = (D.f[dirTE])[k];//kte - real fBW = (D.f[dirBW])[kbw]; - real fBE = (D.f[dirBE])[kb];//kbe - real fTW = (D.f[dirTW])[kw];//ktw - real fTN = (D.f[dirTN])[k];//ktn - real fBS = (D.f[dirBS])[kbs]; - real fBN = (D.f[dirBN])[kb];//kbn - real fTS = (D.f[dirTS])[ks];//kts - real fZERO = (D.f[dirZERO])[k];//kzero - real fTNE = (D.f[dirTNE])[k];//ktne - real fTSW = (D.f[dirTSW])[ksw];//ktsw - real fTSE = (D.f[dirTSE])[ks];//ktse - real fTNW = (D.f[dirTNW])[kw];//ktnw - real fBNE = (D.f[dirBNE])[kb];//kbne - real fBSW = (D.f[dirBSW])[kbsw]; - real fBSE = (D.f[dirBSE])[kbs];//kbse - real fBNW = (D.f[dirBNW])[kbw];//kbnw + real fE = (D.f[DIR_P00])[k];//ke + real fW = (D.f[DIR_M00])[kw]; + real fN = (D.f[DIR_0P0])[k];//kn + real fS = (D.f[DIR_0M0])[ks]; + real fT = (D.f[DIR_00P])[k];//kt + real fB = (D.f[DIR_00M])[kb]; + real fNE = (D.f[DIR_PP0])[k];//kne + real fSW = (D.f[DIR_MM0])[ksw]; + real fSE = (D.f[DIR_PM0])[ks];//kse + real fNW = (D.f[DIR_MP0])[kw];//knw + real fTE = (D.f[DIR_P0P])[k];//kte + real fBW = (D.f[DIR_M0M])[kbw]; + real fBE = (D.f[DIR_P0M])[kb];//kbe + real fTW = (D.f[DIR_M0P])[kw];//ktw + real fTN = (D.f[DIR_0PP])[k];//ktn + real fBS = (D.f[DIR_0MM])[kbs]; + real fBN = (D.f[DIR_0PM])[kb];//kbn + real fTS = (D.f[DIR_0MP])[ks];//kts + real fZERO = (D.f[DIR_000])[k];//kzero + real fTNE = (D.f[DIR_PPP])[k];//ktne + real fTSW = (D.f[DIR_MMP])[ksw];//ktsw + real fTSE = (D.f[DIR_PMP])[ks];//ktse + real fTNW = (D.f[DIR_MPP])[kw];//ktnw + real fBNE = (D.f[DIR_PPM])[kb];//kbne + real fBSW = (D.f[DIR_MMM])[kbsw]; + real fBSE = (D.f[DIR_PMM])[kbs];//kbse + real fBNW = (D.f[DIR_MPM])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////// @@ -205,33 +206,33 @@ extern "C" __global__ void LB_Kernel_BGK_Incomp_SP_27(real omega, ////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = fW; - (D.f[dirW])[kw] = fE; - (D.f[dirN])[k] = fS; - (D.f[dirS])[ks] = fN; - (D.f[dirT])[k] = fB; - (D.f[dirB])[kb] = fT; - (D.f[dirNE])[k] = fSW; - (D.f[dirSW])[ksw] = fNE; - (D.f[dirSE])[ks] = fNW; - (D.f[dirNW])[kw] = fSE; - (D.f[dirTE])[k] = fBW; - (D.f[dirBW])[kbw] = fTE; - (D.f[dirBE])[kb] = fTW; - (D.f[dirTW])[kw] = fBE; - (D.f[dirTN])[k] = fBS; - (D.f[dirBS])[kbs] = fTN; - (D.f[dirBN])[kb] = fTS; - (D.f[dirTS])[ks] = fBN; - (D.f[dirZERO])[k] = fZERO; - (D.f[dirTNE])[k] = fBSW; - (D.f[dirTSE])[ks] = fBNW; - (D.f[dirBNE])[kb] = fTSW; - (D.f[dirBSE])[kbs] = fTNW; - (D.f[dirTNW])[kw] = fBSE; - (D.f[dirTSW])[ksw] = fBNE; - (D.f[dirBNW])[kbw] = fTSE; - (D.f[dirBSW])[kbsw] = fTNE; + (D.f[DIR_P00])[k] = fW; + (D.f[DIR_M00])[kw] = fE; + (D.f[DIR_0P0])[k] = fS; + (D.f[DIR_0M0])[ks] = fN; + (D.f[DIR_00P])[k] = fB; + (D.f[DIR_00M])[kb] = fT; + (D.f[DIR_PP0])[k] = fSW; + (D.f[DIR_MM0])[ksw] = fNE; + (D.f[DIR_PM0])[ks] = fNW; + (D.f[DIR_MP0])[kw] = fSE; + (D.f[DIR_P0P])[k] = fBW; + (D.f[DIR_M0M])[kbw] = fTE; + (D.f[DIR_P0M])[kb] = fTW; + (D.f[DIR_M0P])[kw] = fBE; + (D.f[DIR_0PP])[k] = fBS; + (D.f[DIR_0MM])[kbs] = fTN; + (D.f[DIR_0PM])[kb] = fTS; + (D.f[DIR_0MP])[ks] = fBN; + (D.f[DIR_000])[k] = fZERO; + (D.f[DIR_PPP])[k] = fBSW; + (D.f[DIR_PMP])[ks] = fBNW; + (D.f[DIR_PPM])[kb] = fTSW; + (D.f[DIR_PMM])[kbs] = fTNW; + (D.f[DIR_MPP])[kw] = fBSE; + (D.f[DIR_MMP])[ksw] = fBNE; + (D.f[DIR_MPM])[kbw] = fTSE; + (D.f[DIR_MMM])[kbsw] = fTNE; ////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cuh index 20cdefb5a6acd961b9f93ca5cb759bfe742dc990..f1a90b45238a2df4d93860d7e77cb1242b9fbd90 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_BGK_Incomp_SP_27(real omega, +__global__ void LB_Kernel_BGK_Incomp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27.cu index f7e3d29ab47309634b53ebf95be369ad9572ce5a..86b513f1252f2787abee637819e64606d111c4fa 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27.cu @@ -10,7 +10,7 @@ std::shared_ptr<BGKPlusIncompSP27> BGKPlusIncompSP27::getNewInstance(std::shared void BGKPlusIncompSP27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,13 +29,13 @@ void BGKPlusIncompSP27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_BGK_Plus_Incomp_SP_27 << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_BGK_Plus_SP_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cu index deb8d94dc631c1dfaabddbf97b568d82ab47ebf6..9355e42aa5b05190f063f5247d8d6c0dea787a02 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_BGK_Plus_Incomp_SP_27(real omega, +__global__ void LB_Kernel_BGK_Plus_Incomp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -36,63 +37,63 @@ extern "C" __global__ void LB_Kernel_BGK_Plus_Incomp_SP_27(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -125,33 +126,33 @@ extern "C" __global__ void LB_Kernel_BGK_Plus_Incomp_SP_27(real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// //slow //real oMdrho = one - ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + @@ -723,33 +724,33 @@ extern "C" __global__ void LB_Kernel_BGK_Plus_Incomp_SP_27(real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cuh index 327ea4ddc933ccf5e9e75a7fd6d44e4d59b86d56..7f85f3ca29d4d8d7620e2503df9947fd7e42fe8f 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_BGK_Plus_Incomp_SP_27(real omega, +__global__ void LB_Kernel_BGK_Plus_Incomp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27.cu index fdda12b5cf47bfbaf7c19a7af16db47b478791cd..05f374096c9c5da2460b32cf5ae8cb59cfa78382 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27.cu @@ -10,7 +10,7 @@ std::shared_ptr<CascadeIncompSP27> CascadeIncompSP27::getNewInstance(std::shared void CascadeIncompSP27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,13 +29,13 @@ void CascadeIncompSP27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_Cascade_Incomp_SP_27 << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_Cascade_SP_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cu index 025729760d975e04bb51214f59715c0cd8c8685f..92cc749b135739d5f38c9916c4ee0da7497e5f2d 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_Cascade_Incomp_SP_27(real omega, +__global__ void LB_Kernel_Cascade_Incomp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -36,63 +37,63 @@ extern "C" __global__ void LB_Kernel_Cascade_Incomp_SP_27(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -125,33 +126,33 @@ extern "C" __global__ void LB_Kernel_Cascade_Incomp_SP_27(real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// //slow //real oMdrho = one - ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + @@ -727,33 +728,33 @@ extern "C" __global__ void LB_Kernel_Cascade_Incomp_SP_27(real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cuh index c9f6ec42f8ce1512e84c193484c48e78d827f71a..a531fa7bd64b9782f43f800b29fe666504612f1a 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_Cascade_Incomp_SP_27(real s9, +__global__ void LB_Kernel_Cascade_Incomp_SP_27(real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27.cu index 9a78199b882b71c254a16d515028ecd6b15d9b18..62768ef9948b6c259c5ad4005237081f4d255e73 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27.cu @@ -10,7 +10,7 @@ std::shared_ptr<Cumulant1hIncompSP27> Cumulant1hIncompSP27::getNewInstance(std:: void Cumulant1hIncompSP27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -31,16 +31,16 @@ void Cumulant1hIncompSP27::run() LB_Kernel_Cum_1h_Incomp_SP_27 << < grid, threads >> >( para->getParD(level)->omega, para->getParD(level)->deltaPhi, para->getAngularVelocity(), - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->coordX_SP, - para->getParD(level)->coordY_SP, - para->getParD(level)->coordZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->coordinateX, + para->getParD(level)->coordinateY, + para->getParD(level)->coordinateZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_Cum_1h_SP_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cu index 84bf396c47301fe80cca36294a869c0bdd87f9e6..0243046082ce1853011c6632d5a2f80364ebe0db 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_Cum_1h_Incomp_SP_27(real omega, +__global__ void LB_Kernel_Cum_1h_Incomp_SP_27(real omega, real deltaPhi, real angularVelocity, unsigned int* bcMatD, @@ -41,63 +42,63 @@ extern "C" __global__ void LB_Kernel_Cum_1h_Incomp_SP_27(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -158,33 +159,33 @@ extern "C" __global__ void LB_Kernel_Cum_1h_Incomp_SP_27(real omega, //unsigned int ktne = k; //unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// //Ship real coord0X = 281.125f;//7.5f; @@ -1160,33 +1161,33 @@ extern "C" __global__ void LB_Kernel_Cum_1h_Incomp_SP_27(real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cuh index 3117d4e1e34d1d086711e9c5f1f2f6ecf9c4705f..0679e770f244ad2e2c59c9cacf9d3524a640a42e 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_Cum_1h_Incomp_SP_27(real omega, +__global__ void LB_Kernel_Cum_1h_Incomp_SP_27(real omega, real deltaPhi, real angularVelocity, unsigned int* bcMatD, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27.cu index 448f4190881f8e8843f300eefdac70208a0d7385..6551e1bde300e3a4d2a4f50cefdfff258edfacee 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27.cu @@ -10,7 +10,7 @@ std::shared_ptr<CumulantIsoIncompSP27> CumulantIsoIncompSP27::getNewInstance(std void CumulantIsoIncompSP27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,16 +29,16 @@ void CumulantIsoIncompSP27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_Cum_IsoTest_Incomp_SP_27 << < grid, threads >> >(para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], para->getParD(level)->dxxUx, para->getParD(level)->dyyUy, para->getParD(level)->dzzUz, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_Kum_IsoTest_SP_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cu index 753bb0be77c2e269e77e84f12ccf52be71059eb3..64d697f2b0953cee75f4397e399a0e6128e486a2 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_Cum_IsoTest_Incomp_SP_27(real omega, +__global__ void LB_Kernel_Cum_IsoTest_Incomp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -39,63 +40,63 @@ extern "C" __global__ void LB_Kernel_Cum_IsoTest_Incomp_SP_27(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -128,33 +129,33 @@ extern "C" __global__ void LB_Kernel_Cum_IsoTest_Incomp_SP_27(real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// //slow //real oMdrho = one - ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + @@ -972,33 +973,33 @@ extern "C" __global__ void LB_Kernel_Cum_IsoTest_Incomp_SP_27(real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cuh index 9ed2f167ecb199429c7497acc72f298db41a0dc2..57dc7180ce7900333b4071db409a03ac847dd641 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_Cum_IsoTest_Incomp_SP_27(real omega, +__global__ void LB_Kernel_Cum_IsoTest_Incomp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp.cu index f1844b866e9796c5662b52fec662a0ca1894c663..40cde56b007f70f98db13d5962f3e746b97637ef 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp.cu @@ -10,7 +10,7 @@ std::shared_ptr<CumulantK15Incomp> CumulantK15Incomp::getNewInstance(std::shared void CumulantK15Incomp::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,13 +29,13 @@ void CumulantK15Incomp::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_CumulantK15Incomp <<< grid, threads >>>( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_CumulantK15Incomp execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cu index 9c8ca3a6802add72614b58771e6104ab68fa01ec..fc108ef1ef109a40735e250bd9a0f21491e4f977 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_CumulantK15Incomp(real omega, +__global__ void LB_Kernel_CumulantK15Incomp(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -36,63 +37,63 @@ extern "C" __global__ void LB_Kernel_CumulantK15Incomp(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -153,33 +154,33 @@ extern "C" __global__ void LB_Kernel_CumulantK15Incomp(real omega, //unsigned int ktne = k; //unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// //slow //real oMdrho = one - ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + @@ -1205,33 +1206,33 @@ extern "C" __global__ void LB_Kernel_CumulantK15Incomp(real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cuh index 112e9f7a99bf683e8bacb348633f46a10e149e9e..f2b5063f9db6d55b9efb547c0c05d450463e0509 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_CumulantK15Incomp(real s9, +__global__ void LB_Kernel_CumulantK15Incomp(real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27.cu index 32bac539d21683a49381e44d30ee73e1c952b01c..c4311309e4653f2862e303dacb3e2d07646a5061 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27.cu @@ -10,7 +10,7 @@ std::shared_ptr<MRTIncompSP27> MRTIncompSP27::getNewInstance(std::shared_ptr<Par void MRTIncompSP27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,13 +29,13 @@ void MRTIncompSP27::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_MRT_Incomp_SP_27 << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, - para->getParD(level)->evenOrOdd); + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_MRT_SP_27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cu index be2b2333ab7375b5c8b851d705b562fce87f1d2a..f6a283c2f9ba3c15729061ebeabcf34edd0abe97 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_MRT_Incomp_SP_27(real omega, +__global__ void LB_Kernel_MRT_Incomp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -36,63 +37,63 @@ extern "C" __global__ void LB_Kernel_MRT_Incomp_SP_27(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -125,33 +126,33 @@ extern "C" __global__ void LB_Kernel_MRT_Incomp_SP_27(real omega, //unsigned int ktne = k; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k];//[ke ];// + c2over27 ;(D.f[dirE ])[k ];//ke - real mfabb = (D.f[dirW])[kw];//[kw ];// + c2over27 ;(D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN])[k];//[kn ];// + c2over27 ;(D.f[dirN ])[k ];//kn - real mfbab = (D.f[dirS])[ks];//[ks ];// + c2over27 ;(D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT])[k];//[kt ];// + c2over27 ;(D.f[dirT ])[k ];//kt - real mfbba = (D.f[dirB])[kb];//[kb ];// + c2over27 ;(D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE])[k];//[kne ];// + c1over54 ;(D.f[dirNE ])[k ];//kne - real mfaab = (D.f[dirSW])[ksw];//[ksw ];// + c1over54 ;(D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE])[ks];//[kse ];// + c1over54 ;(D.f[dirSE ])[ks ];//kse - real mfacb = (D.f[dirNW])[kw];//[knw ];// + c1over54 ;(D.f[dirNW ])[kw ];//knw - real mfcbc = (D.f[dirTE])[k];//[kte ];// + c1over54 ;(D.f[dirTE ])[k ];//kte - real mfaba = (D.f[dirBW])[kbw];//[kbw ];// + c1over54 ;(D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE])[kb];//[kbe ];// + c1over54 ;(D.f[dirBE ])[kb ];//kbe - real mfabc = (D.f[dirTW])[kw];//[ktw ];// + c1over54 ;(D.f[dirTW ])[kw ];//ktw - real mfbcc = (D.f[dirTN])[k];//[ktn ];// + c1over54 ;(D.f[dirTN ])[k ];//ktn - real mfbaa = (D.f[dirBS])[kbs];//[kbs ];// + c1over54 ;(D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN])[kb];//[kbn ];// + c1over54 ;(D.f[dirBN ])[kb ];//kbn - real mfbac = (D.f[dirTS])[ks];//[kts ];// + c1over54 ;(D.f[dirTS ])[ks ];//kts - real mfbbb = (D.f[dirZERO])[k];//[kzero];// + c8over27 ;(D.f[dirZERO])[k ];//kzero - real mfccc = (D.f[dirTNE])[k];//[ktne ];// + c1over216;(D.f[dirTNE ])[k ];//ktne - real mfaac = (D.f[dirTSW])[ksw];//[ktsw ];// + c1over216;(D.f[dirTSW ])[ksw];//ktsw - real mfcac = (D.f[dirTSE])[ks];//[ktse ];// + c1over216;(D.f[dirTSE ])[ks ];//ktse - real mfacc = (D.f[dirTNW])[kw];//[ktnw ];// + c1over216;(D.f[dirTNW ])[kw ];//ktnw - real mfcca = (D.f[dirBNE])[kb];//[kbne ];// + c1over216;(D.f[dirBNE ])[kb ];//kbne - real mfaaa = (D.f[dirBSW])[kbsw];//[kbsw ];// + c1over216;(D.f[dirBSW ])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs];//[kbse ];// + c1over216;(D.f[dirBSE ])[kbs];//kbse - real mfaca = (D.f[dirBNW])[kbw];//[kbnw ];// + c1over216;(D.f[dirBNW ])[kbw];//kbnw + real mfcbb = (D.f[DIR_P00])[k];//[ke ];// + c2over27 ;(D.f[DIR_P00 ])[k ];//ke + real mfabb = (D.f[DIR_M00])[kw];//[kw ];// + c2over27 ;(D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0])[k];//[kn ];// + c2over27 ;(D.f[DIR_0P0 ])[k ];//kn + real mfbab = (D.f[DIR_0M0])[ks];//[ks ];// + c2over27 ;(D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P])[k];//[kt ];// + c2over27 ;(D.f[DIR_00P ])[k ];//kt + real mfbba = (D.f[DIR_00M])[kb];//[kb ];// + c2over27 ;(D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0])[k];//[kne ];// + c1over54 ;(D.f[DIR_PP0 ])[k ];//kne + real mfaab = (D.f[DIR_MM0])[ksw];//[ksw ];// + c1over54 ;(D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks];//[kse ];// + c1over54 ;(D.f[DIR_PM0 ])[ks ];//kse + real mfacb = (D.f[DIR_MP0])[kw];//[knw ];// + c1over54 ;(D.f[DIR_MP0 ])[kw ];//knw + real mfcbc = (D.f[DIR_P0P])[k];//[kte ];// + c1over54 ;(D.f[DIR_P0P ])[k ];//kte + real mfaba = (D.f[DIR_M0M])[kbw];//[kbw ];// + c1over54 ;(D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb];//[kbe ];// + c1over54 ;(D.f[DIR_P0M ])[kb ];//kbe + real mfabc = (D.f[DIR_M0P])[kw];//[ktw ];// + c1over54 ;(D.f[DIR_M0P ])[kw ];//ktw + real mfbcc = (D.f[DIR_0PP])[k];//[ktn ];// + c1over54 ;(D.f[DIR_0PP ])[k ];//ktn + real mfbaa = (D.f[DIR_0MM])[kbs];//[kbs ];// + c1over54 ;(D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb];//[kbn ];// + c1over54 ;(D.f[DIR_0PM ])[kb ];//kbn + real mfbac = (D.f[DIR_0MP])[ks];//[kts ];// + c1over54 ;(D.f[DIR_0MP ])[ks ];//kts + real mfbbb = (D.f[DIR_000])[k];//[kzero];// + c8over27 ;(D.f[DIR_000])[k ];//kzero + real mfccc = (D.f[DIR_PPP])[k];//[ktne ];// + c1over216;(D.f[DIR_PPP ])[k ];//ktne + real mfaac = (D.f[DIR_MMP])[ksw];//[ktsw ];// + c1over216;(D.f[DIR_MMP ])[ksw];//ktsw + real mfcac = (D.f[DIR_PMP])[ks];//[ktse ];// + c1over216;(D.f[DIR_PMP ])[ks ];//ktse + real mfacc = (D.f[DIR_MPP])[kw];//[ktnw ];// + c1over216;(D.f[DIR_MPP ])[kw ];//ktnw + real mfcca = (D.f[DIR_PPM])[kb];//[kbne ];// + c1over216;(D.f[DIR_PPM ])[kb ];//kbne + real mfaaa = (D.f[DIR_MMM])[kbsw];//[kbsw ];// + c1over216;(D.f[DIR_MMM ])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs];//[kbse ];// + c1over216;(D.f[DIR_PMM ])[kbs];//kbse + real mfaca = (D.f[DIR_MPM])[kbw];//[kbnw ];// + c1over216;(D.f[DIR_MPM ])[kbw];//kbnw //////////////////////////////////////////////////////////////////////////////////// //slow //real oMdrho = one - ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + @@ -730,33 +731,33 @@ extern "C" __global__ void LB_Kernel_MRT_Incomp_SP_27(real omega, //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb;//(D.f[ dirE ])[ke ] = mfabb;// - c2over27 ; (D.f[ dirE ])[k ] - (D.f[dirW])[kw] = mfcbb;//(D.f[ dirW ])[kw ] = mfcbb;// - c2over27 ; (D.f[ dirW ])[kw ] - (D.f[dirN])[k] = mfbab;//(D.f[ dirN ])[kn ] = mfbab;// - c2over27 ; (D.f[ dirN ])[k ] - (D.f[dirS])[ks] = mfbcb;//(D.f[ dirS ])[ks ] = mfbcb;// - c2over27 ; (D.f[ dirS ])[ks ] - (D.f[dirT])[k] = mfbba;//(D.f[ dirT ])[kt ] = mfbba;// - c2over27 ; (D.f[ dirT ])[k ] - (D.f[dirB])[kb] = mfbbc;//(D.f[ dirB ])[kb ] = mfbbc;// - c2over27 ; (D.f[ dirB ])[kb ] - (D.f[dirNE])[k] = mfaab;//(D.f[ dirNE ])[kne ] = mfaab;// - c1over54 ; (D.f[ dirNE ])[k ] - (D.f[dirSW])[ksw] = mfccb;//(D.f[ dirSW ])[ksw ] = mfccb;// - c1over54 ; (D.f[ dirSW ])[ksw ] - (D.f[dirSE])[ks] = mfacb;//(D.f[ dirSE ])[kse ] = mfacb;// - c1over54 ; (D.f[ dirSE ])[ks ] - (D.f[dirNW])[kw] = mfcab;//(D.f[ dirNW ])[knw ] = mfcab;// - c1over54 ; (D.f[ dirNW ])[kw ] - (D.f[dirTE])[k] = mfaba;//(D.f[ dirTE ])[kte ] = mfaba;// - c1over54 ; (D.f[ dirTE ])[k ] - (D.f[dirBW])[kbw] = mfcbc;//(D.f[ dirBW ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ dirBW ])[kbw ] - (D.f[dirBE])[kb] = mfabc;//(D.f[ dirBE ])[kbe ] = mfabc;// - c1over54 ; (D.f[ dirBE ])[kb ] - (D.f[dirTW])[kw] = mfcba;//(D.f[ dirTW ])[ktw ] = mfcba;// - c1over54 ; (D.f[ dirTW ])[kw ] - (D.f[dirTN])[k] = mfbaa;//(D.f[ dirTN ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ dirTN ])[k ] - (D.f[dirBS])[kbs] = mfbcc;//(D.f[ dirBS ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ dirBS ])[kbs ] - (D.f[dirBN])[kb] = mfbac;//(D.f[ dirBN ])[kbn ] = mfbac;// - c1over54 ; (D.f[ dirBN ])[kb ] - (D.f[dirTS])[ks] = mfbca;//(D.f[ dirTS ])[kts ] = mfbca;// - c1over54 ; (D.f[ dirTS ])[ks ] - (D.f[dirZERO])[k] = mfbbb;//(D.f[ dirZERO])[kzero] = mfbbb;// - c8over27 ; (D.f[ dirZERO])[k ] - (D.f[dirTNE])[k] = mfaaa;//(D.f[ dirTNE ])[ktne ] = mfaaa;// - c1over216; (D.f[ dirTNE ])[k ] - (D.f[dirTSE])[ks] = mfaca;//(D.f[ dirTSE ])[ktse ] = mfaca;// - c1over216; (D.f[ dirTSE ])[ks ] - (D.f[dirBNE])[kb] = mfaac;//(D.f[ dirBNE ])[kbne ] = mfaac;// - c1over216; (D.f[ dirBNE ])[kb ] - (D.f[dirBSE])[kbs] = mfacc;//(D.f[ dirBSE ])[kbse ] = mfacc;// - c1over216; (D.f[ dirBSE ])[kbs ] - (D.f[dirTNW])[kw] = mfcaa;//(D.f[ dirTNW ])[ktnw ] = mfcaa;// - c1over216; (D.f[ dirTNW ])[kw ] - (D.f[dirTSW])[ksw] = mfcca;//(D.f[ dirTSW ])[ktsw ] = mfcca;// - c1over216; (D.f[ dirTSW ])[ksw ] - (D.f[dirBNW])[kbw] = mfcac;//(D.f[ dirBNW ])[kbnw ] = mfcac;// - c1over216; (D.f[ dirBNW ])[kbw ] - (D.f[dirBSW])[kbsw] = mfccc;//(D.f[ dirBSW ])[kbsw ] = mfccc;// - c1over216; (D.f[ dirBSW ])[kbsw] + (D.f[DIR_P00])[k] = mfabb;//(D.f[ DIR_P00 ])[ke ] = mfabb;// - c2over27 ; (D.f[ DIR_P00 ])[k ] + (D.f[DIR_M00])[kw] = mfcbb;//(D.f[ DIR_M00 ])[kw ] = mfcbb;// - c2over27 ; (D.f[ DIR_M00 ])[kw ] + (D.f[DIR_0P0])[k] = mfbab;//(D.f[ DIR_0P0 ])[kn ] = mfbab;// - c2over27 ; (D.f[ DIR_0P0 ])[k ] + (D.f[DIR_0M0])[ks] = mfbcb;//(D.f[ DIR_0M0 ])[ks ] = mfbcb;// - c2over27 ; (D.f[ DIR_0M0 ])[ks ] + (D.f[DIR_00P])[k] = mfbba;//(D.f[ DIR_00P ])[kt ] = mfbba;// - c2over27 ; (D.f[ DIR_00P ])[k ] + (D.f[DIR_00M])[kb] = mfbbc;//(D.f[ DIR_00M ])[kb ] = mfbbc;// - c2over27 ; (D.f[ DIR_00M ])[kb ] + (D.f[DIR_PP0])[k] = mfaab;//(D.f[ DIR_PP0 ])[kne ] = mfaab;// - c1over54 ; (D.f[ DIR_PP0 ])[k ] + (D.f[DIR_MM0])[ksw] = mfccb;//(D.f[ DIR_MM0 ])[ksw ] = mfccb;// - c1over54 ; (D.f[ DIR_MM0 ])[ksw ] + (D.f[DIR_PM0])[ks] = mfacb;//(D.f[ DIR_PM0 ])[kse ] = mfacb;// - c1over54 ; (D.f[ DIR_PM0 ])[ks ] + (D.f[DIR_MP0])[kw] = mfcab;//(D.f[ DIR_MP0 ])[knw ] = mfcab;// - c1over54 ; (D.f[ DIR_MP0 ])[kw ] + (D.f[DIR_P0P])[k] = mfaba;//(D.f[ DIR_P0P ])[kte ] = mfaba;// - c1over54 ; (D.f[ DIR_P0P ])[k ] + (D.f[DIR_M0M])[kbw] = mfcbc;//(D.f[ DIR_M0M ])[kbw ] = mfcbc;// - c1over54 ; (D.f[ DIR_M0M ])[kbw ] + (D.f[DIR_P0M])[kb] = mfabc;//(D.f[ DIR_P0M ])[kbe ] = mfabc;// - c1over54 ; (D.f[ DIR_P0M ])[kb ] + (D.f[DIR_M0P])[kw] = mfcba;//(D.f[ DIR_M0P ])[ktw ] = mfcba;// - c1over54 ; (D.f[ DIR_M0P ])[kw ] + (D.f[DIR_0PP])[k] = mfbaa;//(D.f[ DIR_0PP ])[ktn ] = mfbaa;// - c1over54 ; (D.f[ DIR_0PP ])[k ] + (D.f[DIR_0MM])[kbs] = mfbcc;//(D.f[ DIR_0MM ])[kbs ] = mfbcc;// - c1over54 ; (D.f[ DIR_0MM ])[kbs ] + (D.f[DIR_0PM])[kb] = mfbac;//(D.f[ DIR_0PM ])[kbn ] = mfbac;// - c1over54 ; (D.f[ DIR_0PM ])[kb ] + (D.f[DIR_0MP])[ks] = mfbca;//(D.f[ DIR_0MP ])[kts ] = mfbca;// - c1over54 ; (D.f[ DIR_0MP ])[ks ] + (D.f[DIR_000])[k] = mfbbb;//(D.f[ DIR_000])[kzero] = mfbbb;// - c8over27 ; (D.f[ DIR_000])[k ] + (D.f[DIR_PPP])[k] = mfaaa;//(D.f[ DIR_PPP ])[ktne ] = mfaaa;// - c1over216; (D.f[ DIR_PPP ])[k ] + (D.f[DIR_PMP])[ks] = mfaca;//(D.f[ DIR_PMP ])[ktse ] = mfaca;// - c1over216; (D.f[ DIR_PMP ])[ks ] + (D.f[DIR_PPM])[kb] = mfaac;//(D.f[ DIR_PPM ])[kbne ] = mfaac;// - c1over216; (D.f[ DIR_PPM ])[kb ] + (D.f[DIR_PMM])[kbs] = mfacc;//(D.f[ DIR_PMM ])[kbse ] = mfacc;// - c1over216; (D.f[ DIR_PMM ])[kbs ] + (D.f[DIR_MPP])[kw] = mfcaa;//(D.f[ DIR_MPP ])[ktnw ] = mfcaa;// - c1over216; (D.f[ DIR_MPP ])[kw ] + (D.f[DIR_MMP])[ksw] = mfcca;//(D.f[ DIR_MMP ])[ktsw ] = mfcca;// - c1over216; (D.f[ DIR_MMP ])[ksw ] + (D.f[DIR_MPM])[kbw] = mfcac;//(D.f[ DIR_MPM ])[kbnw ] = mfcac;// - c1over216; (D.f[ DIR_MPM ])[kbw ] + (D.f[DIR_MMM])[kbsw] = mfccc;//(D.f[ DIR_MMM ])[kbsw ] = mfccc;// - c1over216; (D.f[ DIR_MMM ])[kbsw] //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cuh index c9a353d6e08c4110a546416fd5185af68b837c65..d3a9fcea7c1a53e4084acf8dc5f1f815d0da967d 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_MRT_Incomp_SP_27(real omega, +__global__ void LB_Kernel_MRT_Incomp_SP_27(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27.cu index 19f62e8a6e89d09c6820b521c7b3f94ef9d3afd4..77527d5bedab08fdcacb3a103727ae25274b2aa4 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27.cu @@ -11,7 +11,7 @@ std::shared_ptr<PMCumulantOneCompSP27> PMCumulantOneCompSP27::getNewInstance(std void PMCumulantOneCompSP27::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -31,11 +31,11 @@ void PMCumulantOneCompSP27::run() for (int i = 0; i < pm.size(); i++) { LB_Kernel_PM_Cum_One_Comp_SP_27 << < grid, threads >> >(para->getParD(level)->omega, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->size_Mat_SP, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, level, para->getForcesDev(), pm[i]->getPorosity(), @@ -43,7 +43,7 @@ void PMCumulantOneCompSP27::run() pm[i]->getForchheimerLBM(), pm[i]->getSizePM(), pm[i]->getHostNodeIDsPM(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_PM_Cum_One_Comp_SP_27 execution failed"); } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27_Device.cu index 2f42b717259aeab052be08b6ef6485771734ad98..89975d1663fb236295c22b81af4b0544ffc489bb 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_PM_Cum_One_Comp_SP_27(real omega, +__global__ void LB_Kernel_PM_Cum_One_Comp_SP_27(real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, @@ -23,63 +24,63 @@ extern "C" __global__ void LB_Kernel_PM_Cum_One_Comp_SP_27(real omega, Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -106,33 +107,33 @@ extern "C" __global__ void LB_Kernel_PM_Cum_One_Comp_SP_27(real omega, unsigned int kbs = neighborZ[ks]; unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k]; - real mfabb = (D.f[dirW])[kw]; - real mfbcb = (D.f[dirN])[k]; - real mfbab = (D.f[dirS])[ks]; - real mfbbc = (D.f[dirT])[k]; - real mfbba = (D.f[dirB])[kb]; - real mfccb = (D.f[dirNE])[k]; - real mfaab = (D.f[dirSW])[ksw]; - real mfcab = (D.f[dirSE])[ks]; - real mfacb = (D.f[dirNW])[kw]; - real mfcbc = (D.f[dirTE])[k]; - real mfaba = (D.f[dirBW])[kbw]; - real mfcba = (D.f[dirBE])[kb]; - real mfabc = (D.f[dirTW])[kw]; - real mfbcc = (D.f[dirTN])[k]; - real mfbaa = (D.f[dirBS])[kbs]; - real mfbca = (D.f[dirBN])[kb]; - real mfbac = (D.f[dirTS])[ks]; - real mfbbb = (D.f[dirZERO])[k]; - real mfccc = (D.f[dirTNE])[k]; - real mfaac = (D.f[dirTSW])[ksw]; - real mfcac = (D.f[dirTSE])[ks]; - real mfacc = (D.f[dirTNW])[kw]; - real mfcca = (D.f[dirBNE])[kb]; - real mfaaa = (D.f[dirBSW])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs]; - real mfaca = (D.f[dirBNW])[kbw]; + real mfcbb = (D.f[DIR_P00])[k]; + real mfabb = (D.f[DIR_M00])[kw]; + real mfbcb = (D.f[DIR_0P0])[k]; + real mfbab = (D.f[DIR_0M0])[ks]; + real mfbbc = (D.f[DIR_00P])[k]; + real mfbba = (D.f[DIR_00M])[kb]; + real mfccb = (D.f[DIR_PP0])[k]; + real mfaab = (D.f[DIR_MM0])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks]; + real mfacb = (D.f[DIR_MP0])[kw]; + real mfcbc = (D.f[DIR_P0P])[k]; + real mfaba = (D.f[DIR_M0M])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb]; + real mfabc = (D.f[DIR_M0P])[kw]; + real mfbcc = (D.f[DIR_0PP])[k]; + real mfbaa = (D.f[DIR_0MM])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb]; + real mfbac = (D.f[DIR_0MP])[ks]; + real mfbbb = (D.f[DIR_000])[k]; + real mfccc = (D.f[DIR_PPP])[k]; + real mfaac = (D.f[DIR_MMP])[ksw]; + real mfcac = (D.f[DIR_PMP])[ks]; + real mfacc = (D.f[DIR_MPP])[kw]; + real mfcca = (D.f[DIR_PPM])[kb]; + real mfaaa = (D.f[DIR_MMM])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs]; + real mfaca = (D.f[DIR_MPM])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -903,33 +904,33 @@ extern "C" __global__ void LB_Kernel_PM_Cum_One_Comp_SP_27(real omega, //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb; - (D.f[dirW])[kw] = mfcbb; - (D.f[dirN])[k] = mfbab; - (D.f[dirS])[ks] = mfbcb; - (D.f[dirT])[k] = mfbba; - (D.f[dirB])[kb] = mfbbc; - (D.f[dirNE])[k] = mfaab; - (D.f[dirSW])[ksw] = mfccb; - (D.f[dirSE])[ks] = mfacb; - (D.f[dirNW])[kw] = mfcab; - (D.f[dirTE])[k] = mfaba; - (D.f[dirBW])[kbw] = mfcbc; - (D.f[dirBE])[kb] = mfabc; - (D.f[dirTW])[kw] = mfcba; - (D.f[dirTN])[k] = mfbaa; - (D.f[dirBS])[kbs] = mfbcc; - (D.f[dirBN])[kb] = mfbac; - (D.f[dirTS])[ks] = mfbca; - (D.f[dirZERO])[k] = mfbbb; - (D.f[dirTNE])[k] = mfaaa; - (D.f[dirTSE])[ks] = mfaca; - (D.f[dirBNE])[kb] = mfaac; - (D.f[dirBSE])[kbs] = mfacc; - (D.f[dirTNW])[kw] = mfcaa; - (D.f[dirTSW])[ksw] = mfcca; - (D.f[dirBNW])[kbw] = mfcac; - (D.f[dirBSW])[kbsw] = mfccc; + (D.f[DIR_P00])[k] = mfabb; + (D.f[DIR_M00])[kw] = mfcbb; + (D.f[DIR_0P0])[k] = mfbab; + (D.f[DIR_0M0])[ks] = mfbcb; + (D.f[DIR_00P])[k] = mfbba; + (D.f[DIR_00M])[kb] = mfbbc; + (D.f[DIR_PP0])[k] = mfaab; + (D.f[DIR_MM0])[ksw] = mfccb; + (D.f[DIR_PM0])[ks] = mfacb; + (D.f[DIR_MP0])[kw] = mfcab; + (D.f[DIR_P0P])[k] = mfaba; + (D.f[DIR_M0M])[kbw] = mfcbc; + (D.f[DIR_P0M])[kb] = mfabc; + (D.f[DIR_M0P])[kw] = mfcba; + (D.f[DIR_0PP])[k] = mfbaa; + (D.f[DIR_0MM])[kbs] = mfbcc; + (D.f[DIR_0PM])[kb] = mfbac; + (D.f[DIR_0MP])[ks] = mfbca; + (D.f[DIR_000])[k] = mfbbb; + (D.f[DIR_PPP])[k] = mfaaa; + (D.f[DIR_PMP])[ks] = mfaca; + (D.f[DIR_PPM])[kb] = mfaac; + (D.f[DIR_PMM])[kbs] = mfacc; + (D.f[DIR_MPP])[kw] = mfcaa; + (D.f[DIR_MMP])[ksw] = mfcca; + (D.f[DIR_MPM])[kbw] = mfcac; + (D.f[DIR_MMM])[kbsw] = mfccc; //////////////////////////////////////////////////////////////////////////////////// } } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27_Device.cuh index e02e8abe1321d4b9b47872f9a5e7c5414a587531..6533c604f32a478cdc6a097e4dd7d0b56e48150d 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/CumulantOne/PMCumulantOneCompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_PM_Cum_One_Comp_SP_27(real omega, +__global__ void LB_Kernel_PM_Cum_One_Comp_SP_27(real omega, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim.cu new file mode 100644 index 0000000000000000000000000000000000000000..a9d518d14a286ae3f6b565176969162994afa269 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim.cu @@ -0,0 +1,57 @@ +#include "TurbulentViscosityCumulantK17CompChim.h" +#include "cuda/CudaGrid.h" +#include <logger/Logger.h> +#include "Parameter/Parameter.h" +#include "TurbulentViscosityCumulantK17CompChim_Device.cuh" + +template<TurbulenceModel turbulenceModel> +std::shared_ptr< TurbulentViscosityCumulantK17CompChim<turbulenceModel> > TurbulentViscosityCumulantK17CompChim<turbulenceModel>::getNewInstance(std::shared_ptr<Parameter> para, int level) +{ + return std::shared_ptr<TurbulentViscosityCumulantK17CompChim<turbulenceModel> >(new TurbulentViscosityCumulantK17CompChim<turbulenceModel>(para,level)); +} + +template<TurbulenceModel turbulenceModel> +void TurbulentViscosityCumulantK17CompChim<turbulenceModel>::run() +{ + vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, para->getParH(level)->numberOfNodes); + + LB_Kernel_TurbulentViscosityCumulantK17CompChim < turbulenceModel > <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, + para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->rho, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->turbViscosity, + para->getSGSConstant(), + (unsigned long)para->getParD(level)->numberOfNodes, + level, + para->getIsBodyForce(), + para->getForcesDev(), + para->getParD(level)->forceX_SP, + para->getParD(level)->forceY_SP, + para->getParD(level)->forceZ_SP, + para->getQuadricLimitersDev(), + para->getParD(level)->isEvenTimestep); + + getLastCudaError("LB_Kernel_TurbulentViscosityCumulantK17CompChim execution failed"); +} + +template<TurbulenceModel turbulenceModel> +TurbulentViscosityCumulantK17CompChim<turbulenceModel>::TurbulentViscosityCumulantK17CompChim(std::shared_ptr<Parameter> para, int level) +{ + this->para = para; + this->level = level; + + myPreProcessorTypes.push_back(InitCompSP27); + + myKernelGroup = BasicKernel; + + VF_LOG_INFO("Using turbulence model: {}", turbulenceModel); +} + +template class TurbulentViscosityCumulantK17CompChim<TurbulenceModel::AMD>; +template class TurbulentViscosityCumulantK17CompChim<TurbulenceModel::Smagorinsky>; +template class TurbulentViscosityCumulantK17CompChim<TurbulenceModel::QR>; diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim.h new file mode 100644 index 0000000000000000000000000000000000000000..0d35b68c916e54c6ec6eeeacd7189fe4d9a33c10 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim.h @@ -0,0 +1,19 @@ +#ifndef TurbulentViscosityCUMULANT_K17_COMP_CHIM_H +#define TurbulentViscosityCUMULANT_K17_COMP_CHIM_H + +#include "Kernel/KernelImp.h" +#include "Parameter/Parameter.h" + +template<TurbulenceModel turbulenceModel> +class TurbulentViscosityCumulantK17CompChim : public KernelImp +{ +public: + static std::shared_ptr< TurbulentViscosityCumulantK17CompChim<turbulenceModel> > getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + TurbulentViscosityCumulantK17CompChim(); + TurbulentViscosityCumulantK17CompChim(std::shared_ptr<Parameter> para, int level); +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim_Device.cu new file mode 100644 index 0000000000000000000000000000000000000000..32350b95107b68103af0f238fefe095882919092 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim_Device.cu @@ -0,0 +1,687 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file TurbulentViscosityCumulantK17CompChim_Device.cu +//! \author Henry Korb, Henrik Asmuth +//! \date 16/05/2022 +//! \brief CumulantK17CompChim kernel by Martin Schönherr that inlcudes turbulent viscosity and other small mods. +//! +//! Additions to CumulantK17CompChim: +//! - can incorporate local body force +//! - when applying a local body force, the total round of error of forcing+bodyforce is saved and added in next time step +//! - uses turbulent viscosity that is computed in separate kernel (as of now AMD) +//! - saves macroscopic values (needed for instance for probes, AMD, and actuator models) +//! +//======================================================================================= +/* Device code */ +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" +#include <lbm/constants/NumericConstants.h> +#include "Kernel/Utilities/DistributionHelper.cuh" + +#include "GPU/TurbulentViscosityInlines.cuh" + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; +#include "Kernel/Utilities/ChimeraTransformation.h" + + +//////////////////////////////////////////////////////////////////////////////// +template<TurbulenceModel turbulenceModel> +__global__ void LB_Kernel_TurbulentViscosityCumulantK17CompChim( + real omega_in, + uint* typeOfGridNode, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + real* distributions, + real* rho, + real* vx, + real* vy, + real* vz, + real* turbulentViscosity, + real SGSconstant, + unsigned long size_Mat, + int level, + bool bodyForce, + real* forces, + real* bodyForceX, + real* bodyForceY, + real* bodyForceZ, + real* quadricLimiters, + bool isEvenTimestep) +{ + ////////////////////////////////////////////////////////////////////////// + //! Cumulant K17 Kernel is based on \ref + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> and \ref <a href="https://doi.org/10.1016/j.jcp.2017.07.004"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.07.004 ]</b></a> + //! + //! The cumulant kernel is executed in the following steps + //! + //////////////////////////////////////////////////////////////////////////////// + //! - Get node index coordinates from threadIdx, blockIdx, blockDim and gridDim. + //! + const unsigned k_000 = vf::gpu::getNodeIndex(); + + ////////////////////////////////////////////////////////////////////////// + // run for all indices in size_Mat and fluid nodes + if ((k_000 < size_Mat) && (typeOfGridNode[k_000] == GEO_FLUID)) { + ////////////////////////////////////////////////////////////////////////// + //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on + //! timestep is based on the esoteric twist algorithm \ref <a + //! href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), + //! DOI:10.3390/computation5020019 ]</b></a> + //! + Distributions27 dist = vf::gpu::getDistributionReferences27(distributions, size_Mat, isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////// + //! - Set neighbor indices (necessary for indirect addressing) + uint k_M00 = neighborX[k_000]; + uint k_0M0 = neighborY[k_000]; + uint k_00M = neighborZ[k_000]; + uint k_MM0 = neighborY[k_M00]; + uint k_M0M = neighborZ[k_M00]; + uint k_0MM = neighborZ[k_0M0]; + uint k_MMM = neighborZ[k_MM0]; + //////////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions + //! + real f_000 = (dist.f[DIR_000])[k_000]; + real f_P00 = (dist.f[DIR_P00])[k_000]; + real f_M00 = (dist.f[DIR_M00])[k_M00]; + real f_0P0 = (dist.f[DIR_0P0])[k_000]; + real f_0M0 = (dist.f[DIR_0M0])[k_0M0]; + real f_00P = (dist.f[DIR_00P])[k_000]; + real f_00M = (dist.f[DIR_00M])[k_00M]; + real f_PP0 = (dist.f[DIR_PP0])[k_000]; + real f_MM0 = (dist.f[DIR_MM0])[k_MM0]; + real f_PM0 = (dist.f[DIR_PM0])[k_0M0]; + real f_MP0 = (dist.f[DIR_MP0])[k_M00]; + real f_P0P = (dist.f[DIR_P0P])[k_000]; + real f_M0M = (dist.f[DIR_M0M])[k_M0M]; + real f_P0M = (dist.f[DIR_P0M])[k_00M]; + real f_M0P = (dist.f[DIR_M0P])[k_M00]; + real f_0PP = (dist.f[DIR_0PP])[k_000]; + real f_0MM = (dist.f[DIR_0MM])[k_0MM]; + real f_0PM = (dist.f[DIR_0PM])[k_00M]; + real f_0MP = (dist.f[DIR_0MP])[k_0M0]; + real f_PPP = (dist.f[DIR_PPP])[k_000]; + real f_MPP = (dist.f[DIR_MPP])[k_M00]; + real f_PMP = (dist.f[DIR_PMP])[k_0M0]; + real f_MMP = (dist.f[DIR_MMP])[k_MM0]; + real f_PPM = (dist.f[DIR_PPM])[k_00M]; + real f_MPM = (dist.f[DIR_MPM])[k_M0M]; + real f_PMM = (dist.f[DIR_PMM])[k_0MM]; + real f_MMM = (dist.f[DIR_MMM])[k_MMM]; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Define aliases to use the same variable for the moments (m's): + //! + real& m_111 = f_000; + real& m_211 = f_P00; + real& m_011 = f_M00; + real& m_121 = f_0P0; + real& m_101 = f_0M0; + real& m_112 = f_00P; + real& m_110 = f_00M; + real& m_221 = f_PP0; + real& m_001 = f_MM0; + real& m_201 = f_PM0; + real& m_021 = f_MP0; + real& m_212 = f_P0P; + real& m_010 = f_M0M; + real& m_210 = f_P0M; + real& m_012 = f_M0P; + real& m_122 = f_0PP; + real& m_100 = f_0MM; + real& m_120 = f_0PM; + real& m_102 = f_0MP; + real& m_222 = f_PPP; + real& m_022 = f_MPP; + real& m_202 = f_PMP; + real& m_002 = f_MMP; + real& m_220 = f_PPM; + real& m_020 = f_MPM; + real& m_200 = f_PMM; + real& m_000 = f_MMM; + + //////////////////////////////////////////////////////(unsigned long)////////////////////////////// + //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + real drho = ((((f_PPP + f_MMM) + (f_MPM + f_PMP)) + ((f_MPP + f_PMM) + (f_MMP + f_PPM))) + + (((f_0MP + f_0PM) + (f_0MM + f_0PP)) + ((f_M0P + f_P0M) + (f_M0M + f_P0P)) + + ((f_MP0 + f_PM0) + (f_MM0 + f_PP0))) + + ((f_M00 + f_P00) + (f_0M0 + f_0P0) + (f_00M + f_00P))) + + f_000; + + real oneOverRho = c1o1 / (c1o1 + drho); + + real vvx = ((((f_PPP - f_MMM) + (f_PMP - f_MPM)) + ((f_PMM - f_MPP) + (f_PPM - f_MMP))) + + (((f_P0M - f_M0P) + (f_P0P - f_M0M)) + ((f_PM0 - f_MP0) + (f_PP0 - f_MM0))) + (f_P00 - f_M00)) * + oneOverRho; + real vvy = ((((f_PPP - f_MMM) + (f_MPM - f_PMP)) + ((f_MPP - f_PMM) + (f_PPM - f_MMP))) + + (((f_0PM - f_0MP) + (f_0PP - f_0MM)) + ((f_MP0 - f_PM0) + (f_PP0 - f_MM0))) + (f_0P0 - f_0M0)) * + oneOverRho; + real vvz = ((((f_PPP - f_MMM) + (f_PMP - f_MPM)) + ((f_MPP - f_PMM) + (f_MMP - f_PPM))) + + (((f_0MP - f_0PM) + (f_0PP - f_0MM)) + ((f_M0P - f_P0M) + (f_P0P - f_M0M))) + (f_00P - f_00M)) * + oneOverRho; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Add half of the acceleration (body force) to the velocity as in Eq. (42) \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + real factor = c1o1; + for (size_t i = 1; i <= level; i++) { + factor *= c2o1; + } + + real fx = forces[0]; + real fy = forces[1]; + real fz = forces[2]; + + if( bodyForce ){ + fx += bodyForceX[k_000]; + fy += bodyForceY[k_000]; + fz += bodyForceZ[k_000]; + + real vx = vvx; + real vy = vvy; + real vz = vvz; + real acc_x = fx * c1o2 / factor; + real acc_y = fy * c1o2 / factor; + real acc_z = fz * c1o2 / factor; + + vvx += acc_x; + vvy += acc_y; + vvz += acc_z; + + // // Reset body force. To be used when not using round-off correction. + // bodyForceX[k] = 0.0f; + // bodyForceY[k] = 0.0f; + // bodyForceZ[k] = 0.0f; + + //////////////////////////////////////////////////////////////////////////////////// + //!> Round-off correction + //! + //!> Similar to Kahan summation algorithm (https://en.wikipedia.org/wiki/Kahan_summation_algorithm) + //!> Essentially computes the round-off error of the applied force and adds it in the next time step as a compensation. + //!> Seems to be necesseary at very high Re boundary layers, where the forcing and velocity can + //!> differ by several orders of magnitude. + //!> \note 16/05/2022: Testing, still ongoing! + //! + bodyForceX[k_000] = (acc_x-(vvx-vx))*factor*c2o1; + bodyForceY[k_000] = (acc_y-(vvy-vy))*factor*c2o1; + bodyForceZ[k_000] = (acc_z-(vvz-vz))*factor*c2o1; + } + else{ + vvx += fx * c1o2 / factor; + vvy += fy * c1o2 / factor; + vvz += fz * c1o2 / factor; + } + + + //////////////////////////////////////////////////////////////////////////////////// + // calculate the square of velocities for this lattice node + real vx2 = vvx * vvx; + real vy2 = vvy * vvy; + real vz2 = vvz * vvz; + //////////////////////////////////////////////////////////////////////////////////// + //! - Set relaxation limiters for third order cumulants to default value \f$ \lambda=0.001 \f$ according to + //! section 6 in \ref <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + real quadricLimitP = quadricLimiters[0]; + real quadricLimitM = quadricLimiters[1]; + real quadricLimitD = quadricLimiters[2]; + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (6)-(14) in \ref <a + //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + forwardInverseChimeraWithK(f_MMM, f_MM0, f_MMP, vvz, vz2, c36o1, c1o36); + forwardInverseChimeraWithK(f_M0M, f_M00, f_M0P, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(f_MPM, f_MP0, f_MPP, vvz, vz2, c36o1, c1o36); + forwardInverseChimeraWithK(f_0MM, f_0M0, f_0MP, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(f_00M, f_000, f_00P, vvz, vz2, c9o4, c4o9); + forwardInverseChimeraWithK(f_0PM, f_0P0, f_0PP, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(f_PMM, f_PM0, f_PMP, vvz, vz2, c36o1, c1o36); + forwardInverseChimeraWithK(f_P0M, f_P00, f_P0P, vvz, vz2, c9o1, c1o9); + forwardInverseChimeraWithK(f_PPM, f_PP0, f_PPP, vvz, vz2, c36o1, c1o36); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + forwardInverseChimeraWithK(f_MMM, f_M0M, f_MPM, vvy, vy2, c6o1, c1o6); + forwardChimera( f_MM0, f_M00, f_MP0, vvy, vy2); + forwardInverseChimeraWithK(f_MMP, f_M0P, f_MPP, vvy, vy2, c18o1, c1o18); + forwardInverseChimeraWithK(f_0MM, f_00M, f_0PM, vvy, vy2, c3o2, c2o3); + forwardChimera( f_0M0, f_000, f_0P0, vvy, vy2); + forwardInverseChimeraWithK(f_0MP, f_00P, f_0PP, vvy, vy2, c9o2, c2o9); + forwardInverseChimeraWithK(f_PMM, f_P0M, f_PPM, vvy, vy2, c6o1, c1o6); + forwardChimera( f_PM0, f_P00, f_PP0, vvy, vy2); + forwardInverseChimeraWithK(f_PMP, f_P0P, f_PPP, vvy, vy2, c18o1, c1o18); + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + forwardInverseChimeraWithK(f_MMM, f_0MM, f_PMM, vvx, vx2, c1o1, c1o1); + forwardChimera( f_M0M, f_00M, f_P0M, vvx, vx2); + forwardInverseChimeraWithK(f_MPM, f_0PM, f_PPM, vvx, vx2, c3o1, c1o3); + forwardChimera( f_MM0, f_0M0, f_PM0, vvx, vx2); + forwardChimera( f_M00, f_000, f_P00, vvx, vx2); + forwardChimera( f_MP0, f_0P0, f_PP0, vvx, vx2); + forwardInverseChimeraWithK(f_MMP, f_0MP, f_PMP, vvx, vx2, c3o1, c1o3); + forwardChimera( f_M0P, f_00P, f_P0P, vvx, vx2); + forwardInverseChimeraWithK(f_MPP, f_0PP, f_PPP, vvx, vx2, c3o1, c1o9); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Setting relaxation rates for non-hydrodynamic cumulants (default values). Variable names and equations + //! according to <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! => [NAME IN PAPER]=[NAME IN CODE]=[DEFAULT VALUE]. + //! - Trace of second order cumulants \f$ C_{200}+C_{020}+C_{002} \f$ used to adjust bulk + //! viscosity:\f$\omega_2=OxxPyyPzz=1.0 \f$. + //! - Third order cumulants \f$ C_{120}+C_{102}, C_{210}+C_{012}, C_{201}+C_{021} \f$: \f$ \omega_3=OxyyPxzz + //! \f$ set according to Eq. (111) with simplifications assuming \f$ \omega_2=1.0\f$. + //! - Third order cumulants \f$ C_{120}-C_{102}, C_{210}-C_{012}, C_{201}-C_{021} \f$: \f$ \omega_4 = OxyyMxzz + //! \f$ set according to Eq. (112) with simplifications assuming \f$ \omega_2 = 1.0\f$. + //! - Third order cumulants \f$ C_{111} \f$: \f$ \omega_5 = Oxyz \f$ set according to Eq. (113) with + //! simplifications assuming \f$ \omega_2 = 1.0\f$ (modify for different bulk viscosity). + //! - Fourth order cumulants \f$ C_{220}, C_{202}, C_{022}, C_{211}, C_{121}, C_{112} \f$: for simplification + //! all set to the same default value \f$ \omega_6=\omega_7=\omega_8=O4=1.0 \f$. + //! - Fifth order cumulants \f$ C_{221}, C_{212}, C_{122}\f$: \f$\omega_9=O5=1.0\f$. + //! - Sixth order cumulant \f$ C_{222}\f$: \f$\omega_{10}=O6=1.0\f$. + //! + //////////////////////////////////////////////////////////////////////////////////// + //! - Calculate modified omega with turbulent viscosity + //! + real omega = omega_in / (c1o1 + c3o1*omega_in*turbulentViscosity[k_000]); + //////////////////////////////////////////////////////////// + // 2. + real OxxPyyPzz = c1o1; + //////////////////////////////////////////////////////////// + // 3. + real OxyyPxzz = c8o1 * (-c2o1 + omega) * (c1o1 + c2o1 * omega) / (-c8o1 - c14o1 * omega + c7o1 * omega * omega); + real OxyyMxzz = + c8o1 * (-c2o1 + omega) * (-c7o1 + c4o1 * omega) / (c56o1 - c50o1 * omega + c9o1 * omega * omega); + real Oxyz = c24o1 * (-c2o1 + omega) * (-c2o1 - c7o1 * omega + c3o1 * omega * omega) / + (c48o1 + c152o1 * omega - c130o1 * omega * omega + c29o1 * omega * omega * omega); + //////////////////////////////////////////////////////////// + // 4. + real O4 = c1o1; + //////////////////////////////////////////////////////////// + // 5. + real O5 = c1o1; + //////////////////////////////////////////////////////////// + // 6. + real O6 = c1o1; + + //////////////////////////////////////////////////////////////////////////////////// + //! - A and DIR_00M: parameters for fourth order convergence of the diffusion term according to Eq. (115) and (116) + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> with simplifications assuming \f$ \omega_2 = 1.0 \f$ (modify for + //! different bulk viscosity). + //! + real factorA = (c4o1 + c2o1 * omega - c3o1 * omega * omega) / (c2o1 - c7o1 * omega + c5o1 * omega * omega); + real factorB = (c4o1 + c28o1 * omega - c14o1 * omega * omega) / (c6o1 - c21o1 * omega + c15o1 * omega * omega); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute cumulants from central moments according to Eq. (20)-(23) in + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + //////////////////////////////////////////////////////////// + // 4. + real c_211 = m_211 - ((m_200 + c1o3) * m_011 + c2o1 * m_110 * m_101) * oneOverRho; + real c_121 = m_121 - ((m_020 + c1o3) * m_101 + c2o1 * m_110 * m_011) * oneOverRho; + real c_112 = m_112 - ((m_002 + c1o3) * m_110 + c2o1 * m_101 * m_011) * oneOverRho; + + real c_220 = m_220 - (((m_200 * m_020 + c2o1 * m_110 * m_110) + c1o3 * (m_200 + m_020)) * oneOverRho - c1o9 * (drho * oneOverRho)); + real c_202 = m_202 - (((m_200 * m_002 + c2o1 * m_101 * m_101) + c1o3 * (m_200 + m_002)) * oneOverRho - c1o9 * (drho * oneOverRho)); + real c_022 = m_022 - (((m_002 * m_020 + c2o1 * m_011 * m_011) + c1o3 * (m_002 + m_020)) * oneOverRho - c1o9 * (drho * oneOverRho)); + //////////////////////////////////////////////////////////// + // 5. + real c_122 = + m_122 - ((m_002 * m_120 + m_020 * m_102 + c4o1 * m_011 * m_111 + c2o1 * (m_101 * m_021 + m_110 * m_012)) + + c1o3 * (m_120 + m_102)) * + oneOverRho; + real c_212 = + m_212 - ((m_002 * m_210 + m_200 * m_012 + c4o1 * m_101 * m_111 + c2o1 * (m_011 * m_201 + m_110 * m_102)) + + c1o3 * (m_210 + m_012)) * + oneOverRho; + real c_221 = + m_221 - ((m_200 * m_021 + m_020 * m_201 + c4o1 * m_110 * m_111 + c2o1 * (m_101 * m_120 + m_011 * m_210)) + + c1o3 * (m_021 + m_201)) * + oneOverRho; + //////////////////////////////////////////////////////////// + // 6. + real c_222 = m_222 + ((-c4o1 * m_111 * m_111 - (m_200 * m_022 + m_020 * m_202 + m_002 * m_220) - + c4o1 * (m_011 * m_211 + m_101 * m_121 + m_110 * m_112) - + c2o1 * (m_120 * m_102 + m_210 * m_012 + m_201 * m_021)) * + oneOverRho + + (c4o1 * (m_101 * m_101 * m_020 + m_011 * m_011 * m_200 + m_110 * m_110 * m_002) + + c2o1 * (m_200 * m_020 * m_002) + c16o1 * m_110 * m_101 * m_011) * + oneOverRho * oneOverRho - + c1o3 * (m_022 + m_202 + m_220) * oneOverRho - c1o9 * (m_200 + m_020 + m_002) * oneOverRho + + (c2o1 * (m_101 * m_101 + m_011 * m_011 + m_110 * m_110) + + (m_002 * m_020 + m_002 * m_200 + m_020 * m_200) + c1o3 * (m_002 + m_020 + m_200)) * + oneOverRho * oneOverRho * c2o3 + + c1o27 * ((drho * drho - drho) * oneOverRho * oneOverRho)); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute linear combinations of second and third order cumulants + //! + //////////////////////////////////////////////////////////// + // 2. + real mxxPyyPzz = m_200 + m_020 + m_002; + real mxxMyy = m_200 - m_020; + real mxxMzz = m_200 - m_002; + //////////////////////////////////////////////////////////// + // 3. + real mxxyPyzz = m_210 + m_012; + real mxxyMyzz = m_210 - m_012; + + real mxxzPyyz = m_201 + m_021; + real mxxzMyyz = m_201 - m_021; + + real mxyyPxzz = m_120 + m_102; + real mxyyMxzz = m_120 - m_102; + + //////////////////////////////////////////////////////////////////////////////////// + // incl. correction + //////////////////////////////////////////////////////////// + //! - Compute velocity gradients from second order cumulants according to Eq. (27)-(32) + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> Further explanations of the correction in viscosity in Appendix H of + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> Note that the division by rho is omitted here as we need rho times + //! the gradients later. + //! + real Dxy = -c3o1 * omega * m_110; + real Dxz = -c3o1 * omega * m_101; + real Dyz = -c3o1 * omega * m_011; + real dxux = c1o2 * (-omega) * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (m_000 - mxxPyyPzz); + real dyuy = dxux + omega * c3o2 * mxxMyy; + real dzuz = dxux + omega * c3o2 * mxxMzz; + + //////////////////////////////////////////////////////////////////////////////////// + switch (turbulenceModel) + { + case TurbulenceModel::AMD: //AMD is computed in separate kernel + break; + case TurbulenceModel::Smagorinsky: + turbulentViscosity[k_000] = calcTurbulentViscositySmagorinsky(SGSconstant, dxux, dyuy, dzuz, Dxy, Dxz , Dyz); + break; + case TurbulenceModel::QR: + turbulentViscosity[k_000] = calcTurbulentViscosityQR(SGSconstant, dxux, dyuy, dzuz, Dxy, Dxz , Dyz); + break; + default: + break; + } + //////////////////////////////////////////////////////////// + //! - Relaxation of second order cumulants with correction terms according to Eq. (33)-(35) in + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + mxxPyyPzz += OxxPyyPzz * (m_000 - mxxPyyPzz) - c3o1 * (c1o1 - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); + mxxMyy += omega * (-mxxMyy) - c3o1 * (c1o1 + c1o2 * (-omega)) * (vx2 * dxux - vy2 * dyuy); + mxxMzz += omega * (-mxxMzz) - c3o1 * (c1o1 + c1o2 * (-omega)) * (vx2 * dxux - vz2 * dzuz); + + //////////////////////////////////////////////////////////////////////////////////// + ////no correction + // mxxPyyPzz += OxxPyyPzz*(mfaaa - mxxPyyPzz); + // mxxMyy += -(-omega) * (-mxxMyy); + // mxxMzz += -(-omega) * (-mxxMzz); + ////////////////////////////////////////////////////////////////////////// + m_011 += omega * (-m_011); + m_101 += omega * (-m_101); + m_110 += omega * (-m_110); + + //////////////////////////////////////////////////////////////////////////////////// + // relax + ////////////////////////////////////////////////////////////////////////// + // incl. limiter + //! - Relaxation of third order cumulants including limiter according to Eq. (116)-(123) + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + real wadjust = Oxyz + (c1o1 - Oxyz) * abs(m_111) / (abs(m_111) + quadricLimitD); + m_111 += wadjust * (-m_111); + wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxxyPyzz) / (abs(mxxyPyzz) + quadricLimitP); + mxxyPyzz += wadjust * (-mxxyPyzz); + wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxxyMyzz) / (abs(mxxyMyzz) + quadricLimitM); + mxxyMyzz += wadjust * (-mxxyMyzz); + wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxxzPyyz) / (abs(mxxzPyyz) + quadricLimitP); + mxxzPyyz += wadjust * (-mxxzPyyz); + wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxxzMyyz) / (abs(mxxzMyyz) + quadricLimitM); + mxxzMyyz += wadjust * (-mxxzMyyz); + wadjust = OxyyPxzz + (c1o1 - OxyyPxzz) * abs(mxyyPxzz) / (abs(mxyyPxzz) + quadricLimitP); + mxyyPxzz += wadjust * (-mxyyPxzz); + wadjust = OxyyMxzz + (c1o1 - OxyyMxzz) * abs(mxyyMxzz) / (abs(mxyyMxzz) + quadricLimitM); + mxyyMxzz += wadjust * (-mxyyMxzz); + ////////////////////////////////////////////////////////////////////////// + // no limiter + // mfbbb += OxyyMxzz * (-mfbbb); + // mxxyPyzz += OxyyPxzz * (-mxxyPyzz); + // mxxyMyzz += OxyyMxzz * (-mxxyMyzz); + // mxxzPyyz += OxyyPxzz * (-mxxzPyyz); + // mxxzMyyz += OxyyMxzz * (-mxxzMyyz); + // mxyyPxzz += OxyyPxzz * (-mxyyPxzz); + // mxyyMxzz += OxyyMxzz * (-mxyyMxzz); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute inverse linear combinations of second and third order cumulants + //! + m_200 = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); + m_020 = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz); + m_002 = c1o3 * (mxxMyy - c2o1 * mxxMzz + mxxPyyPzz); + + m_210 = ( mxxyMyzz + mxxyPyzz) * c1o2; + m_012 = (-mxxyMyzz + mxxyPyzz) * c1o2; + m_201 = ( mxxzMyyz + mxxzPyyz) * c1o2; + m_021 = (-mxxzMyyz + mxxzPyyz) * c1o2; + m_120 = ( mxyyMxzz + mxyyPxzz) * c1o2; + m_102 = (-mxyyMxzz + mxyyPxzz) * c1o2; + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // 4. + // no limiter + //! - Relax fourth order cumulants to modified equilibrium for fourth order convergence of diffusion according + //! to Eq. (43)-(48) <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + c_022 = -O4 * (c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * factorA + (c1o1 - O4) * (c_022); + c_202 = -O4 * (c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * factorA + (c1o1 - O4) * (c_202); + c_220 = -O4 * (c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * factorA + (c1o1 - O4) * (c_220); + c_112 = -O4 * (c1o1 / omega - c1o2) * Dxy * c1o3 * factorB + (c1o1 - O4) * (c_112); + c_121 = -O4 * (c1o1 / omega - c1o2) * Dxz * c1o3 * factorB + (c1o1 - O4) * (c_121); + c_211 = -O4 * (c1o1 / omega - c1o2) * Dyz * c1o3 * factorB + (c1o1 - O4) * (c_211); + + + ////////////////////////////////////////////////////////////////////////// + // 5. + c_122 += O5 * (-c_122); + c_212 += O5 * (-c_212); + c_221 += O5 * (-c_221); + + ////////////////////////////////////////////////////////////////////////// + // 6. + c_222 += O6 * (-c_222); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Compute central moments from post collision cumulants according to Eq. (53)-(56) in + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), + //! DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + + ////////////////////////////////////////////////////////////////////////// + // 4. + m_211 = c_211 + c1o3 * ((c3o1 * m_200 + c1o1) * m_011 + c6o1 * m_110 * m_101) * oneOverRho; + m_121 = c_121 + c1o3 * ((c3o1 * m_020 + c1o1) * m_101 + c6o1 * m_110 * m_011) * oneOverRho; + m_112 = c_112 + c1o3 * ((c3o1 * m_002 + c1o1) * m_110 + c6o1 * m_101 * m_011) * oneOverRho; + + m_220 = + c_220 + (((m_200 * m_020 + c2o1 * m_110 * m_110) * c9o1 + c3o1 * (m_200 + m_020)) * oneOverRho - (drho * oneOverRho)) * c1o9; + m_202 = + c_202 + (((m_200 * m_002 + c2o1 * m_101 * m_101) * c9o1 + c3o1 * (m_200 + m_002)) * oneOverRho - (drho * oneOverRho)) * c1o9; + m_022 = + c_022 + (((m_002 * m_020 + c2o1 * m_011 * m_011) * c9o1 + c3o1 * (m_002 + m_020)) * oneOverRho - (drho * oneOverRho)) * c1o9; + + ////////////////////////////////////////////////////////////////////////// + // 5. + m_122 = c_122 + c1o3 * + (c3o1 * (m_002 * m_120 + m_020 * m_102 + c4o1 * m_011 * m_111 + c2o1 * (m_101 * m_021 + m_110 * m_012)) + + (m_120 + m_102)) * oneOverRho; + m_212 = c_212 + c1o3 * + (c3o1 * (m_002 * m_210 + m_200 * m_012 + c4o1 * m_101 * m_111 + c2o1 * (m_011 * m_201 + m_110 * m_102)) + + (m_210 + m_012)) * oneOverRho; + m_221 = c_221 + c1o3 * + (c3o1 * (m_200 * m_021 + m_020 * m_201 + c4o1 * m_110 * m_111 + c2o1 * (m_101 * m_120 + m_011 * m_210)) + + (m_021 + m_201)) * oneOverRho; + + ////////////////////////////////////////////////////////////////////////// + // 6. + m_222 = c_222 - ((-c4o1 * m_111 * m_111 - (m_200 * m_022 + m_020 * m_202 + m_002 * m_220) - + c4o1 * (m_011 * m_211 + m_101 * m_121 + m_110 * m_112) - + c2o1 * (m_120 * m_102 + m_210 * m_012 + m_201 * m_021)) * + oneOverRho + + (c4o1 * (m_101 * m_101 * m_020 + m_011 * m_011 * m_200 + m_110 * m_110 * m_002) + + c2o1 * (m_200 * m_020 * m_002) + c16o1 * m_110 * m_101 * m_011) * + oneOverRho * oneOverRho - + c1o3 * (m_022 + m_202 + m_220) * oneOverRho - c1o9 * (m_200 + m_020 + m_002) * oneOverRho + + (c2o1 * (m_101 * m_101 + m_011 * m_011 + m_110 * m_110) + + (m_002 * m_020 + m_002 * m_200 + m_020 * m_200) + c1o3 * (m_002 + m_020 + m_200)) * + oneOverRho * oneOverRho * c2o3 + + c1o27 * ((drho * drho - drho) * oneOverRho * oneOverRho)); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Add acceleration (body force) to first order cumulants according to Eq. (85)-(87) in + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + m_100 = -m_100; + m_010 = -m_010; + m_001 = -m_001; + + //Write to array here to distribute read/write + rho[k_000] = drho; + vx[k_000] = vvx; + vy[k_000] = vvy; + vz[k_000] = vvz; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (88)-(96) in <a + //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + backwardInverseChimeraWithK(m_000, m_100, m_200, vvx, vx2, c1o1, c1o1); + backwardChimera( m_010, m_110, m_210, vvx, vx2); + backwardInverseChimeraWithK(m_020, m_120, m_220, vvx, vx2, c3o1, c1o3); + backwardChimera( m_001, m_101, m_201, vvx, vx2); + backwardChimera( m_011, m_111, m_211, vvx, vx2); + backwardChimera( m_021, m_121, m_221, vvx, vx2); + backwardInverseChimeraWithK(m_002, m_102, m_202, vvx, vx2, c3o1, c1o3); + backwardChimera( m_012, m_112, m_212, vvx, vx2); + backwardInverseChimeraWithK(m_022, m_122, m_222, vvx, vx2, c9o1, c1o9); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithK(m_000, m_010, m_020, vvy, vy2, c6o1, c1o6); + backwardChimera( m_001, m_011, m_021, vvy, vy2); + backwardInverseChimeraWithK(m_002, m_012, m_022, vvy, vy2, c18o1, c1o18); + backwardInverseChimeraWithK(m_100, m_110, m_120, vvy, vy2, c3o2, c2o3); + backwardChimera( m_101, m_111, m_121, vvy, vy2); + backwardInverseChimeraWithK(m_102, m_112, m_122, vvy, vy2, c9o2, c2o9); + backwardInverseChimeraWithK(m_200, m_210, m_220, vvy, vy2, c6o1, c1o6); + backwardChimera( m_201, m_211, m_221, vvy, vy2); + backwardInverseChimeraWithK(m_202, m_212, m_222, vvy, vy2, c18o1, c1o18); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithK(m_000, m_001, m_002, vvz, vz2, c36o1, c1o36); + backwardInverseChimeraWithK(m_010, m_011, m_012, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(m_020, m_021, m_022, vvz, vz2, c36o1, c1o36); + backwardInverseChimeraWithK(m_100, m_101, m_102, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(m_110, m_111, m_112, vvz, vz2, c9o4, c4o9); + backwardInverseChimeraWithK(m_120, m_121, m_122, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(m_200, m_201, m_202, vvz, vz2, c36o1, c1o36); + backwardInverseChimeraWithK(m_210, m_211, m_212, vvz, vz2, c9o1, c1o9); + backwardInverseChimeraWithK(m_220, m_221, m_222, vvz, vz2, c36o1, c1o36); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Write distributions: style of reading and writing the distributions from/to + //! stored arrays dependent on timestep is based on the esoteric twist algorithm + //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), + //! DOI:10.3390/computation5020019 ]</b></a> + //! + (dist.f[DIR_P00])[k_000] = f_M00; + (dist.f[DIR_M00])[k_M00] = f_P00; + (dist.f[DIR_0P0])[k_000] = f_0M0; + (dist.f[DIR_0M0])[k_0M0] = f_0P0; + (dist.f[DIR_00P])[k_000] = f_00M; + (dist.f[DIR_00M])[k_00M] = f_00P; + (dist.f[DIR_PP0])[k_000] = f_MM0; + (dist.f[DIR_MM0])[k_MM0] = f_PP0; + (dist.f[DIR_PM0])[k_0M0] = f_MP0; + (dist.f[DIR_MP0])[k_M00] = f_PM0; + (dist.f[DIR_P0P])[k_000] = f_M0M; + (dist.f[DIR_M0M])[k_M0M] = f_P0P; + (dist.f[DIR_P0M])[k_00M] = f_M0P; + (dist.f[DIR_M0P])[k_M00] = f_P0M; + (dist.f[DIR_0PP])[k_000] = f_0MM; + (dist.f[DIR_0MM])[k_0MM] = f_0PP; + (dist.f[DIR_0PM])[k_00M] = f_0MP; + (dist.f[DIR_0MP])[k_0M0] = f_0PM; + (dist.f[DIR_000])[k_000] = f_000; + (dist.f[DIR_PPP])[k_000] = f_MMM; + (dist.f[DIR_PMP])[k_0M0] = f_MPM; + (dist.f[DIR_PPM])[k_00M] = f_MMP; + (dist.f[DIR_PMM])[k_0MM] = f_MPP; + (dist.f[DIR_MPP])[k_M00] = f_PMM; + (dist.f[DIR_MMP])[k_MM0] = f_PPM; + (dist.f[DIR_MPM])[k_M0M] = f_PMP; + (dist.f[DIR_MMM])[k_MMM] = f_PPP; + } +} + +template __global__ void LB_Kernel_TurbulentViscosityCumulantK17CompChim < TurbulenceModel::AMD > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep); + +template __global__ void LB_Kernel_TurbulentViscosityCumulantK17CompChim < TurbulenceModel::Smagorinsky > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep); + +template __global__ void LB_Kernel_TurbulentViscosityCumulantK17CompChim < TurbulenceModel::QR > ( real omega_in, uint* typeOfGridNode, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long size_Mat, int level, bool bodyForce, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep); diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim_Device.cuh new file mode 100644 index 0000000000000000000000000000000000000000..5ef37557399f263d25edf03b02b00f6a03c6e1cb --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim_Device.cuh @@ -0,0 +1,29 @@ +#ifndef LB_Kernel_TURBULENT_VISCOSITY_CUMULANT_K17_COMP_CHIM_H +#define LB_Kernel_TURBULENT_VISCOSITY_CUMULANT_K17_COMP_CHIM_H + +#include <DataTypes.h> +#include <curand.h> + +template< TurbulenceModel turbulenceModel > __global__ void LB_Kernel_TurbulentViscosityCumulantK17CompChim( + real omega_in, + uint* typeOfGridNode, + uint* neighborX, + uint* neighborY, + uint* neighborZ, + real* distributions, + real* rho, + real* vx, + real* vy, + real* vz, + real* turbulentViscosity, + real SGSconstant, + unsigned long size_Mat, + int level, + bool bodyForce, + real* forces, + real* bodyForceX, + real* bodyForceY, + real* bodyForceZ, + real* quadricLimiters, + bool isEvenTimestep); +#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/TurbulentViscosityFluidFlowCompStrategy.cpp b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/TurbulentViscosityFluidFlowCompStrategy.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f3615a89994f0ca1fafdc1eda905d3c3b615d478 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/TurbulentViscosityFluidFlowCompStrategy.cpp @@ -0,0 +1,23 @@ +#include "TurbulentViscosityFluidFlowCompStrategy.h" + +#include "Parameter/Parameter.h" + +std::shared_ptr<TurbulentViscosityFluidFlowCompStrategy> TurbulentViscosityFluidFlowCompStrategy::getInstance() +{ + static std::shared_ptr<TurbulentViscosityFluidFlowCompStrategy> uniqueInstance; + if (!uniqueInstance) + uniqueInstance = std::shared_ptr<TurbulentViscosityFluidFlowCompStrategy>(new TurbulentViscosityFluidFlowCompStrategy()); + return uniqueInstance; +} + +bool TurbulentViscosityFluidFlowCompStrategy::checkParameter(std::shared_ptr<Parameter> para) +{ + if (!para->getUseTurbulentViscosity()) + return false; + else if (!para->getCompOn()) + return false; + else + return true; +} + +TurbulentViscosityFluidFlowCompStrategy::TurbulentViscosityFluidFlowCompStrategy() {} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/TurbulentViscosityFluidFlowCompStrategy.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/TurbulentViscosityFluidFlowCompStrategy.h new file mode 100644 index 0000000000000000000000000000000000000000..95eff17777f7f0d1c3e05fe1b0d93892a88646a4 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/TurbulentViscosityFluidFlowCompStrategy.h @@ -0,0 +1,18 @@ +#ifndef AMD_FLUID_FLOW_COMP_STRATEGY_H +#define AMD_FLUID_FLOW_COMP_STRATEGY_H + +#include "Kernel/Utilities/CheckParameterStrategy/CheckParameterStrategy.h" + + +class TurbulentViscosityFluidFlowCompStrategy : public CheckParameterStrategy +{ +public: + static std::shared_ptr<TurbulentViscosityFluidFlowCompStrategy> getInstance(); + + bool checkParameter(std::shared_ptr<Parameter> para); + +private: + TurbulentViscosityFluidFlowCompStrategy(); + +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp.cu index 9abdc38c631de7337ad63a3a54eff06cfbf60c65..cfcb70cd2bd6f3cc8ec4349650c44b7d3b0619fc 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp.cu @@ -10,7 +10,7 @@ std::shared_ptr<WaleCumulantK15Comp> WaleCumulantK15Comp::getNewInstance(std::sh void WaleCumulantK15Comp::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; int Grid = (size_Mat / numberOfThreads) + 1; @@ -29,21 +29,21 @@ void WaleCumulantK15Comp::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_WaleCumulantK15Comp << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->neighborWSB_SP, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->d0SP.f[0], + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->neighborInverse, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->distributions.f[0], para->getParD(level)->turbViscosity, - para->getParD(level)->size_Mat_SP, + para->getParD(level)->numberOfNodes, level, para->getTimestepOfCoarseLevel(), para->getForcesDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_WaleCumulantK15Comp execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp_Device.cu index 23c4d72d23a42977cf44cce8bcd622e9edc66968..3da25060e6c82ea685a1659fecc8cf66eeaf44c4 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_WaleCumulantK15Comp( +__global__ void LB_Kernel_WaleCumulantK15Comp( real omega_in, unsigned int* bcMatD, unsigned int* neighborX, @@ -45,63 +46,63 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK15Comp( Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -135,33 +136,33 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK15Comp( unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ]; - real mfaab = (D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ]; - real mfacb = (D.f[dirNW ])[kw ]; - real mfcbc = (D.f[dirTE ])[k ]; - real mfaba = (D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ]; - real mfabc = (D.f[dirTW ])[kw ]; - real mfbcc = (D.f[dirTN ])[k ]; - real mfbaa = (D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ]; - real mfbac = (D.f[dirTS ])[ks ]; - real mfbbb = (D.f[dirZERO])[k ]; - real mfccc = (D.f[dirTNE ])[k ]; - real mfaac = (D.f[dirTSW ])[ksw]; - real mfcac = (D.f[dirTSE ])[ks ]; - real mfacc = (D.f[dirTNW ])[kw ]; - real mfcca = (D.f[dirBNE ])[kb ]; - real mfaaa = (D.f[dirBSW])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs]; - real mfaca = (D.f[dirBNW ])[kbw]; + real mfcbb = (D.f[DIR_P00 ])[k ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ]; + real mfaab = (D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ]; + real mfacb = (D.f[DIR_MP0 ])[kw ]; + real mfcbc = (D.f[DIR_P0P ])[k ]; + real mfaba = (D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ]; + real mfabc = (D.f[DIR_M0P ])[kw ]; + real mfbcc = (D.f[DIR_0PP ])[k ]; + real mfbaa = (D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ]; + real mfbac = (D.f[DIR_0MP ])[ks ]; + real mfbbb = (D.f[DIR_000])[k ]; + real mfccc = (D.f[DIR_PPP ])[k ]; + real mfaac = (D.f[DIR_MMP ])[ksw]; + real mfcac = (D.f[DIR_PMP ])[ks ]; + real mfacc = (D.f[DIR_MPP ])[kw ]; + real mfcca = (D.f[DIR_PPM ])[kb ]; + real mfaaa = (D.f[DIR_MMM])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs]; + real mfaca = (D.f[DIR_MPM ])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + (((mfbac+mfbca) + (mfbaa+mfbcc)) + ((mfabc+mfcba) + (mfaba+mfcbc)) + ((mfacb+mfcab) + (mfaab+mfccb))) + @@ -1179,33 +1180,33 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK15Comp( //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[ dirE ])[k ] = mfabb; - (D.f[ dirW ])[kw ] = mfcbb; - (D.f[ dirN ])[k ] = mfbab; - (D.f[ dirS ])[ks ] = mfbcb; - (D.f[ dirT ])[k ] = mfbba; - (D.f[ dirB ])[kb ] = mfbbc; - (D.f[ dirNE ])[k ] = mfaab; - (D.f[ dirSW ])[ksw ] = mfccb; - (D.f[ dirSE ])[ks ] = mfacb; - (D.f[ dirNW ])[kw ] = mfcab; - (D.f[ dirTE ])[k ] = mfaba; - (D.f[ dirBW ])[kbw ] = mfcbc; - (D.f[ dirBE ])[kb ] = mfabc; - (D.f[ dirTW ])[kw ] = mfcba; - (D.f[ dirTN ])[k ] = mfbaa; - (D.f[ dirBS ])[kbs ] = mfbcc; - (D.f[ dirBN ])[kb ] = mfbac; - (D.f[ dirTS ])[ks ] = mfbca; - (D.f[ dirZERO])[k ] = mfbbb; - (D.f[ dirTNE ])[k ] = mfaaa; - (D.f[ dirTSE ])[ks ] = mfaca; - (D.f[ dirBNE ])[kb ] = mfaac; - (D.f[ dirBSE ])[kbs ] = mfacc; - (D.f[ dirTNW ])[kw ] = mfcaa; - (D.f[ dirTSW ])[ksw ] = mfcca; - (D.f[ dirBNW ])[kbw ] = mfcac; - (D.f[ dirBSW ])[kbsw] = mfccc; + (D.f[ DIR_P00 ])[k ] = mfabb; + (D.f[ DIR_M00 ])[kw ] = mfcbb; + (D.f[ DIR_0P0 ])[k ] = mfbab; + (D.f[ DIR_0M0 ])[ks ] = mfbcb; + (D.f[ DIR_00P ])[k ] = mfbba; + (D.f[ DIR_00M ])[kb ] = mfbbc; + (D.f[ DIR_PP0 ])[k ] = mfaab; + (D.f[ DIR_MM0 ])[ksw ] = mfccb; + (D.f[ DIR_PM0 ])[ks ] = mfacb; + (D.f[ DIR_MP0 ])[kw ] = mfcab; + (D.f[ DIR_P0P ])[k ] = mfaba; + (D.f[ DIR_M0M ])[kbw ] = mfcbc; + (D.f[ DIR_P0M ])[kb ] = mfabc; + (D.f[ DIR_M0P ])[kw ] = mfcba; + (D.f[ DIR_0PP ])[k ] = mfbaa; + (D.f[ DIR_0MM ])[kbs ] = mfbcc; + (D.f[ DIR_0PM ])[kb ] = mfbac; + (D.f[ DIR_0MP ])[ks ] = mfbca; + (D.f[ DIR_000])[k ] = mfbbb; + (D.f[ DIR_PPP ])[k ] = mfaaa; + (D.f[ DIR_PMP ])[ks ] = mfaca; + (D.f[ DIR_PPM ])[kb ] = mfaac; + (D.f[ DIR_PMM ])[kbs ] = mfacc; + (D.f[ DIR_MPP ])[kw ] = mfcaa; + (D.f[ DIR_MMP ])[ksw ] = mfcca; + (D.f[ DIR_MPM ])[kbw ] = mfcac; + (D.f[ DIR_MMM ])[kbsw] = mfccc; //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp_Device.cuh index 409d7d0862479299e92c93aaa50085d673bb95f0..fad3eb11434b9c3fd216a7698b9275d4af43245c 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_WaleCumulantK15Comp(real omega, +__global__ void LB_Kernel_WaleCumulantK15Comp(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp.cu index 71cabc7de7e87ea2cd593b973a55dafc11aafbb9..15b808279a4c9dc771531f118cb369b7c5380a84 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp.cu @@ -10,7 +10,7 @@ std::shared_ptr<WaleBySoniMalavCumulantK15Comp> WaleBySoniMalavCumulantK15Comp:: void WaleBySoniMalavCumulantK15Comp::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; //int Grid = size_Array / numberOfThreads; @@ -33,20 +33,20 @@ void WaleBySoniMalavCumulantK15Comp::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_WaleBySoniMalavCumulantK15Comp << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->neighborWSB_SP, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->d0SP.f[0], + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->neighborInverse, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->distributions.f[0], para->getParD(level)->turbViscosity, - para->getParD(level)->size_Mat_SP, + para->getParD(level)->numberOfNodes, level, para->getForcesDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_WaleBySoniMalavCumulantK15Comp execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp_Device.cu index a791e1114ddad8b2bc2e7eaa3ac5d9690fd3e11a..511219c352c4d156428565f718191a70b9cc6c32 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_WaleBySoniMalavCumulantK15Comp( +__global__ void LB_Kernel_WaleBySoniMalavCumulantK15Comp( real omega_in, unsigned int* bcMatD, unsigned int* neighborX, @@ -44,63 +45,63 @@ extern "C" __global__ void LB_Kernel_WaleBySoniMalavCumulantK15Comp( Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -114,33 +115,33 @@ extern "C" __global__ void LB_Kernel_WaleBySoniMalavCumulantK15Comp( unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ]; - real mfaab = (D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ]; - real mfacb = (D.f[dirNW ])[kw ]; - real mfcbc = (D.f[dirTE ])[k ]; - real mfaba = (D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ]; - real mfabc = (D.f[dirTW ])[kw ]; - real mfbcc = (D.f[dirTN ])[k ]; - real mfbaa = (D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ]; - real mfbac = (D.f[dirTS ])[ks ]; - real mfbbb = (D.f[dirZERO])[k ]; - real mfccc = (D.f[dirTNE ])[k ]; - real mfaac = (D.f[dirTSW ])[ksw]; - real mfcac = (D.f[dirTSE ])[ks ]; - real mfacc = (D.f[dirTNW ])[kw ]; - real mfcca = (D.f[dirBNE ])[kb ]; - real mfaaa = (D.f[dirBSW])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs]; - real mfaca = (D.f[dirBNW ])[kbw]; + real mfcbb = (D.f[DIR_P00 ])[k ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ]; + real mfaab = (D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ]; + real mfacb = (D.f[DIR_MP0 ])[kw ]; + real mfcbc = (D.f[DIR_P0P ])[k ]; + real mfaba = (D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ]; + real mfabc = (D.f[DIR_M0P ])[kw ]; + real mfbcc = (D.f[DIR_0PP ])[k ]; + real mfbaa = (D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ]; + real mfbac = (D.f[DIR_0MP ])[ks ]; + real mfbbb = (D.f[DIR_000])[k ]; + real mfccc = (D.f[DIR_PPP ])[k ]; + real mfaac = (D.f[DIR_MMP ])[ksw]; + real mfcac = (D.f[DIR_PMP ])[ks ]; + real mfacc = (D.f[DIR_MPP ])[kw ]; + real mfcca = (D.f[DIR_PPM ])[kb ]; + real mfaaa = (D.f[DIR_MMM])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs]; + real mfaca = (D.f[DIR_MPM ])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + (((mfbac+mfbca) + (mfbaa+mfbcc)) + ((mfabc+mfcba) + (mfaba+mfcbc)) + ((mfacb+mfcab) + (mfaab+mfccb))) + @@ -1003,33 +1004,33 @@ extern "C" __global__ void LB_Kernel_WaleBySoniMalavCumulantK15Comp( //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[ dirE ])[k ] = mfabb; - (D.f[ dirW ])[kw ] = mfcbb; - (D.f[ dirN ])[k ] = mfbab; - (D.f[ dirS ])[ks ] = mfbcb; - (D.f[ dirT ])[k ] = mfbba; - (D.f[ dirB ])[kb ] = mfbbc; - (D.f[ dirNE ])[k ] = mfaab; - (D.f[ dirSW ])[ksw ] = mfccb; - (D.f[ dirSE ])[ks ] = mfacb; - (D.f[ dirNW ])[kw ] = mfcab; - (D.f[ dirTE ])[k ] = mfaba; - (D.f[ dirBW ])[kbw ] = mfcbc; - (D.f[ dirBE ])[kb ] = mfabc; - (D.f[ dirTW ])[kw ] = mfcba; - (D.f[ dirTN ])[k ] = mfbaa; - (D.f[ dirBS ])[kbs ] = mfbcc; - (D.f[ dirBN ])[kb ] = mfbac; - (D.f[ dirTS ])[ks ] = mfbca; - (D.f[ dirZERO])[k ] = mfbbb; - (D.f[ dirTNE ])[k ] = mfaaa; - (D.f[ dirTSE ])[ks ] = mfaca; - (D.f[ dirBNE ])[kb ] = mfaac; - (D.f[ dirBSE ])[kbs ] = mfacc; - (D.f[ dirTNW ])[kw ] = mfcaa; - (D.f[ dirTSW ])[ksw ] = mfcca; - (D.f[ dirBNW ])[kbw ] = mfcac; - (D.f[ dirBSW ])[kbsw] = mfccc; + (D.f[ DIR_P00 ])[k ] = mfabb; + (D.f[ DIR_M00 ])[kw ] = mfcbb; + (D.f[ DIR_0P0 ])[k ] = mfbab; + (D.f[ DIR_0M0 ])[ks ] = mfbcb; + (D.f[ DIR_00P ])[k ] = mfbba; + (D.f[ DIR_00M ])[kb ] = mfbbc; + (D.f[ DIR_PP0 ])[k ] = mfaab; + (D.f[ DIR_MM0 ])[ksw ] = mfccb; + (D.f[ DIR_PM0 ])[ks ] = mfacb; + (D.f[ DIR_MP0 ])[kw ] = mfcab; + (D.f[ DIR_P0P ])[k ] = mfaba; + (D.f[ DIR_M0M ])[kbw ] = mfcbc; + (D.f[ DIR_P0M ])[kb ] = mfabc; + (D.f[ DIR_M0P ])[kw ] = mfcba; + (D.f[ DIR_0PP ])[k ] = mfbaa; + (D.f[ DIR_0MM ])[kbs ] = mfbcc; + (D.f[ DIR_0PM ])[kb ] = mfbac; + (D.f[ DIR_0MP ])[ks ] = mfbca; + (D.f[ DIR_000])[k ] = mfbbb; + (D.f[ DIR_PPP ])[k ] = mfaaa; + (D.f[ DIR_PMP ])[ks ] = mfaca; + (D.f[ DIR_PPM ])[kb ] = mfaac; + (D.f[ DIR_PMM ])[kbs ] = mfacc; + (D.f[ DIR_MPP ])[kw ] = mfcaa; + (D.f[ DIR_MMP ])[ksw ] = mfcca; + (D.f[ DIR_MPM ])[kbw ] = mfcac; + (D.f[ DIR_MMM ])[kbsw] = mfccc; //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp_Device.cuh index 593a7cef915e605f28bfbcbd362a6600b6c6224d..4297404073aacc0acd01b84c35cbae3d1081ed5b 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_WaleBySoniMalavCumulantK15Comp(real omega_in, +__global__ void LB_Kernel_WaleBySoniMalavCumulantK15Comp(real omega_in, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp.cu index 0a1bc5f5f49b887555f35dade84821384b6a72fb..5eeea51301c666cf17546c85a444413111bebf2c 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp.cu @@ -10,7 +10,7 @@ std::shared_ptr<WaleCumulantK17Comp> WaleCumulantK17Comp::getNewInstance(std::sh void WaleCumulantK17Comp::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; //int Grid = size_Array / numberOfThreads; @@ -33,22 +33,22 @@ void WaleCumulantK17Comp::run() dim3 threads(numberOfThreads, 1, 1); LB_Kernel_WaleCumulantK17Comp <<< grid, threads >>>(para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->neighborWSB_SP, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->d0SP.f[0], + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->neighborInverse, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->distributions.f[0], para->getParD(level)->turbViscosity, - para->getParD(level)->size_Mat_SP, + para->getParD(level)->numberOfNodes, level, para->getTimestepOfCoarseLevel(), para->getForcesDev(), para->getQuadricLimitersDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_WaleCumulantK17Comp execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp_Device.cu index 0ff953e261d7c726a360b5952ac5b58c32c96791..8aaa13ab1d868e15ea5707d1566ba653b44c645d 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_WaleCumulantK17Comp( +__global__ void LB_Kernel_WaleCumulantK17Comp( real omega_in, unsigned int* bcMatD, unsigned int* neighborX, @@ -46,63 +47,63 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK17Comp( Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DDStart[dirE *size_Mat]; - D.f[dirW ] = &DDStart[dirW *size_Mat]; - D.f[dirN ] = &DDStart[dirN *size_Mat]; - D.f[dirS ] = &DDStart[dirS *size_Mat]; - D.f[dirT ] = &DDStart[dirT *size_Mat]; - D.f[dirB ] = &DDStart[dirB *size_Mat]; - D.f[dirNE ] = &DDStart[dirNE *size_Mat]; - D.f[dirSW ] = &DDStart[dirSW *size_Mat]; - D.f[dirSE ] = &DDStart[dirSE *size_Mat]; - D.f[dirNW ] = &DDStart[dirNW *size_Mat]; - D.f[dirTE ] = &DDStart[dirTE *size_Mat]; - D.f[dirBW ] = &DDStart[dirBW *size_Mat]; - D.f[dirBE ] = &DDStart[dirBE *size_Mat]; - D.f[dirTW ] = &DDStart[dirTW *size_Mat]; - D.f[dirTN ] = &DDStart[dirTN *size_Mat]; - D.f[dirBS ] = &DDStart[dirBS *size_Mat]; - D.f[dirBN ] = &DDStart[dirBN *size_Mat]; - D.f[dirTS ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE ] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW ] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE ] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW ] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE ] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW ] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE ] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DDStart[dirE *size_Mat]; - D.f[dirE ] = &DDStart[dirW *size_Mat]; - D.f[dirS ] = &DDStart[dirN *size_Mat]; - D.f[dirN ] = &DDStart[dirS *size_Mat]; - D.f[dirB ] = &DDStart[dirT *size_Mat]; - D.f[dirT ] = &DDStart[dirB *size_Mat]; - D.f[dirSW ] = &DDStart[dirNE *size_Mat]; - D.f[dirNE ] = &DDStart[dirSW *size_Mat]; - D.f[dirNW ] = &DDStart[dirSE *size_Mat]; - D.f[dirSE ] = &DDStart[dirNW *size_Mat]; - D.f[dirBW ] = &DDStart[dirTE *size_Mat]; - D.f[dirTE ] = &DDStart[dirBW *size_Mat]; - D.f[dirTW ] = &DDStart[dirBE *size_Mat]; - D.f[dirBE ] = &DDStart[dirTW *size_Mat]; - D.f[dirBS ] = &DDStart[dirTN *size_Mat]; - D.f[dirTN ] = &DDStart[dirBS *size_Mat]; - D.f[dirTS ] = &DDStart[dirBN *size_Mat]; - D.f[dirBN ] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW ] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE ] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW ] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE ] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW ] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE ] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW ] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE ] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -136,33 +137,33 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK17Comp( unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE ])[k ]; - real mfabb = (D.f[dirW ])[kw ]; - real mfbcb = (D.f[dirN ])[k ]; - real mfbab = (D.f[dirS ])[ks ]; - real mfbbc = (D.f[dirT ])[k ]; - real mfbba = (D.f[dirB ])[kb ]; - real mfccb = (D.f[dirNE ])[k ]; - real mfaab = (D.f[dirSW ])[ksw]; - real mfcab = (D.f[dirSE ])[ks ]; - real mfacb = (D.f[dirNW ])[kw ]; - real mfcbc = (D.f[dirTE ])[k ]; - real mfaba = (D.f[dirBW ])[kbw]; - real mfcba = (D.f[dirBE ])[kb ]; - real mfabc = (D.f[dirTW ])[kw ]; - real mfbcc = (D.f[dirTN ])[k ]; - real mfbaa = (D.f[dirBS ])[kbs]; - real mfbca = (D.f[dirBN ])[kb ]; - real mfbac = (D.f[dirTS ])[ks ]; - real mfbbb = (D.f[dirZERO])[k ]; - real mfccc = (D.f[dirTNE ])[k ]; - real mfaac = (D.f[dirTSW ])[ksw]; - real mfcac = (D.f[dirTSE ])[ks ]; - real mfacc = (D.f[dirTNW ])[kw ]; - real mfcca = (D.f[dirBNE ])[kb ]; - real mfaaa = (D.f[dirBSW])[kbsw]; - real mfcaa = (D.f[dirBSE ])[kbs]; - real mfaca = (D.f[dirBNW ])[kbw]; + real mfcbb = (D.f[DIR_P00 ])[k ]; + real mfabb = (D.f[DIR_M00 ])[kw ]; + real mfbcb = (D.f[DIR_0P0 ])[k ]; + real mfbab = (D.f[DIR_0M0 ])[ks ]; + real mfbbc = (D.f[DIR_00P ])[k ]; + real mfbba = (D.f[DIR_00M ])[kb ]; + real mfccb = (D.f[DIR_PP0 ])[k ]; + real mfaab = (D.f[DIR_MM0 ])[ksw]; + real mfcab = (D.f[DIR_PM0 ])[ks ]; + real mfacb = (D.f[DIR_MP0 ])[kw ]; + real mfcbc = (D.f[DIR_P0P ])[k ]; + real mfaba = (D.f[DIR_M0M ])[kbw]; + real mfcba = (D.f[DIR_P0M ])[kb ]; + real mfabc = (D.f[DIR_M0P ])[kw ]; + real mfbcc = (D.f[DIR_0PP ])[k ]; + real mfbaa = (D.f[DIR_0MM ])[kbs]; + real mfbca = (D.f[DIR_0PM ])[kb ]; + real mfbac = (D.f[DIR_0MP ])[ks ]; + real mfbbb = (D.f[DIR_000])[k ]; + real mfccc = (D.f[DIR_PPP ])[k ]; + real mfaac = (D.f[DIR_MMP ])[ksw]; + real mfcac = (D.f[DIR_PMP ])[ks ]; + real mfacc = (D.f[DIR_MPP ])[kw ]; + real mfcca = (D.f[DIR_PPM ])[kb ]; + real mfaaa = (D.f[DIR_MMM])[kbsw]; + real mfcaa = (D.f[DIR_PMM ])[kbs]; + real mfaca = (D.f[DIR_MPM ])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc+mfaaa) + (mfaca+mfcac)) + ((mfacc+mfcaa) + (mfaac+mfcca))) + (((mfbac+mfbca) + (mfbaa+mfbcc)) + ((mfabc+mfcba) + (mfaba+mfcbc)) + ((mfacb+mfcab) + (mfaab+mfccb))) + @@ -862,8 +863,8 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK17Comp( // wadjust = O4+(one-O4)*abs(CUMcbb)/(abs(CUMcbb)+qudricLimit); //CUMcbb += wadjust * (-CUMcbb); ////////////////////////////////////////////////////////////////////////// - real A = (c4o1 + c2o1*omega - c3o1*omega*omega) / (c2o1 - c7o1*omega + c5o1*omega*omega); - real B = (c4o1 + c28o1*omega - c14o1*omega*omega) / (c6o1 - c21o1*omega + c15o1*omega*omega); + real factorA = (c4o1 + c2o1*omega - c3o1*omega*omega) / (c2o1 - c7o1*omega + c5o1*omega*omega); + real factorB = (c4o1 + c28o1*omega - c14o1*omega*omega) / (c6o1 - c21o1*omega + c15o1*omega*omega); ////////////////////////////////////////////////////////////////////////// //ohne limiter //CUMacc += O4 * (-CUMacc); @@ -872,12 +873,12 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK17Comp( //CUMbbc += O4 * (-CUMbbc); //CUMbcb += O4 * (-CUMbcb); //CUMcbb += O4 * (-CUMcbb); - CUMacc = -O4*(c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMacc); - CUMcac = -O4*(c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMcac); - CUMcca = -O4*(c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * A + (c1o1 - O4) * (CUMcca); - CUMbbc = -O4*(c1o1 / omega - c1o2) * Dxy * c1o3 * B + (c1o1 - O4) * (CUMbbc); - CUMbcb = -O4*(c1o1 / omega - c1o2) * Dxz * c1o3 * B + (c1o1 - O4) * (CUMbcb); - CUMcbb = -O4*(c1o1 / omega - c1o2) * Dyz * c1o3 * B + (c1o1 - O4) * (CUMcbb); + CUMacc = -O4*(c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMacc); + CUMcac = -O4*(c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMcac); + CUMcca = -O4*(c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * factorA + (c1o1 - O4) * (CUMcca); + CUMbbc = -O4*(c1o1 / omega - c1o2) * Dxy * c1o3 * factorB + (c1o1 - O4) * (CUMbbc); + CUMbcb = -O4*(c1o1 / omega - c1o2) * Dxz * c1o3 * factorB + (c1o1 - O4) * (CUMbcb); + CUMcbb = -O4*(c1o1 / omega - c1o2) * Dyz * c1o3 * factorB + (c1o1 - O4) * (CUMcbb); ////////////////////////////////////////////////////////////////////////// @@ -1141,33 +1142,33 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK17Comp( //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[ dirE ])[k ] = mfabb; - (D.f[ dirW ])[kw ] = mfcbb; - (D.f[ dirN ])[k ] = mfbab; - (D.f[ dirS ])[ks ] = mfbcb; - (D.f[ dirT ])[k ] = mfbba; - (D.f[ dirB ])[kb ] = mfbbc; - (D.f[ dirNE ])[k ] = mfaab; - (D.f[ dirSW ])[ksw ] = mfccb; - (D.f[ dirSE ])[ks ] = mfacb; - (D.f[ dirNW ])[kw ] = mfcab; - (D.f[ dirTE ])[k ] = mfaba; - (D.f[ dirBW ])[kbw ] = mfcbc; - (D.f[ dirBE ])[kb ] = mfabc; - (D.f[ dirTW ])[kw ] = mfcba; - (D.f[ dirTN ])[k ] = mfbaa; - (D.f[ dirBS ])[kbs ] = mfbcc; - (D.f[ dirBN ])[kb ] = mfbac; - (D.f[ dirTS ])[ks ] = mfbca; - (D.f[ dirZERO])[k ] = mfbbb; - (D.f[ dirTNE ])[k ] = mfaaa; - (D.f[ dirTSE ])[ks ] = mfaca; - (D.f[ dirBNE ])[kb ] = mfaac; - (D.f[ dirBSE ])[kbs ] = mfacc; - (D.f[ dirTNW ])[kw ] = mfcaa; - (D.f[ dirTSW ])[ksw ] = mfcca; - (D.f[ dirBNW ])[kbw ] = mfcac; - (D.f[ dirBSW ])[kbsw] = mfccc; + (D.f[ DIR_P00 ])[k ] = mfabb; + (D.f[ DIR_M00 ])[kw ] = mfcbb; + (D.f[ DIR_0P0 ])[k ] = mfbab; + (D.f[ DIR_0M0 ])[ks ] = mfbcb; + (D.f[ DIR_00P ])[k ] = mfbba; + (D.f[ DIR_00M ])[kb ] = mfbbc; + (D.f[ DIR_PP0 ])[k ] = mfaab; + (D.f[ DIR_MM0 ])[ksw ] = mfccb; + (D.f[ DIR_PM0 ])[ks ] = mfacb; + (D.f[ DIR_MP0 ])[kw ] = mfcab; + (D.f[ DIR_P0P ])[k ] = mfaba; + (D.f[ DIR_M0M ])[kbw ] = mfcbc; + (D.f[ DIR_P0M ])[kb ] = mfabc; + (D.f[ DIR_M0P ])[kw ] = mfcba; + (D.f[ DIR_0PP ])[k ] = mfbaa; + (D.f[ DIR_0MM ])[kbs ] = mfbcc; + (D.f[ DIR_0PM ])[kb ] = mfbac; + (D.f[ DIR_0MP ])[ks ] = mfbca; + (D.f[ DIR_000 ])[k ] = mfbbb; + (D.f[ DIR_PPP ])[k ] = mfaaa; + (D.f[ DIR_PMP ])[ks ] = mfaca; + (D.f[ DIR_PPM ])[kb ] = mfaac; + (D.f[ DIR_PMM ])[kbs ] = mfacc; + (D.f[ DIR_MPP ])[kw ] = mfcaa; + (D.f[ DIR_MMP ])[ksw ] = mfcca; + (D.f[ DIR_MPM ])[kbw ] = mfcac; + (D.f[ DIR_MMM ])[kbsw] = mfccc; //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp_Device.cuh index 34e2c094cd9a2d7ecb1dc064db954d5b6e211f8f..459c833e2bd3f0bfd2a0c214a9d366bcfb3a4b49 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17/WaleCumulantK17Comp_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_WaleCumulantK17Comp( +__global__ void LB_Kernel_WaleCumulantK17Comp( real omega, unsigned int* bcMatD, unsigned int* neighborX, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp.cu index d4b54f7ef82f10df68a39a02bfe5e91eb311d014..98dca58f522bf02ce66328819e42c717f0ceef28 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp.cu @@ -10,7 +10,7 @@ std::shared_ptr<WaleCumulantK17DebugComp> WaleCumulantK17DebugComp::getNewInstan void WaleCumulantK17DebugComp::run() { - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int numberOfThreads = para->getParD(level)->numberofthreads; //int Grid = size_Array / numberOfThreads; @@ -34,15 +34,15 @@ void WaleCumulantK17DebugComp::run() LB_Kernel_WaleCumulantK17DebugComp << < grid, threads >> >( para->getParD(level)->omega, - para->getParD(level)->geoSP, - para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->neighborWSB_SP, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->d0SP.f[0], + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->neighborInverse, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->distributions.f[0], para->getParD(level)->turbViscosity, para->getParD(level)->gSij, para->getParD(level)->gSDij, @@ -55,11 +55,11 @@ void WaleCumulantK17DebugComp::run() para->getParD(level)->gDxvz, para->getParD(level)->gDyvz, para->getParD(level)->gDzvz, - para->getParD(level)->size_Mat_SP, + para->getParD(level)->numberOfNodes, level, para->getForcesDev(), para->getQuadricLimitersDev(), - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LB_Kernel_WaleCumulantK17DebugComp execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp_Device.cu index 9d4efb2ab81a30d27a7909212e8c35847fded3ea..a1feba477a6555ea728311a6e99d5302652813ff 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Kernel_WaleCumulantK17DebugComp( +__global__ void LB_Kernel_WaleCumulantK17DebugComp( real omega_in, unsigned int* bcMatD, unsigned int* neighborX, @@ -56,63 +57,63 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK17DebugComp( Distributions27 D; if (EvenOrOdd == true) { - D.f[dirE] = &DDStart[dirE *size_Mat]; - D.f[dirW] = &DDStart[dirW *size_Mat]; - D.f[dirN] = &DDStart[dirN *size_Mat]; - D.f[dirS] = &DDStart[dirS *size_Mat]; - D.f[dirT] = &DDStart[dirT *size_Mat]; - D.f[dirB] = &DDStart[dirB *size_Mat]; - D.f[dirNE] = &DDStart[dirNE *size_Mat]; - D.f[dirSW] = &DDStart[dirSW *size_Mat]; - D.f[dirSE] = &DDStart[dirSE *size_Mat]; - D.f[dirNW] = &DDStart[dirNW *size_Mat]; - D.f[dirTE] = &DDStart[dirTE *size_Mat]; - D.f[dirBW] = &DDStart[dirBW *size_Mat]; - D.f[dirBE] = &DDStart[dirBE *size_Mat]; - D.f[dirTW] = &DDStart[dirTW *size_Mat]; - D.f[dirTN] = &DDStart[dirTN *size_Mat]; - D.f[dirBS] = &DDStart[dirBS *size_Mat]; - D.f[dirBN] = &DDStart[dirBN *size_Mat]; - D.f[dirTS] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirTNE] = &DDStart[dirTNE *size_Mat]; - D.f[dirTSW] = &DDStart[dirTSW *size_Mat]; - D.f[dirTSE] = &DDStart[dirTSE *size_Mat]; - D.f[dirTNW] = &DDStart[dirTNW *size_Mat]; - D.f[dirBNE] = &DDStart[dirBNE *size_Mat]; - D.f[dirBSW] = &DDStart[dirBSW *size_Mat]; - D.f[dirBSE] = &DDStart[dirBSE *size_Mat]; - D.f[dirBNW] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_PMM]= &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_MPM]= &DDStart[DIR_MPM *size_Mat]; } else { - D.f[dirW] = &DDStart[dirE *size_Mat]; - D.f[dirE] = &DDStart[dirW *size_Mat]; - D.f[dirS] = &DDStart[dirN *size_Mat]; - D.f[dirN] = &DDStart[dirS *size_Mat]; - D.f[dirB] = &DDStart[dirT *size_Mat]; - D.f[dirT] = &DDStart[dirB *size_Mat]; - D.f[dirSW] = &DDStart[dirNE *size_Mat]; - D.f[dirNE] = &DDStart[dirSW *size_Mat]; - D.f[dirNW] = &DDStart[dirSE *size_Mat]; - D.f[dirSE] = &DDStart[dirNW *size_Mat]; - D.f[dirBW] = &DDStart[dirTE *size_Mat]; - D.f[dirTE] = &DDStart[dirBW *size_Mat]; - D.f[dirTW] = &DDStart[dirBE *size_Mat]; - D.f[dirBE] = &DDStart[dirTW *size_Mat]; - D.f[dirBS] = &DDStart[dirTN *size_Mat]; - D.f[dirTN] = &DDStart[dirBS *size_Mat]; - D.f[dirTS] = &DDStart[dirBN *size_Mat]; - D.f[dirBN] = &DDStart[dirTS *size_Mat]; - D.f[dirZERO] = &DDStart[dirZERO*size_Mat]; - D.f[dirBSW] = &DDStart[dirTNE *size_Mat]; - D.f[dirBNE] = &DDStart[dirTSW *size_Mat]; - D.f[dirBNW] = &DDStart[dirTSE *size_Mat]; - D.f[dirBSE] = &DDStart[dirTNW *size_Mat]; - D.f[dirTSW] = &DDStart[dirBNE *size_Mat]; - D.f[dirTNE] = &DDStart[dirBSW *size_Mat]; - D.f[dirTNW] = &DDStart[dirBSE *size_Mat]; - D.f[dirTSE] = &DDStart[dirBNW *size_Mat]; + D.f[DIR_M00] = &DDStart[DIR_P00 *size_Mat]; + D.f[DIR_P00] = &DDStart[DIR_M00 *size_Mat]; + D.f[DIR_0M0] = &DDStart[DIR_0P0 *size_Mat]; + D.f[DIR_0P0] = &DDStart[DIR_0M0 *size_Mat]; + D.f[DIR_00M] = &DDStart[DIR_00P *size_Mat]; + D.f[DIR_00P] = &DDStart[DIR_00M *size_Mat]; + D.f[DIR_MM0] = &DDStart[DIR_PP0 *size_Mat]; + D.f[DIR_PP0] = &DDStart[DIR_MM0 *size_Mat]; + D.f[DIR_MP0] = &DDStart[DIR_PM0 *size_Mat]; + D.f[DIR_PM0] = &DDStart[DIR_MP0 *size_Mat]; + D.f[DIR_M0M] = &DDStart[DIR_P0P *size_Mat]; + D.f[DIR_P0P] = &DDStart[DIR_M0M *size_Mat]; + D.f[DIR_M0P] = &DDStart[DIR_P0M *size_Mat]; + D.f[DIR_P0M] = &DDStart[DIR_M0P *size_Mat]; + D.f[DIR_0MM] = &DDStart[DIR_0PP *size_Mat]; + D.f[DIR_0PP] = &DDStart[DIR_0MM *size_Mat]; + D.f[DIR_0MP] = &DDStart[DIR_0PM *size_Mat]; + D.f[DIR_0PM] = &DDStart[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DDStart[DIR_000*size_Mat]; + D.f[DIR_MMM] = &DDStart[DIR_PPP *size_Mat]; + D.f[DIR_PPM] = &DDStart[DIR_MMP *size_Mat]; + D.f[DIR_MPM]= &DDStart[DIR_PMP *size_Mat]; + D.f[DIR_PMM]= &DDStart[DIR_MPP *size_Mat]; + D.f[DIR_MMP] = &DDStart[DIR_PPM *size_Mat]; + D.f[DIR_PPP] = &DDStart[DIR_MMM *size_Mat]; + D.f[DIR_MPP] = &DDStart[DIR_PMM *size_Mat]; + D.f[DIR_PMP] = &DDStart[DIR_MPM *size_Mat]; } //////////////////////////////////////////////////////////////////////////////// @@ -146,33 +147,33 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK17DebugComp( unsigned int kbsw = neighborZ[ksw]; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real mfcbb = (D.f[dirE])[k]; - real mfabb = (D.f[dirW])[kw]; - real mfbcb = (D.f[dirN])[k]; - real mfbab = (D.f[dirS])[ks]; - real mfbbc = (D.f[dirT])[k]; - real mfbba = (D.f[dirB])[kb]; - real mfccb = (D.f[dirNE])[k]; - real mfaab = (D.f[dirSW])[ksw]; - real mfcab = (D.f[dirSE])[ks]; - real mfacb = (D.f[dirNW])[kw]; - real mfcbc = (D.f[dirTE])[k]; - real mfaba = (D.f[dirBW])[kbw]; - real mfcba = (D.f[dirBE])[kb]; - real mfabc = (D.f[dirTW])[kw]; - real mfbcc = (D.f[dirTN])[k]; - real mfbaa = (D.f[dirBS])[kbs]; - real mfbca = (D.f[dirBN])[kb]; - real mfbac = (D.f[dirTS])[ks]; - real mfbbb = (D.f[dirZERO])[k]; - real mfccc = (D.f[dirTNE])[k]; - real mfaac = (D.f[dirTSW])[ksw]; - real mfcac = (D.f[dirTSE])[ks]; - real mfacc = (D.f[dirTNW])[kw]; - real mfcca = (D.f[dirBNE])[kb]; - real mfaaa = (D.f[dirBSW])[kbsw]; - real mfcaa = (D.f[dirBSE])[kbs]; - real mfaca = (D.f[dirBNW])[kbw]; + real mfcbb = (D.f[DIR_P00])[k]; + real mfabb = (D.f[DIR_M00])[kw]; + real mfbcb = (D.f[DIR_0P0])[k]; + real mfbab = (D.f[DIR_0M0])[ks]; + real mfbbc = (D.f[DIR_00P])[k]; + real mfbba = (D.f[DIR_00M])[kb]; + real mfccb = (D.f[DIR_PP0])[k]; + real mfaab = (D.f[DIR_MM0])[ksw]; + real mfcab = (D.f[DIR_PM0])[ks]; + real mfacb = (D.f[DIR_MP0])[kw]; + real mfcbc = (D.f[DIR_P0P])[k]; + real mfaba = (D.f[DIR_M0M])[kbw]; + real mfcba = (D.f[DIR_P0M])[kb]; + real mfabc = (D.f[DIR_M0P])[kw]; + real mfbcc = (D.f[DIR_0PP])[k]; + real mfbaa = (D.f[DIR_0MM])[kbs]; + real mfbca = (D.f[DIR_0PM])[kb]; + real mfbac = (D.f[DIR_0MP])[ks]; + real mfbbb = (D.f[DIR_000])[k]; + real mfccc = (D.f[DIR_PPP])[k]; + real mfaac = (D.f[DIR_MMP])[ksw]; + real mfcac = (D.f[DIR_PMP])[ks]; + real mfacc = (D.f[DIR_MPP])[kw]; + real mfcca = (D.f[DIR_PPM])[kb]; + real mfaaa = (D.f[DIR_MMM])[kbsw]; + real mfcaa = (D.f[DIR_PMM])[kbs]; + real mfaca = (D.f[DIR_MPM])[kbw]; //////////////////////////////////////////////////////////////////////////////////// real drho = ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + @@ -878,8 +879,8 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK17DebugComp( // wadjust = O4+(one-O4)*abs(CUMcbb)/(abs(CUMcbb)+qudricLimit); //CUMcbb += wadjust * (-CUMcbb); ////////////////////////////////////////////////////////////////////////// - real A = (c4o1 + c2o1*omega - c3o1*omega*omega) / (c2o1 - c7o1*omega + c5o1*omega*omega); - real B = (c4o1 + c28o1*omega - c14o1*omega*omega) / (c6o1 - c21o1*omega + c15o1*omega*omega); + real factorA = (c4o1 + c2o1*omega - c3o1*omega*omega) / (c2o1 - c7o1*omega + c5o1*omega*omega); + real factorB = (c4o1 + c28o1*omega - c14o1*omega*omega) / (c6o1 - c21o1*omega + c15o1*omega*omega); ////////////////////////////////////////////////////////////////////////// //ohne limiter //CUMacc += O4 * (-CUMacc); @@ -888,12 +889,12 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK17DebugComp( //CUMbbc += O4 * (-CUMbbc); //CUMbcb += O4 * (-CUMbcb); //CUMcbb += O4 * (-CUMcbb); - CUMacc = -O4*(c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMacc); - CUMcac = -O4*(c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMcac); - CUMcca = -O4*(c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * A + (c1o1 - O4) * (CUMcca); - CUMbbc = -O4*(c1o1 / omega - c1o2) * Dxy * c1o3 * B + (c1o1 - O4) * (CUMbbc); - CUMbcb = -O4*(c1o1 / omega - c1o2) * Dxz * c1o3 * B + (c1o1 - O4) * (CUMbcb); - CUMcbb = -O4*(c1o1 / omega - c1o2) * Dyz * c1o3 * B + (c1o1 - O4) * (CUMcbb); + CUMacc = -O4*(c1o1 / omega - c1o2) * (dyuy + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMacc); + CUMcac = -O4*(c1o1 / omega - c1o2) * (dxux + dzuz) * c2o3 * factorA + (c1o1 - O4) * (CUMcac); + CUMcca = -O4*(c1o1 / omega - c1o2) * (dyuy + dxux) * c2o3 * factorA + (c1o1 - O4) * (CUMcca); + CUMbbc = -O4*(c1o1 / omega - c1o2) * Dxy * c1o3 * factorB + (c1o1 - O4) * (CUMbbc); + CUMbcb = -O4*(c1o1 / omega - c1o2) * Dxz * c1o3 * factorB + (c1o1 - O4) * (CUMbcb); + CUMcbb = -O4*(c1o1 / omega - c1o2) * Dyz * c1o3 * factorB + (c1o1 - O4) * (CUMcbb); ////////////////////////////////////////////////////////////////////////// @@ -1157,33 +1158,33 @@ extern "C" __global__ void LB_Kernel_WaleCumulantK17DebugComp( //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// - (D.f[dirE])[k] = mfabb; - (D.f[dirW])[kw] = mfcbb; - (D.f[dirN])[k] = mfbab; - (D.f[dirS])[ks] = mfbcb; - (D.f[dirT])[k] = mfbba; - (D.f[dirB])[kb] = mfbbc; - (D.f[dirNE])[k] = mfaab; - (D.f[dirSW])[ksw] = mfccb; - (D.f[dirSE])[ks] = mfacb; - (D.f[dirNW])[kw] = mfcab; - (D.f[dirTE])[k] = mfaba; - (D.f[dirBW])[kbw] = mfcbc; - (D.f[dirBE])[kb] = mfabc; - (D.f[dirTW])[kw] = mfcba; - (D.f[dirTN])[k] = mfbaa; - (D.f[dirBS])[kbs] = mfbcc; - (D.f[dirBN])[kb] = mfbac; - (D.f[dirTS])[ks] = mfbca; - (D.f[dirZERO])[k] = mfbbb; - (D.f[dirTNE])[k] = mfaaa; - (D.f[dirTSE])[ks] = mfaca; - (D.f[dirBNE])[kb] = mfaac; - (D.f[dirBSE])[kbs] = mfacc; - (D.f[dirTNW])[kw] = mfcaa; - (D.f[dirTSW])[ksw] = mfcca; - (D.f[dirBNW])[kbw] = mfcac; - (D.f[dirBSW])[kbsw] = mfccc; + (D.f[DIR_P00])[k] = mfabb; + (D.f[DIR_M00])[kw] = mfcbb; + (D.f[DIR_0P0])[k] = mfbab; + (D.f[DIR_0M0])[ks] = mfbcb; + (D.f[DIR_00P])[k] = mfbba; + (D.f[DIR_00M])[kb] = mfbbc; + (D.f[DIR_PP0])[k] = mfaab; + (D.f[DIR_MM0])[ksw] = mfccb; + (D.f[DIR_PM0])[ks] = mfacb; + (D.f[DIR_MP0])[kw] = mfcab; + (D.f[DIR_P0P])[k] = mfaba; + (D.f[DIR_M0M])[kbw] = mfcbc; + (D.f[DIR_P0M])[kb] = mfabc; + (D.f[DIR_M0P])[kw] = mfcba; + (D.f[DIR_0PP])[k] = mfbaa; + (D.f[DIR_0MM])[kbs] = mfbcc; + (D.f[DIR_0PM])[kb] = mfbac; + (D.f[DIR_0MP])[ks] = mfbca; + (D.f[DIR_000])[k] = mfbbb; + (D.f[DIR_PPP])[k] = mfaaa; + (D.f[DIR_PMP])[ks] = mfaca; + (D.f[DIR_PPM])[kb] = mfaac; + (D.f[DIR_PMM])[kbs] = mfacc; + (D.f[DIR_MPP])[kw] = mfcaa; + (D.f[DIR_MMP])[ksw] = mfcca; + (D.f[DIR_MPM])[kbw] = mfcac; + (D.f[DIR_MMM])[kbsw] = mfccc; //////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp_Device.cuh index 6f4253639f5d7bfce82f5909914c793955ef794a..50da48fa702862b71dc13b8b21b34cd1e2b39250 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK17Debug/WaleCumulantK17DebugComp_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Kernel_WaleCumulantK17DebugComp( +__global__ void LB_Kernel_WaleCumulantK17DebugComp( real omega_in, unsigned int* bcMatD, unsigned int* neighborX, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/ChimeraTransformation.h b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/ChimeraTransformation.h similarity index 100% rename from src/gpu/VirtualFluids_GPU/Kernel/ChimeraTransformation.h rename to src/gpu/VirtualFluids_GPU/Kernel/Utilities/ChimeraTransformation.h diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cu b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cu index 2b9203bf96be89fb328cbbe221994dffed481e14..7c477c539dc3526389dc22563b50501e778a63f3 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cu @@ -2,79 +2,13 @@ #include <cuda_runtime.h> -#include "LBM/D3Q27.h" #include <lbm/constants/NumericConstants.h> -#include <lbm/constants/D3Q27.h> +#include "lbm/constants/D3Q27.h" +using namespace vf::lbm::dir; -namespace vf +namespace vf::gpu { -namespace gpu -{ - -__device__ __host__ DistributionReferences27 getDistributionReferences27(real *distributions, unsigned int size_Mat, bool isEvenTimestep) -{ - DistributionReferences27 distribution_references; - - if (isEvenTimestep) { - distribution_references.f[dirE] = &distributions[dirE * size_Mat]; - distribution_references.f[dirW] = &distributions[dirW * size_Mat]; - distribution_references.f[dirN] = &distributions[dirN * size_Mat]; - distribution_references.f[dirS] = &distributions[dirS * size_Mat]; - distribution_references.f[dirT] = &distributions[dirT * size_Mat]; - distribution_references.f[dirB] = &distributions[dirB * size_Mat]; - distribution_references.f[dirNE] = &distributions[dirNE * size_Mat]; - distribution_references.f[dirSW] = &distributions[dirSW * size_Mat]; - distribution_references.f[dirSE] = &distributions[dirSE * size_Mat]; - distribution_references.f[dirNW] = &distributions[dirNW * size_Mat]; - distribution_references.f[dirTE] = &distributions[dirTE * size_Mat]; - distribution_references.f[dirBW] = &distributions[dirBW * size_Mat]; - distribution_references.f[dirBE] = &distributions[dirBE * size_Mat]; - distribution_references.f[dirTW] = &distributions[dirTW * size_Mat]; - distribution_references.f[dirTN] = &distributions[dirTN * size_Mat]; - distribution_references.f[dirBS] = &distributions[dirBS * size_Mat]; - distribution_references.f[dirBN] = &distributions[dirBN * size_Mat]; - distribution_references.f[dirTS] = &distributions[dirTS * size_Mat]; - distribution_references.f[dirREST] = &distributions[dirREST * size_Mat]; - distribution_references.f[dirTNE] = &distributions[dirTNE * size_Mat]; - distribution_references.f[dirTSW] = &distributions[dirTSW * size_Mat]; - distribution_references.f[dirTSE] = &distributions[dirTSE * size_Mat]; - distribution_references.f[dirTNW] = &distributions[dirTNW * size_Mat]; - distribution_references.f[dirBNE] = &distributions[dirBNE * size_Mat]; - distribution_references.f[dirBSW] = &distributions[dirBSW * size_Mat]; - distribution_references.f[dirBSE] = &distributions[dirBSE * size_Mat]; - distribution_references.f[dirBNW] = &distributions[dirBNW * size_Mat]; - } else { - distribution_references.f[dirW] = &distributions[dirE * size_Mat]; - distribution_references.f[dirE] = &distributions[dirW * size_Mat]; - distribution_references.f[dirS] = &distributions[dirN * size_Mat]; - distribution_references.f[dirN] = &distributions[dirS * size_Mat]; - distribution_references.f[dirB] = &distributions[dirT * size_Mat]; - distribution_references.f[dirT] = &distributions[dirB * size_Mat]; - distribution_references.f[dirSW] = &distributions[dirNE * size_Mat]; - distribution_references.f[dirNE] = &distributions[dirSW * size_Mat]; - distribution_references.f[dirNW] = &distributions[dirSE * size_Mat]; - distribution_references.f[dirSE] = &distributions[dirNW * size_Mat]; - distribution_references.f[dirBW] = &distributions[dirTE * size_Mat]; - distribution_references.f[dirTE] = &distributions[dirBW * size_Mat]; - distribution_references.f[dirTW] = &distributions[dirBE * size_Mat]; - distribution_references.f[dirBE] = &distributions[dirTW * size_Mat]; - distribution_references.f[dirBS] = &distributions[dirTN * size_Mat]; - distribution_references.f[dirTN] = &distributions[dirBS * size_Mat]; - distribution_references.f[dirTS] = &distributions[dirBN * size_Mat]; - distribution_references.f[dirBN] = &distributions[dirTS * size_Mat]; - distribution_references.f[dirREST] = &distributions[dirREST * size_Mat]; - distribution_references.f[dirBSW] = &distributions[dirTNE * size_Mat]; - distribution_references.f[dirBNE] = &distributions[dirTSW * size_Mat]; - distribution_references.f[dirBNW] = &distributions[dirTSE * size_Mat]; - distribution_references.f[dirBSE] = &distributions[dirTNW * size_Mat]; - distribution_references.f[dirTSW] = &distributions[dirBNE * size_Mat]; - distribution_references.f[dirTNE] = &distributions[dirBSW * size_Mat]; - distribution_references.f[dirTNW] = &distributions[dirBSE * size_Mat]; - distribution_references.f[dirTSE] = &distributions[dirBNW * size_Mat]; - } - return distribution_references; -} __device__ DistributionWrapper::DistributionWrapper(real *distributions, unsigned int size_Mat, bool isEvenTimestep, uint k, uint *neighborX, uint *neighborY, uint *neighborZ) @@ -86,76 +20,64 @@ __device__ DistributionWrapper::DistributionWrapper(real *distributions, unsigne __device__ void DistributionWrapper::read() { - distribution.f[vf::lbm::dir::PZZ] = (distribution_references.f[dirE])[k]; - distribution.f[vf::lbm::dir::MZZ] = (distribution_references.f[dirW])[kw]; - distribution.f[vf::lbm::dir::ZPZ] = (distribution_references.f[dirN])[k]; - distribution.f[vf::lbm::dir::ZMZ] = (distribution_references.f[dirS])[ks]; - distribution.f[vf::lbm::dir::ZZP] = (distribution_references.f[dirT])[k]; - distribution.f[vf::lbm::dir::ZZM] = (distribution_references.f[dirB])[kb]; - distribution.f[vf::lbm::dir::PPZ] = (distribution_references.f[dirNE])[k]; - distribution.f[vf::lbm::dir::MMZ] = (distribution_references.f[dirSW])[ksw]; - distribution.f[vf::lbm::dir::PMZ] = (distribution_references.f[dirSE])[ks]; - distribution.f[vf::lbm::dir::MPZ] = (distribution_references.f[dirNW])[kw]; - distribution.f[vf::lbm::dir::PZP] = (distribution_references.f[dirTE])[k]; - distribution.f[vf::lbm::dir::MZM] = (distribution_references.f[dirBW])[kbw]; - distribution.f[vf::lbm::dir::PZM] = (distribution_references.f[dirBE])[kb]; - distribution.f[vf::lbm::dir::MZP] = (distribution_references.f[dirTW])[kw]; - distribution.f[vf::lbm::dir::ZPP] = (distribution_references.f[dirTN])[k]; - distribution.f[vf::lbm::dir::ZMM] = (distribution_references.f[dirBS])[kbs]; - distribution.f[vf::lbm::dir::ZPM] = (distribution_references.f[dirBN])[kb]; - distribution.f[vf::lbm::dir::ZMP] = (distribution_references.f[dirTS])[ks]; - distribution.f[vf::lbm::dir::PPP] = (distribution_references.f[dirTNE])[k]; - distribution.f[vf::lbm::dir::MPP] = (distribution_references.f[dirTNW])[kw]; - distribution.f[vf::lbm::dir::PMP] = (distribution_references.f[dirTSE])[ks]; - distribution.f[vf::lbm::dir::MMP] = (distribution_references.f[dirTSW])[ksw]; - distribution.f[vf::lbm::dir::PPM] = (distribution_references.f[dirBNE])[kb]; - distribution.f[vf::lbm::dir::MPM] = (distribution_references.f[dirBNW])[kbw]; - distribution.f[vf::lbm::dir::PMM] = (distribution_references.f[dirBSE])[kbs]; - distribution.f[vf::lbm::dir::MMM] = (distribution_references.f[dirBSW])[kbsw]; - distribution.f[vf::lbm::dir::ZZZ] = (distribution_references.f[dirREST])[k]; + distribution.f[vf::lbm::dir::PZZ] = (distribution_references.f[DIR_P00])[k]; + distribution.f[vf::lbm::dir::MZZ] = (distribution_references.f[DIR_M00])[kw]; + distribution.f[vf::lbm::dir::ZPZ] = (distribution_references.f[DIR_0P0])[k]; + distribution.f[vf::lbm::dir::ZMZ] = (distribution_references.f[DIR_0M0])[ks]; + distribution.f[vf::lbm::dir::ZZP] = (distribution_references.f[DIR_00P])[k]; + distribution.f[vf::lbm::dir::ZZM] = (distribution_references.f[DIR_00M])[kb]; + distribution.f[vf::lbm::dir::PPZ] = (distribution_references.f[DIR_PP0])[k]; + distribution.f[vf::lbm::dir::MMZ] = (distribution_references.f[DIR_MM0])[ksw]; + distribution.f[vf::lbm::dir::PMZ] = (distribution_references.f[DIR_PM0])[ks]; + distribution.f[vf::lbm::dir::MPZ] = (distribution_references.f[DIR_MP0])[kw]; + distribution.f[vf::lbm::dir::PZP] = (distribution_references.f[DIR_P0P])[k]; + distribution.f[vf::lbm::dir::MZM] = (distribution_references.f[DIR_M0M])[kbw]; + distribution.f[vf::lbm::dir::PZM] = (distribution_references.f[DIR_P0M])[kb]; + distribution.f[vf::lbm::dir::MZP] = (distribution_references.f[DIR_M0P])[kw]; + distribution.f[vf::lbm::dir::ZPP] = (distribution_references.f[DIR_0PP])[k]; + distribution.f[vf::lbm::dir::ZMM] = (distribution_references.f[DIR_0MM])[kbs]; + distribution.f[vf::lbm::dir::ZPM] = (distribution_references.f[DIR_0PM])[kb]; + distribution.f[vf::lbm::dir::ZMP] = (distribution_references.f[DIR_0MP])[ks]; + distribution.f[vf::lbm::dir::PPP] = (distribution_references.f[DIR_PPP])[k]; + distribution.f[vf::lbm::dir::MPP] = (distribution_references.f[DIR_MPP])[kw]; + distribution.f[vf::lbm::dir::PMP] = (distribution_references.f[DIR_PMP])[ks]; + distribution.f[vf::lbm::dir::MMP] = (distribution_references.f[DIR_MMP])[ksw]; + distribution.f[vf::lbm::dir::PPM] = (distribution_references.f[DIR_PPM])[kb]; + distribution.f[vf::lbm::dir::MPM] = (distribution_references.f[DIR_MPM])[kbw]; + distribution.f[vf::lbm::dir::PMM] = (distribution_references.f[DIR_PMM])[kbs]; + distribution.f[vf::lbm::dir::MMM] = (distribution_references.f[DIR_MMM])[kbsw]; + distribution.f[vf::lbm::dir::ZZZ] = (distribution_references.f[DIR_000])[k]; } __device__ void DistributionWrapper::write() { - (distribution_references.f[dirE])[k] = distribution.f[vf::lbm::dir::PZZ]; - (distribution_references.f[dirW])[kw] = distribution.f[vf::lbm::dir::MZZ]; - (distribution_references.f[dirN])[k] = distribution.f[vf::lbm::dir::ZPZ]; - (distribution_references.f[dirS])[ks] = distribution.f[vf::lbm::dir::ZMZ]; - (distribution_references.f[dirT])[k] = distribution.f[vf::lbm::dir::ZZP]; - (distribution_references.f[dirB])[kb] = distribution.f[vf::lbm::dir::ZZM]; - (distribution_references.f[dirNE])[k] = distribution.f[vf::lbm::dir::PPZ]; - (distribution_references.f[dirSW])[ksw] = distribution.f[vf::lbm::dir::MMZ]; - (distribution_references.f[dirSE])[ks] = distribution.f[vf::lbm::dir::PMZ]; - (distribution_references.f[dirNW])[kw] = distribution.f[vf::lbm::dir::MPZ]; - (distribution_references.f[dirTE])[k] = distribution.f[vf::lbm::dir::PZP]; - (distribution_references.f[dirBW])[kbw] = distribution.f[vf::lbm::dir::MZM]; - (distribution_references.f[dirBE])[kb] = distribution.f[vf::lbm::dir::PZM]; - (distribution_references.f[dirTW])[kw] = distribution.f[vf::lbm::dir::MZP]; - (distribution_references.f[dirTN])[k] = distribution.f[vf::lbm::dir::ZPP]; - (distribution_references.f[dirBS])[kbs] = distribution.f[vf::lbm::dir::ZMM]; - (distribution_references.f[dirBN])[kb] = distribution.f[vf::lbm::dir::ZPM]; - (distribution_references.f[dirTS])[ks] = distribution.f[vf::lbm::dir::ZMP]; - (distribution_references.f[dirTNE])[k] = distribution.f[vf::lbm::dir::PPP]; - (distribution_references.f[dirTNW])[kw] = distribution.f[vf::lbm::dir::MPP]; - (distribution_references.f[dirTSE])[ks] = distribution.f[vf::lbm::dir::PMP]; - (distribution_references.f[dirTSW])[ksw] = distribution.f[vf::lbm::dir::MMP]; - (distribution_references.f[dirBNE])[kb] = distribution.f[vf::lbm::dir::PPM]; - (distribution_references.f[dirBNW])[kbw] = distribution.f[vf::lbm::dir::MPM]; - (distribution_references.f[dirBSE])[kbs] = distribution.f[vf::lbm::dir::PMM]; - (distribution_references.f[dirBSW])[kbsw] = distribution.f[vf::lbm::dir::MMM]; - (distribution_references.f[dirREST])[k] = distribution.f[vf::lbm::dir::ZZZ]; -} - -__device__ unsigned int getNodeIndex() -{ - const unsigned x = threadIdx.x; - const unsigned y = blockIdx.x; - const unsigned z = blockIdx.y; - - const unsigned nx = blockDim.x; - const unsigned ny = gridDim.x; - - return nx * (ny * z + y) + x; + (distribution_references.f[DIR_P00])[k] = distribution.f[vf::lbm::dir::PZZ]; + (distribution_references.f[DIR_M00])[kw] = distribution.f[vf::lbm::dir::MZZ]; + (distribution_references.f[DIR_0P0])[k] = distribution.f[vf::lbm::dir::ZPZ]; + (distribution_references.f[DIR_0M0])[ks] = distribution.f[vf::lbm::dir::ZMZ]; + (distribution_references.f[DIR_00P])[k] = distribution.f[vf::lbm::dir::ZZP]; + (distribution_references.f[DIR_00M])[kb] = distribution.f[vf::lbm::dir::ZZM]; + (distribution_references.f[DIR_PP0])[k] = distribution.f[vf::lbm::dir::PPZ]; + (distribution_references.f[DIR_MM0])[ksw] = distribution.f[vf::lbm::dir::MMZ]; + (distribution_references.f[DIR_PM0])[ks] = distribution.f[vf::lbm::dir::PMZ]; + (distribution_references.f[DIR_MP0])[kw] = distribution.f[vf::lbm::dir::MPZ]; + (distribution_references.f[DIR_P0P])[k] = distribution.f[vf::lbm::dir::PZP]; + (distribution_references.f[DIR_M0M])[kbw] = distribution.f[vf::lbm::dir::MZM]; + (distribution_references.f[DIR_P0M])[kb] = distribution.f[vf::lbm::dir::PZM]; + (distribution_references.f[DIR_M0P])[kw] = distribution.f[vf::lbm::dir::MZP]; + (distribution_references.f[DIR_0PP])[k] = distribution.f[vf::lbm::dir::ZPP]; + (distribution_references.f[DIR_0MM])[kbs] = distribution.f[vf::lbm::dir::ZMM]; + (distribution_references.f[DIR_0PM])[kb] = distribution.f[vf::lbm::dir::ZPM]; + (distribution_references.f[DIR_0MP])[ks] = distribution.f[vf::lbm::dir::ZMP]; + (distribution_references.f[DIR_PPP])[k] = distribution.f[vf::lbm::dir::PPP]; + (distribution_references.f[DIR_MPP])[kw] = distribution.f[vf::lbm::dir::MPP]; + (distribution_references.f[DIR_PMP])[ks] = distribution.f[vf::lbm::dir::PMP]; + (distribution_references.f[DIR_MMP])[ksw] = distribution.f[vf::lbm::dir::MMP]; + (distribution_references.f[DIR_PPM])[kb] = distribution.f[vf::lbm::dir::PPM]; + (distribution_references.f[DIR_MPM])[kbw] = distribution.f[vf::lbm::dir::MPM]; + (distribution_references.f[DIR_PMM])[kbs] = distribution.f[vf::lbm::dir::PMM]; + (distribution_references.f[DIR_MMM])[kbsw] = distribution.f[vf::lbm::dir::MMM]; + (distribution_references.f[DIR_000])[k] = distribution.f[vf::lbm::dir::ZZZ]; } __device__ bool isValidFluidNode(uint nodeType) @@ -164,5 +86,4 @@ __device__ bool isValidFluidNode(uint nodeType) } -} // namespace gpu -} // namespace vf +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cuh index 6b38cac75c99680c71420533455dd060195b6c87..1009ecfa92f31e821d825ad72ba681bc3ae96d1b 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cuh @@ -35,12 +35,77 @@ #include "LBM/LB.h" -#include <lbm/KernelParameter.h> +#include "lbm/KernelParameter.h" +#include "lbm/constants/D3Q27.h" -namespace vf +using namespace vf::lbm::dir; + +namespace vf::gpu { -namespace gpu + +__inline__ __device__ __host__ void getPointersToDistributions(Distributions27 &dist, real *distributionArray, const uint numberOfLBnodes, const bool isEvenTimestep) { + if (isEvenTimestep) + { + dist.f[DIR_000] = &distributionArray[DIR_000 * numberOfLBnodes]; + dist.f[DIR_P00] = &distributionArray[DIR_P00 * numberOfLBnodes]; + dist.f[DIR_M00] = &distributionArray[DIR_M00 * numberOfLBnodes]; + dist.f[DIR_0P0] = &distributionArray[DIR_0P0 * numberOfLBnodes]; + dist.f[DIR_0M0] = &distributionArray[DIR_0M0 * numberOfLBnodes]; + dist.f[DIR_00P] = &distributionArray[DIR_00P * numberOfLBnodes]; + dist.f[DIR_00M] = &distributionArray[DIR_00M * numberOfLBnodes]; + dist.f[DIR_PP0] = &distributionArray[DIR_PP0 * numberOfLBnodes]; + dist.f[DIR_MM0] = &distributionArray[DIR_MM0 * numberOfLBnodes]; + dist.f[DIR_PM0] = &distributionArray[DIR_PM0 * numberOfLBnodes]; + dist.f[DIR_MP0] = &distributionArray[DIR_MP0 * numberOfLBnodes]; + dist.f[DIR_P0P] = &distributionArray[DIR_P0P * numberOfLBnodes]; + dist.f[DIR_M0M] = &distributionArray[DIR_M0M * numberOfLBnodes]; + dist.f[DIR_P0M] = &distributionArray[DIR_P0M * numberOfLBnodes]; + dist.f[DIR_M0P] = &distributionArray[DIR_M0P * numberOfLBnodes]; + dist.f[DIR_0PP] = &distributionArray[DIR_0PP * numberOfLBnodes]; + dist.f[DIR_0MM] = &distributionArray[DIR_0MM * numberOfLBnodes]; + dist.f[DIR_0PM] = &distributionArray[DIR_0PM * numberOfLBnodes]; + dist.f[DIR_0MP] = &distributionArray[DIR_0MP * numberOfLBnodes]; + dist.f[DIR_PPP] = &distributionArray[DIR_PPP * numberOfLBnodes]; + dist.f[DIR_MMP] = &distributionArray[DIR_MMP * numberOfLBnodes]; + dist.f[DIR_PMP] = &distributionArray[DIR_PMP * numberOfLBnodes]; + dist.f[DIR_MPP] = &distributionArray[DIR_MPP * numberOfLBnodes]; + dist.f[DIR_PPM] = &distributionArray[DIR_PPM * numberOfLBnodes]; + dist.f[DIR_MMM] = &distributionArray[DIR_MMM * numberOfLBnodes]; + dist.f[DIR_PMM] = &distributionArray[DIR_PMM * numberOfLBnodes]; + dist.f[DIR_MPM] = &distributionArray[DIR_MPM * numberOfLBnodes]; + } + else + { + dist.f[DIR_M00] = &distributionArray[DIR_P00 * numberOfLBnodes]; + dist.f[DIR_P00] = &distributionArray[DIR_M00 * numberOfLBnodes]; + dist.f[DIR_0M0] = &distributionArray[DIR_0P0 * numberOfLBnodes]; + dist.f[DIR_0P0] = &distributionArray[DIR_0M0 * numberOfLBnodes]; + dist.f[DIR_00M] = &distributionArray[DIR_00P * numberOfLBnodes]; + dist.f[DIR_00P] = &distributionArray[DIR_00M * numberOfLBnodes]; + dist.f[DIR_MM0] = &distributionArray[DIR_PP0 * numberOfLBnodes]; + dist.f[DIR_PP0] = &distributionArray[DIR_MM0 * numberOfLBnodes]; + dist.f[DIR_MP0] = &distributionArray[DIR_PM0 * numberOfLBnodes]; + dist.f[DIR_PM0] = &distributionArray[DIR_MP0 * numberOfLBnodes]; + dist.f[DIR_M0M] = &distributionArray[DIR_P0P * numberOfLBnodes]; + dist.f[DIR_P0P] = &distributionArray[DIR_M0M * numberOfLBnodes]; + dist.f[DIR_M0P] = &distributionArray[DIR_P0M * numberOfLBnodes]; + dist.f[DIR_P0M] = &distributionArray[DIR_M0P * numberOfLBnodes]; + dist.f[DIR_0MM] = &distributionArray[DIR_0PP * numberOfLBnodes]; + dist.f[DIR_0PP] = &distributionArray[DIR_0MM * numberOfLBnodes]; + dist.f[DIR_0MP] = &distributionArray[DIR_0PM * numberOfLBnodes]; + dist.f[DIR_0PM] = &distributionArray[DIR_0MP * numberOfLBnodes]; + dist.f[DIR_000] = &distributionArray[DIR_000 * numberOfLBnodes]; + dist.f[DIR_PPP] = &distributionArray[DIR_MMM * numberOfLBnodes]; + dist.f[DIR_MMP] = &distributionArray[DIR_PPM * numberOfLBnodes]; + dist.f[DIR_PMP] = &distributionArray[DIR_MPM * numberOfLBnodes]; + dist.f[DIR_MPP] = &distributionArray[DIR_PMM * numberOfLBnodes]; + dist.f[DIR_PPM] = &distributionArray[DIR_MMP * numberOfLBnodes]; + dist.f[DIR_MMM] = &distributionArray[DIR_PPP * numberOfLBnodes]; + dist.f[DIR_PMM] = &distributionArray[DIR_MPP * numberOfLBnodes]; + dist.f[DIR_MPM] = &distributionArray[DIR_PMP * numberOfLBnodes]; + } +} /** * Getting references to the 27 directions. @@ -49,7 +114,11 @@ namespace gpu * @params isEvenTimestep: stored data dependent on timestep is based on the esoteric twist algorithm * @return a data struct containing the addresses to the 27 directions within the 1D distribution array */ -__device__ __host__ DistributionReferences27 getDistributionReferences27(real* distributions, unsigned int matrix_size, bool isEvenTimestep); +__inline__ __device__ __host__ DistributionReferences27 getDistributionReferences27(real* distributions, unsigned int numberOfLBnodes, bool isEvenTimestep){ + DistributionReferences27 distribution_references; + getPointersToDistributions(distribution_references, distributions, numberOfLBnodes, isEvenTimestep); + return distribution_references; +} /** @@ -88,11 +157,20 @@ struct DistributionWrapper const uint kbsw; }; -__device__ unsigned int getNodeIndex(); +__inline__ __device__ unsigned int getNodeIndex() +{ + const unsigned x = threadIdx.x; + const unsigned y = blockIdx.x; + const unsigned z = blockIdx.y; -__device__ bool isValidFluidNode(uint nodeType); + const unsigned nx = blockDim.x; + const unsigned ny = gridDim.x; + return nx * (ny * z + y) + x; } + +__device__ bool isValidFluidNode(uint nodeType); + } #endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelperTests.cpp b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelperTests.cpp index 46d3fe890fd2f412251044cce6ade51f08ba0185..9d6529404284f786f85a7445e494487fe75d8ad7 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelperTests.cpp +++ b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelperTests.cpp @@ -1,18 +1,10 @@ #include <gmock/gmock.h> +#include "basics/tests/testUtilities.h" #include "DistributionHelper.cuh" -#include "LBM/D3Q27.h" - - -auto RealEq = [](auto value) { -#ifdef VF_DOUBLE_ACCURACY - return testing::DoubleEq(value); -#else - return testing::FloatEq(value); -#endif -}; - +#include "lbm/constants/D3Q27.h" +using namespace vf::lbm::dir; TEST(DistributionHelperTests, getPointerToDistribution_WhenEvenTimeStep_ShouldBeEqualToInput) { @@ -24,33 +16,33 @@ TEST(DistributionHelperTests, getPointerToDistribution_WhenEvenTimeStep_ShouldBe Distributions27 distribution_out = vf::gpu::getDistributionReferences27(distributions_in, size_Mat, isEvenTimeStep); - EXPECT_THAT(*distribution_out.f[dirE], RealEq(distributions_in[dirE])); - EXPECT_THAT(*distribution_out.f[dirW], RealEq(distributions_in[dirW])); - EXPECT_THAT(*distribution_out.f[dirN], RealEq(distributions_in[dirN])); - EXPECT_THAT(*distribution_out.f[dirS], RealEq(distributions_in[dirS])); - EXPECT_THAT(*distribution_out.f[dirT], RealEq(distributions_in[dirT])); - EXPECT_THAT(*distribution_out.f[dirB], RealEq(distributions_in[dirB])); - EXPECT_THAT(*distribution_out.f[dirNE], RealEq(distributions_in[dirNE])); - EXPECT_THAT(*distribution_out.f[dirSW], RealEq(distributions_in[dirSW])); - EXPECT_THAT(*distribution_out.f[dirSE], RealEq(distributions_in[dirSE])); - EXPECT_THAT(*distribution_out.f[dirNW], RealEq(distributions_in[dirNW])); - EXPECT_THAT(*distribution_out.f[dirTE], RealEq(distributions_in[dirTE])); - EXPECT_THAT(*distribution_out.f[dirBW], RealEq(distributions_in[dirBW])); - EXPECT_THAT(*distribution_out.f[dirBE], RealEq(distributions_in[dirBE])); - EXPECT_THAT(*distribution_out.f[dirTW], RealEq(distributions_in[dirTW])); - EXPECT_THAT(*distribution_out.f[dirTN], RealEq(distributions_in[dirTN])); - EXPECT_THAT(*distribution_out.f[dirBS], RealEq(distributions_in[dirBS])); - EXPECT_THAT(*distribution_out.f[dirBN], RealEq(distributions_in[dirBN])); - EXPECT_THAT(*distribution_out.f[dirTS], RealEq(distributions_in[dirTS])); - EXPECT_THAT(*distribution_out.f[dirREST], RealEq(distributions_in[dirREST])); - EXPECT_THAT(*distribution_out.f[dirTNE], RealEq(distributions_in[dirTNE])); - EXPECT_THAT(*distribution_out.f[dirTSW], RealEq(distributions_in[dirTSW])); - EXPECT_THAT(*distribution_out.f[dirTSE], RealEq(distributions_in[dirTSE])); - EXPECT_THAT(*distribution_out.f[dirTNW], RealEq(distributions_in[dirTNW])); - EXPECT_THAT(*distribution_out.f[dirBNE], RealEq(distributions_in[dirBNE])); - EXPECT_THAT(*distribution_out.f[dirBSW], RealEq(distributions_in[dirBSW])); - EXPECT_THAT(*distribution_out.f[dirBSE], RealEq(distributions_in[dirBSE])); - EXPECT_THAT(*distribution_out.f[dirBNW], RealEq(distributions_in[dirBNW])); + EXPECT_THAT(*distribution_out.f[DIR_P00], RealEq(distributions_in[DIR_P00])); + EXPECT_THAT(*distribution_out.f[DIR_M00], RealEq(distributions_in[DIR_M00])); + EXPECT_THAT(*distribution_out.f[DIR_0P0], RealEq(distributions_in[DIR_0P0])); + EXPECT_THAT(*distribution_out.f[DIR_0M0], RealEq(distributions_in[DIR_0M0])); + EXPECT_THAT(*distribution_out.f[DIR_00P], RealEq(distributions_in[DIR_00P])); + EXPECT_THAT(*distribution_out.f[DIR_00M], RealEq(distributions_in[DIR_00M])); + EXPECT_THAT(*distribution_out.f[DIR_PP0], RealEq(distributions_in[DIR_PP0])); + EXPECT_THAT(*distribution_out.f[DIR_MM0], RealEq(distributions_in[DIR_MM0])); + EXPECT_THAT(*distribution_out.f[DIR_PM0], RealEq(distributions_in[DIR_PM0])); + EXPECT_THAT(*distribution_out.f[DIR_MP0], RealEq(distributions_in[DIR_MP0])); + EXPECT_THAT(*distribution_out.f[DIR_P0P], RealEq(distributions_in[DIR_P0P])); + EXPECT_THAT(*distribution_out.f[DIR_M0M], RealEq(distributions_in[DIR_M0M])); + EXPECT_THAT(*distribution_out.f[DIR_P0M], RealEq(distributions_in[DIR_P0M])); + EXPECT_THAT(*distribution_out.f[DIR_M0P], RealEq(distributions_in[DIR_M0P])); + EXPECT_THAT(*distribution_out.f[DIR_0PP], RealEq(distributions_in[DIR_0PP])); + EXPECT_THAT(*distribution_out.f[DIR_0MM], RealEq(distributions_in[DIR_0MM])); + EXPECT_THAT(*distribution_out.f[DIR_0PM], RealEq(distributions_in[DIR_0PM])); + EXPECT_THAT(*distribution_out.f[DIR_0MP], RealEq(distributions_in[DIR_0MP])); + EXPECT_THAT(*distribution_out.f[DIR_000], RealEq(distributions_in[DIR_000])); + EXPECT_THAT(*distribution_out.f[DIR_PPP], RealEq(distributions_in[DIR_PPP])); + EXPECT_THAT(*distribution_out.f[DIR_MMP], RealEq(distributions_in[DIR_MMP])); + EXPECT_THAT(*distribution_out.f[DIR_PMP], RealEq(distributions_in[DIR_PMP])); + EXPECT_THAT(*distribution_out.f[DIR_MPP], RealEq(distributions_in[DIR_MPP])); + EXPECT_THAT(*distribution_out.f[DIR_PPM], RealEq(distributions_in[DIR_PPM])); + EXPECT_THAT(*distribution_out.f[DIR_MMM], RealEq(distributions_in[DIR_MMM])); + EXPECT_THAT(*distribution_out.f[DIR_PMM], RealEq(distributions_in[DIR_PMM])); + EXPECT_THAT(*distribution_out.f[DIR_MPM], RealEq(distributions_in[DIR_MPM])); } TEST(DistributionHelperTests, getPointerToDistribution_WhenOddTimeStep_ShouldBeSwapped) @@ -63,31 +55,31 @@ TEST(DistributionHelperTests, getPointerToDistribution_WhenOddTimeStep_ShouldBeS Distributions27 distribution_out = vf::gpu::getDistributionReferences27(distributions_in, size_Mat, isEvenTimeStep); - EXPECT_THAT(*distribution_out.f[dirW], RealEq(distributions_in[dirE])); - EXPECT_THAT(*distribution_out.f[dirE], RealEq(distributions_in[dirW])); - EXPECT_THAT(*distribution_out.f[dirS], RealEq(distributions_in[dirN])); - EXPECT_THAT(*distribution_out.f[dirN], RealEq(distributions_in[dirS])); - EXPECT_THAT(*distribution_out.f[dirB], RealEq(distributions_in[dirT])); - EXPECT_THAT(*distribution_out.f[dirT], RealEq(distributions_in[dirB])); - EXPECT_THAT(*distribution_out.f[dirSW], RealEq(distributions_in[dirNE])); - EXPECT_THAT(*distribution_out.f[dirNE], RealEq(distributions_in[dirSW])); - EXPECT_THAT(*distribution_out.f[dirNW], RealEq(distributions_in[dirSE])); - EXPECT_THAT(*distribution_out.f[dirSE], RealEq(distributions_in[dirNW])); - EXPECT_THAT(*distribution_out.f[dirBW], RealEq(distributions_in[dirTE])); - EXPECT_THAT(*distribution_out.f[dirTE], RealEq(distributions_in[dirBW])); - EXPECT_THAT(*distribution_out.f[dirTW], RealEq(distributions_in[dirBE])); - EXPECT_THAT(*distribution_out.f[dirBE], RealEq(distributions_in[dirTW])); - EXPECT_THAT(*distribution_out.f[dirBS], RealEq(distributions_in[dirTN])); - EXPECT_THAT(*distribution_out.f[dirTN], RealEq(distributions_in[dirBS])); - EXPECT_THAT(*distribution_out.f[dirTS], RealEq(distributions_in[dirBN])); - EXPECT_THAT(*distribution_out.f[dirBN], RealEq(distributions_in[dirTS])); - EXPECT_THAT(*distribution_out.f[dirREST], RealEq(distributions_in[dirREST])); - EXPECT_THAT(*distribution_out.f[dirBSW], RealEq(distributions_in[dirTNE])); - EXPECT_THAT(*distribution_out.f[dirBNE], RealEq(distributions_in[dirTSW])); - EXPECT_THAT(*distribution_out.f[dirBNW], RealEq(distributions_in[dirTSE])); - EXPECT_THAT(*distribution_out.f[dirBSE], RealEq(distributions_in[dirTNW])); - EXPECT_THAT(*distribution_out.f[dirTSW], RealEq(distributions_in[dirBNE])); - EXPECT_THAT(*distribution_out.f[dirTNE], RealEq(distributions_in[dirBSW])); - EXPECT_THAT(*distribution_out.f[dirTNW], RealEq(distributions_in[dirBSE])); - EXPECT_THAT(*distribution_out.f[dirTSE], RealEq(distributions_in[dirBNW])); + EXPECT_THAT(*distribution_out.f[DIR_M00], RealEq(distributions_in[DIR_P00])); + EXPECT_THAT(*distribution_out.f[DIR_P00], RealEq(distributions_in[DIR_M00])); + EXPECT_THAT(*distribution_out.f[DIR_0M0], RealEq(distributions_in[DIR_0P0])); + EXPECT_THAT(*distribution_out.f[DIR_0P0], RealEq(distributions_in[DIR_0M0])); + EXPECT_THAT(*distribution_out.f[DIR_00M], RealEq(distributions_in[DIR_00P])); + EXPECT_THAT(*distribution_out.f[DIR_00P], RealEq(distributions_in[DIR_00M])); + EXPECT_THAT(*distribution_out.f[DIR_MM0], RealEq(distributions_in[DIR_PP0])); + EXPECT_THAT(*distribution_out.f[DIR_PP0], RealEq(distributions_in[DIR_MM0])); + EXPECT_THAT(*distribution_out.f[DIR_MP0], RealEq(distributions_in[DIR_PM0])); + EXPECT_THAT(*distribution_out.f[DIR_PM0], RealEq(distributions_in[DIR_MP0])); + EXPECT_THAT(*distribution_out.f[DIR_M0M], RealEq(distributions_in[DIR_P0P])); + EXPECT_THAT(*distribution_out.f[DIR_P0P], RealEq(distributions_in[DIR_M0M])); + EXPECT_THAT(*distribution_out.f[DIR_M0P], RealEq(distributions_in[DIR_P0M])); + EXPECT_THAT(*distribution_out.f[DIR_P0M], RealEq(distributions_in[DIR_M0P])); + EXPECT_THAT(*distribution_out.f[DIR_0MM], RealEq(distributions_in[DIR_0PP])); + EXPECT_THAT(*distribution_out.f[DIR_0PP], RealEq(distributions_in[DIR_0MM])); + EXPECT_THAT(*distribution_out.f[DIR_0MP], RealEq(distributions_in[DIR_0PM])); + EXPECT_THAT(*distribution_out.f[DIR_0PM], RealEq(distributions_in[DIR_0MP])); + EXPECT_THAT(*distribution_out.f[DIR_000], RealEq(distributions_in[DIR_000])); + EXPECT_THAT(*distribution_out.f[DIR_MMM], RealEq(distributions_in[DIR_PPP])); + EXPECT_THAT(*distribution_out.f[DIR_PPM], RealEq(distributions_in[DIR_MMP])); + EXPECT_THAT(*distribution_out.f[DIR_MPM], RealEq(distributions_in[DIR_PMP])); + EXPECT_THAT(*distribution_out.f[DIR_PMM], RealEq(distributions_in[DIR_MPP])); + EXPECT_THAT(*distribution_out.f[DIR_MMP], RealEq(distributions_in[DIR_PPM])); + EXPECT_THAT(*distribution_out.f[DIR_PPP], RealEq(distributions_in[DIR_MMM])); + EXPECT_THAT(*distribution_out.f[DIR_MPP], RealEq(distributions_in[DIR_PMM])); + EXPECT_THAT(*distribution_out.f[DIR_PMP], RealEq(distributions_in[DIR_MPM])); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp index 5f63df1c9afc17a62a9a47ce82401ebba4453872..53ec240f096080097416e640fdd095c3812fb34c 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp +++ b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp @@ -11,6 +11,8 @@ #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Comp.h" #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.h" #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.h" +#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimStream/CumulantK17CompChimStream.h" +#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chimRedesigned/CumulantK17CompChimRedesigned.h" #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.h" #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.h" #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.h" @@ -47,6 +49,9 @@ #include "Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15/WaleCumulantK15Comp.h" #include "Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp.h" +//turbulent viscosity kernel +#include "Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/CumulantK17chim/TurbulentViscosityCumulantK17CompChim.h" + //strategies #include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/FluidFlowCompStrategy.h" #include "Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/FluidFlowIncompStrategy.h" @@ -56,15 +61,7 @@ #include "Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADMod7IncompStrategy.h" #include "Kernel/Kernels/PorousMediaKernels/FluidFlow/Compressible/PMFluidFlowCompStrategy.h" #include "Kernel/Kernels/WaleKernels/FluidFlow/Compressible/WaleFluidFlowCompStrategy.h" - - -std::shared_ptr<KernelFactoryImp> KernelFactoryImp::getInstance() -{ - static std::shared_ptr<KernelFactoryImp> uniqueInstance; - if (!uniqueInstance) - uniqueInstance = std::shared_ptr<KernelFactoryImp>(new KernelFactoryImp()); - return uniqueInstance; -} +#include "Kernel/Kernels/TurbulentViscosityKernels/FluidFlow/Compressible/TurbulentViscosityFluidFlowCompStrategy.h" std::vector<std::shared_ptr<Kernel>> KernelFactoryImp::makeKernels(std::shared_ptr<Parameter> para) { @@ -136,6 +133,12 @@ std::shared_ptr<Kernel> KernelFactoryImp::makeKernel(std::shared_ptr<Parameter> } else if (kernel == "CumulantK17CompChim") { newKernel = CumulantK17CompChim::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); + } else if (kernel == "CumulantK17CompChimStream") { + newKernel = CumulantK17CompChimStream::getNewInstance(para, level); + checkStrategy = FluidFlowCompStrategy::getInstance(); + } else if (kernel == "CumulantK17CompChimRedesigned") { + newKernel = CumulantK17CompChimRedesigned::getNewInstance(para, level); + checkStrategy = FluidFlowCompStrategy::getInstance(); } else if (kernel == "CumulantAll4CompSP27") { newKernel = CumulantAll4CompSP27::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); @@ -176,7 +179,7 @@ std::shared_ptr<Kernel> KernelFactoryImp::makeKernel(std::shared_ptr<Parameter> } else if (kernel == "CumulantK15Incomp") { // /\ // newKernel = CumulantK15Incomp::getNewInstance(para, level); // || checkStrategy = FluidFlowIncompStrategy::getInstance(); // incompressible - } //=============== + } //=============== else if (kernel == "PMCumulantOneCompSP27") { // porous media newKernel = PMCumulantOneCompSP27::getNewInstance(para, pm, level); // || checkStrategy = PMFluidFlowCompStrategy::getInstance(); // porous media @@ -192,15 +195,40 @@ std::shared_ptr<Kernel> KernelFactoryImp::makeKernel(std::shared_ptr<Parameter> checkStrategy = WaleFluidFlowCompStrategy::getInstance(); } else if (kernel == "WaleBySoniMalavCumulantK15Comp") { // /\ // newKernel = WaleBySoniMalavCumulantK15Comp::getNewInstance(para, level);// || - checkStrategy = WaleFluidFlowCompStrategy::getInstance(); // wale model - } //=============== + checkStrategy = WaleFluidFlowCompStrategy::getInstance(); // wale model + } //=============== + else if (kernel == "TurbulentViscosityCumulantK17CompChim"){ // compressible with turbulent viscosity + switch(para->getTurbulenceModel()) // || + { // \/ // + case TurbulenceModel::AMD: + newKernel = TurbulentViscosityCumulantK17CompChim<TurbulenceModel::AMD>::getNewInstance(para, level); + break; + case TurbulenceModel::Smagorinsky: + newKernel = TurbulentViscosityCumulantK17CompChim<TurbulenceModel::Smagorinsky>::getNewInstance(para, level); + break; + case TurbulenceModel::QR: + newKernel = TurbulentViscosityCumulantK17CompChim<TurbulenceModel::QR>::getNewInstance(para, level); + break; + case TurbulenceModel::None: + throw std::runtime_error("TurbulentViscosityCumulantK17CompChim currently not implemented for TurbulenceModel::None!"); + break; + default: + throw std::runtime_error("Unknown turbulence model!"); + break; + } + checkStrategy = TurbulentViscosityFluidFlowCompStrategy::getInstance(); + // /\ // + // || + // compressible with turbulent viscosity + //=============== + } else { throw std::runtime_error("KernelFactory does not know the KernelType."); } - newKernel->setCheckParameterStrategy(checkStrategy); - return newKernel; - + newKernel->setCheckParameterStrategy(checkStrategy); + para->setKernelNeedsFluidNodeIndicesToRun(newKernel->getKernelUsesFluidNodeIndices()); + return newKernel; } std::shared_ptr<ADKernel> KernelFactoryImp::makeAdvDifKernel(std::shared_ptr<Parameter> para, std::string kernel, int level) @@ -231,8 +259,3 @@ std::shared_ptr<ADKernel> KernelFactoryImp::makeAdvDifKernel(std::shared_ptr<Par else throw std::runtime_error("KernelFactory does not know the KernelType."); } - -KernelFactoryImp::KernelFactoryImp() -{ - -} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h index 8373988df0c035007209f1a266723e6d50bcb5d7..064e9fbddfce4ddc71195536bfd5c20cd88660ee 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h +++ b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.h @@ -8,15 +8,11 @@ class PorousMedia; class VIRTUALFLUIDS_GPU_EXPORT KernelFactoryImp : public KernelFactory { public: - static std::shared_ptr< KernelFactoryImp> getInstance(); std::vector< std::shared_ptr< Kernel>> makeKernels(std::shared_ptr<Parameter> para); std::vector< std::shared_ptr< ADKernel>> makeAdvDifKernels(std::shared_ptr<Parameter> para); void setPorousMedia(std::vector<std::shared_ptr<PorousMedia>> pm); -private: - KernelFactoryImp(); - std::shared_ptr<Kernel> makeKernel(std::shared_ptr<Parameter> para, std::string kernel, int level); std::shared_ptr<ADKernel> makeAdvDifKernel(std::shared_ptr<Parameter> para, std::string kernel, int level); void setKernelAtLevel(std::vector< std::shared_ptr<Kernel>> kernels, std::shared_ptr<Parameter> para, std::string kernel, int level); diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/ScalingHelperFunctions.h b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/ScalingHelperFunctions.h new file mode 100644 index 0000000000000000000000000000000000000000..13ce5d88aaa7cb49225fa914c1f59c2de05802f5 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/ScalingHelperFunctions.h @@ -0,0 +1,148 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file scalingHelperFunctions.h +//! \ingroup GPU/Kernel/Utilities +//! \author Martin Schoenherr, Anna Wellmann +//======================================================================================= + +#ifndef SCALING_HELPER_FUNCTIONS_H +#define SCALING_HELPER_FUNCTIONS_H + +#include "LBM/LB.h" +#include "lbm/constants/D3Q27.h" +#include "lbm/constants/NumericConstants.h" + +using namespace vf::lbm::constant; +using namespace vf::lbm::dir; + +__device__ __inline__ void calculateMomentsOnSourceNodes( + Distributions27& dist, + real& omega, + unsigned int& k_000, + unsigned int& k_M00, + unsigned int& k_0M0, + unsigned int& k_00M, + unsigned int& k_MM0, + unsigned int& k_M0M, + unsigned int& k_0MM, + unsigned int& k_MMM, + real& drho, + real& velocityX, + real& velocityY, + real& velocityZ, + real& kxyFromfcNEQ, + real& kyzFromfcNEQ, + real& kxzFromfcNEQ, + real& kxxMyyFromfcNEQ, + real& kxxMzzFromfcNEQ + ){ + //////////////////////////////////////////////////////////////////////////////////// + //! - Set local distributions (f's) on source nodes: + //! + real f_000 = (dist.f[DIR_000])[k_000]; + real f_P00 = (dist.f[DIR_P00])[k_000]; + real f_M00 = (dist.f[DIR_M00])[k_M00]; + real f_0P0 = (dist.f[DIR_0P0])[k_000]; + real f_0M0 = (dist.f[DIR_0M0])[k_0M0]; + real f_00P = (dist.f[DIR_00P])[k_000]; + real f_00M = (dist.f[DIR_00M])[k_00M]; + real f_PP0 = (dist.f[DIR_PP0])[k_000]; + real f_MM0 = (dist.f[DIR_MM0])[k_MM0]; + real f_PM0 = (dist.f[DIR_PM0])[k_0M0]; + real f_MP0 = (dist.f[DIR_MP0])[k_M00]; + real f_P0P = (dist.f[DIR_P0P])[k_000]; + real f_M0M = (dist.f[DIR_M0M])[k_M0M]; + real f_P0M = (dist.f[DIR_P0M])[k_00M]; + real f_M0P = (dist.f[DIR_M0P])[k_M00]; + real f_0PP = (dist.f[DIR_0PP])[k_000]; + real f_0MM = (dist.f[DIR_0MM])[k_0MM]; + real f_0PM = (dist.f[DIR_0PM])[k_00M]; + real f_0MP = (dist.f[DIR_0MP])[k_0M0]; + real f_PPP = (dist.f[DIR_PPP])[k_000]; + real f_MPP = (dist.f[DIR_MPP])[k_M00]; + real f_PMP = (dist.f[DIR_PMP])[k_0M0]; + real f_MMP = (dist.f[DIR_MMP])[k_MM0]; + real f_PPM = (dist.f[DIR_PPM])[k_00M]; + real f_MPM = (dist.f[DIR_MPM])[k_M0M]; + real f_PMM = (dist.f[DIR_PMM])[k_0MM]; + real f_MMM = (dist.f[DIR_MMM])[k_MMM]; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + drho = ((((f_PPP + f_MMM) + (f_MPM + f_PMP)) + ((f_MPP + f_PMM) + (f_MMP + f_PPM))) + + (((f_0MP + f_0PM) + (f_0MM + f_0PP)) + ((f_M0P + f_P0M) + (f_M0M + f_P0P)) + + ((f_MP0 + f_PM0) + (f_MM0 + f_PP0))) + + ((f_M00 + f_P00) + (f_0M0 + f_0P0) + (f_00M + f_00P))) + + f_000; + + real oneOverRho = c1o1 / (c1o1 + drho); + + velocityX = ((((f_PPP - f_MMM) + (f_PMP - f_MPM)) + ((f_PMM - f_MPP) + (f_PPM - f_MMP))) + + (((f_P0M - f_M0P) + (f_P0P - f_M0M)) + ((f_PM0 - f_MP0) + (f_PP0 - f_MM0))) + (f_P00 - f_M00)) * + oneOverRho; + velocityY = ((((f_PPP - f_MMM) + (f_MPM - f_PMP)) + ((f_MPP - f_PMM) + (f_PPM - f_MMP))) + + (((f_0PM - f_0MP) + (f_0PP - f_0MM)) + ((f_MP0 - f_PM0) + (f_PP0 - f_MM0))) + (f_0P0 - f_0M0)) * + oneOverRho; + velocityZ = ((((f_PPP - f_MMM) + (f_PMP - f_MPM)) + ((f_MPP - f_PMM) + (f_MMP - f_PPM))) + + (((f_0MP - f_0PM) + (f_0PP - f_0MM)) + ((f_M0P - f_P0M) + (f_P0P - f_M0M))) + (f_00P - f_00M)) * + oneOverRho; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Calculate second order moments for interpolation + //! + // example: kxxMzz: moment, second derivative in x direction minus the second derivative in z direction + kxyFromfcNEQ = + -c3o1 * omega * + ((f_MM0 + f_MMM + f_MMP - f_MP0 - f_MPM - f_MPP - f_PM0 - f_PMM - f_PMP + f_PP0 + f_PPM + f_PPP) / + (c1o1 + drho) - + ((velocityX * velocityY))); + kyzFromfcNEQ = + -c3o1 * omega * + ((f_0MM + f_PMM + f_MMM - f_0MP - f_PMP - f_MMP - f_0PM - f_PPM - f_MPM + f_0PP + f_PPP + f_MPP) / + (c1o1 + drho) - + ((velocityY * velocityZ))); + kxzFromfcNEQ = + -c3o1 * omega * + ((f_M0M + f_MMM + f_MPM - f_M0P - f_MMP - f_MPP - f_P0M - f_PMM - f_PPM + f_P0P + f_PMP + f_PPP) / + (c1o1 + drho) - + ((velocityX * velocityZ))); + kxxMyyFromfcNEQ = + -c3o2 * omega * + ((f_M0M + f_M00 + f_M0P - f_0MM - f_0M0 - f_0MP - f_0PM - f_0P0 - f_0PP + f_P0M + f_P00 + f_P0P) / (c1o1 + drho) - + ((velocityX * velocityX - velocityY * velocityY))); + kxxMzzFromfcNEQ = + -c3o2 * omega * + ((f_MM0 + f_M00 + f_MP0 - f_0MM - f_0MP - f_00M - f_00P - f_0PM - f_0PP + f_PM0 + f_P00 + f_PP0) / (c1o1 + drho) - + ((velocityX * velocityX - velocityZ * velocityZ))); +} + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/KernelManager/ADKernelManager.cpp b/src/gpu/VirtualFluids_GPU/KernelManager/ADKernelManager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9ca813ac4987af618491422acb60207b7fee543c --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/KernelManager/ADKernelManager.cpp @@ -0,0 +1,505 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ADKernelManager.h +//! \ingroup KernelManager +//! \author Martin Schoenherr +//======================================================================================= +#include "KernelManager/ADKernelManager.h" +#include "GPU/CudaMemoryManager.h" +#include "GPU/GPU_Interface.h" +#include "Parameter/Parameter.h" + +ADKernelManager::ADKernelManager(SPtr<Parameter> parameter): para(parameter){} + +void ADKernelManager::initAD(const int level) const +{ + ////////////////////////////////////////////////////////////////////////// + // calculation of omega for diffusivity + para->getParD(level)->omegaDiffusivity = (real)2.0 / ((real)6.0 * para->getParD(level)->diffusivity + (real)1.0); + ////////////////////////////////////////////////////////////////////////// + para->getParD(level)->isEvenTimestep = true; + ////////////////////////////////////////////////////////////////////////// + InitADDev27( + para->getParD(level)->numberofthreads, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->concentration, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->isEvenTimestep); + ////////////////////////////////////////////////////////////////////////// + para->getParD(level)->isEvenTimestep = false; + ////////////////////////////////////////////////////////////////////////// + InitADDev27( + para->getParD(level)->numberofthreads, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->concentration, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->isEvenTimestep); + ////////////////////////////////////////////////////////////////////////// + CalcConcentration27( + para->getParD(level)->numberofthreads, + para->getParD(level)->concentration, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->isEvenTimestep); +} + +//////////////////////////////////////////////////////////////////////////////// +void ADKernelManager::setInitialNodeValuesAD(const int level, SPtr<CudaMemoryManager> cudaMemoryManager) const +{ + for (uint j = 1; j <= para->getParH(level)->numberOfNodes; j++) { + const real coordX = para->getParH(level)->coordinateX[j]; + const real coordY = para->getParH(level)->coordinateY[j]; + const real coordZ = para->getParH(level)->coordinateZ[j]; + + real concentration; + + // call functor object with initial condition + if (para->getInitialConditionAD()) { + para->getInitialConditionAD()(coordX, coordY, coordZ, concentration); + } else { + concentration = real(0.0); + } + + para->getParH(level)->concentration[j] = concentration; + } + + cudaMemoryManager->cudaCopyConcentrationHostToDevice(level); +} + +//////////////////////////////////////////////////////////////////////////////// +void ADKernelManager::runADcollisionKernel(const int level)const +{ + if (para->getDiffMod() == 7) + { + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // incompressible + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // KernelADincomp7( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->diffusivity, + // para->getParD(level)->typeOfGridNode, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->distributionsAD7.f[0], + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // compressible + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // KernelThS7( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->diffusivity, + // para->getParD(level)->typeOfGridNode, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->distributionsAD7.f[0], + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + } + else if (para->getDiffMod() == 27) + { + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // incompressible + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // KernelADincomp27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->diffusivity, + // para->getParD(level)->typeOfGridNode, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->distributionsAD27.f[0], + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // compressible + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + FactorizedCentralMomentsAdvectionDiffusionDeviceKernel( + para->getParD(level)->numberofthreads, + para->getParD(level)->omegaDiffusivity, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->forcing, + para->getParD(level)->isEvenTimestep); + } +} + +void ADKernelManager::runADslipBCKernel(const int level) const{ + if (para->getParD(level)->slipBC.numberOfBCnodes > 1) { + ADSlipVelDevComp( + para->getParD(level)->numberofthreads, + para->getParD(level)->slipBC.normalX, + para->getParD(level)->slipBC.normalY, + para->getParD(level)->slipBC.normalZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->slipBC.k, + para->getParD(level)->slipBC.q27[0], + para->getParD(level)->slipBC.numberOfBCnodes, + para->getParD(level)->omegaDiffusivity, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + } +} + +void ADKernelManager::runADpressureBCKernel(const int level) const{ + if (para->getParD(level)->TempPress.kTemp > 0){ + if (para->getDiffMod() == 7) { + // QADPressIncompDev7( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->distributionsAD7.f[0], + // para->getParD(level)->TempPress.temp, + // para->getParD(level)->TempPress.velo, + // para->getParD(level)->diffusivity, + // para->getParD(level)->TempPress.k, + // para->getParD(level)->pressureBC.q27[0], + // para->getParD(level)->TempPress.kTemp, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + ////////////////////////////////////////////////////////////////////////// + // C O M P R E S S I B L E + ////////////////////////////////////////////////////////////////////////// + QADPressDev7( + para->getParD(level)->numberofthreads, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD7.f[0], + para->getParD(level)->TempPress.temp, + para->getParD(level)->TempPress.velo, + para->getParD(level)->diffusivity, + para->getParD(level)->TempPress.k, + para->getParD(level)->pressureBC.q27[0], + para->getParD(level)->TempPress.kTemp, + para->getParD(level)->omega, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + + } else if (para->getDiffMod() == 27) { + // QADPressIncompDev27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->distributionsAD27.f[0], + // para->getParD(level)->TempPress.temp, + // para->getParD(level)->TempPress.velo, + // para->getParD(level)->diffusivity, + // para->getParD(level)->TempPress.k, + // para->getParD(level)->pressureBC.q27[0], + // para->getParD(level)->TempPress.kTemp, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + ////////////////////////////////////////////////////////////////////////// + // C O M P R E S S I B L E + ////////////////////////////////////////////////////////////////////////// + QADPressDev27( + para->getParD(level)->numberofthreads, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->TempPress.temp, + para->getParD(level)->TempPress.velo, + para->getParD(level)->diffusivity, + para->getParD(level)->TempPress.k, + para->getParD(level)->pressureBC.q27[0], + para->getParD(level)->TempPress.kTemp, + para->getParD(level)->omega, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + } + } +} + +void ADKernelManager::runADgeometryBCKernel(const int level) const +{ + if (para->getParD(level)->geometryBC.numberOfBCnodes > 0) { + if (para->getDiffMod() == 7) { + // QNoSlipADincompDev7( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->distributionsAD7.f[0], + // para->getParD(level)->Temp.temp, + // para->getParD(level)->diffusivity, + // para->getParD(level)->Temp.k, + // para->getParD(level)->geometryBC.q27[0], + // para->getParD(level)->Temp.kTemp, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + ////////////////////////////////////////////////////////////////////////// + // C O M P R E S S I B L E + ////////////////////////////////////////////////////////////////////////// + + QADDev7( + para->getParD(level)->numberofthreads, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD7.f[0], + para->getParD(level)->Temp.temp, + para->getParD(level)->diffusivity, + para->getParD(level)->Temp.k, + para->getParD(level)->geometryBC.q27[0], + para->getParD(level)->Temp.kTemp, + para->getParD(level)->omega, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + + } else if (para->getDiffMod() == 27) { + // QNoSlipADincompDev27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->distributionsAD27.f[0], + // para->getParD(level)->Temp.temp, + // para->getParD(level)->diffusivity, + // para->getParD(level)->Temp.k, + // para->getParD(level)->geometryBC.q27[0], + // para->getParD(level)->Temp.kTemp, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + ////////////////////////////////////////////////////////////////////////// + // C O M P R E S S I B L E + ////////////////////////////////////////////////////////////////////////// + + QADBBDev27( + para->getParD(level)->numberofthreads, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->Temp.temp, + para->getParD(level)->diffusivity, + para->getParD(level)->Temp.k, + para->getParD(level)->geometryBC.q27[0], + para->getParD(level)->Temp.kTemp, + para->getParD(level)->omega, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + } + } +} + +void ADKernelManager::runADveloBCKernel(const int level) const{ + if (para->getParD(level)->TempVel.kTemp > 0){ + if (para->getDiffMod() == 7) + { + // QADVeloIncompDev7( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->distributionsAD7.f[0], + // para->getParD(level)->TempVel.tempPulse, + // para->getParD(level)->TempVel.velo, + // para->getParD(level)->diffusivity, + // para->getParD(level)->TempVel.k, + // para->getParD(level)->velocityBC.q27[0], + // para->getParD(level)->TempVel.kTemp, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + ////////////////////////////////////////////////////////////////////////// + // C O M P R E S S I B L E + ////////////////////////////////////////////////////////////////////////// + + QADVelDev7( + para->getParD(level)->numberofthreads, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD7.f[0], + para->getParD(level)->TempVel.temp, + para->getParD(level)->TempVel.velo, + para->getParD(level)->diffusivity, + para->getParD(level)->TempVel.k, + para->getParD(level)->velocityBC.q27[0], + para->getParD(level)->TempVel.kTemp, + para->getParD(level)->omega, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + + } else if (para->getDiffMod() == 27) { + // QADVeloIncompDev27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->distributionsAD27.f[0], + // para->getParD(level)->TempVel.temp, + // para->getParD(level)->TempVel.velo, + // para->getParD(level)->diffusivity, + // para->getParD(level)->TempVel.k, + // para->getParD(level)->velocityBC.q27[0], + // para->getParD(level)->TempVel.kTemp, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + ////////////////////////////////////////////////////////////////////////// + // C O M P R E S S I B L E + ////////////////////////////////////////////////////////////////////////// + QADVelDev27( + para->getParD(level)->numberofthreads, + para->getParD(level)->distributions.f[0], + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->TempVel.tempPulse, + para->getParD(level)->TempVel.velo, + para->getParD(level)->diffusivity, + para->getParD(level)->velocityBC.k, + para->getParD(level)->velocityBC.q27[0], + para->getParD(level)->velocityBC.numberOfBCnodes, + para->getParD(level)->omega, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + + ////////////////////////////////////////////////////////////////////////// + // W T G _ R U B + ////////////////////////////////////////////////////////////////////////// + // if (t<1000)//(t>100000 && t<103895)//(t>1600000 && t<1662317)//(t>500000 && t<515580)//(t<1000)//(t<15580)//(t>400000 && t<415580)// + // { + // QADVelDev27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->distributionsAD27.f[0], + // para->getParD(level)->TempVel.tempPulse, + // para->getParD(level)->TempVel.velo, + // para->getParD(level)->diffusivity, + // para->getParD(level)->velocityBC.k, + // para->getParD(level)->velocityBC.q27[0], + // para->getParD(level)->velocityBC.numberOfBCnodes, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + // } + // else + // { + // QADVelDev27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->distributionsAD27.f[0], + // para->getParD(level)->TempVel.temp, + // para->getParD(level)->TempVel.velo, + // para->getParD(level)->diffusivity, + // para->getParD(level)->velocityBC.k, + // para->getParD(level)->velocityBC.q27[0], + // para->getParD(level)->velocityBC.numberOfBCnodes, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + // } + } + } +} + +//////////////////////////////////////////////////////////////////////////////// +void ADKernelManager::printAD(const int level, SPtr<CudaMemoryManager> cudaMemoryManager) const +{ + CalcConcentration27( + para->getParD(level)->numberofthreads, + para->getParD(level)->concentration, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->isEvenTimestep); + + cudaMemoryManager->cudaCopyConcentrationDeviceToHost(level); +} diff --git a/src/gpu/VirtualFluids_GPU/KernelManager/ADKernelManager.h b/src/gpu/VirtualFluids_GPU/KernelManager/ADKernelManager.h new file mode 100644 index 0000000000000000000000000000000000000000..1c069a364ab5ef2837ffd05d0ef4b6488365e4e3 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/KernelManager/ADKernelManager.h @@ -0,0 +1,84 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ADKernelManager.h +//! \ingroup KernelManager +//! \author Martin Schoenherr +//======================================================================================= +#ifndef ADVECTION_DIFFUSION_H +#define ADVECTION_DIFFUSION_H + +#include "Core/DataTypes.h" +#include "PointerDefinitions.h" +#include "VirtualFluids_GPU_export.h" + +//! \brief Class forwarding for Parameter, CudaMemoryManager +class Parameter; +class CudaMemoryManager; + +//! \class ADKernelManager +//! \brief manage the advection diffusion kernel calls +class VIRTUALFLUIDS_GPU_EXPORT ADKernelManager +{ + +public: + //! Class constructor + //! \param parameter shared pointer to instance of class Parameter + ADKernelManager(SPtr<Parameter> parameter); + + //! \brief initialize the advection diffusion distributions + void initAD(const int level) const; + + //! \brief set initial concentration values at all nodes + //! \param cudaMemoryManager instance of class CudaMemoryManager + void setInitialNodeValuesAD(const int level, SPtr<CudaMemoryManager> cudaMemoryManager) const; + + //! \brief calculate the state of the next time step of the advection diffusion distributions + void runADcollisionKernel(const int level) const; + + //! \brief calls the device function of the geometry boundary condition for advection diffusion + void runADgeometryBCKernel(const int level) const; + + //! \brief calls the device function of the velocity boundary condition for advection diffusion + void runADveloBCKernel(const int level) const; + + //! \brief calls the device function of the slip boundary condition for advection diffusion + void runADslipBCKernel(const int level) const; + + //! \brief calls the device function of the pressure boundary condition for advection diffusion + void runADpressureBCKernel(const int level) const; + + //! \brief copy the concentration from device to host and writes VTK file with concentration + //! \param cudaMemoryManager instance of class CudaMemoryManager + void printAD(const int level, SPtr<CudaMemoryManager> cudaMemoryManager) const; + +private: + SPtr<Parameter> para; +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cc945ea225a28c58dca4ceefdb80fffb76228b21 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp @@ -0,0 +1,389 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file LBKernelManager.cpp +//! \ingroup KernelManager +//! \author Martin Schoenherr +//======================================================================================= +#include <cuda_runtime.h> +#include <helper_cuda.h> +#include <iostream> +#include <stdexcept> +#include <string> + +#include "BCKernelManager.h" +#include "Factories/BoundaryConditionFactory.h" +#include "Calculation/Cp.h" +#include "Calculation/DragLift.h" +#include "GPU/GPU_Interface.h" +#include "Parameter/Parameter.h" + +BCKernelManager::BCKernelManager(SPtr<Parameter> parameter, BoundaryConditionFactory *bcFactory) : para(parameter) +{ + this->velocityBoundaryConditionPost = bcFactory->getVelocityBoundaryConditionPost(); + this->noSlipBoundaryConditionPost = bcFactory->getNoSlipBoundaryConditionPost(); + this->slipBoundaryConditionPost = bcFactory->getSlipBoundaryConditionPost(); + this->pressureBoundaryConditionPre = bcFactory->getPressureBoundaryConditionPre(); + this->geometryBoundaryConditionPost = bcFactory->getGeometryBoundaryConditionPost(); + this->stressBoundaryConditionPost = bcFactory->getStressBoundaryConditionPost(); + + checkBoundaryCondition(this->velocityBoundaryConditionPost, this->para->getParD(0)->velocityBC, + "velocityBoundaryConditionPost"); + checkBoundaryCondition(this->noSlipBoundaryConditionPost, this->para->getParD(0)->noSlipBC, + "noSlipBoundaryConditionPost"); + checkBoundaryCondition(this->slipBoundaryConditionPost, this->para->getParD(0)->slipBC, + "slipBoundaryConditionPost"); + checkBoundaryCondition(this->pressureBoundaryConditionPre, this->para->getParD(0)->pressureBC, + "pressureBoundaryConditionPre"); + checkBoundaryCondition(this->geometryBoundaryConditionPost, this->para->getParD(0)->geometryBC, + "geometryBoundaryConditionPost"); + checkBoundaryCondition(this->stressBoundaryConditionPost, this->para->getParD(0)->stressBC, + "stressBoundaryConditionPost"); +} + +void BCKernelManager::runVelocityBCKernelPre(const int level) const +{ + if (para->getParD(level)->velocityBC.numberOfBCnodes > 0) + { + // TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 + // if ( myid == 0) + // { + // VelSchlaffer27(para->getParD(level)->numberofthreads, t, + // para->getParD(level)->distributions.f[0], para->getParD(level)->velocityBC.Vz, + // para->getParD(level)->velocityBC.deltaVz, para->getParD(level)->velocityBC.k, + // para->getParD(level)->velocityBC.kN, para->getParD(level)->velocityBC.numberOfBCnodes, + // para->getParD(level)->omega, para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level)->isEvenTimestep); + // getLastCudaError("VelSchlaffer27 execution failed"); + // } + //////////////////////////////////////////////////////////////////////////// + // high viscosity incompressible + // QVelDevIncompHighNu27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->velocityBC.Vx, + // para->getParD(level)->velocityBC.Vy, + // para->getParD(level)->velocityBC.Vz, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->velocityBC.k, + // para->getParD(level)->velocityBC.q27[0], + // para->getParD(level)->velocityBC.numberOfBCnodes, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + //////////////////////////////////////////////////////////////////////////// + // high viscosity compressible + // QVelDevCompHighNu27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->velocityBC.Vx, + // para->getParD(level)->velocityBC.Vy, + // para->getParD(level)->velocityBC.Vz, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->velocityBC.k, + // para->getParD(level)->velocityBC.q27[0], + // para->getParD(level)->velocityBC.numberOfBCnodes, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + } +} + +void BCKernelManager::runVelocityBCKernelPost(const int level) const +{ + if (para->getParD(level)->velocityBC.numberOfBCnodes > 0) + { + velocityBoundaryConditionPost(para->getParD(level).get(), &(para->getParD(level)->velocityBC)); + + ////////////////////////////////////////////////////////////////////////// + // D E P R E C A T E D + ////////////////////////////////////////////////////////////////////////// + + // QVelDevice1h27( para->getParD(level)->numberofthreads, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level)->velocityBC.Vx, para->getParD(level)->velocityBC.Vy, para->getParD(level)->velocityBC.Vz, + // para->getParD(level)->distributions.f[0], para->getParD(level)->velocityBC.k, para->getParD(level)->velocityBC.q27[0], + // para->getParD(level)->velocityBC.numberOfBCnodes, para->getParD(level)->omega, + // para->getPhi(), para->getAngularVelocity(), + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ, + // para->getParD(level)->numberOfNodes, para->getParD(level)->isEvenTimestep); + // getLastCudaError("QVelDev27 execution failed"); + } +} + +void BCKernelManager::runGeoBCKernelPre(const int level, unsigned int t, CudaMemoryManager* cudaMemoryManager) const{ + if (para->getParD(level)->geometryBC.numberOfBCnodes > 0){ + if (para->getCalcDragLift()) + { + //Drag and Lift Part II + DragLiftPreD27( + para->getParD(level)->distributions.f[0], + para->getParD(level)->geometryBC.k, + para->getParD(level)->geometryBC.q27[0], + para->getParD(level)->geometryBC.numberOfBCnodes, + para->getParD(level)->DragPreX, + para->getParD(level)->DragPreY, + para->getParD(level)->DragPreZ, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + //////////////////////////////////////////////////////////////////////////////// + //Calculation of Drag and Lift + //////////////////////////////////////////////////////////////////////////////// + calcDragLift(para.get(), cudaMemoryManager, level); + //////////////////////////////////////////////////////////////////////////////// + } + + if (para->getCalcCp()) + { + //////////////////////////////////////////////////////////////////////////////// + //Calculation of cp + //////////////////////////////////////////////////////////////////////////////// + + if(t > para->getTimestepStartOut()) + { + //////////////////////////////////////////////////////////////////////////////// + CalcCPtop27( + para->getParD(level)->distributions.f[0], + para->getParD(level)->cpTopIndex, + para->getParD(level)->numberOfPointsCpTop, + para->getParD(level)->cpPressTop, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////////////// + CalcCPbottom27( + para->getParD(level)->distributions.f[0], + para->getParD(level)->cpBottomIndex, + para->getParD(level)->numberOfPointsCpBottom, + para->getParD(level)->cpPressBottom, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////////////// + CalcCPbottom27( + para->getParD(level)->distributions.f[0], + para->getParD(level)->cpBottom2Index, + para->getParD(level)->numberOfPointsCpBottom2, + para->getParD(level)->cpPressBottom2, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + ////////////////////////////////////////////////////////////////////////////////// + calcCp(para.get(), cudaMemoryManager, level); + } + } + + //////////////////////////////////////////////////////////////////////////////// + // high viscosity incompressible + // QDevIncompHighNu27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->geometryBC.k, + // para->getParD(level)->geometryBC.q27[0], + // para->getParD(level)->geometryBC.numberOfBCnodes, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + ////////////////////////////////////////////////////////////////////////////////// + // high viscosity compressible + // QDevCompHighNu27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->geometryBC.k, + // para->getParD(level)->geometryBC.q27[0], + // para->getParD(level)->geometryBC.numberOfBCnodes, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + } +} + +void BCKernelManager::runGeoBCKernelPost(const int level) const +{ + if (para->getParD(level)->geometryBC.numberOfBCnodes > 0) + { + if (para->getCalcDragLift()) + { + //Drag and Lift Part I + DragLiftPostD27(para->getParD(level)->distributions.f[0], + para->getParD(level)->geometryBC.k, + para->getParD(level)->geometryBC.q27[0], + para->getParD(level)->geometryBC.numberOfBCnodes, + para->getParD(level)->DragPostX, + para->getParD(level)->DragPostY, + para->getParD(level)->DragPostZ, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->numberofthreads); + getLastCudaError("DragLift27 execution failed"); + } + + geometryBoundaryConditionPost(para->getParD(level).get(), &(para->getParD(level)->geometryBC)); + + ////////////////////////////////////////////////////////////////////////// + // D E P R E C A T E D + ////////////////////////////////////////////////////////////////////////// + // the GridGenerator does currently not provide normals! + + // QSlipGeomDevComp27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->geometryBC.k, + // para->getParD(level)->geometryBC.q27[0], + // para->getParD(level)->geometryBC.numberOfBCnodes, + // para->getParD(level)->omega, + // para->getParD(level)->geometryBCnormalX.q27[0], + // para->getParD(level)->geometryBCnormalY.q27[0], + // para->getParD(level)->geometryBCnormalZ.q27[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + + // QSlipNormDevComp27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->geometryBC.k, + // para->getParD(level)->geometryBC.q27[0], + // para->getParD(level)->geometryBC.numberOfBCnodes, + // para->getParD(level)->omega, + // para->getParD(level)->geometryBCnormalX.q27[0], + // para->getParD(level)->geometryBCnormalY.q27[0], + // para->getParD(level)->geometryBCnormalZ.q27[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + } +} + +void BCKernelManager::runOutflowBCKernelPre(const int level) const{ + if (para->getParD(level)->outflowBC.numberOfBCnodes > 0) + { + QPressNoRhoDev27(para->getParD(level).get(), &(para->getParD(level)->outflowBC)); + + // TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 + // if ( myid == numprocs - 1) + // PressSchlaffer27( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->outflowBC.RhoBC, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->outflowBC.Vx, + // para->getParD(level)->outflowBC.Vy, + // para->getParD(level)->outflowBC.Vz, + // para->getParD(level)->outflowBC.deltaVz, + // para->getParD(level)->outflowBC.k, + // para->getParD(level)->outflowBC.kN, + // para->getParD(level)->outflowBC.numberOfBCnodes, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + } +} + +void BCKernelManager::runPressureBCKernelPre(const int level) const{ + if (para->getParD(level)->pressureBC.numberOfBCnodes > 0) + { + this->pressureBoundaryConditionPre(para->getParD(level).get(), &(para->getParD(level)->pressureBC)); + } +} + +void BCKernelManager::runPressureBCKernelPost(const int level) const{ + if (para->getParD(level)->pressureBC.numberOfBCnodes > 0) + { + // QPressDev27_IntBB( + // para->getParD(level)->numberofthreads, + // para->getParD(level)->pressureBC.RhoBC, + // para->getParD(level)->distributions.f[0], + // para->getParD(level)->pressureBC.k, + // para->getParD(level)->pressureBC.q27[0], + // para->getParD(level)->pressureBC.numberOfBCnodes, + // para->getParD(level)->omega, + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level)->isEvenTimestep); + } +} + +void BCKernelManager::runStressWallModelKernelPost(const int level) const{ + if (para->getParD(level)->stressBC.numberOfBCnodes > 0) + { + stressBoundaryConditionPost(para.get(), &(para->getParD(level)->stressBC), level); + } +} + +void BCKernelManager::runSlipBCKernelPost(const int level) const{ + if (para->getParD(level)->slipBC.numberOfBCnodes > 0) + { + slipBoundaryConditionPost(para->getParD(level).get(), &(para->getParD(level)->slipBC)); + } +} + +void BCKernelManager::runNoSlipBCKernelPost(const int level) const{ + if (para->getParD(level)->noSlipBC.numberOfBCnodes > 0) + { + noSlipBoundaryConditionPost(para->getParD(level).get(), &(para->getParD(level)->noSlipBC)); + } +} diff --git a/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.h b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.h new file mode 100644 index 0000000000000000000000000000000000000000..423a9cc9056281a3a2a135ae32fa26cc47f93967 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.h @@ -0,0 +1,115 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file BCKernelManager.h +//! \ingroup KernelManager +//! \author Martin Schoenherr, Anna Wellmann +//======================================================================================= +#ifndef BCKernelManager_H +#define BCKernelManager_H + +#include <functional> +#include <memory> +#include <string> + +#include "LBM/LB.h" +#include "PointerDefinitions.h" +#include "VirtualFluids_GPU_export.h" + +class CudaMemoryManager; +class BoundaryConditionFactory; +class Parameter; +struct LBMSimulationParameter; + +using boundaryCondition = std::function<void(LBMSimulationParameter *, QforBoundaryConditions *)>; +using boundaryConditionWithParameter = std::function<void(Parameter *, QforBoundaryConditions *, const int level)>; + +//! \class BCKernelManager +//! \brief manage the cuda kernel calls to boundary conditions +//! \details This class stores the boundary conditions and manages the calls to the boundary condition kernels. +class VIRTUALFLUIDS_GPU_EXPORT BCKernelManager +{ +public: + //! Class constructor + //! \param parameter shared pointer to instance of class Parameter + //! \throws std::runtime_error when the user forgets to specify a boundary condition + BCKernelManager(SPtr<Parameter> parameter, BoundaryConditionFactory *bcFactory); + + //! \brief calls the device function of the velocity boundary condition (post-collision) + void runVelocityBCKernelPost(const int level) const; + + //! \brief calls the device function of the velocity boundary condition (pre-collision) + void runVelocityBCKernelPre(const int level) const; + + //! \brief calls the device function of the geometry boundary condition (post-collision) + void runGeoBCKernelPost(const int level) const; + + //! \brief calls the device function of the geometry boundary condition (pre-collision) + void runGeoBCKernelPre(const int level, unsigned int t, CudaMemoryManager *cudaMemoryManager) const; + + //! \brief calls the device function of the slip boundary condition (post-collision) + void runSlipBCKernelPost(const int level) const; + + //! \brief calls the device function of the no-slip boundary condition (post-collision) + void runNoSlipBCKernelPost(const int level) const; + + //! \brief calls the device function of the pressure boundary condition (pre-collision) + void runPressureBCKernelPre(const int level) const; + + //! \brief calls the device function of the pressure boundary condition (post-collision) + void runPressureBCKernelPost(const int level) const; + + //! \brief calls the device function of the outflow boundary condition (pre-collision) + void runOutflowBCKernelPre(const int level) const; + + //! \brief calls the device function of the stress wall model (post-collision) + void runStressWallModelKernelPost(const int level) const; + +private: + //! \brief check if a boundary condition was set + //! \throws std::runtime_error if boundary nodes were assigned, but no boundary condition was set in the boundary condition factory + //! \param boundaryCondition: a kernel function for the boundary condition + //! \param bcStruct: a struct containing the grid nodes which are part of the boundary condition + //! \param bcName: the name of the checked boundary condition + template <typename bcFunction> + void checkBoundaryCondition(const bcFunction &boundaryCondition, const QforBoundaryConditions &bcStruct, const std::string &bcName) + { + if (!boundaryCondition && bcStruct.numberOfBCnodes > 0) + throw std::runtime_error("The boundary condition " + bcName + " was not set!"); + } + + SPtr<Parameter> para; + + boundaryCondition velocityBoundaryConditionPost = nullptr; + boundaryCondition noSlipBoundaryConditionPost = nullptr; + boundaryCondition slipBoundaryConditionPost = nullptr; + boundaryCondition pressureBoundaryConditionPre = nullptr; + boundaryCondition geometryBoundaryConditionPost = nullptr; + boundaryConditionWithParameter stressBoundaryConditionPost = nullptr; +}; +#endif diff --git a/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManagerTest.cpp b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManagerTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d55fa51bd8a225dd4e89e684bc81cd56f3f450c0 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManagerTest.cpp @@ -0,0 +1,55 @@ +#include <gmock/gmock.h> +#include <stdexcept> + +#include "BCKernelManager.h" +#include "Factories/BoundaryConditionFactory.h" +#include "Parameter/Parameter.h" +#include "PointerDefinitions.h" + +class BCKernelManagerTest_BCsNotSpecified : public testing::Test +{ +protected: + BoundaryConditionFactory bcFactory; + SPtr<Parameter> para = std::make_shared<Parameter>(); + + void SetUp() override + { + para->initLBMSimulationParameter(); + } +}; + +TEST_F(BCKernelManagerTest_BCsNotSpecified, velocityBoundaryConditionPost_NotSpecified) +{ + para->getParD(0)->velocityBC.numberOfBCnodes = 1; + EXPECT_THROW(BCKernelManager(para, &bcFactory), std::runtime_error); +} + +TEST_F(BCKernelManagerTest_BCsNotSpecified, noSlipBoundaryConditionPost_NotSpecified) +{ + para->getParD(0)->noSlipBC.numberOfBCnodes = 1; + EXPECT_NO_THROW(BCKernelManager(para, &bcFactory)); // no throw, as a default is specified +} + +TEST_F(BCKernelManagerTest_BCsNotSpecified, slipBoundaryConditionPost_NotSpecified) +{ + para->getParD(0)->slipBC.numberOfBCnodes = 1; + EXPECT_THROW(BCKernelManager(para, &bcFactory), std::runtime_error); +} + +TEST_F(BCKernelManagerTest_BCsNotSpecified, pressureBoundaryConditionPre_NotSpecified) +{ + para->getParD(0)->pressureBC.numberOfBCnodes = 1; + EXPECT_THROW(BCKernelManager(para, &bcFactory), std::runtime_error); +} + +TEST_F(BCKernelManagerTest_BCsNotSpecified, geometryBoundaryConditionPost_NotSpecified) +{ + para->getParD(0)->geometryBC.numberOfBCnodes = 1; + EXPECT_NO_THROW(BCKernelManager(para, &bcFactory)); // no throw, as a default is specified +} + +TEST_F(BCKernelManagerTest_BCsNotSpecified, stressBoundaryConditionPost_NotSpecified) +{ + para->getParD(0)->stressBC.numberOfBCnodes = 1; + EXPECT_THROW(BCKernelManager(para, &bcFactory), std::runtime_error); +} diff --git a/src/gpu/VirtualFluids_GPU/KernelManager/GridScalingKernelManager.cpp b/src/gpu/VirtualFluids_GPU/KernelManager/GridScalingKernelManager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c3129e31a9c750a012a26d58961062eaf3f40add --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/KernelManager/GridScalingKernelManager.cpp @@ -0,0 +1,597 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file GridScalingKernelManager.h +//! \ingroup KernelManager +//! \author Martin Schoenherr +//======================================================================================= +#include "KernelManager/GridScalingKernelManager.h" +#include "GPU/CudaMemoryManager.h" +#include "GPU/GPU_Interface.h" +#include "Logger.h" +#include "Parameter/Parameter.h" +#include "Parameter/CudaStreamManager.h" +#include "PreCollisionInteractor/PreCollisionInteractor.h" +#include "Factories/GridScalingFactory.h" +#include <stdexcept> + +GridScalingKernelManager::GridScalingKernelManager(SPtr<Parameter> parameter, GridScalingFactory *gridScalingFactory) + : para(parameter) +{ + if(para->getMaxLevel() != 0){ + if(!gridScalingFactory){ + throw std::runtime_error("There is more than one level, but no scalingFactory was provided."); + } + checkScalingFunction(gridScalingFactory->getGridScalingFC(), this->para->getParD(0)->intFC, "scalingFineToCoarse"); + checkScalingFunction(gridScalingFactory->getGridScalingCF(), this->para->getParD(0)->intCF, "scalingCoarseToFine"); + this->scalingFineToCoarse = gridScalingFactory->getGridScalingFC(); + this->scalingCoarseToFine = gridScalingFactory->getGridScalingCF(); + } + + if(this->scalingFineToCoarse == nullptr) + VF_LOG_TRACE("Function for scalingFineToCoarse is nullptr"); + if(this->scalingCoarseToFine == nullptr) + VF_LOG_TRACE("Function for scalingCoarseToFine is nullptr"); +} + +void GridScalingKernelManager::runFineToCoarseKernelLB(const int level, InterpolationCellFC *icellFC, OffFC &offFC, int streamIndex) const{ + cudaStream_t stream = (streamIndex == -1) ? CU_STREAM_LEGACY : para->getStreamManager()->getStream(streamIndex); + + this->scalingFineToCoarse(para->getParD(level).get(), para->getParD(level+1).get(), icellFC, offFC, stream); + + // ScaleFC_comp_D3Q27F3( + // para->getParD(level)->distributions.f[0], + // para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->g6.g[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, + // para->getParD(level+1)->neighborY, + // para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level+1)->numberOfNodes, + // para->getParD(level)->isEvenTimestep, + // icellFC->ICellFCC, + // icellFC->ICellFCF, + // icellFC->kFC, + // para->getParD(level)->omega, + // para->getParD(level+1)->omega, + // para->getParD(level)->vis, + // para->getParD(level)->nx, + // para->getParD(level)->ny, + // para->getParD(level+1)->nx, + // para->getParD(level+1)->ny, + // para->getParD(level)->numberofthreads, + // para->getParD(level)->offFC, + // stream); + + // ScaleFC_0817_comp_27( + // para->getParD(level)->distributions.f[0], + // para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, + // para->getParD(level+1)->neighborY, + // para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level+1)->numberOfNodes, + // para->getParD(level)->isEvenTimestep, + // icellFC->ICellFCC, + // icellFC->ICellFCF, + // icellFC->kFC, + // para->getParD(level)->omega, + // para->getParD(level+1)->omega, + // para->getParD(level)->vis, + // para->getParD(level)->nx, + // para->getParD(level)->ny, + // para->getParD(level+1)->nx, + // para->getParD(level+1)->ny, + // para->getParD(level)->numberofthreads, + // para->getParD(level)->offFC, + // stream); + + // ScaleFC_RhoSq_3rdMom_comp_27( + // para->getParD(level)->distributions.f[0], + // para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, + // para->getParD(level+1)->neighborY, + // para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level+1)->numberOfNodes, + // para->getParD(level)->isEvenTimestep, + // icellFC->ICellFCC, + // icellFC->ICellFCF, + // icellFC->kFC, + // para->getParD(level)->omega, + // para->getParD(level+1)->omega, + // para->getParD(level)->vis, + // para->getParD(level)->nx, + // para->getParD(level)->ny, + // para->getParD(level+1)->nx, + // para->getParD(level+1)->ny, + // para->getParD(level)->numberofthreads, + // para->getParD(level)->offFC, + // stream); + + // ScaleFC_AA2016_comp_27( + // para->getParD(level)->distributions.f[0], + // para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, + // para->getParD(level+1)->neighborY, + // para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level+1)->numberOfNodes, + // para->getParD(level)->isEvenTimestep, + // icellFC->ICellFCC, + // icellFC->ICellFCF, + // icellFC->kFC, + // para->getParD(level)->omega, + // para->getParD(level+1)->omega, + // para->getParD(level)->vis, + // para->getParD(level)->nx, + // para->getParD(level)->ny, + // para->getParD(level+1)->nx, + // para->getParD(level+1)->ny, + // para->getParD(level)->numberofthreads, + // para->getParD(level)->offFC, + // stream); + + + ////////////////////////////////////////////////////////////////////////// + // D E P R E C A T E D + ////////////////////////////////////////////////////////////////////////// + + //ScaleFC27( para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, + // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->gridNX); + //getLastCudaError("ScaleFC27 execution failed"); + + //ScaleFCEff27( para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, + // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offFC); + //getLastCudaError("ScaleFC27 execution failed"); + + //ScaleFCLast27( para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, + // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offFC); + //getLastCudaError("ScaleFC27 execution failed"); + + //ScaleFCpress27(para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, + // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offFC); + //getLastCudaError("ScaleFC27 execution failed"); + + // ScaleFC_Fix_comp_27( para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, + // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offFC); + // getLastCudaError("ScaleFC27 execution failed"); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // incompressible + //ScaleFC_Fix_27(para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, + // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offFC); + //getLastCudaError("ScaleFC27 execution failed"); + + //ScaleFC_NSPress_27(para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intFC.ICellFCC, para->getParD(level)->intFC.ICellFCF, + // para->getParD(level)->K_FC, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offFC); + //getLastCudaError("ScaleFC27 execution failed"); +} + +void GridScalingKernelManager::runFineToCoarseKernelAD(const int level) const +{ + //A D V E C T I O N D I F F U S I O N + + if (para->getDiffMod() == 7) + { + // ScaleFCThS7( + // para->getParD(level)->distributions.f[0], + // para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->distributionsAD7.f[0], + // para->getParD(level+1)->distributionsAD7.f[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, + // para->getParD(level+1)->neighborY, + // para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level+1)->numberOfNodes, + // para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intFC.ICellFCC, + // para->getParD(level)->intFC.ICellFCF, + // para->getParD(level)->K_FC, + // para->getParD(level)->vis, + // para->getParD(level)->diffusivity, + // para->getParD(level)->numberofthreads); + ScaleFCThSMG7( + para->getParD(level)->distributions.f[0], + para->getParD(level+1)->distributions.f[0], + para->getParD(level)->distributionsAD7.f[0], + para->getParD(level+1)->distributionsAD7.f[0], + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level+1)->neighborX, + para->getParD(level+1)->neighborY, + para->getParD(level+1)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level+1)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->intFC.ICellFCC, + para->getParD(level)->intFC.ICellFCF, + para->getParD(level)->K_FC, + para->getParD(level)->vis, + para->getParD(level)->diffusivity, + para->getParD(level)->numberofthreads, + para->getParD(level)->offFC); + } + else if (para->getDiffMod() == 27) + { + ScaleFCThS27( + para->getParD(level)->distributions.f[0], + para->getParD(level+1)->distributions.f[0], + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level+1)->distributionsAD27.f[0], + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level+1)->neighborX, + para->getParD(level+1)->neighborY, + para->getParD(level+1)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level+1)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->intFC.ICellFCC, + para->getParD(level)->intFC.ICellFCF, + para->getParD(level)->K_FC, + para->getParD(level)->vis, + para->getParD(level)->diffusivity, + para->getParD(level)->numberofthreads, + para->getParD(level)->offFC); + } +} + +void GridScalingKernelManager::runCoarseToFineKernelLB(const int level, InterpolationCellCF* icellCF, OffCF &offCF, int streamIndex) const +{ + cudaStream_t stream = (streamIndex == -1) ? CU_STREAM_LEGACY : para->getStreamManager()->getStream(streamIndex); + this->scalingCoarseToFine(para->getParD(level).get(), para->getParD(level+1).get(), icellCF, offCF, stream); + + // ScaleCF_comp_D3Q27F3( + // para->getParD(level)->distributions.f[0], + // para->getParD(level+1)->distributions.f[0], + // para->getParD(level+1)->g6.g[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, + // para->getParD(level+1)->neighborY, + // para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level+1)->numberOfNodes, + // para->getParD(level)->isEvenTimestep, + // icellCF->ICellCFC, + // icellCF->ICellCFF, + // icellCF->kCF, + // para->getParD(level)->omega, + // para->getParD(level+1)->omega, + // para->getParD(level)->vis, + // para->getParD(level)->nx, + // para->getParD(level)->ny, + // para->getParD(level+1)->nx, + // para->getParD(level+1)->ny, + // para->getParD(level)->numberofthreads, + // offCF, + // stream); + + // ScaleCF_0817_comp_27( + // para->getParD(level)->distributions.f[0], + // para->getParD(level + 1)->distributions.f[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, + // para->getParD(level+1)->neighborY, + // para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level+1)->numberOfNodes, + // para->getParD(level)->isEvenTimestep, + // icellCF->ICellCFC, + // icellCF->ICellCFF, + // icellCF->kCF, + // para->getParD(level)->omega, + // para->getParD(level+1)->omega, + // para->getParD(level)->vis, + // para->getParD(level)->nx, + // para->getParD(level)->ny, + // para->getParD(level+1)->nx, + // para->getParD(level+1)->ny, + // para->getParD(level)->numberofthreads, + // offCF, + // stream); + + // ScaleCF_RhoSq_3rdMom_comp_27( + // para->getParD(level)->distributions.f[0], + // para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, + // para->getParD(level+1)->neighborY, + // para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level+1)->numberOfNodes, + // para->getParD(level)->isEvenTimestep, + // icellCF->ICellCFC, + // icellCF->ICellCFF, + // icellCF->kCF, + // para->getParD(level)->omega, + // para->getParD(level+1)->omega, + // para->getParD(level)->vis, + // para->getParD(level)->nx, + // para->getParD(level)->ny, + // para->getParD(level+1)->nx, + // para->getParD(level+1)->ny, + // para->getParD(level)->numberofthreads, + // offCF, + // stream); + + // ScaleCF_AA2016_comp_27( + // para->getParD(level)->distributions.f[0], + // para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, + // para->getParD(level+1)->neighborY, + // para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level+1)->numberOfNodes, + // para->getParD(level)->isEvenTimestep, + // icellCF->ICellCFC, + // icellCF->ICellCFF, + // icellCF->kCF, + // para->getParD(level)->omega, + // para->getParD(level+1)->omega, + // para->getParD(level)->vis, + // para->getParD(level)->nx, + // para->getParD(level)->ny, + // para->getParD(level+1)->nx, + // para->getParD(level+1)->ny, + // para->getParD(level)->numberofthreads, + // offCF, + // stream); + + + ////////////////////////////////////////////////////////////////////////// + // D E P R E C A T E D + ////////////////////////////////////////////////////////////////////////// + + //ScaleCF27( para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, + // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->gridNX); + //getLastCudaError("ScaleCF27 execution failed"); + + //ScaleCFEff27( para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, + // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offCF); + //getLastCudaError("ScaleCF27 execution failed"); + + //ScaleCFLast27( para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, + // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offCF); + //getLastCudaError("ScaleCF27 execution failed"); + + //ScaleCFpress27(para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, + // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offCF); + //getLastCudaError("ScaleCF27 execution failed"); + + // ScaleCF_Fix_comp_27( para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, + // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offCF); + // getLastCudaError("ScaleCF27 execution failed"); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // incompressible + //ScaleCF_Fix_27(para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, + // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offCF); + //getLastCudaError("ScaleCF27 execution failed"); + + //ScaleCF_NSPress_27(para->getParD(level)->distributions.f[0], para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, para->getParD(level+1)->neighborY, para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, para->getParD(level+1)->numberOfNodes, para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intCF.ICellCFC, para->getParD(level)->intCF.ICellCFF, + // para->getParD(level)->K_CF, para->getParD(level)->omega, para->getParD(level+1)->omega, + // para->getParD(level)->vis, para->getParD(level)->nx, para->getParD(level)->ny, + // para->getParD(level+1)->nx, para->getParD(level+1)->ny, para->getParD(level)->numberofthreads, + // para->getParD(level)->offCF); + //getLastCudaError("ScaleCF27 execution failed"); +} + +void GridScalingKernelManager::runCoarseToFineKernelAD(const int level) const +{ + // A D V E C T I O N D I F F U S I O N + + if (para->getDiffMod() == 7) + { + // ScaleCFThS7( + // para->getParD(level)->distributions.f[0], + // para->getParD(level+1)->distributions.f[0], + // para->getParD(level)->distributionsAD7.f[0], + // para->getParD(level+1)->distributionsAD7.f[0], + // para->getParD(level)->neighborX, + // para->getParD(level)->neighborY, + // para->getParD(level)->neighborZ, + // para->getParD(level+1)->neighborX, + // para->getParD(level+1)->neighborY, + // para->getParD(level+1)->neighborZ, + // para->getParD(level)->numberOfNodes, + // para->getParD(level+1)->numberOfNodes, + // para->getParD(level)->isEvenTimestep, + // para->getParD(level)->intCF.ICellCFC, + // para->getParD(level)->intCF.ICellCFF, + // para->getParD(level)->K_CF, + // para->getParD(level)->vis, + // para->getParD(level+1)->diffusivity, + // para->getParD(level)->numberofthreads); + + ScaleCFThSMG7( + para->getParD(level)->distributions.f[0], + para->getParD(level+1)->distributions.f[0], + para->getParD(level)->distributionsAD7.f[0], + para->getParD(level+1)->distributionsAD7.f[0], + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level+1)->neighborX, + para->getParD(level+1)->neighborY, + para->getParD(level+1)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level+1)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->intCF.ICellCFC, + para->getParD(level)->intCF.ICellCFF, + para->getParD(level)->K_CF, + para->getParD(level)->vis, + para->getParD(level+1)->diffusivity, + para->getParD(level)->numberofthreads, + para->getParD(level)->offCF); + } + else if (para->getDiffMod() == 27) + { + ScaleCFThS27( + para->getParD(level)->distributions.f[0], + para->getParD(level+1)->distributions.f[0], + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level+1)->distributionsAD27.f[0], + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level+1)->neighborX, + para->getParD(level+1)->neighborY, + para->getParD(level+1)->neighborZ, + para->getParD(level)->numberOfNodes, + para->getParD(level+1)->numberOfNodes, + para->getParD(level)->isEvenTimestep, + para->getParD(level)->intCF.ICellCFC, + para->getParD(level)->intCF.ICellCFF, + para->getParD(level)->K_CF, + para->getParD(level)->vis, + para->getParD(level+1)->diffusivity, + para->getParD(level)->numberofthreads, + para->getParD(level)->offCF); + } +} diff --git a/src/gpu/VirtualFluids_GPU/KernelManager/GridScalingKernelManager.h b/src/gpu/VirtualFluids_GPU/KernelManager/GridScalingKernelManager.h new file mode 100644 index 0000000000000000000000000000000000000000..85cdd88ec2e3a6622108026ce8f53c5c770f8afe --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/KernelManager/GridScalingKernelManager.h @@ -0,0 +1,111 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file GridScalingKernelManager.h +//! \ingroup KernelManager +//! \author Martin Schoenherr +//======================================================================================= +#ifndef GridScalingKernelManager_H +#define GridScalingKernelManager_H + +#include "LBM/LB.h" +#include "PointerDefinitions.h" +#include "VirtualFluids_GPU_export.h" +#include "logger/Logger.h" +#include <functional> +#include <memory> +#include <stdexcept> + +class Parameter; +class CudaMemoryManager; +class GridScalingFactory; +struct LBMSimulationParameter; +struct CUstream_st; + +using gridScalingFC = + std::function<void(LBMSimulationParameter *, LBMSimulationParameter *, ICellFC *, OffFC &, CUstream_st *stream)>; +using gridScalingCF = + std::function<void(LBMSimulationParameter *, LBMSimulationParameter *, ICellCF *, OffCF &, CUstream_st *stream)>; + +//! \class GridScalingKernelManager +//! \brief manage the cuda kernel calls +class VIRTUALFLUIDS_GPU_EXPORT GridScalingKernelManager +{ +public: + //! Class constructor + //! \param parameter shared pointer to instance of class Parameter + //! \throws std::runtime_error when the user forgets to specify a scaling function + GridScalingKernelManager(SPtr<Parameter> parameter, GridScalingFactory *gridScalingFactory); + + //! \brief calls the device function of the fine to coarse grid interpolation kernel + void runFineToCoarseKernelLB(const int level, InterpolationCellFC *icellFC, OffFC &offFC, int streamIndex) const; + + //! \brief calls the device function of the fine to coarse grid interpolation kernel (advection diffusion) + void runFineToCoarseKernelAD(const int level) const; + + //! \brief calls the device function of the coarse to fine grid interpolation kernel + void runCoarseToFineKernelLB(const int level, InterpolationCellCF *icellCF, OffCF &offCF, int streamIndex) const; + + //! \brief calls the device function of the coarse to fine grid interpolation kernel (advection diffusion) + void runCoarseToFineKernelAD(const int level) const; + +private: + //! \brief check if grid scaling was set + //! \throws std::runtime_error if interpolation nodes were assigned, but no scaling function was set in the grid + //! scaling factory \param scalingFunctionFC: a kernel function for the grid scaling \param scalingStruct: a struct + //! containing the grid nodes which are part of the interpolation \param scalingName: the name of the checked + //! scaling function + void checkScalingFunction(const gridScalingFC &scalingFunctionFC, const InterpolationCellFC &scalingStruct, + const std::string &scalingName) + { + if (!scalingFunctionFC && scalingStruct.kFC > 0) + throw std::runtime_error("The scaling function " + scalingName + " was not set!"); + if (scalingFunctionFC && scalingStruct.kFC == 0) + VF_LOG_WARNING("The scaling function {} was set, although there is no refinement", scalingName); + } + + //! \brief check if grid scaling was set + //! \throws std::runtime_error if interpolation nodes were assigned, but no scaling function was set in the grid + //! scaling factory \param scalingFunctionCF: a kernel function for the grid scaling \param scalingStruct: a struct + //! containing the grid nodes which are part of the interpolation \param scalingName: the name of the checked + //! scaling function + void checkScalingFunction(const gridScalingCF &scalingFunctionCF, const InterpolationCellCF &scalingStruct, + const std::string &scalingName) + { + if (!scalingFunctionCF && scalingStruct.kCF > 0) + throw std::runtime_error("The scaling function " + scalingName + " was not set!"); + if (scalingFunctionCF && scalingStruct.kCF == 0) + VF_LOG_WARNING("The scaling function {} was set, although there is no refinement", scalingName); + } + + SPtr<Parameter> para; + + gridScalingFC scalingFineToCoarse = nullptr; + gridScalingCF scalingCoarseToFine = nullptr; +}; +#endif diff --git a/src/gpu/VirtualFluids_GPU/LBM/D3Q27.h b/src/gpu/VirtualFluids_GPU/LBM/D3Q27.h deleted file mode 100644 index 5e769b603e7c6677b7f9e1189f5c4fe27051f795..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/LBM/D3Q27.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _LB_D3Q27_H_ -#define _LB_D3Q27_H_ -#include <math.h> - -#define dirE /*f1 */ 0 -#define dirW /*f2 */ 1 -#define dirN /*f3 */ 2 -#define dirS /*f4 */ 3 -#define dirT /*f5 */ 4 -#define dirB /*f6 */ 5 -#define dirNE /*f7 */ 6 -#define dirSW /*f8 */ 7 -#define dirSE /*f9 */ 8 -#define dirNW /*f10*/ 9 -#define dirTE /*f11*/ 10 -#define dirBW /*f12*/ 11 -#define dirBE /*f13*/ 12 -#define dirTW /*f14*/ 13 -#define dirTN /*f15*/ 14 -#define dirBS /*f16*/ 15 -#define dirBN /*f17*/ 16 -#define dirTS /*f18*/ 17 -#define dirZERO /*f0 */ 18 -#define dirREST /*f0 */ 18 - -#define dirTNE /*f */ 19 -#define dirBNE /*f */ 20 -#define dirTSE /*f */ 21 -#define dirBSE /*f */ 22 - -#define dirTNW /*f */ 23 -#define dirBNW /*f */ 24 -#define dirTSW /*f */ 25 -#define dirBSW /*f */ 26 - -#define dirSTART 0 -#define dirEND 26 - -#endif - - diff --git a/src/gpu/VirtualFluids_GPU/LBM/LB.h b/src/gpu/VirtualFluids_GPU/LBM/LB.h index a33b3b792cd451307825fd0b2c8716e942440582..eea4adfda3c1ef0862f39ef58fc6e065af7bab1b 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/LB.h +++ b/src/gpu/VirtualFluids_GPU/LBM/LB.h @@ -1,7 +1,7 @@ // _ ___ __ __________ _ __ ______________ __ // | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ / ___/ __ / / / / // | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ / /___/ /_/ / / / / -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) / /_) / ____/ /__/ / +// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) / /_) / ____/ /__/ / // |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ \____/_/ \_____/ // ////////////////////////////////////////////////////////////////////////// @@ -50,6 +50,19 @@ #include <string> #include <vector> +//! \brief An enumeration for selecting a turbulence model +enum class TurbulenceModel { + //! - Smagorinsky + Smagorinsky, + //! - AMD (Anisotropic Minimum Dissipation) model, see e.g. Rozema et al., Phys. Fluids 27, 085107 (2015), https://doi.org/10.1063/1.4928700 + AMD, + //! - QR model by Verstappen + QR, + //! - TODO: move the WALE model here from the old kernels + //WALE + //! - No turbulence model + None +}; struct InitCondition { @@ -61,7 +74,7 @@ struct InitCondition real RealX {1.0}; real RealY {1.0}; int numprocs {1}; - int myid {0}; + int myProcessId {0}; int maxdev {1}; uint tDoCheckPoint {0}; uint tDoRestart {0}; @@ -74,12 +87,14 @@ struct InitCondition uint PressOutID {0}; uint PressInZ {1}; uint PressOutZ {2}; - std::vector<uint> devices {1, 0}; // one device with ID = 0 + std::vector<uint> devices {0, 1}; // one device with ID = 0 std::vector<int> GridX, GridY, GridZ, DistX, DistY, DistZ; std::vector<real> scaleLBMtoSI, translateLBMtoSI; std::vector<real> minCoordX, minCoordY, minCoordZ, maxCoordX, maxCoordY, maxCoordZ; - std::string fname, oPath; - std::string oPrefix {"MyFile"}; + std::string fname {"output/simulation"}; + std::string oPath {"output/"}; + std::string gridPath {"grid/"}; + std::string oPrefix {"simulation"}; std::string geometryFileC, geometryFileM, geometryFileF; std::string kFull, geoFull, geoVec, coordX, coordY, coordZ, neighborX, neighborY, neighborZ, neighborWSB, scaleCFC, scaleCFF, scaleFCC, scaleFCF, scaleOffsetCF, scaleOffsetFC; std::string noSlipBcPos, noSlipBcQs, noSlipBcValue; @@ -120,9 +135,13 @@ struct InitCondition bool calcMedian {false}; bool isConc {false}; bool isWale {false}; + TurbulenceModel turbulenceModel {TurbulenceModel::None}; + bool isTurbulentViscosity {false}; + real SGSConstant {0.0}; bool isMeasurePoints {false}; bool isInitNeq {false}; bool isGeoNormal, isInflowNormal, isOutflowNormal; + bool hasWallModelMonitor {false}; bool simulatePorousMedia {false}; bool streetVelocityFile {false}; }; @@ -173,7 +192,13 @@ typedef struct Distri27{ real* f[27]; } Distributions27, DistributionReferences27; +// Subgrid distances q 27 +typedef struct SubgridDist27{ + real* q[27]; +} SubgridDistances27; + //Q for second order BCs +//! \struct to manage sub-grid-distances (q) for second order Boundary Conditions (BCs) typedef struct QforBC{ int* k; int* kN; @@ -181,9 +206,12 @@ typedef struct QforBC{ real* qread; real* q27[27]; real* q19[19]; - int kQ=0; + unsigned int numberOfBCnodes=0; int kArray; - real *Vx, *Vy, *Vz, *deltaVz, *RhoBC; + real *Vx, *Vy, *Vz; + real *Vx1, *Vy1, *Vz1; + real *deltaVz, *RhoBC; + real *normalX, *normalY, *normalZ; }QforBoundaryConditions; //BCTemp @@ -210,6 +238,17 @@ typedef struct TempPressforBC{ int kTemp=0; }TempPressforBoundaryConditions; +// Settings for wall model used in StressBC +typedef struct WMparas{ + real* z0; + int* samplingOffset; + bool hasMonitor; + real* u_star; + real* Fx; + real* Fy; + real* Fz; +}WallModelParameters; + //measurePoints typedef struct MeasP{ std::string name; @@ -259,6 +298,8 @@ typedef struct PLP{ uint memSizeID, memSizeTimestep, memSizerealAll, memSizereal, memSizeBool, memSizeBoolBC; }PathLineParticles; + + ////////////////////////////////////////////////////////////////////////// inline int vectorPosition(int i, int j, int k, int Lx, int Ly ) { diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp index 737b4edad35eee4829065b89fc1b12eb2c43ef4d..703e935e6edb5676c7d6e045a38e3ec20d7a4b41 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp +++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp @@ -1,20 +1,27 @@ #include "Simulation.h" -#include <stdio.h> #include <vector> #include <helper_timer.h> + +#include "Factories/GridScalingFactory.h" #include "LBM/LB.h" #include "Communication/Communicator.h" #include "Communication/ExchangeData27.h" #include "Parameter/Parameter.h" +#include "Parameter/CudaStreamManager.h" +#include "Parameter/EdgeNodeFinder.h" #include "GPU/GPU_Interface.h" +#include "GPU/KineticEnergyAnalyzer.h" +#include "GPU/EnstrophyAnalyzer.h" #include "basics/utilities/UbFileOutputASCII.h" ////////////////////////////////////////////////////////////////////////// #include "Output/MeasurePointWriter.hpp" #include "Output/AnalysisData.hpp" #include "Output/InterfaceDebugWriter.hpp" +#include "Output/EdgeNodeDebugWriter.hpp" +#include "Output/NeighborDebugWriter.hpp" #include "Output/VeloASCIIWriter.hpp" ////////////////////////////////////////////////////////////////////////// #include "Utilities/Buffer2D.hpp" @@ -34,403 +41,426 @@ #include "Calculation/Cp.h" #include "Calculation/Calc2ndMoments.h" #include "Calculation/CalcMedian.h" +#include "Calculation/CalcTurbulenceIntensity.h" #include "Calculation/ForceCalculations.h" #include "Calculation/PorousMedia.h" ////////////////////////////////////////////////////////////////////////// +#include "Output/Timer.h" +#include "Output/FileWriter.h" +////////////////////////////////////////////////////////////////////////// #include "Restart/RestartObject.h" ////////////////////////////////////////////////////////////////////////// #include "DataStructureInitializer/GridProvider.h" #include "Output/DataWriter.h" #include "Kernel/Utilities/KernelFactory/KernelFactory.h" #include "PreProcessor/PreProcessorFactory/PreProcessorFactory.h" +#include "PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h" +#include "Kernel/Utilities/KernelFactory/KernelFactoryImp.h" #include "Kernel/Kernel.h" - +#include "TurbulenceModels/TurbulenceModelFactory.h" #include <cuda/DeviceInfo.h> #include <logger/Logger.h> -Simulation::Simulation(vf::gpu::Communicator& communicator) : communicator(communicator) -{ - -} std::string getFileName(const std::string& fname, int step, int myID) { return std::string(fname + "_Restart_" + UbSystem::toString(myID) + "_" + UbSystem::toString(step)); } - -void Simulation::setFactories(std::shared_ptr<KernelFactory> kernelFactory, std::shared_ptr<PreProcessorFactory> preProcessorFactory) +Simulation::Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, + vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, GridScalingFactory* scalingFactory) + : para(para), cudaMemoryManager(memoryManager), communicator(communicator), kernelFactory(std::make_unique<KernelFactoryImp>()), + preProcessorFactory(std::make_shared<PreProcessorFactoryImp>()), dataWriter(std::make_unique<FileWriter>()) { - this->kernelFactory = kernelFactory; - this->preProcessorFactory = preProcessorFactory; + this->tmFactory = SPtr<TurbulenceModelFactory>( new TurbulenceModelFactory(para) ); + init(gridProvider, bcFactory, tmFactory, scalingFactory); } -void Simulation::addKineticEnergyAnalyzer(uint tAnalyse) +Simulation::Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, + vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory* scalingFactory) + : para(para), cudaMemoryManager(memoryManager), communicator(communicator), kernelFactory(std::make_unique<KernelFactoryImp>()), + preProcessorFactory(std::make_shared<PreProcessorFactoryImp>()), dataWriter(std::make_unique<FileWriter>()) { - this->kineticEnergyAnalyzer = std::make_shared<KineticEnergyAnalyzer>(this->para, tAnalyse); + init(gridProvider, bcFactory, tmFactory, scalingFactory); } -void Simulation::addEnstrophyAnalyzer(uint tAnalyse) +void Simulation::init(GridProvider &gridProvider, BoundaryConditionFactory *bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory *scalingFactory) { - this->enstrophyAnalyzer = std::make_shared<EnstrophyAnalyzer>(this->para, tAnalyse); -} + gridProvider.initalGridInformations(); + vf::cuda::verifyAndSetDevice( + communicator.mapCudaDevice(para->getMyProcessID(), para->getNumprocs(), para->getDevices(), para->getMaxDev())); -void Simulation::init(SPtr<Parameter> para, SPtr<GridProvider> gridProvider, std::shared_ptr<DataWriter> dataWriter, std::shared_ptr<CudaMemoryManager> cudaManager) -{ - this->dataWriter = dataWriter; - this->gridProvider = gridProvider; - this->cudaManager = cudaManager; - gridProvider->initalGridInformations(); - this->para = para; - - vf::cuda::verifyAndSetDevice(communicator.mapCudaDevice(para->getMyID(), para->getNumprocs(), para->getDevices(), para->getMaxDev())); - - para->initLBMSimulationParameter(); - - gridProvider->allocAndCopyForcing(); - gridProvider->allocAndCopyQuadricLimiters(); - gridProvider->setDimensions(); - gridProvider->setBoundingBox(); - - para->setRe(para->getVelocity() * (real)1.0 / para->getViscosity()); - para->setlimitOfNodesForVTK(30000000); //max 30 Million nodes per VTK file - if (para->getDoRestart()) - para->setStartTurn(para->getTimeDoRestart()); - else - para->setStartTurn((unsigned int)0); //100000 - - restart_object = std::make_shared<ASCIIRestartObject>(); - ////////////////////////////////////////////////////////////////////////// - output.setName(para->getFName() + StringUtil::toString<int>(para->getMyID()) + ".log"); - if(para->getMyID() == 0) output.setConsoleOut(true); - output.clearLogFile(); - ////////////////////////////////////////////////////////////////////////// - //output << para->getNeedInterface().at(0) << "\n"; - //output << para->getNeedInterface().at(1) << "\n"; - //output << para->getNeedInterface().at(2) << "\n"; - //output << para->getNeedInterface().at(3) << "\n"; - //output << para->getNeedInterface().at(4) << "\n"; - //output << para->getNeedInterface().at(5) << "\n"; - ////////////////////////////////////////////////////////////////////////// - //output << " \t GridX \t GridY \t GridZ \t DistX \t DistY \t DistZ\n"; - //for (int testout=0; testout<=para->getMaxLevel();testout++) - //{ - // output << "Level " << testout << ": " << para->getGridX().at(testout) << " \t " << para->getGridY().at(testout) << " \t " << para->getGridZ().at(testout) << " \t " << para->getDistX().at(testout) << " \t " << para->getDistY().at(testout) << " \t " << para->getDistZ().at(testout) << " \n"; - //} - ////////////////////////////////////////////////////////////////////////// - output << "LB_Modell: D3Q"<< para->getD3Qxx() << "\n"; - output << "Re: " << para->getRe() << "\n"; - output << "vis_ratio: " << para->getViscosityRatio() << "\n"; - output << "u0_ratio: " << para->getVelocityRatio() << "\n"; - output << "delta_rho: " << para->getDensityRatio() << "\n"; - ////////////////////////////////////////////////////////////////////////// + para->initLBMSimulationParameter(); - ///////////////////////////////////////////////////////////////////////// - cudaManager->setMemsizeGPU(0, true); - ////////////////////////////////////////////////////////////////////////// - gridProvider->allocArrays_CoordNeighborGeo(); - gridProvider->allocArrays_BoundaryValues(); - gridProvider->allocArrays_BoundaryQs(); - gridProvider->allocArrays_OffsetScale(); + gridProvider.allocAndCopyForcing(); + gridProvider.allocAndCopyQuadricLimiters(); + if (para->getKernelNeedsFluidNodeIndicesToRun()) { + gridProvider.allocArrays_fluidNodeIndices(); + gridProvider.allocArrays_fluidNodeIndicesBorder(); + } - for( SPtr<PreCollisionInteractor> actuator: para->getActuators()){ - actuator->init(para.get(), gridProvider.get(), cudaManager.get()); - } + gridProvider.setDimensions(); + gridProvider.setBoundingBox(); - for( SPtr<PreCollisionInteractor> probe: para->getProbes()){ - probe->init(para.get(), gridProvider.get(), cudaManager.get()); - } + para->setRe(para->getVelocity() * (real)1.0 / para->getViscosity()); + para->setlimitOfNodesForVTK(30000000); // max 30 Million nodes per VTK file + if (para->getDoRestart()) + para->setStartTurn(para->getTimeDoRestart()); + else + para->setStartTurn((unsigned int)0); // 100000 - ////////////////////////////////////////////////////////////////////////// - //Kernel init - ////////////////////////////////////////////////////////////////////////// - output << "make Kernels " << "\n"; - kernels = kernelFactory->makeKernels(para); - - output << "make AD Kernels " << "\n"; - if (para->getDiffOn()) - adKernels = kernelFactory->makeAdvDifKernels(para); + restart_object = std::make_shared<ASCIIRestartObject>(); + ////////////////////////////////////////////////////////////////////////// + // CUDA streams + if (para->getUseStreams()) { + para->getStreamManager()->launchStreams(2u); + para->getStreamManager()->createCudaEvents(); + } + ////////////////////////////////////////////////////////////////////////// + VF_LOG_INFO("LB_Modell: D3Q{}", para->getD3Qxx()); + VF_LOG_INFO("Re: {}", para->getRe()); + VF_LOG_INFO("vis_ratio: {}", para->getViscosityRatio()); + VF_LOG_INFO("u0_ratio: {}", para->getVelocityRatio()); + VF_LOG_INFO("delta_rho: {}", para->getDensityRatio()); + VF_LOG_INFO("QuadricLimiters: {}, \t{}, \t{}", para->getQuadricLimitersHost()[0], + para->getQuadricLimitersHost()[1], para->getQuadricLimitersHost()[2]); + ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - //PreProcessor init - ////////////////////////////////////////////////////////////////////////// - output << "make Preprocessors " << "\n"; - std::vector<PreProcessorType> preProTypes = kernels.at(0)->getPreProcessorTypes(); - preProcessor = preProcessorFactory->makePreProcessor(preProTypes, para); + ///////////////////////////////////////////////////////////////////////// + cudaMemoryManager->setMemsizeGPU(0, true); + ////////////////////////////////////////////////////////////////////////// + allocNeighborsOffsetsScalesAndBoundaries(gridProvider); - ////////////////////////////////////////////////////////////////////////// - //Particles preprocessing - ////////////////////////////////////////////////////////////////////////// - if (para->getCalcParticle()) - { - rearrangeGeometry(para.get(), cudaManager.get()); - ////////////////////////////////////////////////////////////////////////// - allocParticles(para.get(), cudaManager.get()); - ////////////////////////////////////////////////////////////////////////// - ////CUDA random number generation - //para->cudaAllocRandomValues(); - - ////init - //initRandomDevice(para->getRandomState(), - // para->getParD(0)->plp.numberOfParticles, - // para->getParD(0)->numberofthreads); - - ////generate random values - //generateRandomValuesDevice( para->getRandomState(), - // para->getParD(0)->plp.numberOfParticles, - // para->getParD(0)->plp.randomLocationInit, - // para->getParD(0)->numberofthreads); - - ////////////////////////////////////////////////////////////////////////////// - initParticles(para.get()); - } - //////////////////////////////////////////////////////////////////////////// + for (SPtr<PreCollisionInteractor> actuator : para->getActuators()) { + actuator->init(para.get(), &gridProvider, cudaMemoryManager.get()); + } - ////////////////////////////////////////////////////////////////////////// - //Allocate Memory for Drag Lift Calculation - ////////////////////////////////////////////////////////////////////////// - if (para->getCalcDragLift()) allocDragLift(para.get(), cudaManager.get()); + for (SPtr<PreCollisionInteractor> probe : para->getProbes()) { + probe->init(para.get(), &gridProvider, cudaMemoryManager.get()); + } + ////////////////////////////////////////////////////////////////////////// + // Kernel init + ////////////////////////////////////////////////////////////////////////// + VF_LOG_INFO("make Kernels"); + kernels = kernelFactory->makeKernels(para); - ////////////////////////////////////////////////////////////////////////// - //Allocate Memory for Plane Conc Calculation - ////////////////////////////////////////////////////////////////////////// - //if (para->getDiffOn()) allocPlaneConc(para.get(), cudaManager.get()); + if (para->getDiffOn()) { + VF_LOG_INFO("make AD Kernels"); + adKernels = kernelFactory->makeAdvDifKernels(para); + } + ////////////////////////////////////////////////////////////////////////// + // PreProcessor init + ////////////////////////////////////////////////////////////////////////// + VF_LOG_INFO("make Preprocessors"); + std::vector<PreProcessorType> preProTypes = kernels.at(0)->getPreProcessorTypes(); + preProcessor = preProcessorFactory->makePreProcessor(preProTypes, para); - ////////////////////////////////////////////////////////////////////////// - //Median - ////////////////////////////////////////////////////////////////////////// - if (para->getCalcMedian()) - { - output << "alloc Calculation for Mean Valus " << "\n"; - if (para->getDiffOn()) allocMedianAD(para.get(), cudaManager.get()); - else allocMedian(para.get(), cudaManager.get()); - } + ////////////////////////////////////////////////////////////////////////// + // Particles preprocessing + ////////////////////////////////////////////////////////////////////////// + if (para->getCalcParticles()) { + rearrangeGeometry(para.get(), cudaMemoryManager.get()); + ////////////////////////////////////////////////////////////////////////// + allocParticles(para.get(), cudaMemoryManager.get()); + ////////////////////////////////////////////////////////////////////////// + ////CUDA random number generation + // para->cudaAllocRandomValues(); + + ////init + // initRandomDevice(para->getRandomState(), + // para->getParD(0)->plp.numberOfParticles, + // para->getParD(0)->numberofthreads); + + ////generate random values + // generateRandomValuesDevice( para->getRandomState(), + // para->getParD(0)->plp.numberOfParticles, + // para->getParD(0)->plp.randomLocationInit, + // para->getParD(0)->numberofthreads); + ////////////////////////////////////////////////////////////////////////////// + initParticles(para.get()); + } + //////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - //allocate memory and initialize 2nd, 3rd and higher order moments - ////////////////////////////////////////////////////////////////////////// - if (para->getCalc2ndOrderMoments()){ alloc2ndMoments(para.get(), cudaManager.get()); init2ndMoments(para.get()); } - if (para->getCalc3rdOrderMoments()){ alloc3rdMoments(para.get(), cudaManager.get()); init3rdMoments(para.get()); } - if (para->getCalcHighOrderMoments()){ allocHigherOrderMoments(para.get(), cudaManager.get()); initHigherOrderMoments(para.get()); } + ////////////////////////////////////////////////////////////////////////// + // Allocate Memory for Drag Lift Calculation + ////////////////////////////////////////////////////////////////////////// + if (para->getCalcDragLift()) + allocDragLift(para.get(), cudaMemoryManager.get()); + ////////////////////////////////////////////////////////////////////////// + // Allocate Memory for Plane Conc Calculation + ////////////////////////////////////////////////////////////////////////// + // if (para->getDiffOn()) allocPlaneConc(para.get(), cudaMemoryManager.get()); - ////////////////////////////////////////////////////////////////////////// - //MeasurePoints - ////////////////////////////////////////////////////////////////////////// - if (para->getUseMeasurePoints()) - { - output << "read measure points..."; - readMeasurePoints(para.get(), cudaManager.get()); - output << "done.\n"; - } + ////////////////////////////////////////////////////////////////////////// + // Median + ////////////////////////////////////////////////////////////////////////// + if (para->getCalcMedian()) { + VF_LOG_INFO("alloc Calculation for Mean Values"); + if (para->getDiffOn()) + allocMedianAD(para.get(), cudaMemoryManager.get()); + else + allocMedian(para.get(), cudaMemoryManager.get()); + } - ////////////////////////////////////////////////////////////////////////// - //Porous Media - ////////////////////////////////////////////////////////////////////////// - if (para->getSimulatePorousMedia()) - { - output << "define area(s) of porous media..."; - porousMedia(); - kernelFactory->setPorousMedia(pm); - output << "done.\n"; - } + ////////////////////////////////////////////////////////////////////////// + // Turbulence Intensity + ////////////////////////////////////////////////////////////////////////// + if (para->getCalcTurbulenceIntensity()) { + VF_LOG_INFO("alloc arrays for calculating Turbulence Intensity"); + allocTurbulenceIntensity(para.get(), cudaMemoryManager.get()); + } - ////////////////////////////////////////////////////////////////////////// - //enSightGold - ////////////////////////////////////////////////////////////////////////// - //excludeGridInterfaceNodesForMirror(para, 7); - ////output << "print case file..."; - //printCaseFile(para); - ////output << "done.\n"; - ////output << "print geo file..."; - //printGeoFile(para, true); //true for binary - ////output << "done.\n"; + ////////////////////////////////////////////////////////////////////////// + // allocate memory and initialize 2nd, 3rd and higher order moments + ////////////////////////////////////////////////////////////////////////// + if (para->getCalc2ndOrderMoments()) { + alloc2ndMoments(para.get(), cudaMemoryManager.get()); + init2ndMoments(para.get()); + } + if (para->getCalc3rdOrderMoments()) { + alloc3rdMoments(para.get(), cudaMemoryManager.get()); + init3rdMoments(para.get()); + } + if (para->getCalcHighOrderMoments()) { + allocHigherOrderMoments(para.get(), cudaMemoryManager.get()); + initHigherOrderMoments(para.get()); + } - ////////////////////////////////////////////////////////////////////////// - //Forcing - ////////////////////////////////////////////////////////////////////////// - ////allocVeloForForcing(para); - //output << "new object forceCalulator " << "\n"; - //forceCalculator = std::make_shared<ForceCalculations>(para.get()); + ////////////////////////////////////////////////////////////////////////// + // MeasurePoints + ////////////////////////////////////////////////////////////////////////// + if (para->getUseMeasurePoints()) { + VF_LOG_INFO("read measure points"); + readMeasurePoints(para.get(), cudaMemoryManager.get()); + } - ////////////////////////////////////////////////////////////////////////// - //output << "define the Grid..." ; - //defineGrid(para, communicator); - ////allocateMemory(); - //output << "done.\n"; - - output << "init lattice..." ; - initLattice(para, preProcessor, cudaManager); - output << "done.\n"; - - //output << "set geo for Q...\n" ; - //setGeoForQ(); - //output << "done.\n"; - - //if (maxlevel>1) - //{ - //output << "find Qs...\n" ; - //findQ27(para); - //output << "done.\n"; - //} - - //if (para->getDiffOn()==true) - //{ - // output << "define TempBC...\n" ; - // findTempSim(para); - // output << "done.\n"; - - // output << "define TempVelBC...\n" ; - // findTempVelSim(para); - // output << "done.\n"; - - // output << "define TempPressBC...\n" ; - // findTempPressSim(para); - // output << "done.\n"; - //} - - //output << "find Qs-BC...\n" ; - //findBC27(para); - //output << "done.\n"; - - //output << "find Press-BC...\n" ; - //findPressQShip(para); - //output << "done.\n"; + ////////////////////////////////////////////////////////////////////////// + // Porous Media + ////////////////////////////////////////////////////////////////////////// + if (para->getSimulatePorousMedia()) { + VF_LOG_INFO("define area(s) of porous media"); + porousMedia(); + kernelFactory->setPorousMedia(pm); + } + ////////////////////////////////////////////////////////////////////////// + // enSightGold + ////////////////////////////////////////////////////////////////////////// + // excludeGridInterfaceNodesForMirror(para, 7); + ////VF_LOG_INFO("print case file..."); + // printCaseFile(para); + ////VF_LOG_INFO("print geo file..."); + // printGeoFile(para, true); //true for binary + ////VF_LOG_INFO("done."); - ////////////////////////////////////////////////////////////////////////// - //Memory alloc for CheckPoint / Restart - ////////////////////////////////////////////////////////////////////////// - if (para->getDoCheckPoint() || para->getDoRestart()) - { - output << "Alloc Memory for CheckPoint / Restart..."; - for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) - { - cudaManager->cudaAllocFsForCheckPointAndRestart(lev); - } - output << "done.\n"; - } + ////////////////////////////////////////////////////////////////////////// + // Forcing + ////////////////////////////////////////////////////////////////////////// + ////allocVeloForForcing(para); + // VF_LOG_INFO("new object forceCalulator"); + // forceCalculator = std::make_shared<ForceCalculations>(para.get()); - ////////////////////////////////////////////////////////////////////////// - //Restart - ////////////////////////////////////////////////////////////////////////// - if (para->getDoRestart()) - { - output << "Restart...\n...get the Object...\n"; - - const auto name = getFileName(para->getFName(), para->getTimeDoRestart(), para->getMyID()); - restart_object->deserialize(name, para); - - output << "...copy Memory for Restart...\n"; - for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) - { - ////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyFsForRestart(lev); - ////////////////////////////////////////////////////////////////////////// - //macroscopic values - CalcMacSP27(para->getParD(lev)->vx_SP, - para->getParD(lev)->vy_SP, - para->getParD(lev)->vz_SP, - para->getParD(lev)->rho_SP, - para->getParD(lev)->press_SP, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->numberofthreads, - para->getParD(lev)->d0SP.f[0], - para->getParD(lev)->evenOrOdd); - getLastCudaError("Kernel CalcMacSP27 execution failed"); - ////////////////////////////////////////////////////////////////////////// - //test...should not work...and does not - //para->getEvenOrOdd(lev)==false; - } - output << "done.\n"; - } + ////////////////////////////////////////////////////////////////////////// + // VF_LOG_INFO("define the Grid..."); + // defineGrid(para, communicator); + ////allocateMemory(); + // VF_LOG_INFO("done."); - ////////////////////////////////////////////////////////////////////////// - //Print Init - ////////////////////////////////////////////////////////////////////////// - output << "Print files Init..."; - dataWriter->writeInit(para, cudaManager); - if (para->getCalcParticle()) - copyAndPrintParticles(para.get(), cudaManager.get(), 0, true); - output << "done.\n"; + VF_LOG_INFO("init lattice..."); + initLattice(para, preProcessor, cudaMemoryManager); + VF_LOG_INFO("done"); - ////////////////////////////////////////////////////////////////////////// - output << "used Device Memory: " << cudaManager->getMemsizeGPU() / 1000000.0 << " MB\n"; - ////////////////////////////////////////////////////////////////////////// + // VF_LOG_INFO("set geo for Q...\n"); + // setGeoForQ(); + + // if (maxlevel>1) + //{ + // VF_LOG_INFO("find Qs..."); + // findQ27(para); + // VF_LOG_INFO("done."); + //} + + // if (para->getDiffOn()==true) + //{ + // VF_LOG_INFO("define TempBC..."); + // findTempSim(para); + + // VF_LOG_INFO("define TempVelBC..."); + // findTempVelSim(para); + + // VF_LOG_INFO("define TempPressBC..."); + // findTempPressSim(para); + // VF_LOG_INFO("done."); + //} + + // VF_LOG_INFO("find Qs-BC..."); + // findBC27(para); + + // VF_LOG_INFO("find Press-BC..."); + // findPressQShip(para); + // VF_LOG_INFO("done."); + + ////////////////////////////////////////////////////////////////////////// + // find indices of corner nodes for multiGPU communication + ////////////////////////////////////////////////////////////////////////// + if (para->getDevices().size() > 2) { + VF_LOG_INFO("Find indices of edge nodes for multiGPU communication"); + vf::gpu::findEdgeNodesCommMultiGPU(*para); + } + ////////////////////////////////////////////////////////////////////////// + // Memory alloc for CheckPoint / Restart + ////////////////////////////////////////////////////////////////////////// + if (para->getDoCheckPoint() || para->getDoRestart()) { + VF_LOG_INFO("Alloc Memory for CheckPoint / Restart"); + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { + cudaMemoryManager->cudaAllocFsForCheckPointAndRestart(lev); + } + } - InterfaceDebugWriter::writeInterfaceLinesDebugCF(para.get()); - InterfaceDebugWriter::writeInterfaceLinesDebugFC(para.get()); + ////////////////////////////////////////////////////////////////////////// + // Restart + ////////////////////////////////////////////////////////////////////////// + if (para->getDoRestart()) { + VF_LOG_INFO("Restart...\n...get the Object..."); + + const auto name = getFileName(para->getFName(), para->getTimeDoRestart(), para->getMyProcessID()); + restart_object->deserialize(name, para); + + VF_LOG_INFO("...copy Memory for Restart..."); + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { + ////////////////////////////////////////////////////////////////////////// + cudaMemoryManager->cudaCopyFsForRestart(lev); + ////////////////////////////////////////////////////////////////////////// + // macroscopic values + CalcMacSP27(para->getParD(lev)->velocityX, para->getParD(lev)->velocityY, para->getParD(lev)->velocityZ, + para->getParD(lev)->rho, para->getParD(lev)->pressure, para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, para->getParD(lev)->numberOfNodes, + para->getParD(lev)->numberofthreads, para->getParD(lev)->distributions.f[0], + para->getParD(lev)->isEvenTimestep); + getLastCudaError("Kernel CalcMacSP27 execution failed"); + ////////////////////////////////////////////////////////////////////////// + // test...should not work...and does not + // para->getEvenOrOdd(lev)==false; + } + VF_LOG_INFO("done."); + } + + ////////////////////////////////////////////////////////////////////////// + // Init UpdateGrid + ////////////////////////////////////////////////////////////////////////// + this->updateGrid27 = std::make_unique<UpdateGrid27>(para, communicator, cudaMemoryManager, pm, kernels, bcFactory, tmFactory, scalingFactory); + + ////////////////////////////////////////////////////////////////////////// + // Write Initialized Files + ////////////////////////////////////////////////////////////////////////// + VF_LOG_INFO("Write initialized Files ..."); + dataWriter->writeInit(para, cudaMemoryManager); + if (para->getCalcParticles()) + copyAndPrintParticles(para.get(), cudaMemoryManager.get(), 0, true); + VF_LOG_INFO("... done."); + + ////////////////////////////////////////////////////////////////////////// + VF_LOG_INFO("used Device Memory: {} MB", cudaMemoryManager->getMemsizeGPU() / 1000000.0); + // std::cout << "Process " << communicator.getPID() <<": used device memory" << cudaMemoryManager->getMemsizeGPU() / + // 1000000.0 << " MB\n" << std::endl; + ////////////////////////////////////////////////////////////////////////// + + // NeighborDebugWriter::writeNeighborLinkLinesDebug(para.get()); + + // InterfaceDebugWriter::writeInterfaceLinesDebugCF(para.get()); + // InterfaceDebugWriter::writeInterfaceLinesDebugFC(para.get()); + + // writers for version with communication hiding + // if(para->getNumprocs() > 1 && para->getUseStreams()){ + // InterfaceDebugWriter::writeInterfaceFCC_Send(para.get()); + // InterfaceDebugWriter::writeInterfaceCFC_Recv(para.get()); + // InterfaceDebugWriter::writeSendNodesStream(para.get()); + // InterfaceDebugWriter::writeRecvNodesStream(para.get()); + // EdgeNodeDebugWriter::writeEdgeNodesXZ_Send(para); + // EdgeNodeDebugWriter::writeEdgeNodesXZ_Recv(para); + // } +} + +void Simulation::addKineticEnergyAnalyzer(uint tAnalyse) +{ + this->kineticEnergyAnalyzer = std::make_unique<KineticEnergyAnalyzer>(this->para, tAnalyse); } -void Simulation::bulk() +void Simulation::addEnstrophyAnalyzer(uint tAnalyse) { + this->enstrophyAnalyzer = std::make_unique<EnstrophyAnalyzer>(this->para, tAnalyse); +} +void Simulation::setDataWriter(std::shared_ptr<DataWriter> dataWriter_) +{ + this->dataWriter = dataWriter_; } +void Simulation::setFactories(std::unique_ptr<KernelFactory> &&kernelFactory_, + std::unique_ptr<PreProcessorFactory> &&preProcessorFactory_) +{ + this->kernelFactory = std::move(kernelFactory_); + this->preProcessorFactory = std::move(preProcessorFactory_); +} + + +void Simulation::allocNeighborsOffsetsScalesAndBoundaries(GridProvider &gridProvider) +{ + gridProvider.allocArrays_CoordNeighborGeo(); + gridProvider.allocArrays_OffsetScale(); + gridProvider.allocArrays_BoundaryValues(); // allocArrays_BoundaryValues() has to be called after allocArrays_OffsetScale() because of initCommunicationArraysForCommAfterFinetoCoarse() + gridProvider.allocArrays_BoundaryQs(); +} + + void Simulation::run() { - double ftimeE, ftimeS, fnups, durchsatz; - float timerE, timerS; - timerE = 0.0f; - timerS = 0.0f; - ftimeE = 0.0f; - ftimeS = 0.0f; - unsigned int t, t_prev; + unsigned int timestep, t_prev; + uint t_turbulenceIntensity = 0; unsigned int t_MP = 0; + ////////////////////////////////////////////////////////////////////////// para->setStepEnsight(0); //turning Ship real Pi = (real)3.14159265358979323846; real delta_x_F = (real)0.1; - real delta_t_F = (real)((double)para->getVelocity() * (double)delta_x_F / (double)3.75); + real delta_t_F = (real)((double)para->getVelocity() * (double)delta_x_F / (double)3.75); real delta_t_C = (real)(delta_t_F * pow(2.,para->getMaxLevel())); real timesteps_C = (real)(12.5 / delta_t_C); real AngularVelocity = (real)(12.5 / timesteps_C * Pi / 180.); para->setAngularVelocity(AngularVelocity); for (int i = 0; i<= para->getMaxLevel(); i++) { - para->getParD(i)->deltaPhi = (real)(para->getAngularVelocity()/(pow(2.,i))); + para->getParD(i)->deltaPhi = (real)(para->getAngularVelocity()/(pow(2.,i))); } ////////////////////////////////////////////////////////////////////////// - //Timer SDK - StopWatchInterface *sdkTimer = NULL; - sdkCreateTimer(&sdkTimer); - sdkStartTimer(&sdkTimer); - //Timer Event - cudaEvent_t start_t, stop_t; - checkCudaErrors( cudaEventCreate(&start_t)); - checkCudaErrors( cudaEventCreate(&stop_t)); - checkCudaErrors( cudaEventRecord(start_t)); - t_prev = para->getTimeCalcMedStart(); - output << "Processing time (ms) \t Nups in Mio \t Durchsatz in GB/sec\n"; + Timer* averageTimer = new Timer("Average performance"); + averageTimer->startTimer(); - output << "getMaxLevel = " << para->getMaxLevel() << "\n"; - //////////////////////////////////////////////////////////////////////////////// - // Time loop - //////////////////////////////////////////////////////////////////////////////// - for(t=para->getTStart();t<=para->getTEnd();t++) - { - updateGrid27(para.get(), communicator, cudaManager.get(), pm, 0, t, kernels); + //////////////////////////////////////////////////////////////////////////////// + // Time loop + //////////////////////////////////////////////////////////////////////////////// + for(timestep=para->getTimestepStart();timestep<=para->getTimestepEnd();timestep++) + { + this->updateGrid27->updateGrid(0, timestep); - //////////////////////////////////////////////////////////////////////////////// - //Particles - //////////////////////////////////////////////////////////////////////////////// - if (para->getCalcParticle()) propagateParticles(para.get(), t); - //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + //Particles + //////////////////////////////////////////////////////////////////////////////// + if (para->getCalcParticles()) propagateParticles(para.get(), timestep); + //////////////////////////////////////////////////////////////////////////////// @@ -438,12 +468,14 @@ void Simulation::run() //////////////////////////////////////////////////////////////////////////////// // run Analyzers for kinetic energy and enstrophy for TGV in 3D // these analyzers only work on level 0 - //////////////////////////////////////////////////////////////////////////////// - if( this->kineticEnergyAnalyzer || this->enstrophyAnalyzer ) exchangeMultiGPU(para.get(), communicator, cudaManager.get(), 0); + //////////////////////////////////////////////////////////////////////////////// + if (this->kineticEnergyAnalyzer || this->enstrophyAnalyzer) { + updateGrid27->exchangeData(0); + } - if( this->kineticEnergyAnalyzer ) this->kineticEnergyAnalyzer->run(t); - if( this->enstrophyAnalyzer ) this->enstrophyAnalyzer->run(t); - //////////////////////////////////////////////////////////////////////////////// + if( this->kineticEnergyAnalyzer ) this->kineticEnergyAnalyzer->run(timestep); + if( this->enstrophyAnalyzer ) this->enstrophyAnalyzer->run(timestep); + //////////////////////////////////////////////////////////////////////////////// @@ -451,42 +483,66 @@ void Simulation::run() //////////////////////////////////////////////////////////////////////////////// //Calc Median //////////////////////////////////////////////////////////////////////////////// - if (para->getCalcMedian() && ((int)t >= para->getTimeCalcMedStart()) && ((int)t <= para->getTimeCalcMedEnd())) + if (para->getCalcMedian() && ((int)timestep >= para->getTimeCalcMedStart()) && ((int)timestep <= para->getTimeCalcMedEnd())) { for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { - //CalcMedSP27(para->getParD(lev)->vx_SP_Med, - // para->getParD(lev)->vy_SP_Med, - // para->getParD(lev)->vz_SP_Med, - // para->getParD(lev)->rho_SP_Med, - // para->getParD(lev)->press_SP_Med, - // para->getParD(lev)->geoSP, - // para->getParD(lev)->neighborX_SP, - // para->getParD(lev)->neighborY_SP, - // para->getParD(lev)->neighborZ_SP, - // para->getParD(lev)->size_Mat_SP, - // para->getParD(lev)->numberofthreads, - // para->getParD(lev)->d0SP.f[0], - // para->getParD(lev)->evenOrOdd); - //getLastCudaError("CalcMacSP27 execution failed"); - - CalcMedCompSP27(para->getParD(lev)->vx_SP_Med, - para->getParD(lev)->vy_SP_Med, - para->getParD(lev)->vz_SP_Med, - para->getParD(lev)->rho_SP_Med, - para->getParD(lev)->press_SP_Med, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->numberofthreads, - para->getParD(lev)->d0SP.f[0], - para->getParD(lev)->evenOrOdd); - getLastCudaError("CalcMacMedCompSP27 execution failed"); - + //CalcMedSP27(para->getParD(lev)->vx_SP_Med, + // para->getParD(lev)->vy_SP_Med, + // para->getParD(lev)->vz_SP_Med, + // para->getParD(lev)->rho_SP_Med, + // para->getParD(lev)->press_SP_Med, + // para->getParD(lev)->geoSP, + // para->getParD(lev)->neighborX_SP, + // para->getParD(lev)->neighborY_SP, + // para->getParD(lev)->neighborZ_SP, + // para->getParD(lev)->size_Mat_SP, + // para->getParD(lev)->numberofthreads, + // para->getParD(lev)->d0SP.f[0], + // para->getParD(lev)->evenOrOdd); + //getLastCudaError("CalcMacSP27 execution failed"); + + CalcMedCompSP27(para->getParD(lev)->vx_SP_Med, + para->getParD(lev)->vy_SP_Med, + para->getParD(lev)->vz_SP_Med, + para->getParD(lev)->rho_SP_Med, + para->getParD(lev)->press_SP_Med, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, + para->getParD(lev)->numberofthreads, + para->getParD(lev)->distributions.f[0], + para->getParD(lev)->isEvenTimestep); + getLastCudaError("CalcMacMedCompSP27 execution failed"); + } } + + if (para->getCalcTurbulenceIntensity()) { + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { + CalcTurbulenceIntensityDevice( + para->getParD(lev)->vxx, + para->getParD(lev)->vyy, + para->getParD(lev)->vzz, + para->getParD(lev)->vxy, + para->getParD(lev)->vxz, + para->getParD(lev)->vyz, + para->getParD(lev)->vx_mean, + para->getParD(lev)->vy_mean, + para->getParD(lev)->vz_mean, + para->getParD(lev)->distributions.f[0], + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, + para->getParD(lev)->isEvenTimestep, + para->getParD(lev)->numberofthreads + ); + } + } //////////////////////////////////////////////////////////////////////////////// @@ -495,39 +551,29 @@ void Simulation::run() //////////////////////////////////////////////////////////////////////////////// // CheckPoint //////////////////////////////////////////////////////////////////////////////// - if(para->getDoCheckPoint() && para->getTimeDoCheckPoint()>0 && t%para->getTimeDoCheckPoint()==0 && t>0 && !para->overWritingRestart(t)) + if(para->getDoCheckPoint() && para->getTimeDoCheckPoint()>0 && timestep%para->getTimeDoCheckPoint()==0 && timestep>0 && !para->overWritingRestart(timestep)) { + averageTimer->stopTimer(); ////////////////////////////////////////////////////////////////////////// - //Timer SDK - sdkStopTimer(&sdkTimer); - sdkResetTimer(&sdkTimer); - ////////////////////////////////////////////////////////////////////////// - //Timer Event - checkCudaErrors( cudaEventRecord(stop_t)); - checkCudaErrors( cudaEventSynchronize(stop_t)); - + if( para->getDoCheckPoint() ) { - output << "Dateien fuer CheckPoint kopieren t=" << t << "...\n"; - + VF_LOG_INFO("Copy data for CheckPoint t = {}....", timestep); + for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { - cudaManager->cudaCopyFsForCheckPoint(lev); + cudaMemoryManager->cudaCopyFsForCheckPoint(lev); } - - output << "Dateien fuer CheckPoint schreiben t=" << t << "..."; - const auto name = getFileName(para->getFName(), t, para->getMyID()); - restart_object->serialize(name, para); + VF_LOG_INFO("Write data for CheckPoint t = {}...", timestep); + + const auto name = getFileName(para->getFName(), timestep, para->getMyProcessID()); + restart_object->serialize(name, para); - output << "\n fertig\n"; + VF_LOG_INFO("done"); } ////////////////////////////////////////////////////////////////////////// - //Timer SDK - sdkStartTimer(&sdkTimer); - ////////////////////////////////////////////////////////////////////////// - //Timer Event - checkCudaErrors( cudaEventRecord(start_t)); + averageTimer->startTimer(); } ////////////////////////////////////////////////////////////////////////////// @@ -541,33 +587,33 @@ void Simulation::run() //set MP-Time if (para->getUseMeasurePoints()) { - if ((t%para->getTimestepForMP()) == 0) + if ((timestep%para->getTimestepForMP()) == 0) { unsigned int valuesPerClockCycle = (unsigned int)(para->getclockCycleForMP() / para->getTimestepForMP()); for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { - //output << "start level = " << lev << "\n"; - LBCalcMeasurePoints27( para->getParD(lev)->VxMP, para->getParD(lev)->VyMP, para->getParD(lev)->VzMP, - para->getParD(lev)->RhoMP, para->getParD(lev)->kMP, para->getParD(lev)->numberOfPointskMP, - valuesPerClockCycle, t_MP, para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, para->getParD(lev)->neighborY_SP, para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, para->getParD(lev)->d0SP.f[0], para->getParD(lev)->numberofthreads, - para->getParD(lev)->evenOrOdd); + // VF_LOG_INFO("start level = {}", lev); + LBCalcMeasurePoints27( para->getParD(lev)->VxMP, para->getParD(lev)->VyMP, para->getParD(lev)->VzMP, + para->getParD(lev)->RhoMP, para->getParD(lev)->kMP, para->getParD(lev)->numberOfPointskMP, + valuesPerClockCycle, t_MP, para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, para->getParD(lev)->neighborY, para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, para->getParD(lev)->distributions.f[0], para->getParD(lev)->numberofthreads, + para->getParD(lev)->isEvenTimestep); } t_MP++; } - + //Copy Measure Values - if ((t % (unsigned int)para->getclockCycleForMP()) == 0) + if ((timestep % (unsigned int)para->getclockCycleForMP()) == 0) { for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { - cudaManager->cudaCopyMeasurePointsToHost(lev); + cudaMemoryManager->cudaCopyMeasurePointsToHost(lev); para->copyMeasurePointsArrayToVector(lev); - output << "\n Write MeasurePoints at level = " << lev << " and timestep = " << t << "\n"; + VF_LOG_INFO("Write MeasurePoints at level = {} and timestep = {}", lev, timestep); for (int j = 0; j < (int)para->getParH(lev)->MP.size(); j++) { - MeasurePointWriter::writeMeasurePoints(para.get(), lev, j, t); + MeasurePointWriter::writeMeasurePoints(para.get(), lev, j, timestep); } //MeasurePointWriter::calcAndWriteMeanAndFluctuations(para.get(), lev, t, para->getTStartOut()); } @@ -582,724 +628,684 @@ void Simulation::run() ////////////////////////////////////////////////////////////////////////////////// ////get concentration at the plane ////////////////////////////////////////////////////////////////////////////////// - if (para->getDiffOn() && para->getCalcPlaneConc()) + if (para->getDiffOn() && para->getCalcPlaneConc()) { PlaneConcThS27( para->getParD(0)->ConcPlaneIn, - para->getParD(0)->cpTopIndex, - para->getParD(0)->numberOfPointsCpTop, - para->getParD(0)->geoSP, - para->getParD(0)->neighborX_SP, - para->getParD(0)->neighborY_SP, - para->getParD(0)->neighborZ_SP, - para->getParD(0)->size_Mat_SP, - para->getParD(0)->numberofthreads, - para->getParD(0)->d27.f[0], - para->getParD(0)->evenOrOdd); - getLastCudaError("PlaneConcThS27 execution failed"); + para->getParD(0)->cpTopIndex, + para->getParD(0)->numberOfPointsCpTop, + para->getParD(0)->typeOfGridNode, + para->getParD(0)->neighborX, + para->getParD(0)->neighborY, + para->getParD(0)->neighborZ, + para->getParD(0)->numberOfNodes, + para->getParD(0)->numberofthreads, + para->getParD(0)->distributionsAD27.f[0], + para->getParD(0)->isEvenTimestep); + getLastCudaError("PlaneConcThS27 execution failed"); PlaneConcThS27( para->getParD(0)->ConcPlaneOut1, - para->getParD(0)->cpBottomIndex, - para->getParD(0)->numberOfPointsCpBottom, - para->getParD(0)->geoSP, - para->getParD(0)->neighborX_SP, - para->getParD(0)->neighborY_SP, - para->getParD(0)->neighborZ_SP, - para->getParD(0)->size_Mat_SP, - para->getParD(0)->numberofthreads, - para->getParD(0)->d27.f[0], - para->getParD(0)->evenOrOdd); - getLastCudaError("PlaneConcThS27 execution failed"); + para->getParD(0)->cpBottomIndex, + para->getParD(0)->numberOfPointsCpBottom, + para->getParD(0)->typeOfGridNode, + para->getParD(0)->neighborX, + para->getParD(0)->neighborY, + para->getParD(0)->neighborZ, + para->getParD(0)->numberOfNodes, + para->getParD(0)->numberofthreads, + para->getParD(0)->distributionsAD27.f[0], + para->getParD(0)->isEvenTimestep); + getLastCudaError("PlaneConcThS27 execution failed"); PlaneConcThS27( para->getParD(0)->ConcPlaneOut2, - para->getParD(0)->QPress.kN, - para->getParD(0)->QPress.kQ, - para->getParD(0)->geoSP, - para->getParD(0)->neighborX_SP, - para->getParD(0)->neighborY_SP, - para->getParD(0)->neighborZ_SP, - para->getParD(0)->size_Mat_SP, - para->getParD(0)->numberofthreads, - para->getParD(0)->d27.f[0], - para->getParD(0)->evenOrOdd); - getLastCudaError("PlaneConcThS27 execution failed"); + para->getParD(0)->pressureBC.kN, + para->getParD(0)->pressureBC.numberOfBCnodes, + para->getParD(0)->typeOfGridNode, + para->getParD(0)->neighborX, + para->getParD(0)->neighborY, + para->getParD(0)->neighborZ, + para->getParD(0)->numberOfNodes, + para->getParD(0)->numberofthreads, + para->getParD(0)->distributionsAD27.f[0], + para->getParD(0)->isEvenTimestep); + getLastCudaError("PlaneConcThS27 execution failed"); ////////////////////////////////////////////////////////////////////////////////// ////Calculation of concentration at the plane ////////////////////////////////////////////////////////////////////////////////// - calcPlaneConc(para.get(), cudaManager.get(), 0); + calcPlaneConc(para.get(), cudaMemoryManager.get(), 0); } ////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// // File IO //////////////////////////////////////////////////////////////////////////////// //communicator->startTimer(); - if(para->getTOut()>0 && t%para->getTOut()==0 && t>para->getTStartOut()) + if(para->getTimestepOut()>0 && timestep%para->getTimestepOut()==0 && timestep>para->getTimestepStartOut()) { - ////////////////////////////////////////////////////////////////////////////////// - //if (para->getParD(0)->evenOrOdd==true) para->getParD(0)->evenOrOdd=false; - //else para->getParD(0)->evenOrOdd=true; - ////////////////////////////////////////////////////////////////////////////////// - - - ////////////////////////////////////////////////////////////////////////// - //Timer SDK - checkCudaErrors(cudaDeviceSynchronize()); - sdkStopTimer(&sdkTimer); - timerS = sdkGetTimerValue(&sdkTimer); - sdkResetTimer(&sdkTimer); - ftimeS += timerS; - fnups = 0.0; - durchsatz = 0.0; - for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) - { - fnups += 1000.0 * (t-para->getTStart()) * para->getParH(lev)->size_Mat_SP * pow(2.,lev) / (ftimeS*1.0E6); - durchsatz += (27.0+1.0) * 4.0 * 1000.0 * (t-para->getTStart()) * para->getParH(lev)->size_Mat_SP / (ftimeS*1.0E9); - } - output << timerS << " / " << ftimeS << " \t " << fnups << " \t " << durchsatz << "\n"; - ////////////////////////////////////////////////////////////////////////// - //Timer Event - checkCudaErrors( cudaEventRecord(stop_t)); - checkCudaErrors( cudaEventSynchronize(stop_t)); - checkCudaErrors( cudaEventElapsedTime( &timerE, start_t, stop_t)); - ftimeE += timerE; - fnups = 0.0; - durchsatz = 0.0; - for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) - { - fnups += 1000.0 * (t-para->getTStart()) * para->getParH(lev)->size_Mat_SP * pow(2.,lev) / (ftimeE*1.0E6); - durchsatz += (27.0+1.0) * 4.0 * 1000.0 * (t-para->getTStart()) * para->getParH(lev)->size_Mat_SP / (ftimeE*1.0E9); - } - output << timerE << " / " << ftimeE << " \t " << fnups << " \t " << durchsatz << "\n"; + ////////////////////////////////////////////////////////////////////////////////// + //if (para->getParD(0)->evenOrOdd==true) para->getParD(0)->evenOrOdd=false; + //else para->getParD(0)->evenOrOdd=true; + ////////////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + averageTimer->stopTimer(); + averageTimer->outputPerformance(timestep, para.get(), communicator); + ////////////////////////////////////////////////////////////////////////// if( para->getPrintFiles() ) { - output << "Dateien schreiben t=" << t << "..."; + VF_LOG_INFO("Write files t = {} ...", timestep); for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) { - ////////////////////////////////////////////////////////////////////////// - //exchange data for valid post process - exchangeMultiGPU(para.get(), communicator, cudaManager.get(), lev); + ////////////////////////////////////////////////////////////////////////// + //exchange data for valid post process + updateGrid27->exchangeData(lev); ////////////////////////////////////////////////////////////////////////// //if (para->getD3Qxx()==19) //{ - //CalcMac(para->getParD(lev)->vx, para->getParD(lev)->vy, para->getParD(lev)->vz, para->getParD(lev)->rho, - // para->getParD(lev)->geo, para->getParD(lev)->size_Mat, para->getParD(lev)->gridNX, para->getParD(lev)->gridNY, + //CalcMac(para->getParD(lev)->vx, para->getParD(lev)->vy, para->getParD(lev)->vz, para->getParD(lev)->rho, + // para->getParD(lev)->geo, para->getParD(lev)->size_Mat, para->getParD(lev)->gridNX, para->getParD(lev)->gridNY, // para->getParD(lev)->gridNZ, para->getParD(lev)->d0.f[0], para->getParD(lev)->evenOrOdd); //} //else if (para->getD3Qxx()==27) //{ - //if (para->getCalcMedian() && ((int)t > para->getTimeCalcMedStart()) && ((int)t <= para->getTimeCalcMedEnd())) - //{ - // unsigned int tdiff = t - t_prev; - // CalcMacMedSP27(para->getParD(lev)->vx_SP_Med, - // para->getParD(lev)->vy_SP_Med, - // para->getParD(lev)->vz_SP_Med, - // para->getParD(lev)->rho_SP_Med, - // para->getParD(lev)->press_SP_Med, - // para->getParD(lev)->geoSP, - // para->getParD(lev)->neighborX_SP, - // para->getParD(lev)->neighborY_SP, - // para->getParD(lev)->neighborZ_SP, - // tdiff, - // para->getParD(lev)->size_Mat_SP, - // para->getParD(lev)->numberofthreads, - // para->getParD(lev)->evenOrOdd); - // getLastCudaError("CalcMacMedSP27 execution failed"); - //} - - //CalcMacSP27(para->getParD(lev)->vx_SP, - // para->getParD(lev)->vy_SP, - // para->getParD(lev)->vz_SP, - // para->getParD(lev)->rho_SP, - // para->getParD(lev)->press_SP, - // para->getParD(lev)->geoSP, - // para->getParD(lev)->neighborX_SP, - // para->getParD(lev)->neighborY_SP, + //if (para->getCalcMedian() && ((int)t > para->getTimeCalcMedStart()) && ((int)t <= para->getTimeCalcMedEnd())) + //{ + // unsigned int tdiff = t - t_prev; + // CalcMacMedSP27(para->getParD(lev)->vx_SP_Med, + // para->getParD(lev)->vy_SP_Med, + // para->getParD(lev)->vz_SP_Med, + // para->getParD(lev)->rho_SP_Med, + // para->getParD(lev)->press_SP_Med, + // para->getParD(lev)->geoSP, + // para->getParD(lev)->neighborX_SP, + // para->getParD(lev)->neighborY_SP, + // para->getParD(lev)->neighborZ_SP, + // tdiff, + // para->getParD(lev)->size_Mat_SP, + // para->getParD(lev)->numberofthreads, + // para->getParD(lev)->evenOrOdd); + // getLastCudaError("CalcMacMedSP27 execution failed"); + //} + + //CalcMacSP27(para->getParD(lev)->vx_SP, + // para->getParD(lev)->vy_SP, + // para->getParD(lev)->vz_SP, + // para->getParD(lev)->rho, + // para->getParD(lev)->pressure, + // para->getParD(lev)->geoSP, + // para->getParD(lev)->neighborX_SP, + // para->getParD(lev)->neighborY_SP, // para->getParD(lev)->neighborZ_SP, - // para->getParD(lev)->size_Mat_SP, - // para->getParD(lev)->numberofthreads, - // para->getParD(lev)->d0SP.f[0], + // para->getParD(lev)->size_Mat_SP, + // para->getParD(lev)->numberofthreads, + // para->getParD(lev)->d0SP.f[0], // para->getParD(lev)->evenOrOdd); - // getLastCudaError("CalcMacSP27 execution failed"); - - - CalcMacCompSP27(para->getParD(lev)->vx_SP, - para->getParD(lev)->vy_SP, - para->getParD(lev)->vz_SP, - para->getParD(lev)->rho_SP, - para->getParD(lev)->press_SP, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->numberofthreads, - para->getParD(lev)->d0SP.f[0], - para->getParD(lev)->evenOrOdd); - getLastCudaError("CalcMacSP27 execution failed"); - - //�berschreiben mit Wandknoten - //SetOutputWallVelocitySP27( para->getParD(lev)->numberofthreads, - // para->getParD(lev)->vx_SP, - // para->getParD(lev)->vy_SP, - // para->getParD(lev)->vz_SP, - // para->getParD(lev)->QGeom.Vx, - // para->getParD(lev)->QGeom.Vy, - // para->getParD(lev)->QGeom.Vz, - // para->getParD(lev)->QGeom.kQ, - // para->getParD(lev)->QGeom.k, - // para->getParD(lev)->rho_SP, - // para->getParD(lev)->press_SP, - // para->getParD(lev)->geoSP, - // para->getParD(lev)->neighborX_SP, - // para->getParD(lev)->neighborY_SP, - // para->getParD(lev)->neighborZ_SP, - // para->getParD(lev)->size_Mat_SP, - // para->getParD(lev)->d0SP.f[0], - // para->getParD(lev)->evenOrOdd); - // getLastCudaError("SetOutputWallVelocitySP27 execution failed"); - - //SetOutputWallVelocitySP27( para->getParD(lev)->numberofthreads, - // para->getParD(lev)->vx_SP, - // para->getParD(lev)->vy_SP, - // para->getParD(lev)->vz_SP, - // para->getParD(lev)->Qinflow.Vx, - // para->getParD(lev)->Qinflow.Vy, - // para->getParD(lev)->Qinflow.Vz, - // para->getParD(lev)->kInflowQ, - // para->getParD(lev)->Qinflow.k, - // para->getParD(lev)->rho_SP, - // para->getParD(lev)->press_SP, - // para->getParD(lev)->geoSP, - // para->getParD(lev)->neighborX_SP, - // para->getParD(lev)->neighborY_SP, - // para->getParD(lev)->neighborZ_SP, - // para->getParD(lev)->size_Mat_SP, - // para->getParD(lev)->d0SP.f[0], - // para->getParD(lev)->evenOrOdd); - // getLastCudaError("SetOutputWallVelocitySP27 execution failed"); - - //} - - cudaManager->cudaCopyPrint(lev); - if (para->getCalcMedian()) - { - cudaManager->cudaCopyMedianPrint(lev); - } - - ////////////////////////////////////////////////////////////////////////// + // getLastCudaError("CalcMacSP27 execution failed"); + + + CalcMacCompSP27(para->getParD(lev)->velocityX, + para->getParD(lev)->velocityY, + para->getParD(lev)->velocityZ, + para->getParD(lev)->rho, + para->getParD(lev)->pressure, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, + para->getParD(lev)->numberofthreads, + para->getParD(lev)->distributions.f[0], + para->getParD(lev)->isEvenTimestep); + getLastCudaError("CalcMacSP27 execution failed"); + + // // overwrite with wall nodes + // SetOutputWallVelocitySP27( para->getParD(lev)->numberofthreads, + // para->getParD(lev)->velocityX, + // para->getParD(lev)->velocityY, + // para->getParD(lev)->velocityZ, + // para->getParD(lev)->geometryBC.Vx, + // para->getParD(lev)->geometryBC.Vy, + // para->getParD(lev)->geometryBC.Vz, + // para->getParD(lev)->geometryBC.numberOfBCnodes, + // para->getParD(lev)->geometryBC.k, + // para->getParD(lev)->rho, + // para->getParD(lev)->pressure, + // para->getParD(lev)->typeOfGridNode, + // para->getParD(lev)->neighborX, + // para->getParD(lev)->neighborY, + // para->getParD(lev)->neighborZ, + // para->getParD(lev)->size_Mat, + // para->getParD(lev)->distributions.f[0], + // para->getParD(lev)->isEvenTimestep); + // getLastCudaError("SetOutputWallVelocitySP27 execution failed"); + + // SetOutputWallVelocitySP27( para->getParD(lev)->numberofthreads, + // para->getParD(lev)->velocityX, + // para->getParD(lev)->velocityY, + // para->getParD(lev)->velocityZ, + // para->getParD(lev)->velocityBC.Vx, + // para->getParD(lev)->velocityBC.Vy, + // para->getParD(lev)->velocityBC.Vz, + // para->getParD(lev)->velocityBC.numberOfBCnodes, + // para->getParD(lev)->velocityBC.k, + // para->getParD(lev)->rho, + // para->getParD(lev)->pressure, + // para->getParD(lev)->typeOfGridNode, + // para->getParD(lev)->neighborX, + // para->getParD(lev)->neighborY, + // para->getParD(lev)->neighborZ, + // para->getParD(lev)->size_Mat, + // para->getParD(lev)->distributions.f[0], + // para->getParD(lev)->isEvenTimestep); + // getLastCudaError("SetOutputWallVelocitySP27 execution failed"); + + //} + + cudaMemoryManager->cudaCopyPrint(lev); + if (para->getCalcMedian()) + { + cudaMemoryManager->cudaCopyMedianPrint(lev); + } + + ////////////////////////////////////////////////////////////////////////// //TODO: implement flag to write ASCII data - if (para->getWriteVeloASCIIfiles()) - VeloASCIIWriter::writeVelocitiesAsTXT(para.get(), lev, t); - ////////////////////////////////////////////////////////////////////////// + if (para->getWriteVeloASCIIfiles()) + VeloASCIIWriter::writeVelocitiesAsTXT(para.get(), lev, timestep); + ////////////////////////////////////////////////////////////////////////// if( this->kineticEnergyAnalyzer || this->enstrophyAnalyzer ) { - std::string fname = para->getFName() + "_ID_" + StringUtil::toString<int>(para->getMyID()) + "_t_" + StringUtil::toString<int>(t); + std::string fname = para->getFName() + "_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + "_t_" + StringUtil::toString<int>(timestep); if (this->kineticEnergyAnalyzer) this->kineticEnergyAnalyzer->writeToFile(fname); if (this->enstrophyAnalyzer) this->enstrophyAnalyzer->writeToFile(fname); } - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (para->getDiffOn()==true) { if (para->getDiffMod() == 7) { - CalcMacThS7( para->getParD(lev)->Conc, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->numberofthreads, - para->getParD(lev)->d7.f[0], - para->getParD(lev)->evenOrOdd); - getLastCudaError("CalcMacTh7 execution failed"); - } + CalcMacThS7( para->getParD(lev)->Conc, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, + para->getParD(lev)->numberofthreads, + para->getParD(lev)->distributionsAD7.f[0], + para->getParD(lev)->isEvenTimestep); + getLastCudaError("CalcMacTh7 execution failed"); + } else if (para->getDiffMod() == 27) { - CalcMacThS27( para->getParD(lev)->Conc, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->numberofthreads, - para->getParD(lev)->d27.f[0], - para->getParD(lev)->evenOrOdd); - getLastCudaError("CalcMacTh27 execution failed"); + CalcConcentration27( + para->getParD(lev)->numberofthreads, + para->getParD(lev)->Conc, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, + para->getParD(lev)->distributionsAD27.f[0], + para->getParD(lev)->isEvenTimestep); } - cudaManager->cudaCopyConcDH(lev); + cudaMemoryManager->cudaCopyConcentrationDeviceToHost(lev); //cudaMemoryCopy(para->getParH(lev)->Conc, para->getParD(lev)->Conc, para->getParH(lev)->mem_size_real_SP , cudaMemcpyDeviceToHost); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////print cp - //if ((para->getParH(lev)->cpTop.size() > 0) && (t > para->getTStartOut())) - //{ - // printCpTopIntermediateStep(para, t, lev); - //} - //////////////////////////////////////////////////////////////////////////////// - //MeasurePointWriter::writeSpacialAverageForXZSlices(para, lev, t); - //////////////////////////////////////////////////////////////////////////////// - //MeasurePointWriter::writeTestAcousticXY(para, lev, t); - //MeasurePointWriter::writeTestAcousticYZ(para, lev, t); - //MeasurePointWriter::writeTestAcousticXZ(para, lev, t); - //////////////////////////////////////////////////////////////////////// - } - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////test print press mirror - //if (t > para->getTStartOut()) - //{ - // //////////////////////////////////////////////////////////////////////////////// - // //Level 7 - // CalcCPtop27(para->getParD(7)->d0SP.f[0], - // para->getParD(7)->cpTopIndex, - // para->getParD(7)->numberOfPointsCpTop, - // para->getParD(7)->cpPressTop, - // para->getParD(7)->neighborX_SP, - // para->getParD(7)->neighborY_SP, - // para->getParD(7)->neighborZ_SP, - // para->getParD(7)->size_Mat_SP, - // para->getParD(7)->evenOrOdd, - // para->getParD(7)->numberofthreads); - // ////////////////////////////////////////////////////////////////////////////////// - // calcPressForMirror(para, 7); - // //////////////////////////////////////////////////////////////////////////////// - // //Level 8 - // CalcCPtop27(para->getParD(8)->d0SP.f[0], - // para->getParD(8)->cpTopIndex, - // para->getParD(8)->numberOfPointsCpTop, - // para->getParD(8)->cpPressTop, - // para->getParD(8)->neighborX_SP, - // para->getParD(8)->neighborY_SP, - // para->getParD(8)->neighborZ_SP, - // para->getParD(8)->size_Mat_SP, - // para->getParD(8)->evenOrOdd, - // para->getParD(8)->numberofthreads); - // ////////////////////////////////////////////////////////////////////////////////// - // calcPressForMirror(para, 8); - // //////////////////////////////////////////////////////////////////////////////// - // //print press mirror - // printScalars(para, false); - // //////////////////////////////////////////////////////////////////////////////// - //} - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //t_prev = t; - - ////////////////////////////////////////////////////////////////////////// - ////Data Analysis - ////AnalysisData::writeAnalysisData(para, t); - //AnalysisData::writeAnalysisDataX(para, t); - //AnalysisData::writeAnalysisDataZ(para, t); - ////////////////////////////////////////////////////////////////////////// + ////print cp + //if ((para->getParH(lev)->cpTop.size() > 0) && (t > para->getTStartOut())) + //{ + // printCpTopIntermediateStep(para, t, lev); + //} + //////////////////////////////////////////////////////////////////////////////// + //MeasurePointWriter::writeSpacialAverageForXZSlices(para, lev, t); + //////////////////////////////////////////////////////////////////////////////// + //MeasurePointWriter::writeTestAcousticXY(para, lev, t); + //MeasurePointWriter::writeTestAcousticYZ(para, lev, t); + //MeasurePointWriter::writeTestAcousticXZ(para, lev, t); + //////////////////////////////////////////////////////////////////////// + } + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////test print press mirror + //if (t > para->getTStartOut()) + //{ + // //////////////////////////////////////////////////////////////////////////////// + // //Level 7 + // CalcCPtop27(para->getParD(7)->d0SP.f[0], + // para->getParD(7)->cpTopIndex, + // para->getParD(7)->numberOfPointsCpTop, + // para->getParD(7)->cpPressTop, + // para->getParD(7)->neighborX_SP, + // para->getParD(7)->neighborY_SP, + // para->getParD(7)->neighborZ_SP, + // para->getParD(7)->size_Mat_SP, + // para->getParD(7)->evenOrOdd, + // para->getParD(7)->numberofthreads); + // ////////////////////////////////////////////////////////////////////////////////// + // calcPressForMirror(para, 7); + // //////////////////////////////////////////////////////////////////////////////// + // //Level 8 + // CalcCPtop27(para->getParD(8)->d0SP.f[0], + // para->getParD(8)->cpTopIndex, + // para->getParD(8)->numberOfPointsCpTop, + // para->getParD(8)->cpPressTop, + // para->getParD(8)->neighborX_SP, + // para->getParD(8)->neighborY_SP, + // para->getParD(8)->neighborZ_SP, + // para->getParD(8)->size_Mat_SP, + // para->getParD(8)->evenOrOdd, + // para->getParD(8)->numberofthreads); + // ////////////////////////////////////////////////////////////////////////////////// + // calcPressForMirror(para, 8); + // //////////////////////////////////////////////////////////////////////////////// + // //print press mirror + // printScalars(para, false); + // //////////////////////////////////////////////////////////////////////////////// + //} + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + //t_prev = t; + + ////////////////////////////////////////////////////////////////////////// + ////Data Analysis + ////AnalysisData::writeAnalysisData(para, t); + //AnalysisData::writeAnalysisDataX(para, t); + //AnalysisData::writeAnalysisDataZ(para, t); + ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //pressure difference //////////////////////////////////////////////////////////////////////// - //if (para->getMyID() == para->getPressInID()) calcPressure(para, "in", 0); - //else if (para->getMyID() == para->getPressOutID()) calcPressure(para, "out", 0); + //if (para->getMyID() == para->getPressInID()) calcPressure(para, "in", 0); + //else if (para->getMyID() == para->getPressOutID()) calcPressure(para, "out", 0); //////////////////////////////////////////////////////////////////////// //flow rate //////////////////////////////////////////////////////////////////////// - //calcFlowRate(para, 0); + //calcFlowRate(para, 0); + //////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////// + //calculate 2nd, 3rd and higher order moments + //////////////////////////////////////////////////////////////////////// + if (para->getCalc2ndOrderMoments()) calc2ndMoments(para.get(), cudaMemoryManager.get()); + if (para->getCalc3rdOrderMoments()) calc3rdMoments(para.get(), cudaMemoryManager.get()); + if (para->getCalcHighOrderMoments()) calcHigherOrderMoments(para.get(), cudaMemoryManager.get()); //////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////// - //calculate 2nd, 3rd and higher order moments - //////////////////////////////////////////////////////////////////////// - if (para->getCalc2ndOrderMoments()) calc2ndMoments(para.get(), cudaManager.get()); - if (para->getCalc3rdOrderMoments()) calc3rdMoments(para.get(), cudaManager.get()); - if (para->getCalcHighOrderMoments()) calcHigherOrderMoments(para.get(), cudaManager.get()); - //////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////// - //calculate median on host - //////////////////////////////////////////////////////////////////////// - if (para->getCalcMedian() && ((int)t > para->getTimeCalcMedStart()) && ((int)t <= para->getTimeCalcMedEnd()) && ((t%(unsigned int)para->getclockCycleForMP())==0)) - { - unsigned int tdiff = t - t_prev; - calcMedian(para.get(), tdiff); - - ///////////////////////////////// - //added for incremental averaging - t_prev = t; - resetMedian(para.get()); - ///////////////////////////////// - } - //////////////////////////////////////////////////////////////////////// - dataWriter->writeTimestep(para, t); - //////////////////////////////////////////////////////////////////////// - if (para->getCalcDragLift()) printDragLift(para.get(), cudaManager.get(), t); - //////////////////////////////////////////////////////////////////////// - if (para->getCalcParticle()) copyAndPrintParticles(para.get(), cudaManager.get(), t, false); - //////////////////////////////////////////////////////////////////////// - output << "done.\n"; - //////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////// + //calculate median on host + //////////////////////////////////////////////////////////////////////// + if (para->getCalcMedian() && ((int)timestep > para->getTimeCalcMedStart()) && ((int)timestep <= para->getTimeCalcMedEnd()) && ((timestep%(unsigned int)para->getclockCycleForMP())==0)) + { + unsigned int tdiff = timestep - t_prev; + calcMedian(para.get(), tdiff); + + ///////////////////////////////// + //added for incremental averaging + t_prev = timestep; + resetMedian(para.get()); + ///////////////////////////////// + } + if (para->getCalcTurbulenceIntensity()) + { + uint t_diff = timestep - t_turbulenceIntensity; + calcTurbulenceIntensity(para.get(), cudaMemoryManager.get(), t_diff); + //writeAllTiDatafToFile(para.get(), t); + } + //////////////////////////////////////////////////////////////////////// + dataWriter->writeTimestep(para, timestep); + //////////////////////////////////////////////////////////////////////// + if (para->getCalcTurbulenceIntensity()) { + t_turbulenceIntensity = timestep; + resetVelocityFluctuationsAndMeans(para.get(), cudaMemoryManager.get()); + } + //////////////////////////////////////////////////////////////////////// + if (para->getCalcDragLift()) printDragLift(para.get(), cudaMemoryManager.get(), timestep); + //////////////////////////////////////////////////////////////////////// + if (para->getCalcParticles()) copyAndPrintParticles(para.get(), cudaMemoryManager.get(), timestep, false); + //////////////////////////////////////////////////////////////////////// + VF_LOG_INFO("... done"); + //////////////////////////////////////////////////////////////////////// } - sdkStartTimer(&sdkTimer); - checkCudaErrors( cudaEventRecord(start_t)); + + //////////////////////////////////////////////////////////////////////// + averageTimer->startTimer(); } - } - - - ////////////////////////////////////////////////////////////////////////// - //Timer SDK - sdkStopTimer(&sdkTimer); - timerS = sdkGetTimerValue(&sdkTimer); - ftimeS += timerS; - fnups = 0.0; - durchsatz = 0.0; - for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) - { - fnups += 1000.0 * (t-para->getTStart()) * para->getParH(lev)->size_Mat_SP * pow(2.,lev) / (ftimeS*1.0E6); - durchsatz += (27.0+1.0) * 4.0 * 1000.0 * (t-para->getTStart()) * para->getParH(lev)->size_Mat_SP / (ftimeS*1.0E9); - } - output << "Processing time: " << ftimeS << "(ms)\n"; - output << "Nups in Mio: " << fnups << "\n"; - output << "Durchsatz in GB/sec: " << durchsatz << "\n"; - ////////////////////////////////////////////////////////////////////////// - //Timer Event - checkCudaErrors( cudaEventRecord(stop_t)); - checkCudaErrors( cudaEventSynchronize(stop_t)); - checkCudaErrors( cudaEventElapsedTime( &timerE, start_t, stop_t )); - ftimeE += timerE; - fnups = 0.0; - durchsatz = 0.0; - for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) - { - fnups += 1000.0 * (t-para->getTStart()) * para->getParH(lev)->size_Mat_SP * pow(2.,lev) / (ftimeE*1.0E6); - durchsatz += (27.0+1.0) * 4.0 * 1000.0 * (t-para->getTStart()) * para->getParH(lev)->size_Mat_SP / (ftimeE*1.0E9); } - output << "Processing time: " << ftimeE << "(ms)\n"; - output << "Nups in Mio: " << fnups << "\n"; - output << "Durchsatz in GB/sec: " << durchsatz << "\n"; - ////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////// - //printDragLift(para); - //////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////// - if (para->getDiffOn()==true) printPlaneConc(para.get(), cudaManager.get()); - //////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////// - ////for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) - ////{ - //// if (para->getParH(lev)->cpTop.size() > 0) - //// { - //// printCpTop(para, lev); - //// } - ////} - //for (int lev = 7; lev <= 8; lev++) - //{ - // printCpTop(para, lev); - //} - ////printCpTop(para); - ////printCpBottom(para); - ////printCpBottom2(para); - //////////////////////////////////////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////// + //printDragLift(para); + //////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////// + if (para->getDiffOn()==true) printPlaneConc(para.get(), cudaMemoryManager.get()); + //////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////// + ////for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) + ////{ + //// if (para->getParH(lev)->cpTop.size() > 0) + //// { + //// printCpTop(para, lev); + //// } + ////} + //for (int lev = 7; lev <= 8; lev++) + //{ + // printCpTop(para, lev); + //} + ////printCpTop(para); + ////printCpBottom(para); + ////printCpBottom2(para); + //////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////// // //Copy Measure Values - //for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) - //{ - // output << "\n Copy MeasurePoints at level = " << lev <<"\n"; - // para->cudaCopyMeasurePointsToHost(lev); - // para->copyMeasurePointsArrayToVector(lev); - // output << "\n Write MeasurePoints at level = " << lev <<"\n"; - // for(int j = 0; j < (int)para->getParH(lev)->MP.size(); j++) - // { - // MeasurePointWriter::writeMeasurePoints(para, lev, j, 0); - // } - //} + //for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) + //{ + // VF_LOG_INFO("Copy MeasurePoints at level = {}", lev); + // para->cudaCopyMeasurePointsToHost(lev); + // para->copyMeasurePointsArrayToVector(lev); + // VF_LOG_INFO("Write MeasurePoints at level = {}", lev); + // for(int j = 0; j < (int)para->getParH(lev)->MP.size(); j++) + // { + // MeasurePointWriter::writeMeasurePoints(para, lev, j, 0); + // } + //} // ////////////////////////////////////////////////////////////////////////// - - checkCudaErrors(cudaEventDestroy(start_t)); - checkCudaErrors(cudaEventDestroy(stop_t)); - sdkDeleteTimer(&sdkTimer); } void Simulation::porousMedia() { - double porosity, darcySI, forchheimerSI; - double dxLBM = 0.00390625; - double dtLBM = 0.00000658; - unsigned int level, geo; - double startX, startY, startZ, endX, endY, endZ; - ////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////// - ////Test = porous media 0 - //porosity = 0.7; - //darcySI = 137.36; //[1/s] - //forchheimerSI = 1037.8; //[1/m] - //level = para->getFine(); - //geo = GEO_PM_0; - //startX = 20.0; - //startY = 0.0; - //startZ = 0.0; - //endX = 40.0; - //endY = 22.0; - //endZ = 22.0; - //pm[0] = new PorousMedia(porosity, geo, darcySI, forchheimerSI, dxLBM, dtLBM, level); - //pm[0]->setStartCoordinates(startX, startY, startZ); - //pm[0]->setEndCoordinates(endX, endY, endZ); - //pm[0]->setResistanceLBM(); - //definePMarea(pm[0]); - //////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - //Kondensator = porous media 0 - porosity = 0.7; - darcySI = 137.36; //[1/s] - forchheimerSI = 1037.8; //[1/m] - level = para->getFine(); - geo = GEO_PM_0; - startX = -0.715882; - startY = -0.260942; - startZ = -0.031321; - endX = -0.692484; - endY = 0.277833; - endZ = 0.360379; - pm.push_back(std::shared_ptr<PorousMedia>(new PorousMedia(porosity, geo, darcySI, forchheimerSI, dxLBM, dtLBM, level))); - int n = (int)pm.size() - 1; - pm.at(n)->setStartCoordinates(startX, startY, startZ); - pm.at(n)->setEndCoordinates(endX, endY, endZ); - pm.at(n)->setResistanceLBM(); - definePMarea(pm.at(n)); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - //NT-Kuehler = porous media 1 - porosity = 0.6; - darcySI = 149.98; //[1/s] - forchheimerSI = 960.57; //[1/m] - level = para->getFine(); - geo = GEO_PM_1; - startX = -0.696146; - startY = -0.32426; - startZ = -0.0421345; - endX = -0.651847; - endY = 0.324822; - endZ = 0.057098; - pm.push_back(std::shared_ptr<PorousMedia>(new PorousMedia(porosity, geo, darcySI, forchheimerSI, dxLBM, dtLBM, level))); - n = (int)pm.size() - 1; - pm.at(n)->setStartCoordinates(startX, startY, startZ); - pm.at(n)->setEndCoordinates(endX, endY, endZ); - pm.at(n)->setResistanceLBM(); - definePMarea(pm.at(n)); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - //Wasserkuehler = porous media 2 - porosity = 0.6; - darcySI = 148.69; //[1/s] - forchheimerSI = 629.45; //[1/m] - level = para->getFine(); - geo = GEO_PM_2; - startX = -0.692681; - startY = -0.324954; - startZ = 0.0789429; - endX = -0.657262; - endY = 0.32538; - endZ = 0.400974; - pm.push_back(std::shared_ptr<PorousMedia>(new PorousMedia(porosity, geo, darcySI, forchheimerSI, dxLBM, dtLBM, level))); - n = (int)pm.size() - 1; - pm.at(n)->setStartCoordinates(startX, startY, startZ); - pm.at(n)->setEndCoordinates(endX, endY, endZ); - pm.at(n)->setResistanceLBM(); - definePMarea(pm.at(n)); - ////////////////////////////////////////////////////////////////////////// + double porosity, darcySI, forchheimerSI; + double dxLBM = 0.00390625; + double dtLBM = 0.00000658; + unsigned int level, geo; + double startX, startY, startZ, endX, endY, endZ; + ////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////// + ////Test = porous media 0 + //porosity = 0.7; + //darcySI = 137.36; //[1/s] + //forchheimerSI = 1037.8; //[1/m] + //level = para->getFine(); + //geo = GEO_PM_0; + //startX = 20.0; + //startY = 0.0; + //startZ = 0.0; + //endX = 40.0; + //endY = 22.0; + //endZ = 22.0; + //pm[0] = new PorousMedia(porosity, geo, darcySI, forchheimerSI, dxLBM, dtLBM, level); + //pm[0]->setStartCoordinates(startX, startY, startZ); + //pm[0]->setEndCoordinates(endX, endY, endZ); + //pm[0]->setResistanceLBM(); + //definePMarea(pm[0]); + //////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + //Kondensator = porous media 0 + porosity = 0.7; + darcySI = 137.36; //[1/s] + forchheimerSI = 1037.8; //[1/m] + level = para->getFine(); + geo = GEO_PM_0; + startX = -0.715882; + startY = -0.260942; + startZ = -0.031321; + endX = -0.692484; + endY = 0.277833; + endZ = 0.360379; + pm.push_back(std::shared_ptr<PorousMedia>(new PorousMedia(porosity, geo, darcySI, forchheimerSI, dxLBM, dtLBM, level))); + int n = (int)pm.size() - 1; + pm.at(n)->setStartCoordinates(startX, startY, startZ); + pm.at(n)->setEndCoordinates(endX, endY, endZ); + pm.at(n)->setResistanceLBM(); + definePMarea(pm.at(n)); + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + //NT-Kuehler = porous media 1 + porosity = 0.6; + darcySI = 149.98; //[1/s] + forchheimerSI = 960.57; //[1/m] + level = para->getFine(); + geo = GEO_PM_1; + startX = -0.696146; + startY = -0.32426; + startZ = -0.0421345; + endX = -0.651847; + endY = 0.324822; + endZ = 0.057098; + pm.push_back(std::shared_ptr<PorousMedia>(new PorousMedia(porosity, geo, darcySI, forchheimerSI, dxLBM, dtLBM, level))); + n = (int)pm.size() - 1; + pm.at(n)->setStartCoordinates(startX, startY, startZ); + pm.at(n)->setEndCoordinates(endX, endY, endZ); + pm.at(n)->setResistanceLBM(); + definePMarea(pm.at(n)); + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + //Wasserkuehler = porous media 2 + porosity = 0.6; + darcySI = 148.69; //[1/s] + forchheimerSI = 629.45; //[1/m] + level = para->getFine(); + geo = GEO_PM_2; + startX = -0.692681; + startY = -0.324954; + startZ = 0.0789429; + endX = -0.657262; + endY = 0.32538; + endZ = 0.400974; + pm.push_back(std::shared_ptr<PorousMedia>(new PorousMedia(porosity, geo, darcySI, forchheimerSI, dxLBM, dtLBM, level))); + n = (int)pm.size() - 1; + pm.at(n)->setStartCoordinates(startX, startY, startZ); + pm.at(n)->setEndCoordinates(endX, endY, endZ); + pm.at(n)->setResistanceLBM(); + definePMarea(pm.at(n)); + ////////////////////////////////////////////////////////////////////////// } -void Simulation::definePMarea(std::shared_ptr<PorousMedia> pMedia) +void Simulation::definePMarea(std::shared_ptr<PorousMedia>& pMedia) { - unsigned int counter = 0; - unsigned int level = pMedia->getLevelPM(); - std::vector< unsigned int > nodeIDsPorousMedia; - output << "definePMarea....find nodes \n"; - - for (unsigned int i = 0; i < para->getParH(level)->size_Mat_SP; i++) - { - if (((para->getParH(level)->coordX_SP[i] >= pMedia->getStartX()) && (para->getParH(level)->coordX_SP[i] <= pMedia->getEndX())) && - ((para->getParH(level)->coordY_SP[i] >= pMedia->getStartY()) && (para->getParH(level)->coordY_SP[i] <= pMedia->getEndY())) && - ((para->getParH(level)->coordZ_SP[i] >= pMedia->getStartZ()) && (para->getParH(level)->coordZ_SP[i] <= pMedia->getEndZ())) ) - { - if (para->getParH(level)->geoSP[i] >= GEO_FLUID) - { - para->getParH(level)->geoSP[i] = pMedia->getGeoID(); - nodeIDsPorousMedia.push_back(i); - counter++; - } - } - } - - output << "definePMarea....cuda copy SP \n"; - cudaManager->cudaCopySP(level); - pMedia->setSizePM(counter); - output << "definePMarea....cuda alloc PM \n"; - cudaManager->cudaAllocPorousMedia(pMedia.get(), level); - unsigned int *tpmArrayIDs = pMedia->getHostNodeIDsPM(); - - output << "definePMarea....copy vector to array \n"; - for (unsigned int j = 0; j < pMedia->getSizePM(); j++) - { - tpmArrayIDs[j] = nodeIDsPorousMedia[j]; - } - - pMedia->setHostNodeIDsPM(tpmArrayIDs); - output << "definePMarea....cuda copy PM \n"; - cudaManager->cudaCopyPorousMedia(pMedia.get(), level); + unsigned int counter = 0; + unsigned int level = pMedia->getLevelPM(); + std::vector< unsigned int > nodeIDsPorousMedia; + VF_LOG_INFO("definePMarea....find nodes"); + + for (unsigned int i = 0; i < para->getParH(level)->numberOfNodes; i++) + { + if (((para->getParH(level)->coordinateX[i] >= pMedia->getStartX()) && (para->getParH(level)->coordinateX[i] <= pMedia->getEndX())) && + ((para->getParH(level)->coordinateY[i] >= pMedia->getStartY()) && (para->getParH(level)->coordinateY[i] <= pMedia->getEndY())) && + ((para->getParH(level)->coordinateZ[i] >= pMedia->getStartZ()) && (para->getParH(level)->coordinateZ[i] <= pMedia->getEndZ())) ) + { + if (para->getParH(level)->typeOfGridNode[i] >= GEO_FLUID) + { + para->getParH(level)->typeOfGridNode[i] = pMedia->getGeoID(); + nodeIDsPorousMedia.push_back(i); + counter++; + } + } + } + + VF_LOG_INFO("definePMarea....cuda copy SP"); + cudaMemoryManager->cudaCopySP(level); + pMedia->setSizePM(counter); + VF_LOG_INFO("definePMarea....cuda alloc PM"); + cudaMemoryManager->cudaAllocPorousMedia(pMedia.get(), level); + unsigned int *tpmArrayIDs = pMedia->getHostNodeIDsPM(); + + VF_LOG_INFO("definePMarea....copy vector to array"); + for (unsigned int j = 0; j < pMedia->getSizePM(); j++) + { + tpmArrayIDs[j] = nodeIDsPorousMedia[j]; + } + + pMedia->setHostNodeIDsPM(tpmArrayIDs); + VF_LOG_INFO("definePMarea....cuda copy PM"); + cudaMemoryManager->cudaCopyPorousMedia(pMedia.get(), level); } -void Simulation::free() +Simulation::~Simulation() { - //CudaFreeHostMemory - for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) - { - //para->cudaFreeFull(lev); - cudaManager->cudaFreeCoord(lev); - cudaManager->cudaFreeSP(lev); - if (para->getCalcMedian()) - { - cudaManager->cudaFreeMedianSP(lev); - } - //para->cudaFreeVeloBC(lev); - //para->cudaFreeWallBC(lev); - //para->cudaFreeVeloBC(lev); - //para->cudaFreeInlet(lev); - //para->cudaFreeOutlet(lev); - //para->cudaFreeGeomBC(lev); - //para->cudaFreePress(lev); - } - if (para->getMaxLevel()>1) - { - for (int lev = para->getCoarse(); lev < para->getFine(); lev++) - { - cudaManager->cudaFreeInterfaceCF(lev); - cudaManager->cudaFreeInterfaceFC(lev); - cudaManager->cudaFreeInterfaceOffCF(lev); - cudaManager->cudaFreeInterfaceOffFC(lev); - //para->cudaFreePressX1(lev); - } - } - //para->cudaFreeVeloBC(0); //level = 0 - //para->cudaFreePressBC(); - //para->cudaFreeVeloPropeller(para->getFine()); - //para->cudaFreePressX0(para->getCoarse()); - - ////////////////////////////////////////////////////////////////////////// - //Temp - if (para->getDiffOn() == true) - { - for (int lev = para->getCoarse(); lev < para->getFine(); lev++) - { - checkCudaErrors(cudaFreeHost(para->getParH(lev)->Conc_Full)); - checkCudaErrors(cudaFreeHost(para->getParH(lev)->Conc)); - checkCudaErrors(cudaFreeHost(para->getParH(lev)->Temp.temp)); - checkCudaErrors(cudaFreeHost(para->getParH(lev)->Temp.k)); - checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempVel.temp)); - checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempVel.velo)); - checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempVel.k)); - checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempPress.temp)); - checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempPress.velo)); - checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempPress.k)); - } - } - ////////////////////////////////////////////////////////////////////////// - - - ////////////////////////////////////////////////////////////////////////// - //free second order moments - if (para->getCalc2ndOrderMoments()) - { - for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) - { - cudaManager->cudaFree2ndMoments(lev); - } - } - ////////////////////////////////////////////////////////////////////////// - //free third order moments - if (para->getCalc3rdOrderMoments()) - { - for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) - { - cudaManager->cudaFree3rdMoments(lev); - } - } - ////////////////////////////////////////////////////////////////////////// - //free higher order moments - if (para->getCalcHighOrderMoments()) - { - for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) - { - cudaManager->cudaFreeHigherMoments(lev); - } - } - ////////////////////////////////////////////////////////////////////////// - - - ////////////////////////////////////////////////////////////////////////// - //Multi GPU - ////////////////////////////////////////////////////////////////////////// - ////1D domain decomposition - //if (para->getNumprocs() > 1) - //{ - // for (int lev=para->getCoarse(); lev < para->getFine(); lev++) - // { - // for (unsigned int i=0; i < para->getNumberOfProcessNeighbors(lev, "send"); i++) - // { - // para->cudaFreeProcessNeighbor(lev, i); - // } - // } - //} - ////////////////////////////////////////////////////////////////////////// - //3D domain decomposition - if (para->getNumprocs() > 1) - { - for (int lev = para->getCoarse(); lev < para->getFine(); lev++) - { - ////////////////////////////////////////////////////////////////////////// - for (unsigned int i = 0; i < para->getNumberOfProcessNeighborsX(lev, "send"); i++) - { - cudaManager->cudaFreeProcessNeighborX(lev, i); - } - ////////////////////////////////////////////////////////////////////////// - for (unsigned int i = 0; i < para->getNumberOfProcessNeighborsY(lev, "send"); i++) - { - cudaManager->cudaFreeProcessNeighborY(lev, i); - } - ////////////////////////////////////////////////////////////////////////// - for (unsigned int i = 0; i < para->getNumberOfProcessNeighborsZ(lev, "send"); i++) - { - cudaManager->cudaFreeProcessNeighborZ(lev, i); - } - } - } - ////////////////////////////////////////////////////////////////////////// - //Normals - if (para->getIsGeoNormal()) { - for (int lev = para->getCoarse(); lev < para->getFine(); lev++) - { - cudaManager->cudaFreeGeomNormals(lev); - } - } - ////////////////////////////////////////////////////////////////////////// - //PreCollisionInteractors - for( SPtr<PreCollisionInteractor> actuator: para->getActuators()){ - actuator->free(para.get(), cudaManager.get()); - } - - for( SPtr<PreCollisionInteractor> probe: para->getProbes()){ - probe->free(para.get(), cudaManager.get()); - } - ////////////////////////////////////////////////////////////////////////// + // Cuda Streams + if (para->getUseStreams()) { + para->getStreamManager()->destroyCudaEvents(); + para->getStreamManager()->terminateStreams(); + } + + //CudaFreeHostMemory + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) + { + //para->cudaFreeFull(lev); + cudaMemoryManager->cudaFreeCoord(lev); + cudaMemoryManager->cudaFreeSP(lev); + if (para->getCalcMedian()) + { + cudaMemoryManager->cudaFreeMedianSP(lev); + } + //para->cudaFreeVeloBC(lev); + //para->cudaFreeWallBC(lev); + //para->cudaFreeVeloBC(lev); + //para->cudaFreeInlet(lev); + //para->cudaFreeOutlet(lev); + //para->cudaFreeGeomBC(lev); + //para->cudaFreePress(lev); + } + if (para->getMaxLevel()>1) + { + for (int lev = para->getCoarse(); lev < para->getFine(); lev++) + { + cudaMemoryManager->cudaFreeInterfaceCF(lev); + cudaMemoryManager->cudaFreeInterfaceFC(lev); + cudaMemoryManager->cudaFreeInterfaceOffCF(lev); + cudaMemoryManager->cudaFreeInterfaceOffFC(lev); + //para->cudaFreePressX1(lev); + } + } + //para->cudaFreeVeloBC(0); //level = 0 + //para->cudaFreePressBC(); + //para->cudaFreeVeloPropeller(para->getFine()); + //para->cudaFreePressX0(para->getCoarse()); + + ////////////////////////////////////////////////////////////////////////// + //Temp + if (para->getDiffOn() == true) + { + for (int lev = para->getCoarse(); lev < para->getFine(); lev++) + { + checkCudaErrors(cudaFreeHost(para->getParH(lev)->Conc_Full)); + checkCudaErrors(cudaFreeHost(para->getParH(lev)->Conc)); + checkCudaErrors(cudaFreeHost(para->getParH(lev)->Temp.temp)); + checkCudaErrors(cudaFreeHost(para->getParH(lev)->Temp.k)); + checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempVel.temp)); + checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempVel.velo)); + checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempVel.k)); + checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempPress.temp)); + checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempPress.velo)); + checkCudaErrors(cudaFreeHost(para->getParH(lev)->TempPress.k)); + } + } + ////////////////////////////////////////////////////////////////////////// + + + ////////////////////////////////////////////////////////////////////////// + //free second order moments + if (para->getCalc2ndOrderMoments()) + { + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) + { + cudaMemoryManager->cudaFree2ndMoments(lev); + } + } + ////////////////////////////////////////////////////////////////////////// + //free third order moments + if (para->getCalc3rdOrderMoments()) + { + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) + { + cudaMemoryManager->cudaFree3rdMoments(lev); + } + } + ////////////////////////////////////////////////////////////////////////// + //free higher order moments + if (para->getCalcHighOrderMoments()) + { + for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) + { + cudaMemoryManager->cudaFreeHigherMoments(lev); + } + } + ////////////////////////////////////////////////////////////////////////// + + + ////////////////////////////////////////////////////////////////////////// + //Multi GPU + ////////////////////////////////////////////////////////////////////////// + ////1D domain decomposition + //if (para->getNumprocs() > 1) + //{ + // for (int lev=para->getCoarse(); lev < para->getFine(); lev++) + // { + // for (unsigned int i=0; i < para->getNumberOfProcessNeighbors(lev, "send"); i++) + // { + // para->cudaFreeProcessNeighbor(lev, i); + // } + // } + //} + ////////////////////////////////////////////////////////////////////////// + //3D domain decomposition + if (para->getNumprocs() > 1) + { + for (int lev = para->getCoarse(); lev < para->getFine(); lev++) + { + ////////////////////////////////////////////////////////////////////////// + for (unsigned int i = 0; i < para->getNumberOfProcessNeighborsX(lev, "send"); i++) + { + cudaMemoryManager->cudaFreeProcessNeighborX(lev, i); + } + ////////////////////////////////////////////////////////////////////////// + for (unsigned int i = 0; i < para->getNumberOfProcessNeighborsY(lev, "send"); i++) + { + cudaMemoryManager->cudaFreeProcessNeighborY(lev, i); + } + ////////////////////////////////////////////////////////////////////////// + for (unsigned int i = 0; i < para->getNumberOfProcessNeighborsZ(lev, "send"); i++) + { + cudaMemoryManager->cudaFreeProcessNeighborZ(lev, i); + } + } + } + ////////////////////////////////////////////////////////////////////////// + //Normals + if (para->getIsGeoNormal()) { + for (int lev = para->getCoarse(); lev < para->getFine(); lev++) + { + cudaMemoryManager->cudaFreeGeomNormals(lev); + } + } + ////////////////////////////////////////////////////////////////////////// + // Turbulence Intensity + if (para->getCalcTurbulenceIntensity()) { + cudaFreeTurbulenceIntensityArrays(para.get(), cudaMemoryManager.get()); + //PreCollisionInteractors + for( SPtr<PreCollisionInteractor> actuator: para->getActuators()){ + actuator->free(para.get(), cudaMemoryManager.get()); + } + + for( SPtr<PreCollisionInteractor> probe: para->getProbes()){ + probe->free(para.get(), cudaMemoryManager.get()); + } + ////////////////////////////////////////////////////////////////////////// + } } diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.h b/src/gpu/VirtualFluids_GPU/LBM/Simulation.h index 72c86140258b01aec3b3ed00d59c271f1824d514..5bb58827ea58a8fe135b934f6e1aa0a5ee42cdfd 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.h +++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.h @@ -3,15 +3,12 @@ #include <memory> #include <vector> + #include <PointerDefinitions.h> -#include "Output/LogWriter.hpp" -#include "GPU/KineticEnergyAnalyzer.h" -#include "GPU/EnstrophyAnalyzer.h" #include "Utilities/Buffer2D.hpp" #include "LBM/LB.h" -#include "VirtualFluids_GPU_export.h" namespace vf::gpu { class Communicator; } @@ -28,48 +25,58 @@ class KernelFactory; class PreProcessor; class PreProcessorFactory; class TrafficMovementFactory; - -class VIRTUALFLUIDS_GPU_EXPORT Simulation +class UpdateGrid27; +class KineticEnergyAnalyzer; +class EnstrophyAnalyzer; +class BoundaryConditionFactory; +class GridScalingFactory; +class TurbulenceModelFactory; + +class Simulation { public: - Simulation(vf::gpu::Communicator& communicator); - void run(); - void init(SPtr<Parameter> para, SPtr<GridProvider> gridProvider, std::shared_ptr<DataWriter> dataWriter, std::shared_ptr<CudaMemoryManager> cudaManager); - void free(); - void bulk(); - void porousMedia(); - void definePMarea(std::shared_ptr<PorousMedia> pm); - - void setFactories(std::shared_ptr<KernelFactory> kernelFactory, std::shared_ptr<PreProcessorFactory> preProcessorFactory); - - void addKineticEnergyAnalyzer( uint tAnalyse ); - void addEnstrophyAnalyzer ( uint tAnalyse ); - -protected: - std::shared_ptr<KernelFactory> kernelFactory; + Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, + vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, GridScalingFactory* scalingFactory = nullptr); + Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, + vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory* scalingFactory = nullptr); + + ~Simulation(); + void run(); + + void setFactories(std::unique_ptr<KernelFactory> &&kernelFactory, + std::unique_ptr<PreProcessorFactory> &&preProcessorFactory); + void setDataWriter(std::shared_ptr<DataWriter> dataWriter); + void addKineticEnergyAnalyzer(uint tAnalyse); + void addEnstrophyAnalyzer(uint tAnalyse); + +private: + void init(GridProvider &gridProvider, BoundaryConditionFactory *bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory *scalingFactory); + void allocNeighborsOffsetsScalesAndBoundaries(GridProvider& gridProvider); + void porousMedia(); + void definePMarea(std::shared_ptr<PorousMedia>& pm); + + std::unique_ptr<KernelFactory> kernelFactory; std::shared_ptr<PreProcessorFactory> preProcessorFactory; - Buffer2D <real> sbuf_t; + Buffer2D <real> sbuf_t; Buffer2D <real> rbuf_t; Buffer2D <real> sbuf_b; Buffer2D <real> rbuf_b; - Buffer2D <int> geo_sbuf_t; + Buffer2D <int> geo_sbuf_t; Buffer2D <int> geo_rbuf_t; Buffer2D <int> geo_sbuf_b; Buffer2D <int> geo_rbuf_b; - LogWriter output; - vf::gpu::Communicator& communicator; SPtr<Parameter> para; - SPtr<GridProvider> gridProvider; - SPtr<DataWriter> dataWriter; - SPtr<CudaMemoryManager> cudaManager; + std::shared_ptr<DataWriter> dataWriter; + std::shared_ptr<CudaMemoryManager> cudaMemoryManager; std::vector < SPtr< Kernel>> kernels; std::vector < SPtr< ADKernel>> adKernels; std::shared_ptr<PreProcessor> preProcessor; + SPtr<TurbulenceModelFactory> tmFactory; SPtr<RestartObject> restart_object; @@ -82,27 +89,25 @@ protected: //PorousMedia* pm1; //PorousMedia* pm2; + // TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/29 //KQ - Schlaff - unsigned int kNQ, kSQ, kEQ, kWQ; - QforBoundaryConditions QnH, QnD; - QforBoundaryConditions QsH, QsD; - QforBoundaryConditions QeH, QeD; - QforBoundaryConditions QwH, QwD; - real *VxNH, *VyNH, *VzNH, *deltaVNH; - real *VxND, *VyND, *VzND, *deltaVND; - real *VxSH, *VySH, *VzSH, *deltaVSH; - real *VxSD, *VySD, *VzSD, *deltaVSD; - real *VxEH, *VyEH, *VzEH, *deltaVEH; - real *VxED, *VyED, *VzED, *deltaVED; - real *VxWH, *VyWH, *VzWH, *deltaVWH; - real *VxWD, *VyWD, *VzWD, *deltaVWD; - - - //////////////////////////////////////////////////////////////////////////// - SPtr<KineticEnergyAnalyzer> kineticEnergyAnalyzer; - //////////////////////////////////////////////////////////////////////////// - SPtr<EnstrophyAnalyzer> enstrophyAnalyzer; - //////////////////////////////////////////////////////////////////////////// - - }; + // unsigned int kNQ, kSQ, kEQ, kWQ; + // QforBoundaryConditions QnH, QnD; + // QforBoundaryConditions QsH, QsD; + // QforBoundaryConditions QeH, QeD; + // QforBoundaryConditions QwH, QwD; + // real *VxNH, *VyNH, *VzNH, *deltaVNH; + // real *VxND, *VyND, *VzND, *deltaVND; + // real *VxSH, *VySH, *VzSH, *deltaVSH; + // real *VxSD, *VySD, *VzSD, *deltaVSD; + // real *VxEH, *VyEH, *VzEH, *deltaVEH; + // real *VxED, *VyED, *VzED, *deltaVED; + // real *VxWH, *VyWH, *VzWH, *deltaVWH; + // real *VxWD, *VyWD, *VzWD, *deltaVWD; + + + std::unique_ptr<KineticEnergyAnalyzer> kineticEnergyAnalyzer; + std::unique_ptr<EnstrophyAnalyzer> enstrophyAnalyzer; + std::unique_ptr<UpdateGrid27> updateGrid27; +}; #endif diff --git a/src/gpu/VirtualFluids_GPU/Output/AnalysisData.hpp b/src/gpu/VirtualFluids_GPU/Output/AnalysisData.hpp index 9263f5009f6bda53966197bd7076dab23093c8d9..d091f38ea228d43345235132cd4947ff750436d6 100644 --- a/src/gpu/VirtualFluids_GPU/Output/AnalysisData.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/AnalysisData.hpp @@ -23,10 +23,10 @@ public: { int m = para->getParH(0)->nx*(para->getParH(0)->ny*k + j) + i; //gerade - out.writeDouble((double)para->getParH(0)->vy_SP[para->getParH(0)->k[m]]); - //schräg x + out.writeDouble((double)para->getParH(0)->velocityY[para->getParH(0)->k[m]]); + //schr�g x // out.writeDouble((double)para->getParH(0)->vz_SP[para->getParH(0)->k[m]]); - //schräg z + //schr�g z //out.writeDouble((double)para->getParH(0)->vx_SP[para->getParH(0)->k[m]]); } out.writeLine(); @@ -49,7 +49,7 @@ public: // } // out.writeLine(); //} - int numberNodes = (int)para->getParH(0)->size_Mat_SP; + int numberNodes = (int)para->getParH(0)->numberOfNodes; real deltaX = 1.0f; real halfDx = deltaX / 2.0f; @@ -57,11 +57,11 @@ public: for (int u = 0; u < numberNodes; u++) { - if ((para->getParH(0)->geoSP[u] == GEO_FLUID) && - ((middleOfTheGrid - halfDx) <= para->getParH(0)->coordY_SP[u]) && - ((middleOfTheGrid + halfDx) >= para->getParH(0)->coordY_SP[u])) + if ((para->getParH(0)->typeOfGridNode[u] == GEO_FLUID) && + ((middleOfTheGrid - halfDx) <= para->getParH(0)->coordinateY[u]) && + ((middleOfTheGrid + halfDx) >= para->getParH(0)->coordinateY[u])) { - out.writeDouble((float)(para->getParH(0)->vx_SP[u])); + out.writeDouble((float)(para->getParH(0)->velocityX[u])); out.writeLine(); } } @@ -79,7 +79,7 @@ public: { int m = para->getParH(0)->nx*(para->getParH(0)->ny*k + j) + i; //Taylor Green Vortex - Z - out.writeDouble((double)para->getParH(0)->vz_SP[para->getParH(0)->k[m]]); + out.writeDouble((double)para->getParH(0)->velocityZ[para->getParH(0)->k[m]]); } out.writeLine(); } @@ -90,7 +90,7 @@ public: UbFileOutputASCII out(para->getFName() + "_AD_X_" + StringUtil::toString<int>(t) + ".dat"); real level = 0; //uniform - int numberNodes = (int)para->getParH(level)->size_Mat_SP; + int numberNodes = (int)para->getParH(level)->numberOfNodes; real deltaX = 1.0f / pow(2, level); real halfDx = deltaX / 2.0f; @@ -98,11 +98,11 @@ public: for (int u = 0; u < numberNodes; u++) { - if ((para->getParH(level)->geoSP[u] == GEO_FLUID) && - ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordY_SP[u]) && - ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordY_SP[u])) + if ((para->getParH(level)->typeOfGridNode[u] == GEO_FLUID) && + ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordinateY[u]) && + ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordinateY[u])) { - out.writeDouble((double)(para->getParH(level)->vx_SP[u])); + out.writeDouble((double)(para->getParH(level)->velocityX[u])); } } } @@ -112,7 +112,7 @@ public: UbFileOutputASCII out(para->getFName() + "_AD_Y_" + StringUtil::toString<int>(t) + ".dat"); real level = 0; //uniform - int numberNodes = (int)para->getParH(level)->size_Mat_SP; + int numberNodes = (int)para->getParH(level)->numberOfNodes; real deltaX = 1.0f / pow(2, level); real halfDx = deltaX / 2.0f; @@ -120,11 +120,11 @@ public: for (int u = 0; u < numberNodes; u++) { - if ((para->getParH(level)->geoSP[u] == GEO_FLUID) && - ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordY_SP[u]) && - ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordY_SP[u])) + if ((para->getParH(level)->typeOfGridNode[u] == GEO_FLUID) && + ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordinateY[u]) && + ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordinateY[u])) { - out.writeDouble((double)(para->getParH(level)->vy_SP[u])); + out.writeDouble((double)(para->getParH(level)->velocityY[u])); } } } @@ -134,7 +134,7 @@ public: UbFileOutputASCII out(para->getFName() + "_AD_Z_" + StringUtil::toString<int>(t) + ".dat"); real level = 0; //uniform - int numberNodes = (int)para->getParH(level)->size_Mat_SP; + int numberNodes = (int)para->getParH(level)->numberOfNodes; real deltaX = 1.0f / pow(2, level); real halfDx = deltaX / 2.0f; @@ -142,11 +142,11 @@ public: for (int u = 0; u < numberNodes; u++) { - if ((para->getParH(level)->geoSP[u] == GEO_FLUID) && - ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordY_SP[u]) && - ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordY_SP[u])) + if ((para->getParH(level)->typeOfGridNode[u] == GEO_FLUID) && + ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordinateY[u]) && + ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordinateY[u])) { - out.writeDouble((double)(para->getParH(level)->vz_SP[u])); + out.writeDouble((double)(para->getParH(level)->velocityZ[u])); } } } diff --git a/src/gpu/VirtualFluids_GPU/Output/DataWriter.h b/src/gpu/VirtualFluids_GPU/Output/DataWriter.h index 6e61fc696ffe2af2e7e425a25867de8f3c0d2c0f..48a9b56da3abd5337e1c6042a7dcba3304c449e6 100644 --- a/src/gpu/VirtualFluids_GPU/Output/DataWriter.h +++ b/src/gpu/VirtualFluids_GPU/Output/DataWriter.h @@ -3,7 +3,6 @@ #include "PointerDefinitions.h" #include "Core/DataTypes.h" -#include "VirtualFluids_GPU_export.h" #include <memory> #include <vector> @@ -16,10 +15,9 @@ class CudaMemoryManager; class DataWriter { public: - DataWriter() = default; virtual ~DataWriter() = default; - virtual void writeInit(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager) = 0; + virtual void writeInit(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager) = 0; virtual void writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep) = 0; virtual void writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep, int level) = 0; }; diff --git a/src/gpu/VirtualFluids_GPU/Output/EdgeNodeDebugWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/EdgeNodeDebugWriter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6498bbb0a2b787d70a3b11500549b2a8956ce67a --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Output/EdgeNodeDebugWriter.hpp @@ -0,0 +1,101 @@ +#ifndef EDGENODEDEBUG_HPP +#define EDGENODEDEBUG_HPP + +#include <fstream> +#include <sstream> +#include <stdio.h> +// #include <math.h> +#include "Core/StringUtilities/StringUtil.h" +#include "lbm/constants/D3Q27.h" +#include "LBM/LB.h" +#include "Parameter/Parameter.h" +#include "basics/utilities/UbSystem.h" +#include <basics/writer/WbWriterVtkXmlBinary.h> +#include <cmath> + +#include "VirtualFluids_GPU/Communication/Communicator.h" + +namespace EdgeNodeDebugWriter +{ + +void addCoordinatesToNodeVector(SPtr<LBMSimulationParameter> parH, std::vector<UbTupleFloat3> &nodesVec, int indexInNodesVector, int sparseIndexOfNode){ + double x1 = parH->coordinateX[sparseIndexOfNode]; + double x2 = parH->coordinateY[sparseIndexOfNode]; + double x3 = parH->coordinateZ[sparseIndexOfNode]; + nodesVec[indexInNodesVector] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); +} + +void writeEdgeNodesXZ_Send(SPtr<Parameter> para) +{ + std::vector<UbTupleFloat3> nodesVec; + std::vector<std::string> datanames = { "SparseIndex", "ProcessNeighbor", "IndexInSendVector", "AfterFtoC" }; + std::vector<std::vector<double>> nodedata; + + int numberOfNodes = 0; + for (int level = 0; level < para->getMaxLevel(); level++){ + numberOfNodes += (int) para->getParH(level)->edgeNodesXtoZ.size(); + } + nodesVec.resize(numberOfNodes); + nodedata.resize(datanames.size(), std::vector<double>(numberOfNodes)); + + int nodeCount = 0; + for (int level = 0; level < para->getMaxLevel(); level++) { + for (int u = 0; u < numberOfNodes; u++) { + int indexOfProcessNeighborSend = para->getParH(level)->edgeNodesXtoZ[u].indexOfProcessNeighborSend; + int indexInSendBuffer = para->getParH(level)->edgeNodesXtoZ[u].indexInSendBuffer; + int sparseIndex = para->getParH(level)->sendProcessNeighborZ[indexOfProcessNeighborSend].index[indexInSendBuffer]; + nodedata[0][nodeCount] = sparseIndex; + nodedata[1][nodeCount] = indexOfProcessNeighborSend; + nodedata[2][nodeCount] = indexInSendBuffer; + nodedata[3][nodeCount] = indexInSendBuffer < para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighborSend].numberOfNodes; + + addCoordinatesToNodeVector(para->getParH(level), nodesVec, nodeCount, sparseIndex); + + nodeCount++; + } + std::string filenameVec = para->getFName() + "_writeEdgeNodesXZ_Send_PID_" + + std::to_string(vf::gpu::Communicator::getInstance().getPID()) + "_" + + StringUtil::toString<int>(level); + + WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); + } +} + +void writeEdgeNodesXZ_Recv(SPtr<Parameter> para) +{ + std::vector<UbTupleFloat3> nodesVec; + std::vector<std::string> datanames = { "SparseIndex", "ProcessNeighbor", "IndexInRecvVector", "AfterFtoC" }; + std::vector<std::vector<double>> nodedata; + + int numberOfNodes = 0; + for (int level = 0; level < para->getMaxLevel(); level++){ + numberOfNodes += (int) para->getParH(level)->edgeNodesXtoZ.size(); + } + nodesVec.resize(numberOfNodes); + nodedata.resize(datanames.size(), std::vector<double>(numberOfNodes)); + + int nodeCount = 0; + for (int level = 0; level < para->getMaxLevel(); level++) { + for (int u = 0; u < numberOfNodes; u++) { + int indexOfProcessNeighborRecv = para->getParH(level)->edgeNodesXtoZ[u].indexOfProcessNeighborRecv; + int indexInRecvBuffer = para->getParH(level)->edgeNodesXtoZ[u].indexInRecvBuffer; + int sparseIndex = para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighborRecv].index[indexInRecvBuffer]; + nodedata[0][nodeCount] = sparseIndex; + nodedata[1][nodeCount] = indexOfProcessNeighborRecv; + nodedata[2][nodeCount] = indexInRecvBuffer; + nodedata[3][nodeCount] = indexInRecvBuffer < para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighborRecv].numberOfNodes; + + addCoordinatesToNodeVector(para->getParH(level), nodesVec, nodeCount, sparseIndex); + + nodeCount++; + } + std::string filenameVec = para->getFName() + "_writeEdgeNodesXZ_Recv_PID_" + + std::to_string(vf::gpu::Communicator::getInstance().getPID()) + "_" + + StringUtil::toString<int>(level); + + WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); + } +} +} // namespace EdgeNodeDebugWriter + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp b/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp index a554d63cccbb9a2622f0bbffa143c8a586b88f44..c6e53ee3cbfb98f11e373ca014c7faf4e70a86f0 100644 --- a/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp +++ b/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp @@ -1,11 +1,12 @@ // _ ___ __ __________ _ __ ______________ __ // | | / (_)____/ /___ ______ _/ / ____/ /_ __(_)___/ /____ / ___/ __ / / / / // | | / / / ___/ __/ / / / __ `/ / /_ / / / / / / __ / ___/ / /___/ /_/ / / / / -// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) / /_) / ____/ /__/ / +// | |/ / / / / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__ ) / /_) / ____/ /__/ / // |___/_/_/ \__/\__,_/\__,_/_/_/ /_/\__,_/_/\__,_/____/ \____/_/ \_____/ // ////////////////////////////////////////////////////////////////////////// #include "FileWriter.h" +#include <logger/Logger.h> #include <stdio.h> #include <fstream> @@ -18,17 +19,17 @@ #include "GPU/CudaMemoryManager.h" #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <basics/writer/WbWriterVtkXmlBinary.h> -void FileWriter::writeInit(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager) +void FileWriter::writeInit(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager) { - unsigned int timestep = para->getTInit(); - for (int level = para->getCoarse(); level <= para->getFine(); level++) { - cudaManager->cudaCopyPrint(level); - writeTimestep(para, timestep, level); - } + unsigned int timestep = para->getTimestepInit(); + for (int level = para->getCoarse(); level <= para->getFine(); level++) { + cudaMemoryManager->cudaCopyPrint(level); + writeTimestep(para, timestep, level); + } this->writeCollectionFile(para, timestep); @@ -49,61 +50,62 @@ void FileWriter::writeTimestep(std::shared_ptr<Parameter> para, unsigned int tim void FileWriter::writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep, int level) { - const unsigned int numberOfParts = para->getParH(level)->size_Mat_SP / para->getlimitOfNodesForVTK() + 1; + const unsigned int numberOfParts = para->getParH(level)->numberOfNodes / para->getlimitOfNodesForVTK() + 1; std::vector<std::string> fname; - std::vector<std::string> fnameMed; - for (unsigned int i = 1; i <= numberOfParts; i++) - { - fname.push_back(para->getFName() + "_bin_lev_" + StringUtil::toString<int>(level) + "_ID_" + StringUtil::toString<int>(para->getMyID()) + "_Part_" + StringUtil::toString<int>(i) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"); - fnameMed.push_back(para->getFName() + "_bin_median_lev_" + StringUtil::toString<int>(level) + "_ID_" + StringUtil::toString<int>(para->getMyID()) + "_Part_" + StringUtil::toString<int>(i) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"); + std::vector<std::string> fnameMed; + + for (unsigned int i = 1; i <= numberOfParts; i++) + { + fname.push_back(para->getFName() + "_bin_lev_" + StringUtil::toString<int>(level) + "_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + "_Part_" + StringUtil::toString<int>(i) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"); + fnameMed.push_back(para->getFName() + "_bin_median_lev_" + StringUtil::toString<int>(level) + "_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + "_Part_" + StringUtil::toString<int>(i) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"); this->fileNamesForCollectionFile.push_back( fname.back() ); this->fileNamesForCollectionFileMedian.push_back( fnameMed.back() ); - } - - if (para->getDiffOn() == true) - writeUnstrucuredGridLTConc(para, level, fname); - else - writeUnstrucuredGridLT(para, level, fname); - - if (para->getCalcMedian()) - { - if (para->getDiffOn() == true) - writeUnstrucuredGridMedianLTConc(para, level, fnameMed); - else - writeUnstrucuredGridMedianLT(para, level, fnameMed); - } + } + + if (para->getDiffOn() == true) + writeUnstrucuredGridLTConc(para, level, fname); + else + writeUnstrucuredGridLT(para, level, fname); + + if (para->getCalcMedian()) + { + if (para->getDiffOn() == true) + writeUnstrucuredGridMedianLTConc(para, level, fnameMed); + else + writeUnstrucuredGridMedianLT(para, level, fnameMed); + } } bool FileWriter::isPeriodicCell(std::shared_ptr<Parameter> para, int level, unsigned int number2, unsigned int number1, unsigned int number3, unsigned int number5) { - return (para->getParH(level)->coordX_SP[number2] < para->getParH(level)->coordX_SP[number1]) || - (para->getParH(level)->coordY_SP[number3] < para->getParH(level)->coordY_SP[number1]) || - (para->getParH(level)->coordZ_SP[number5] < para->getParH(level)->coordZ_SP[number1]); + return (para->getParH(level)->coordinateX[number2] < para->getParH(level)->coordinateX[number1]) || + (para->getParH(level)->coordinateY[number3] < para->getParH(level)->coordinateY[number1]) || + (para->getParH(level)->coordinateZ[number5] < para->getParH(level)->coordinateZ[number1]); } void VIRTUALFLUIDS_GPU_EXPORT FileWriter::writeCollectionFile(std::shared_ptr<Parameter> para, unsigned int timestep) { - std::string filename = para->getFName() + "_bin_ID_" + StringUtil::toString<int>(para->getMyID()) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"; + std::string filename = para->getFName() + "_bin_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"; std::ofstream file; file.open( filename + ".pvtu" ); ////////////////////////////////////////////////////////////////////////// - - file << "<VTKFile type=\"PUnstructuredGrid\" version=\"1.0\" byte_order=\"LittleEndian\" header_type=\"UInt64\">" << std::endl; + file << "<?xml version=\"1.0\"?>" << std::endl; + file << "<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">" << std::endl; file << " <PUnstructuredGrid GhostLevel=\"1\">" << std::endl; file << " <PPointData>" << std::endl; - file << " <DataArray type=\"Float32\" Name=\"press\" /> " << std::endl; - file << " <DataArray type=\"Float32\" Name=\"rho\" /> " << std::endl; - file << " <DataArray type=\"Float32\" Name=\"vx1\" /> " << std::endl; - file << " <DataArray type=\"Float32\" Name=\"vx2\" /> " << std::endl; - file << " <DataArray type=\"Float32\" Name=\"vx3\" /> " << std::endl; - file << " <DataArray type=\"Float32\" Name=\"geo\" /> " << std::endl; - if( para->getDiffOn() ) file << " <DataArray type=\"Float32\" Name=\"conc\" /> " << std::endl; + file << " <PDataArray type=\"Float64\" Name=\"press\" /> " << std::endl; + file << " <PDataArray type=\"Float64\" Name=\"rho\" /> " << std::endl; + file << " <PDataArray type=\"Float64\" Name=\"vx1\" /> " << std::endl; + file << " <PDataArray type=\"Float64\" Name=\"vx2\" /> " << std::endl; + file << " <PDataArray type=\"Float64\" Name=\"vx3\" /> " << std::endl; + file << " <PDataArray type=\"Float64\" Name=\"geo\" /> " << std::endl; + if( para->getDiffOn() ) file << " <PDataArray type=\"Float64\" Name=\"conc\" /> " << std::endl; file << " </PPointData>" << std::endl; file << " <PPoints>" << std::endl; @@ -129,14 +131,14 @@ void VIRTUALFLUIDS_GPU_EXPORT FileWriter::writeCollectionFile(std::shared_ptr<Pa void VIRTUALFLUIDS_GPU_EXPORT FileWriter::writeCollectionFileMedian(std::shared_ptr<Parameter> para, unsigned int timestep) { - std::string filename = para->getFName() + "_bin_median_ID_" + StringUtil::toString<int>(para->getMyID()) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"; + std::string filename = para->getFName() + "_bin_median_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"; std::ofstream file; file.open( filename + ".pvtu" ); ////////////////////////////////////////////////////////////////////////// - + file << "<VTKFile type=\"PUnstructuredGrid\" version=\"1.0\" byte_order=\"LittleEndian\" header_type=\"UInt64\">" << std::endl; file << " <PUnstructuredGrid GhostLevel=\"1\">" << std::endl; @@ -181,6 +183,30 @@ void FileWriter::writeUnstrucuredGridLT(std::shared_ptr<Parameter> para, int lev nodedatanames.push_back("vx2"); nodedatanames.push_back("vx3"); nodedatanames.push_back("geo"); + + uint firstBodyForceNode = (uint) nodedatanames.size(); + if(para->getIsBodyForce()) + { + nodedatanames.push_back("Fx"); + nodedatanames.push_back("Fy"); + nodedatanames.push_back("Fz"); + } + + uint firstNutNode = (uint) nodedatanames.size(); + if(para->getUseTurbulentViscosity()) + { + nodedatanames.push_back("nut"); + } + + uint firstTurbNode = (uint) nodedatanames.size(); + if (para->getCalcTurbulenceIntensity()) { + nodedatanames.push_back("vxx"); + nodedatanames.push_back("vyy"); + nodedatanames.push_back("vzz"); + nodedatanames.push_back("vxy"); + nodedatanames.push_back("vxz"); + nodedatanames.push_back("vyz"); + } unsigned int number1, number2, number3, number4, number5, number6, number7, number8; uint dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; bool neighborsAreFluid; @@ -191,8 +217,131 @@ void FileWriter::writeUnstrucuredGridLT(std::shared_ptr<Parameter> para, int lev for (unsigned int part = 0; part < fname.size(); part++) { - if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + else + sizeOfNodes = para->getlimitOfNodesForVTK(); + + ////////////////////////////////////////////////////////////////////////// + startpos = part * para->getlimitOfNodesForVTK(); + endpos = startpos + sizeOfNodes; + ////////////////////////////////////////////////////////////////////////// + cells.clear(); + nodes.resize(sizeOfNodes); + for (uint i = 0; i < (uint)nodedatanames.size(); i++) + nodedata[i].resize(sizeOfNodes); + + ////////////////////////////////////////////////////////////////////////// + for (unsigned int pos = startpos; pos < endpos; pos++) + { + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) + { + ////////////////////////////////////////////////////////////////////////// + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + ////////////////////////////////////////////////////////////////////////// + number1 = pos; + dn1 = pos - startpos; + neighborsAreFluid = true; + ////////////////////////////////////////////////////////////////////////// + nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + nodedata[0][dn1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][dn1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][dn1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][dn1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][dn1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; + + if(para->getIsBodyForce()) + { + nodedata[firstBodyForceNode ][dn1] = (double)para->getParH(level)->forceX_SP[pos] * (double)para->getScaledForceRatio(level); + nodedata[firstBodyForceNode + 1][dn1] = (double)para->getParH(level)->forceY_SP[pos] * (double)para->getScaledForceRatio(level); + nodedata[firstBodyForceNode + 2][dn1] = (double)para->getParH(level)->forceZ_SP[pos] * (double)para->getScaledForceRatio(level); + } + + if(para->getUseTurbulentViscosity()) + { + nodedata[firstNutNode][dn1] = (double)para->getParH(level)->turbViscosity[pos] * (double)para->getScaledViscosityRatio(level); + } + + if (para->getCalcTurbulenceIntensity()) { + nodedata[firstTurbNode ][dn1] = (double)para->getParH(level)->vxx[pos]; + nodedata[firstTurbNode + 1][dn1] = (double)para->getParH(level)->vyy[pos]; + nodedata[firstTurbNode + 2][dn1] = (double)para->getParH(level)->vzz[pos]; + nodedata[firstTurbNode + 3][dn1] = (double)para->getParH(level)->vxy[pos]; + nodedata[firstTurbNode + 4][dn1] = (double)para->getParH(level)->vxz[pos]; + nodedata[firstTurbNode + 5][dn1] = (double)para->getParH(level)->vyz[pos]; + } + + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) neighborsAreFluid = false; + ////////////////////////////////////////////////////////////////////////// + if (number2 > endpos || + number3 > endpos || + number4 > endpos || + number5 > endpos || + number6 > endpos || + number7 > endpos || + number8 > endpos) neighborsAreFluid = false; + ////////////////////////////////////////////////////////////////////////// + dn2 = number2 - startpos; + dn3 = number3 - startpos; + dn4 = number4 - startpos; + dn5 = number5 - startpos; + dn6 = number6 - startpos; + dn7 = number7 - startpos; + dn8 = number8 - startpos; + ////////////////////////////////////////////////////////////////////////// + if (isPeriodicCell(para, level, number2, number1, number3, number5)) + continue; + ////////////////////////////////////////////////////////////////////////// + if (neighborsAreFluid) + cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8)); + } + } + WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata); + } +} + +void FileWriter::writeUnstrucuredGridLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) +{ + std::vector< UbTupleFloat3 > nodes; + std::vector< UbTupleUInt8 > cells; + std::vector< std::string > nodedatanames; + nodedatanames.push_back("press"); + nodedatanames.push_back("rho"); + nodedatanames.push_back("vx1"); + nodedatanames.push_back("vx2"); + nodedatanames.push_back("vx3"); + nodedatanames.push_back("geo"); + nodedatanames.push_back("conc"); + unsigned int number1, number2, number3, number4, number5, number6, number7, number8; + uint dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; + bool neighborsAreFluid; + unsigned int startpos = 0; + unsigned int endpos = 0; + unsigned int sizeOfNodes = 0; + std::vector< std::vector< double > > nodedata(nodedatanames.size()); + + for (unsigned int part = 0; part < fname.size(); part++) + { + if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); else sizeOfNodes = para->getlimitOfNodesForVTK(); @@ -208,43 +357,45 @@ void FileWriter::writeUnstrucuredGridLT(std::shared_ptr<Parameter> para, int lev nodedata[3].resize(sizeOfNodes); nodedata[4].resize(sizeOfNodes); nodedata[5].resize(sizeOfNodes); + nodedata[6].resize(sizeOfNodes); ////////////////////////////////////////////////////////////////////////// for (unsigned int pos = startpos; pos < endpos; pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; dn1 = pos - startpos; neighborsAreFluid = true; ////////////////////////////////////////////////////////////////////////// nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - nodedata[0][dn1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][dn1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID) neighborsAreFluid = false; + nodedata[0][dn1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][dn1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][dn1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][dn1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][dn1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; + nodedata[6][dn1] = (double)para->getParH(level)->Conc[pos]; + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) neighborsAreFluid = false; ////////////////////////////////////////////////////////////////////////// if (number2 > endpos || number3 > endpos || @@ -261,10 +412,10 @@ void FileWriter::writeUnstrucuredGridLT(std::shared_ptr<Parameter> para, int lev dn6 = number6 - startpos; dn7 = number7 - startpos; dn8 = number8 - startpos; - ////////////////////////////////////////////////////////////////////////// - if (isPeriodicCell(para, level, number2, number1, number3, number5)) - continue; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////// + if (isPeriodicCell(para, level, number2, number1, number3, number5)) + continue; + ////////////////////////////////////////////////////////////////////////// if (neighborsAreFluid) cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8)); } @@ -273,329 +424,223 @@ void FileWriter::writeUnstrucuredGridLT(std::shared_ptr<Parameter> para, int lev } } -void FileWriter::writeUnstrucuredGridLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) -{ - std::vector< UbTupleFloat3 > nodes; - std::vector< UbTupleUInt8 > cells; - std::vector< std::string > nodedatanames; - nodedatanames.push_back("press"); - nodedatanames.push_back("rho"); - nodedatanames.push_back("vx1"); - nodedatanames.push_back("vx2"); - nodedatanames.push_back("vx3"); - nodedatanames.push_back("geo"); - nodedatanames.push_back("conc"); - unsigned int number1, number2, number3, number4, number5, number6, number7, number8; - uint dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; - bool neighborsAreFluid; - unsigned int startpos = 0; - unsigned int endpos = 0; - unsigned int sizeOfNodes = 0; - std::vector< std::vector< double > > nodedata(nodedatanames.size()); - - for (unsigned int part = 0; part < fname.size(); part++) - { - if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); - else - sizeOfNodes = para->getlimitOfNodesForVTK(); - - ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); - endpos = startpos + sizeOfNodes; - ////////////////////////////////////////////////////////////////////////// - cells.clear(); - nodes.resize(sizeOfNodes); - nodedata[0].resize(sizeOfNodes); - nodedata[1].resize(sizeOfNodes); - nodedata[2].resize(sizeOfNodes); - nodedata[3].resize(sizeOfNodes); - nodedata[4].resize(sizeOfNodes); - nodedata[5].resize(sizeOfNodes); - nodedata[6].resize(sizeOfNodes); - ////////////////////////////////////////////////////////////////////////// - for (unsigned int pos = startpos; pos < endpos; pos++) - { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) - { - ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - ////////////////////////////////////////////////////////////////////////// - number1 = pos; - dn1 = pos - startpos; - neighborsAreFluid = true; - ////////////////////////////////////////////////////////////////////////// - nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - nodedata[0][dn1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][dn1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos]; - nodedata[6][dn1] = (double)para->getParH(level)->Conc[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID) neighborsAreFluid = false; - ////////////////////////////////////////////////////////////////////////// - if (number2 > endpos || - number3 > endpos || - number4 > endpos || - number5 > endpos || - number6 > endpos || - number7 > endpos || - number8 > endpos) neighborsAreFluid = false; - ////////////////////////////////////////////////////////////////////////// - dn2 = number2 - startpos; - dn3 = number3 - startpos; - dn4 = number4 - startpos; - dn5 = number5 - startpos; - dn6 = number6 - startpos; - dn7 = number7 - startpos; - dn8 = number8 - startpos; - ////////////////////////////////////////////////////////////////////////// - if (isPeriodicCell(para, level, number2, number1, number3, number5)) - continue; - ////////////////////////////////////////////////////////////////////////// - if (neighborsAreFluid) - cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8)); - } - } - WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata); - } -} - void FileWriter::writeUnstrucuredGridMedianLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) { - 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"); - nodedatanames.push_back("vx2Med"); - nodedatanames.push_back("vx3Med"); - nodedatanames.push_back("geo"); - unsigned int number1, number2, number3, number4, number5, number6, number7, number8; - unsigned int dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; - bool neighborsFluid; - unsigned int startpos = 0; - unsigned int endpos = 0; - unsigned int sizeOfNodes = 0; - std::vector< std::vector< double > > nodedata(nodedatanames.size()); - - //printf("\n test for if... \n"); - for (unsigned int part = 0; part < fname.size(); part++) - { - //printf("\n test in if I... \n"); - ////////////////////////////////////////////////////////////////////////// - if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) - { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); - } - else - { - sizeOfNodes = para->getlimitOfNodesForVTK(); - } - ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); - endpos = startpos + sizeOfNodes; - ////////////////////////////////////////////////////////////////////////// - cells.clear(); - nodes.resize(sizeOfNodes); - nodedata[0].resize(sizeOfNodes); - nodedata[1].resize(sizeOfNodes); - nodedata[2].resize(sizeOfNodes); - nodedata[3].resize(sizeOfNodes); - nodedata[4].resize(sizeOfNodes); - nodedata[5].resize(sizeOfNodes); - ////////////////////////////////////////////////////////////////////////// - //printf("\n test in if II... \n"); - for (unsigned int pos = startpos; pos < endpos; pos++) - { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) - { - ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - ////////////////////////////////////////////////////////////////////////// - number1 = pos; - dn1 = pos - startpos; - neighborsFluid = true; - ////////////////////////////////////////////////////////////////////////// - nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - nodedata[0][dn1] = para->getParH(level)->press_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[1][dn1] = para->getParH(level)->rho_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[2][dn1] = para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[3][dn1] = para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[4][dn1] = para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID) neighborsFluid = false; - ////////////////////////////////////////////////////////////////////////// - if (number2 > endpos || - number3 > endpos || - number4 > endpos || - number5 > endpos || - number6 > endpos || - number7 > endpos || - number8 > endpos) neighborsFluid = false; - ////////////////////////////////////////////////////////////////////////// - dn2 = number2 - startpos; - dn3 = number3 - startpos; - dn4 = number4 - startpos; - dn5 = number5 - startpos; - dn6 = number6 - startpos; - dn7 = number7 - startpos; - dn8 = number8 - startpos; - ////////////////////////////////////////////////////////////////////////// - if (isPeriodicCell(para, level, number2, number1, number3, number5)) - continue; - ////////////////////////////////////////////////////////////////////////// - if (neighborsFluid == true) cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8)); - ////////////////////////////////////////////////////////////////////////// - } - } - WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata); - ////////////////////////////////////////////////////////////////////////// - } + 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"); + nodedatanames.push_back("vx2Med"); + nodedatanames.push_back("vx3Med"); + nodedatanames.push_back("geo"); + unsigned int number1, number2, number3, number4, number5, number6, number7, number8; + unsigned int dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; + bool neighborsFluid; + unsigned int startpos = 0; + unsigned int endpos = 0; + unsigned int sizeOfNodes = 0; + std::vector< std::vector< double > > nodedata(nodedatanames.size()); + + //printf("\n test for if... \n"); + for (unsigned int part = 0; part < fname.size(); part++) + { + //printf("\n test in if I... \n"); + ////////////////////////////////////////////////////////////////////////// + if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) + { + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + } + else + { + sizeOfNodes = para->getlimitOfNodesForVTK(); + } + ////////////////////////////////////////////////////////////////////////// + startpos = part * para->getlimitOfNodesForVTK(); + endpos = startpos + sizeOfNodes; + ////////////////////////////////////////////////////////////////////////// + cells.clear(); + nodes.resize(sizeOfNodes); + nodedata[0].resize(sizeOfNodes); + nodedata[1].resize(sizeOfNodes); + nodedata[2].resize(sizeOfNodes); + nodedata[3].resize(sizeOfNodes); + nodedata[4].resize(sizeOfNodes); + nodedata[5].resize(sizeOfNodes); + ////////////////////////////////////////////////////////////////////////// + //printf("\n test in if II... \n"); + for (unsigned int pos = startpos; pos < endpos; pos++) + { + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) + { + ////////////////////////////////////////////////////////////////////////// + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + ////////////////////////////////////////////////////////////////////////// + number1 = pos; + dn1 = pos - startpos; + neighborsFluid = true; + ////////////////////////////////////////////////////////////////////////// + nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + nodedata[0][dn1] = para->getParH(level)->press_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[1][dn1] = para->getParH(level)->rho_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[2][dn1] = para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio(); + nodedata[3][dn1] = para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio(); + nodedata[4][dn1] = para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio(); + nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) neighborsFluid = false; + ////////////////////////////////////////////////////////////////////////// + if (number2 > endpos || + number3 > endpos || + number4 > endpos || + number5 > endpos || + number6 > endpos || + number7 > endpos || + number8 > endpos) neighborsFluid = false; + ////////////////////////////////////////////////////////////////////////// + dn2 = number2 - startpos; + dn3 = number3 - startpos; + dn4 = number4 - startpos; + dn5 = number5 - startpos; + dn6 = number6 - startpos; + dn7 = number7 - startpos; + dn8 = number8 - startpos; + ////////////////////////////////////////////////////////////////////////// + if (isPeriodicCell(para, level, number2, number1, number3, number5)) + continue; + ////////////////////////////////////////////////////////////////////////// + if (neighborsFluid == true) cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8)); + ////////////////////////////////////////////////////////////////////////// + } + } + WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata); + ////////////////////////////////////////////////////////////////////////// + } } void FileWriter::writeUnstrucuredGridMedianLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) { - 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"); - nodedatanames.push_back("vx1Med"); - nodedatanames.push_back("vx2Med"); - nodedatanames.push_back("vx3Med"); - nodedatanames.push_back("geo"); - uint number1, number2, number3, number4, number5, number6, number7, number8; - uint dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; - bool neighborsFluid; - uint startpos = 0; - uint endpos = 0; - uint sizeOfNodes = 0; - std::vector< std::vector< double > > nodedata(nodedatanames.size()); - - for (unsigned int part = 0; part < fname.size(); part++) - { - if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); - else - sizeOfNodes = para->getlimitOfNodesForVTK(); - ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); - endpos = startpos + sizeOfNodes; - ////////////////////////////////////////////////////////////////////////// - cells.clear(); - nodes.resize(sizeOfNodes); - nodedata[0].resize(sizeOfNodes); - nodedata[1].resize(sizeOfNodes); - nodedata[2].resize(sizeOfNodes); - nodedata[3].resize(sizeOfNodes); - nodedata[4].resize(sizeOfNodes); - nodedata[5].resize(sizeOfNodes); - nodedata[6].resize(sizeOfNodes); - ////////////////////////////////////////////////////////////////////////// - for (unsigned int pos = startpos; pos < endpos; pos++) - { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) - { - ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - ////////////////////////////////////////////////////////////////////////// - number1 = pos; - dn1 = pos - startpos; - neighborsFluid = true; - ////////////////////////////////////////////////////////////////////////// - nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - nodedata[0][dn1] = (double)para->getParH(level)->Conc_Med_Out[pos]; - nodedata[1][dn1] = (double)para->getParH(level)->press_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->rho_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[6][dn1] = (double)para->getParH(level)->geoSP[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID) neighborsFluid = false; - ////////////////////////////////////////////////////////////////////////// - if (number2 > endpos || - number3 > endpos || - number4 > endpos || - number5 > endpos || - number6 > endpos || - number7 > endpos || - number8 > endpos) neighborsFluid = false; - ////////////////////////////////////////////////////////////////////////// - dn2 = number2 - startpos; - dn3 = number3 - startpos; - dn4 = number4 - startpos; - dn5 = number5 - startpos; - dn6 = number6 - startpos; - dn7 = number7 - startpos; - dn8 = number8 - startpos; - ////////////////////////////////////////////////////////////////////////// - if (isPeriodicCell(para, level, number2, number1, number3, number5)) - continue; - ////////////////////////////////////////////////////////////////////////// - if (neighborsFluid) - cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8)); - ////////////////////////////////////////////////////////////////////////// - } - } - WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata); - ////////////////////////////////////////////////////////////////////////// - } + 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"); + nodedatanames.push_back("vx1Med"); + nodedatanames.push_back("vx2Med"); + nodedatanames.push_back("vx3Med"); + nodedatanames.push_back("geo"); + uint number1, number2, number3, number4, number5, number6, number7, number8; + uint dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; + bool neighborsFluid; + uint startpos = 0; + uint endpos = 0; + uint sizeOfNodes = 0; + std::vector< std::vector< double > > nodedata(nodedatanames.size()); + + for (unsigned int part = 0; part < fname.size(); part++) + { + if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + else + sizeOfNodes = para->getlimitOfNodesForVTK(); + ////////////////////////////////////////////////////////////////////////// + startpos = part * para->getlimitOfNodesForVTK(); + endpos = startpos + sizeOfNodes; + ////////////////////////////////////////////////////////////////////////// + cells.clear(); + nodes.resize(sizeOfNodes); + nodedata[0].resize(sizeOfNodes); + nodedata[1].resize(sizeOfNodes); + nodedata[2].resize(sizeOfNodes); + nodedata[3].resize(sizeOfNodes); + nodedata[4].resize(sizeOfNodes); + nodedata[5].resize(sizeOfNodes); + nodedata[6].resize(sizeOfNodes); + ////////////////////////////////////////////////////////////////////////// + for (unsigned int pos = startpos; pos < endpos; pos++) + { + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) + { + ////////////////////////////////////////////////////////////////////////// + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + ////////////////////////////////////////////////////////////////////////// + number1 = pos; + dn1 = pos - startpos; + neighborsFluid = true; + ////////////////////////////////////////////////////////////////////////// + nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + nodedata[0][dn1] = (double)para->getParH(level)->Conc_Med_Out[pos]; + nodedata[1][dn1] = (double)para->getParH(level)->press_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[2][dn1] = (double)para->getParH(level)->rho_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[3][dn1] = (double)para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio(); + nodedata[4][dn1] = (double)para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio(); + nodedata[5][dn1] = (double)para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio(); + nodedata[6][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) neighborsFluid = false; + ////////////////////////////////////////////////////////////////////////// + if (number2 > endpos || + number3 > endpos || + number4 > endpos || + number5 > endpos || + number6 > endpos || + number7 > endpos || + number8 > endpos) neighborsFluid = false; + ////////////////////////////////////////////////////////////////////////// + dn2 = number2 - startpos; + dn3 = number3 - startpos; + dn4 = number4 - startpos; + dn5 = number5 - startpos; + dn6 = number6 - startpos; + dn7 = number7 - startpos; + dn8 = number8 - startpos; + ////////////////////////////////////////////////////////////////////////// + if (isPeriodicCell(para, level, number2, number1, number3, number5)) + continue; + ////////////////////////////////////////////////////////////////////////// + if (neighborsFluid) + cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8)); + ////////////////////////////////////////////////////////////////////////// + } + } + WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata); + ////////////////////////////////////////////////////////////////////////// + } } ////////////////////////////////////////////////////////////////////////// @@ -605,5 +650,3 @@ void FileWriter::writeUnstrucuredGridMedianLTConc(std::shared_ptr<Parameter> par - - diff --git a/src/gpu/VirtualFluids_GPU/Output/FileWriter.h b/src/gpu/VirtualFluids_GPU/Output/FileWriter.h index 7f5c3c2d27f852b72966d3a837952c70a3fcf54e..2d7c176fa067ea86573849e90bd91dab259526b4 100644 --- a/src/gpu/VirtualFluids_GPU/Output/FileWriter.h +++ b/src/gpu/VirtualFluids_GPU/Output/FileWriter.h @@ -11,29 +11,27 @@ class Parameter; class CudaMemoryManager; +struct PN27; class FileWriter : public DataWriter { public: - VIRTUALFLUIDS_GPU_EXPORT FileWriter() {} - - void VIRTUALFLUIDS_GPU_EXPORT writeInit(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager) override; - void VIRTUALFLUIDS_GPU_EXPORT writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep) override; + void writeInit(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager) override; + void writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep) override; private: - void VIRTUALFLUIDS_GPU_EXPORT writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep, int level) override; - //void VIRTUALFLUIDS_GPU_EXPORT writeParticle(Parameter* para, unsigned int t); - void VIRTUALFLUIDS_GPU_EXPORT writeUnstrucuredGridLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname); - void VIRTUALFLUIDS_GPU_EXPORT writeUnstrucuredGridLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname); - void VIRTUALFLUIDS_GPU_EXPORT writeUnstrucuredGridMedianLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname); - void VIRTUALFLUIDS_GPU_EXPORT writeUnstrucuredGridMedianLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname); - bool VIRTUALFLUIDS_GPU_EXPORT isPeriodicCell(std::shared_ptr<Parameter> para, int level, unsigned int number2, unsigned int number1, unsigned int number3, unsigned int number5); - - FileWriter(const FileWriter& fileWriter) = default; - - void VIRTUALFLUIDS_GPU_EXPORT writeCollectionFile( std::shared_ptr<Parameter> para, unsigned int timestep ); - - void VIRTUALFLUIDS_GPU_EXPORT writeCollectionFileMedian( std::shared_ptr<Parameter> para, unsigned int timestep ); + void writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep, int level) override; + //void writeParticle(Parameter* para, unsigned int t); + void writeUnstrucuredGridLT(std::shared_ptr<Parameter> para, int level, + std::vector<std::string> &fname); + void writeUnstrucuredGridLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname); + void writeUnstrucuredGridMedianLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname); + void writeUnstrucuredGridMedianLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname); + bool isPeriodicCell(std::shared_ptr<Parameter> para, int level, unsigned int number2, unsigned int number1, unsigned int number3, unsigned int number5); + + void writeCollectionFile( std::shared_ptr<Parameter> para, unsigned int timestep ); + + void writeCollectionFileMedian( std::shared_ptr<Parameter> para, unsigned int timestep ); std::vector< std::string > fileNamesForCollectionFile; std::vector< std::string > fileNamesForCollectionFileMedian; diff --git a/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp index 8d1337be8088f3daa55f03fc5fcf1e405c8d0b3d..0b1e9dc1c25457457eabe3013a288c4c93577dc3 100644 --- a/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp @@ -1,604 +1,909 @@ #ifndef INTERFACEDEBUG_HPP #define INTERFACEDEBUG_HPP -#include <stdio.h> #include <fstream> #include <sstream> -// #include <math.h> -#include <cmath> +#include "Core/StringUtilities/StringUtil.h" +#include "lbm/constants/D3Q27.h" #include "LBM/LB.h" -#include "LBM/D3Q27.h" #include "Parameter/Parameter.h" #include "basics/utilities/UbSystem.h" -#include "Core/StringUtilities/StringUtil.h" #include <basics/writer/WbWriterVtkXmlBinary.h> +#include <cmath> - -//using namespace std; +#include "VirtualFluids_GPU/Communication/Communicator.h" namespace InterfaceDebugWriter { - void writeGridInterfaceLines(Parameter* para, int level, const uint* coarse, const uint* fine, uint numberOfNodes, const std::string& name) +void writeGridInterfaceLines(Parameter *para, int level, const uint *coarse, const uint *fine, uint numberOfNodes, + const std::string &name) +{ + std::vector<UbTupleFloat3> nodes(numberOfNodes * 2); + std::vector<UbTupleInt2> cells(numberOfNodes); + + int actualNodeNumber = 0; + for (uint u = 0; u < numberOfNodes; u++) { + const int posCoarse = coarse[u]; + const double x1Coarse = para->getParH(level)->coordinateX[posCoarse]; + const double x2Coarse = para->getParH(level)->coordinateY[posCoarse]; + const double x3Coarse = para->getParH(level)->coordinateZ[posCoarse]; + + const int posFine = fine[u]; + const double x1Fine = para->getParH(level + 1)->coordinateX[posFine]; + const double x2Fine = para->getParH(level + 1)->coordinateY[posFine]; + const double x3Fine = para->getParH(level + 1)->coordinateZ[posFine]; + + nodes[actualNodeNumber++] = makeUbTuple(float(x1Coarse), float(x2Coarse), float(x3Coarse)); + nodes[actualNodeNumber++] = makeUbTuple(float(x1Fine), float(x2Fine), float(x3Fine)); + + cells[u] = makeUbTuple(actualNodeNumber - 2, actualNodeNumber - 1); + } + WbWriterVtkXmlBinary::getInstance()->writeLines(name, nodes, cells); +} + +void writeInterfaceLinesDebugCF(Parameter *para) +{ + for (int level = 0; level < para->getMaxLevel(); level++) { + const std::string fileName = para->getFName() + "_" + StringUtil::toString<int>(level) + "_OffDebugCF.vtk"; + writeGridInterfaceLines(para, level, para->getParH(level)->intCF.ICellCFC, para->getParH(level)->intCF.ICellCFF, + para->getParH(level)->K_CF, fileName); + } +} + +void writeInterfaceLinesDebugFC(Parameter *para) +{ + for (int level = 0; level < para->getMaxLevel(); level++) { + const std::string fileName = para->getFName() + "_" + StringUtil::toString<int>(level) + "_OffDebugFC.vtk"; + writeGridInterfaceLines(para, level, para->getParH(level)->intFC.ICellFCC, para->getParH(level)->intFC.ICellFCF, + para->getParH(level)->K_FC, fileName); + } +} + +////////////////////////////////////////////////////////////////////////// +void writeGridInterfaceLinesNeighbors(Parameter *para, int level, const uint *interfaceIndices, uint numberOfNodes, + const std::string &name) +{ + std::vector<UbTupleFloat3> nodes(numberOfNodes * 2); + std::vector<UbTupleInt2> cells(numberOfNodes); + + int actualNodeNumber = 0; + for (uint u = 0; u < numberOfNodes; u++) { + const int pos = interfaceIndices[u]; + const double x1 = para->getParH(level)->coordinateX[pos]; + const double x2 = para->getParH(level)->coordinateY[pos]; + const double x3 = para->getParH(level)->coordinateZ[pos]; + + const double x1Neighbor = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[pos]]; + const double x2Neighbor = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[pos]]; + const double x3Neighbor = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[pos]]; + + nodes[actualNodeNumber++] = (makeUbTuple(float(x1), float(x2), float(x3))); + nodes[actualNodeNumber++] = (makeUbTuple(float(x1Neighbor), float(x2Neighbor), float(x3Neighbor))); + + cells[u] = makeUbTuple(actualNodeNumber - 2, actualNodeNumber - 1); + } + WbWriterVtkXmlBinary::getInstance()->writeLines(name, nodes, cells); +} + +void writeInterfaceLinesDebugCFCneighbor(Parameter *para) +{ + for (int level = 0; level < para->getMaxLevel(); level++) { + std::string filename = para->getFName() + "_" + StringUtil::toString<int>(level) + "_CFCneighbor.vtk"; + writeGridInterfaceLinesNeighbors(para, level, para->getParH(level)->intCF.ICellCFC, para->getParH(level)->K_CF, + filename); + } +} + +////////////////////////////////////////////////////////////////////////// +void writeInterfaceLinesDebugCFFneighbor(Parameter *para) +{ + for (int level = 0; level < para->getMaxLevel(); level++) { + std::string filename = para->getFName() + "_" + StringUtil::toString<int>(level) + "_CFFneighbor.vtk"; + writeGridInterfaceLinesNeighbors(para, level + 1, para->getParH(level)->intCF.ICellCFF, + para->getParH(level)->K_CF, filename); + } +} + +////////////////////////////////////////////////////////////////////////// +void writeInterfaceLinesDebugFCCneighbor(Parameter *para) +{ + for (int level = 0; level < para->getMaxLevel(); level++) { + std::string filename = para->getFName() + "_" + StringUtil::toString<int>(level) + "_FCCneighbor.vtk"; + writeGridInterfaceLinesNeighbors(para, level, para->getParH(level)->intFC.ICellFCC, para->getParH(level)->K_FC, + filename); + } +} + +////////////////////////////////////////////////////////////////////////// +void writeInterfaceLinesDebugFCFneighbor(Parameter *para) +{ + for (int level = 0; level < para->getMaxLevel(); level++) { + std::string filename = para->getFName() + "_" + StringUtil::toString<int>(level) + "_FCFneighbor.vtk"; + writeGridInterfaceLinesNeighbors(para, level + 1, para->getParH(level)->intFC.ICellFCF, + para->getParH(level)->K_FC, filename); + } +} + +////////////////////////////////////////////////////////////////////////// +void writeInterfaceLinesDebugOff(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + std::vector<UbTupleInt2> cellsVec; + int nodeNumberVec = 0; + + for (int level = 0; level < para->getMaxLevel(); level++) // evtl. Maxlevel + 1 { - std::vector<UbTupleFloat3> nodes(numberOfNodes * 2); - std::vector<UbTupleInt2> cells(numberOfNodes); - - int actualNodeNumber = 0; - for (uint u = 0; u < numberOfNodes; u++) - { - const int posCoarse = coarse[u]; - const double x1Coarse = para->getParH(level)->coordX_SP[posCoarse]; - const double x2Coarse = para->getParH(level)->coordY_SP[posCoarse]; - const double x3Coarse = para->getParH(level)->coordZ_SP[posCoarse]; - - const int posFine = fine[u]; - const double x1Fine = para->getParH(level + 1)->coordX_SP[posFine]; - const double x2Fine = para->getParH(level + 1)->coordY_SP[posFine]; - const double x3Fine = para->getParH(level + 1)->coordZ_SP[posFine]; - - nodes[actualNodeNumber++] = makeUbTuple(float(x1Coarse), float(x2Coarse), float(x3Coarse)); - nodes[actualNodeNumber++] = makeUbTuple(float(x1Fine), float(x2Fine), float(x3Fine)); - - cells[u] = makeUbTuple(actualNodeNumber - 2, actualNodeNumber - 1); + nodeNumberVec += (int)para->getParH(level)->K_CF; + } + nodesVec.resize(nodeNumberVec * 8); + int nodeCount = 0; + for (int level = 0; level < para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->K_CF; u++) { + double xoff = para->getParH(level)->offCF.xOffCF[u]; + double yoff = para->getParH(level)->offCF.yOffCF[u]; + double zoff = para->getParH(level)->offCF.zOffCF[u]; + + int posFine = para->getParH(level)->intCF.ICellCFF[u]; + + double x1Fine = para->getParH(level + 1)->coordinateX[posFine]; + double x2Fine = para->getParH(level + 1)->coordinateY[posFine]; + double x3Fine = para->getParH(level + 1)->coordinateZ[posFine]; + + double x1 = x1Fine + xoff; + double x2 = x2Fine + yoff; + double x3 = x3Fine + zoff; + + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1Fine), (float)(x2Fine), (float)(x3Fine))); + + cellsVec.push_back(makeUbTuple(nodeCount - 2, nodeCount - 1)); } - WbWriterVtkXmlBinary::getInstance()->writeLines(name, nodes, cells); + std::string filenameVec = para->getFName() + "_" + StringUtil::toString<int>(level) + "_OffDebugCF_Offs.vtk"; + WbWriterVtkXmlBinary::getInstance()->writeLines(filenameVec, nodesVec, cellsVec); + cellsVec.clear(); + nodesVec.clear(); } +} +////////////////////////////////////////////////////////////////////////// + +void writeInterfacePointsDebugCFC(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec2; + int nodeNumberVec = 0; - void writeInterfaceLinesDebugCF(Parameter* para) + for (int level = 0; level < para->getMaxLevel(); level++) // evtl. Maxlevel + 1 { - for (int level = 0; level < para->getMaxLevel(); level++) - { - const std::string fileName = para->getFName() + "_" + StringUtil::toString<int>(level) + "_OffDebugCF.vtk"; - writeGridInterfaceLines(para, level, para->getParH(level)->intCF.ICellCFC, para->getParH(level)->intCF.ICellCFF, para->getParH(level)->K_CF, fileName); - } - } + nodeNumberVec += (int)para->getParH(level)->K_CF; + } + nodesVec2.resize(nodeNumberVec * 8); + int nodeCount2 = 0; + for (int level = 0; level < para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->K_CF; u++) { + int pos = para->getParH(level)->intCF.ICellCFC[u]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; - void writeInterfaceLinesDebugFC(Parameter* para) + nodesVec2[nodeCount2++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + } + std::string filenameVec2 = para->getFName() + "_" + StringUtil::toString<int>(level) + "_OffDebugPointsCF.vtk"; + WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec2, nodesVec2); + } +} + +////////////////////////////////////////////////////////////////////////// + +void writeBcPointsDebug(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec2; + int nodeNumberVec = 0; + + for (int level = 0; level <= para->getMaxLevel(); level++) // evtl. Maxlevel + 1 { - for (int level = 0; level < para->getMaxLevel(); level++) - { - const std::string fileName = para->getFName() + "_" + StringUtil::toString<int>(level) + "_OffDebugFC.vtk"; - writeGridInterfaceLines(para, level, para->getParH(level)->intFC.ICellFCC, para->getParH(level)->intFC.ICellFCF, para->getParH(level)->K_FC, fileName); + nodeNumberVec += (int)para->getParH(level)->noSlipBC.numberOfBCnodes; + } + nodesVec2.resize(nodeNumberVec * 8); + int nodeCount2 = 0; + for (int level = 0; level <= para->getMaxLevel(); level++) { + for (uint u = 0; u < para->getParH(level)->noSlipBC.numberOfBCnodes; u++) { + int pos = para->getParH(level)->noSlipBC.k[u]; + + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + + nodesVec2[nodeCount2++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); } - } + std::string filenameVec2 = para->getFName() + "_PointsBc_" + StringUtil::toString<int>(level); + WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec2, nodesVec2); + } +} +////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - void writeGridInterfaceLinesNeighbors(Parameter* para, int level, const uint* interfaceIndices, uint numberOfNodes, const std::string& name) +void writePressPointsDebug(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + int nodeNumberVec = 0; + + for (int level = 0; level <= para->getMaxLevel(); level++) // evtl. Maxlevel + 1 { - std::vector<UbTupleFloat3> nodes(numberOfNodes * 2); - std::vector<UbTupleInt2> cells(numberOfNodes); - - int actualNodeNumber = 0; - for (uint u = 0; u < numberOfNodes; u++) - { - const int pos = interfaceIndices[u]; - const double x1 = para->getParH(level)->coordX_SP[pos]; - const double x2 = para->getParH(level)->coordY_SP[pos]; - const double x3 = para->getParH(level)->coordZ_SP[pos]; - - const double x1Neighbor = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[pos]]; - const double x2Neighbor = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[pos]]; - const double x3Neighbor = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[pos]]; - - nodes[actualNodeNumber++] = (makeUbTuple(float(x1), float(x2), float(x3))); - nodes[actualNodeNumber++] = (makeUbTuple(float(x1Neighbor), float(x2Neighbor), float(x3Neighbor))); - - cells[u] = makeUbTuple(actualNodeNumber - 2, actualNodeNumber - 1); + nodeNumberVec += (int)para->getParH(level)->pressureBC.numberOfBCnodes; + } + nodesVec.resize(nodeNumberVec); + int nodeCount2 = 0; + for (int level = 0; level <= para->getMaxLevel(); level++) { + for (uint u = 0; u < para->getParH(level)->pressureBC.numberOfBCnodes; u++) { + int pos = para->getParH(level)->pressureBC.k[u]; + + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + + nodesVec[nodeCount2++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + } + std::string filenameVec = para->getFName() + "_PointsPress_" + StringUtil::toString<int>(level); + WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec, nodesVec); + } +} + +////////////////////////////////////////////////////////////////////////// + +void writePressNeighborPointsDebug(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + int nodeNumberVec = 0; + + for (int level = 0; level <= para->getMaxLevel(); level++) { + nodeNumberVec += (int)para->getParH(level)->pressureBC.numberOfBCnodes; + } + nodesVec.resize(nodeNumberVec); + int nodeCount2 = 0; + for (int level = 0; level <= para->getMaxLevel(); level++) { + for (uint u = 0; u < para->getParH(level)->pressureBC.numberOfBCnodes; u++) { + int pos = para->getParH(level)->pressureBC.kN[u]; + + real x1 = para->getParH(level)->coordinateX[pos]; + real x2 = para->getParH(level)->coordinateY[pos]; + real x3 = para->getParH(level)->coordinateZ[pos]; + + nodesVec[nodeCount2++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + } + std::string filenameVec = para->getFName() + "_PointsPressNeighbor_" + StringUtil::toString<int>(level); + WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec, nodesVec); + } +} + +////////////////////////////////////////////////////////////////////////// + +void writeNeighborXPointsDebug(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + int nodeNumberVec = 0; + + for (int level = 0; level <= para->getMaxLevel(); level++) { + nodeNumberVec += (int)para->getParH(level)->numberOfNodes; + } + nodesVec.resize(nodeNumberVec); + int nodeCount2 = 0; + for (int level = 0; level <= para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->numberOfNodes; u++) { + real x1 = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[u]]; + real x2 = para->getParH(level)->coordinateY[para->getParH(level)->neighborX[u]]; + real x3 = para->getParH(level)->coordinateZ[para->getParH(level)->neighborX[u]]; + + nodesVec[nodeCount2++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + } + std::string filenameVec = para->getFName() + "_PointsNeighborX_" + StringUtil::toString<int>(level); + WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec, nodesVec); + } +} + +////////////////////////////////////////////////////////////////////////// + +void writeNeighborXLinesDebug(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + std::vector<UbTupleInt2> cellsVec; + int nodeNumberVec = 0; + + for (int level = 0; level < para->getMaxLevel(); level++) // evtl. Maxlevel + 1 + { + nodeNumberVec += (int)para->getParH(level)->numberOfNodes; + } + nodesVec.resize(nodeNumberVec * 2); + int nodeCount = 0; + for (int level = 0; level < para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->numberOfNodes; u++) { + real x1 = para->getParH(level)->coordinateX[u]; + real x2 = para->getParH(level)->coordinateY[u]; + real x3 = para->getParH(level)->coordinateZ[u]; + real x1N = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[u]]; + real x2N = para->getParH(level)->coordinateY[para->getParH(level)->neighborX[u]]; + real x3N = para->getParH(level)->coordinateZ[para->getParH(level)->neighborX[u]]; + + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1N), (float)(x2N), (float)(x3N))); + + if (para->getParH(level)->typeOfGridNode[u] == GEO_FLUID) { + cellsVec.push_back(makeUbTuple(nodeCount - 2, nodeCount - 1)); + } + } + std::string filenameVec = para->getFName() + "_" + StringUtil::toString<int>(level) + "_NeighborX_Lines.vtk"; + WbWriterVtkXmlBinary::getInstance()->writeLines(filenameVec, nodesVec, cellsVec); + } +} + +////////////////////////////////////////////////////////////////////////// + +void writeNeighborYPointsDebug(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + int nodeNumberVec = 0; + + for (int level = 0; level <= para->getMaxLevel(); level++) { + nodeNumberVec += (int)para->getParH(level)->numberOfNodes; + } + nodesVec.resize(nodeNumberVec); + int nodeCount2 = 0; + for (int level = 0; level <= para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->numberOfNodes; u++) { + real x1 = para->getParH(level)->coordinateX[para->getParH(level)->neighborY[u]]; + real x2 = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[u]]; + real x3 = para->getParH(level)->coordinateZ[para->getParH(level)->neighborY[u]]; + + nodesVec[nodeCount2++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); } - WbWriterVtkXmlBinary::getInstance()->writeLines(name, nodes, cells); + std::string filenameVec = para->getFName() + "_PointsNeighborY_" + StringUtil::toString<int>(level); + WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec, nodesVec); } +} - void writeInterfaceLinesDebugCFCneighbor(Parameter* para) +////////////////////////////////////////////////////////////////////////// + +void writeNeighborYLinesDebug(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + std::vector<UbTupleInt2> cellsVec; + int nodeNumberVec = 0; + + for (int level = 0; level < para->getMaxLevel(); level++) // evtl. Maxlevel + 1 { - for (int level = 0; level < para->getMaxLevel(); level++) - { - std::string filename = para->getFName() + "_" + StringUtil::toString<int>(level) + "_CFCneighbor.vtk"; - writeGridInterfaceLinesNeighbors(para, level, para->getParH(level)->intCF.ICellCFC, para->getParH(level)->K_CF, filename); - } - } + nodeNumberVec += (int)para->getParH(level)->numberOfNodes; + } + nodesVec.resize(nodeNumberVec * 2); + int nodeCount = 0; + for (int level = 0; level < para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->numberOfNodes; u++) { + real x1 = para->getParH(level)->coordinateX[u]; + real x2 = para->getParH(level)->coordinateY[u]; + real x3 = para->getParH(level)->coordinateZ[u]; + real x1N = para->getParH(level)->coordinateX[para->getParH(level)->neighborY[u]]; + real x2N = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[u]]; + real x3N = para->getParH(level)->coordinateZ[para->getParH(level)->neighborY[u]]; + + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1N), (float)(x2N), (float)(x3N))); + + if (para->getParH(level)->typeOfGridNode[u] == GEO_FLUID) { + cellsVec.push_back(makeUbTuple(nodeCount - 2, nodeCount - 1)); + } + } + std::string filenameVec = para->getFName() + "_" + StringUtil::toString<int>(level) + "_NeighborY_Lines.vtk"; + WbWriterVtkXmlBinary::getInstance()->writeLines(filenameVec, nodesVec, cellsVec); + } +} + +////////////////////////////////////////////////////////////////////////// +void writeNeighborZPointsDebug(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + int nodeNumberVec = 0; - ////////////////////////////////////////////////////////////////////////// - void writeInterfaceLinesDebugCFFneighbor(Parameter* para) + for (int level = 0; level <= para->getMaxLevel(); level++) { + nodeNumberVec += (int)para->getParH(level)->numberOfNodes; + } + nodesVec.resize(nodeNumberVec); + int nodeCount2 = 0; + for (int level = 0; level <= para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->numberOfNodes; u++) { + real x1 = para->getParH(level)->coordinateX[para->getParH(level)->neighborZ[u]]; + real x2 = para->getParH(level)->coordinateY[para->getParH(level)->neighborZ[u]]; + real x3 = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[u]]; + + nodesVec[nodeCount2++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + } + std::string filenameVec = para->getFName() + "_PointsNeighborZ_" + StringUtil::toString<int>(level); + WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec, nodesVec); + } +} + +////////////////////////////////////////////////////////////////////////// + +void writeNeighborZLinesDebug(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + std::vector<UbTupleInt2> cellsVec; + int nodeNumberVec = 0; + + for (int level = 0; level < para->getMaxLevel(); level++) // evtl. Maxlevel + 1 { - for (int level = 0; level < para->getMaxLevel(); level++) - { - std::string filename = para->getFName() + "_" + StringUtil::toString<int>(level) + "_CFFneighbor.vtk"; - writeGridInterfaceLinesNeighbors(para, level + 1, para->getParH(level)->intCF.ICellCFF, para->getParH(level)->K_CF, filename); + nodeNumberVec += (int)para->getParH(level)->numberOfNodes; + } + nodesVec.resize(nodeNumberVec * 2); + int nodeCount = 0; + for (int level = 0; level < para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->numberOfNodes; u++) { + real x1 = para->getParH(level)->coordinateX[u]; + real x2 = para->getParH(level)->coordinateY[u]; + real x3 = para->getParH(level)->coordinateZ[u]; + real x1N = para->getParH(level)->coordinateX[para->getParH(level)->neighborZ[u]]; + real x2N = para->getParH(level)->coordinateY[para->getParH(level)->neighborZ[u]]; + real x3N = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[u]]; + + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1N), (float)(x2N), (float)(x3N))); + + if (para->getParH(level)->typeOfGridNode[u] == GEO_FLUID) { + cellsVec.push_back(makeUbTuple(nodeCount - 2, nodeCount - 1)); + } } - } + std::string filenameVec = para->getFName() + "_" + StringUtil::toString<int>(level) + "_NeighborZ_Lines.vtk"; + WbWriterVtkXmlBinary::getInstance()->writeLines(filenameVec, nodesVec, cellsVec); + } +} + +////////////////////////////////////////////////////////////////////////// +void writeInterfaceCellsDebugCFC(Parameter *para) +{ - ////////////////////////////////////////////////////////////////////////// - void writeInterfaceLinesDebugFCCneighbor(Parameter* para) + std::vector<UbTupleFloat3> nodesVec; + std::vector<UbTupleInt8> cellsVec; + int nodeNumberVec = 0; + for (int level = 0; level < para->getMaxLevel(); level++) // evtl. Maxlevel + 1 { - for (int level = 0; level < para->getMaxLevel(); level++) - { - std::string filename = para->getFName() + "_" + StringUtil::toString<int>(level) + "_FCCneighbor.vtk"; - writeGridInterfaceLinesNeighbors(para, level, para->getParH(level)->intFC.ICellFCC, para->getParH(level)->K_FC, filename); + nodeNumberVec += (int)para->getParH(level)->K_CF; + } + nodesVec.resize(nodeNumberVec * 8); + int nodeCount = 0; + for (int level = 0; level < para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->K_CF; u++) { + int pos = para->getParH(level)->intCF.ICellCFC[u]; + + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + double x1P = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[pos]]; + double x2P = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[pos]]; + double x3P = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[pos]]; + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1P), (float)(x2), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1P), (float)(x2P), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2P), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3P))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1P), (float)(x2), (float)(x3P))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1P), (float)(x2P), (float)(x3P))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2P), (float)(x3P))); + + cellsVec.push_back(makeUbTuple(nodeCount - 8, nodeCount - 7, nodeCount - 6, nodeCount - 5, nodeCount - 4, + nodeCount - 3, nodeCount - 2, nodeCount - 1)); } - } + std::string filenameVec = para->getFName() + "_CellsCFC_" + StringUtil::toString<int>(level); + WbWriterVtkXmlBinary::getInstance()->writeOcts(filenameVec, nodesVec, cellsVec); + } +} +////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - void writeInterfaceLinesDebugFCFneighbor(Parameter* para) +void writeInterfaceCellsDebugCFF(Parameter *para) +{ + + std::vector<UbTupleFloat3> nodesVec; + std::vector<UbTupleInt8> cellsVec; + int nodeNumberVec = 0; + for (int level = 0; level < para->getMaxLevel(); level++) // evtl. Maxlevel + 1 { - for (int level = 0; level < para->getMaxLevel(); level++) - { - std::string filename = para->getFName() + "_" + StringUtil::toString<int>(level) + "_FCFneighbor.vtk"; - writeGridInterfaceLinesNeighbors(para, level + 1, para->getParH(level)->intFC.ICellFCF, para->getParH(level)->K_FC, filename); + nodeNumberVec += (int)para->getParH(level)->K_CF; + } + nodesVec.resize(nodeNumberVec * 8); + int nodeCount = 0; + for (int level = 0; level < para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->K_CF; u++) { + int pos = para->getParH(level)->intCF.ICellCFF[u]; + + double x1 = para->getParH(level + 1)->coordinateX[pos]; + double x2 = para->getParH(level + 1)->coordinateY[pos]; + double x3 = para->getParH(level + 1)->coordinateZ[pos]; + double x1P = para->getParH(level + 1)->coordinateX[para->getParH(level + 1)->neighborX[pos]]; + double x2P = para->getParH(level + 1)->coordinateY[para->getParH(level + 1)->neighborY[pos]]; + double x3P = para->getParH(level + 1)->coordinateZ[para->getParH(level + 1)->neighborZ[pos]]; + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1P), (float)(x2), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1P), (float)(x2P), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2P), (float)(x3))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3P))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1P), (float)(x2), (float)(x3P))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1P), (float)(x2P), (float)(x3P))); + nodesVec[nodeCount++] = (makeUbTuple((float)(x1), (float)(x2P), (float)(x3P))); + + cellsVec.push_back(makeUbTuple(nodeCount - 8, nodeCount - 7, nodeCount - 6, nodeCount - 5, nodeCount - 4, + nodeCount - 3, nodeCount - 2, nodeCount - 1)); } - } - - - ////////////////////////////////////////////////////////////////////////// - void writeInterfaceLinesDebugOff(Parameter* para){ - std::vector< UbTupleFloat3 > nodesVec; - std::vector< UbTupleInt2 > cellsVec; - int nodeNumberVec = 0; - - for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 - { - nodeNumberVec += (int)para->getParH(level)->K_CF; - } - nodesVec.resize(nodeNumberVec*8); - int nodeCount = 0; - for (int level = 0; level < para->getMaxLevel(); level++) - { - for(unsigned int u=0;u<para->getParH(level)->K_CF;u++) - { - double xoff = para->getParH(level)->offCF.xOffCF[u]; - double yoff = para->getParH(level)->offCF.yOffCF[u]; - double zoff = para->getParH(level)->offCF.zOffCF[u]; + std::string filenameVec = para->getFName() + "_CellsCFF_" + StringUtil::toString<int>(level); + WbWriterVtkXmlBinary::getInstance()->writeOcts(filenameVec, nodesVec, cellsVec); + } +} + + - int posFine = para->getParH(level)->intCF.ICellCFF[u]; - - double x1Fine = para->getParH(level+1)->coordX_SP[posFine]; - double x2Fine = para->getParH(level+1)->coordY_SP[posFine]; - double x3Fine = para->getParH(level+1)->coordZ_SP[posFine]; - - double x1 = x1Fine + xoff; - double x2 = x2Fine + yoff; - double x3 = x3Fine + zoff; - - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1),(float)(x2),(float)(x3) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1Fine),(float)(x2Fine),(float)(x3Fine) ) ); - - cellsVec.push_back( makeUbTuple(nodeCount-2,nodeCount-1) ); - - } - std::string filenameVec = para->getFName()+"_"+StringUtil::toString<int>(level)+"_OffDebugCF_Offs.vtk"; - WbWriterVtkXmlBinary::getInstance()->writeLines(filenameVec,nodesVec,cellsVec); - cellsVec.clear(); - nodesVec.clear(); - } - } - ////////////////////////////////////////////////////////////////////////// - void writeInterfacePointsDebugCFC(Parameter* para){ - std::vector< UbTupleFloat3 > nodesVec2; - int nodeNumberVec = 0; - for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 - { - nodeNumberVec += (int)para->getParH(level)->K_CF; - } - nodesVec2.resize(nodeNumberVec*8); - int nodeCount2 = 0; - for (int level = 0; level < para->getMaxLevel(); level++) - { - for(unsigned int u=0;u<para->getParH(level)->K_CF;u++) - { - int pos = para->getParH(level)->intCF.ICellCFC[u]; - - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - - nodesVec2[nodeCount2++]=( makeUbTuple( (float)(x1),(float)(x2),(float)(x3) ) ); - - } - std::string filenameVec2 = para->getFName()+"_"+StringUtil::toString<int>(level)+"_OffDebugPointsCF.vtk"; - WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec2,nodesVec2); - } - } - ////////////////////////////////////////////////////////////////////////// - void writeBcPointsDebug(Parameter* para){ - std::vector< UbTupleFloat3 > nodesVec2; - int nodeNumberVec = 0; - - for (int level = 0; level <= para->getMaxLevel(); level++) //evtl. Maxlevel + 1 - { - nodeNumberVec += (int)para->getParH(level)->QWall.kQ; - } - nodesVec2.resize(nodeNumberVec*8); - int nodeCount2 = 0; - for (int level = 0; level <= para->getMaxLevel(); level++) - { - for(int u=0;u<para->getParH(level)->QWall.kQ;u++) - { - int pos = para->getParH(level)->QWall.k[u]; - - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - - nodesVec2[nodeCount2++]=( makeUbTuple( (float)(x1),(float)(x2),(float)(x3) ) ); - - } - std::string filenameVec2 = para->getFName()+"_PointsBc_"+StringUtil::toString<int>(level); - WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec2,nodesVec2); - } - } - - - ////////////////////////////////////////////////////////////////////////// - - - void writePressPointsDebug(Parameter* para){ - std::vector< UbTupleFloat3 > nodesVec; - int nodeNumberVec = 0; - - for (int level = 0; level <= para->getMaxLevel(); level++) //evtl. Maxlevel + 1 - { - nodeNumberVec += (int)para->getParH(level)->QPress.kQ; - } - nodesVec.resize(nodeNumberVec); - int nodeCount2 = 0; - for (int level = 0; level <= para->getMaxLevel(); level++) - { - for(int u=0;u<para->getParH(level)->QPress.kQ;u++) - { - int pos = para->getParH(level)->QPress.k[u]; - - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - - nodesVec[nodeCount2++]=( makeUbTuple( (float)(x1),(float)(x2),(float)(x3) ) ); - - } - std::string filenameVec = para->getFName()+"_PointsPress_"+StringUtil::toString<int>(level); - WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec,nodesVec); - } - } - - - ////////////////////////////////////////////////////////////////////////// - - - void writePressNeighborPointsDebug(Parameter* para){ - std::vector< UbTupleFloat3 > nodesVec; - int nodeNumberVec = 0; - - for (int level = 0; level <= para->getMaxLevel(); level++) - { - nodeNumberVec += (int)para->getParH(level)->QPress.kQ; - } - nodesVec.resize(nodeNumberVec); - int nodeCount2 = 0; - for (int level = 0; level <= para->getMaxLevel(); level++) - { - for(int u=0;u<para->getParH(level)->QPress.kQ;u++) - { - int pos = para->getParH(level)->QPress.kN[u]; - - real x1 = para->getParH(level)->coordX_SP[pos]; - real x2 = para->getParH(level)->coordY_SP[pos]; - real x3 = para->getParH(level)->coordZ_SP[pos]; - - nodesVec[nodeCount2++]=( makeUbTuple( (float)(x1),(float)(x2),(float)(x3) ) ); - } - std::string filenameVec = para->getFName()+"_PointsPressNeighbor_"+StringUtil::toString<int>(level); - WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec,nodesVec); - } - } - - - ////////////////////////////////////////////////////////////////////////// - - - void writeNeighborXPointsDebug(Parameter* para){ - std::vector< UbTupleFloat3 > nodesVec; - int nodeNumberVec = 0; - - for (int level = 0; level <= para->getMaxLevel(); level++) - { - nodeNumberVec += (int)para->getParH(level)->size_Mat_SP; - } - nodesVec.resize(nodeNumberVec); - int nodeCount2 = 0; - for (int level = 0; level <= para->getMaxLevel(); level++) - { - for(unsigned int u=0;u<para->getParH(level)->size_Mat_SP;u++) - { - real x1 = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[u]]; - real x2 = para->getParH(level)->coordY_SP[para->getParH(level)->neighborX_SP[u]]; - real x3 = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborX_SP[u]]; - - nodesVec[nodeCount2++]=( makeUbTuple( (float)(x1),(float)(x2),(float)(x3) ) ); - } - std::string filenameVec = para->getFName()+"_PointsNeighborX_"+StringUtil::toString<int>(level); - WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec,nodesVec); - } - } - - - ////////////////////////////////////////////////////////////////////////// - - - void writeNeighborXLinesDebug(Parameter* para){ - std::vector< UbTupleFloat3 > nodesVec; - std::vector< UbTupleInt2 > cellsVec; - int nodeNumberVec = 0; - - for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 - { - nodeNumberVec += (int)para->getParH(level)->size_Mat_SP; - } - nodesVec.resize(nodeNumberVec*2); - int nodeCount = 0; - for (int level = 0; level < para->getMaxLevel(); level++) - { - for(unsigned int u=0;u<para->getParH(level)->size_Mat_SP;u++) - { - real x1 = para->getParH(level)->coordX_SP[u]; - real x2 = para->getParH(level)->coordY_SP[u]; - real x3 = para->getParH(level)->coordZ_SP[u]; - real x1N = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[u]]; - real x2N = para->getParH(level)->coordY_SP[para->getParH(level)->neighborX_SP[u]]; - real x3N = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborX_SP[u]]; - - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1),(float)(x2),(float)(x3) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1N),(float)(x2N),(float)(x3N) ) ); - - if (para->getParH(level)->geoSP[u]==GEO_FLUID) - { - cellsVec.push_back( makeUbTuple(nodeCount-2,nodeCount-1) ); - } - - } - std::string filenameVec = para->getFName()+"_"+StringUtil::toString<int>(level)+"_NeighborX_Lines.vtk"; - WbWriterVtkXmlBinary::getInstance()->writeLines(filenameVec,nodesVec,cellsVec); - } - } - - - ////////////////////////////////////////////////////////////////////////// - - - void writeNeighborYPointsDebug(Parameter* para){ - std::vector< UbTupleFloat3 > nodesVec; - int nodeNumberVec = 0; - - for (int level = 0; level <= para->getMaxLevel(); level++) - { - nodeNumberVec += (int)para->getParH(level)->size_Mat_SP; - } - nodesVec.resize(nodeNumberVec); - int nodeCount2 = 0; - for (int level = 0; level <= para->getMaxLevel(); level++) - { - for(unsigned int u=0;u<para->getParH(level)->size_Mat_SP;u++) - { - real x1 = para->getParH(level)->coordX_SP[para->getParH(level)->neighborY_SP[u]]; - real x2 = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[u]]; - real x3 = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborY_SP[u]]; - - nodesVec[nodeCount2++]=( makeUbTuple( (float)(x1),(float)(x2),(float)(x3) ) ); - } - std::string filenameVec = para->getFName()+"_PointsNeighborY_"+StringUtil::toString<int>(level); - WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec,nodesVec); - } - } - - - ////////////////////////////////////////////////////////////////////////// - - - void writeNeighborYLinesDebug(Parameter* para){ - std::vector< UbTupleFloat3 > nodesVec; - std::vector< UbTupleInt2 > cellsVec; - int nodeNumberVec = 0; - - for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 - { - nodeNumberVec += (int)para->getParH(level)->size_Mat_SP; - } - nodesVec.resize(nodeNumberVec*2); - int nodeCount = 0; - for (int level = 0; level < para->getMaxLevel(); level++) - { - for(unsigned int u=0;u<para->getParH(level)->size_Mat_SP;u++) - { - real x1 = para->getParH(level)->coordX_SP[u]; - real x2 = para->getParH(level)->coordY_SP[u]; - real x3 = para->getParH(level)->coordZ_SP[u]; - real x1N = para->getParH(level)->coordX_SP[para->getParH(level)->neighborY_SP[u]]; - real x2N = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[u]]; - real x3N = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborY_SP[u]]; - - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1),(float)(x2),(float)(x3) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1N),(float)(x2N),(float)(x3N) ) ); - - if (para->getParH(level)->geoSP[u]==GEO_FLUID) - { - cellsVec.push_back( makeUbTuple(nodeCount-2,nodeCount-1) ); - } - - } - std::string filenameVec = para->getFName()+"_"+StringUtil::toString<int>(level)+"_NeighborY_Lines.vtk"; - WbWriterVtkXmlBinary::getInstance()->writeLines(filenameVec,nodesVec,cellsVec); - } - } - - - ////////////////////////////////////////////////////////////////////////// - - - void writeNeighborZPointsDebug(Parameter* para){ - std::vector< UbTupleFloat3 > nodesVec; - int nodeNumberVec = 0; - - for (int level = 0; level <= para->getMaxLevel(); level++) - { - nodeNumberVec += (int)para->getParH(level)->size_Mat_SP; - } - nodesVec.resize(nodeNumberVec); - int nodeCount2 = 0; - for (int level = 0; level <= para->getMaxLevel(); level++) - { - for(unsigned int u=0;u<para->getParH(level)->size_Mat_SP;u++) - { - real x1 = para->getParH(level)->coordX_SP[para->getParH(level)->neighborZ_SP[u]]; - real x2 = para->getParH(level)->coordY_SP[para->getParH(level)->neighborZ_SP[u]]; - real x3 = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[u]]; - - nodesVec[nodeCount2++]=( makeUbTuple( (float)(x1),(float)(x2),(float)(x3) ) ); - } - std::string filenameVec = para->getFName()+"_PointsNeighborZ_"+StringUtil::toString<int>(level); - WbWriterVtkXmlBinary::getInstance()->writeNodes(filenameVec,nodesVec); - } - } - - - ////////////////////////////////////////////////////////////////////////// - - - void writeNeighborZLinesDebug(Parameter* para){ - std::vector< UbTupleFloat3 > nodesVec; - std::vector< UbTupleInt2 > cellsVec; - int nodeNumberVec = 0; - - for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 - { - nodeNumberVec += (int)para->getParH(level)->size_Mat_SP; - } - nodesVec.resize(nodeNumberVec*2); - int nodeCount = 0; - for (int level = 0; level < para->getMaxLevel(); level++) - { - for(unsigned int u=0;u<para->getParH(level)->size_Mat_SP;u++) - { - real x1 = para->getParH(level)->coordX_SP[u]; - real x2 = para->getParH(level)->coordY_SP[u]; - real x3 = para->getParH(level)->coordZ_SP[u]; - real x1N = para->getParH(level)->coordX_SP[para->getParH(level)->neighborZ_SP[u]]; - real x2N = para->getParH(level)->coordY_SP[para->getParH(level)->neighborZ_SP[u]]; - real x3N = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[u]]; - - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1),(float)(x2),(float)(x3) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1N),(float)(x2N),(float)(x3N) ) ); - - if (para->getParH(level)->geoSP[u]==GEO_FLUID) - { - cellsVec.push_back( makeUbTuple(nodeCount-2,nodeCount-1) ); - } - - } - std::string filenameVec = para->getFName()+"_"+StringUtil::toString<int>(level)+"_NeighborZ_Lines.vtk"; - WbWriterVtkXmlBinary::getInstance()->writeLines(filenameVec,nodesVec,cellsVec); - } - } - - - ////////////////////////////////////////////////////////////////////////// - - - void writeInterfaceCellsDebugCFC(Parameter* para){ - - std::vector< UbTupleFloat3 > nodesVec; - std::vector< UbTupleInt8 > cellsVec; - int nodeNumberVec = 0; - for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 - { - nodeNumberVec += (int)para->getParH(level)->K_CF; - } - nodesVec.resize(nodeNumberVec*8); - int nodeCount = 0; - for (int level = 0; level < para->getMaxLevel(); level++) - { - for(unsigned int u=0;u<para->getParH(level)->K_CF;u++) - { - int pos = para->getParH(level)->intCF.ICellCFC[u]; - - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - double x1P = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[pos]]; - double x2P = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[pos]]; - double x3P = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[pos]]; - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3 ) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1P),(float)(x2 ),(float)(x3 ) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1P),(float)(x2P),(float)(x3 ) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1 ),(float)(x2P),(float)(x3 ) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3P) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1P),(float)(x2 ),(float)(x3P) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1P),(float)(x2P),(float)(x3P) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1 ),(float)(x2P),(float)(x3P) ) ); - - cellsVec.push_back( makeUbTuple(nodeCount-8,nodeCount-7,nodeCount-6,nodeCount-5,nodeCount-4,nodeCount-3,nodeCount-2,nodeCount-1) ); - - } - std::string filenameVec = para->getFName()+"_CellsCFC_"+StringUtil::toString<int>(level); - WbWriterVtkXmlBinary::getInstance()->writeOcts(filenameVec,nodesVec,cellsVec); - } - } - - - ////////////////////////////////////////////////////////////////////////// - - - void writeInterfaceCellsDebugCFF(Parameter* para){ - - std::vector< UbTupleFloat3 > nodesVec; - std::vector< UbTupleInt8 > cellsVec; - int nodeNumberVec = 0; - for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 - { - nodeNumberVec += (int)para->getParH(level)->K_CF; - } - nodesVec.resize(nodeNumberVec*8); - int nodeCount = 0; - for (int level = 0; level < para->getMaxLevel(); level++) - { - for(unsigned int u=0;u<para->getParH(level)->K_CF;u++) - { - int pos = para->getParH(level )->intCF.ICellCFF[u]; - - double x1 = para->getParH(level+1)->coordX_SP[pos]; - double x2 = para->getParH(level+1)->coordY_SP[pos]; - double x3 = para->getParH(level+1)->coordZ_SP[pos]; - double x1P = para->getParH(level+1)->coordX_SP[para->getParH(level+1)->neighborX_SP[pos]]; - double x2P = para->getParH(level+1)->coordY_SP[para->getParH(level+1)->neighborY_SP[pos]]; - double x3P = para->getParH(level+1)->coordZ_SP[para->getParH(level+1)->neighborZ_SP[pos]]; - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3 ) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1P),(float)(x2 ),(float)(x3 ) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1P),(float)(x2P),(float)(x3 ) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1 ),(float)(x2P),(float)(x3 ) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3P) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1P),(float)(x2 ),(float)(x3P) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1P),(float)(x2P),(float)(x3P) ) ); - nodesVec[nodeCount++]=( makeUbTuple( (float)(x1 ),(float)(x2P),(float)(x3P) ) ); - - cellsVec.push_back( makeUbTuple(nodeCount-8,nodeCount-7,nodeCount-6,nodeCount-5,nodeCount-4,nodeCount-3,nodeCount-2,nodeCount-1) ); - - } - std::string filenameVec = para->getFName()+"_CellsCFF_"+StringUtil::toString<int>(level); - WbWriterVtkXmlBinary::getInstance()->writeOcts(filenameVec,nodesVec,cellsVec); - } - } +////////////////////////////////////////////////////////////////////////// +// Functions for version with streams +////////////////////////////////////////////////////////////////////////// +void checkForSendOrRecvNode(int pos, int &commDir, int &commDirectionInCommAfterFtoC, int& indexInCommVector, + std::vector<ProcessNeighbor27> &sendRecvProcessNeighbor, + std::vector<ProcessNeighbor27> &sendRecvProcessNeighborsAfterFtoC, double indicator) +{ + for (uint pn = 0; pn < (uint)sendRecvProcessNeighbor.size(); pn++) { + for (int j = 0; j < sendRecvProcessNeighbor[pn].numberOfNodes; j++) { + if (pos == sendRecvProcessNeighbor[pn].index[j]) { + commDir = indicator; + indexInCommVector = j; + if (j < sendRecvProcessNeighborsAfterFtoC[pn].numberOfNodes) { + commDirectionInCommAfterFtoC = indicator; + } + return; + } + } + } +} + +void checkForRecvNodeX(int pos, int &recvDir, int &recvDirectionInCommAfterFtoC, int& recvIndex, Parameter *para, int level) +{ + checkForSendOrRecvNode(pos, recvDir, recvDirectionInCommAfterFtoC, recvIndex, para->getParH(level)->recvProcessNeighborX, + para->getParH(level)->recvProcessNeighborsAfterFtoCX, 2.0); +} + +void checkForRecvNodeY(int pos, int &recvDir, int &recvDirectionInCommAfterFtoC, int& recvIndex, Parameter *para, int level) +{ + checkForSendOrRecvNode(pos, recvDir, recvDirectionInCommAfterFtoC, recvIndex, para->getParH(level)->recvProcessNeighborY, + para->getParH(level)->recvProcessNeighborsAfterFtoCY, 4.0); +} + +void checkForRecvNodeZ(int pos, int &recvDir, int &recvDirectionInCommAfterFtoC, int& recvIndex, Parameter *para, int level) +{ + checkForSendOrRecvNode(pos, recvDir, recvDirectionInCommAfterFtoC, recvIndex, para->getParH(level)->recvProcessNeighborZ, + para->getParH(level)->recvProcessNeighborsAfterFtoCZ, 8.0); +} + +void checkForSendNodeX(int pos, int &sendDir, int &sendDirectionInCommAfterFtoC, int& sendIndex, Parameter *para, int level) +{ + checkForSendOrRecvNode(pos, sendDir, sendDirectionInCommAfterFtoC, sendIndex, para->getParH(level)->sendProcessNeighborX, + para->getParH(level)->sendProcessNeighborsAfterFtoCX, 2.0); +} + +void checkForSendNodeY(int pos, int &sendDir, int &sendDirectionInCommAfterFtoC, int& sendIndex, Parameter *para, int level) +{ + checkForSendOrRecvNode(pos, sendDir, sendDirectionInCommAfterFtoC, sendIndex, para->getParH(level)->sendProcessNeighborY, + para->getParH(level)->sendProcessNeighborsAfterFtoCY, 4.0); +} + +void checkForSendNodeZ(int pos, int &sendDir, int &sendDirectionInCommAfterFtoC, int& sendIndex, Parameter *para, int level) +{ + checkForSendOrRecvNode(pos, sendDir, sendDirectionInCommAfterFtoC, sendIndex, para->getParH(level)->sendProcessNeighborZ, + para->getParH(level)->sendProcessNeighborsAfterFtoCZ, 8.0); +} + +void writeInterfaceFCC_Send(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + int nodeNumberVec = 0; + + // nodedata + std::vector<std::string> datanames = { "sparse index", "borderBulk", "sendDirection", + "sendDirectionInCommAfterFtoC", "sendIndex" }; + // sendDirection: x = 2, y = 4, z = 8 + // borderBulk: border = 1, bulk = 0 + std::vector<std::vector<double>> nodedata; + + for (int level = 0; level < para->getMaxLevel(); level++) { + nodeNumberVec += (int)para->getParH(level)->intFC.kFC; + } + + nodesVec.resize(nodeNumberVec); + nodedata.resize(datanames.size(), std::vector<double>(nodeNumberVec)); + + int nodeCount = 0; + for (int level = 0; level < para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->intFC.kFC; u++) { + int pos = para->getParH(level)->intFC.ICellFCC[u]; + nodedata[0][nodeCount] = pos; + + // coordinate section + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + nodesVec[nodeCount] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + + // nodedata section + nodedata[1][nodeCount] = u < para->getParH(level)->intFCBorder.kFC; + int sendDir = 0.0; + int sendDirectionInCommAfterFtoC = 0.0; + int sendIndex = 0.0; + + checkForSendNodeX(pos, sendDir, sendIndex, sendDirectionInCommAfterFtoC, para, level); + checkForSendNodeY(pos, sendDir, sendIndex, sendDirectionInCommAfterFtoC, para, level); + checkForSendNodeZ(pos, sendDir, sendIndex, sendDirectionInCommAfterFtoC, para, level); + nodedata[2][nodeCount] = sendDir; + nodedata[3][nodeCount] = sendDirectionInCommAfterFtoC; + nodedata[4][nodeCount] = sendIndex; + + nodeCount++; + } + std::string filenameVec = para->getFName() + "_writeInterfaceFCC_Send_PID_" + + std::to_string(vf::gpu::Communicator::getInstance().getPID()) + "_" + + StringUtil::toString<int>(level); + + WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); + } +} + +void writeInterfaceCFC_Recv(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + int nodeNumberVec = 0; + + // nodedata + std::vector<std::string> datanames = { "sparse index", "borderBulk", "recvDirection", + "recvDirectionInCommAfterFtoC", "recvIndex"}; + // recvDirection: x = 2, y = 4, z = 8 + // borderBulk: border = 1, bulk = 0 + std::vector<std::vector<double>> nodedata; + + for (int level = 0; level < para->getMaxLevel(); level++) { + nodeNumberVec += (int)para->getParH(level)->intCF.kCF; + } + + nodesVec.resize(nodeNumberVec); + nodedata.resize(datanames.size(), std::vector<double>(nodeNumberVec)); + + int nodeCount = 0; + for (int level = 0; level < para->getMaxLevel(); level++) { + for (unsigned int u = 0; u < para->getParH(level)->intCF.kCF; u++) { + int pos = para->getParH(level)->intCF.ICellCFC[u]; + nodedata[0][nodeCount] = pos; + + // coordinate section + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + nodesVec[nodeCount] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); + + // nodedata section + nodedata[1][nodeCount] = u < para->getParH(level)->intCFBorder.kCF; + int recvDir = 0.0; + int recvDirectionInCommAfterFtoC = 0.0; + int recvIndex = 0.0; + + checkForRecvNodeX(pos, recvDir, recvIndex, recvDirectionInCommAfterFtoC, para, level); + checkForRecvNodeY(pos, recvDir, recvIndex, recvDirectionInCommAfterFtoC, para, level); + checkForRecvNodeZ(pos, recvDir, recvIndex, recvDirectionInCommAfterFtoC, para, level); + nodedata[2][nodeCount] = recvDir; + nodedata[3][nodeCount] = recvDirectionInCommAfterFtoC; + nodedata[4][nodeCount] = recvIndex; + nodeCount++; + } + std::string filenameVec = para->getFName() + "_writeInterfaceCFC_Recv_PID_" + + std::to_string(vf::gpu::Communicator::getInstance().getPID()) + "_" + + StringUtil::toString<int>(level); + + WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); + } +} + +void addToNodesVector(const int level, const int pos, std::vector<UbTupleFloat3> &nodesVec, Parameter *para) +{ + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + nodesVec.push_back(makeUbTuple((float)(x1), (float)(x2), (float)(x3))); +} + +void writeSendNodesStream(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + + // nodedata + std::vector<std::string> datanames = { "sparse index", "sendDirection", "sendDirectionInCommAfterFtoC", "sendIndex", + "inICcellFCC" }; + // sendDirection: x = 2, y = 4, z = 8 + std::vector<std::vector<double>> nodedata; + nodedata.resize(datanames.size()); + + int pos; + int sendDirectionInCommAfterFtoC; + for (int level = 0; level < para->getMaxLevel(); level++) { + // X + for (int pn = 0; pn < (int)para->getParH(level)->sendProcessNeighborX.size(); pn++) { + for (int i = 0; i < para->getParH(level)->sendProcessNeighborX[pn].numberOfNodes; i++) { + pos = para->getParH(level)->sendProcessNeighborX[pn].index[i]; + nodedata[0].push_back(pos); + addToNodesVector(level, pos, nodesVec, para); + + nodedata[1].push_back(2.0); + sendDirectionInCommAfterFtoC = + (i < para->getParH(level)->sendProcessNeighborsAfterFtoCX[pn].numberOfNodes) ? 2.0 : 0.0; + nodedata[2].push_back(sendDirectionInCommAfterFtoC); + nodedata[3].push_back((double)i); + } + } + + // Y + for (int pn = 0; pn < (int)para->getParH(level)->sendProcessNeighborY.size(); pn++) { + for (int i = 0; i < para->getParH(level)->sendProcessNeighborY[pn].numberOfNodes; i++) { + pos = para->getParH(level)->sendProcessNeighborY[pn].index[i]; + + sendDirectionInCommAfterFtoC = + (i < para->getParH(level)->sendProcessNeighborsAfterFtoCY[pn].numberOfNodes) ? 4.0 : 0.0; + + auto it = std::find(nodedata[0].begin(), nodedata[0].end(), pos); + if (it == nodedata[0].end()) { + nodedata[0].push_back(pos); + addToNodesVector(level, pos, nodesVec, para); + nodedata[1].push_back(4.0); + nodedata[2].push_back(sendDirectionInCommAfterFtoC); + nodedata[3].push_back((double) i); + } else { + int posInVectors = it - nodedata[0].begin(); + nodedata[1][posInVectors] += 4.0; + nodedata[2][posInVectors] += sendDirectionInCommAfterFtoC; + nodedata[3][posInVectors] = (double)i; + } + } + } + + // Z + for (int pn = 0; pn < (int)para->getParH(level)->sendProcessNeighborZ.size(); pn++) { + for (int i = 0; i < para->getParH(level)->sendProcessNeighborZ[pn].numberOfNodes; i++) { + pos = para->getParH(level)->sendProcessNeighborZ[pn].index[i]; + + sendDirectionInCommAfterFtoC = + (i < para->getParH(level)->sendProcessNeighborsAfterFtoCZ[pn].numberOfNodes) ? 8.0 : 0.0; + + auto it = std::find(nodedata[0].begin(), nodedata[0].end(), pos); + if (it == nodedata[0].end()) { + nodedata[0].push_back(pos); + addToNodesVector(level, pos, nodesVec, para); + nodedata[1].push_back(8.0); + nodedata[2].push_back(sendDirectionInCommAfterFtoC); + nodedata[3].push_back((double) i); + } else { + int posInVectors = it - nodedata[0].begin(); + nodedata[1][posInVectors] += 8.0; + nodedata[2][posInVectors] += sendDirectionInCommAfterFtoC; + nodedata[3][posInVectors] = (double)i; + } + } + } + + // check if node is in iCellFCC + nodedata[4].resize(nodedata[0].size()); + for (int i = 0; i < (int)nodedata[0].size(); i++) { + pos = nodedata[0][i]; + for (unsigned int u = 0; u < para->getParH(level)->intFC.kFC; u++) { + if (para->getParH(level)->intFC.ICellFCC[u] == (uint)pos) { + nodedata[4][i] = 1.0; + break; + } + nodedata[4][i] = 0.0; + } + } + std::string filenameVec = para->getFName() + "_writeSendNodesStreams_PID_" + + std::to_string(vf::gpu::Communicator::getInstance().getPID()) + "_" + + StringUtil::toString<int>(level); + + WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); + } +} + +void writeRecvNodesStream(Parameter *para) +{ + std::vector<UbTupleFloat3> nodesVec; + + // nodedata + std::vector<std::string> datanames = { "sparse index", "recvDirection", "recvDirectionInCommAfterFtoC", "recvIndex" }; + // sendDirection: x = 2, y = 4, z = 8 + std::vector<std::vector<double>> nodedata; + nodedata.resize(datanames.size()); + + int pos; + int recvDirectionInCommAfterFtoC; + for (int level = 0; level < para->getMaxLevel(); level++) { + // X + for (int pn = 0; pn < (int)para->getParH(level)->recvProcessNeighborX.size(); pn++) { + for (int i = 0; i < para->getParH(level)->recvProcessNeighborX[pn].numberOfNodes; i++) { + pos = para->getParH(level)->recvProcessNeighborX[pn].index[i]; + nodedata[0].push_back(pos); + addToNodesVector(level, pos, nodesVec, para); + + nodedata[1].push_back(2.0); + recvDirectionInCommAfterFtoC = + (i < para->getParH(level)->recvProcessNeighborsAfterFtoCX[pn].numberOfNodes) ? 2.0 : 0.0; + nodedata[2].push_back(recvDirectionInCommAfterFtoC); + nodedata[3].push_back(i); + } + } + + // Y + for (int pn = 0; pn < (int)para->getParH(level)->recvProcessNeighborY.size(); pn++) { + for (int i = 0; i < para->getParH(level)->recvProcessNeighborY[pn].numberOfNodes; i++) { + pos = para->getParH(level)->recvProcessNeighborY[pn].index[i]; + + recvDirectionInCommAfterFtoC = + (i < para->getParH(level)->recvProcessNeighborsAfterFtoCY[pn].numberOfNodes) ? 4.0 : 0.0; + + auto it = std::find(nodedata[0].begin(), nodedata[0].end(), pos); + if (it == nodedata[0].end()) { + nodedata[0].push_back(pos); + addToNodesVector(level, pos, nodesVec, para); + nodedata[1].push_back(4.0); + nodedata[2].push_back(recvDirectionInCommAfterFtoC); + nodedata[3].push_back(i); + } else { + int posInVectors = it - nodedata[0].begin(); + nodedata[1][posInVectors] += 4.0; + nodedata[2][posInVectors] += recvDirectionInCommAfterFtoC; + nodedata[3][posInVectors] += i; + } + } + } + + // Z + for (int pn = 0; pn < (int)para->getParH(level)->recvProcessNeighborZ.size(); pn++) { + for (int i = 0; i < para->getParH(level)->recvProcessNeighborZ[pn].numberOfNodes; i++) { + pos = para->getParH(level)->recvProcessNeighborZ[pn].index[i]; + + recvDirectionInCommAfterFtoC = + (i < para->getParH(level)->recvProcessNeighborsAfterFtoCZ[pn].numberOfNodes) ? 8.0 : 0.0; + + auto it = std::find(nodedata[0].begin(), nodedata[0].end(), pos); + if (it == nodedata[0].end()) { + nodedata[0].push_back(pos); + addToNodesVector(level, pos, nodesVec, para); + nodedata[1].push_back(8.0); + nodedata[2].push_back(recvDirectionInCommAfterFtoC); + nodedata[3].push_back(i); + } else { + int posInVectors = it - nodedata[0].begin(); + nodedata[1][posInVectors] += 8.0; + nodedata[2][posInVectors] += recvDirectionInCommAfterFtoC; + nodedata[3][posInVectors] += i; + } + } + } + + // Recv are nodes ghost nodes and therefore they can't be iCellCFCs + + std::string filenameVec = para->getFName() + "_writeRecvNodesStreams_PID_" + + std::to_string(vf::gpu::Communicator::getInstance().getPID()) + "_" + + StringUtil::toString<int>(level); + + WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); + } } +} // namespace InterfaceDebugWriter #endif diff --git a/src/gpu/VirtualFluids_GPU/Output/LogWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/LogWriter.hpp deleted file mode 100644 index cbce9a48cdc8ca36127ab61363fdb9a3dff9dec8..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Output/LogWriter.hpp +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef LOGWRITER_H -#define LOGWRITER_H - -#include <iostream> -#include <fstream> -//#include <string> - -//#include "Utilities/StringUtil.hpp" - - -//////////////////////////////////////////////////////////////////////////////// -class LogWriter -{ -public: - LogWriter() - { - consoleOut = false; - } - LogWriter(std::string fname) - { - consoleOut = false; - this->fname = fname; - } - void setName(std::string name) - { - this->fname = name; - } - void setConsoleOut(bool flag) - { - consoleOut = flag; - } - void clearLogFile() - { - ostr.open(fname.c_str(), std::ios_base::out); - if (ostr.bad()) - { - std::string exceptionText = "Error: Output file/directory not found! LogWriter::operator << \n"; - throw exceptionText; - } - ostr << ""; - ostr.close(); - } - template <typename T> - LogWriter& operator << (const T& arg) - { - ostr.open(fname.c_str(), std::ios_base::app); - if (ostr.bad()) - { - //std::cout << "Error: Output file/directory not found! LogWriter::operator <<" << std::endl; - //return *this; - std::string exceptionText = "Error: Output file/directory not found! LogWriter::operator << \n"; - throw exceptionText; - } - ostr << arg; - ostr.close(); - if(consoleOut) std::cout << arg << std::flush; - return *this; - } -protected: -private: - std::string fname; - std::ofstream ostr; - bool consoleOut; -}; - -#endif diff --git a/src/gpu/VirtualFluids_GPU/Output/MeasurePointWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/MeasurePointWriter.hpp index 0fee62e7d2fc5ddb3acc4188671c9cbd10e8f0a3..c4f5e1413860fd0ad4b548090b6ad72af6384765 100644 --- a/src/gpu/VirtualFluids_GPU/Output/MeasurePointWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/MeasurePointWriter.hpp @@ -10,7 +10,7 @@ //#include <cmath> //#include "LBM/LB.h" -//#include "LBM/D3Q27.h" +//#include "lbm/constants/D3Q27.h" #include <numeric> #include "basics/utilities/UbFileOutputASCII.h" #include "Parameter/Parameter.h" @@ -58,7 +58,7 @@ public: UbFileOutputASCII out(para->getFName() + "_timestep_" + st + "_level_" + sLevel + "_XY.dat"); - int numberNodes = (int)para->getParH(level)->size_Mat_SP; + int numberNodes = (int)para->getParH(level)->numberOfNodes; real deltaX = 1.0f / pow(2, level); real halfDx = deltaX / 2.0f; @@ -67,14 +67,14 @@ public: for (int u = 0; u < numberNodes; u++) { - if ((para->getParH(level)->geoSP[u] == GEO_FLUID) && - ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordZ_SP[u]) && - ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordZ_SP[u]) ) + if ((para->getParH(level)->typeOfGridNode[u] == GEO_FLUID) && + ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordinateZ[u]) && + ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordinateZ[u]) ) { - out.writeFloat((float)(para->getParH(level)->rho_SP[u])); - out.writeFloat((float)(para->getParH(level)->press_SP[u])); - out.writeFloat((float)(para->getParH(level)->coordX_SP[u])); - out.writeFloat((float)(para->getParH(level)->coordY_SP[u])); + out.writeFloat((float)(para->getParH(level)->rho[u])); + out.writeFloat((float)(para->getParH(level)->pressure[u])); + out.writeFloat((float)(para->getParH(level)->coordinateX[u])); + out.writeFloat((float)(para->getParH(level)->coordinateY[u])); out.writeLine(); } } @@ -91,7 +91,7 @@ public: UbFileOutputASCII out(para->getFName() + "_timestep_" + st + "_level_" + sLevel + "_YZ.dat"); - int numberNodes = (int)para->getParH(level)->size_Mat_SP; + int numberNodes = (int)para->getParH(level)->numberOfNodes; real deltaX = 1.0f / pow(2, level); real halfDx = deltaX / 2.0f; @@ -99,14 +99,14 @@ public: for (int u = 0; u < numberNodes; u++) { - if ((para->getParH(level)->geoSP[u] == GEO_FLUID) && - ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordX_SP[u]) && - ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordX_SP[u])) + if ((para->getParH(level)->typeOfGridNode[u] == GEO_FLUID) && + ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordinateX[u]) && + ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordinateX[u])) { - out.writeFloat((float)(para->getParH(level)->rho_SP[u])); - out.writeFloat((float)(para->getParH(level)->press_SP[u])); - out.writeFloat((float)(para->getParH(level)->coordY_SP[u])); - out.writeFloat((float)(para->getParH(level)->coordZ_SP[u])); + out.writeFloat((float)(para->getParH(level)->rho[u])); + out.writeFloat((float)(para->getParH(level)->pressure[u])); + out.writeFloat((float)(para->getParH(level)->coordinateY[u])); + out.writeFloat((float)(para->getParH(level)->coordinateZ[u])); out.writeLine(); } } @@ -123,7 +123,7 @@ public: UbFileOutputASCII out(para->getFName() + "_timestep_" + st + "_level_" + sLevel + "_XZ.dat"); - int numberNodes = (int)para->getParH(level)->size_Mat_SP; + int numberNodes = (int)para->getParH(level)->numberOfNodes; real deltaX = 1.0f / pow(2, level); real halfDx = deltaX / 2.0f; @@ -131,14 +131,14 @@ public: for (int u = 0; u < numberNodes; u++) { - if ((para->getParH(level)->geoSP[u] == GEO_FLUID) && - ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordY_SP[u]) && - ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordY_SP[u])) + if ((para->getParH(level)->typeOfGridNode[u] == GEO_FLUID) && + ((middleOfTheGrid - halfDx) <= para->getParH(level)->coordinateY[u]) && + ((middleOfTheGrid + halfDx) >= para->getParH(level)->coordinateY[u])) { - out.writeFloat((float)(para->getParH(level)->rho_SP[u])); - out.writeFloat((float)(para->getParH(level)->press_SP[u])); - out.writeFloat((float)(para->getParH(level)->coordX_SP[u])); - out.writeFloat((float)(para->getParH(level)->coordZ_SP[u])); + out.writeFloat((float)(para->getParH(level)->rho[u])); + out.writeFloat((float)(para->getParH(level)->pressure[u])); + out.writeFloat((float)(para->getParH(level)->coordinateX[u])); + out.writeFloat((float)(para->getParH(level)->coordinateZ[u])); out.writeLine(); } } @@ -276,15 +276,15 @@ public: out.writeLine(); out.writeString("Index Nx Ny Ny"); out.writeLine(); - int numberNodes = (int)para->getParH(level)->size_Mat_SP; + int numberNodes = (int)para->getParH(level)->numberOfNodes; out.writeInteger(numberNodes); out.writeLine(); for (int u = 0; u < numberNodes; u++) { out.writeInteger((int)(u)); - out.writeInteger((int)(para->getParH(level)->neighborX_SP[u])); - out.writeInteger((int)(para->getParH(level)->neighborY_SP[u])); - out.writeInteger((int)(para->getParH(level)->neighborZ_SP[u])); + out.writeInteger((int)(para->getParH(level)->neighborX[u])); + out.writeInteger((int)(para->getParH(level)->neighborY[u])); + out.writeInteger((int)(para->getParH(level)->neighborZ[u])); out.writeLine(); } out.writeLine(); diff --git a/src/gpu/VirtualFluids_GPU/Output/NeighborDebugWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/NeighborDebugWriter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..83f0a677b0012153cf079b466a333acc58bda6be --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Output/NeighborDebugWriter.hpp @@ -0,0 +1,61 @@ +#ifndef NEIGHBORDEBUG_HPP +#define NEIGHBORDEBUG_HPP + +#include "LBM/LB.h" +#include "Logger.h" +#include "Parameter/Parameter.h" +#include "basics/utilities/UbSystem.h" +#include "grid/NodeValues.h" +#include "lbm/constants/D3Q27.h" +#include <basics/writer/WbWriterVtkXmlBinary.h> + +#include "Utilities/FindNeighbors.h" +#include "VirtualFluids_GPU/Communication/Communicator.h" +#include "Core/StringUtilities/StringUtil.h" + +namespace NeighborDebugWriter +{ + +inline void writeNeighborLinkLines(Parameter *para, const int level, const uint numberOfNodes, const int direction, + const std::string &name) +{ + VF_LOG_INFO("Write node links in direction {}.", direction); + std::vector<UbTupleFloat3> nodes(numberOfNodes * 2); + std::vector<UbTupleInt2> cells(numberOfNodes); + + for (uint position = 0; position < numberOfNodes; position++) { + if (para->getParH(level)->typeOfGridNode[position] != GEO_FLUID) + continue; + + const double x1 = para->getParH(level)->coordinateX[position]; + const double x2 = para->getParH(level)->coordinateY[position]; + const double x3 = para->getParH(level)->coordinateZ[position]; + + const uint positionNeighbor = getNeighborIndex(para->getParH(level).get(), position, direction); + + const double x1Neighbor = para->getParH(level)->coordinateX[positionNeighbor]; + const double x2Neighbor = para->getParH(level)->coordinateY[positionNeighbor]; + const double x3Neighbor = para->getParH(level)->coordinateZ[positionNeighbor]; + + nodes.emplace_back(float(x1), float(x2), float(x3)); + nodes.emplace_back(float(x1Neighbor), float(x2Neighbor), float(x3Neighbor)); + + cells.emplace_back((int)nodes.size() - 2, (int)nodes.size() - 1); + } + WbWriterVtkXmlBinary::getInstance()->writeLines(name, nodes, cells); +} + +inline void writeNeighborLinkLinesDebug(Parameter *para) +{ + for (int level = 0; level <= para->getMaxLevel(); level++) { + for (int direction = vf::lbm::dir::STARTDIR; direction <= vf::lbm::dir::ENDDIR; direction++) { + const std::string fileName = para->getFName() + "_" + StringUtil::toString<int>(level) + "_Link_" + + std::to_string(direction) + "_Debug.vtk"; + writeNeighborLinkLines(para, level, para->getParH(level)->numberOfNodes, direction, fileName); + } + } +} + +} // namespace NeighborDebugWriter + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Output/PosVecIntWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/PosVecIntWriter.hpp index 6fb4c8e2f20a95b5f83a107a9b24341cceb2c5ca..a9207ed231e8d9667e57636a5a5fdd6b5aeab94f 100644 --- a/src/gpu/VirtualFluids_GPU/Output/PosVecIntWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/PosVecIntWriter.hpp @@ -10,7 +10,7 @@ //#include <cmath> //#include "LBM/LB.h" -//#include "LBM/D3Q27.h" +//#include "lbm/constants/D3Q27.h" #include "basics/utilities/UbFileOutputASCII.h" #include "Parameter/Parameter.h" diff --git a/src/gpu/VirtualFluids_GPU/Output/PosWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/PosWriter.hpp index 1a8de78a6eb69d6e6e1594a635cae3d55ea0233e..456f9c148c75c27fb899f976ba4f99b109fc3d4b 100644 --- a/src/gpu/VirtualFluids_GPU/Output/PosWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/PosWriter.hpp @@ -10,7 +10,7 @@ //#include <cmath> //#include "LBM/LB.h" -//#include "LBM/D3Q27.h" +//#include "lbm/constants/D3Q27.h" #include "basics/utilities/UbFileOutputASCII.h" #include "Parameter/Parameter.h" @@ -31,11 +31,11 @@ public: { for (int level = 0; level <= para->getMaxLevel(); level++) { - out.writeInteger(para->getParH(level)->size_Mat_SP); + out.writeInteger(para->getParH(level)->numberOfNodes); out.writeLine(); - for(unsigned int u=0; u<para->getParH(level)->size_Mat_SP; u++) + for(unsigned int u=0; u<para->getParH(level)->numberOfNodes; u++) { - out.writeInteger(para->getParH(level)->geoSP[u]); + out.writeInteger(para->getParH(level)->typeOfGridNode[u]); } out.writeLine(); } //end levelloop @@ -44,11 +44,11 @@ public: { for (int level = 0; level <= para->getMaxLevel(); level++) { - out.writeInteger(para->getParH(level)->size_Mat_SP); + out.writeInteger(para->getParH(level)->numberOfNodes); out.writeLine(); - for(unsigned int u=0; u<para->getParH(level)->size_Mat_SP; u++) + for(unsigned int u=0; u<para->getParH(level)->numberOfNodes; u++) { - out.writeInteger(para->getParH(level)->neighborX_SP[u]); + out.writeInteger(para->getParH(level)->neighborX[u]); } out.writeLine(); } //end levelloop @@ -57,11 +57,11 @@ public: { for (int level = 0; level <= para->getMaxLevel(); level++) { - out.writeInteger(para->getParH(level)->size_Mat_SP); + out.writeInteger(para->getParH(level)->numberOfNodes); out.writeLine(); - for(unsigned int u=0; u<para->getParH(level)->size_Mat_SP; u++) + for(unsigned int u=0; u<para->getParH(level)->numberOfNodes; u++) { - out.writeInteger(para->getParH(level)->neighborY_SP[u]); + out.writeInteger(para->getParH(level)->neighborY[u]); } out.writeLine(); } //end levelloop @@ -70,11 +70,11 @@ public: { for (int level = 0; level <= para->getMaxLevel(); level++) { - out.writeInteger(para->getParH(level)->size_Mat_SP); + out.writeInteger(para->getParH(level)->numberOfNodes); out.writeLine(); - for(unsigned int u=0; u<para->getParH(level)->size_Mat_SP; u++) + for(unsigned int u=0; u<para->getParH(level)->numberOfNodes; u++) { - out.writeInteger(para->getParH(level)->neighborZ_SP[u]); + out.writeInteger(para->getParH(level)->neighborZ[u]); } out.writeLine(); } //end levelloop diff --git a/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp index d0c15ec08b7c817538bef86323fe753437e40d30..d006636572377477aeb3599a8ae843ea2b1e31ff 100644 --- a/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp @@ -7,7 +7,7 @@ // #include <math.h> #include <cmath> #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include "Parameter/Parameter.h" #include "basics/utilities/UbSystem.h" #include <basics/writer/WbWriterVtkXmlBinary.h> diff --git a/src/gpu/VirtualFluids_GPU/Output/TimeStepTimer.cpp b/src/gpu/VirtualFluids_GPU/Output/TimeStepTimer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..78da4947d0c8196cda49fef754a3f44fc39d0a44 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Output/TimeStepTimer.cpp @@ -0,0 +1,64 @@ +#include "helper_cuda.h" +#include <cuda_runtime.h> +#include "Core/DataTypes.h" +#include "UbScheduler.h" +#include "Parameter/Parameter.h" + +#include "Timer.h" +#include "TimeStepTimer.h" + +void TimeStepTimer::startTotalTimer (uint t){ if(t%this->tActivate==0) this->totalTimer->startTimer(); } +void TimeStepTimer::stopTotalTimer (uint t){ if(t%this->tActivate==0) this->totalTimer->stopTimer(); } +void TimeStepTimer::startCollisionTimer (uint t){ if(t%this->tActivate==0) this->collisionTimer->startTimer(); } +void TimeStepTimer::stopCollisionTimer (uint t){ if(t%this->tActivate==0) this->collisionTimer->stopTimer(); } +void TimeStepTimer::startPostCollisionBCTimer (uint t){ if(t%this->tActivate==0) this->postCollisionBCTimer->startTimer(); } +void TimeStepTimer::stopPostCollisionBCTimer (uint t){ if(t%this->tActivate==0) this->postCollisionBCTimer->stopTimer(); } +void TimeStepTimer::startPreCollisionBCTimer (uint t){ if(t%this->tActivate==0) this->preCollisionBCTimer->startTimer(); } +void TimeStepTimer::stopPreCollisionBCTimer (uint t){ if(t%this->tActivate==0) this->preCollisionBCTimer->stopTimer(); } +void TimeStepTimer::startEddyViscosityTimer (uint t){ if(t%this->tActivate==0) this->eddyViscosityTimer->startTimer(); } +void TimeStepTimer::stopEddyViscosityTimer (uint t){ if(t%this->tActivate==0) this->eddyViscosityTimer->stopTimer(); } +void TimeStepTimer::startActuatorTimer (uint t){ if(t%this->tActivate==0) this->actuatorTimer->startTimer(); } +void TimeStepTimer::stopActuatorTimer (uint t){ if(t%this->tActivate==0) this->actuatorTimer->stopTimer(); } +void TimeStepTimer::startProbeTimer (uint t){ if(t%this->tActivate==0) this->probeTimer->startTimer(); } +void TimeStepTimer::stopProbeTimer (uint t){ if(t%this->tActivate==0) this->probeTimer->stopTimer(); } +void TimeStepTimer::startExchangeTimer (uint t){ if(t%this->tActivate==0) this->exchangeTimer->startTimer(); } +void TimeStepTimer::stopExchangeTimer (uint t){ if(t%this->tActivate==0) this->exchangeTimer->stopTimer(); } + + +void TimeStepTimer::resetTimers(uint t) +{ + if(t%this->tActivate==0) + { + this->totalTimer->resetTimer(); + this->collisionTimer->resetTimer(); + this->postCollisionBCTimer->resetTimer(); + this->preCollisionBCTimer->resetTimer(); + this->eddyViscosityTimer->resetTimer(); + this->actuatorTimer->resetTimer(); + this->probeTimer->resetTimer(); + } +} + +void TimeStepTimer::outputPerformance(uint t, Parameter* para) +{ + if(t%this->tActivate==0) + { + + float tCollision = this->collisionTimer->getTotalElapsedTime(); + float tPostCollisionBC = this->postCollisionBCTimer->getTotalElapsedTime(); + float tPreCollisionBC = this->preCollisionBCTimer->getTotalElapsedTime(); + float tEddyViscosity = this->eddyViscosityTimer->getTotalElapsedTime(); + float tAcutator = this->actuatorTimer->getTotalElapsedTime(); + float tProbe = this->probeTimer->getTotalElapsedTime(); + float tExchange = this->exchangeTimer->getTotalElapsedTime(); + float tTotal = tCollision+tPostCollisionBC+tPreCollisionBC+tEddyViscosity+tAcutator+tProbe+tExchange; + + VF_LOG_INFO(" --- Collision \t {}%", (tCollision/tTotal)*100 ); + VF_LOG_INFO(" --- PostCollisionBCs \t {}%", (tPostCollisionBC/tTotal)*100 ); + VF_LOG_INFO(" --- PreCollisionBCs \t {}%", (tPreCollisionBC/tTotal)*100 ); + VF_LOG_INFO(" --- Eddy viscosity \t {}%", (tEddyViscosity/tTotal)*100 ); + VF_LOG_INFO(" --- Actuators \t {}%", (tAcutator/tTotal)*100 ); + VF_LOG_INFO(" --- Probes \t\t {}%", (tProbe/tTotal)*100 ); + VF_LOG_INFO(" --- Data exchange \t {}%", (tExchange/tTotal)*100 ); + } +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Output/TimeStepTimer.h b/src/gpu/VirtualFluids_GPU/Output/TimeStepTimer.h new file mode 100644 index 0000000000000000000000000000000000000000..982d1ce56bfadb7eddfd3d34d8d6b01ac6f92233 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Output/TimeStepTimer.h @@ -0,0 +1,59 @@ +#ifndef TIMESTEPTIMER_H +#define TIMESTEPTIMER_H + +#include "helper_cuda.h" +#include <cuda_runtime.h> +#include "Core/DataTypes.h" +#include "UbScheduler.h" +#include "Parameter/Parameter.h" + +#include "Timer.h" + +class TimeStepTimer +{ + public: + TimeStepTimer(std::string _name, uint _tActivate): name(_name), tActivate(_tActivate) + { + + }; + + ~TimeStepTimer(){}; + + void startTotalTimer (uint t); + void stopTotalTimer (uint t); + void startCollisionTimer (uint t); + void stopCollisionTimer (uint t); + void startPostCollisionBCTimer (uint t); + void stopPostCollisionBCTimer (uint t); + void startPreCollisionBCTimer (uint t); + void stopPreCollisionBCTimer (uint t); + void startEddyViscosityTimer (uint t); + void stopEddyViscosityTimer (uint t); + void startActuatorTimer (uint t); + void stopActuatorTimer (uint t); + void startProbeTimer (uint t); + void stopProbeTimer (uint t); + void startExchangeTimer (uint t); + void stopExchangeTimer (uint t); + + void resetTimers(uint t); + void outputPerformance(uint t, Parameter* para); + + private: + + Timer* totalTimer = new Timer("total"); + Timer* collisionTimer = new Timer("collision"); + Timer* postCollisionBCTimer = new Timer("postCollisionBC"); + Timer* preCollisionBCTimer = new Timer("preCollisionBC"); + Timer* eddyViscosityTimer = new Timer("eddyViscosity"); + Timer* actuatorTimer = new Timer("actuator"); + Timer* probeTimer = new Timer("probes"); + Timer* exchangeTimer = new Timer("exchange"); + + std::string name; + uint tActivate; +}; + + + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Output/Timer.cpp b/src/gpu/VirtualFluids_GPU/Output/Timer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..74a706165489a86cace40047beb09996aa0aa8db --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Output/Timer.cpp @@ -0,0 +1,59 @@ +#include "Timer.h" +#include <iostream> +#include <helper_cuda.h> + +#include "UbScheduler.h" +#include "Parameter/Parameter.h" +#include "VirtualFluids_GPU/Communication/Communicator.h" + +void Timer::initTimer() +{ + cudaEventCreate(&this->start_t); + cudaEventCreate(&this->stop_t ); +} + +void Timer::startTimer() +{ + checkCudaErrors(cudaEventRecord(this->start_t)); +} + +void Timer::stopTimer() +{ + checkCudaErrors(cudaEventRecord(this->stop_t)); + checkCudaErrors(cudaEventSynchronize(this->stop_t)); + checkCudaErrors(cudaEventElapsedTime(&this->elapsedTime, this->start_t, this->stop_t)); + this->totalElapsedTime += this->elapsedTime; +} + +void Timer::resetTimer() +{ + this->elapsedTime = 0.0; + this->totalElapsedTime = 0.0; +} + +void Timer::outputPerformance(uint t, Parameter* para, vf::gpu::Communicator& communicator) +{ + real fnups = 0.0; + real bandwidth = 0.0; + + for (int lev=para->getCoarse(); lev <= para->getFine(); lev++) + { + fnups += 1000.0 * (t-para->getTimestepStart()) * para->getParH(lev)->numberOfNodes * pow(2.,lev) / (this->totalElapsedTime*1.0E6); + bandwidth += (27.0+1.0) * 4.0 * 1000.0 * (t-para->getTimestepStart()) * para->getParH(lev)->numberOfNodes / (this->totalElapsedTime*1.0E9); + } + + if(this->firstOutput && communicator.getPID() == 0) //only display the legend once + { + VF_LOG_INFO("PID \t --- {} --- Processing time (ms) \t Nups in Mio \t Bandwidth in GB/sec", this->name ); + this->firstOutput = false; + } + + VF_LOG_INFO(" {} \t --- {} --- {:>8.1f}/ {:<8.1f} \t {:5.1f} \t {:4.1f}", communicator.getPID(), this->name, this->elapsedTime, this->totalElapsedTime, fnups, bandwidth); + + // When using multiple GPUs, sum the nups of all processes + if (communicator.getNummberOfProcess() > 1) { + double nupsSum = communicator.sumNups(fnups); + if (communicator.getPID() == 0) + VF_LOG_INFO("Sum of all {} processes: Nups in Mio: {:.1f}", communicator.getNummberOfProcess(), nupsSum); + } +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Output/Timer.h b/src/gpu/VirtualFluids_GPU/Output/Timer.h new file mode 100644 index 0000000000000000000000000000000000000000..d035cbb6cef7ea9f8edabbd2894671a868c37eec --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Output/Timer.h @@ -0,0 +1,49 @@ +#ifndef TIMER_H +#define TIMER_H +#include <cuda_runtime.h> + +#include "Core/DataTypes.h" +#include "Parameter/Parameter.h" +#include "logger/Logger.h" + +namespace vf::gpu{ + class Communicator; +} +class Parameter; + +class Timer +{ + public: + Timer(std::string _name): name(_name) + { + this->initTimer(); + }; + + ~Timer() + { + cudaEventDestroy(this->start_t); + cudaEventDestroy(this->stop_t); + }; + + void initTimer(); + void startTimer(); + void stopTimer(); + void resetTimer(); + void outputPerformance(uint t, Parameter* para, vf::gpu::Communicator& communicator); + + float getElapsedTime(){ return this->elapsedTime; } + float getTotalElapsedTime(){ return this->totalElapsedTime; } + + private: + + cudaEvent_t start_t, stop_t; + float elapsedTime = 0.0; + float totalElapsedTime = 0.0; + std::string name; + + bool firstOutput = true; +}; + + + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp index e20fe79ab137ca13010062a9fde6e1add9b5f96f..81f2c028a6bbc7cd9c077571349f4f0465a08a05 100644 --- a/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp @@ -7,7 +7,7 @@ // #include <math.h> #include <cmath> #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include "Parameter/Parameter.h" #include "basics/utilities/UbSystem.h" #include <basics/writer/WbWriterVtkXmlBinary.h> @@ -33,7 +33,7 @@ namespace UnstructuredGridWriter bool neighborsFluid; - unsigned int allnodes = para->getParH(level)->size_Mat_SP * 8; + unsigned int allnodes = para->getParH(level)->numberOfNodes * 8; nodes.resize(allnodes); nodedata[0].resize(allnodes); @@ -45,17 +45,17 @@ namespace UnstructuredGridWriter unsigned int nodeCount = 0; double nodeDeltaLevel = para->getParH(level)->dx; - for (unsigned int pos=0;pos<para->getParH(level)->size_Mat_SP;pos++) + for (unsigned int pos=0;pos<para->getParH(level)->numberOfNodes;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID /*!= GEO_VOID*/) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID /*!= GEO_VOID*/) { ////////////////////////////////////////////////////////////////////////// - double ix1 = para->getParH(level)->coordX_SP[pos];//-STARTOFFX; - double ix2 = para->getParH(level)->coordY_SP[pos];//-STARTOFFY; - double ix3 = para->getParH(level)->coordZ_SP[pos];//-STARTOFFZ; - double ix1P = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[pos]];//-STARTOFFX; - double ix2P = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[pos]];//-STARTOFFY; - double ix3P = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[pos]];//-STARTOFFZ; + double ix1 = para->getParH(level)->coordinateX[pos];//-STARTOFFX; + double ix2 = para->getParH(level)->coordinateY[pos];//-STARTOFFY; + double ix3 = para->getParH(level)->coordinateZ[pos];//-STARTOFFZ; + double ix1P = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[pos]];//-STARTOFFX; + double ix2P = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[pos]];//-STARTOFFY; + double ix3P = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[pos]];//-STARTOFFZ; ////////////////////////////////////////////////////////////////////////// double x1 = ix1; // para->getParH(level)->distX + ix1 *nodeDeltaLevel;// + tmpDist; double x2 = ix2; // para->getParH(level)->distY + ix2 *nodeDeltaLevel;// + tmpDist; @@ -68,83 +68,83 @@ namespace UnstructuredGridWriter ////////////////////////////////////////////////////////////////////////// //1 nodes[nodeCount]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3 ) ) ); - nodedata[0][nodeCount] = para->getParH(level)->rho_SP[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[1][nodeCount] = para->getParH(level)->vx_SP[pos] * para->getVelocityRatio(); - nodedata[2][nodeCount] = para->getParH(level)->vy_SP[pos] * para->getVelocityRatio(); - nodedata[3][nodeCount] = para->getParH(level)->vz_SP[pos] * para->getVelocityRatio(); - nodedata[4][nodeCount] = para->getParH(level)->geoSP[pos]; - //if(para->getParH(level)->geoSP[pos]==GEO_VOID) neighborsFluid = false; + nodedata[0][nodeCount] = para->getParH(level)->rho[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[1][nodeCount] = para->getParH(level)->velocityX[pos] * para->getVelocityRatio(); + nodedata[2][nodeCount] = para->getParH(level)->velocityY[pos] * para->getVelocityRatio(); + nodedata[3][nodeCount] = para->getParH(level)->velocityZ[pos] * para->getVelocityRatio(); + nodedata[4][nodeCount] = para->getParH(level)->typeOfGridNode[pos]; + //if(para->getParH(level)->typeOfGridNode[pos]==GEO_VOID) neighborsFluid = false; nodeCount++; ////////////////////////////////////////////////////////////////////////// //2 nodes[nodeCount]=( makeUbTuple( (float)(x1P),(float)(x2 ),(float)(x3 ) ) ); - nodedata[0][nodeCount] = para->getParH(level)->rho_SP[para->getParH(level)->neighborX_SP[pos]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[1][nodeCount] = para->getParH(level)->vx_SP[para->getParH(level)->neighborX_SP[pos]] * para->getVelocityRatio(); - nodedata[2][nodeCount] = para->getParH(level)->vy_SP[para->getParH(level)->neighborX_SP[pos]] * para->getVelocityRatio(); - nodedata[3][nodeCount] = para->getParH(level)->vz_SP[para->getParH(level)->neighborX_SP[pos]] * para->getVelocityRatio(); - nodedata[4][nodeCount] = para->getParH(level)->geoSP[para->getParH(level)->neighborX_SP[pos]]; - //if(para->getParH(level)->geoSP[para->getParH(level)->neighborX_SP[pos]]==GEO_VOID) neighborsFluid = false; + nodedata[0][nodeCount] = para->getParH(level)->rho[para->getParH(level)->neighborX[pos]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[1][nodeCount] = para->getParH(level)->velocityX[para->getParH(level)->neighborX[pos]] * para->getVelocityRatio(); + nodedata[2][nodeCount] = para->getParH(level)->velocityY[para->getParH(level)->neighborX[pos]] * para->getVelocityRatio(); + nodedata[3][nodeCount] = para->getParH(level)->velocityZ[para->getParH(level)->neighborX[pos]] * para->getVelocityRatio(); + nodedata[4][nodeCount] = para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborX[pos]]; + //if(para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborX[pos]]==GEO_VOID) neighborsFluid = false; nodeCount++; ////////////////////////////////////////////////////////////////////////// //3 nodes[nodeCount]=( makeUbTuple( (float)(x1P),(float)(x2P),(float)(x3 ) ) ); - nodedata[0][nodeCount] = para->getParH(level)->rho_SP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[1][nodeCount] = para->getParH(level)->vx_SP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]] * para->getVelocityRatio(); - nodedata[2][nodeCount] = para->getParH(level)->vy_SP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]] * para->getVelocityRatio(); - nodedata[3][nodeCount] = para->getParH(level)->vz_SP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]] * para->getVelocityRatio(); - nodedata[4][nodeCount] = para->getParH(level)->geoSP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]]; - //if(para->getParH(level)->geoSP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]]==GEO_VOID) neighborsFluid = false; + nodedata[0][nodeCount] = para->getParH(level)->rho[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[1][nodeCount] = para->getParH(level)->velocityX[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]] * para->getVelocityRatio(); + nodedata[2][nodeCount] = para->getParH(level)->velocityY[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]] * para->getVelocityRatio(); + nodedata[3][nodeCount] = para->getParH(level)->velocityZ[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]] * para->getVelocityRatio(); + nodedata[4][nodeCount] = para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]]; + //if(para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]]==GEO_VOID) neighborsFluid = false; nodeCount++; ////////////////////////////////////////////////////////////////////////// //4 nodes[nodeCount]=( makeUbTuple( (float)(x1 ),(float)(x2P),(float)(x3 ) ) ); - nodedata[0][nodeCount] = para->getParH(level)->rho_SP[para->getParH(level)->neighborY_SP[pos]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[1][nodeCount] = para->getParH(level)->vx_SP[para->getParH(level)->neighborY_SP[pos]] * para->getVelocityRatio(); - nodedata[2][nodeCount] = para->getParH(level)->vy_SP[para->getParH(level)->neighborY_SP[pos]] * para->getVelocityRatio(); - nodedata[3][nodeCount] = para->getParH(level)->vz_SP[para->getParH(level)->neighborY_SP[pos]] * para->getVelocityRatio(); - nodedata[4][nodeCount] = para->getParH(level)->geoSP[para->getParH(level)->neighborY_SP[pos]]; - //if(para->getParH(level)->geoSP[para->getParH(level)->neighborY_SP[pos]]==GEO_VOID) neighborsFluid = false; - //if((para->getParH(level)->neighborY_SP[pos]<=pos) && ((para->getParH(level)->coordY_SP[pos]) > (para->getParH(level)->gridNY-2))) neighborsFluid = false; + nodedata[0][nodeCount] = para->getParH(level)->rho[para->getParH(level)->neighborY[pos]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[1][nodeCount] = para->getParH(level)->velocityX[para->getParH(level)->neighborY[pos]] * para->getVelocityRatio(); + nodedata[2][nodeCount] = para->getParH(level)->velocityY[para->getParH(level)->neighborY[pos]] * para->getVelocityRatio(); + nodedata[3][nodeCount] = para->getParH(level)->velocityZ[para->getParH(level)->neighborY[pos]] * para->getVelocityRatio(); + nodedata[4][nodeCount] = para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborY[pos]]; + //if(para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborY[pos]]==GEO_VOID) neighborsFluid = false; + //if((para->getParH(level)->neighborY[pos]<=pos) && ((para->getParH(level)->coordinateY[pos]) > (para->getParH(level)->gridNY-2))) neighborsFluid = false; nodeCount++; ////////////////////////////////////////////////////////////////////////// //5 nodes[nodeCount]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3P) ) ); - nodedata[0][nodeCount] = para->getParH(level)->rho_SP[para->getParH(level)->neighborZ_SP[pos]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[1][nodeCount] = para->getParH(level)->vx_SP[para->getParH(level)->neighborZ_SP[pos]] * para->getVelocityRatio(); - nodedata[2][nodeCount] = para->getParH(level)->vy_SP[para->getParH(level)->neighborZ_SP[pos]] * para->getVelocityRatio(); - nodedata[3][nodeCount] = para->getParH(level)->vz_SP[para->getParH(level)->neighborZ_SP[pos]] * para->getVelocityRatio(); - nodedata[4][nodeCount] = para->getParH(level)->geoSP[para->getParH(level)->neighborZ_SP[pos]]; - //if(para->getParH(level)->geoSP[para->getParH(level)->neighborZ_SP[pos]]==GEO_VOID) neighborsFluid = false; + nodedata[0][nodeCount] = para->getParH(level)->rho[para->getParH(level)->neighborZ[pos]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[1][nodeCount] = para->getParH(level)->velocityX[para->getParH(level)->neighborZ[pos]] * para->getVelocityRatio(); + nodedata[2][nodeCount] = para->getParH(level)->velocityY[para->getParH(level)->neighborZ[pos]] * para->getVelocityRatio(); + nodedata[3][nodeCount] = para->getParH(level)->velocityZ[para->getParH(level)->neighborZ[pos]] * para->getVelocityRatio(); + nodedata[4][nodeCount] = para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborZ[pos]]; + //if(para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborZ[pos]]==GEO_VOID) neighborsFluid = false; nodeCount++; ////////////////////////////////////////////////////////////////////////// //6 nodes[nodeCount]=( makeUbTuple( (float)(x1P),(float)(x2 ),(float)(x3P) ) ); - nodedata[0][nodeCount] = para->getParH(level)->rho_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborX_SP[pos]]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[1][nodeCount] = para->getParH(level)->vx_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborX_SP[pos]]] * para->getVelocityRatio(); - nodedata[2][nodeCount] = para->getParH(level)->vy_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborX_SP[pos]]] * para->getVelocityRatio(); - nodedata[3][nodeCount] = para->getParH(level)->vz_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborX_SP[pos]]] * para->getVelocityRatio(); - nodedata[4][nodeCount] = para->getParH(level)->geoSP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborX_SP[pos]]]; - //if(para->getParH(level)->geoSP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborX_SP[pos]]]==GEO_VOID) neighborsFluid = false; + nodedata[0][nodeCount] = para->getParH(level)->rho[para->getParH(level)->neighborZ[para->getParH(level)->neighborX[pos]]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[1][nodeCount] = para->getParH(level)->velocityX[para->getParH(level)->neighborZ[para->getParH(level)->neighborX[pos]]] * para->getVelocityRatio(); + nodedata[2][nodeCount] = para->getParH(level)->velocityY[para->getParH(level)->neighborZ[para->getParH(level)->neighborX[pos]]] * para->getVelocityRatio(); + nodedata[3][nodeCount] = para->getParH(level)->velocityZ[para->getParH(level)->neighborZ[para->getParH(level)->neighborX[pos]]] * para->getVelocityRatio(); + nodedata[4][nodeCount] = para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborZ[para->getParH(level)->neighborX[pos]]]; + //if(para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborZ[para->getParH(level)->neighborX[pos]]]==GEO_VOID) neighborsFluid = false; nodeCount++; ////////////////////////////////////////////////////////////////////////// //7 nodes[nodeCount]=( makeUbTuple( (float)(x1P),(float)(x2P),(float)(x3P) ) ); - nodedata[0][nodeCount] = para->getParH(level)->rho_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[1][nodeCount] = para->getParH(level)->vx_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]]] * para->getVelocityRatio(); - nodedata[2][nodeCount] = para->getParH(level)->vy_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]]] * para->getVelocityRatio(); - nodedata[3][nodeCount] = para->getParH(level)->vz_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]]] * para->getVelocityRatio(); - nodedata[4][nodeCount] = para->getParH(level)->geoSP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]]]; - //if(para->getParH(level)->geoSP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[para->getParH(level)->neighborX_SP[pos]]]]==GEO_VOID) neighborsFluid = false; + nodedata[0][nodeCount] = para->getParH(level)->rho[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[1][nodeCount] = para->getParH(level)->velocityX[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]]] * para->getVelocityRatio(); + nodedata[2][nodeCount] = para->getParH(level)->velocityY[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]]] * para->getVelocityRatio(); + nodedata[3][nodeCount] = para->getParH(level)->velocityZ[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]]] * para->getVelocityRatio(); + nodedata[4][nodeCount] = para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]]]; + //if(para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[para->getParH(level)->neighborX[pos]]]]==GEO_VOID) neighborsFluid = false; nodeCount++; ////////////////////////////////////////////////////////////////////////// //8 nodes[nodeCount]=( makeUbTuple( (float)(x1 ),(float)(x2P),(float)(x3P) ) ); - nodedata[0][nodeCount] = para->getParH(level)->rho_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[pos]]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[1][nodeCount] = para->getParH(level)->vx_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[pos]]] * para->getVelocityRatio(); - nodedata[2][nodeCount] = para->getParH(level)->vy_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[pos]]] * para->getVelocityRatio(); - nodedata[3][nodeCount] = para->getParH(level)->vz_SP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[pos]]] * para->getVelocityRatio(); - nodedata[4][nodeCount] = para->getParH(level)->geoSP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[pos]]]; - //if(para->getParH(level)->geoSP[para->getParH(level)->neighborZ_SP[para->getParH(level)->neighborY_SP[pos]]]==GEO_VOID) neighborsFluid = false; + nodedata[0][nodeCount] = para->getParH(level)->rho[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[pos]]] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodedata[1][nodeCount] = para->getParH(level)->velocityX[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[pos]]] * para->getVelocityRatio(); + nodedata[2][nodeCount] = para->getParH(level)->velocityY[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[pos]]] * para->getVelocityRatio(); + nodedata[3][nodeCount] = para->getParH(level)->velocityZ[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[pos]]] * para->getVelocityRatio(); + nodedata[4][nodeCount] = para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[pos]]]; + //if(para->getParH(level)->typeOfGridNode[para->getParH(level)->neighborZ[para->getParH(level)->neighborY[pos]]]==GEO_VOID) neighborsFluid = false; nodeCount++; if(neighborsFluid) @@ -162,9 +162,9 @@ namespace UnstructuredGridWriter bool isPeriodicCell(Parameter* para, int level, unsigned int number2, unsigned int number1, unsigned int number3, unsigned int number5) { - return (para->getParH(level)->coordX_SP[number2] < para->getParH(level)->coordX_SP[number1]) || - (para->getParH(level)->coordY_SP[number3] < para->getParH(level)->coordY_SP[number1]) || - (para->getParH(level)->coordZ_SP[number5] < para->getParH(level)->coordZ_SP[number1]); + return (para->getParH(level)->coordinateX[number2] < para->getParH(level)->coordinateX[number1]) || + (para->getParH(level)->coordinateY[number3] < para->getParH(level)->coordinateY[number1]) || + (para->getParH(level)->coordinateZ[number5] < para->getParH(level)->coordinateZ[number1]); } @@ -197,9 +197,9 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) + if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); } else { @@ -224,12 +224,12 @@ namespace UnstructuredGridWriter for (unsigned int pos=startpos;pos<endpos;pos++) { - if (/*para->getParH(level)->geoSP[pos] >= GEO_FLUID*/true) + if (/*para->getParH(level)->typeOfGridNode[pos] >= GEO_FLUID*/true) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; dn1 = pos - startpos; @@ -237,30 +237,30 @@ namespace UnstructuredGridWriter ////////////////////////////////////////////////////////////////////////// //printf("\n test vor node data... \n"); nodes[dn1]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3 ) ) ); - nodedata[0][dn1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][dn1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos]; + nodedata[0][dn1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][dn1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][dn1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][dn1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][dn1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; ////////////////////////////////////////////////////////////////////////// //printf("\n test vor numbers... \n"); - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; ////////////////////////////////////////////////////////////////////////// //printf("\n test vor neighborsFluid... \n"); - if (para->getParH(level)->geoSP[number2] < GEO_FLUID || - para->getParH(level)->geoSP[number3] < GEO_FLUID || - para->getParH(level)->geoSP[number4] < GEO_FLUID || - para->getParH(level)->geoSP[number5] < GEO_FLUID || - para->getParH(level)->geoSP[number6] < GEO_FLUID || - para->getParH(level)->geoSP[number7] < GEO_FLUID || - para->getParH(level)->geoSP[number8] < GEO_FLUID ) neighborsFluid=false; + if (para->getParH(level)->typeOfGridNode[number2] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] < GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// //if(neighborsFluid==false) counter++; ////////////////////////////////////////////////////////////////////////// @@ -340,9 +340,9 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) + if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); } else { @@ -368,41 +368,41 @@ namespace UnstructuredGridWriter for (unsigned int pos = startpos; pos < endpos; pos++) { - if (/*para->getParH(level)->geoSP[pos] >= GEO_FLUID*/true) + if (/*para->getParH(level)->typeOfGridNode[pos] >= GEO_FLUID*/true) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; dn1 = pos - startpos; neighborsFluid = true; ////////////////////////////////////////////////////////////////////////// nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - nodedata[0][dn1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][dn1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos]; + nodedata[0][dn1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][dn1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][dn1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][dn1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][dn1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; nodedata[6][dn1] = (double)para->getParH(level)->turbViscosity[pos]; ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] < GEO_FLUID || - para->getParH(level)->geoSP[number3] < GEO_FLUID || - para->getParH(level)->geoSP[number4] < GEO_FLUID || - para->getParH(level)->geoSP[number5] < GEO_FLUID || - para->getParH(level)->geoSP[number6] < GEO_FLUID || - para->getParH(level)->geoSP[number7] < GEO_FLUID || - para->getParH(level)->geoSP[number8] < GEO_FLUID) neighborsFluid = false; + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] < GEO_FLUID) neighborsFluid = false; ////////////////////////////////////////////////////////////////////////// if (number2 > endpos || number3 > endpos || @@ -479,9 +479,9 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) + if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); } else { @@ -518,24 +518,24 @@ namespace UnstructuredGridWriter for (unsigned int pos = startpos; pos < endpos; pos++) { - if (/*para->getParH(level)->geoSP[pos] >= GEO_FLUID*/true) + if (/*para->getParH(level)->typeOfGridNode[pos] >= GEO_FLUID*/true) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; dn1 = pos - startpos; neighborsFluid = true; ////////////////////////////////////////////////////////////////////////// nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - nodedata[0][dn1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][dn1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos]; + nodedata[0][dn1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][dn1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][dn1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][dn1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][dn1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; nodedata[6][dn1] = (double)para->getParH(level)->turbViscosity[pos] * (double)para->getViscosityRatio(); nodedata[7][dn1] = (double)para->getParH(level)->gSij[pos] * (double)para->getVelocityRatio(); nodedata[8][dn1] = (double)para->getParH(level)->gSDij[pos] * (double)para->getVelocityRatio(); @@ -549,21 +549,21 @@ namespace UnstructuredGridWriter nodedata[16][dn1] = (double)para->getParH(level)->gDyvz[pos] * (double)para->getVelocityRatio(); nodedata[17][dn1] = (double)para->getParH(level)->gDzvz[pos] * (double)para->getVelocityRatio(); ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] < GEO_FLUID || - para->getParH(level)->geoSP[number3] < GEO_FLUID || - para->getParH(level)->geoSP[number4] < GEO_FLUID || - para->getParH(level)->geoSP[number5] < GEO_FLUID || - para->getParH(level)->geoSP[number6] < GEO_FLUID || - para->getParH(level)->geoSP[number7] < GEO_FLUID || - para->getParH(level)->geoSP[number8] < GEO_FLUID) neighborsFluid = false; + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] < GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] < GEO_FLUID) neighborsFluid = false; ////////////////////////////////////////////////////////////////////////// if (number2 > endpos || number3 > endpos || @@ -628,9 +628,9 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) + if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); } else { @@ -655,12 +655,12 @@ namespace UnstructuredGridWriter for (unsigned int pos = startpos; pos < endpos; pos++) { - if ((para->getParH(level)->geoSP[pos] >= GEO_FLUID) || ((para->getParH(level)->geoSP[pos] >= GEO_PM_0) && (para->getParH(level)->geoSP[pos] <= GEO_PM_2))) + if ((para->getParH(level)->typeOfGridNode[pos] >= GEO_FLUID) || ((para->getParH(level)->typeOfGridNode[pos] >= GEO_PM_0) && (para->getParH(level)->typeOfGridNode[pos] <= GEO_PM_2))) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; dn1 = pos - startpos; @@ -668,30 +668,30 @@ namespace UnstructuredGridWriter ////////////////////////////////////////////////////////////////////////// //printf("\n test vor node data... \n"); nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - nodedata[0][dn1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][dn1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos]; + nodedata[0][dn1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][dn1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][dn1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][dn1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][dn1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; ////////////////////////////////////////////////////////////////////////// //printf("\n test vor numbers... \n"); - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; ////////////////////////////////////////////////////////////////////////// //printf("\n test vor neighborsFluid... \n"); - if (((para->getParH(level)->geoSP[number2] != GEO_FLUID) && (para->getParH(level)->geoSP[number2] < GEO_PM_0) && (para->getParH(level)->geoSP[number2] > GEO_PM_2)) || - ((para->getParH(level)->geoSP[number3] != GEO_FLUID) && (para->getParH(level)->geoSP[number3] < GEO_PM_0) && (para->getParH(level)->geoSP[number3] > GEO_PM_2)) || - ((para->getParH(level)->geoSP[number4] != GEO_FLUID) && (para->getParH(level)->geoSP[number4] < GEO_PM_0) && (para->getParH(level)->geoSP[number4] > GEO_PM_2)) || - ((para->getParH(level)->geoSP[number5] != GEO_FLUID) && (para->getParH(level)->geoSP[number5] < GEO_PM_0) && (para->getParH(level)->geoSP[number5] > GEO_PM_2)) || - ((para->getParH(level)->geoSP[number6] != GEO_FLUID) && (para->getParH(level)->geoSP[number6] < GEO_PM_0) && (para->getParH(level)->geoSP[number6] > GEO_PM_2)) || - ((para->getParH(level)->geoSP[number7] != GEO_FLUID) && (para->getParH(level)->geoSP[number7] < GEO_PM_0) && (para->getParH(level)->geoSP[number7] > GEO_PM_2)) || - ((para->getParH(level)->geoSP[number8] != GEO_FLUID) && (para->getParH(level)->geoSP[number8] < GEO_PM_0) && (para->getParH(level)->geoSP[number8] > GEO_PM_2))) neighborsFluid = false; + if (((para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID) && (para->getParH(level)->typeOfGridNode[number2] < GEO_PM_0) && (para->getParH(level)->typeOfGridNode[number2] > GEO_PM_2)) || + ((para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID) && (para->getParH(level)->typeOfGridNode[number3] < GEO_PM_0) && (para->getParH(level)->typeOfGridNode[number3] > GEO_PM_2)) || + ((para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID) && (para->getParH(level)->typeOfGridNode[number4] < GEO_PM_0) && (para->getParH(level)->typeOfGridNode[number4] > GEO_PM_2)) || + ((para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID) && (para->getParH(level)->typeOfGridNode[number5] < GEO_PM_0) && (para->getParH(level)->typeOfGridNode[number5] > GEO_PM_2)) || + ((para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID) && (para->getParH(level)->typeOfGridNode[number6] < GEO_PM_0) && (para->getParH(level)->typeOfGridNode[number6] > GEO_PM_2)) || + ((para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID) && (para->getParH(level)->typeOfGridNode[number7] < GEO_PM_0) && (para->getParH(level)->typeOfGridNode[number7] > GEO_PM_2)) || + ((para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) && (para->getParH(level)->typeOfGridNode[number8] < GEO_PM_0) && (para->getParH(level)->typeOfGridNode[number8] > GEO_PM_2))) neighborsFluid = false; ////////////////////////////////////////////////////////////////////////// //if(neighborsFluid==false) counter++; ////////////////////////////////////////////////////////////////////////// @@ -771,9 +771,9 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) + if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); } else { @@ -796,41 +796,41 @@ namespace UnstructuredGridWriter //printf("\n test in if II... \n"); for (unsigned int pos=startpos;pos<endpos;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; dn1 = pos - startpos; neighborsFluid = true; ////////////////////////////////////////////////////////////////////////// nodes[dn1]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3 ) ) ); - nodedata[0][dn1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][dn1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos]; + nodedata[0][dn1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][dn1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][dn1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][dn1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][dn1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; nodedata[6][dn1] = (double)para->getParH(level)->Conc[pos]; ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// if (number2 > endpos || number3 > endpos || @@ -896,10 +896,10 @@ namespace UnstructuredGridWriter vector< vector< double > > nodedata(nodedatanames.size()); //printf("\n test for if... \n"); - if (para->getParH(level)->size_Mat_SP > limitOfNodes) + if (para->getParH(level)->numberOfNodes > limitOfNodes) { //printf("\n test in if I... \n"); - unsigned int restOfNodes = para->getParH(level)->size_Mat_SP - limitOfNodes; + unsigned int restOfNodes = para->getParH(level)->numberOfNodes - limitOfNodes; ////////////////////////////////////////////////////////////////////////// //PART I nodes.resize(limitOfNodes); @@ -913,39 +913,39 @@ namespace UnstructuredGridWriter //printf("\n test in if II... \n"); for (unsigned int pos=0;pos<limitOfNodes;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; neighborsFluid = true; ////////////////////////////////////////////////////////////////////////// nodes[number1]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3 ) ) ); - nodedata[0][number1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][number1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][number1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][number1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][number1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][number1] = (double)para->getParH(level)->geoSP[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + nodedata[0][number1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][number1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][number1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][number1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][number1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][number1] = (double)para->getParH(level)->typeOfGridNode[pos]; + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// if (number2 > limitOfNodes || number3 > limitOfNodes || @@ -984,42 +984,42 @@ namespace UnstructuredGridWriter nodedata[5].resize(restOfNodes); //printf("\n test in if IV... \n"); - for (unsigned int pos=limitOfNodes;pos<para->getParH(level)->size_Mat_SP;pos++) + for (unsigned int pos=limitOfNodes;pos<para->getParH(level)->numberOfNodes;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; dn1 = pos - limitOfNodes; neighborsFluid = true; ////////////////////////////////////////////////////////////////////////// nodes[dn1]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3 ) ) ); - nodedata[0][dn1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][dn1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + nodedata[0][dn1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][dn1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][dn1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][dn1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][dn1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// dn2 = number2 - limitOfNodes; dn3 = number3 - limitOfNodes; @@ -1046,54 +1046,54 @@ namespace UnstructuredGridWriter else { //printf("\n test in else I... \n"); - nodes.resize(para->getParH(level)->size_Mat_SP); - nodedata[0].resize(para->getParH(level)->size_Mat_SP); - nodedata[1].resize(para->getParH(level)->size_Mat_SP); - nodedata[2].resize(para->getParH(level)->size_Mat_SP); - nodedata[3].resize(para->getParH(level)->size_Mat_SP); - nodedata[4].resize(para->getParH(level)->size_Mat_SP); - nodedata[5].resize(para->getParH(level)->size_Mat_SP); + nodes.resize(para->getParH(level)->numberOfNodes); + nodedata[0].resize(para->getParH(level)->numberOfNodes); + nodedata[1].resize(para->getParH(level)->numberOfNodes); + nodedata[2].resize(para->getParH(level)->numberOfNodes); + nodedata[3].resize(para->getParH(level)->numberOfNodes); + nodedata[4].resize(para->getParH(level)->numberOfNodes); + nodedata[5].resize(para->getParH(level)->numberOfNodes); //printf("\n test in else II... \n"); - for (unsigned int pos=0;pos<para->getParH(level)->size_Mat_SP;pos++) + for (unsigned int pos=0;pos<para->getParH(level)->numberOfNodes;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { //printf("\n test in else-for I pos = %d \n", pos); ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; neighborsFluid = true; ////////////////////////////////////////////////////////////////////////// //printf("\n test in else-for II pos = %d \n", pos); nodes[number1]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3 ) ) ); - nodedata[0][number1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][number1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][number1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][number1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][number1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][number1] = (double)para->getParH(level)->geoSP[pos]; + nodedata[0][number1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][number1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][number1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][number1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][number1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][number1] = (double)para->getParH(level)->typeOfGridNode[pos]; ////////////////////////////////////////////////////////////////////////// //printf("\n test in else-for III pos = %d \n", pos); - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; ////////////////////////////////////////////////////////////////////////// //printf("\n test in else-for VI pos = %d \n", pos); - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// //if (level == 0 && // (number2 <= number1 || @@ -1150,53 +1150,53 @@ namespace UnstructuredGridWriter double vxmax = 0; vector< vector< double > > nodedata(nodedatanames.size()); - nodes.resize(para->getParH(level)->size_Mat_SP); - nodedata[0].resize(para->getParH(level)->size_Mat_SP); - nodedata[1].resize(para->getParH(level)->size_Mat_SP); - nodedata[2].resize(para->getParH(level)->size_Mat_SP); - nodedata[3].resize(para->getParH(level)->size_Mat_SP); - nodedata[4].resize(para->getParH(level)->size_Mat_SP); - nodedata[5].resize(para->getParH(level)->size_Mat_SP); + nodes.resize(para->getParH(level)->numberOfNodes); + nodedata[0].resize(para->getParH(level)->numberOfNodes); + nodedata[1].resize(para->getParH(level)->numberOfNodes); + nodedata[2].resize(para->getParH(level)->numberOfNodes); + nodedata[3].resize(para->getParH(level)->numberOfNodes); + nodedata[4].resize(para->getParH(level)->numberOfNodes); + nodedata[5].resize(para->getParH(level)->numberOfNodes); - for (unsigned int pos=0;pos<para->getParH(level)->size_Mat_SP;pos++) + for (unsigned int pos=0;pos<para->getParH(level)->numberOfNodes;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - double x1P = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[pos]]; - double x2P = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[pos]]; - double x3P = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[pos]]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + double x1P = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[pos]]; + double x2P = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[pos]]; + double x3P = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[pos]]; ////////////////////////////////////////////////////////////////////////// number1 = pos; neighborsFluid = true; ////////////////////////////////////////////////////////////////////////// nodes[number1]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3 ) ) ); nodedata[0][number1] = (double)pos; - //nodedata[0][number1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][number1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][number1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][number1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][number1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][number1] = (double)para->getParH(level)->geoSP[pos]; + //nodedata[0][number1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][number1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][number1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][number1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][number1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][number1] = (double)para->getParH(level)->typeOfGridNode[pos]; ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// //if (level == 0 && // (number2 <= number1 || @@ -1236,53 +1236,53 @@ namespace UnstructuredGridWriter double posmax = 0; vector< vector< double > > nodedata(nodedatanames.size()); - nodes.resize(para->getParH(level)->size_Mat_SP); - nodedata[0].resize(para->getParH(level)->size_Mat_SP); - nodedata[1].resize(para->getParH(level)->size_Mat_SP); - nodedata[2].resize(para->getParH(level)->size_Mat_SP); - nodedata[3].resize(para->getParH(level)->size_Mat_SP); - nodedata[4].resize(para->getParH(level)->size_Mat_SP); - nodedata[5].resize(para->getParH(level)->size_Mat_SP); + nodes.resize(para->getParH(level)->numberOfNodes); + nodedata[0].resize(para->getParH(level)->numberOfNodes); + nodedata[1].resize(para->getParH(level)->numberOfNodes); + nodedata[2].resize(para->getParH(level)->numberOfNodes); + nodedata[3].resize(para->getParH(level)->numberOfNodes); + nodedata[4].resize(para->getParH(level)->numberOfNodes); + nodedata[5].resize(para->getParH(level)->numberOfNodes); - for (unsigned int pos=0;pos<para->getParH(level)->size_Mat_SP;pos++) + for (unsigned int pos=0;pos<para->getParH(level)->numberOfNodes;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - double x1P = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[pos]]; - double x2P = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[pos]]; - double x3P = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[pos]]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + double x1P = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[pos]]; + double x2P = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[pos]]; + double x3P = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[pos]]; ////////////////////////////////////////////////////////////////////////// number1 = pos; neighborsFluid = true; ////////////////////////////////////////////////////////////////////////// nodes[number1]=( makeUbTuple( (float)(x1 ),(float)(x2 ),(float)(x3 ) ) ); nodedata[0][number1] = (double)pos; - //nodedata[0][number1] = (double)para->getParH(level)->press_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][number1] = (double)para->getParH(level)->rho_SP[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][number1] = (double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio(); - nodedata[3][number1] = (double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio(); - nodedata[4][number1] = (double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio(); - nodedata[5][number1] = (double)para->getParH(level)->geoSP[pos]; + //nodedata[0][number1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[1][number1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodedata[2][number1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodedata[3][number1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodedata[4][number1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodedata[5][number1] = (double)para->getParH(level)->typeOfGridNode[pos]; ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// //if (level == 0 && // (number2 <= number1 || @@ -1342,9 +1342,9 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) + if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); } else { @@ -1366,12 +1366,12 @@ namespace UnstructuredGridWriter //printf("\n test in if II... \n"); for (unsigned int pos=startpos;pos<endpos;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; dn1 = pos - startpos; @@ -1383,23 +1383,23 @@ namespace UnstructuredGridWriter nodedata[2][dn1] = para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio(); nodedata[3][dn1] = para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio(); nodedata[4][dn1] = para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->geoSP[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// if (number2 > endpos || number3 > endpos || @@ -1465,9 +1465,9 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) + if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); } else { @@ -1489,12 +1489,12 @@ namespace UnstructuredGridWriter //printf("\n test in if II... \n"); for (unsigned int pos = startpos; pos < endpos; pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; dn1 = pos - startpos; @@ -1507,23 +1507,23 @@ namespace UnstructuredGridWriter nodedata[3][dn1] = para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio(); nodedata[4][dn1] = para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio(); nodedata[5][dn1] = para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[6][dn1] = (double)para->getParH(level)->geoSP[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID) neighborsFluid = false; + nodedata[6][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) neighborsFluid = false; ////////////////////////////////////////////////////////////////////////// if (number2 > endpos || number3 > endpos || @@ -1595,9 +1595,9 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) + if (((part + 1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); } else { @@ -1626,12 +1626,12 @@ namespace UnstructuredGridWriter //printf("\n test in if II... \n"); for (unsigned int pos = startpos; pos < endpos; pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; dn1 = pos - startpos; @@ -1643,41 +1643,41 @@ namespace UnstructuredGridWriter nodedata[2][dn1] = para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio(); nodedata[3][dn1] = para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio(); nodedata[4][dn1] = para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[5][dn1] = (((double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio())); - nodedata[6][dn1] = (((double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio())); - nodedata[7][dn1] = (((double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio())); + nodedata[5][dn1] = (((double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio())); + nodedata[6][dn1] = (((double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio())); + nodedata[7][dn1] = (((double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio())); nodedata[8][dn1] = - (((double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio())) * - (((double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio())); + (((double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio())) * + (((double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio())); nodedata[9][dn1] = - (((double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio())) * - (((double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio())); + (((double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio())) * + (((double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio())); nodedata[10][dn1] = - (((double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio())) * - (((double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio())); + (((double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio())) * + (((double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio())); nodedata[11][dn1] = - (((double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio())) * - (((double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio())); - //nodedata[8][dn1] = (((double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio()) * ((double)para->getParH(level)->vx_SP[pos] * (double)para->getVelocityRatio())); - //nodedata[9][dn1] = (((double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio()) * ((double)para->getParH(level)->vy_SP[pos] * (double)para->getVelocityRatio())); - //nodedata[10][dn1] = (((double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio()) * ((double)para->getParH(level)->vz_SP[pos] * (double)para->getVelocityRatio())); - nodedata[12][dn1] = (double)para->getParH(level)->geoSP[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID) neighborsFluid = false; + (((double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio())) * + (((double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio()) - (para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio())); + //nodedata[8][dn1] = (((double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio()) * ((double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio())); + //nodedata[9][dn1] = (((double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio()) * ((double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio())); + //nodedata[10][dn1] = (((double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio()) * ((double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio())); + nodedata[12][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) neighborsFluid = false; ////////////////////////////////////////////////////////////////////////// if (number2 > endpos || number3 > endpos || @@ -1730,25 +1730,25 @@ namespace UnstructuredGridWriter bool neighborsFluid; vector< vector< double > > nodedata(nodedatanames.size()); - nodes.resize(para->getParH(level)->size_Mat_SP); - nodedata[0].resize(para->getParH(level)->size_Mat_SP); - nodedata[1].resize(para->getParH(level)->size_Mat_SP); - nodedata[2].resize(para->getParH(level)->size_Mat_SP); - nodedata[3].resize(para->getParH(level)->size_Mat_SP); - nodedata[4].resize(para->getParH(level)->size_Mat_SP); - nodedata[5].resize(para->getParH(level)->size_Mat_SP); + nodes.resize(para->getParH(level)->numberOfNodes); + nodedata[0].resize(para->getParH(level)->numberOfNodes); + nodedata[1].resize(para->getParH(level)->numberOfNodes); + nodedata[2].resize(para->getParH(level)->numberOfNodes); + nodedata[3].resize(para->getParH(level)->numberOfNodes); + nodedata[4].resize(para->getParH(level)->numberOfNodes); + nodedata[5].resize(para->getParH(level)->numberOfNodes); - for (unsigned int pos=0;pos<para->getParH(level)->size_Mat_SP;pos++) + for (unsigned int pos=0;pos<para->getParH(level)->numberOfNodes;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - double x1P = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[pos]]; - double x2P = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[pos]]; - double x3P = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[pos]]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + double x1P = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[pos]]; + double x2P = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[pos]]; + double x3P = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[pos]]; ////////////////////////////////////////////////////////////////////////// number1 = pos; neighborsFluid = true; @@ -1759,23 +1759,23 @@ namespace UnstructuredGridWriter nodedata[2][number1] = para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio(); nodedata[3][number1] = para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio(); nodedata[4][number1] = para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[5][number1] = para->getParH(level)->geoSP[pos]; + nodedata[5][number1] = para->getParH(level)->typeOfGridNode[pos]; ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// //if (level == 0 && // (number2 <= number1 || @@ -1817,25 +1817,25 @@ namespace UnstructuredGridWriter bool neighborsFluid; vector< vector< double > > nodedata(nodedatanames.size()); - nodes.resize(para->getParH(level)->size_Mat_SP); - nodedata[0].resize(para->getParH(level)->size_Mat_SP); - nodedata[1].resize(para->getParH(level)->size_Mat_SP); - nodedata[2].resize(para->getParH(level)->size_Mat_SP); - nodedata[3].resize(para->getParH(level)->size_Mat_SP); - nodedata[4].resize(para->getParH(level)->size_Mat_SP); - nodedata[5].resize(para->getParH(level)->size_Mat_SP); + nodes.resize(para->getParH(level)->numberOfNodes); + nodedata[0].resize(para->getParH(level)->numberOfNodes); + nodedata[1].resize(para->getParH(level)->numberOfNodes); + nodedata[2].resize(para->getParH(level)->numberOfNodes); + nodedata[3].resize(para->getParH(level)->numberOfNodes); + nodedata[4].resize(para->getParH(level)->numberOfNodes); + nodedata[5].resize(para->getParH(level)->numberOfNodes); - for (unsigned int pos=0;pos<para->getParH(level)->size_Mat_SP;pos++) + for (unsigned int pos=0;pos<para->getParH(level)->numberOfNodes;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - double x1P = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[pos]]; - double x2P = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[pos]]; - double x3P = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[pos]]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + double x1P = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[pos]]; + double x2P = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[pos]]; + double x3P = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[pos]]; ////////////////////////////////////////////////////////////////////////// number1 = pos; neighborsFluid = true; @@ -1846,23 +1846,23 @@ namespace UnstructuredGridWriter nodedata[2][number1] = para->getParH(level)->kxzFromfcNEQ[pos]; nodedata[3][number1] = para->getParH(level)->kxxMyyFromfcNEQ[pos]; nodedata[4][number1] = para->getParH(level)->kxxMzzFromfcNEQ[pos]; - nodedata[5][number1] = para->getParH(level)->geoSP[pos]; + nodedata[5][number1] = para->getParH(level)->typeOfGridNode[pos]; ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// if (neighborsFluid==true) cells.push_back( makeUbTuple(number1,number2,number3,number4,number5,number6,number7,number8) ); ////////////////////////////////////////////////////////////////////////// @@ -1975,9 +1975,9 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) + if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); } else { @@ -1999,15 +1999,15 @@ namespace UnstructuredGridWriter //printf("\n test in if II... \n"); for (unsigned int pos=startpos;pos<endpos;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - double x1P = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[pos]]; - double x2P = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[pos]]; - double x3P = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[pos]]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + double x1P = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[pos]]; + double x2P = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[pos]]; + double x3P = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[pos]]; ////////////////////////////////////////////////////////////////////////// number1 = pos; neighborsFluid = true; @@ -2018,23 +2018,23 @@ namespace UnstructuredGridWriter nodedata[2][number1] = para->getParH(level)->kxzFromfcNEQ[pos]; nodedata[3][number1] = para->getParH(level)->kxxMyyFromfcNEQ[pos]; nodedata[4][number1] = para->getParH(level)->kxxMzzFromfcNEQ[pos]; - nodedata[5][number1] = para->getParH(level)->geoSP[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + nodedata[5][number1] = para->getParH(level)->typeOfGridNode[pos]; + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// if (neighborsFluid==true) cells.push_back( makeUbTuple(number1,number2,number3,number4,number5,number6,number7,number8) ); ////////////////////////////////////////////////////////////////////////// @@ -2080,9 +2080,9 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) + if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); } else { @@ -2106,15 +2106,15 @@ namespace UnstructuredGridWriter //printf("\n test in if II... \n"); for (unsigned int pos=startpos;pos<endpos;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - double x1P = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[pos]]; - double x2P = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[pos]]; - double x3P = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[pos]]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + double x1P = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[pos]]; + double x2P = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[pos]]; + double x3P = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[pos]]; ////////////////////////////////////////////////////////////////////////// number1 = pos; neighborsFluid = true; @@ -2127,23 +2127,23 @@ namespace UnstructuredGridWriter nodedata[4][number1] = para->getParH(level)->CUMcba[pos]; nodedata[5][number1] = para->getParH(level)->CUMacb[pos]; nodedata[6][number1] = para->getParH(level)->CUMcab[pos]; - nodedata[7][number1] = para->getParH(level)->geoSP[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + nodedata[7][number1] = para->getParH(level)->typeOfGridNode[pos]; + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// if (neighborsFluid==true) cells.push_back( makeUbTuple(number1,number2,number3,number4,number5,number6,number7,number8) ); ////////////////////////////////////////////////////////////////////////// @@ -2192,9 +2192,9 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat_SP) + if ( ((part+1)*para->getlimitOfNodesForVTK()) > para->getParH(level)->numberOfNodes) { - sizeOfNodes = para->getParH(level)->size_Mat_SP - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); } else { @@ -2221,15 +2221,15 @@ namespace UnstructuredGridWriter //printf("\n test in if II... \n"); for (unsigned int pos=startpos;pos<endpos;pos++) { - if (para->getParH(level)->geoSP[pos] == GEO_FLUID) + if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordX_SP[pos]; - double x2 = para->getParH(level)->coordY_SP[pos]; - double x3 = para->getParH(level)->coordZ_SP[pos]; - double x1P = para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[pos]]; - double x2P = para->getParH(level)->coordY_SP[para->getParH(level)->neighborY_SP[pos]]; - double x3P = para->getParH(level)->coordZ_SP[para->getParH(level)->neighborZ_SP[pos]]; + double x1 = para->getParH(level)->coordinateX[pos]; + double x2 = para->getParH(level)->coordinateY[pos]; + double x3 = para->getParH(level)->coordinateZ[pos]; + double x1P = para->getParH(level)->coordinateX[para->getParH(level)->neighborX[pos]]; + double x2P = para->getParH(level)->coordinateY[para->getParH(level)->neighborY[pos]]; + double x3P = para->getParH(level)->coordinateZ[para->getParH(level)->neighborZ[pos]]; ////////////////////////////////////////////////////////////////////////// number1 = pos; neighborsFluid = true; @@ -2245,23 +2245,23 @@ namespace UnstructuredGridWriter nodedata[7][number1] = para->getParH(level)->CUMcbc[pos]; nodedata[8][number1] = para->getParH(level)->CUMccb[pos]; nodedata[9][number1] = para->getParH(level)->CUMccc[pos]; - nodedata[10][number1] = para->getParH(level)->geoSP[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX_SP[number1]; - number3 = para->getParH(level)->neighborY_SP[number2]; - number4 = para->getParH(level)->neighborY_SP[number1]; - number5 = para->getParH(level)->neighborZ_SP[number1]; - number6 = para->getParH(level)->neighborZ_SP[number2]; - number7 = para->getParH(level)->neighborZ_SP[number3]; - number8 = para->getParH(level)->neighborZ_SP[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->geoSP[number2] != GEO_FLUID || - para->getParH(level)->geoSP[number3] != GEO_FLUID || - para->getParH(level)->geoSP[number4] != GEO_FLUID || - para->getParH(level)->geoSP[number5] != GEO_FLUID || - para->getParH(level)->geoSP[number6] != GEO_FLUID || - para->getParH(level)->geoSP[number7] != GEO_FLUID || - para->getParH(level)->geoSP[number8] != GEO_FLUID ) neighborsFluid=false; + nodedata[10][number1] = para->getParH(level)->typeOfGridNode[pos]; + ////////////////////////////////////////////////////////////////////////// + number2 = para->getParH(level)->neighborX[number1]; + number3 = para->getParH(level)->neighborY[number2]; + number4 = para->getParH(level)->neighborY[number1]; + number5 = para->getParH(level)->neighborZ[number1]; + number6 = para->getParH(level)->neighborZ[number2]; + number7 = para->getParH(level)->neighborZ[number3]; + number8 = para->getParH(level)->neighborZ[number4]; + ////////////////////////////////////////////////////////////////////////// + if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || + para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID ) neighborsFluid=false; ////////////////////////////////////////////////////////////////////////// if (neighborsFluid==true) cells.push_back( makeUbTuple(number1,number2,number3,number4,number5,number6,number7,number8) ); ////////////////////////////////////////////////////////////////////////// @@ -2293,7 +2293,7 @@ namespace UnstructuredGridWriter QforBoundaryConditions Q; double nodeX1, nodeX2, nodeX3, wallX1, wallX2, wallX3, q; ////////////////////////////////////////////////////////////////////////// - sizeOfNodes = para->getParH(level)->QGeom.kQ; + sizeOfNodes = para->getParH(level)->geometryBC.numberOfBCnodes; endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// //qs.clear(); @@ -2311,49 +2311,49 @@ namespace UnstructuredGridWriter for (unsigned int pos = startpos; pos < endpos; pos++) { ////////////////////////////////////////////////////////////////////////// - nodeX1 = para->getParH(level)->coordX_SP[para->getParH(level)->QGeom.k[pos]]; - nodeX2 = para->getParH(level)->coordY_SP[para->getParH(level)->QGeom.k[pos]]; - nodeX3 = para->getParH(level)->coordZ_SP[para->getParH(level)->QGeom.k[pos]]; + nodeX1 = para->getParH(level)->coordinateX[para->getParH(level)->geometryBC.k[pos]]; + nodeX2 = para->getParH(level)->coordinateY[para->getParH(level)->geometryBC.k[pos]]; + nodeX3 = para->getParH(level)->coordinateZ[para->getParH(level)->geometryBC.k[pos]]; wallX1 = 0.0; wallX2 = 0.0; wallX3 = 0.0; q = 0.0; ////////////////////////////////////////////////////////////////////////// - for (unsigned int typeOfQ = dirSTART; typeOfQ <= dirEND; typeOfQ++) + for (unsigned int typeOfQ = STARTDIR; typeOfQ <= ENDDIR; typeOfQ++) { - QQ = para->getParH(level)->QGeom.q27[0]; + QQ = para->getParH(level)->geometryBC.q27[0]; Q.q27[typeOfQ] = &QQ[typeOfQ*sizeOfNodes]; q = (double)(Q.q27[typeOfQ][pos]); ////////////////////////////////////////////////////////////////////////// switch (typeOfQ) { - case dirE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; - case dirN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; - case dirW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; - case dirS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; - case dirNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; - case dirNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; - case dirSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; - case dirSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; - case dirT: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; - case dirTE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; - case dirTN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; - case dirTW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; - case dirTS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; - case dirB: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; - case dirBE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; - case dirBN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; - case dirBW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; - case dirBS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; - case dirTNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; - case dirBSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; - case dirBNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; - case dirTSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; - case dirTSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; - case dirBNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; - case dirBSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; - case dirTNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; - case dirZERO:wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3; break; + case E: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; + case N: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; + case W: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; + case S: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; + case NE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; + case NW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; + case SW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; + case SE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; + case T: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; + case TE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; + case TN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; + case TW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; + case TS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; + case B: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; + case BE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; + case BN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; + case BW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; + case BS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; + case TNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; + case BSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; + case BNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; + case TSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; + case TSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; + case BNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; + case BSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; + case TNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; + case REST:wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3; break; default: throw UbException(UB_EXARGS, "unknown direction"); } ////////////////////////////////////////////////////////////////////////// @@ -2397,7 +2397,7 @@ namespace UnstructuredGridWriter QforBoundaryConditions Q; double nodeX1, nodeX2, nodeX3, wallX1, wallX2, wallX3, q; ////////////////////////////////////////////////////////////////////////// - sizeOfNodes = para->getParH(level)->Qinflow.kQ; + sizeOfNodes = para->getParH(level)->velocityBC.numberOfBCnodes; endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// //qs.clear(); @@ -2415,50 +2415,50 @@ namespace UnstructuredGridWriter for (unsigned int pos = startpos; pos < endpos; pos++) { ////////////////////////////////////////////////////////////////////////// - nodeX1 = para->getParH(level)->coordX_SP[para->getParH(level)->Qinflow.k[pos]]; - nodeX2 = para->getParH(level)->coordY_SP[para->getParH(level)->Qinflow.k[pos]]; - nodeX3 = para->getParH(level)->coordZ_SP[para->getParH(level)->Qinflow.k[pos]]; + nodeX1 = para->getParH(level)->coordinateX[para->getParH(level)->velocityBC.k[pos]]; + nodeX2 = para->getParH(level)->coordinateY[para->getParH(level)->velocityBC.k[pos]]; + nodeX3 = para->getParH(level)->coordinateZ[para->getParH(level)->velocityBC.k[pos]]; wallX1 = 0.0; wallX2 = 0.0; wallX3 = 0.0; q = 0.0; ////////////////////////////////////////////////////////////////////////// - for (unsigned int typeOfQ = dirSTART; typeOfQ <= dirEND; typeOfQ++) + for (unsigned int typeOfQ = STARTDIR; typeOfQ <= ENDDIR; typeOfQ++) { - QQ = para->getParH(level)->Qinflow.q27[0]; + QQ = para->getParH(level)->velocityBC.q27[0]; Q.q27[typeOfQ] = &QQ[typeOfQ*sizeOfNodes]; q = (double)(Q.q27[typeOfQ][pos]); if( q < 0.0 ) q = 0.0; ////////////////////////////////////////////////////////////////////////// switch (typeOfQ) { - case dirE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; - case dirN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; - case dirW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; - case dirS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; - case dirNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; - case dirNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; - case dirSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; - case dirSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; - case dirT: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; - case dirTE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; - case dirTN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; - case dirTW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; - case dirTS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; - case dirB: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; - case dirBE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; - case dirBN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; - case dirBW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; - case dirBS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; - case dirTNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; - case dirBSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; - case dirBNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; - case dirTSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; - case dirTSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; - case dirBNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; - case dirBSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; - case dirTNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; - case dirZERO:wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3; break; + case E: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; + case N: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; + case W: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; + case S: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; + case NE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; + case NW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; + case SW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; + case SE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; + case T: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; + case TE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; + case TN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; + case TW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; + case TS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; + case B: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; + case BE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; + case BN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; + case BW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; + case BS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; + case TNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; + case BSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; + case BNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; + case TSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; + case TSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; + case BNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; + case BSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; + case TNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; + case REST:wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3; break; default: throw UbException(UB_EXARGS, "unknown direction"); } ////////////////////////////////////////////////////////////////////////// @@ -2502,7 +2502,7 @@ namespace UnstructuredGridWriter QforBoundaryConditions Q; double nodeX1, nodeX2, nodeX3, wallX1, wallX2, wallX3, q; ////////////////////////////////////////////////////////////////////////// - sizeOfNodes = para->getParH(level)->QPress.kQ; + sizeOfNodes = para->getParH(level)->pressureBC.numberOfBCnodes; endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// //qs.clear(); @@ -2520,50 +2520,50 @@ namespace UnstructuredGridWriter for (unsigned int pos = startpos; pos < endpos; pos++) { ////////////////////////////////////////////////////////////////////////// - nodeX1 = para->getParH(level)->coordX_SP[para->getParH(level)->QPress.k[pos]]; - nodeX2 = para->getParH(level)->coordY_SP[para->getParH(level)->QPress.k[pos]]; - nodeX3 = para->getParH(level)->coordZ_SP[para->getParH(level)->QPress.k[pos]]; + nodeX1 = para->getParH(level)->coordinateX[para->getParH(level)->pressureBC.k[pos]]; + nodeX2 = para->getParH(level)->coordinateY[para->getParH(level)->pressureBC.k[pos]]; + nodeX3 = para->getParH(level)->coordinateZ[para->getParH(level)->pressureBC.k[pos]]; wallX1 = 0.0; wallX2 = 0.0; wallX3 = 0.0; q = 0.0; ////////////////////////////////////////////////////////////////////////// - for (unsigned int typeOfQ = dirSTART; typeOfQ <= dirEND; typeOfQ++) + for (unsigned int typeOfQ = STARTDIR; typeOfQ <= ENDDIR; typeOfQ++) { - QQ = para->getParH(level)->QPress.q27[0]; + QQ = para->getParH(level)->pressureBC.q27[0]; Q.q27[typeOfQ] = &QQ[typeOfQ*sizeOfNodes]; q = (double)(Q.q27[typeOfQ][pos]); if( q < 0.0 ) q = 0.0; ////////////////////////////////////////////////////////////////////////// switch (typeOfQ) { - case dirE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; - case dirN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; - case dirW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; - case dirS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; - case dirNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; - case dirNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; - case dirSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; - case dirSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; - case dirT: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; - case dirTE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; - case dirTN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; - case dirTW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; - case dirTS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; - case dirB: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; - case dirBE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; - case dirBN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; - case dirBW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; - case dirBS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; - case dirTNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; - case dirBSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; - case dirBNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; - case dirTSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; - case dirTSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; - case dirBNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; - case dirBSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; - case dirTNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; - case dirZERO:wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3; break; + case E: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; + case N: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; + case W: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3; break; + case S: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; + case NE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; + case NW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3; break; + case SW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; + case SE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3; break; + case T: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; + case TE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; + case TN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; + case TW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 + q*dx; break; + case TS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; + case B: wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; + case BE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; + case BN: wallX1 = nodeX1; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; + case BW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2; wallX3 = nodeX3 - q*dx; break; + case BS: wallX1 = nodeX1; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; + case TNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; + case BSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; + case BNE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; + case TSW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; + case TSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 + q*dx; break; + case BNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 - q*dx; break; + case BSE: wallX1 = nodeX1 + q*dx; wallX2 = nodeX2 - q*dx; wallX3 = nodeX3 - q*dx; break; + case TNW: wallX1 = nodeX1 - q*dx; wallX2 = nodeX2 + q*dx; wallX3 = nodeX3 + q*dx; break; + case REST:wallX1 = nodeX1; wallX2 = nodeX2; wallX3 = nodeX3; break; default: throw UbException(UB_EXARGS, "unknown direction"); } ////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/Output/VeloASCIIWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/VeloASCIIWriter.hpp index d80cbf6660caa1d9212b87e3304871641b1d0bb6..5973525d23233ab49121d2cfd7dd6ed16666229d 100644 --- a/src/gpu/VirtualFluids_GPU/Output/VeloASCIIWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/VeloASCIIWriter.hpp @@ -14,9 +14,9 @@ public: static void writeVelocitiesAsTXT(Parameter* para, int level, int t) { //calc - int numberNodes = (int)para->getParH(level)->size_Mat_SP; + int numberNodes = (int)para->getParH(level)->numberOfNodes; //write - UbFileOutputASCII out(para->getFName() + "_VelocitiesASCII_" + std::to_string(level) + "_ID_" + StringUtil::toString<int>(para->getMyID()) + "_t_" + std::to_string(t) + ".dat"); + UbFileOutputASCII out(para->getFName() + "_VelocitiesASCII_" + std::to_string(level) + "_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + "_t_" + std::to_string(t) + ".dat"); //header out.writeString("Level:"); out.writeInteger(level); @@ -27,9 +27,9 @@ public: //out.writeLine(); for (int index = 0; index < numberNodes; index++) { - out.writeFloat((float)(para->getParH(level)->vx_SP[index] * para->getVelocityRatio())); - out.writeFloat((float)(para->getParH(level)->vy_SP[index] * para->getVelocityRatio())); - out.writeFloat((float)(para->getParH(level)->vz_SP[index] * para->getVelocityRatio())); + out.writeFloat((float)(para->getParH(level)->velocityX[index] * para->getVelocityRatio())); + out.writeFloat((float)(para->getParH(level)->velocityY[index] * para->getVelocityRatio())); + out.writeFloat((float)(para->getParH(level)->velocityZ[index] * para->getVelocityRatio())); out.writeLine(); } out.writeLine(); diff --git a/src/gpu/VirtualFluids_GPU/Output/VtkSGWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/VtkSGWriter.hpp index 5313d7bfbde22533ed198acaee16cc83844425da..7b2e5021a404ba5d9e969c1b5d144799d06c9ae6 100644 --- a/src/gpu/VirtualFluids_GPU/Output/VtkSGWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/VtkSGWriter.hpp @@ -7,7 +7,7 @@ // #include <math.h> #include <cmath> #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include "basics/utilities/UbSystem.h" //using namespace std; diff --git a/src/gpu/VirtualFluids_GPU/Output/interfaceWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/interfaceWriter.hpp index 8efdf4b499579bf1a75ed32337ccbab84379acf6..f140b15a6b7595a959139da2a35ed58f01b2a307 100644 --- a/src/gpu/VirtualFluids_GPU/Output/interfaceWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/interfaceWriter.hpp @@ -10,7 +10,7 @@ //#include <cmath> //#include "LBM/LB.h" -//#include "LBM/D3Q27.h" +//#include "lbm/constants/D3Q27.h" #include "basics/writer/WbWriterVtkXmlBinary.h" #include <basics/utilities/UbException.h> #include <basics/utilities/UbSystem.h> diff --git a/src/gpu/VirtualFluids_GPU/Output/kFullWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/kFullWriter.hpp index 68be148760b831253100d266c61065792aa460ea..1ef164b353eb9bb2f99b8658dcc1201e397197c4 100644 --- a/src/gpu/VirtualFluids_GPU/Output/kFullWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/kFullWriter.hpp @@ -10,7 +10,7 @@ //#include <cmath> //#include "LBM/LB.h" -//#include "LBM/D3Q27.h" +//#include "lbm/constants/D3Q27.h" #include "basics/utilities/UbFileOutputASCII.h" #include "Parameter/Parameter.h" diff --git a/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3731836f336d91c1bc4cc5f1a8f5ea0a10bee0a6 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp @@ -0,0 +1,72 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//======================================================================================= +#include "CudaStreamManager.h" +#include <helper_cuda.h> +#include <iostream> + +void CudaStreamManager::launchStreams(uint numberOfStreams) +{ + cudaStreams.resize(numberOfStreams); + for (cudaStream_t &stream : cudaStreams) + cudaStreamCreate(&stream); +} + +void CudaStreamManager::terminateStreams() +{ + for (cudaStream_t &stream : cudaStreams) + cudaStreamDestroy(stream); +} + +cudaStream_t &CudaStreamManager::getStream(uint streamIndex) +{ return cudaStreams[streamIndex]; } + +int CudaStreamManager::getBorderStreamIndex() { return borderStreamIndex; } + +int CudaStreamManager::getBulkStreamIndex() { return bulkStreamIndex; } + +void CudaStreamManager::createCudaEvents() +{ + checkCudaErrors(cudaEventCreateWithFlags(&startBulkKernel, cudaEventDisableTiming)); +} + +void CudaStreamManager::destroyCudaEvents() +{ + checkCudaErrors(cudaEventDestroy(startBulkKernel)); +} + +void CudaStreamManager::triggerStartBulkKernel(int streamIndex) +{ + checkCudaErrors(cudaEventRecord(startBulkKernel, cudaStreams[streamIndex])); +} + +void CudaStreamManager::waitOnStartBulkKernelEvent(int streamIndex) +{ + checkCudaErrors(cudaStreamWaitEvent(cudaStreams[streamIndex], startBulkKernel)); +} diff --git a/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.h b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.h new file mode 100644 index 0000000000000000000000000000000000000000..c2d515ab5fe9c24388632a7ca9e1e4c78b7f1467 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.h @@ -0,0 +1,61 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//======================================================================================= +#ifndef STREAM_MANAGER_H +#define STREAM_MANAGER_H + +#include <vector> +#include "Core/DataTypes.h" + +#include <cuda_runtime.h> + +class CudaStreamManager +{ +private: + std::vector<cudaStream_t> cudaStreams; + cudaEvent_t startBulkKernel = NULL; + const int borderStreamIndex = 1; + const int bulkStreamIndex = 0; + +public: + void launchStreams(uint numberOfStreams); + void terminateStreams(); + cudaStream_t &getStream(uint streamIndex); + + int getBorderStreamIndex(); + int getBulkStreamIndex(); + + // Events + void createCudaEvents(); + void destroyCudaEvents(); + void triggerStartBulkKernel(int streamIndex); + void waitOnStartBulkKernelEvent(int strteamIndex); +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Parameter/EdgeNodeFinder.cpp b/src/gpu/VirtualFluids_GPU/Parameter/EdgeNodeFinder.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fc1d9b19752be009c8105e5d2759c33afe8e9400 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Parameter/EdgeNodeFinder.cpp @@ -0,0 +1,74 @@ +#include <vector> +#include <optional> + +#include "EdgeNodeFinder.h" +#include "Parameter.h" + +namespace vf::gpu +{ +//! \brief Find nodes that are both received in the x-direction and sent in the y-direction +void findEdgeNodesXY(LBMSimulationParameter& parameterLB); +//! \brief Find nodes that are both received in the x-direction and sent in the z-direction +void findEdgeNodesXZ(LBMSimulationParameter& parameterLB); +//! \brief Find nodes that are both received in the y-direction and sent in the z-direction +void findEdgeNodesYZ(LBMSimulationParameter& parameterLB); +void findEdgeNodes(const std::vector<ProcessNeighbor27> &recvProcessNeighbor, + const std::vector<ProcessNeighbor27> &sendProcessNeighbor, + std::vector<LBMSimulationParameter::EdgeNodePositions> &edgeNodes); +std::optional<std::pair<int, int>> findIndexInSendNodes(const int nodeIndex, + const std::vector<ProcessNeighbor27> &sendProcessNeighbor); + +void findEdgeNodesCommMultiGPU(Parameter& parameter) +{ + for (int level = 0; level <= parameter.getFine(); level++) { + findEdgeNodesXY(*parameter.getParH(level)); + findEdgeNodesXZ(*parameter.getParH(level)); + findEdgeNodesYZ(*parameter.getParH(level)); + } +} + +void findEdgeNodesXY(LBMSimulationParameter& parameterLB) +{ + findEdgeNodes(parameterLB.recvProcessNeighborX, parameterLB.sendProcessNeighborY, + parameterLB.edgeNodesXtoY); +} + +void findEdgeNodesXZ(LBMSimulationParameter& parameterLB) +{ + findEdgeNodes(parameterLB.recvProcessNeighborX, parameterLB.sendProcessNeighborZ, + parameterLB.edgeNodesXtoZ); +} + +void findEdgeNodesYZ(LBMSimulationParameter& parameterLB) +{ + findEdgeNodes(parameterLB.recvProcessNeighborY, parameterLB.sendProcessNeighborZ, + parameterLB.edgeNodesYtoZ); +} + +void findEdgeNodes(const std::vector<ProcessNeighbor27> &recvProcessNeighbor, + const std::vector<ProcessNeighbor27> &sendProcessNeighbor, + std::vector<LBMSimulationParameter::EdgeNodePositions> &edgeNodes) +{ + for (uint neighbor = 0; neighbor < (unsigned int)(recvProcessNeighbor.size()); neighbor++) { + for (int index = 0; index < recvProcessNeighbor[neighbor].numberOfNodes; index++) { + if (auto sendIndices = findIndexInSendNodes(recvProcessNeighbor[neighbor].index[index], sendProcessNeighbor)) { + edgeNodes.emplace_back(neighbor, index, sendIndices->first, sendIndices->second); + } + } + } +} + +std::optional<std::pair<int, int>> findIndexInSendNodes(const int nodeIndex, + const std::vector<ProcessNeighbor27> &sendProcessNeighbor) +{ + for (uint neighbor = 0; neighbor < (unsigned int)sendProcessNeighbor.size(); neighbor++) { + for (int node = 0; node < sendProcessNeighbor[neighbor].numberOfNodes; node++) { + if (sendProcessNeighbor[neighbor].index[node] == nodeIndex) { + return std::pair<int, int>(neighbor, node); + } + } + } + return std::nullopt; +} + +} // namespace vf::gpu diff --git a/src/gpu/VirtualFluids_GPU/Parameter/EdgeNodeFinder.h b/src/gpu/VirtualFluids_GPU/Parameter/EdgeNodeFinder.h new file mode 100644 index 0000000000000000000000000000000000000000..440b307c871ca4d1b3e1a6457c37657f080a33a4 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Parameter/EdgeNodeFinder.h @@ -0,0 +1,50 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file EdgeNodeFinder.h +//! \ingroup Parameter +//! \author Anna Wellmann +//! \brief Functions for finding edge nodes in the multi-gpu implementation +//! \details Edge nodes are nodes, which are part of the communication in multiple directions +//! \ref master thesis of Anna Wellmann (p. 54-57) + +//======================================================================================= +#ifndef GPU_EDGENODES_H +#define GPU_EDGENODES_H + +#include "basics/PointerDefinitions.h" + +class Parameter; + +namespace vf::gpu +{ +//! \brief Find nodes which are part of communication in multiple coordinate directions +void findEdgeNodesCommMultiGPU(Parameter& parameter); +} // namespace vf::gpu + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Parameter/EdgeNodeFinderTest.cpp b/src/gpu/VirtualFluids_GPU/Parameter/EdgeNodeFinderTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c63c1620ae368cdb31ed582814b472b4695114bf --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Parameter/EdgeNodeFinderTest.cpp @@ -0,0 +1,160 @@ +#include <gmock/gmock.h> + +#include <filesystem> + +#include "EdgeNodeFinder.h" +#include "Parameter.h" +#include "basics/config/ConfigurationFile.h" + +bool compareEdgeNodesRecv(const std::vector<LBMSimulationParameter::EdgeNodePositions> &actual, + const std::vector<std::pair<int, int>> &expected) +{ + for (int i = 0; i < (int)expected.size(); i++) { + if (actual[i].indexOfProcessNeighborRecv != expected[i].first) { + return false; + } + if (actual[i].indexInRecvBuffer != expected[i].second) { + return false; + } + } + return true; +} + +bool compareEdgeNodesSend(const std::vector<LBMSimulationParameter::EdgeNodePositions> &actual, + const std::vector<std::pair<int, int>> &expected) +{ + for (int i = 0; i < (int)expected.size(); i++) { + if (actual[i].indexOfProcessNeighborSend != expected[i].first) { + return false; + } + if (actual[i].indexInSendBuffer != expected[i].second) { + return false; + } + } + return true; +} + +class EdgeNodeFinderTest_findEdgeNodes : public testing::Test +{ +protected: + std::shared_ptr<Parameter> para; + const int level = 0; + +private: + void SetUp() override + { + para = std::make_shared<Parameter>(); + para->initLBMSimulationParameter(); + } +}; + +TEST_F(EdgeNodeFinderTest_findEdgeNodes, shouldReturnCorrectVectorForXY) +{ + para->parH[level]->recvProcessNeighborX.push_back(ProcessNeighbor27()); + para->parH[level]->sendProcessNeighborY.push_back(ProcessNeighbor27()); + para->parH[level]->sendProcessNeighborY.push_back(ProcessNeighbor27()); + + const int numRecvNeighbor = (int)para->parH[level]->recvProcessNeighborX.size() - 1; + const int numSendNeighbor = (int)para->parH[level]->sendProcessNeighborY.size() - 1; + + const int sizeRecv = 6; + const int sizeSend = 10; + para->parH[level]->recvProcessNeighborX[numRecvNeighbor].numberOfNodes = sizeRecv; + para->parH[level]->sendProcessNeighborY[numSendNeighbor].numberOfNodes = sizeSend; + + int recvNeighbors[sizeRecv] = { 1, 2, 3, 4, 5, 6 }; + para->parH[level]->recvProcessNeighborX[numRecvNeighbor].index = recvNeighbors; + + int sendNeighbors[sizeSend] = { 20, 1, 21, 22, 6, 23, 5, 24, 25, 26 }; + para->parH[level]->sendProcessNeighborY[numSendNeighbor].index = sendNeighbors; + + vf::gpu::findEdgeNodesCommMultiGPU(*para); + + const std::vector<std::pair<int, int>> expectedEdgeNodesXtoYRecv = { std::pair(numRecvNeighbor, 0), + std::pair(numRecvNeighbor, 4), + std::pair(numRecvNeighbor, 5) }; + + const std::vector<std::pair<int, int>> expectedEdgeNodesXtoYSend = { std::pair(numSendNeighbor, 1), + std::pair(numSendNeighbor, 6), + std::pair(numSendNeighbor, 4) }; + + EXPECT_THAT(para->parH[level]->edgeNodesXtoY.size(), testing::Eq(expectedEdgeNodesXtoYRecv.size())); + EXPECT_TRUE(compareEdgeNodesRecv(para->parH[level]->edgeNodesXtoY, expectedEdgeNodesXtoYRecv)) + << "the edgeNodesXtoY for the receive process do not match the expected nodes"; + EXPECT_TRUE(compareEdgeNodesSend(para->parH[level]->edgeNodesXtoY, expectedEdgeNodesXtoYSend)) + << "the edgeNodesXtoY for the send process do not match the expected nodes"; +} + +TEST_F(EdgeNodeFinderTest_findEdgeNodes, shouldReturnCorrectVectorForXZ) +{ + para->parH[level]->recvProcessNeighborX.push_back(ProcessNeighbor27()); + para->parH[level]->sendProcessNeighborZ.push_back(ProcessNeighbor27()); + para->parH[level]->sendProcessNeighborZ.push_back(ProcessNeighbor27()); + + const int numRecvNeighbor = (int)para->parH[level]->recvProcessNeighborX.size() - 1; + const int numSendNeighbor = (int)para->parH[level]->sendProcessNeighborZ.size() - 1; + + const int sizeRecv = 10; + const int sizeSend = 6; + para->parH[level]->recvProcessNeighborX[numRecvNeighbor].numberOfNodes = sizeRecv; + para->parH[level]->sendProcessNeighborZ[numSendNeighbor].numberOfNodes = sizeSend; + + int recvNeighbors[sizeRecv] = { 20, 1, 21, 22, 6, 23, 5, 24, 25, 26 }; + para->parH[level]->recvProcessNeighborX[numRecvNeighbor].index = recvNeighbors; + + int sendNeighbors[sizeSend] = { 1, 2, 3, 4, 5, 6 }; + para->parH[level]->sendProcessNeighborZ[numSendNeighbor].index = sendNeighbors; + + vf::gpu::findEdgeNodesCommMultiGPU(*para); + + const std::vector<std::pair<int, int>> expectedEdgeNodesXtoZRecv = { std::pair(numRecvNeighbor, 1), + std::pair(numRecvNeighbor, 4), + std::pair(numRecvNeighbor, 6) }; + const std::vector<std::pair<int, int>> expectedEdgeNodesXtoZSend = { std::pair(numSendNeighbor, 0), + std::pair(numSendNeighbor, 5), + std::pair(numSendNeighbor, 4) }; + + EXPECT_THAT(para->parH[level]->edgeNodesXtoZ.size(), testing::Eq(expectedEdgeNodesXtoZRecv.size())); + EXPECT_TRUE(compareEdgeNodesRecv(para->parH[level]->edgeNodesXtoZ, expectedEdgeNodesXtoZRecv)) + << "the edgeNodesXtoZ for the receive process do not match the expected nodes"; + EXPECT_TRUE(compareEdgeNodesSend(para->parH[level]->edgeNodesXtoZ, expectedEdgeNodesXtoZSend)) + << "the edgeNodesXtoZ for the send process do not match the expected nodes"; +} + +TEST_F(EdgeNodeFinderTest_findEdgeNodes, shouldReturnCorrectVectorForYZ) +{ + para->parH[level]->recvProcessNeighborY.push_back(ProcessNeighbor27()); + para->parH[level]->sendProcessNeighborZ.push_back(ProcessNeighbor27()); + para->parH[level]->sendProcessNeighborZ.push_back(ProcessNeighbor27()); + + const int sizeRecv = 10; + const int sizeSend1 = 6; + const int sizeSend2 = 5; + + para->parH[level]->recvProcessNeighborY[0].numberOfNodes = sizeRecv; + para->parH[level]->sendProcessNeighborZ[0].numberOfNodes = sizeSend1; + para->parH[level]->sendProcessNeighborZ[1].numberOfNodes = sizeSend2; + + int recvNeighbors[sizeRecv] = { 20, 1, 9, 22, 6, 23, 5, 24, 11, 26 }; + para->parH[level]->recvProcessNeighborY[0].index = recvNeighbors; + + int sendNeighbors1[sizeSend1] = { 1, 2, 3, 4, 5, 6 }; + int sendNeighbors2[sizeSend2] = { 7, 8, 9, 10, 11 }; + para->parH[level]->sendProcessNeighborZ[0].index = sendNeighbors1; + para->parH[level]->sendProcessNeighborZ[1].index = sendNeighbors2; + + vf::gpu::findEdgeNodesCommMultiGPU(*para); + + const std::vector<std::pair<int, int>> expectedEdgeNodesYtoZRecv = { std::pair(0, 1), std::pair(0, 2), + std::pair(0, 4), std::pair(0, 6), + std::pair(0, 8) }; + const std::vector<std::pair<int, int>> expectedEdgeNodesYtoZSend = { std::pair(0, 0), std::pair(1, 2), + std::pair(0, 5), std::pair(0, 4), + std::pair(1, 4) }; + + EXPECT_THAT(para->parH[level]->edgeNodesYtoZ.size(), testing::Eq(expectedEdgeNodesYtoZRecv.size())); + EXPECT_TRUE(compareEdgeNodesRecv(para->parH[level]->edgeNodesYtoZ, expectedEdgeNodesYtoZRecv)) + << "the edgeNodesYtoZ for the receive process do not match the expected nodes"; + EXPECT_TRUE(compareEdgeNodesSend(para->parH[level]->edgeNodesYtoZ, expectedEdgeNodesYtoZSend)) + << "the edgeNodesYtoZ for the send process do not match the expected nodes"; +} diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp index 2aa00708e5a440f99fe341374dd668a5e764bbdb..7687ec926270f23e57608ca5f3084bd26d4de20e 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp +++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp @@ -1,28 +1,28 @@ //======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ // \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ // -// This file is part of VirtualFluids. VirtualFluids is free software: you can +// This file is part of VirtualFluids. VirtualFluids is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of +// License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. -// +// // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // @@ -32,9 +32,10 @@ //======================================================================================= #include "Parameter.h" -#include <stdio.h> -#include <stdlib.h> -#include <math.h> +#include <cmath> +#include <cstdio> +#include <cstdlib> +#include <optional> #include <curand_kernel.h> @@ -42,31 +43,42 @@ #include <basics/config/ConfigurationFile.h> +#include "Parameter/CudaStreamManager.h" + +Parameter::Parameter() : Parameter(1, 0, {}) {} + +Parameter::Parameter(const vf::basics::ConfigurationFile* configData) : Parameter(1, 0, configData) {} +Parameter::Parameter(int numberOfProcesses, int myId) : Parameter(numberOfProcesses, myId, {}) {} -Parameter::Parameter(const vf::basics::ConfigurationFile &configData, int numberOfProcesses, int myId) +Parameter::Parameter(int numberOfProcesses, int myId, std::optional<const vf::basics::ConfigurationFile*> configData) { - ic.numprocs = numberOfProcesses; - ic.myid = myId; + this->ic.numprocs = numberOfProcesses; + this->ic.myProcessId = myId; - readConfigData(configData); - //initLBMSimulationParameter(); + this->setQuadricLimiters(0.01, 0.01, 0.01); + this->setForcing(0.0, 0.0, 0.0); + + if(configData) + readConfigData(**configData); + + initGridPaths(); + initGridBasePoints(); + initDefaultLBMkernelAllLevels(); } +Parameter::~Parameter() = default; + void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) { - if (configData.contains("NumberOfDevices")) + if (configData.contains("NumberOfDevices")) this->setMaxDev(configData.getValue<int>("NumberOfDevices")); - ////////////////////////////////////////////////////////////////////////// if (configData.contains("Devices")) this->setDevices(configData.getVector<uint>("Devices")); ////////////////////////////////////////////////////////////////////////// if (configData.contains("Path")) this->setOutputPath(configData.getValue<std::string>("Path")); - else - throw std::runtime_error("<Path> need to be defined in config file!"); - ////////////////////////////////////////////////////////////////////////// if (configData.contains("Prefix")) this->setOutputPrefix(configData.getValue<std::string>("Prefix")); @@ -75,7 +87,7 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) this->setPrintFiles(configData.getValue<bool>("WriteGrid")); ////////////////////////////////////////////////////////////////////////// if (configData.contains("GeometryValues")) - this->setGeometryValues(configData.getValue<bool>("GeometryValues")); + this->setUseGeometryValues(configData.getValue<bool>("GeometryValues")); ////////////////////////////////////////////////////////////////////////// if (configData.contains("calc2ndOrderMoments")) this->setCalc2ndOrderMoments(configData.getValue<bool>("calc2ndOrderMoments")); @@ -123,13 +135,13 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) this->setD3Qxx(configData.getValue<int>("D3Qxx")); ////////////////////////////////////////////////////////////////////////// if (configData.contains("TimeEnd")) - this->setTEnd(configData.getValue<int>("TimeEnd")); + this->setTimestepEnd(configData.getValue<int>("TimeEnd")); ////////////////////////////////////////////////////////////////////////// if (configData.contains("TimeOut")) - this->setTOut(configData.getValue<int>("TimeOut")); + this->setTimestepOut(configData.getValue<int>("TimeOut")); ////////////////////////////////////////////////////////////////////////// if (configData.contains("TimeStartOut")) - this->setTStartOut(configData.getValue<int>("TimeStartOut")); + this->setTimestepStartOut(configData.getValue<int>("TimeStartOut")); ////////////////////////////////////////////////////////////////////////// if (configData.contains("TimeStartCalcMedian")) this->setTimeCalcMedStart(configData.getValue<int>("TimeStartCalcMedian")); @@ -150,7 +162,7 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) this->setPressOutZ(configData.getValue<int>("PressOutZ")); ////////////////////////////////////////////////////////////////////////// - //second component + // second component if (configData.contains("DiffOn")) this->setDiffOn(configData.getValue<bool>("DiffOn")); ////////////////////////////////////////////////////////////////////////// @@ -168,10 +180,10 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) ////////////////////////////////////////////////////////////////////////// if (configData.contains("Viscosity_LB")) - this->setViscosity(configData.getValue<real>("Viscosity_LB")); + this->setViscosityLB(configData.getValue<real>("Viscosity_LB")); ////////////////////////////////////////////////////////////////////////// if (configData.contains("Velocity_LB")) - this->setVelocity(configData.getValue<real>("Velocity_LB")); + this->setVelocityLB(configData.getValue<real>("Velocity_LB")); ////////////////////////////////////////////////////////////////////////// if (configData.contains("Viscosity_Ratio_World_to_LB")) this->setViscosityRatio(configData.getValue<real>("Viscosity_Ratio_World_to_LB")); @@ -196,7 +208,21 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) this->setFactorPressBC(configData.getValue<real>("FactorPressBC")); ////////////////////////////////////////////////////////////////////////// - //read Geometry (STL) + // CUDA streams and optimized communication + if (this->getNumprocs() > 1) { + if (configData.contains("useStreams")) { + if (configData.getValue<bool>("useStreams")) + this->setUseStreams(true); + } + + if (configData.contains("useReducedCommunicationInInterpolation")) { + this->useReducedCommunicationAfterFtoC = + configData.getValue<bool>("useReducedCommunicationInInterpolation"); + } + } + ////////////////////////////////////////////////////////////////////////// + + // read Geometry (STL) if (configData.contains("ReadGeometry")) this->setReadGeo(configData.getValue<bool>("ReadGeometry")); @@ -224,72 +250,10 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) ////////////////////////////////////////////////////////////////////////// - std::string gridPath{ "" }; if (configData.contains("GridPath")) - gridPath = configData.getValue<std::string>("GridPath"); - else - throw std::runtime_error("GridPath has to be defined in config file!"); + this->setGridPath(configData.getValue<std::string>("GridPath")); - if (this->getNumprocs() == 1) - gridPath += "/"; - else - gridPath += "/" + StringUtil::toString(this->getMyID()) + "/"; - - // ////////////////////////////////////////////////////////////////////////// - this->setFName(this->getOutputPath() + "/" + this->getOutputPrefix()); - ////////////////////////////////////////////////////////////////////////// - this->setgeoVec(gridPath + "geoVec.dat"); - this->setcoordX(gridPath + "coordX.dat"); - this->setcoordY(gridPath + "coordY.dat"); - this->setcoordZ(gridPath + "coordZ.dat"); - this->setneighborX(gridPath + "neighborX.dat"); - this->setneighborY(gridPath + "neighborY.dat"); - this->setneighborZ(gridPath + "neighborZ.dat"); - this->setneighborWSB(gridPath + "neighborWSB.dat"); - this->setscaleCFC(gridPath + "scaleCFC.dat"); - this->setscaleCFF(gridPath + "scaleCFF.dat"); - this->setscaleFCC(gridPath + "scaleFCC.dat"); - this->setscaleFCF(gridPath + "scaleFCF.dat"); - this->setscaleOffsetCF(gridPath + "offsetVecCF.dat"); - this->setscaleOffsetFC(gridPath + "offsetVecFC.dat"); - this->setgeomBoundaryBcQs(gridPath + "geomBoundaryQs.dat"); - this->setgeomBoundaryBcValues(gridPath + "geomBoundaryValues.dat"); - this->setinletBcQs(gridPath + "inletBoundaryQs.dat"); - this->setinletBcValues(gridPath + "inletBoundaryValues.dat"); - this->setoutletBcQs(gridPath + "outletBoundaryQs.dat"); - this->setoutletBcValues(gridPath + "outletBoundaryValues.dat"); - this->settopBcQs(gridPath + "topBoundaryQs.dat"); - this->settopBcValues(gridPath + "topBoundaryValues.dat"); - this->setbottomBcQs(gridPath + "bottomBoundaryQs.dat"); - this->setbottomBcValues(gridPath + "bottomBoundaryValues.dat"); - this->setfrontBcQs(gridPath + "frontBoundaryQs.dat"); - this->setfrontBcValues(gridPath + "frontBoundaryValues.dat"); - this->setbackBcQs(gridPath + "backBoundaryQs.dat"); - this->setbackBcValues(gridPath + "backBoundaryValues.dat"); - this->setnumberNodes(gridPath + "numberNodes.dat"); - this->setLBMvsSI(gridPath + "LBMvsSI.dat"); - this->setmeasurePoints(gridPath + "measurePoints.dat"); - this->setpropellerValues(gridPath + "propellerValues.dat"); - this->setcpTop(gridPath + "cpTop.dat"); - this->setcpBottom(gridPath + "cpBottom.dat"); - this->setcpBottom2(gridPath + "cpBottom2.dat"); - this->setConcentration(gridPath + "conc.dat"); - this->setStreetVelocity(gridPath + "streetVector.dat"); - ////////////////////////////////////////////////////////////////////////// - // Normals - Geometry - this->setgeomBoundaryNormalX(gridPath + "geomBoundaryNormalX.dat"); - this->setgeomBoundaryNormalY(gridPath + "geomBoundaryNormalY.dat"); - this->setgeomBoundaryNormalZ(gridPath + "geomBoundaryNormalZ.dat"); - // Normals - Inlet - this->setInflowBoundaryNormalX(gridPath + "inletBoundaryNormalX.dat"); - this->setInflowBoundaryNormalY(gridPath + "inletBoundaryNormalY.dat"); - this->setInflowBoundaryNormalZ(gridPath + "inletBoundaryNormalZ.dat"); - // Normals - Outlet - this->setOutflowBoundaryNormalX(gridPath + "outletBoundaryNormalX.dat"); - this->setOutflowBoundaryNormalY(gridPath + "outletBoundaryNormalY.dat"); - this->setOutflowBoundaryNormalZ(gridPath + "outletBoundaryNormalZ.dat"); - ////////////////////////////////////////////////////////////////////////// - // //Forcing + // Forcing real forcingX = 0.0; real forcingY = 0.0; real forcingZ = 0.0; @@ -335,28 +299,6 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) if (configData.contains("endXHotWall")) this->setEndXHotWall(configData.getValue<real>("endXHotWall")); - ////////////////////////////////////////////////////////////////////////// - // for Multi GPU - if (this->getNumprocs() > 1) { - ////////////////////////////////////////////////////////////////////////// - // 3D domain decomposition - std::vector<std::string> sendProcNeighborsX, sendProcNeighborsY, sendProcNeighborsZ; - std::vector<std::string> recvProcNeighborsX, recvProcNeighborsY, recvProcNeighborsZ; - for (int i = 0; i < this->getNumprocs(); i++) { - sendProcNeighborsX.push_back(gridPath + StringUtil::toString(i) + "Xs.dat"); - sendProcNeighborsY.push_back(gridPath + StringUtil::toString(i) + "Ys.dat"); - sendProcNeighborsZ.push_back(gridPath + StringUtil::toString(i) + "Zs.dat"); - recvProcNeighborsX.push_back(gridPath + StringUtil::toString(i) + "Xr.dat"); - recvProcNeighborsY.push_back(gridPath + StringUtil::toString(i) + "Yr.dat"); - recvProcNeighborsZ.push_back(gridPath + StringUtil::toString(i) + "Zr.dat"); - } - this->setPossNeighborFilesX(sendProcNeighborsX, "send"); - this->setPossNeighborFilesY(sendProcNeighborsY, "send"); - this->setPossNeighborFilesZ(sendProcNeighborsZ, "send"); - this->setPossNeighborFilesX(recvProcNeighborsX, "recv"); - this->setPossNeighborFilesY(recvProcNeighborsY, "recv"); - this->setPossNeighborFilesZ(recvProcNeighborsZ, "recv"); - } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Restart @@ -375,14 +317,6 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) if (configData.contains("NOGL")) setMaxLevel(configData.getValue<int>("NOGL")); - this->setGridX(std::vector<int>(this->getMaxLevel() + 1, 32)); - this->setGridY(std::vector<int>(this->getMaxLevel() + 1, 32)); - this->setGridZ(std::vector<int>(this->getMaxLevel() + 1, 32)); - - this->setDistX(std::vector<int>(this->getMaxLevel() + 1, 32)); - this->setDistY(std::vector<int>(this->getMaxLevel() + 1, 32)); - this->setDistZ(std::vector<int>(this->getMaxLevel() + 1, 32)); - if (configData.contains("GridX")) this->setGridX(configData.getVector<int>("GridX")); @@ -411,7 +345,126 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) if (configData.contains("MultiKernelLevel")) this->setMultiKernelLevel(configData.getVector<int>("MultiKernelLevel")); - else if (this->getMultiKernelOn()) { + + if (configData.contains("MultiKernelName")) + this->setMultiKernel(configData.getVector<std::string>("MultiKernelName")); +} + +void Parameter::initGridPaths(){ + std::string gridPath = this->getGridPath(); + + // add missing slash to gridPath + if (gridPath.back() != '/') { + gridPath += "/"; + ic.gridPath = gridPath; + } + + // for multi-gpu add process id (if not already there) + if (this->getNumprocs() > 1) { + gridPath += StringUtil::toString(this->getMyProcessID()) + "/"; + ic.gridPath = gridPath; + } + + ////////////////////////////////////////////////////////////////////////// + + this->setgeoVec(gridPath + "geoVec.dat"); + this->setcoordX(gridPath + "coordX.dat"); + this->setcoordY(gridPath + "coordY.dat"); + this->setcoordZ(gridPath + "coordZ.dat"); + this->setneighborX(gridPath + "neighborX.dat"); + this->setneighborY(gridPath + "neighborY.dat"); + this->setneighborZ(gridPath + "neighborZ.dat"); + this->setneighborWSB(gridPath + "neighborWSB.dat"); + this->setscaleCFC(gridPath + "scaleCFC.dat"); + this->setscaleCFF(gridPath + "scaleCFF.dat"); + this->setscaleFCC(gridPath + "scaleFCC.dat"); + this->setscaleFCF(gridPath + "scaleFCF.dat"); + this->setscaleOffsetCF(gridPath + "offsetVecCF.dat"); + this->setscaleOffsetFC(gridPath + "offsetVecFC.dat"); + this->setgeomBoundaryBcQs(gridPath + "geomBoundaryQs.dat"); + this->setgeomBoundaryBcValues(gridPath + "geomBoundaryValues.dat"); + this->setinletBcQs(gridPath + "inletBoundaryQs.dat"); + this->setinletBcValues(gridPath + "inletBoundaryValues.dat"); + this->setoutletBcQs(gridPath + "outletBoundaryQs.dat"); + this->setoutletBcValues(gridPath + "outletBoundaryValues.dat"); + this->settopBcQs(gridPath + "topBoundaryQs.dat"); + this->settopBcValues(gridPath + "topBoundaryValues.dat"); + this->setbottomBcQs(gridPath + "bottomBoundaryQs.dat"); + this->setbottomBcValues(gridPath + "bottomBoundaryValues.dat"); + this->setfrontBcQs(gridPath + "frontBoundaryQs.dat"); + this->setfrontBcValues(gridPath + "frontBoundaryValues.dat"); + this->setbackBcQs(gridPath + "backBoundaryQs.dat"); + this->setbackBcValues(gridPath + "backBoundaryValues.dat"); + this->setnumberNodes(gridPath + "numberNodes.dat"); + this->setLBMvsSI(gridPath + "LBMvsSI.dat"); + this->setmeasurePoints(gridPath + "measurePoints.dat"); + this->setpropellerValues(gridPath + "propellerValues.dat"); + this->setcpTop(gridPath + "cpTop.dat"); + this->setcpBottom(gridPath + "cpBottom.dat"); + this->setcpBottom2(gridPath + "cpBottom2.dat"); + this->setConcentration(gridPath + "conc.dat"); + this->setStreetVelocity(gridPath + "streetVector.dat"); + + ////////////////////////////////////////////////////////////////////////// + // Normals - Geometry + this->setgeomBoundaryNormalX(gridPath + "geomBoundaryNormalX.dat"); + this->setgeomBoundaryNormalY(gridPath + "geomBoundaryNormalY.dat"); + this->setgeomBoundaryNormalZ(gridPath + "geomBoundaryNormalZ.dat"); + // Normals - Inlet + this->setInflowBoundaryNormalX(gridPath + "inletBoundaryNormalX.dat"); + this->setInflowBoundaryNormalY(gridPath + "inletBoundaryNormalY.dat"); + this->setInflowBoundaryNormalZ(gridPath + "inletBoundaryNormalZ.dat"); + // Normals - Outlet + this->setOutflowBoundaryNormalX(gridPath + "outletBoundaryNormalX.dat"); + this->setOutflowBoundaryNormalY(gridPath + "outletBoundaryNormalY.dat"); + this->setOutflowBoundaryNormalZ(gridPath + "outletBoundaryNormalZ.dat"); + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // for Multi GPU + if (this->getNumprocs() > 1) { + + // 3D domain decomposition + std::vector<std::string> sendProcNeighborsX, sendProcNeighborsY, sendProcNeighborsZ; + std::vector<std::string> recvProcNeighborsX, recvProcNeighborsY, recvProcNeighborsZ; + for (int i = 0; i < this->getNumprocs(); i++) { + sendProcNeighborsX.push_back(gridPath + StringUtil::toString(i) + "Xs.dat"); + sendProcNeighborsY.push_back(gridPath + StringUtil::toString(i) + "Ys.dat"); + sendProcNeighborsZ.push_back(gridPath + StringUtil::toString(i) + "Zs.dat"); + recvProcNeighborsX.push_back(gridPath + StringUtil::toString(i) + "Xr.dat"); + recvProcNeighborsY.push_back(gridPath + StringUtil::toString(i) + "Yr.dat"); + recvProcNeighborsZ.push_back(gridPath + StringUtil::toString(i) + "Zr.dat"); + } + this->setPossNeighborFilesX(sendProcNeighborsX, "send"); + this->setPossNeighborFilesY(sendProcNeighborsY, "send"); + this->setPossNeighborFilesZ(sendProcNeighborsZ, "send"); + this->setPossNeighborFilesX(recvProcNeighborsX, "recv"); + this->setPossNeighborFilesY(recvProcNeighborsY, "recv"); + this->setPossNeighborFilesZ(recvProcNeighborsZ, "recv"); + + ////////////////////////////////////////////////////////////////////////// + } +} + +void Parameter::initGridBasePoints() +{ + if (this->getGridX().empty()) + this->setGridX(std::vector<int>(this->getMaxLevel() + 1, 32)); + if (this->getGridY().empty()) + this->setGridY(std::vector<int>(this->getMaxLevel() + 1, 32)); + if (this->getGridZ().empty()) + this->setGridZ(std::vector<int>(this->getMaxLevel() + 1, 32)); + + if (this->getDistX().empty()) + this->setDistX(std::vector<int>(this->getMaxLevel() + 1, 32)); + if (this->getDistY().empty()) + this->setDistY(std::vector<int>(this->getMaxLevel() + 1, 32)); + if (this->getDistZ().empty()) + this->setDistZ(std::vector<int>(this->getMaxLevel() + 1, 32)); +} + +void Parameter::initDefaultLBMkernelAllLevels(){ + if (this->getMultiKernelOn() && this->getMultiKernelLevel().empty()) { std::vector<int> tmp; for (int i = 0; i < this->getMaxLevel() + 1; i++) { tmp.push_back(i); @@ -419,9 +472,7 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) this->setMultiKernelLevel(tmp); } - if (configData.contains("MultiKernelName")) - this->setMultiKernel(configData.getVector<std::string>("MultiKernelName")); - else if (this->getMultiKernelOn()) { + if (this->getMultiKernelOn() && this->getMultiKernel().empty()) { std::vector<std::string> tmp; for (int i = 0; i < this->getMaxLevel() + 1; i++) { tmp.push_back("CumulantK17Comp"); @@ -432,2088 +483,2235 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) void Parameter::initLBMSimulationParameter() { - //host - for (int i = coarse; i <= fine; i++) - { - parH[i] = std::make_shared<LBMSimulationParameter>(); - parH[i]->numberofthreads = 64;// 128; - parH[i]->gridNX = getGridX().at(i); - parH[i]->gridNY = getGridY().at(i); - parH[i]->gridNZ = getGridZ().at(i); - parH[i]->vis = ic.vis*pow(2.f,i); - parH[i]->diffusivity = ic.Diffusivity*pow(2.f,i); - parH[i]->omega = 1.0f/(3.0f*parH[i]->vis+0.5f);//omega :-) not s9 = -1.0f/(3.0f*parH[i]->vis+0.5f);// - parH[i]->nx = parH[i]->gridNX + 2 * STARTOFFX; - parH[i]->ny = parH[i]->gridNY + 2 * STARTOFFY; - parH[i]->nz = parH[i]->gridNZ + 2 * STARTOFFZ; - parH[i]->size_Mat = parH[i]->nx * parH[i]->ny * parH[i]->nz; - parH[i]->sizePlaneXY = parH[i]->nx * parH[i]->ny; - parH[i]->sizePlaneYZ = parH[i]->ny * parH[i]->nz; - parH[i]->sizePlaneXZ = parH[i]->nx * parH[i]->nz; - parH[i]->mem_size_real = sizeof(real ) * parH[i]->size_Mat; - parH[i]->mem_size_int = sizeof(unsigned int) * parH[i]->size_Mat; - parH[i]->mem_size_bool = sizeof(bool ) * parH[i]->size_Mat; - parH[i]->mem_size_real_yz = sizeof(real ) * parH[i]->ny * parH[i]->nz; - parH[i]->evenOrOdd = true; - parH[i]->startz = parH[i]->gridNZ * ic.myid; - parH[i]->endz = parH[i]->gridNZ * ic.myid + parH[i]->gridNZ; - parH[i]->Lx = (real)((1.f*parH[i]->gridNX - 1.f)/(pow(2.f,i))); - parH[i]->Ly = (real)((1.f*parH[i]->gridNY - 1.f)/(pow(2.f,i))); - parH[i]->Lz = (real)((1.f*parH[i]->gridNZ - 1.f)/(pow(2.f,i))); - parH[i]->dx = (real)(1.f/(pow(2.f,i))); - parH[i]->XdistKn = getDistX().at(i); - parH[i]->YdistKn = getDistY().at(i); - parH[i]->ZdistKn = getDistZ().at(i); - if (i == coarse) - { - parH[i]->distX = (real)getDistX().at(i); - parH[i]->distY = (real)getDistY().at(i); - parH[i]->distZ = (real)getDistZ().at(i); - parH[i]->mTtoWx = (real)1.0f; - parH[i]->mTtoWy = (real)1.0f; - parH[i]->mTtoWz = (real)1.0f; - parH[i]->cTtoWx = (real)0.0f; - parH[i]->cTtoWy = (real)0.0f; - parH[i]->cTtoWz = (real)0.0f; - ////MGs Trafo/////////////////////////////////////////////////////////////// - //parH[i]->cStartx = (real)parH[i]->XdistKn; - //parH[i]->cStarty = (real)parH[i]->XdistKn; - //parH[i]->cStartz = (real)parH[i]->XdistKn; - //////////////////////////////////////////////////////////////////////////// - } - else - { - //Geller - parH[i]->distX = ((real)getDistX().at(i) + 0.25f) * parH[i-1]->dx; - parH[i]->distY = ((real)getDistY().at(i) + 0.25f) * parH[i-1]->dx; - parH[i]->distZ = ((real)getDistZ().at(i) + 0.25f) * parH[i-1]->dx; - //parH[i]->distX = ((real)getDistX().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distX; - //parH[i]->distY = ((real)getDistY().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distY; - //parH[i]->distZ = ((real)getDistZ().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distZ; - parH[i]->mTtoWx = (real)pow(0.5f,i); - parH[i]->mTtoWy = (real)pow(0.5f,i); - parH[i]->mTtoWz = (real)pow(0.5f,i); - parH[i]->cTtoWx = (real)(STARTOFFX/2.f + (parH[i]->gridNX+1.f)/4.f); //funzt nur fuer zwei level - parH[i]->cTtoWy = (real)(STARTOFFY/2.f + (parH[i]->gridNY+1.f)/4.f); //funzt nur fuer zwei level - parH[i]->cTtoWz = (real)(STARTOFFZ/2.f + (parH[i]->gridNZ+1.f)/4.f); //funzt nur fuer zwei level - ////MGs Trafo/////////////////////////////////////////////////////////////// - //parH[i]->cStartx = (real)parH[i]->XdistKn; - //parH[i]->cStarty = (real)parH[i]->XdistKn; - //parH[i]->cStartz = (real)parH[i]->XdistKn; - //////////////////////////////////////////////////////////////////////////// - } - } - - //device - for (int i = coarse; i <= fine; i++) - { - parD[i] = std::make_shared<LBMSimulationParameter>(); - parD[i]->numberofthreads = parH[i]->numberofthreads; - parD[i]->gridNX = parH[i]->gridNX; - parD[i]->gridNY = parH[i]->gridNY; - parD[i]->gridNZ = parH[i]->gridNZ; - parD[i]->vis = parH[i]->vis; - parD[i]->diffusivity = parH[i]->diffusivity; - parD[i]->omega = parH[i]->omega; - parD[i]->nx = parH[i]->nx; - parD[i]->ny = parH[i]->ny; - parD[i]->nz = parH[i]->nz; - parD[i]->size_Mat = parH[i]->size_Mat; - parD[i]->sizePlaneXY = parH[i]->sizePlaneXY; - parD[i]->sizePlaneYZ = parH[i]->sizePlaneYZ; - parD[i]->sizePlaneXZ = parH[i]->sizePlaneXZ; - parD[i]->mem_size_real = sizeof(real ) * parD[i]->size_Mat; - parD[i]->mem_size_int = sizeof(unsigned int) * parD[i]->size_Mat; - parD[i]->mem_size_bool = sizeof(bool ) * parD[i]->size_Mat; - parD[i]->mem_size_real_yz = sizeof(real ) * parD[i]->ny * parD[i]->nz; - parD[i]->evenOrOdd = parH[i]->evenOrOdd; - parD[i]->startz = parH[i]->startz; - parD[i]->endz = parH[i]->endz; - parD[i]->Lx = parH[i]->Lx; - parD[i]->Ly = parH[i]->Ly; - parD[i]->Lz = parH[i]->Lz; - parD[i]->dx = parH[i]->dx; - parD[i]->XdistKn = parH[i]->XdistKn; - parD[i]->YdistKn = parH[i]->YdistKn; - parD[i]->ZdistKn = parH[i]->ZdistKn; - parD[i]->distX = parH[i]->distX; - parD[i]->distY = parH[i]->distY; - parD[i]->distZ = parH[i]->distZ; - } + // host + for (int i = coarse; i <= fine; i++) { + parH[i] = std::make_shared<LBMSimulationParameter>(); + parH[i]->numberofthreads = 64; // 128; + parH[i]->gridNX = getGridX().at(i); + parH[i]->gridNY = getGridY().at(i); + parH[i]->gridNZ = getGridZ().at(i); + parH[i]->vis = ic.vis * pow(2.f, i); + parH[i]->diffusivity = ic.Diffusivity * pow(2.f, i); + parH[i]->omega = 1.0f / (3.0f * parH[i]->vis + 0.5f); // omega :-) not s9 = -1.0f/(3.0f*parH[i]->vis+0.5f);// + parH[i]->nx = parH[i]->gridNX + 2 * STARTOFFX; + parH[i]->ny = parH[i]->gridNY + 2 * STARTOFFY; + parH[i]->nz = parH[i]->gridNZ + 2 * STARTOFFZ; + parH[i]->size_Mat = parH[i]->nx * parH[i]->ny * parH[i]->nz; + parH[i]->sizePlaneXY = parH[i]->nx * parH[i]->ny; + parH[i]->sizePlaneYZ = parH[i]->ny * parH[i]->nz; + parH[i]->sizePlaneXZ = parH[i]->nx * parH[i]->nz; + parH[i]->mem_size_real = sizeof(real) * parH[i]->size_Mat; + parH[i]->mem_size_int = sizeof(unsigned int) * parH[i]->size_Mat; + parH[i]->mem_size_bool = sizeof(bool) * parH[i]->size_Mat; + parH[i]->mem_size_real_yz = sizeof(real) * parH[i]->ny * parH[i]->nz; + parH[i]->isEvenTimestep = true; + parH[i]->startz = parH[i]->gridNZ * ic.myProcessId; + parH[i]->endz = parH[i]->gridNZ * ic.myProcessId + parH[i]->gridNZ; + parH[i]->Lx = (real)((1.f * parH[i]->gridNX - 1.f) / (pow(2.f, i))); + parH[i]->Ly = (real)((1.f * parH[i]->gridNY - 1.f) / (pow(2.f, i))); + parH[i]->Lz = (real)((1.f * parH[i]->gridNZ - 1.f) / (pow(2.f, i))); + parH[i]->dx = (real)(1.f / (pow(2.f, i))); + parH[i]->XdistKn = getDistX().at(i); + parH[i]->YdistKn = getDistY().at(i); + parH[i]->ZdistKn = getDistZ().at(i); + if (i == coarse) { + parH[i]->distX = (real)getDistX().at(i); + parH[i]->distY = (real)getDistY().at(i); + parH[i]->distZ = (real)getDistZ().at(i); + parH[i]->mTtoWx = (real)1.0f; + parH[i]->mTtoWy = (real)1.0f; + parH[i]->mTtoWz = (real)1.0f; + parH[i]->cTtoWx = (real)0.0f; + parH[i]->cTtoWy = (real)0.0f; + parH[i]->cTtoWz = (real)0.0f; + ////MGs Trafo/////////////////////////////////////////////////////////////// + // parH[i]->cStartx = (real)parH[i]->XdistKn; + // parH[i]->cStarty = (real)parH[i]->XdistKn; + // parH[i]->cStartz = (real)parH[i]->XdistKn; + //////////////////////////////////////////////////////////////////////////// + } else { + // Geller + parH[i]->distX = ((real)getDistX().at(i) + 0.25f) * parH[i - 1]->dx; + parH[i]->distY = ((real)getDistY().at(i) + 0.25f) * parH[i - 1]->dx; + parH[i]->distZ = ((real)getDistZ().at(i) + 0.25f) * parH[i - 1]->dx; + // parH[i]->distX = ((real)getDistX().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distX; + // parH[i]->distY = ((real)getDistY().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distY; + // parH[i]->distZ = ((real)getDistZ().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distZ; + parH[i]->mTtoWx = (real)pow(0.5f, i); + parH[i]->mTtoWy = (real)pow(0.5f, i); + parH[i]->mTtoWz = (real)pow(0.5f, i); + parH[i]->cTtoWx = (real)(STARTOFFX / 2.f + (parH[i]->gridNX + 1.f) / 4.f); // funzt nur fuer zwei level + parH[i]->cTtoWy = (real)(STARTOFFY / 2.f + (parH[i]->gridNY + 1.f) / 4.f); // funzt nur fuer zwei level + parH[i]->cTtoWz = (real)(STARTOFFZ / 2.f + (parH[i]->gridNZ + 1.f) / 4.f); // funzt nur fuer zwei level + ////MGs Trafo/////////////////////////////////////////////////////////////// + // parH[i]->cStartx = (real)parH[i]->XdistKn; + // parH[i]->cStarty = (real)parH[i]->XdistKn; + // parH[i]->cStartz = (real)parH[i]->XdistKn; + //////////////////////////////////////////////////////////////////////////// + } + } + + // device + for (int i = coarse; i <= fine; i++) { + parD[i] = std::make_shared<LBMSimulationParameter>(); + parD[i]->numberofthreads = parH[i]->numberofthreads; + parD[i]->gridNX = parH[i]->gridNX; + parD[i]->gridNY = parH[i]->gridNY; + parD[i]->gridNZ = parH[i]->gridNZ; + parD[i]->vis = parH[i]->vis; + parD[i]->diffusivity = parH[i]->diffusivity; + parD[i]->omega = parH[i]->omega; + parD[i]->nx = parH[i]->nx; + parD[i]->ny = parH[i]->ny; + parD[i]->nz = parH[i]->nz; + parD[i]->size_Mat = parH[i]->size_Mat; + parD[i]->sizePlaneXY = parH[i]->sizePlaneXY; + parD[i]->sizePlaneYZ = parH[i]->sizePlaneYZ; + parD[i]->sizePlaneXZ = parH[i]->sizePlaneXZ; + parD[i]->mem_size_real = sizeof(real) * parD[i]->size_Mat; + parD[i]->mem_size_int = sizeof(unsigned int) * parD[i]->size_Mat; + parD[i]->mem_size_bool = sizeof(bool) * parD[i]->size_Mat; + parD[i]->mem_size_real_yz = sizeof(real) * parD[i]->ny * parD[i]->nz; + parD[i]->isEvenTimestep = parH[i]->isEvenTimestep; + parD[i]->startz = parH[i]->startz; + parD[i]->endz = parH[i]->endz; + parD[i]->Lx = parH[i]->Lx; + parD[i]->Ly = parH[i]->Ly; + parD[i]->Lz = parH[i]->Lz; + parD[i]->dx = parH[i]->dx; + parD[i]->XdistKn = parH[i]->XdistKn; + parD[i]->YdistKn = parH[i]->YdistKn; + parD[i]->ZdistKn = parH[i]->ZdistKn; + parD[i]->distX = parH[i]->distX; + parD[i]->distY = parH[i]->distY; + parD[i]->distZ = parH[i]->distZ; + } } void Parameter::copyMeasurePointsArrayToVector(int lev) { - int valuesPerClockCycle = (int)(getclockCycleForMP()/getTimestepForMP()); - for(int i = 0; i < (int)parH[lev]->MP.size(); i++) - { - for(int j = 0; j < valuesPerClockCycle; j++) - { - int index = i*valuesPerClockCycle+j; - parH[lev]->MP[i].Vx.push_back(parH[lev]->VxMP[index]); - parH[lev]->MP[i].Vy.push_back(parH[lev]->VyMP[index]); - parH[lev]->MP[i].Vz.push_back(parH[lev]->VzMP[index]); - parH[lev]->MP[i].Rho.push_back(parH[lev]->RhoMP[index]); - } - } + int valuesPerClockCycle = (int)(getclockCycleForMP() / getTimestepForMP()); + for (int i = 0; i < (int)parH[lev]->MP.size(); i++) { + for (int j = 0; j < valuesPerClockCycle; j++) { + int index = i * valuesPerClockCycle + j; + parH[lev]->MP[i].Vx.push_back(parH[lev]->VxMP[index]); + parH[lev]->MP[i].Vy.push_back(parH[lev]->VyMP[index]); + parH[lev]->MP[i].Vz.push_back(parH[lev]->VzMP[index]); + parH[lev]->MP[i].Rho.push_back(parH[lev]->RhoMP[index]); + } + } } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//set-methods +// set-methods //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Parameter::setForcing(real forcingX, real forcingY, real forcingZ) { - this->hostForcing[0] = forcingX; - this->hostForcing[1] = forcingY; - this->hostForcing[2] = forcingZ; + this->hostForcing[0] = forcingX; + this->hostForcing[1] = forcingY; + this->hostForcing[2] = forcingZ; } void Parameter::setQuadricLimiters(real quadricLimiterP, real quadricLimiterM, real quadricLimiterD) { - this->hostQuadricLimiters[0] = quadricLimiterP; - this->hostQuadricLimiters[1] = quadricLimiterM; - this->hostQuadricLimiters[2] = quadricLimiterD; + this->hostQuadricLimiters[0] = quadricLimiterP; + this->hostQuadricLimiters[1] = quadricLimiterM; + this->hostQuadricLimiters[2] = quadricLimiterD; } void Parameter::setPhi(real inPhi) { - Phi = inPhi; + Phi = inPhi; } void Parameter::setAngularVelocity(real inAngVel) { - angularVelocity = inAngVel; + angularVelocity = inAngVel; } void Parameter::setStepEnsight(unsigned int step) { - this->stepEnsight = step; + this->stepEnsight = step; } void Parameter::setOutputCount(unsigned int outputCount) { - this->outputCount = outputCount; + this->outputCount = outputCount; } void Parameter::setlimitOfNodesForVTK(unsigned int limitOfNodesForVTK) { - this->limitOfNodesForVTK = limitOfNodesForVTK; + this->limitOfNodesForVTK = limitOfNodesForVTK; } void Parameter::setStartTurn(unsigned int inStartTurn) { - startTurn = inStartTurn; + startTurn = inStartTurn; } void Parameter::setDiffOn(bool isDiff) { - diffOn = isDiff; + diffOn = isDiff; } void Parameter::setCompOn(bool isComp) { - compOn = isComp; + compOn = isComp; } void Parameter::setDiffMod(int DiffMod) { - diffMod = DiffMod; + diffMod = DiffMod; } void Parameter::setD3Qxx(int d3qxx) { - this->D3Qxx = d3qxx; + this->D3Qxx = d3qxx; } -void Parameter::setMaxLevel(int maxlevel) +void Parameter::setMaxLevel(int numberOfLevels) { - this->maxlevel = maxlevel-1; - this->fine = this->maxlevel; + this->maxlevel = numberOfLevels - 1; + this->fine = this->maxlevel; parH.resize(this->maxlevel + 1); parD.resize(this->maxlevel + 1); } void Parameter::setParticleBasicLevel(int pbl) { - this->particleBasicLevel = pbl; + this->particleBasicLevel = pbl; } void Parameter::setParticleInitLevel(int pil) { - this->particleInitLevel = pil; + this->particleInitLevel = pil; } void Parameter::setNumberOfParticles(int nop) { - this->numberOfParticles = nop; + this->numberOfParticles = nop; } void Parameter::setCalcParticles(bool calcParticles) { - this->calcParticles = calcParticles; + this->calcParticles = calcParticles; } void Parameter::setStartXHotWall(real startXHotWall) { - this->startXHotWall = startXHotWall; + this->startXHotWall = startXHotWall; } void Parameter::setEndXHotWall(real endXHotWall) { - this->endXHotWall = endXHotWall; + this->endXHotWall = endXHotWall; } -void Parameter::setTEnd(unsigned int tend) +void Parameter::setTimestepEnd(unsigned int tend) { - ic.tend = tend; + ic.tend = tend; } -void Parameter::setTOut(unsigned int tout) +void Parameter::setTimestepOut(unsigned int tout) { - ic.tout = tout; + ic.tout = tout; } -void Parameter::setTStartOut(unsigned int tStartOut) +void Parameter::setTimestepStartOut(unsigned int tStartOut) { - ic.tStartOut = tStartOut; + ic.tStartOut = tStartOut; } void Parameter::setTimestepOfCoarseLevel(unsigned int timestep) { - this->timestep = timestep; + this->timestep = timestep; +} +void Parameter::setCalcTurbulenceIntensity(bool calcVelocityAndFluctuations) +{ + this->calcVelocityAndFluctuations = calcVelocityAndFluctuations; } void Parameter::setCalcMedian(bool calcMedian) { - ic.calcMedian = calcMedian; + ic.calcMedian = calcMedian; } void Parameter::setCalcDragLift(bool calcDragLift) { - this->calcDragLift = calcDragLift; + this->calcDragLift = calcDragLift; } void Parameter::setCalcCp(bool calcCp) { - this->calcCp = calcCp; + this->calcCp = calcCp; } void Parameter::setWriteVeloASCIIfiles(bool writeVeloASCII) { - this->writeVeloASCII = writeVeloASCII; + this->writeVeloASCII = writeVeloASCII; } void Parameter::setCalcPlaneConc(bool calcPlaneConc) { - this->calcPlaneConc = calcPlaneConc; + this->calcPlaneConc = calcPlaneConc; } void Parameter::setTimeCalcMedStart(int CalcMedStart) -{ - ic.tCalcMedStart = CalcMedStart; +{ + ic.tCalcMedStart = CalcMedStart; } void Parameter::setTimeCalcMedEnd(int CalcMedEnd) { - ic.tCalcMedEnd = CalcMedEnd; + ic.tCalcMedEnd = CalcMedEnd; } void Parameter::setOutputPath(std::string oPath) { - ic.oPath = oPath; + // add missing slash to outputPath + if (oPath.back() != '/') + oPath += "/"; + + ic.oPath = oPath; + this->setPathAndFilename(this->getOutputPath() + this->getOutputPrefix()); } void Parameter::setOutputPrefix(std::string oPrefix) { - //std::string test = fname; - ic.oPrefix = oPrefix; + ic.oPrefix = oPrefix; + this->setPathAndFilename(this->getOutputPath() + this->getOutputPrefix()); } -void Parameter::setFName(std::string fname) +void Parameter::setPathAndFilename(std::string fname) { - //std::string test = fname; - ic.fname = fname; + ic.fname = fname; +} +void Parameter::setGridPath(std::string gridPath) +{ + ic.gridPath = gridPath; + this->initGridPaths(); } void Parameter::setPrintFiles(bool printfiles) { - ic.printFiles = printfiles; + ic.printFiles = printfiles; } void Parameter::setReadGeo(bool readGeo) { - ic.readGeo = readGeo; + ic.readGeo = readGeo; } void Parameter::setDiffusivity(real Diffusivity) { - ic.Diffusivity = Diffusivity; + ic.Diffusivity = Diffusivity; } void Parameter::setTemperatureInit(real Temp) { - ic.Temp = Temp; + ic.Temp = Temp; } void Parameter::setTemperatureBC(real TempBC) { - ic.TempBC = TempBC; + ic.TempBC = TempBC; } -void Parameter::setViscosity(real Viscosity) +void Parameter::setViscosityLB(real Viscosity) { - ic.vis = Viscosity; + ic.vis = Viscosity; } -void Parameter::setVelocity(real Velocity) +void Parameter::setVelocityLB(real Velocity) { - ic.u0 = Velocity; + ic.u0 = Velocity; } void Parameter::setViscosityRatio(real ViscosityRatio) { - ic.vis_ratio = ViscosityRatio; + ic.vis_ratio = ViscosityRatio; } void Parameter::setVelocityRatio(real VelocityRatio) { - ic.u0_ratio = VelocityRatio; + ic.u0_ratio = VelocityRatio; } void Parameter::setDensityRatio(real DensityRatio) { - ic.delta_rho = DensityRatio; + ic.delta_rho = DensityRatio; } void Parameter::setPressRatio(real PressRatio) { - ic.delta_press = PressRatio; + ic.delta_press = PressRatio; +} +real Parameter::getViscosityRatio() +{ + return ic.vis_ratio; +} +real Parameter::getVelocityRatio() +{ + return ic.u0_ratio; +} +real Parameter::getDensityRatio() +{ + return ic.delta_rho; +} +real Parameter::getPressureRatio() +{ + return ic.delta_press; +} +real Parameter::getTimeRatio() +{ + return this->getViscosityRatio() * pow(this->getVelocityRatio(), -2); +} +real Parameter::getLengthRatio() +{ + return this->getViscosityRatio() / this->getVelocityRatio(); +} +real Parameter::getForceRatio() +{ + return this->getDensityRatio() * this->getVelocityRatio()/this->getTimeRatio(); +} +real Parameter::getScaledViscosityRatio(int level) +{ + return this->getViscosityRatio()/(level+1); +} +real Parameter::getScaledVelocityRatio(int level) +{ + return this->getVelocityRatio(); +} +real Parameter::getScaledDensityRatio(int level) +{ + return this->getDensityRatio(); +} +real Parameter::getScaledPressureRatio(int level) +{ + return this->getPressureRatio(); +} +real Parameter::getScaledTimeRatio(int level) +{ + return this->getTimeRatio()/(level+1); +} +real Parameter::getScaledLengthRatio(int level) +{ + return this->getLengthRatio()/(level+1); +} +real Parameter::getScaledForceRatio(int level) +{ + return this->getForceRatio()*(level+1); } void Parameter::setRealX(real RealX) { - ic.RealX = RealX; + ic.RealX = RealX; } void Parameter::setRealY(real RealY) { - ic.RealY = RealY; + ic.RealY = RealY; } void Parameter::setPressInID(unsigned int PressInID) { - ic.PressInID = PressInID; + ic.PressInID = PressInID; } void Parameter::setPressOutID(unsigned int PressOutID) { - ic.PressOutID = PressOutID; + ic.PressOutID = PressOutID; } void Parameter::setPressInZ(unsigned int PressInZ) { - ic.PressInZ = PressInZ; + ic.PressInZ = PressInZ; } void Parameter::setPressOutZ(unsigned int PressOutZ) { - ic.PressOutZ = PressOutZ; + ic.PressOutZ = PressOutZ; } void Parameter::setMaxDev(int maxdev) { - ic.maxdev = maxdev; + ic.maxdev = maxdev; } void Parameter::setMyID(int myid) { - ic.myid = myid; + ic.myProcessId = myid; } void Parameter::setNumprocs(int numprocs) { - ic.numprocs = numprocs; + ic.numprocs = numprocs; } void Parameter::setDevices(std::vector<uint> devices) { - ic.devices = devices; + ic.devices = devices; } void Parameter::setGeometryFileC(std::string GeometryFileC) { - ic.geometryFileC = GeometryFileC; + ic.geometryFileC = GeometryFileC; } void Parameter::setGeometryFileM(std::string GeometryFileM) { - ic.geometryFileM = GeometryFileM; + ic.geometryFileM = GeometryFileM; } void Parameter::setGeometryFileF(std::string GeometryFileF) { - ic.geometryFileF = GeometryFileF; + ic.geometryFileF = GeometryFileF; } void Parameter::setRe(real Re) { - ic.Re = Re; + ic.Re = Re; } void Parameter::setFactorPressBC(real factorPressBC) { - ic.factorPressBC = factorPressBC; + ic.factorPressBC = factorPressBC; } void Parameter::setIsGeo(bool isGeo) { - ic.isGeo = isGeo; + ic.isGeo = isGeo; } void Parameter::setIsGeoNormal(bool isGeoNormal) { - ic.isGeoNormal = isGeoNormal; + ic.isGeoNormal = isGeoNormal; } void Parameter::setIsInflowNormal(bool isInflowNormal) { - ic.isInflowNormal = isInflowNormal; + ic.isInflowNormal = isInflowNormal; } void Parameter::setIsOutflowNormal(bool isOutflowNormal) { - ic.isOutflowNormal = isOutflowNormal; + ic.isOutflowNormal = isOutflowNormal; } void Parameter::setIsProp(bool isProp) { - ic.isProp = isProp; + ic.isProp = isProp; } void Parameter::setIsCp(bool isCp) { - ic.isCp = isCp; + ic.isCp = isCp; } void Parameter::setConcFile(bool concFile) { - ic.isConc = concFile; + ic.isConc = concFile; } void Parameter::setStreetVelocityFile(bool streetVelocityFile) { - ic.streetVelocityFile = streetVelocityFile; + ic.streetVelocityFile = streetVelocityFile; } void Parameter::setUseMeasurePoints(bool useMeasurePoints) { - ic.isMeasurePoints = useMeasurePoints; + ic.isMeasurePoints = useMeasurePoints; +} +void Parameter::setUseInitNeq(bool useInitNeq) +{ + ic.isInitNeq = useInitNeq; +} +void Parameter::setSimulatePorousMedia(bool simulatePorousMedia) +{ + ic.simulatePorousMedia = simulatePorousMedia; +} +void Parameter::setUseTurbulentViscosity(bool useTurbulentViscosity) +{ + ic.isTurbulentViscosity = useTurbulentViscosity; } void Parameter::setUseWale(bool useWale) { - ic.isWale = useWale; + ic.isWale = useWale; + if (useWale) + setUseTurbulentViscosity(true); } -void Parameter::setUseInitNeq(bool useInitNeq) +void Parameter::setTurbulenceModel(TurbulenceModel turbulenceModel) { - ic.isInitNeq = useInitNeq; + ic.turbulenceModel = turbulenceModel; } -void Parameter::setSimulatePorousMedia(bool simulatePorousMedia) +void Parameter::setSGSConstant(real SGSConstant) { - ic.simulatePorousMedia = simulatePorousMedia; + ic.SGSConstant = SGSConstant; +} +void Parameter::setHasWallModelMonitor(bool hasWallModelMonitor) +{ + ic.hasWallModelMonitor = hasWallModelMonitor; } void Parameter::setIsF3(bool isF3) { - this->isF3 = isF3; + this->isF3 = isF3; } -void Parameter::setIsBodyForce(bool isBodyForce) +void Parameter::setIsBodyForce(bool isBodyForce) { - this->isBodyForce = isBodyForce; + this->isBodyForce = isBodyForce; } void Parameter::setGridX(std::vector<int> GridX) { - ic.GridX = GridX; + ic.GridX = GridX; } void Parameter::setGridY(std::vector<int> GridY) { - ic.GridY = GridY; + ic.GridY = GridY; } void Parameter::setGridZ(std::vector<int> GridZ) { - ic.GridZ = GridZ; + ic.GridZ = GridZ; } void Parameter::setDistX(std::vector<int> DistX) { - ic.DistX = DistX; + ic.DistX = DistX; } void Parameter::setDistY(std::vector<int> DistY) { - ic.DistY = DistY; + ic.DistY = DistY; } void Parameter::setDistZ(std::vector<int> DistZ) { - ic.DistZ = DistZ; + ic.DistZ = DistZ; } void Parameter::setScaleLBMtoSI(std::vector<real> scaleLBMtoSI) { - ic.scaleLBMtoSI = scaleLBMtoSI; + ic.scaleLBMtoSI = scaleLBMtoSI; } void Parameter::setTranslateLBMtoSI(std::vector<real> translateLBMtoSI) { - ic.translateLBMtoSI = translateLBMtoSI; + ic.translateLBMtoSI = translateLBMtoSI; } void Parameter::setMinCoordX(std::vector<real> MinCoordX) { - ic.minCoordX = MinCoordX; + ic.minCoordX = MinCoordX; } void Parameter::setMinCoordY(std::vector<real> MinCoordY) { - ic.minCoordY = MinCoordY; + ic.minCoordY = MinCoordY; } void Parameter::setMinCoordZ(std::vector<real> MinCoordZ) { - ic.minCoordZ = MinCoordZ; + ic.minCoordZ = MinCoordZ; } void Parameter::setMaxCoordX(std::vector<real> MaxCoordX) { - ic.maxCoordX = MaxCoordX; + ic.maxCoordX = MaxCoordX; } void Parameter::setMaxCoordY(std::vector<real> MaxCoordY) { - ic.maxCoordY = MaxCoordY; + ic.maxCoordY = MaxCoordY; } void Parameter::setMaxCoordZ(std::vector<real> MaxCoordZ) { - ic.maxCoordZ = MaxCoordZ; + ic.maxCoordZ = MaxCoordZ; } -void Parameter::setTempH(TempforBoundaryConditions* TempH) +void Parameter::setTempH(TempforBoundaryConditions *TempH) { - this->TempH = TempH; + this->TempH = TempH; } -void Parameter::setTempD(TempforBoundaryConditions* TempD) +void Parameter::setTempD(TempforBoundaryConditions *TempD) { - this->TempD = TempD; + this->TempD = TempD; } -void Parameter::setTempVelH(TempVelforBoundaryConditions* TempVelH) +void Parameter::setTempVelH(TempVelforBoundaryConditions *TempVelH) { - this->TempVelH = TempVelH; + this->TempVelH = TempVelH; } -void Parameter::setTempVelD(TempVelforBoundaryConditions* TempVelD) +void Parameter::setTempVelD(TempVelforBoundaryConditions *TempVelD) { - this->TempVelD = TempVelD; + this->TempVelD = TempVelD; } -void Parameter::setTempPressH(TempPressforBoundaryConditions* TempPressH) +void Parameter::setTempPressH(TempPressforBoundaryConditions *TempPressH) { - this->TempPressH = TempPressH; + this->TempPressH = TempPressH; } -void Parameter::setTempPressD(TempPressforBoundaryConditions* TempPressD) +void Parameter::setTempPressD(TempPressforBoundaryConditions *TempPressD) { - this->TempPressD = TempPressD; + this->TempPressD = TempPressD; } -//void Parameter::setkInflowQ(unsigned int kInflowQ) -//{ -// this->kInflowQ = kInflowQ; -//} -//void Parameter::setkOutflowQ(unsigned int kOutflowQ) -//{ -// this->kOutflowQ = kOutflowQ; -//} -//void Parameter::setQinflowH(QforBoundaryConditions* QinflowH) +// void Parameter::setQinflowH(QforBoundaryConditions* QinflowH) //{ // this->QinflowH = QinflowH; //} -//void Parameter::setQinflowD(QforBoundaryConditions* QinflowD) +// void Parameter::setQinflowD(QforBoundaryConditions* QinflowD) //{ // this->QinflowD = QinflowD; //} -//void Parameter::setQoutflowH(QforBoundaryConditions* QoutflowH) +// void Parameter::setQoutflowH(QforBoundaryConditions* QoutflowH) //{ // this->QoutflowH = QoutflowH; //} -//void Parameter::setQoutflowD(QforBoundaryConditions* QoutflowD) +// void Parameter::setQoutflowD(QforBoundaryConditions* QoutflowD) //{ // this->QoutflowD = QoutflowD; //} void Parameter::setkFull(std::string kFull) { - ic.kFull = kFull; + ic.kFull = kFull; } void Parameter::setgeoFull(std::string geoFull) { - ic.geoFull = geoFull; + ic.geoFull = geoFull; } void Parameter::setgeoVec(std::string geoVec) { - ic.geoVec = geoVec; + ic.geoVec = geoVec; } void Parameter::setcoordX(std::string coordX) { - ic.coordX = coordX; + ic.coordX = coordX; } void Parameter::setcoordY(std::string coordY) { - ic.coordY = coordY; + ic.coordY = coordY; } void Parameter::setcoordZ(std::string coordZ) { - ic.coordZ = coordZ; + ic.coordZ = coordZ; } void Parameter::setneighborX(std::string neighborX) { - ic.neighborX = neighborX; + ic.neighborX = neighborX; } void Parameter::setneighborY(std::string neighborY) { - ic.neighborY = neighborY; + ic.neighborY = neighborY; } void Parameter::setneighborZ(std::string neighborZ) { - ic.neighborZ = neighborZ; + ic.neighborZ = neighborZ; } void Parameter::setneighborWSB(std::string neighborWSB) { - ic.neighborWSB = neighborWSB; + ic.neighborWSB = neighborWSB; } void Parameter::setscaleCFC(std::string scaleCFC) { - ic.scaleCFC = scaleCFC; + ic.scaleCFC = scaleCFC; } void Parameter::setscaleCFF(std::string scaleCFF) { - ic.scaleCFF = scaleCFF; + ic.scaleCFF = scaleCFF; } void Parameter::setscaleFCC(std::string scaleFCC) { - ic.scaleFCC = scaleFCC; + ic.scaleFCC = scaleFCC; } void Parameter::setscaleFCF(std::string scaleFCF) { - ic.scaleFCF = scaleFCF; + ic.scaleFCF = scaleFCF; } void Parameter::setscaleOffsetCF(std::string scaleOffsetCF) { - ic.scaleOffsetCF = scaleOffsetCF; + ic.scaleOffsetCF = scaleOffsetCF; } void Parameter::setscaleOffsetFC(std::string scaleOffsetFC) { - ic.scaleOffsetFC = scaleOffsetFC; + ic.scaleOffsetFC = scaleOffsetFC; } void Parameter::setgeomBoundaryBcQs(std::string geomBoundaryBcQs) { - ic.geomBoundaryBcQs = geomBoundaryBcQs; + ic.geomBoundaryBcQs = geomBoundaryBcQs; } void Parameter::setgeomBoundaryBcValues(std::string geomBoundaryBcValues) { - ic.geomBoundaryBcValues = geomBoundaryBcValues; + ic.geomBoundaryBcValues = geomBoundaryBcValues; } void Parameter::setnoSlipBcPos(std::string noSlipBcPos) { - ic.noSlipBcPos = noSlipBcPos; + ic.noSlipBcPos = noSlipBcPos; } void Parameter::setnoSlipBcQs(std::string noSlipBcQs) { - ic.noSlipBcQs = noSlipBcQs; + ic.noSlipBcQs = noSlipBcQs; } void Parameter::setnoSlipBcValue(std::string noSlipBcValue) { - ic.noSlipBcValue = noSlipBcValue; + ic.noSlipBcValue = noSlipBcValue; } void Parameter::setnoSlipBcValues(std::string noSlipBcValues) { - ic.noSlipBcValues = noSlipBcValues; + ic.noSlipBcValues = noSlipBcValues; } void Parameter::setslipBcPos(std::string slipBcPos) { - ic.slipBcPos = slipBcPos; + ic.slipBcPos = slipBcPos; } void Parameter::setslipBcQs(std::string slipBcQs) { - ic.slipBcQs = slipBcQs; + ic.slipBcQs = slipBcQs; } void Parameter::setslipBcValue(std::string slipBcValue) { - ic.slipBcValue = slipBcValue; + ic.slipBcValue = slipBcValue; } void Parameter::setpressBcPos(std::string pressBcPos) { - ic.pressBcPos = pressBcPos; + ic.pressBcPos = pressBcPos; } void Parameter::setpressBcQs(std::string pressBcQs) { - ic.pressBcQs = pressBcQs; + ic.pressBcQs = pressBcQs; } void Parameter::setpressBcValue(std::string pressBcValue) { - ic.pressBcValue = pressBcValue; + ic.pressBcValue = pressBcValue; } void Parameter::setpressBcValues(std::string pressBcValues) { - ic.pressBcValues = pressBcValues; + ic.pressBcValues = pressBcValues; } void Parameter::setvelBcQs(std::string velBcQs) { - ic.velBcQs = velBcQs; + ic.velBcQs = velBcQs; } void Parameter::setvelBcValues(std::string velBcValues) { - ic.velBcValues = velBcValues; + ic.velBcValues = velBcValues; } void Parameter::setinletBcQs(std::string inletBcQs) { - ic.inletBcQs = inletBcQs; + ic.inletBcQs = inletBcQs; } void Parameter::setinletBcValues(std::string inletBcValues) { - ic.inletBcValues = inletBcValues; + ic.inletBcValues = inletBcValues; } void Parameter::setoutletBcQs(std::string outletBcQs) { - ic.outletBcQs = outletBcQs; + ic.outletBcQs = outletBcQs; } void Parameter::setoutletBcValues(std::string outletBcValues) { - ic.outletBcValues = outletBcValues; + ic.outletBcValues = outletBcValues; } void Parameter::settopBcQs(std::string topBcQs) { - ic.topBcQs = topBcQs; + ic.topBcQs = topBcQs; } void Parameter::settopBcValues(std::string topBcValues) { - ic.topBcValues = topBcValues; + ic.topBcValues = topBcValues; } void Parameter::setbottomBcQs(std::string bottomBcQs) { - ic.bottomBcQs = bottomBcQs; + ic.bottomBcQs = bottomBcQs; } void Parameter::setbottomBcValues(std::string bottomBcValues) { - ic.bottomBcValues = bottomBcValues; + ic.bottomBcValues = bottomBcValues; } void Parameter::setfrontBcQs(std::string frontBcQs) { - ic.frontBcQs = frontBcQs; + ic.frontBcQs = frontBcQs; } void Parameter::setfrontBcValues(std::string frontBcValues) { - ic.frontBcValues = frontBcValues; + ic.frontBcValues = frontBcValues; } void Parameter::setbackBcQs(std::string backBcQs) { - ic.backBcQs = backBcQs; + ic.backBcQs = backBcQs; } void Parameter::setbackBcValues(std::string backBcValues) { - ic.backBcValues = backBcValues; + ic.backBcValues = backBcValues; } void Parameter::setwallBcQs(std::string wallBcQs) { - ic.wallBcQs = wallBcQs; + ic.wallBcQs = wallBcQs; } void Parameter::setwallBcValues(std::string wallBcValues) { - ic.wallBcValues = wallBcValues; + ic.wallBcValues = wallBcValues; } void Parameter::setperiodicBcQs(std::string periodicBcQs) { - ic.periodicBcQs = periodicBcQs; + ic.periodicBcQs = periodicBcQs; } void Parameter::setperiodicBcValues(std::string periodicBcValues) { - ic.periodicBcValues = periodicBcValues; + ic.periodicBcValues = periodicBcValues; } void Parameter::setpropellerQs(std::string propellerQs) { - ic.propellerQs = propellerQs; + ic.propellerQs = propellerQs; } void Parameter::setpropellerValues(std::string propellerValues) { - ic.propellerValues = propellerValues; + ic.propellerValues = propellerValues; } void Parameter::setpropellerCylinder(std::string propellerCylinder) { - ic.propellerCylinder = propellerCylinder; + ic.propellerCylinder = propellerCylinder; } void Parameter::setmeasurePoints(std::string measurePoints) { - ic.measurePoints = measurePoints; + ic.measurePoints = measurePoints; } void Parameter::setnumberNodes(std::string numberNodes) { - ic.numberNodes = numberNodes; + ic.numberNodes = numberNodes; } void Parameter::setLBMvsSI(std::string LBMvsSI) { - ic.LBMvsSI = LBMvsSI; + ic.LBMvsSI = LBMvsSI; } void Parameter::setcpTop(std::string cpTop) { - ic.cpTop = cpTop; + ic.cpTop = cpTop; } void Parameter::setcpBottom(std::string cpBottom) { - ic.cpBottom = cpBottom; + ic.cpBottom = cpBottom; } void Parameter::setcpBottom2(std::string cpBottom2) { - ic.cpBottom2 = cpBottom2; + ic.cpBottom2 = cpBottom2; } void Parameter::setConcentration(std::string concFile) { - ic.concentration = concFile; + ic.concentration = concFile; } void Parameter::setStreetVelocity(std::string streetVelocity) { - ic.streetVelocity = streetVelocity; + ic.streetVelocity = streetVelocity; } void Parameter::setclockCycleForMP(real clockCycleForMP) { - ic.clockCycleForMP = clockCycleForMP; + ic.clockCycleForMP = clockCycleForMP; } void Parameter::setTimeDoCheckPoint(unsigned int tDoCheckPoint) { - ic.tDoCheckPoint = tDoCheckPoint; + ic.tDoCheckPoint = tDoCheckPoint; } void Parameter::setTimeDoRestart(unsigned int tDoRestart) { - ic.tDoRestart = tDoRestart; + ic.tDoRestart = tDoRestart; } void Parameter::setDoCheckPoint(bool doCheckPoint) { - ic.doCheckPoint = doCheckPoint; + ic.doCheckPoint = doCheckPoint; } void Parameter::setDoRestart(bool doRestart) { - ic.doRestart = doRestart; + ic.doRestart = doRestart; } void Parameter::settimestepForMP(unsigned int timestepForMP) { - ic.timeStepForMP = timestepForMP; + ic.timeStepForMP = timestepForMP; } void Parameter::setObj(std::string str, bool isObj) { - if (str == "geo") - { - this->setIsGeo(isObj); - } - else if (str == "prop") - { - this->setIsProp(isObj); - } - else if (str == "cp") - { - this->setIsCp(isObj); - } - else if (str == "geoNormal") - { - this->setIsGeoNormal(isObj); - } - else if (str == "inflowNormal") - { - this->setIsInflowNormal(isObj); - } - else if (str == "outflowNormal") - { - this->setIsOutflowNormal(isObj); - } -} -void Parameter::setGeometryValues(bool GeometryValues) -{ - ic.GeometryValues = GeometryValues; + if (str == "geo") { + this->setIsGeo(isObj); + } else if (str == "prop") { + this->setIsProp(isObj); + } else if (str == "cp") { + this->setIsCp(isObj); + } else if (str == "geoNormal") { + this->setIsGeoNormal(isObj); + } else if (str == "inflowNormal") { + this->setIsInflowNormal(isObj); + } else if (str == "outflowNormal") { + this->setIsOutflowNormal(isObj); + } +} +void Parameter::setUseGeometryValues(bool useGeometryValues) +{ + ic.GeometryValues = useGeometryValues; } void Parameter::setCalc2ndOrderMoments(bool is2ndOrderMoments) { - ic.is2ndOrderMoments = is2ndOrderMoments; + ic.is2ndOrderMoments = is2ndOrderMoments; } void Parameter::setCalc3rdOrderMoments(bool is3rdOrderMoments) { - ic.is3rdOrderMoments = is3rdOrderMoments; + ic.is3rdOrderMoments = is3rdOrderMoments; } void Parameter::setCalcHighOrderMoments(bool isHighOrderMoments) { - ic.isHighOrderMoments = isHighOrderMoments; + ic.isHighOrderMoments = isHighOrderMoments; } void Parameter::setMemsizeGPU(double admem, bool reset) { - if (reset == true) - { - this->memsizeGPU = 0.; - } - else - { - this->memsizeGPU += admem; - } + if (reset == true) { + this->memsizeGPU = 0.; + } else { + this->memsizeGPU += admem; + } } -//1D domain decomposition +// 1D domain decomposition void Parameter::setPossNeighborFiles(std::vector<std::string> possNeighborFiles, std::string sor) { - if (sor=="send") - { - this->possNeighborFilesSend = possNeighborFiles; - } - else if (sor == "recv") - { - this->possNeighborFilesRecv = possNeighborFiles; - } + if (sor == "send") { + this->possNeighborFilesSend = possNeighborFiles; + } else if (sor == "recv") { + this->possNeighborFilesRecv = possNeighborFiles; + } } void Parameter::setNumberOfProcessNeighbors(unsigned int numberOfProcessNeighbors, int level, std::string sor) { - if (sor=="send") - { - parH[level]->sendProcessNeighbor.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighbor.resize(numberOfProcessNeighbors); - } - else if (sor == "recv") - { - parH[level]->recvProcessNeighbor.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighbor.resize(numberOfProcessNeighbors); - } + if (sor == "send") { + parH[level]->sendProcessNeighbor.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighbor.resize(numberOfProcessNeighbors); + } else if (sor == "recv") { + parH[level]->recvProcessNeighbor.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighbor.resize(numberOfProcessNeighbors); + } } void Parameter::setIsNeighbor(bool isNeigbor) { - this->isNeigbor = isNeigbor; + this->isNeigbor = isNeigbor; } -//3D domain decomposition +// 3D domain decomposition void Parameter::setPossNeighborFilesX(std::vector<std::string> possNeighborFiles, std::string sor) { - if (sor=="send") - { - this->possNeighborFilesSendX = possNeighborFiles; - } - else if (sor == "recv") - { - this->possNeighborFilesRecvX = possNeighborFiles; - } + if (sor == "send") { + this->possNeighborFilesSendX = possNeighborFiles; + } else if (sor == "recv") { + this->possNeighborFilesRecvX = possNeighborFiles; + } } void Parameter::setPossNeighborFilesY(std::vector<std::string> possNeighborFiles, std::string sor) { - if (sor=="send") - { - this->possNeighborFilesSendY = possNeighborFiles; - } - else if (sor == "recv") - { - this->possNeighborFilesRecvY = possNeighborFiles; - } + if (sor == "send") { + this->possNeighborFilesSendY = possNeighborFiles; + } else if (sor == "recv") { + this->possNeighborFilesRecvY = possNeighborFiles; + } } void Parameter::setPossNeighborFilesZ(std::vector<std::string> possNeighborFiles, std::string sor) { - if (sor=="send") - { - this->possNeighborFilesSendZ = possNeighborFiles; - } - else if (sor == "recv") - { - this->possNeighborFilesRecvZ = possNeighborFiles; - } + if (sor == "send") { + this->possNeighborFilesSendZ = possNeighborFiles; + } else if (sor == "recv") { + this->possNeighborFilesRecvZ = possNeighborFiles; + } } void Parameter::setNumberOfProcessNeighborsX(unsigned int numberOfProcessNeighbors, int level, std::string sor) { - if (sor=="send") - { - parH[level]->sendProcessNeighborX.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborX.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->sendProcessNeighborADX.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborADX.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } - else if (sor == "recv") - { - parH[level]->recvProcessNeighborX.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborX.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->recvProcessNeighborADX.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborADX.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } + if (sor == "send") { + parH[level]->sendProcessNeighborX.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborX.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->sendProcessNeighborADX.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborADX.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } else if (sor == "recv") { + parH[level]->recvProcessNeighborX.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborX.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->recvProcessNeighborADX.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborADX.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } } void Parameter::setNumberOfProcessNeighborsY(unsigned int numberOfProcessNeighbors, int level, std::string sor) { - if (sor=="send") - { - parH[level]->sendProcessNeighborY.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborY.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->sendProcessNeighborADY.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborADY.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } - else if (sor == "recv") - { - parH[level]->recvProcessNeighborY.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborY.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->recvProcessNeighborADY.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborADY.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } + if (sor == "send") { + parH[level]->sendProcessNeighborY.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborY.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->sendProcessNeighborADY.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborADY.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } else if (sor == "recv") { + parH[level]->recvProcessNeighborY.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborY.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->recvProcessNeighborADY.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborADY.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } } void Parameter::setNumberOfProcessNeighborsZ(unsigned int numberOfProcessNeighbors, int level, std::string sor) { - if (sor=="send") - { - parH[level]->sendProcessNeighborZ.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborZ.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->sendProcessNeighborADZ.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborADZ.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } - else if (sor == "recv") - { - parH[level]->recvProcessNeighborZ.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborZ.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->recvProcessNeighborADZ.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborADZ.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } + if (sor == "send") { + parH[level]->sendProcessNeighborZ.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborZ.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->sendProcessNeighborADZ.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborADZ.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } else if (sor == "recv") { + parH[level]->recvProcessNeighborZ.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborZ.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->recvProcessNeighborADZ.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborADZ.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } } void Parameter::setIsNeighborX(bool isNeigbor) { - this->isNeigborX = isNeigbor; + this->isNeigborX = isNeigbor; } void Parameter::setIsNeighborY(bool isNeigbor) { - this->isNeigborY = isNeigbor; + this->isNeigborY = isNeigbor; } void Parameter::setIsNeighborZ(bool isNeigbor) { - this->isNeigborZ = isNeigbor; + this->isNeigborZ = isNeigbor; +} +void Parameter::setSendProcessNeighborsAfterFtoCX(int numberOfNodes, int level, int arrayIndex) +{ + this->getParH(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; +} +void Parameter::setSendProcessNeighborsAfterFtoCY(int numberOfNodes, int level, int arrayIndex) +{ + this->getParH(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; +} +void Parameter::setSendProcessNeighborsAfterFtoCZ(int numberOfNodes, int level, int arrayIndex) +{ + this->getParH(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; +} +void Parameter::setRecvProcessNeighborsAfterFtoCX(int numberOfNodes, int level, int arrayIndex) +{ + this->getParH(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; +} +void Parameter::setRecvProcessNeighborsAfterFtoCY(int numberOfNodes, int level, int arrayIndex) +{ + this->getParH(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; +} +void Parameter::setRecvProcessNeighborsAfterFtoCZ(int numberOfNodes, int level, int arrayIndex) +{ + this->getParH(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; } void Parameter::setgeomBoundaryNormalX(std::string geomNormalX) { - ic.geomNormalX = geomNormalX; + ic.geomNormalX = geomNormalX; } void Parameter::setgeomBoundaryNormalY(std::string geomNormalY) { - ic.geomNormalY = geomNormalY; + ic.geomNormalY = geomNormalY; } void Parameter::setgeomBoundaryNormalZ(std::string geomNormalZ) { - ic.geomNormalZ = geomNormalZ; + ic.geomNormalZ = geomNormalZ; } void Parameter::setInflowBoundaryNormalX(std::string inflowNormalX) { - ic.inflowNormalX = inflowNormalX; + ic.inflowNormalX = inflowNormalX; } void Parameter::setInflowBoundaryNormalY(std::string inflowNormalY) { - ic.inflowNormalY = inflowNormalY; + ic.inflowNormalY = inflowNormalY; } void Parameter::setInflowBoundaryNormalZ(std::string inflowNormalZ) { - ic.inflowNormalZ = inflowNormalZ; + ic.inflowNormalZ = inflowNormalZ; } void Parameter::setOutflowBoundaryNormalX(std::string outflowNormalX) { - ic.outflowNormalX = outflowNormalX; + ic.outflowNormalX = outflowNormalX; } void Parameter::setOutflowBoundaryNormalY(std::string outflowNormalY) { - ic.outflowNormalY = outflowNormalY; + ic.outflowNormalY = outflowNormalY; } void Parameter::setOutflowBoundaryNormalZ(std::string outflowNormalZ) { - ic.outflowNormalZ = outflowNormalZ; + ic.outflowNormalZ = outflowNormalZ; } void Parameter::setMainKernel(std::string kernel) { - this->mainKernel = kernel; + this->mainKernel = kernel; + if (kernel.find("Stream") != std::string::npos || kernel.find("Redesigned") != std::string::npos) + this->kernelNeedsFluidNodeIndicesToRun = true; } void Parameter::setMultiKernelOn(bool isOn) { - this->multiKernelOn = isOn; + this->multiKernelOn = isOn; } -void Parameter::setMultiKernelLevel(std::vector< int> kernelLevel) +void Parameter::setMultiKernelLevel(std::vector<int> kernelLevel) { - this->multiKernelLevel = kernelLevel; + this->multiKernelLevel = kernelLevel; } -void Parameter::setMultiKernel(std::vector< std::string> kernel) +void Parameter::setMultiKernel(std::vector<std::string> kernel) { - this->multiKernel = kernel; + this->multiKernel = kernel; } void Parameter::setADKernel(std::string adKernel) { - this->adKernel = adKernel; + this->adKernel = adKernel; } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//add-methods +// add-methods //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Parameter::addActuator(SPtr<PreCollisionInteractor> actuator) { - actuators.push_back(actuator); + actuators.push_back(actuator); } void Parameter::addProbe(SPtr<PreCollisionInteractor> probe) { - probes.push_back(probe); + probes.push_back(probe); } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//get-methods +// get-methods //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -double* Parameter::getForcesDouble() +double *Parameter::getForcesDouble() { - return this->hostForcing; + return this->hostForcing; } -real* Parameter::getForcesHost() +real *Parameter::getForcesHost() { - return this->forcingH; + return this->forcingH; } -real* Parameter::getForcesDev() +real *Parameter::getForcesDev() { - return this->forcingD; + return this->forcingD; } -double * Parameter::getQuadricLimitersDouble() +double *Parameter::getQuadricLimitersDouble() { return this->hostQuadricLimiters; } -real * Parameter::getQuadricLimitersHost() +real *Parameter::getQuadricLimitersHost() { return this->quadricLimitersH; } -real * Parameter::getQuadricLimitersDev() +real *Parameter::getQuadricLimitersDev() { return this->quadricLimitersD; } real Parameter::getPhi() { - return Phi; + return Phi; } real Parameter::getAngularVelocity() { - return angularVelocity; + return angularVelocity; } real Parameter::getStartXHotWall() { - return this->startXHotWall; + return this->startXHotWall; } real Parameter::getEndXHotWall() { - return this->endXHotWall; + return this->endXHotWall; } unsigned int Parameter::getStepEnsight() { - return this->stepEnsight; + return this->stepEnsight; } unsigned int Parameter::getOutputCount() { - return this->outputCount; + return this->outputCount; } unsigned int Parameter::getlimitOfNodesForVTK() { - return this->limitOfNodesForVTK; + return this->limitOfNodesForVTK; } unsigned int Parameter::getStartTurn() { - return startTurn; + return startTurn; } std::shared_ptr<LBMSimulationParameter> Parameter::getParD(int level) { - return parD[level]; + return parD[level]; } std::shared_ptr<LBMSimulationParameter> Parameter::getParH(int level) { - return parH[level]; + return parH[level]; +} + +const std::vector<std::shared_ptr<LBMSimulationParameter>> &Parameter::getParHallLevels() +{ + return parH; +} +const std::vector<std::shared_ptr<LBMSimulationParameter>> &Parameter::getParDallLevels() +{ + return parD; } + unsigned int Parameter::getSizeMat(int level) { - return parH[level]->size_Mat; + return parH[level]->size_Mat; } unsigned int Parameter::getMemSizereal(int level) { - return parH[level]->mem_size_real; + return parH[level]->mem_size_real; } unsigned int Parameter::getMemSizeInt(int level) { - return parH[level]->mem_size_int; + return parH[level]->mem_size_int; } unsigned int Parameter::getMemSizeBool(int level) { - return parH[level]->mem_size_bool; + return parH[level]->mem_size_bool; } unsigned int Parameter::getMemSizerealYZ(int level) { - return parH[level]->mem_size_real_yz; + return parH[level]->mem_size_real_yz; } int Parameter::getFine() { - return fine; + return fine; } int Parameter::getCoarse() { - return coarse; + return coarse; } int Parameter::getParticleBasicLevel() { - return this->particleBasicLevel; + return this->particleBasicLevel; } int Parameter::getParticleInitLevel() { - return this->particleInitLevel; + return this->particleInitLevel; } int Parameter::getNumberOfParticles() { - return this->numberOfParticles; + return this->numberOfParticles; } bool Parameter::getEvenOrOdd(int level) { - return parH[level]->evenOrOdd; + return parD[level]->isEvenTimestep; } bool Parameter::getDiffOn() { - return diffOn; + return diffOn; } bool Parameter::getCompOn() { - return compOn; + return compOn; } int Parameter::getDiffMod() { - return diffMod; + return diffMod; } int Parameter::getFactorNZ() { - return factor_gridNZ; + return factor_gridNZ; } int Parameter::getD3Qxx() { - return this->D3Qxx; + return this->D3Qxx; } int Parameter::getMaxLevel() { - return this->maxlevel; + return this->maxlevel; } -unsigned int Parameter::getTStart() +unsigned int Parameter::getTimestepStart() { - if (getDoRestart()) - { - return getTimeDoRestart() + 1; - } - else - { - return 1; - } + if (getDoRestart()) { + return getTimeDoRestart() + 1; + } else { + return 1; + } } -unsigned int Parameter::getTInit() +unsigned int Parameter::getTimestepInit() { - if (getDoRestart()) - { - return getTimeDoRestart(); - } - else - { - return 0; - } + if (getDoRestart()) { + return getTimeDoRestart(); + } else { + return 0; + } } -unsigned int Parameter::getTEnd() +unsigned int Parameter::getTimestepEnd() { - return ic.tend; + return ic.tend; } -unsigned int Parameter::getTOut() +unsigned int Parameter::getTimestepOut() { - return ic.tout; + return ic.tout; } -unsigned int Parameter::getTStartOut() +unsigned int Parameter::getTimestepStartOut() { - return ic.tStartOut; + return ic.tStartOut; } bool Parameter::getCalcMedian() { - return ic.calcMedian; + return ic.calcMedian; } bool Parameter::getCalcDragLift() { - return this->calcDragLift; + return this->calcDragLift; } bool Parameter::getCalcCp() { - return this->calcCp; + return this->calcCp; } -bool Parameter::getCalcParticle() +bool Parameter::getCalcParticles() { - return this->calcParticles; + return this->calcParticles; } bool Parameter::getWriteVeloASCIIfiles() { - return this->writeVeloASCII; + return this->writeVeloASCII; } bool Parameter::getCalcPlaneConc() { - return this->calcPlaneConc; + return this->calcPlaneConc; } int Parameter::getTimeCalcMedStart() { - return ic.tCalcMedStart; + return ic.tCalcMedStart; } int Parameter::getTimeCalcMedEnd() { - return ic.tCalcMedEnd; + return ic.tCalcMedEnd; } std::string Parameter::getOutputPath() { - return ic.oPath; + return ic.oPath; } std::string Parameter::getOutputPrefix() { - return ic.oPrefix; + return ic.oPrefix; } std::string Parameter::getFName() { - return ic.fname; + return ic.fname; +} +std::string Parameter::getGridPath() +{ + return ic.gridPath; } bool Parameter::getPrintFiles() { - return ic.printFiles; + return ic.printFiles; } bool Parameter::getReadGeo() { - return ic.readGeo; + return ic.readGeo; +} +bool Parameter::getCalcTurbulenceIntensity() +{ + return this->calcVelocityAndFluctuations; } real Parameter::getDiffusivity() { - return ic.Diffusivity; + return ic.Diffusivity; } real Parameter::getTemperatureInit() { - return ic.Temp; + return ic.Temp; } real Parameter::getTemperatureBC() { - return ic.TempBC; + return ic.TempBC; } real Parameter::getViscosity() { - return ic.vis; + return ic.vis; } real Parameter::getVelocity() { - return ic.u0; -} -real Parameter::getViscosityRatio() -{ - return ic.vis_ratio; -} -real Parameter::getVelocityRatio() -{ - return ic.u0_ratio; -} -real Parameter::getDensityRatio() -{ - return ic.delta_rho; -} -real Parameter::getPressRatio() -{ - return ic.delta_press; -} -real Parameter::getTimeRatio() -{ - return this->getViscosityRatio()*pow(this->getVelocityRatio(),-2); -} -real Parameter::getLengthRatio() -{ - return this->getViscosityRatio()/this->getVelocityRatio(); -} -real Parameter::getForceRatio() -{ - return this->getDensityRatio()*pow(this->getViscosityRatio(),2); + return ic.u0; } real Parameter::getRealX() { - return ic.RealX; + return ic.RealX; } real Parameter::getRealY() { - return ic.RealY; + return ic.RealY; } unsigned int Parameter::getPressInID() { - return ic.PressInID; + return ic.PressInID; } unsigned int Parameter::getPressOutID() { - return ic.PressOutID; + return ic.PressOutID; } unsigned int Parameter::getPressInZ() { - return ic.PressInZ; + return ic.PressInZ; } unsigned int Parameter::getPressOutZ() { - return ic.PressOutZ; + return ic.PressOutZ; } int Parameter::getMaxDev() { - return ic.maxdev; + return ic.maxdev; } -int Parameter::getMyID() +int Parameter::getMyProcessID() { - return ic.myid; + return ic.myProcessId; } int Parameter::getNumprocs() { - return ic.numprocs; + return ic.numprocs; } std::vector<uint> Parameter::getDevices() { - return ic.devices; + return ic.devices; } std::string Parameter::getGeometryFileC() { - return ic.geometryFileC; + return ic.geometryFileC; } std::string Parameter::getGeometryFileM() { - return ic.geometryFileM; + return ic.geometryFileM; } std::string Parameter::getGeometryFileF() { - return ic.geometryFileF; + return ic.geometryFileF; } real Parameter::getRe() { - return ic.Re; + return ic.Re; } real Parameter::getFactorPressBC() { - return ic.factorPressBC; + return ic.factorPressBC; } std::vector<int> Parameter::getGridX() { - return ic.GridX; + return ic.GridX; } std::vector<int> Parameter::getGridY() { - return ic.GridY; + return ic.GridY; } std::vector<int> Parameter::getGridZ() { - return ic.GridZ; + return ic.GridZ; } std::vector<int> Parameter::getDistX() { - return ic.DistX; + return ic.DistX; } std::vector<int> Parameter::getDistY() { - return ic.DistY; + return ic.DistY; } std::vector<int> Parameter::getDistZ() { - return ic.DistZ; + return ic.DistZ; } std::vector<real> Parameter::getScaleLBMtoSI() { - return ic.scaleLBMtoSI; + return ic.scaleLBMtoSI; } std::vector<real> Parameter::getTranslateLBMtoSI() { - return ic.translateLBMtoSI; + return ic.translateLBMtoSI; } std::vector<real> Parameter::getMinCoordX() { - return ic.minCoordX; + return ic.minCoordX; } std::vector<real> Parameter::getMinCoordY() { - return ic.minCoordY; + return ic.minCoordY; } std::vector<real> Parameter::getMinCoordZ() { - return ic.minCoordZ; + return ic.minCoordZ; } std::vector<real> Parameter::getMaxCoordX() { - return ic.maxCoordX; + return ic.maxCoordX; } std::vector<real> Parameter::getMaxCoordY() { - return ic.maxCoordY; + return ic.maxCoordY; } std::vector<real> Parameter::getMaxCoordZ() { - return ic.maxCoordZ; + return ic.maxCoordZ; } -TempforBoundaryConditions* Parameter::getTempH() +TempforBoundaryConditions *Parameter::getTempH() { - return this->TempH; + return this->TempH; } -TempforBoundaryConditions* Parameter::getTempD() +TempforBoundaryConditions *Parameter::getTempD() { - return this->TempD; + return this->TempD; } -TempVelforBoundaryConditions* Parameter::getTempVelH() +TempVelforBoundaryConditions *Parameter::getTempVelH() { - return this->TempVelH; + return this->TempVelH; } -TempVelforBoundaryConditions* Parameter::getTempVelD() +TempVelforBoundaryConditions *Parameter::getTempVelD() { - return this->TempVelD; + return this->TempVelD; } -TempPressforBoundaryConditions* Parameter::getTempPressH() +TempPressforBoundaryConditions *Parameter::getTempPressH() { - return this->TempPressH; + return this->TempPressH; } -TempPressforBoundaryConditions* Parameter::getTempPressD() +TempPressforBoundaryConditions *Parameter::getTempPressD() { - return this->TempPressD; + return this->TempPressD; } -std::vector<SPtr<PreCollisionInteractor>> Parameter::getActuators() -{ - return actuators; -} -std::vector<SPtr<PreCollisionInteractor>> Parameter::getProbes() -{ - return probes; -} -//unsigned int Parameter::getkInflowQ() -//{ -// return this->kInflowQ; -//} -//unsigned int Parameter::getkOutflowQ() -//{ -// return this->kOutflowQ; -//} -//QforBoundaryConditions* Parameter::getQinflowH() +// QforBoundaryConditions* Parameter::getQinflowH() //{ // return this->QinflowH; //} -//QforBoundaryConditions* Parameter::getQinflowD() +// QforBoundaryConditions* Parameter::getQinflowD() //{ // return this->QinflowD; //} -//QforBoundaryConditions* Parameter::getQoutflowH() +// QforBoundaryConditions* Parameter::getQoutflowH() //{ // return this->QoutflowH; //} -//QforBoundaryConditions* Parameter::getQoutflowD() +// QforBoundaryConditions* Parameter::getQoutflowD() //{ // return this->QoutflowD; //} std::string Parameter::getkFull() { - return ic.kFull; + return ic.kFull; } std::string Parameter::getgeoFull() { - return ic.geoFull; + return ic.geoFull; } std::string Parameter::getgeoVec() { - return ic.geoVec; + return ic.geoVec; } std::string Parameter::getcoordX() { - return ic.coordX; + return ic.coordX; } std::string Parameter::getcoordY() { - return ic.coordY; + return ic.coordY; } std::string Parameter::getcoordZ() { - return ic.coordZ; + return ic.coordZ; } std::string Parameter::getneighborX() { - return ic.neighborX; + return ic.neighborX; } std::string Parameter::getneighborY() { - return ic.neighborY; + return ic.neighborY; } std::string Parameter::getneighborZ() { - return ic.neighborZ; + return ic.neighborZ; } std::string Parameter::getneighborWSB() { - return ic.neighborWSB; + return ic.neighborWSB; } std::string Parameter::getscaleCFC() { - return ic.scaleCFC; + return ic.scaleCFC; } std::string Parameter::getscaleCFF() { - return ic.scaleCFF; + return ic.scaleCFF; } std::string Parameter::getscaleFCC() { - return ic.scaleFCC; + return ic.scaleFCC; } std::string Parameter::getscaleFCF() { - return ic.scaleFCF; + return ic.scaleFCF; } std::string Parameter::getscaleOffsetCF() { - return ic.scaleOffsetCF; + return ic.scaleOffsetCF; } std::string Parameter::getscaleOffsetFC() { - return ic.scaleOffsetFC; + return ic.scaleOffsetFC; } std::string Parameter::getgeomBoundaryBcQs() { - return ic.geomBoundaryBcQs; + return ic.geomBoundaryBcQs; } std::string Parameter::getgeomBoundaryBcValues() { - return ic.geomBoundaryBcValues; + return ic.geomBoundaryBcValues; } std::string Parameter::getnoSlipBcPos() { - return ic.noSlipBcPos; + return ic.noSlipBcPos; } std::string Parameter::getnoSlipBcQs() { - return ic.noSlipBcQs; + return ic.noSlipBcQs; } std::string Parameter::getnoSlipBcValue() { - return ic.noSlipBcValue; + return ic.noSlipBcValue; } std::string Parameter::getnoSlipBcValues() { - return ic.noSlipBcValues; + return ic.noSlipBcValues; } std::string Parameter::getslipBcPos() { - return ic.slipBcPos; + return ic.slipBcPos; } std::string Parameter::getslipBcQs() { - return ic.slipBcQs; + return ic.slipBcQs; } std::string Parameter::getslipBcValue() { - return ic.slipBcValue; + return ic.slipBcValue; } std::string Parameter::getpressBcPos() { - return ic.pressBcPos; + return ic.pressBcPos; } std::string Parameter::getpressBcQs() { - return ic.pressBcQs; + return ic.pressBcQs; } std::string Parameter::getpressBcValue() { - return ic.pressBcValue; + return ic.pressBcValue; } std::string Parameter::getpressBcValues() { - return ic.pressBcValues; + return ic.pressBcValues; } std::string Parameter::getvelBcQs() { - return ic.velBcQs; + return ic.velBcQs; } std::string Parameter::getvelBcValues() { - return ic.velBcValues; + return ic.velBcValues; } std::string Parameter::getinletBcQs() { - return ic.inletBcQs; + return ic.inletBcQs; } std::string Parameter::getinletBcValues() { - return ic.inletBcValues; + return ic.inletBcValues; } std::string Parameter::getoutletBcQs() { - return ic.outletBcQs; + return ic.outletBcQs; } std::string Parameter::getoutletBcValues() { - return ic.outletBcValues; + return ic.outletBcValues; } std::string Parameter::gettopBcQs() { - return ic.topBcQs; + return ic.topBcQs; } std::string Parameter::gettopBcValues() { - return ic.topBcValues; + return ic.topBcValues; } std::string Parameter::getbottomBcQs() { - return ic.bottomBcQs; + return ic.bottomBcQs; } std::string Parameter::getbottomBcValues() { - return ic.bottomBcValues; + return ic.bottomBcValues; } std::string Parameter::getfrontBcQs() { - return ic.frontBcQs; + return ic.frontBcQs; } std::string Parameter::getfrontBcValues() { - return ic.frontBcValues; + return ic.frontBcValues; } std::string Parameter::getbackBcQs() { - return ic.backBcQs; + return ic.backBcQs; } std::string Parameter::getbackBcValues() { - return ic.backBcValues; + return ic.backBcValues; } std::string Parameter::getwallBcQs() { - return ic.wallBcQs; + return ic.wallBcQs; } std::string Parameter::getwallBcValues() { - return ic.wallBcValues; + return ic.wallBcValues; } std::string Parameter::getperiodicBcQs() { - return ic.periodicBcQs; + return ic.periodicBcQs; } std::string Parameter::getperiodicBcValues() { - return ic.periodicBcValues; + return ic.periodicBcValues; } std::string Parameter::getpropellerQs() { - return ic.propellerQs; + return ic.propellerQs; } std::string Parameter::getpropellerValues() { - return ic.propellerValues; + return ic.propellerValues; } std::string Parameter::getpropellerCylinder() { - return ic.propellerCylinder; + return ic.propellerCylinder; } std::string Parameter::getmeasurePoints() { - return ic.measurePoints; + return ic.measurePoints; } std::string Parameter::getLBMvsSI() { - return ic.LBMvsSI; + return ic.LBMvsSI; } std::string Parameter::getnumberNodes() { - return ic.numberNodes; + return ic.numberNodes; } std::string Parameter::getcpTop() { - return ic.cpTop; + return ic.cpTop; } std::string Parameter::getcpBottom() { - return ic.cpBottom; + return ic.cpBottom; } std::string Parameter::getcpBottom2() { - return ic.cpBottom2; + return ic.cpBottom2; } std::string Parameter::getConcentration() { - return ic.concentration; + return ic.concentration; } std::string Parameter::getStreetVelocityFilePath() { - return ic.streetVelocity; + return ic.streetVelocity; } real Parameter::getclockCycleForMP() { - return ic.clockCycleForMP; + return ic.clockCycleForMP; } unsigned int Parameter::getTimeDoCheckPoint() { - return ic.tDoCheckPoint; + return ic.tDoCheckPoint; } unsigned int Parameter::getTimeDoRestart() { - return ic.tDoRestart; + return ic.tDoRestart; +} + +//======================================================================================= +//! \brief Get current (sub)time step of a given level. +//! \param level +//! \param t current time step (of level 0) +//! \param isPostCollision whether getTimeStep is called post- (before swap) or pre- (after swap) collision +//! +unsigned int Parameter::getTimeStep(int level, unsigned int t, bool isPostCollision) +{ + if(level>this->getMaxLevel()) throw std::runtime_error("Parameter::getTimeStep: level>this->getMaxLevel()!"); + unsigned int tLevel = t; + if(level>0) + { + for(int i=1; i<level; i++){ tLevel = 1 + 2*(tLevel-1) + !this->getEvenOrOdd(i); } + bool addOne = isPostCollision? !this->getEvenOrOdd(level): this->getEvenOrOdd(level); + tLevel = 1 + 2*(tLevel-1) + addOne; + } + return tLevel; } + bool Parameter::getDoCheckPoint() { - return ic.doCheckPoint; + return ic.doCheckPoint; } bool Parameter::getDoRestart() { - return ic.doRestart; + return ic.doRestart; } bool Parameter::getIsGeo() { - return ic.isGeo; + return ic.isGeo; } bool Parameter::getIsGeoNormal() { - return ic.isGeoNormal; + return ic.isGeoNormal; } bool Parameter::getIsInflowNormal() { - return ic.isInflowNormal; + return ic.isInflowNormal; } bool Parameter::getIsOutflowNormal() { - return ic.isOutflowNormal; + return ic.isOutflowNormal; } bool Parameter::getIsCp() { - return ic.isCp; + return ic.isCp; } bool Parameter::getConcFile() { - return ic.isConc; + return ic.isConc; } bool Parameter::isStreetVelocityFile() { - return ic.streetVelocityFile; + return ic.streetVelocityFile; } bool Parameter::getUseMeasurePoints() { - return ic.isMeasurePoints; + return ic.isMeasurePoints; } bool Parameter::getUseWale() { - return ic.isWale; + return ic.isWale; +} +TurbulenceModel Parameter::getTurbulenceModel() +{ + return ic.turbulenceModel; +} +bool Parameter::getUseTurbulentViscosity() +{ + return ic.isTurbulentViscosity; +} +real Parameter::getSGSConstant() +{ + return ic.SGSConstant; +} +bool Parameter::getHasWallModelMonitor() +{ + return ic.hasWallModelMonitor; +} +std::vector<SPtr<PreCollisionInteractor>> Parameter::getActuators() +{ + return actuators; +} +std::vector<SPtr<PreCollisionInteractor>> Parameter::getProbes() +{ + return probes; } bool Parameter::getUseInitNeq() { - return ic.isInitNeq; + return ic.isInitNeq; } bool Parameter::getSimulatePorousMedia() { - return ic.simulatePorousMedia; + return ic.simulatePorousMedia; } bool Parameter::getIsF3() { - return this->isF3; + return this->isF3; } -bool Parameter::getIsBodyForce() -{ - return this->isBodyForce; +bool Parameter::getIsBodyForce() +{ + return this->isBodyForce; } bool Parameter::getIsGeometryValues() { - return ic.GeometryValues; + return ic.GeometryValues; } bool Parameter::getCalc2ndOrderMoments() { - return ic.is2ndOrderMoments; + return ic.is2ndOrderMoments; } bool Parameter::getCalc3rdOrderMoments() { - return ic.is3rdOrderMoments; + return ic.is3rdOrderMoments; } bool Parameter::getCalcHighOrderMoments() { - return ic.isHighOrderMoments; + return ic.isHighOrderMoments; } bool Parameter::getIsProp() { - return ic.isProp; + return ic.isProp; } bool Parameter::overWritingRestart(uint t) { - return t == getTimeDoRestart(); + return t == getTimeDoRestart(); } unsigned int Parameter::getTimestepForMP() { - return ic.timeStepForMP; + return ic.timeStepForMP; } unsigned int Parameter::getTimestepOfCoarseLevel() { - return this->timestep; + return this->timestep; } double Parameter::getMemsizeGPU() { - return this->memsizeGPU; + return this->memsizeGPU; } -//1D domain decomposition +// 1D domain decomposition std::vector<std::string> Parameter::getPossNeighborFiles(std::string sor) { - if (sor=="send") - { - return this->possNeighborFilesSend; - } - else if (sor == "recv") - { - return this->possNeighborFilesRecv; - } + if (sor == "send") { + return this->possNeighborFilesSend; + } else if (sor == "recv") { + return this->possNeighborFilesRecv; + } throw std::runtime_error("Parameter string invalid."); } unsigned int Parameter::getNumberOfProcessNeighbors(int level, std::string sor) { - if (sor=="send") - { - return (unsigned int)parH[level]->sendProcessNeighbor.size(); - } - else if (sor == "recv") - { - return (unsigned int)parH[level]->recvProcessNeighbor.size(); - } + if (sor == "send") { + return (unsigned int)parH[level]->sendProcessNeighbor.size(); + } else if (sor == "recv") { + return (unsigned int)parH[level]->recvProcessNeighbor.size(); + } throw std::runtime_error("Parameter string invalid."); } bool Parameter::getIsNeighbor() { - return this->isNeigbor; + return this->isNeigbor; } -//3D domain decomposition +// 3D domain decomposition std::vector<std::string> Parameter::getPossNeighborFilesX(std::string sor) { - if (sor=="send") - { - return this->possNeighborFilesSendX; - } - else if (sor == "recv") - { - return this->possNeighborFilesRecvX; - } + if (sor == "send") { + return this->possNeighborFilesSendX; + } else if (sor == "recv") { + return this->possNeighborFilesRecvX; + } throw std::runtime_error("Parameter string invalid."); } std::vector<std::string> Parameter::getPossNeighborFilesY(std::string sor) { - if (sor=="send") - { - return this->possNeighborFilesSendY; - } - else if (sor == "recv") - { - return this->possNeighborFilesRecvY; - } + if (sor == "send") { + return this->possNeighborFilesSendY; + } else if (sor == "recv") { + return this->possNeighborFilesRecvY; + } throw std::runtime_error("Parameter string invalid."); } std::vector<std::string> Parameter::getPossNeighborFilesZ(std::string sor) { - if (sor=="send") - { - return this->possNeighborFilesSendZ; - } - else if (sor == "recv") - { - return this->possNeighborFilesRecvZ; - } + if (sor == "send") { + return this->possNeighborFilesSendZ; + } else if (sor == "recv") { + return this->possNeighborFilesRecvZ; + } throw std::runtime_error("Parameter string invalid."); } unsigned int Parameter::getNumberOfProcessNeighborsX(int level, std::string sor) { - if (sor=="send") - { - return (unsigned int)parH[level]->sendProcessNeighborX.size(); - } - else if (sor == "recv") - { - return (unsigned int)parH[level]->recvProcessNeighborX.size(); - } - throw std::runtime_error("Parameter string invalid."); + if (sor == "send") { + return (unsigned int)parH[level]->sendProcessNeighborX.size(); + } else if (sor == "recv") { + return (unsigned int)parH[level]->recvProcessNeighborX.size(); + } + throw std::runtime_error("getNumberOfProcessNeighborsX: Parameter string invalid."); } unsigned int Parameter::getNumberOfProcessNeighborsY(int level, std::string sor) { - if (sor=="send") - { - return (unsigned int)parH[level]->sendProcessNeighborY.size(); - } - else if (sor == "recv") - { - return (unsigned int)parH[level]->recvProcessNeighborY.size(); - } - throw std::runtime_error("Parameter string invalid."); + if (sor == "send") { + return (unsigned int)parH[level]->sendProcessNeighborY.size(); + } else if (sor == "recv") { + return (unsigned int)parH[level]->recvProcessNeighborY.size(); + } + throw std::runtime_error("getNumberOfProcessNeighborsY: Parameter string invalid."); } unsigned int Parameter::getNumberOfProcessNeighborsZ(int level, std::string sor) { - if (sor=="send") - { - return (unsigned int)parH[level]->sendProcessNeighborZ.size(); - } - else if (sor == "recv") - { - return (unsigned int)parH[level]->recvProcessNeighborZ.size(); - } - throw std::runtime_error("Parameter string invalid."); + if (sor == "send") { + return (unsigned int)parH[level]->sendProcessNeighborZ.size(); + } else if (sor == "recv") { + return (unsigned int)parH[level]->recvProcessNeighborZ.size(); + } + throw std::runtime_error("getNumberOfProcessNeighborsZ: Parameter string invalid."); } bool Parameter::getIsNeighborX() { - return this->isNeigborX; + return this->isNeigborX; } bool Parameter::getIsNeighborY() { - return this->isNeigborY; + return this->isNeigborY; } bool Parameter::getIsNeighborZ() { - return this->isNeigborZ; + return this->isNeigborZ; } std::string Parameter::getgeomBoundaryNormalX() { - return ic.geomNormalX; + return ic.geomNormalX; } std::string Parameter::getgeomBoundaryNormalY() { - return ic.geomNormalY; + return ic.geomNormalY; } std::string Parameter::getgeomBoundaryNormalZ() { - return ic.geomNormalZ; + return ic.geomNormalZ; } std::string Parameter::getInflowBoundaryNormalX() { - return ic.inflowNormalX; + return ic.inflowNormalX; } std::string Parameter::getInflowBoundaryNormalY() { - return ic.inflowNormalY; + return ic.inflowNormalY; } std::string Parameter::getInflowBoundaryNormalZ() { - return ic.inflowNormalZ; + return ic.inflowNormalZ; } std::string Parameter::getOutflowBoundaryNormalX() { - return ic.outflowNormalX; + return ic.outflowNormalX; } std::string Parameter::getOutflowBoundaryNormalY() { - return ic.outflowNormalY; + return ic.outflowNormalY; } std::string Parameter::getOutflowBoundaryNormalZ() { - return ic.outflowNormalZ; + return ic.outflowNormalZ; } -curandState* Parameter::getRandomState() +curandState *Parameter::getRandomState() { - return this->devState; + return this->devState; } std::string Parameter::getMainKernel() { - return mainKernel; + return mainKernel; } bool Parameter::getMultiKernelOn() { - return multiKernelOn; + return multiKernelOn; } -std::vector< int> Parameter::getMultiKernelLevel() +std::vector<int> Parameter::getMultiKernelLevel() { - return multiKernelLevel; + return multiKernelLevel; } std::vector<std::string> Parameter::getMultiKernel() { - return multiKernel; + return multiKernel; } std::string Parameter::getADKernel() { - return adKernel; + return adKernel; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -void Parameter::setInitialCondition(std::function<void(real,real,real,real&,real&,real&,real&)> initialCondition) +// initial condition fluid +void Parameter::setInitialCondition( + std::function<void(real, real, real, real &, real &, real &, real &)> initialCondition) { this->initialCondition = initialCondition; } -std::function<void(real,real,real,real&,real&,real&,real&)>& Parameter::getInitialCondition() +std::function<void(real, real, real, real &, real &, real &, real &)> &Parameter::getInitialCondition() { return this->initialCondition; } +// initial condition concentration +void Parameter::setInitialConditionAD(std::function<void(real, real, real, real&)> initialConditionAD) +{ + this->initialConditionAD = initialConditionAD; +} + +std::function<void(real, real, real, real&)>& Parameter::getInitialConditionAD() +{ + return this->initialConditionAD; +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + real Parameter::TrafoXtoWorld(int CoordX, int level) { - return (parH[level]->mTtoWx*CoordX+parH[level]->cTtoWx); + return (parH[level]->mTtoWx * CoordX + parH[level]->cTtoWx); } real Parameter::TrafoYtoWorld(int CoordY, int level) { - return (parH[level]->mTtoWy*CoordY+parH[level]->cTtoWy); + return (parH[level]->mTtoWy * CoordY + parH[level]->cTtoWy); } real Parameter::TrafoZtoWorld(int CoordZ, int level) { - return (parH[level]->mTtoWz*CoordZ+parH[level]->cTtoWz); + return (parH[level]->mTtoWz * CoordZ + parH[level]->cTtoWz); } real Parameter::TrafoXtoMGsWorld(int CoordX, int level) { - real temp = 0; - for (int i = 0; i <= level; i++) - { - temp += (parH[i]->XdistKn + 0.25f) * 2.f * parH[i]->dx; - } - temp += (real)((CoordX ) * parH[level]->dx); - return temp; + real temp = 0; + for (int i = 0; i <= level; i++) { + temp += (parH[i]->XdistKn + 0.25f) * 2.f * parH[i]->dx; + } + temp += (real)((CoordX)*parH[level]->dx); + return temp; } real Parameter::TrafoYtoMGsWorld(int CoordY, int level) { - real temp = 0; - for (int i = 0; i <= level; i++) - { - temp += (parH[i]->YdistKn + 0.25f) * 2.f * parH[i]->dx; - } - temp += (real)((CoordY ) * parH[level]->dx); - return temp; + real temp = 0; + for (int i = 0; i <= level; i++) { + temp += (parH[i]->YdistKn + 0.25f) * 2.f * parH[i]->dx; + } + temp += (real)((CoordY)*parH[level]->dx); + return temp; } real Parameter::TrafoZtoMGsWorld(int CoordZ, int level) { - real temp = 0; - for (int i = 0; i <= level; i++) - { - temp += (parH[i]->ZdistKn + 0.25f) * 2.f * parH[i]->dx; - } - temp += (real)((CoordZ) * parH[level]->dx); - return temp; + real temp = 0; + for (int i = 0; i <= level; i++) { + temp += (parH[i]->ZdistKn + 0.25f) * 2.f * parH[i]->dx; + } + temp += (real)((CoordZ)*parH[level]->dx); + return temp; +} + +void Parameter::setUseStreams(bool useStreams) +{ + if (useStreams) { + if (this->getNumprocs() != 1) { + this->useStreams = useStreams; + this->cudaStreamManager = std::make_unique<CudaStreamManager>(); + return; + } else { + std::cout << "Can't use streams with only one process!" << std::endl; + } + } + this->useStreams = false; +} + +bool Parameter::getUseStreams() +{ + return this->useStreams; +} + +std::unique_ptr<CudaStreamManager> &Parameter::getStreamManager() +{ + return this->cudaStreamManager; +} + +bool Parameter::getKernelNeedsFluidNodeIndicesToRun() +{ + return this->kernelNeedsFluidNodeIndicesToRun; +} + +void Parameter::setKernelNeedsFluidNodeIndicesToRun(bool kernelNeedsFluidNodeIndicesToRun){ + this->kernelNeedsFluidNodeIndicesToRun = kernelNeedsFluidNodeIndicesToRun; +} + +void Parameter::initProcessNeighborsAfterFtoCX(int level) +{ + this->getParH(level)->sendProcessNeighborsAfterFtoCX.resize(this->getParH(level)->sendProcessNeighborX.size()); + this->getParH(level)->recvProcessNeighborsAfterFtoCX.resize(this->getParH(level)->recvProcessNeighborX.size()); + this->getParD(level)->sendProcessNeighborsAfterFtoCX.resize( + this->getParH(level)->sendProcessNeighborsAfterFtoCX.size()); + this->getParD(level)->recvProcessNeighborsAfterFtoCX.resize( + this->getParH(level)->recvProcessNeighborsAfterFtoCX.size()); +} + +void Parameter::initProcessNeighborsAfterFtoCY(int level) +{ + this->getParH(level)->sendProcessNeighborsAfterFtoCY.resize(this->getParH(level)->sendProcessNeighborY.size()); + this->getParH(level)->recvProcessNeighborsAfterFtoCY.resize(this->getParH(level)->recvProcessNeighborY.size()); + this->getParD(level)->sendProcessNeighborsAfterFtoCY.resize( + this->getParH(level)->sendProcessNeighborsAfterFtoCY.size()); + this->getParD(level)->recvProcessNeighborsAfterFtoCY.resize( + this->getParH(level)->recvProcessNeighborsAfterFtoCY.size()); +} + +void Parameter::initProcessNeighborsAfterFtoCZ(int level) +{ + this->getParH(level)->sendProcessNeighborsAfterFtoCZ.resize(this->getParH(level)->sendProcessNeighborZ.size()); + this->getParH(level)->recvProcessNeighborsAfterFtoCZ.resize(this->getParH(level)->recvProcessNeighborZ.size()); + this->getParD(level)->sendProcessNeighborsAfterFtoCZ.resize( + this->getParH(level)->sendProcessNeighborsAfterFtoCZ.size()); + this->getParD(level)->recvProcessNeighborsAfterFtoCZ.resize( + this->getParH(level)->recvProcessNeighborsAfterFtoCZ.size()); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h index 06161934b52e35c2a0932277a651bbdc102424a8..cbb8bfd68702bc2285947eb76e6d0adc54a5b6c1 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h +++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h @@ -1,28 +1,28 @@ //======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ // \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ // -// This file is part of VirtualFluids. VirtualFluids is free software: you can +// This file is part of VirtualFluids. VirtualFluids is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of +// License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. -// +// // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // @@ -33,49 +33,59 @@ #ifndef GPU_PARAMETER_H #define GPU_PARAMETER_H -#include <vector> -#include <string> -#include <memory> #include <functional> +#include <memory> +#include <string> +#include <vector> +#include <optional> -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include "LBM/LB.h" #include "PreCollisionInteractor/PreCollisionInteractor.h" +#include "TurbulenceModels/TurbulenceModelFactory.h" #include "VirtualFluids_GPU_export.h" - struct curandStateXORWOW; -typedef struct curandStateXORWOW curandState; -namespace vf -{ -namespace basics +using curandState = struct curandStateXORWOW; +namespace vf:: basics { class ConfigurationFile; } -} +class CudaStreamManager; //! \struct LBMSimulationParameter //! \brief struct holds and manages the LB-parameter of the simulation //! \brief For this purpose it holds structures and pointer for host and device data, respectively. -struct LBMSimulationParameter -{ - bool evenOrOdd; - unsigned int numberofthreads; +struct LBMSimulationParameter { + ////////////////////////////////////////////////////////////////////////// + //! \brief decides if the simulation timestep is even or odd + //! \brief this information is important for the esoteric twist + bool isEvenTimestep; + ////////////////////////////////////////////////////////////////////////// + //! \brief stores the number of threads per GPU block + uint numberofthreads; // distributions/////////// // Distributions19 d0; - Distributions27 d0; - Distributions27 d0SP; + Distributions27 d0; // DEPRECATED: distribution functions for full matrix (not sparse) + //! \brief store all distribution functions for the D3Q27 + Distributions27 distributions; // distributions F3//////// Distributions6 g6; - // thermo////////////////// - Distributions7 d7; - Distributions27 d27; + // advection diffusion ////////////////// + //! \brief store all distribution functions for the D3Q7 advection diffusion field + Distributions7 distributionsAD7; + //! \brief store all distribution functions for the D3Q27 advection diffusion field + Distributions27 distributionsAD27; + //! \brief stores a field of concentration values real *Conc, *Conc_Full; + //! \brief stores the diffusivity real diffusivity; + //! \brief stores the value for omega (for the diffusivity) + real omegaDiffusivity; // BC NoSlip TempforBoundaryConditions Temp; // BC Velocity @@ -94,20 +104,22 @@ struct LBMSimulationParameter real cStartx, cStarty, cStartz; real cFx, cFy, cFz; - // geo///////////////////// - int *geo; - unsigned int *geoSP; + // typeOfGridNode (formerly known as "geo") ///////////////////// + int *geo; // DEPRECATED: typeOfGridNode for full matrix (not sparse) + //! \brief stores the type for every lattice node (f.e. fluid node) + unsigned int *typeOfGridNode; // k/////////////////////// - unsigned int *k; + unsigned int *k; // DEPRECATED: index for full matrix - // neighbor//////////////// - // unsigned int *neighborX, *neighborY, *neighborZ; - unsigned int *neighborX_SP, *neighborY_SP, *neighborZ_SP, *neighborWSB_SP; + // neighbor/////////////////////////////////////////////////////////////// + //! \brief store the neighbors in +X, +Y, +Z, and in diagonal negative direction + //! \brief this information is important because we use an indirect addressing scheme + uint *neighborX, *neighborY, *neighborZ, *neighborInverse; - // coordinates//////////// - // unsigned int *coordX_SP, *coordY_SP, *coordZ_SP; - real *coordX_SP, *coordY_SP, *coordZ_SP; + // coordinates//////////////////////////////////////////////////////////// + //! \brief store the coordinates for every lattice node + real *coordinateX, *coordinateY, *coordinateZ; // body forces//////////// real *forceX_SP, *forceY_SP, *forceZ_SP; @@ -119,10 +131,20 @@ struct LBMSimulationParameter real *turbViscosity; real *gSij, *gSDij, *gDxvx, *gDyvx, *gDzvx, *gDxvy, *gDyvy, *gDzvy, *gDxvz, *gDyvz, *gDzvz; // DebugInformation + // turbulence intensity // + real *vx_mean, *vy_mean, *vz_mean; // means + real *vxx, *vyy, *vzz, *vxy, *vxz, *vyz; // fluctuations + std::vector<real> turbulenceIntensity; + // macroscopic values////// - real *vx, *vy, *vz, *rho; - real *vx_SP, *vy_SP, *vz_SP, *rho_SP, *press_SP; - real vis, omega; + // real *vx, *vy, *vz, *rho; // DEPRECATED: macroscopic values for full matrix + //! \brief store the macroscopic values (velocity, density, pressure) + //! \brief for every lattice node + real *velocityX, *velocityY, *velocityZ, *rho, *pressure; + //! \brief stores the value for omega + real omega; + //! \brief stores the value for viscosity (on level 0) + real vis; // derivations for iso test real *dxxUx, *dyyUy, *dzzUz; @@ -142,7 +164,8 @@ struct LBMSimulationParameter unsigned int sizePlaneXY, sizePlaneYZ, sizePlaneXZ; // size of sparse matrix////////// - unsigned int size_Mat_SP; + //! \brief stores the number of nodes (based on indirect addressing scheme) + unsigned int numberOfNodes; unsigned int size_Array_SP; // size of Plane btw. 2 GPUs////// @@ -158,6 +181,7 @@ struct LBMSimulationParameter bool isSetPress; // memsizeSP///////////////// + //! \brief stores the size of the memory consumption for real/int values of the arrays (e.g. coordinates, velocity) unsigned int mem_size_real_SP; unsigned int mem_size_int_SP; @@ -182,27 +206,36 @@ struct LBMSimulationParameter unsigned int mem_size_kCF; unsigned int mem_size_kFC; + InterpolationCellFC intFCBorder; + InterpolationCellFC intFCBulk; + InterpolationCellCF intCFBorder; + InterpolationCellCF intCFBulk; + // offset////////////////// OffsetCF offCF; + OffsetCF offCFBulk; OffsetFC offFC; + OffsetFC offFCBulk; unsigned int mem_size_kCF_off; unsigned int mem_size_kFC_off; // BC's//////////////////// - QforBoundaryConditions QWall, Qinflow, Qoutflow, QSlip; - unsigned int kQ = 0, kInflowQ = 0, kOutflowQ = 0, kSlipQ = 0; - unsigned int kQread, kInflowQread, kOutflowQread, kSlipQread; - - QforBoundaryConditions QpressX0, QpressX1, QpressY0, QpressY1, QpressZ0, QpressZ1; - QforBoundaryConditions QPropeller; - QforBoundaryConditions QPress; - QforBoundaryConditions QGeom; - QforBoundaryConditions QGeomNormalX, QGeomNormalY, QGeomNormalZ; - QforBoundaryConditions QInflowNormalX, QInflowNormalY, QInflowNormalZ; - QforBoundaryConditions QOutflowNormalX, QOutflowNormalY, QOutflowNormalZ; - QforBoundaryConditions QInlet, QOutlet, QPeriodic; - unsigned int kInletQread, kOutletQread; - unsigned int kPressQ = 0, kPressQread; + //! \brief stores the boundary condition data + QforBoundaryConditions noSlipBC, velocityBC, outflowBC, slipBC, stressBC, pressureBC; + //! \brief number of lattice nodes for the boundary conditions + unsigned int numberOfNoSlipBCnodesRead, numberOfVeloBCnodesRead, numberOfOutflowBCnodesRead, numberOfSlipBCnodesRead, numberOfStressBCnodesRead, numberOfPressureBCnodesRead; + + QforBoundaryConditions QpressX0, QpressX1, QpressY0, QpressY1, QpressZ0, QpressZ1; // DEPRECATED + QforBoundaryConditions propellerBC; + QforBoundaryConditions geometryBC; + QforBoundaryConditions geometryBCnormalX, geometryBCnormalY, geometryBCnormalZ; + QforBoundaryConditions inflowBCnormalX, inflowBCnormalY, inflowBCnormalZ; + QforBoundaryConditions outflowBCnormalX, outflowBCnormalY, outflowBCnormalZ; + QforBoundaryConditions QInlet, QOutlet, QPeriodic; // DEPRECATED + unsigned int kInletQread, kOutletQread; // DEPRECATED + + WallModelParameters wallModel; + // testRoundoffError Distributions27 kDistTestRE; @@ -210,6 +243,7 @@ struct LBMSimulationParameter // velocities to fit the force real *VxForce, *VyForce, *VzForce; ////////////////////////////////////////////////////////////////////////// + //! \brief sets the forcing uniform on every fluid node in all three space dimensions real *forcing; // Measure Points///////// @@ -291,6 +325,13 @@ struct LBMSimulationParameter std::vector<ProcessNeighbor27> recvProcessNeighborX; std::vector<ProcessNeighbor27> recvProcessNeighborY; std::vector<ProcessNeighbor27> recvProcessNeighborZ; + + std::vector<ProcessNeighbor27> sendProcessNeighborsAfterFtoCX; + std::vector<ProcessNeighbor27> sendProcessNeighborsAfterFtoCY; + std::vector<ProcessNeighbor27> sendProcessNeighborsAfterFtoCZ; + std::vector<ProcessNeighbor27> recvProcessNeighborsAfterFtoCX; + std::vector<ProcessNeighbor27> recvProcessNeighborsAfterFtoCY; + std::vector<ProcessNeighbor27> recvProcessNeighborsAfterFtoCZ; /////////////////////////////////////////////////////// // 3D domain decomposition convection diffusion std::vector<ProcessNeighbor27> sendProcessNeighborADX; @@ -308,17 +349,50 @@ struct LBMSimulationParameter std::vector<ProcessNeighborF3> recvProcessNeighborF3Y; std::vector<ProcessNeighborF3> recvProcessNeighborF3Z; //////////////////////////////////////////////////////////////////////////// + // 3D domain decomposition: position (index in array) of corner nodes in ProcessNeighbor27 + struct EdgeNodePositions { + int indexOfProcessNeighborRecv; + int indexInRecvBuffer; + int indexOfProcessNeighborSend; + int indexInSendBuffer; + EdgeNodePositions(int indexOfProcessNeighborRecv, int indexInRecvBuffer, int indexOfProcessNeighborSend, + int indexInSendBuffer) + : indexOfProcessNeighborRecv(indexOfProcessNeighborRecv), indexInRecvBuffer(indexInRecvBuffer), + indexOfProcessNeighborSend(indexOfProcessNeighborSend), indexInSendBuffer(indexInSendBuffer) + { + } + }; + std::vector<EdgeNodePositions> edgeNodesXtoY; + std::vector<EdgeNodePositions> edgeNodesXtoZ; + std::vector<EdgeNodePositions> edgeNodesYtoZ; + + /////////////////////////////////////////////////////// + uint *fluidNodeIndices; + uint numberOfFluidNodes; + uint *fluidNodeIndicesBorder; + uint numberOfFluidNodesBorder; }; +//! \brief Class for LBM-parameter management class VIRTUALFLUIDS_GPU_EXPORT Parameter { public: - Parameter(const vf::basics::ConfigurationFile &configData, int numberOfProcesses, int myId); + Parameter(); + explicit Parameter(const vf::basics::ConfigurationFile* configData); + explicit Parameter(const int numberOfProcesses, const int myId); + explicit Parameter(const int numberOfProcesses, const int myId, std::optional<const vf::basics::ConfigurationFile*> configData); + ~Parameter(); + void initLBMSimulationParameter(); + //! \brief Pointer to instance of LBMSimulationParameter - stored on Host System std::shared_ptr<LBMSimulationParameter> getParH(int level); + //! \brief Pointer to instance of LBMSimulationParameter - stored on Device (GPU) std::shared_ptr<LBMSimulationParameter> getParD(int level); - + + const std::vector<std::shared_ptr<LBMSimulationParameter>>& getParHallLevels(); + const std::vector<std::shared_ptr<LBMSimulationParameter>>& getParDallLevels(); + void copyMeasurePointsArrayToVector(int lev); ////////////////////////////////////////////////////////////////////////// @@ -336,17 +410,18 @@ public: void setDiffMod(int DiffMod); void setDiffusivity(real Diffusivity); void setD3Qxx(int d3qxx); - void setMaxLevel(int maxlevel); + void setMaxLevel(int numberOfLevels); void setParticleBasicLevel(int pbl); void setParticleInitLevel(int pil); void setNumberOfParticles(int nop); void setCalcParticles(bool calcParticles); void setStartXHotWall(real startXHotWall); void setEndXHotWall(real endXHotWall); - void setTEnd(unsigned int tend); - void setTOut(unsigned int tout); - void setTStartOut(unsigned int tStartOut); + void setTimestepEnd(unsigned int tend); + void setTimestepOut(unsigned int tout); + void setTimestepStartOut(unsigned int tStartOut); void setTimestepOfCoarseLevel(unsigned int timestep); + void setCalcTurbulenceIntensity(bool calcVelocityAndFluctuations); void setCalcMedian(bool calcMedian); void setCalcDragLift(bool calcDragLift); void setCalcCp(bool calcCp); @@ -364,7 +439,7 @@ public: void settimestepForMP(unsigned int timestepForMP); void setOutputPath(std::string oPath); void setOutputPrefix(std::string oPrefix); - void setFName(std::string fname); + void setGridPath(std::string gridPath); void setGeometryFileC(std::string GeometryFileC); void setGeometryFileM(std::string GeometryFileM); void setGeometryFileF(std::string GeometryFileF); @@ -430,8 +505,8 @@ public: void setReadGeo(bool readGeo); void setTemperatureInit(real Temp); void setTemperatureBC(real TempBC); - void setViscosity(real Viscosity); - void setVelocity(real Velocity); + void setViscosityLB(real Viscosity); + void setVelocityLB(real Velocity); void setViscosityRatio(real ViscosityRatio); void setVelocityRatio(real VelocityRatio); void setDensityRatio(real DensityRatio); @@ -450,6 +525,11 @@ public: void setStreetVelocityFile(bool streetVelocityFile); void setUseMeasurePoints(bool useMeasurePoints); void setUseWale(bool useWale); + void setTurbulenceModel(TurbulenceModel turbulenceModel); + void setUseTurbulentViscosity(bool useTurbulentViscosity); + void setUseAMD(bool useAMD); + void setSGSConstant(real SGSConstant); + void setHasWallModelMonitor(bool hasWallModelMonitor); void setUseInitNeq(bool useInitNeq); void setSimulatePorousMedia(bool simulatePorousMedia); void setIsF3(bool isF3); @@ -481,7 +561,7 @@ public: void setDoCheckPoint(bool doCheckPoint); void setDoRestart(bool doRestart); void setObj(std::string str, bool isObj); - void setGeometryValues(bool GeometryValues); + void setUseGeometryValues(bool GeometryValues); void setCalc2ndOrderMoments(bool is2ndOrderMoments); void setCalc3rdOrderMoments(bool is3rdOrderMoments); void setCalcHighOrderMoments(bool isHighOrderMoments); @@ -500,8 +580,12 @@ public: void setIsNeighborX(bool isNeighbor); void setIsNeighborY(bool isNeighbor); void setIsNeighborZ(bool isNeighbor); - // void setkInflowQ(unsigned int kInflowQ); - // void setkOutflowQ(unsigned int kOutflowQ); + void setSendProcessNeighborsAfterFtoCX(int numberOfNodes, int level, int arrayIndex); + void setSendProcessNeighborsAfterFtoCY(int numberOfNodes, int level, int arrayIndex); + void setSendProcessNeighborsAfterFtoCZ(int numberOfNodes, int level, int arrayIndex); + void setRecvProcessNeighborsAfterFtoCX(int numberOfNodes, int level, int arrayIndex); + void setRecvProcessNeighborsAfterFtoCY(int numberOfNodes, int level, int arrayIndex); + void setRecvProcessNeighborsAfterFtoCZ(int numberOfNodes, int level, int arrayIndex); // void setQinflowH(QforBoundaryConditions* QinflowH); // void setQinflowD(QforBoundaryConditions* QinflowD); // void setQoutflowH(QforBoundaryConditions* QoutflowH); @@ -524,10 +608,9 @@ public: void setADKernel(std::string adKernel); - //adder - - void addActuator(SPtr<PreCollisionInteractor> actuator); - void addProbe(SPtr<PreCollisionInteractor> probes); + // adder + void addActuator(SPtr<PreCollisionInteractor> actuator); + void addProbe(SPtr<PreCollisionInteractor> probes); // getter double *getForcesDouble(); @@ -549,13 +632,16 @@ public: bool getCompOn(); bool getPrintFiles(); bool getReadGeo(); + bool getCalcTurbulenceIntensity(); bool getCalcMedian(); bool getCalcDragLift(); bool getCalcCp(); - bool getCalcParticle(); + bool getCalcParticles(); bool getWriteVeloASCIIfiles(); bool getCalcPlaneConc(); + //! \returns index of finest level int getFine(); + //! \returns index of coarsest level int getCoarse(); int getParticleBasicLevel(); int getParticleInitLevel(); @@ -563,15 +649,18 @@ public: int getDiffMod(); int getFactorNZ(); int getD3Qxx(); + //! \returns the maximum level of grid refinement int getMaxLevel(); int getTimeCalcMedStart(); int getTimeCalcMedEnd(); int getMaxDev(); - int getMyID(); + //! \returns the ID of the current MPI process + int getMyProcessID(); int getNumprocs(); std::string getOutputPath(); std::string getOutputPrefix(); std::string getFName(); + std::string getGridPath(); std::string getGeometryFileC(); std::string getGeometryFileM(); std::string getGeometryFileF(); @@ -642,11 +731,11 @@ public: unsigned int getMemSizeBool(int level); unsigned int getMemSizerealYZ(int level); unsigned int getSizeMat(int level); - unsigned int getTStart(); - unsigned int getTInit(); - unsigned int getTEnd(); - unsigned int getTOut(); - unsigned int getTStartOut(); + unsigned int getTimestepStart(); + unsigned int getTimestepInit(); + unsigned int getTimestepEnd(); + unsigned int getTimestepOut(); + unsigned int getTimestepStartOut(); unsigned int getTimestepForMP(); unsigned int getTimestepOfCoarseLevel(); real getDiffusivity(); @@ -654,13 +743,34 @@ public: real getTemperatureBC(); real getViscosity(); real getVelocity(); + //! \returns the viscosity ratio in SI/LB units real getViscosityRatio(); + //! \returns the velocity ratio in SI/LB units real getVelocityRatio(); + //! \returns the density ratio in SI/LB units real getDensityRatio(); - real getPressRatio(); + //! \returns the pressure ratio in SI/LB units + real getPressureRatio(); + //! \returns the time ratio in SI/LB units real getTimeRatio(); + //! \returns the length ratio in SI/LB units real getLengthRatio(); - real getForceRatio(); + //! \returns the force ratio in SI/LB units + real getForceRatio(); + //! \returns the viscosity ratio in SI/LB units scaled to the respective level + real getScaledViscosityRatio(int level); + //! \returns the velocity ratio in SI/LB units scaled to the respective level + real getScaledVelocityRatio(int level); + //! \returns the density ratio in SI/LB units scaled to the respective level + real getScaledDensityRatio(int level); + //! \returns the pressure ratio in SI/LB units scaled to the respective level + real getScaledPressureRatio(int level); + //! \returns the time ratio in SI/LB units scaled to the respective level + real getScaledTimeRatio(int level); + //! \returns the length ratio in SI/LB units scaled to the respective level + real getScaledLengthRatio(int level); + //! \returns the force ratio in SI/LB units scaled to the respective level + real getScaledForceRatio(int level); real getRealX(); real getRealY(); real getRe(); @@ -688,9 +798,11 @@ public: TempPressforBoundaryConditions *getTempPressH(); TempPressforBoundaryConditions *getTempPressD(); std::vector<SPtr<PreCollisionInteractor>> getActuators(); + //! \returns the probes, e.g. point or plane probe std::vector<SPtr<PreCollisionInteractor>> getProbes(); unsigned int getTimeDoCheckPoint(); unsigned int getTimeDoRestart(); + unsigned int getTimeStep(int level, unsigned int t, bool isPostCollision); bool getDoCheckPoint(); bool getDoRestart(); bool overWritingRestart(unsigned int t); @@ -708,6 +820,10 @@ public: bool isStreetVelocityFile(); bool getUseMeasurePoints(); bool getUseWale(); + TurbulenceModel getTurbulenceModel(); + bool getUseTurbulentViscosity(); + real getSGSConstant(); + bool getHasWallModelMonitor(); bool getUseInitNeq(); bool getSimulatePorousMedia(); bool getIsF3(); @@ -757,29 +873,46 @@ public: double hostQuadricLimiters[3]; //////////////////////////////////////////////////////////////////////////// - // initial condition + // initial condition fluid void setInitialCondition(std::function<void(real, real, real, real &, real &, real &, real &)> initialCondition); std::function<void(real, real, real, real &, real &, real &, real &)> &getInitialCondition(); + // initial condition concentration + void setInitialConditionAD(std::function<void(real, real, real, real &)> initialConditionAD); + std::function<void(real, real, real, real &)> &getInitialConditionAD(); + + //////////////////////////////////////////////////////////////////////////// + std::vector<std::shared_ptr<LBMSimulationParameter>> parH = std::vector<std::shared_ptr<LBMSimulationParameter>>(1); std::vector<std::shared_ptr<LBMSimulationParameter>> parD = std::vector<std::shared_ptr<LBMSimulationParameter>>(1); + + //////////////////////////////////////////////////////////////////////////// + private: void readConfigData(const vf::basics::ConfigurationFile &configData); + void initGridPaths(); + void initGridBasePoints(); + void initDefaultLBMkernelAllLevels(); + + void setPathAndFilename(std::string fname); - bool compOn { false }; - bool diffOn { false }; - bool isF3 { false }; - bool calcDragLift { false }; - bool calcCp { false }; - bool writeVeloASCII { false }; - bool calcPlaneConc { false }; - bool isBodyForce { false }; - int diffMod {27}; - int maxlevel {0}; - int coarse {0}; - int fine {0}; - int factor_gridNZ {2}; - int D3Qxx {27}; +private: + bool compOn{ false }; + bool diffOn{ false }; + bool isF3{ false }; + bool calcDragLift{ false }; + bool calcCp{ false }; + bool writeVeloASCII{ false }; + bool calcPlaneConc{ false }; + bool calcVelocityAndFluctuations{ false }; + bool isBodyForce{ false }; + int diffMod{ 27 }; + //! \property maximum level of grid refinement + int maxlevel{ 0 }; + int coarse{ 0 }; + int fine{ 0 }; + int factor_gridNZ{ 2 }; + int D3Qxx{ 27 }; InitCondition ic; double memsizeGPU; unsigned int limitOfNodesForVTK; @@ -787,21 +920,21 @@ private: unsigned int timestep; // Kernel - std::string mainKernel { "CumulantK17Comp" }; - bool multiKernelOn { false }; + std::string mainKernel{ "CumulantK17CompChim" }; + bool multiKernelOn{ false }; std::vector<int> multiKernelLevel; std::vector<std::string> multiKernel; - + bool kernelNeedsFluidNodeIndicesToRun = false; std::string adKernel; ////////////////////////////////////////////////////////////////////////// // particles - int particleBasicLevel {0}; - int particleInitLevel {0}; - int numberOfParticles {0}; - bool calcParticles {false}; - real startXHotWall {(real)0.0}; - real endXHotWall {(real)0.0}; + int particleBasicLevel{ 0 }; + int particleInitLevel{ 0 }; + int numberOfParticles{ 0 }; + bool calcParticles{ false }; + real startXHotWall{ (real)0.0 }; + real endXHotWall{ (real)0.0 }; ////////////////////////////////////////////////////////////////////////// // CUDA random number generation curandState *devState; @@ -815,13 +948,13 @@ private: TempPressforBoundaryConditions *TempPressH, *TempPressD; // Drehung/////////////// - real Phi {0.0}; - real angularVelocity; + real Phi{ 0.0 }; + real angularVelocity; unsigned int startTurn; // PreCollisionInteractors ////////////// std::vector<SPtr<PreCollisionInteractor>> actuators; - std::vector<SPtr<PreCollisionInteractor>> probes; + std::vector<SPtr<PreCollisionInteractor>> probes; // Step of Ensight writing// unsigned int stepEnsight; @@ -847,8 +980,33 @@ private: bool isNeigborX, isNeigborY, isNeigborZ; //////////////////////////////////////////////////////////////////////////// - // initial condition + //! \brief initial condition fluid std::function<void(real, real, real, real &, real &, real &, real &)> initialCondition; + //! \brief initial condition concentration + std::function<void(real, real, real, real &)> initialConditionAD; + + //////////////////////////////////////////////////////////////////////////// + // cuda streams + + //! determines whether streams and thus communication hiding should be used + bool useStreams{ false }; + std::unique_ptr<CudaStreamManager> cudaStreamManager; + +public: + //! \brief sets whether streams and thus communication hiding should be used + //! \details This function is only useful for simulations on multiple GPUs. If there is only one MPI process, the + //! passed value is automatically overwritten with false. + void setUseStreams(bool useStreams); + bool getUseStreams(); + std::unique_ptr<CudaStreamManager> &getStreamManager(); + bool getKernelNeedsFluidNodeIndicesToRun(); + void setKernelNeedsFluidNodeIndicesToRun(bool kernelNeedsFluidNodeIndicesToRun); + + void initProcessNeighborsAfterFtoCX(int level); + void initProcessNeighborsAfterFtoCY(int level); + void initProcessNeighborsAfterFtoCZ(int level); + + bool useReducedCommunicationAfterFtoC{ true }; }; #endif diff --git a/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp b/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp index aa0551632e566768aaa9b087c072f665d6f7bc3d..4025acf7acad362e9f0f3702cb897b9c1b6dbf3b 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp +++ b/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp @@ -1,23 +1,15 @@ #include <gmock/gmock.h> +#include "basics/tests/testUtilities.h" +#include <filesystem> #include <iostream> #include <string> -#include <filesystem> #include "Parameter.h" -#include <basics/config/ConfigurationFile.h> - +#include "basics/config/ConfigurationFile.h" -auto RealEq = [](auto value) { -#ifdef VF_DOUBLE_ACCURACY - return testing::DoubleEq(value); -#else - return testing::FloatEq(value); -#endif -}; - -TEST(ParameterTest, passingEmptyFileWithoutPath_ShouldThrow) +TEST(ParameterTest, passingEmptyFileWithoutPath_ShouldNotThrow) { // assuming that the config files is stored parallel to this file. std::filesystem::path filePath = __FILE__; @@ -26,7 +18,7 @@ TEST(ParameterTest, passingEmptyFileWithoutPath_ShouldThrow) vf::basics::ConfigurationFile config; config.load(filePath.string()); - EXPECT_THROW(Parameter para(config, 1, 0), std::runtime_error); + EXPECT_NO_THROW(Parameter para(1, 0, &config)); } // TODO: test setPossNeighborFilesX @@ -41,16 +33,14 @@ TEST(ParameterTest, check_all_Parameter_CanBePassedToConstructor) vf::basics::ConfigurationFile config; config.load(filePath.string()); - Parameter para(config, 1, 0); - - // this two parameters need to be defined in each config file - EXPECT_THAT(para.getOutputPath(), testing::Eq("/output/path")); - EXPECT_THAT(para.getgeoVec(), testing::Eq("/path/to/grid/geoVec.dat")); - // ... all grid files could be tested as well + Parameter para(1, 0, &config); // test optional parameter + EXPECT_THAT(para.getOutputPath(), testing::Eq("/output/path/")); + EXPECT_THAT(para.getGridPath(), testing::Eq("/path/to/grid/")); // ... all grid files (e.g. multi-gpu/ multi-level) could be tested as well + EXPECT_THAT(para.getgeoVec(), testing::Eq("/path/to/grid/geoVec.dat")); EXPECT_THAT(para.getMaxDev(), testing::Eq(2)); - EXPECT_THAT(para.getDevices(), testing::ElementsAreArray({2,3})); + EXPECT_THAT(para.getDevices(), testing::ElementsAreArray({ 2, 3 })); EXPECT_THAT(para.getOutputPrefix(), testing::Eq("MyPrefix")); EXPECT_THAT(para.getPrintFiles(), testing::Eq(true)); EXPECT_THAT(para.getIsGeometryValues(), testing::Eq(true)); @@ -70,9 +60,9 @@ TEST(ParameterTest, check_all_Parameter_CanBePassedToConstructor) EXPECT_THAT(para.getSimulatePorousMedia(), testing::Eq(true)); EXPECT_THAT(para.getD3Qxx(), testing::Eq(99)); - EXPECT_THAT(para.getTEnd(), testing::Eq(33)); - EXPECT_THAT(para.getTOut(), testing::Eq(22)); - EXPECT_THAT(para.getTStartOut(), testing::Eq(11)); + EXPECT_THAT(para.getTimestepEnd(), testing::Eq(33)); + EXPECT_THAT(para.getTimestepOut(), testing::Eq(22)); + EXPECT_THAT(para.getTimestepStartOut(), testing::Eq(11)); EXPECT_THAT(para.getTimeCalcMedStart(), testing::Eq(22)); EXPECT_THAT(para.getTimeCalcMedEnd(), testing::Eq(44)); EXPECT_THAT(para.getPressInID(), testing::Eq(25)); @@ -91,7 +81,7 @@ TEST(ParameterTest, check_all_Parameter_CanBePassedToConstructor) EXPECT_THAT(para.getViscosityRatio(), RealEq(6.66)); EXPECT_THAT(para.getVelocityRatio(), RealEq(7.77)); EXPECT_THAT(para.getDensityRatio(), RealEq(8.88)); - EXPECT_THAT(para.getPressRatio(), RealEq(9.99)); + EXPECT_THAT(para.getPressureRatio(), RealEq(9.99)); EXPECT_THAT(para.getRealX(), RealEq(0.1)); EXPECT_THAT(para.getRealY(), RealEq(0.2)); @@ -105,19 +95,19 @@ TEST(ParameterTest, check_all_Parameter_CanBePassedToConstructor) EXPECT_THAT(para.getclockCycleForMP(), RealEq(0.4)); EXPECT_THAT(para.getTimestepForMP(), testing::Eq(4)); - std::vector<real> forces {2.0,2.1,2.2}; - double* forces_actual = para.getForcesDouble(); + std::vector<real> forces{ 2.0, 2.1, 2.2 }; + double *forces_actual = para.getForcesDouble(); for (size_t i = 0; i < forces.size(); ++i) { - EXPECT_THAT((real)forces_actual[i], RealEq(forces[i])); + EXPECT_THAT((real)forces_actual[i], RealEq(forces[i])); } - std::vector<real> limiters {3.0,3.1,3.2}; - double* limiters_actual = para.getQuadricLimitersDouble(); + std::vector<real> limiters{ 3.0, 3.1, 3.2 }; + double *limiters_actual = para.getQuadricLimitersDouble(); for (size_t i = 0; i < limiters.size(); ++i) { - EXPECT_THAT((real)limiters_actual[i], RealEq(limiters[i])); + EXPECT_THAT((real)limiters_actual[i], RealEq(limiters[i])); } - EXPECT_THAT(para.getCalcParticle(), testing::Eq(true)); + EXPECT_THAT(para.getCalcParticles(), testing::Eq(true)); EXPECT_THAT(para.getParticleBasicLevel(), testing::Eq(1)); EXPECT_THAT(para.getParticleInitLevel(), testing::Eq(2)); EXPECT_THAT(para.getNumberOfParticles(), testing::Eq(1111)); @@ -130,29 +120,83 @@ TEST(ParameterTest, check_all_Parameter_CanBePassedToConstructor) EXPECT_THAT(para.getDoRestart(), testing::Eq(true)); EXPECT_THAT(para.getMaxLevel(), testing::Eq(1)); // NOGL - 1 - EXPECT_THAT(para.getGridX(), testing::ElementsAreArray({100, 101})); - EXPECT_THAT(para.getGridY(), testing::ElementsAreArray({200, 201})); - EXPECT_THAT(para.getGridZ(), testing::ElementsAreArray({300, 301})); - EXPECT_THAT(para.getDistX(), testing::ElementsAreArray({400, 401})); - EXPECT_THAT(para.getDistY(), testing::ElementsAreArray({500, 501})); - EXPECT_THAT(para.getDistZ(), testing::ElementsAreArray({600, 601})); + EXPECT_THAT(para.getGridX(), testing::ElementsAreArray({ 100, 101 })); + EXPECT_THAT(para.getGridY(), testing::ElementsAreArray({ 200, 201 })); + EXPECT_THAT(para.getGridZ(), testing::ElementsAreArray({ 300, 301 })); + EXPECT_THAT(para.getDistX(), testing::ElementsAreArray({ 400, 401 })); + EXPECT_THAT(para.getDistY(), testing::ElementsAreArray({ 500, 501 })); + EXPECT_THAT(para.getDistZ(), testing::ElementsAreArray({ 600, 601 })); EXPECT_THAT(para.getMainKernel(), testing::Eq("KernelName")); EXPECT_THAT(para.getMultiKernelOn(), testing::Eq(true)); - EXPECT_THAT(para.getMultiKernelLevel(), testing::ElementsAreArray({3, 2, 1})); + EXPECT_THAT(para.getMultiKernelLevel(), testing::ElementsAreArray({ 3, 2, 1 })); - std::vector<std::string> kernel {"Kernel1", "Kernel2", "Kernel3"}; + std::vector<std::string> kernel{ "Kernel1", "Kernel2", "Kernel3" }; auto kernel_actual = para.getMultiKernel(); for (size_t i = 0; i < kernel.size(); ++i) { EXPECT_THAT(kernel_actual[i], testing::Eq(kernel[i])); } - EXPECT_THAT(para.getCoarse(), testing::Eq(0)); - EXPECT_THAT(para.getFine(), testing::Eq(1)); // NOGL - 1 + EXPECT_THAT(para.getFine(), testing::Eq(1)); // NOGL - 1 EXPECT_THAT(para.parH.size(), testing::Eq(2)); EXPECT_THAT(para.parD.size(), testing::Eq(2)); } +TEST(ParameterTest, defaultGridPath) +{ + Parameter para; + EXPECT_THAT(para.getGridPath(), testing::Eq("grid/")); + EXPECT_THAT(para.getConcentration(), testing::Eq("grid/conc.dat")); +} + +TEST(ParameterTest, defaultGridPathMultiGPU) +{ + Parameter para(2, 1); + + EXPECT_THAT(para.getGridPath(), testing::Eq("grid/1/")); + EXPECT_THAT(para.getConcentration(), testing::Eq("grid/1/conc.dat")); +} + +TEST(ParameterTest, setGridPathOverridesDefaultGridPath) +{ + Parameter para(2, 1); + para.setGridPath("gridPathTest"); + + EXPECT_THAT( para.getGridPath(), testing::Eq("gridPathTest/1/")); + EXPECT_THAT(para.getConcentration(), testing::Eq("gridPathTest/1/conc.dat")); +} + +TEST(ParameterTest, setGridPathOverridesConfigFile) +{ + // assuming that the config files is stored parallel to this file. + std::filesystem::path filePath = __FILE__; + filePath.replace_filename("parameterTest.cfg"); + vf::basics::ConfigurationFile config; + config.load(filePath.string()); + auto para = Parameter(2, 0, &config); + para.setGridPath("gridPathTest"); + + EXPECT_THAT( para.getGridPath(), testing::Eq("gridPathTest/0/")); + EXPECT_THAT(para.getConcentration(), testing::Eq("gridPathTest/0/conc.dat")); +} + +TEST(ParameterTest, userMissedSlash) +{ + Parameter para; + para.setGridPath("gridPathTest"); + + EXPECT_THAT(para.getGridPath(), testing::Eq("gridPathTest/")); + EXPECT_THAT(para.getConcentration(), testing::Eq("gridPathTest/conc.dat")); + +} + +TEST(ParameterTest, userMissedSlashMultiGPU) +{ + Parameter para(2, 0); + para.setGridPath("gridPathTest"); + EXPECT_THAT(para.getGridPath(), testing::Eq("gridPathTest/0/")); + EXPECT_THAT(para.getConcentration(), testing::Eq("gridPathTest/0/conc.dat")); +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Parameter/parameterTest.cfg b/src/gpu/VirtualFluids_GPU/Parameter/parameterTest.cfg index 8b6a75ddabaf3a9a570d08982ddad6a00e7b41c5..af9cb2851acbb56c2235c66ddf96bab3dac0d39f 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/parameterTest.cfg +++ b/src/gpu/VirtualFluids_GPU/Parameter/parameterTest.cfg @@ -1,8 +1,8 @@ -# this two parameters need to be defined in each config file +# these two parameters need to be defined in each config file Path = /output/path GridPath = /path/to/grid -# optional parameter +# optional parameters NumberOfDevices = 2 Devices = 2 3 Prefix = MyPrefix diff --git a/src/gpu/VirtualFluids_GPU/Particles/Particles.cpp b/src/gpu/VirtualFluids_GPU/Particles/Particles.cpp index 5cf30536fba525f5dae9e6a067326408c8f7f558..7c710f50afb0ae07edd53ef9d68e294c7af54ac1 100644 --- a/src/gpu/VirtualFluids_GPU/Particles/Particles.cpp +++ b/src/gpu/VirtualFluids_GPU/Particles/Particles.cpp @@ -16,14 +16,14 @@ //using namespace std; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void allocParticles(Parameter* para, CudaMemoryManager* cudaManager) +void allocParticles(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for (int lev = para->getParticleBasicLevel(); lev <= para->getFine(); lev++) { ////////////////////////////////////////////////////////////////////////// //all level store the same number of time steps - para->getParH(lev)->plp.numberOfTimestepsParticles = para->getTOut() * (unsigned int)pow(2,para->getParticleBasicLevel()); - para->getParD(lev)->plp.numberOfTimestepsParticles = para->getTOut() * (unsigned int)pow(2,para->getParticleBasicLevel()); + para->getParH(lev)->plp.numberOfTimestepsParticles = para->getTimestepOut() * (unsigned int)pow(2,para->getParticleBasicLevel()); + para->getParD(lev)->plp.numberOfTimestepsParticles = para->getTimestepOut() * (unsigned int)pow(2,para->getParticleBasicLevel()); ////////////////////////////////////////////////////////////////////////// //all level store the same number of Particles para->getParH(lev)->plp.numberOfParticles = para->getNumberOfParticles(); @@ -35,7 +35,7 @@ void allocParticles(Parameter* para, CudaMemoryManager* cudaManager) para->getParH(lev)->plp.memSizereal = sizeof(real)*(para->getParH(lev)->plp.numberOfParticles); para->getParH(lev)->plp.memSizerealAll = sizeof(real)*(para->getParH(lev)->plp.numberOfParticles * para->getParH(lev)->plp.numberOfTimestepsParticles); para->getParH(lev)->plp.memSizeBool = sizeof(bool)*(para->getParH(lev)->plp.numberOfParticles); - para->getParH(lev)->plp.memSizeBoolBC = sizeof(bool)*(para->getParH(lev)->QGeom.kQ);//depends on Geometry!!! + para->getParH(lev)->plp.memSizeBoolBC = sizeof(bool)*(para->getParH(lev)->geometryBC.numberOfBCnodes);//depends on Geometry!!! para->getParD(lev)->plp.memSizeTimestep = para->getParH(lev)->plp.memSizeTimestep; para->getParD(lev)->plp.memSizeID = para->getParH(lev)->plp.memSizeID; para->getParD(lev)->plp.memSizereal = para->getParH(lev)->plp.memSizereal; @@ -44,7 +44,7 @@ void allocParticles(Parameter* para, CudaMemoryManager* cudaManager) para->getParD(lev)->plp.memSizeBoolBC = para->getParH(lev)->plp.memSizeBoolBC; ////////////////////////////////////////////////////////////////////////// //alloc particles - cudaManager->cudaAllocParticles(lev); + cudaMemoryManager->cudaAllocParticles(lev); ////////////////////////////////////////////////////////////////////////// } } @@ -74,10 +74,10 @@ void initParticles(Parameter* para) } ////////////////////////////////////////////////////////////////////////// //set bool "hot wall" - for (int h = 0; h < para->getParH(lev)->QGeom.kQ; h++) + for (uint h = 0; h < para->getParH(lev)->geometryBC.numberOfBCnodes; h++) { - if (para->getParH(lev)->coordX_SP[para->getParH(lev)->QGeom.k[h]] < para->getStartXHotWall() || - para->getParH(lev)->coordX_SP[para->getParH(lev)->QGeom.k[h]] > para->getEndXHotWall()) + if (para->getParH(lev)->coordinateX[para->getParH(lev)->geometryBC.k[h]] < para->getStartXHotWall() || + para->getParH(lev)->coordinateX[para->getParH(lev)->geometryBC.k[h]] > para->getEndXHotWall()) { para->getParH(lev)->plp.hot[h] = false; } @@ -141,10 +141,10 @@ void initParticles(Parameter* para) para->getParH(lev)->plp.coordZabsolut[i] = (real)zCoordVec[i]; // find IDs - for (unsigned int ii = 0; ii < para->getParH(lev)->size_Mat_SP; ii++) + for (unsigned int ii = 0; ii < para->getParH(lev)->numberOfNodes; ii++) { - if ((para->getParH(lev)->coordX_SP[ii] <= para->getParH(lev)->plp.coordXabsolut[i]) && - ((para->getParH(lev)->plp.coordXabsolut[i] - para->getParH(lev)->coordX_SP[ii]) <= dx)) + if ((para->getParH(lev)->coordinateX[ii] <= para->getParH(lev)->plp.coordXabsolut[i]) && + ((para->getParH(lev)->plp.coordXabsolut[i] - para->getParH(lev)->coordinateX[ii]) <= dx)) { tempID.push_back(ii); } @@ -160,15 +160,15 @@ void initParticles(Parameter* para) { for (std::size_t ii = 0; ii < tempID.size(); ii++) { - if ((para->getParH(lev)->coordY_SP[tempID[ii]] <= para->getParH(lev)->plp.coordYabsolut[i]) && - ((para->getParH(lev)->plp.coordYabsolut[i] - para->getParH(lev)->coordY_SP[tempID[ii]]) <= dx) && - (para->getParH(lev)->coordZ_SP[tempID[ii]] <= para->getParH(lev)->plp.coordZabsolut[i]) && - ((para->getParH(lev)->plp.coordZabsolut[i] - para->getParH(lev)->coordZ_SP[tempID[ii]]) <= dx)) + if ((para->getParH(lev)->coordinateY[tempID[ii]] <= para->getParH(lev)->plp.coordYabsolut[i]) && + ((para->getParH(lev)->plp.coordYabsolut[i] - para->getParH(lev)->coordinateY[tempID[ii]]) <= dx) && + (para->getParH(lev)->coordinateZ[tempID[ii]] <= para->getParH(lev)->plp.coordZabsolut[i]) && + ((para->getParH(lev)->plp.coordZabsolut[i] - para->getParH(lev)->coordinateZ[tempID[ii]]) <= dx)) { para->getParH(lev)->plp.cellBaseID[i] = tempID[ii]; - para->getParH(lev)->plp.coordXlocal[i] = (para->getParH(lev)->plp.coordXabsolut[i] - para->getParH(lev)->coordX_SP[tempID[ii]]); - para->getParH(lev)->plp.coordYlocal[i] = (para->getParH(lev)->plp.coordYabsolut[i] - para->getParH(lev)->coordY_SP[tempID[ii]]); - para->getParH(lev)->plp.coordZlocal[i] = (para->getParH(lev)->plp.coordZabsolut[i] - para->getParH(lev)->coordZ_SP[tempID[ii]]); + para->getParH(lev)->plp.coordXlocal[i] = (para->getParH(lev)->plp.coordXabsolut[i] - para->getParH(lev)->coordinateX[tempID[ii]]); + para->getParH(lev)->plp.coordYlocal[i] = (para->getParH(lev)->plp.coordYabsolut[i] - para->getParH(lev)->coordinateY[tempID[ii]]); + para->getParH(lev)->plp.coordZlocal[i] = (para->getParH(lev)->plp.coordZabsolut[i] - para->getParH(lev)->coordinateZ[tempID[ii]]); } } //std::cout << "ID: " << i << ", CellBaseID: " << para->getParH(lev)->plp.cellBaseID[i] @@ -308,9 +308,9 @@ void propagateParticles(Parameter* para, unsigned int t) unsigned int tPLP = t - (para->getOutputCount() * para->getParH(lev)->plp.numberOfTimestepsParticles); ////////////////////////////////////////////////////////////////////////// //put some particles in the flow domain - MoveParticlesDevice(para->getParD(lev)->coordX_SP, - para->getParD(lev)->coordY_SP, - para->getParD(lev)->coordZ_SP, + MoveParticlesDevice(para->getParD(lev)->coordinateX, + para->getParD(lev)->coordinateY, + para->getParD(lev)->coordinateZ, para->getParD(lev)->plp.coordXlocal, para->getParD(lev)->plp.coordYlocal, para->getParD(lev)->plp.coordZlocal, @@ -320,22 +320,22 @@ void propagateParticles(Parameter* para, unsigned int t) para->getParD(lev)->plp.veloX, para->getParD(lev)->plp.veloY, para->getParD(lev)->plp.veloZ, - para->getParD(lev)->d0SP.f[0], + para->getParD(lev)->distributions.f[0], para->getParD(lev)->omega, para->getParD(lev)->plp.ID, para->getParD(lev)->plp.cellBaseID, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->neighborWSB_SP, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->neighborInverse, lev, tPLP, para->getParD(lev)->plp.numberOfTimestepsParticles, para->getParD(lev)->plp.numberOfParticles, - para->getParD(lev)->size_Mat_SP, + para->getParD(lev)->numberOfNodes, para->getParD(lev)->numberofthreads, - para->getParD(lev)->evenOrOdd); + para->getParD(lev)->isEvenTimestep); } } @@ -346,7 +346,7 @@ void propagateParticles(Parameter* para, unsigned int t) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void copyAndPrintParticles(Parameter* para, CudaMemoryManager* cudaManager, unsigned int t, bool isInit) +void copyAndPrintParticles(Parameter* para, CudaMemoryManager* cudaMemoryManager, unsigned int t, bool isInit) { //cout << endl << " t " << t << endl; @@ -362,7 +362,7 @@ void copyAndPrintParticles(Parameter* para, CudaMemoryManager* cudaManager, unsi { ////////////////////////////////////////////////////////////////////////// //copy particles from device to host - cudaManager->cudaCopyParticles(lev); + cudaMemoryManager->cudaCopyParticles(lev); ////////////////////////////////////////////////////////////////////////// ////test output //int maximumT = para->getParH(lev)->plp.numberOfParticles * para->getParH(lev)->plp.numberOfTimestepsParticles; @@ -447,7 +447,7 @@ void copyAndPrintParticles(Parameter* para, CudaMemoryManager* cudaManager, unsi //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void rearrangeGeometry(Parameter* para, CudaMemoryManager* cudaManager) +void rearrangeGeometry(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) { @@ -455,11 +455,11 @@ void rearrangeGeometry(Parameter* para, CudaMemoryManager* cudaManager) int counter2 = 0; ////////////////////////////////////////////////////////////////////////// //redefine fluid nodes - for (uint index = 0; index < para->getParH(lev)->size_Mat_SP; index++) + for (uint index = 0; index < para->getParH(lev)->numberOfNodes; index++) { - if (para->getParH(lev)->geoSP[index] == GEO_FLUID_OLD) + if (para->getParH(lev)->typeOfGridNode[index] == GEO_FLUID_OLD) { - para->getParH(lev)->geoSP[index] = GEO_FLUID; + para->getParH(lev)->typeOfGridNode[index] = GEO_FLUID; counter1++; } counter2++; @@ -468,13 +468,13 @@ void rearrangeGeometry(Parameter* para, CudaMemoryManager* cudaManager) printf("total number of nodes: %d \n", counter2); ////////////////////////////////////////////////////////////////////////// //store the index information of the BC nodes in the geometry array - for (int index = 0; index < para->getParH(lev)->QGeom.kQ; index++) + for (uint index = 0; index < para->getParH(lev)->geometryBC.numberOfBCnodes; index++) { - para->getParH(lev)->geoSP[para->getParH(lev)->QGeom.k[index]] = index + OFFSET_BCsInGeo; + para->getParH(lev)->typeOfGridNode[para->getParH(lev)->geometryBC.k[index]] = index + OFFSET_BCsInGeo; } ////////////////////////////////////////////////////////////////////////// //copy geometry nodes to the device - cudaManager->cudaCopySP(lev); + cudaMemoryManager->cudaCopySP(lev); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/Particles/Particles.h b/src/gpu/VirtualFluids_GPU/Particles/Particles.h index ccffb11e7afe2a5dce899644d2c65a55feed529f..7a6d003a08ef7f6517b6259c2c1b895676c6d80b 100644 --- a/src/gpu/VirtualFluids_GPU/Particles/Particles.h +++ b/src/gpu/VirtualFluids_GPU/Particles/Particles.h @@ -7,12 +7,12 @@ #include "Core/StringUtilities/StringUtil.h" #include "Parameter/Parameter.h" -//extern "C" void calcDragLift(Parameter* para, int lev); -extern "C" void allocParticles(Parameter* para, CudaMemoryManager* cudaManager); -extern "C" void initParticles(Parameter* para); -extern "C" void propagateParticles(Parameter* para, unsigned int t); -extern "C" void copyAndPrintParticles(Parameter* para, CudaMemoryManager* cudaManager, unsigned int t, bool isInit); +//void calcDragLift(Parameter* para, int lev); +void allocParticles(Parameter* para, CudaMemoryManager* cudaMemoryManager); +void initParticles(Parameter* para); +void propagateParticles(Parameter* para, unsigned int t); +void copyAndPrintParticles(Parameter* para, CudaMemoryManager* cudaMemoryManager, unsigned int t, bool isInit); -extern "C" void rearrangeGeometry(Parameter* para, CudaMemoryManager* cudaManager); +void rearrangeGeometry(Parameter* para, CudaMemoryManager* cudaMemoryManager); #endif diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorLine.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorLine.cu index a66474d4fdc13617fde27bef04a2ca30cf005281..71897bd21ea4fb299d3cc0ffa385506d4503f360 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorLine.cu +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorLine.cu @@ -5,31 +5,60 @@ #include <helper_cuda.h> #include <cuda/CudaGrid.h> -#include "lbm/constants/NumericConstants.h" #include "VirtualFluids_GPU/GPU/GeometryUtils.h" #include "Parameter/Parameter.h" #include "DataStructureInitializer/GridProvider.h" #include "GPU/CudaMemoryManager.h" -__host__ __device__ __inline__ real calcGaussian3D(real posX, real posY, real posZ, real destX, real destY, real destZ, real epsilon) +__host__ __device__ __inline__ uint calcNode(uint bladeNode, uint nBladeNodes, uint blade, uint nBlades) { - real distX = destX-posX; - real distY = destY-posY; - real distZ = destZ-posZ; - real dist = sqrt(distX*distX+distY*distY+distZ*distZ); - return pow(epsilon,-3)*pow(vf::lbm::constant::cPi,-1.5f)*exp(-pow(dist/epsilon,2)); + return bladeNode+blade*nBladeNodes; } +__host__ __device__ __inline__ void calcBladeAndBladeNode(uint node, uint& bladeNode, uint nBladeNodes, uint& blade, uint nBlades) +{ + blade = node/nBladeNodes; + bladeNode = node - blade*nBladeNodes; +} + +__host__ __device__ __forceinline__ real distSqrd(real distX, real distY, real distZ) +{ + return distX*distX+distY*distY+distZ*distZ; +} + +__host__ __device__ __inline__ void rotateFromBladeToGlobal( + real& bladeCoordX_BF, real& bladeCoordY_BF, real& bladeCoordZ_BF, + real& bladeCoordX_GF, real& bladeCoordY_GF, real& bladeCoordZ_GF, + real& azimuth, real& yaw) +{ + real tmpX, tmpY, tmpZ; + + rotateAboutX3D(azimuth, bladeCoordX_BF, bladeCoordY_BF, bladeCoordZ_BF, tmpX, tmpY, tmpZ); + rotateAboutZ3D(yaw, tmpX, tmpY, tmpZ, bladeCoordX_GF, bladeCoordY_GF, bladeCoordZ_GF); + +} + +__host__ __device__ __inline__ void rotateFromGlobalToBlade( + real& bladeCoordX_BF, real& bladeCoordY_BF, real& bladeCoordZ_BF, + real& bladeCoordX_GF, real& bladeCoordY_GF, real& bladeCoordZ_GF, + real& azimuth, real& yaw) +{ + real tmpX, tmpY, tmpZ; + + invRotateAboutZ3D(yaw, bladeCoordX_GF, bladeCoordY_GF, bladeCoordZ_GF, tmpX, tmpY, tmpZ); + invRotateAboutX3D(azimuth, tmpX, tmpY, tmpZ, bladeCoordX_BF, bladeCoordY_BF, bladeCoordZ_BF); +} __global__ void interpolateVelocities(real* gridCoordsX, real* gridCoordsY, real* gridCoordsZ, - uint* neighborsX, uint* neighborsY, uint* neighborsZ, - uint* neighborsWSB, + uint* neighborsX, uint* neighborsY, uint* neighborsZ, uint* neighborsWSB, real* vx, real* vy, real* vz, - uint numberOfIndices, - real* bladeCoordsX, real* bladeCoordsY, real* bladeCoordsZ, + real* bladeCoordsX, real* bladeCoordsY, real* bladeCoordsZ, real* bladeVelocitiesX, real* bladeVelocitiesY, real* bladeVelocitiesZ, - uint* bladeIndices, uint numberOfNodes) + uint nBlades, uint nBladeNodes, + real azimuth, real yaw, real omega, + real turbPosX, real turbPosY, real turbPosZ, + uint* bladeIndices, real velocityRatio, real invDeltaX) { const uint x = threadIdx.x; const uint y = blockIdx.x; @@ -40,20 +69,34 @@ __global__ void interpolateVelocities(real* gridCoordsX, real* gridCoordsY, real const uint node = nx*(ny*z + y) + x; - if(node>=numberOfNodes) return; + uint bladeNode, blade; + + calcBladeAndBladeNode(node, bladeNode, nBladeNodes, blade, nBlades); + + if(node>=nBladeNodes*nBlades) return; - real bladePosX = bladeCoordsX[node]; - real bladePosY = bladeCoordsY[node]; - real bladePosZ = bladeCoordsZ[node]; + real bladeCoordX_BF = bladeCoordsX[node]; + real bladeCoordY_BF = bladeCoordsY[node]; + real bladeCoordZ_BF = bladeCoordsZ[node]; - uint old_index = bladeIndices[node]; + real bladeCoordX_GF, bladeCoordY_GF, bladeCoordZ_GF; + + real localAzimuth = azimuth+blade*c2Pi/nBlades; + + rotateFromBladeToGlobal(bladeCoordX_BF, bladeCoordY_BF, bladeCoordZ_BF, + bladeCoordX_GF, bladeCoordY_GF, bladeCoordZ_GF, + localAzimuth, yaw); + + bladeCoordX_GF += turbPosX; + bladeCoordY_GF += turbPosY; + bladeCoordZ_GF += turbPosZ; uint k, ke, kn, kt; uint kne, kte, ktn, ktne; - k = findNearestCellBSW(old_index, + k = findNearestCellBSW(bladeIndices[node], gridCoordsX, gridCoordsY, gridCoordsZ, - bladePosX, bladePosY, bladePosZ, + bladeCoordX_GF, bladeCoordY_GF, bladeCoordZ_GF, neighborsX, neighborsY, neighborsZ, neighborsWSB); bladeIndices[node] = k; @@ -62,30 +105,37 @@ __global__ void interpolateVelocities(real* gridCoordsX, real* gridCoordsY, real real dW, dE, dN, dS, dT, dB; - real invDeltaX = 1.f/(gridCoordsX[ktne]-gridCoordsX[k]); - real distX = invDeltaX*(gridCoordsX[ktne]-bladePosX); - real distY = invDeltaX*(gridCoordsY[ktne]-bladePosY); - real distZ = invDeltaX*(gridCoordsZ[ktne]-bladePosZ); + real distX = invDeltaX*(bladeCoordX_GF-gridCoordsX[k]); + real distY = invDeltaX*(bladeCoordY_GF-gridCoordsY[k]); + real distZ = invDeltaX*(bladeCoordZ_GF-gridCoordsZ[k]); + + getInterpolationWeights(dW, dE, dN, dS, dT, dB, distX, distY, distZ); - getInterpolationWeights(dW, dE, dN, dS, dT, dB, - distX, distY, distZ); + real bladeVelX_GF = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vx)*velocityRatio; + real bladeVelY_GF = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vy)*velocityRatio; + real bladeVelZ_GF = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vz)*velocityRatio; - bladeVelocitiesX[node] = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vx); - bladeVelocitiesY[node] = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vy); - bladeVelocitiesZ[node] = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vz); + real bladeVelX_BF, bladeVelY_BF, bladeVelZ_BF; + rotateFromGlobalToBlade(bladeVelX_BF, bladeVelY_BF, bladeVelZ_BF, + bladeVelX_GF, bladeVelY_GF, bladeVelZ_GF, + localAzimuth, yaw); + + bladeVelocitiesX[node] = bladeVelX_BF; + bladeVelocitiesY[node] = bladeVelY_BF+omega*bladeCoordZ_BF; + bladeVelocitiesZ[node] = bladeVelZ_BF; } __global__ void applyBodyForces(real* gridCoordsX, real* gridCoordsY, real* gridCoordsZ, - real* gridForcesX, real* gridForcesY, real* gridForcesZ, - uint* gridIndices, uint numberOfIndices, - real* bladeCoordsX, real* bladeCoordsY, real* bladeCoordsZ, - real* bladeForcesX, real* bladeForcesY,real* bladeForcesZ, - real* bladeRadii, - real radius, - uint nBlades, uint nBladeNodes, - real epsilon, real delta_x) + real* gridForcesX, real* gridForcesY, real* gridForcesZ, + real* bladeCoordsX, real* bladeCoordsY, real* bladeCoordsZ, + real* bladeForcesX, real* bladeForcesY,real* bladeForcesZ, + uint nBlades, uint nBladeNodes, + real azimuth, real yaw, real omega, + real turbPosX, real turbPosY, real turbPosZ, + uint* gridIndices, uint nIndices, + real invEpsilonSqrd, real factorGaussian) { const uint x = threadIdx.x; const uint y = blockIdx.x; @@ -96,288 +146,278 @@ __global__ void applyBodyForces(real* gridCoordsX, real* gridCoordsY, real* grid const uint index = nx*(ny*z + y) + x; - if(index>=numberOfIndices) return; - - int gridIndex = gridIndices[index]; + if(index>=nIndices) return; - real posX = gridCoordsX[gridIndex]; - real posY = gridCoordsY[gridIndex]; - real posZ = gridCoordsZ[gridIndex]; + uint gridIndex = gridIndices[index]; - real fXYZ_X = 0.0f; - real fXYZ_Y = 0.0f; - real fXYZ_Z = 0.0f; + real gridCoordX_RF = gridCoordsX[gridIndex] - turbPosX; + real gridCoordY_RF = gridCoordsY[gridIndex] - turbPosY; + real gridCoordZ_RF = gridCoordsZ[gridIndex] - turbPosZ; - real eta = 0.0f; + real gridForceX_RF = c0o1; + real gridForceY_RF = c0o1; + real gridForceZ_RF = c0o1; - real delta_x_cubed = pow(delta_x,3); + real dAzimuth = c2Pi/nBlades; for( uint blade=0; blade<nBlades; blade++) - { - real last_r = 0.0f; - real r = 0.0f; + { + real localAzimuth = azimuth+blade*dAzimuth; + real gridCoordX_BF, gridCoordY_BF, gridCoordZ_BF; + + rotateFromGlobalToBlade(gridCoordX_BF, gridCoordY_BF, gridCoordZ_BF, + gridCoordX_RF, gridCoordY_RF, gridCoordZ_RF, + localAzimuth, yaw); + for( uint bladeNode=0; bladeNode<nBladeNodes; bladeNode++) { - int node = bladeNode+blade*nBladeNodes; - eta = calcGaussian3D(posX, posY, posZ, bladeCoordsX[node], bladeCoordsY[node], bladeCoordsZ[node], epsilon)*delta_x_cubed; - r = bladeRadii[bladeNode]; - - fXYZ_X += bladeForcesX[node]*(r-last_r)*eta; - fXYZ_Y += bladeForcesY[node]*(r-last_r)*eta; - fXYZ_Z += bladeForcesZ[node]*(r-last_r)*eta; - - last_r = r; - } - - fXYZ_X += bladeForcesX[nBladeNodes-1]*(radius-last_r)*eta; - fXYZ_Y += bladeForcesY[nBladeNodes-1]*(radius-last_r)*eta; - fXYZ_Z += bladeForcesZ[nBladeNodes-1]*(radius-last_r)*eta; + uint node = calcNode(bladeNode, nBladeNodes, blade, nBlades); + + real eta = factorGaussian*exp(-distSqrd(bladeCoordsX[node]-gridCoordX_BF, bladeCoordsY[node]-gridCoordY_BF, bladeCoordsZ[node]-gridCoordZ_BF)*invEpsilonSqrd); + + real forceX_RF, forceY_RF, forceZ_RF; + + rotateFromBladeToGlobal(bladeForcesX[node], bladeForcesY[node], bladeForcesZ[node], + forceX_RF, forceY_RF, forceZ_RF, + localAzimuth, yaw); + + gridForceX_RF += forceX_RF*eta; + gridForceY_RF += forceY_RF*eta; + gridForceZ_RF += forceZ_RF*eta; + } } - gridForcesX[gridIndex] = fXYZ_X; - gridForcesY[gridIndex] = fXYZ_Y; - gridForcesZ[gridIndex] = fXYZ_Z; + atomicAdd(&gridForcesX[gridIndex], gridForceX_RF); + atomicAdd(&gridForcesY[gridIndex], gridForceY_RF); + atomicAdd(&gridForcesZ[gridIndex], gridForceZ_RF); } -void ActuatorLine::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaManager) +void ActuatorLine::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaMemoryManager) { - this->initBladeRadii(cudaManager); - this->initBladeCoords(cudaManager); - this->initBladeIndices(para, cudaManager); - this->initBladeVelocities(cudaManager); - this->initBladeForces(cudaManager); - this->initBoundingSphere(para, cudaManager); + if(!para->getIsBodyForce()) throw std::runtime_error("try to allocate ActuatorLine but BodyForce is not set in Parameter."); + this->initBladeRadii(cudaMemoryManager); + this->initBladeCoords(cudaMemoryManager); + this->initBladeIndices(para, cudaMemoryManager); + this->initBladeVelocities(cudaMemoryManager); + this->initBladeForces(cudaMemoryManager); + this->initBoundingSphere(para, cudaMemoryManager); } -void ActuatorLine::interact(Parameter* para, CudaMemoryManager* cudaManager, int level, unsigned int t) +void ActuatorLine::interact(Parameter* para, CudaMemoryManager* cudaMemoryManager, int level, unsigned int t) { if (level != this->level) return; - - cudaManager->cudaCopyBladeCoordsHtoD(this); - uint numberOfThreads = para->getParH(level)->numberofthreads; - vf::cuda::CudaGrid bladeGrid = vf::cuda::CudaGrid(numberOfThreads, this->numberOfNodes); + cudaMemoryManager->cudaCopyBladeCoordsHtoD(this); + + vf::cuda::CudaGrid bladeGrid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, this->nNodes); interpolateVelocities<<< bladeGrid.grid, bladeGrid.threads >>>( - para->getParD(this->level)->coordX_SP, para->getParD(this->level)->coordY_SP, para->getParD(this->level)->coordZ_SP, - para->getParD(this->level)->neighborX_SP, para->getParD(this->level)->neighborY_SP, para->getParD(this->level)->neighborZ_SP, para->getParD(this->level)->neighborWSB_SP, - para->getParD(this->level)->vx_SP, para->getParD(this->level)->vy_SP, para->getParD(this->level)->vz_SP, - this->numberOfIndices, + para->getParD(this->level)->coordinateX, para->getParD(this->level)->coordinateY, para->getParD(this->level)->coordinateZ, + para->getParD(this->level)->neighborX, para->getParD(this->level)->neighborY, para->getParD(this->level)->neighborZ, para->getParD(this->level)->neighborInverse, + para->getParD(this->level)->velocityX, para->getParD(this->level)->velocityY, para->getParD(this->level)->velocityZ, this->bladeCoordsXD, this->bladeCoordsYD, this->bladeCoordsZD, this->bladeVelocitiesXD, this->bladeVelocitiesYD, this->bladeVelocitiesZD, - this->bladeIndicesD, this->numberOfNodes); + this->nBlades, this->nBladeNodes, + this->azimuth, this->yaw, this->omega, + this->turbinePosX, this->turbinePosY, this->turbinePosZ, + this->bladeIndicesD, para->getVelocityRatio(), this->invDeltaX); - cudaManager->cudaCopyBladeVelocitiesDtoH(this); + cudaMemoryManager->cudaCopyBladeVelocitiesDtoH(this); - if(true) - { - this->calcForcesEllipticWing(para); - } + this->calcBladeForces(); - cudaManager->cudaCopyBladeForcesHtoD(this); + cudaMemoryManager->cudaCopyBladeForcesHtoD(this); - vf::cuda::CudaGrid sphereGrid = vf::cuda::CudaGrid(numberOfThreads, this->numberOfIndices); + vf::cuda::CudaGrid sphereGrid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, this->nIndices); applyBodyForces<<<sphereGrid.grid, sphereGrid.threads>>>( - para->getParD(this->level)->coordX_SP, para->getParD(this->level)->coordY_SP, para->getParD(this->level)->coordZ_SP, + para->getParD(this->level)->coordinateX, para->getParD(this->level)->coordinateY, para->getParD(this->level)->coordinateZ, para->getParD(this->level)->forceX_SP, para->getParD(this->level)->forceY_SP, para->getParD(this->level)->forceZ_SP, - this->boundingSphereIndicesD, this->numberOfIndices, this->bladeCoordsXD, this->bladeCoordsYD, this->bladeCoordsZD, this->bladeForcesXD, this->bladeForcesYD, this->bladeForcesZD, - this->bladeRadiiD, - this->diameter*0.5f, this->nBlades, this->nBladeNodes, - this->epsilon, this->delta_x); + this->azimuth, this->yaw, this->omega, + this->turbinePosX, this->turbinePosY, this->turbinePosZ, + this->boundingSphereIndicesD, this->nIndices, + this->invEpsilonSqrd, this->factorGaussian); - real dazimuth = this->omega*this->delta_t; - - this->azimuth += dazimuth; - this->rotateBlades(dazimuth); + this->azimuth = fmod(this->azimuth+this->omega*this->deltaT,c2Pi); } -void ActuatorLine::free(Parameter* para, CudaMemoryManager* cudaManager) +void ActuatorLine::free(Parameter* para, CudaMemoryManager* cudaMemoryManager) { - cudaManager->cudaFreeBladeRadii(this); - cudaManager->cudaFreeBladeCoords(this); - cudaManager->cudaFreeBladeVelocities(this); - cudaManager->cudaFreeBladeForces(this); - cudaManager->cudaFreeBladeIndices(this); - cudaManager->cudaFreeSphereIndices(this); + cudaMemoryManager->cudaFreeBladeRadii(this); + cudaMemoryManager->cudaFreeBladeCoords(this); + cudaMemoryManager->cudaFreeBladeVelocities(this); + cudaMemoryManager->cudaFreeBladeForces(this); + cudaMemoryManager->cudaFreeBladeIndices(this); + cudaMemoryManager->cudaFreeSphereIndices(this); } -void ActuatorLine::calcForcesEllipticWing(Parameter* para) +void ActuatorLine::calcForcesEllipticWing() { - real localAzimuth; uint node; - real uXYZ_X, uXYZ_Y, uXYZ_Z; - real uRTZ_X, uRTZ_Y, uRTZ_Z; - real fXYZ_X, fXYZ_Y, fXYZ_Z; - real fRTZ_X, fRTZ_Y, fRTZ_Z; - real r; real u_rel, v_rel, u_rel_sq; real phi; - real Cl = 1.f; - real Cd = 0.f; - real c0 = 1.f; + real Cl = c1o1; + real Cd = c0o1; + real c0 = c1o1; real c, Cn, Ct; - real forceRatio = this->density*pow(this->delta_x,4)*pow(this->delta_t,-2); - for( uint blade=0; blade<this->nBlades; blade++) - { - localAzimuth = this->azimuth+2*blade*vf::lbm::constant::cPi/this->nBlades; + { for( uint bladeNode=0; bladeNode<this->nBladeNodes; bladeNode++) - { - node = bladeNode+blade*this->nBladeNodes; - uXYZ_X = this->bladeVelocitiesXH[node]*para->getVelocityRatio(); - uXYZ_Y = this->bladeVelocitiesYH[node]*para->getVelocityRatio(); - uXYZ_Z = this->bladeVelocitiesZH[node]*para->getVelocityRatio(); + { + node = calcNode(bladeNode, this->nBladeNodes, blade, this->nBlades); - invRotateAboutX3D(localAzimuth, uXYZ_X, uXYZ_Y, uXYZ_Z, uRTZ_X, uRTZ_Y, uRTZ_Z); - r = this->bladeRadiiH[bladeNode]; - - u_rel = uRTZ_X; - v_rel = uRTZ_Y+this->omega*r; + u_rel = this->bladeVelocitiesXH[node]; + v_rel = this->bladeVelocitiesYH[node]; u_rel_sq = u_rel*u_rel+v_rel*v_rel; phi = atan2(u_rel, v_rel); - - c = c0 * sqrt( 1.f- pow(4.f*r/this->diameter-1.f, 2.f) ); - Cn = Cl*cos(phi)+Cd*sin(phi); - Ct = -Cl*sin(phi)+Cd*cos(phi); - - fRTZ_X = 0.5f*u_rel_sq*c*this->density*Cn; - fRTZ_Y = 0.5f*u_rel_sq*c*this->density*Ct; - fRTZ_Z = 0.0; - - rotateAboutX3D(localAzimuth, fRTZ_X, fRTZ_Y, fRTZ_Z, fXYZ_X, fXYZ_Y, fXYZ_Z); + + real tmp = c4o1*this->bladeRadiiH[bladeNode]/this->diameter-c1o1; + c = c0 * sqrt( c1o1- tmp*tmp ); + Cn = Cl*cos(phi)+Cd*sin(phi); + Ct = Cl*sin(phi)-Cd*cos(phi); - this->bladeForcesXH[node] = fXYZ_X/forceRatio; - this->bladeForcesYH[node] = fXYZ_Y/forceRatio; - this->bladeForcesZH[node] = fXYZ_Z/forceRatio; + this->bladeForcesXH[node] = -c1o2*u_rel_sq*c*this->density*Cn; + this->bladeForcesYH[node] = -c1o2*u_rel_sq*c*this->density*Ct; + this->bladeForcesZH[node] = c0o1; } } } -void ActuatorLine::rotateBlades(real angle) +void ActuatorLine::calcBladeForces() { - for(uint node=0; node<this->nBladeNodes*this->nBlades; node++) - { - real oldCoordX = this->bladeCoordsXH[node]; - real oldCoordY = this->bladeCoordsYH[node]; - real oldCoordZ = this->bladeCoordsZH[node]; - - real newCoordX, newCoordY, newCoordZ; - rotateAboutX3D(angle, oldCoordX, oldCoordY, oldCoordZ, newCoordX, newCoordY, newCoordZ, this->turbinePosX, this->turbinePosY, this->turbinePosZ); - - this->bladeCoordsYH[node] = newCoordX; - this->bladeCoordsYH[node] = newCoordY; - this->bladeCoordsZH[node] = newCoordZ; - } + this->calcForcesEllipticWing(); } -void ActuatorLine::initBladeRadii(CudaMemoryManager* cudaManager) +void ActuatorLine::initBladeRadii(CudaMemoryManager* cudaMemoryManager) { - cudaManager->cudaAllocBladeRadii(this); + cudaMemoryManager->cudaAllocBladeRadii(this); + + real dr = c1o2*this->diameter/this->nBladeNodes; - real dx = 0.5f*this->diameter/this->nBladeNodes; for(uint node=0; node<this->nBladeNodes; node++) { - this->bladeRadiiH[node] = dx*(node+1); + this->bladeRadiiH[node] = dr*(node+1); } - cudaManager->cudaCopyBladeRadiiHtoD(this); + cudaMemoryManager->cudaCopyBladeRadiiHtoD(this); + + real dxOPiSqrtEps = pow(this->deltaX/(this->epsilon*sqrt(cPi)),c3o1); + this->factorGaussian = dr*dxOPiSqrtEps/this->forceRatio; } -void ActuatorLine::initBladeCoords(CudaMemoryManager* cudaManager) +void ActuatorLine::initBladeCoords(CudaMemoryManager* cudaMemoryManager) { - cudaManager->cudaAllocBladeCoords(this); + cudaMemoryManager->cudaAllocBladeCoords(this); - for( uint blade=0; blade<this->nBlades; blade++) + for(uint blade=0; blade<this->nBlades; blade++) { - real localAzimuth = this->azimuth+(2*vf::lbm::constant::cPi/this->nBlades)*blade; - for(uint node=0; node<this->nBladeNodes; node++) + for(uint bladeNode=0; bladeNode<this->nBladeNodes; bladeNode++) { - real coordX, coordY, coordZ; - real x,y,z; - x = 0.f; - y = 0.f; - z = this->bladeRadiiH[node]; - rotateAboutX3D(localAzimuth, x, y, z, coordX, coordY, coordZ); - this->bladeCoordsXH[node+this->nBladeNodes*blade] = coordX+this->turbinePosX; - this->bladeCoordsYH[node+this->nBladeNodes*blade] = coordY+this->turbinePosY; - this->bladeCoordsZH[node+this->nBladeNodes*blade] = coordZ+this->turbinePosZ; + uint node = calcNode(bladeNode, this->nBladeNodes, blade, this->nBlades); + + this->bladeCoordsXH[node] = c0o1; + this->bladeCoordsYH[node] = c0o1; + this->bladeCoordsZH[node] = this->bladeRadiiH[bladeNode]; } } - cudaManager->cudaCopyBladeCoordsHtoD(this); + cudaMemoryManager->cudaCopyBladeCoordsHtoD(this); } -void ActuatorLine::initBladeVelocities(CudaMemoryManager* cudaManager) +void ActuatorLine::initBladeVelocities(CudaMemoryManager* cudaMemoryManager) { - cudaManager->cudaAllocBladeVelocities(this); + cudaMemoryManager->cudaAllocBladeVelocities(this); - for(uint node=0; node<this->numberOfNodes; node++) + for(uint node=0; node<this->nNodes; node++) { - this->bladeVelocitiesXH[node] = 0.f; - this->bladeVelocitiesYH[node] = 0.f; - this->bladeVelocitiesZH[node] = 0.f; + this->bladeVelocitiesXH[node] = c0o1; + this->bladeVelocitiesYH[node] = c0o1; + this->bladeVelocitiesZH[node] = c0o1; } - cudaManager->cudaCopyBladeVelocitiesHtoD(this); + cudaMemoryManager->cudaCopyBladeVelocitiesHtoD(this); } -void ActuatorLine::initBladeForces(CudaMemoryManager* cudaManager) +void ActuatorLine::initBladeForces(CudaMemoryManager* cudaMemoryManager) { - cudaManager->cudaAllocBladeForces(this); + cudaMemoryManager->cudaAllocBladeForces(this); - for(uint node=0; node<this->numberOfNodes; node++) + for(uint node=0; node<this->nNodes; node++) { - this->bladeForcesXH[node] = 0.f; - this->bladeForcesYH[node] = 0.f; - this->bladeForcesZH[node] = 0.f; + this->bladeForcesXH[node] = c0o1; + this->bladeForcesYH[node] = c0o1; + this->bladeForcesZH[node] = c0o1; } - cudaManager->cudaCopyBladeForcesHtoD(this); + cudaMemoryManager->cudaCopyBladeForcesHtoD(this); } -void ActuatorLine::initBladeIndices(Parameter* para, CudaMemoryManager* cudaManager) +void ActuatorLine::initBladeIndices(Parameter* para, CudaMemoryManager* cudaMemoryManager) { - cudaManager->cudaAllocBladeIndices(this); + cudaMemoryManager->cudaAllocBladeIndices(this); - real* coordsX = para->getParH(this->level)->coordX_SP; - real* coordsY = para->getParH(this->level)->coordY_SP; - real* coordsZ = para->getParH(this->level)->coordZ_SP; + for(uint node=0; node<this->nNodes; node++) - for(uint node=0; node<this->numberOfNodes; node++) { - this->bladeIndicesH[node] = findNearestCellBSW(1, coordsX, coordsY, coordsZ, - this->bladeCoordsXH[node], this->bladeCoordsYH[node], this->bladeCoordsZH[node], - para->getParH(this->level)->neighborX_SP, para->getParH(this->level)->neighborY_SP, para->getParH(this->level)->neighborZ_SP, - para->getParH(this->level)->neighborWSB_SP); - + this->bladeIndicesH[node] = 1; } - cudaManager->cudaCopyBladeIndicesHtoD(this); + cudaMemoryManager->cudaCopyBladeIndicesHtoD(this); } -void ActuatorLine::initBoundingSphere(Parameter* para, CudaMemoryManager* cudaManager) +void ActuatorLine::initBoundingSphere(Parameter* para, CudaMemoryManager* cudaMemoryManager) { // Actuator line exists only on 1 level std::vector<int> nodesInSphere; + real sphereRadius = c1o2*this->diameter+c4o1*this->epsilon; + real sphereRadiusSqrd = sphereRadius*sphereRadius; - for (uint j = 1; j <= para->getParH(this->level)->size_Mat_SP; j++) + for (uint j = 1; j <= para->getParH(this->level)->numberOfNodes; j++) { - const real coordX = para->getParH(this->level)->coordX_SP[j]; - const real coordY = para->getParH(this->level)->coordY_SP[j]; - const real coordZ = para->getParH(this->level)->coordZ_SP[j]; - const real dist = sqrt(pow(coordX-this->turbinePosX,2)+pow(coordY-this->turbinePosY,2)+pow(coordZ-this->turbinePosZ,2)); - - if(dist < 0.6*this->diameter) nodesInSphere.push_back(j); + const real distX = para->getParH(this->level)->coordinateX[j]-this->turbinePosX; + const real distY = para->getParH(this->level)->coordinateY[j]-this->turbinePosY; + const real distZ = para->getParH(this->level)->coordinateZ[j]-this->turbinePosZ; + if(distSqrd(distX,distY,distZ) < sphereRadiusSqrd) nodesInSphere.push_back(j); } - this->numberOfIndices = uint(nodesInSphere.size()); - cudaManager->cudaAllocSphereIndices(this); + this->nIndices = uint(nodesInSphere.size()); + cudaMemoryManager->cudaAllocSphereIndices(this); std::copy(nodesInSphere.begin(), nodesInSphere.end(), this->boundingSphereIndicesH); - cudaManager->cudaCopySphereIndicesHtoD(this); + cudaMemoryManager->cudaCopySphereIndicesHtoD(this); +} + +void ActuatorLine::setBladeCoords(real* _bladeCoordsX, real* _bladeCoordsY, real* _bladeCoordsZ) +{ + + for(uint node=0; node<this->nNodes; node++) + { + this->bladeCoordsXH[node] = _bladeCoordsX[node]; + this->bladeCoordsYH[node] = _bladeCoordsY[node]; + this->bladeCoordsZH[node] = _bladeCoordsZ[node]; + } +} + +void ActuatorLine::setBladeVelocities(real* _bladeVelocitiesX, real* _bladeVelocitiesY, real* _bladeVelocitiesZ) +{ + for(uint node=0; node<this->nNodes; node++) + { + this->bladeVelocitiesXH[node] = _bladeVelocitiesX[node]; + this->bladeVelocitiesYH[node] = _bladeVelocitiesY[node]; + this->bladeVelocitiesZH[node] = _bladeVelocitiesZ[node]; + } +} + +void ActuatorLine::setBladeForces(real* _bladeForcesX, real* _bladeForcesY, real* _bladeForcesZ) +{ + for(uint node=0; node<this->nNodes; node++) + { + this->bladeForcesXH[node] = _bladeForcesX[node]; + this->bladeForcesYH[node] = _bladeForcesY[node]; + this->bladeForcesZH[node] = _bladeForcesZ[node]; + } } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorLine.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorLine.h index f0de6c8e01b2f4cfc0421f02b1a75308512e34e8..b44c89c5020eb206baa3bba1994b1e45f760c3bb 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorLine.h +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorLine.h @@ -3,11 +3,14 @@ #include "PreCollisionInteractor.h" #include "PointerDefinitions.h" +#include "VirtualFluids_GPU_export.h" +#include "lbm/constants/NumericConstants.h" class Parameter; class GridProvider; -class ActuatorLine : public PreCollisionInteractor +using namespace vf::lbm::constant; +class VIRTUALFLUIDS_GPU_EXPORT ActuatorLine : public PreCollisionInteractor { public: ActuatorLine( @@ -18,8 +21,8 @@ public: real _turbinePosX, real _turbinePosY, real _turbinePosZ, const real _diameter, int _level, - const real _delta_t, - const real _delta_x + const real _deltaT, + const real _deltaX ) : nBlades(_nBlades), density(_density), nBladeNodes(_nBladeNodes), @@ -27,57 +30,66 @@ public: turbinePosX(_turbinePosX), turbinePosY(_turbinePosY), turbinePosZ(_turbinePosZ), diameter(_diameter), level(_level), - delta_x(_delta_x), PreCollisionInteractor() { - this->delta_t = _delta_t/pow(2,this->level); - this->delta_x = _delta_x/pow(2,this->level); - this->numberOfNodes = this->nBladeNodes*this->nBlades; - this->omega = 1.0f; - this->azimuth = 0.0f; - - } + this->deltaT = _deltaT*exp2(-this->level); + this->deltaX = _deltaX*exp2(-this->level); + this->invDeltaX = c1o1/this->deltaX; + this->forceRatio = this->density*pow(this->deltaX,4)*pow(this->deltaT,-2); + this->invEpsilonSqrd = c1o1/(this->epsilon*this->epsilon); + this->nNodes = this->nBladeNodes*this->nBlades; + this->omega = c1o1; + this->azimuth = c0o1; + this->yaw = c0o1; + }; - virtual ~ActuatorLine() - { - - } + virtual ~ActuatorLine(){}; - void init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaManager); - void interact(Parameter* para, CudaMemoryManager* cudaManager, int level, uint t); - void free(Parameter* para, CudaMemoryManager* cudaManager); + void init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaMemoryManager) override; + void interact(Parameter* para, CudaMemoryManager* cudaMemoryManager, int level, uint t) override; + void free(Parameter* para, CudaMemoryManager* cudaMemoryManager) override; void write(uint t); - uint getNBladeNodes(){return this->nBladeNodes;}; - uint getNBlades(){return this->nBlades;}; - uint getNumberOfIndices(){return this->numberOfIndices;}; - uint getNumberOfNodes(){return this->numberOfNodes;}; - real* getBladeCoordsX(){return this->bladeCoordsXH;}; - real* getBladeCoordsY(){return this->bladeCoordsYH;}; - real* getBladeCoordsZ(){return this->bladeCoordsZH;}; - real* getBladeVelocitiesX(){return this->bladeVelocitiesXH;}; - real* getBladeVelocitiesY(){return this->bladeVelocitiesYH;}; - real* getBladeVelocitiesZ(){return this->bladeVelocitiesZH;}; - real* getBladeForcesX(){return this->bladeForcesXH;}; - real* getBladeForcesY(){return this->bladeForcesYH;}; - real* getBladeForcesZ(){return this->bladeForcesZH;}; + uint getNBladeNodes(){ return this->nBladeNodes; }; + uint getNBlades(){ return this->nBlades;}; + uint getNIndices(){ return this->nIndices; }; + uint getNNodes(){ return this->nNodes; }; + real getOmega(){ return this->omega; }; + real getAzimuth(){ return this->azimuth; }; + real getYaw(){ return this->yaw; }; + real getDensity(){ return this->density; }; + real getPositionX(){ return this->turbinePosX; }; + real getPositionY(){ return this->turbinePosY; }; + real getPositionZ(){ return this->turbinePosZ; }; + real* getBladeRadii(){ return this->bladeRadiiH; }; + real* getBladeCoordsX(){ return this->bladeCoordsXH; }; + real* getBladeCoordsY(){ return this->bladeCoordsYH; }; + real* getBladeCoordsZ(){ return this->bladeCoordsZH; }; + real* getBladeVelocitiesX(){ return this->bladeVelocitiesXH; }; + real* getBladeVelocitiesY(){ return this->bladeVelocitiesYH; }; + real* getBladeVelocitiesZ(){ return this->bladeVelocitiesZH; }; + real* getBladeForcesX(){ return this->bladeForcesXH; }; + real* getBladeForcesY(){ return this->bladeForcesYH; }; + real* getBladeForcesZ(){ return this->bladeForcesZH; }; -private: - void initBoundingSphere(Parameter* para, CudaMemoryManager* cudaManager); + void setOmega(real _omega){ this->omega = _omega; }; + void setAzimuth(real _azimuth){ this->azimuth = _azimuth; }; + void setYaw(real _yaw){ this->yaw = _yaw; }; + void setBladeCoords(real* _bladeCoordsX, real* _bladeCoordsY, real* _bladeCoordsZ); + void setBladeVelocities(real* _bladeVelocitiesX, real* _bladeVelocitiesY, real* _bladeVelocitiesZ); + void setBladeForces(real* _bladeForcesX, real* _bladeForcesY, real* _bladeForcesZ); + virtual void calcBladeForces(); - void initBladeRadii(CudaMemoryManager* cudaManager); - void initBladeCoords(CudaMemoryManager* cudaManager); - void initBladeVelocities(CudaMemoryManager* cudaManager); - void initBladeForces(CudaMemoryManager* cudaManager); - void initBladeIndices(Parameter* para, CudaMemoryManager* cudaManager); +private: + void initBoundingSphere(Parameter* para, CudaMemoryManager* cudaMemoryManager); - void calcForcesEllipticWing(Parameter* para); - void rotateBlades(real angle); + void initBladeRadii(CudaMemoryManager* cudaMemoryManager); + void initBladeCoords(CudaMemoryManager* cudaMemoryManager); + void initBladeVelocities(CudaMemoryManager* cudaMemoryManager); + void initBladeForces(CudaMemoryManager* cudaMemoryManager); + void initBladeIndices(Parameter* para, CudaMemoryManager* cudaMemoryManager); - void writeBladeCoords(uint t); - void writeBladeForces(uint t); - void writeBladeVelocities(uint t); - + void calcForcesEllipticWing(); public: real* bladeRadiiH; @@ -96,14 +108,13 @@ public: private: const real density; real turbinePosX, turbinePosY, turbinePosZ; - real omega, azimuth, delta_t, delta_x; + real omega, azimuth, yaw, deltaT, deltaX, invDeltaX, forceRatio, factorGaussian, invEpsilonSqrd; const real diameter; const uint nBladeNodes; const uint nBlades; const real epsilon; // in m const int level; - uint numberOfIndices; - uint numberOfNodes; - }; + uint nIndices, nNodes; +}; #endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h index 78b4d5e9ba148651e78c38758624de69dd08c47d..a9b233f3035890c2617d3a00b639f995be6c218f 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h @@ -30,9 +30,9 @@ public: { } - virtual void init(Parameter *para, GridProvider *gridProvider, CudaMemoryManager *cudaManager) = 0; - virtual void interact(Parameter *para, CudaMemoryManager *cudaManager, int level, uint t) = 0; - virtual void free(Parameter *para, CudaMemoryManager *cudaManager) = 0; + virtual void init(Parameter *para, GridProvider *gridProvider, CudaMemoryManager *cudaMemoryManager) = 0; + virtual void interact(Parameter *para, CudaMemoryManager *cudaMemoryManager, int level, uint t) = 0; + virtual void free(Parameter *para, CudaMemoryManager *cudaMemoryManager) = 0; protected: uint updateInterval; diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.cu new file mode 100644 index 0000000000000000000000000000000000000000..f5b520acfad74f6787e9e657fce3ccdceed9d539 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.cu @@ -0,0 +1,469 @@ +#include "Probe.h" +#include "PlanarAverageProbe.h" + +#include <cuda/CudaGrid.h> + +#include <cuda.h> +#include <cuda_runtime.h> +#include <helper_cuda.h> + +#include <thrust/device_vector.h> +#include <thrust/reduce.h> +#include <thrust/device_ptr.h> +#include <thrust/inner_product.h> + +#include "Parameter/Parameter.h" +#include "DataStructureInitializer/GridProvider.h" +#include "GPU/CudaMemoryManager.h" + +#include <algorithm> + +/////////////////////////////////////////////////////////////////////////////////// +/// Functors for thrust reductions +/////////////////////////////////////////////////////////////////////////////////// + +template<typename T> +struct pow2 : public thrust::unary_function<T,T> +{ + __host__ __device__ T operator()(const T &x) const + { + return x * x; + } +}; + +template<typename T> +struct pow3 : public thrust::unary_function<T,T> +{ + __host__ __device__ T operator()(const T &x) const + { + return x * x * x; + } +}; + +template<typename T> +struct pow4 : public thrust::unary_function<T,T> +{ + __host__ __device__ T operator()(const T &x) const + { + return x * x * x * x; + } +}; + +struct nth_moment +{ + const float mean; + const int n; + + nth_moment(float _mean, int _n) : mean(_mean), n(_n) {} + + __host__ __device__ + float operator()(const float& x) const { + + real fluctuation = x-mean; + real moment = fluctuation; + for(int i = 1; i<n; i++) moment *= fluctuation; + + return moment; + } +}; + + +/////////////////////////////////////////////////////////////////////////////////// + +__global__ void moveIndicesInPosNormalDir( uint* pointIndices, uint nPoints, uint* neighborNormal, real* coordsX, real* coordsY, real* coordsZ ) +{ + const uint x = threadIdx.x; + const uint y = blockIdx.x; + const uint z = blockIdx.y; + + const uint nx = blockDim.x; + const uint ny = gridDim.x; + + const uint node = nx*(ny*z + y) + x; + + if(node>=nPoints) return; + + uint k = pointIndices[node]; + + pointIndices[node] = neighborNormal[k]; +} + +__global__ void moveIndicesInNegNormalDir( uint* pointIndices, uint nPoints, uint* neighborWSB, uint* neighborInplane1, uint* neighborInplane2, real* coordsX, real* coordsY, real* coordsZ ) +{ + const uint x = threadIdx.x; + const uint y = blockIdx.x; + const uint z = blockIdx.y; + + const uint nx = blockDim.x; + const uint ny = gridDim.x; + + const uint node = nx*(ny*z + y) + x; + + if(node>=nPoints) return; + + uint k = pointIndices[node]; + + pointIndices[node] = neighborWSB[neighborInplane1[neighborInplane2[k]]]; +} + +/////////////////////////////////////////////////////////////////////////////////// + +bool PlanarAverageProbe::isAvailableStatistic(Statistic _variable) +{ + bool isAvailable; + + switch (_variable) + { + case Statistic::Instantaneous: + case Statistic::Means: + case Statistic::Variances: + isAvailable = false; + break; + case Statistic::SpatialMeans: + case Statistic::SpatioTemporalMeans: + case Statistic::SpatialCovariances: + case Statistic::SpatioTemporalCovariances: + case Statistic::SpatialSkewness: + case Statistic::SpatioTemporalSkewness: + case Statistic::SpatialFlatness: + case Statistic::SpatioTemporalFlatness: + isAvailable = true; + break; + default: + isAvailable = false; + } + return isAvailable; +} + +/////////////////////////////////////////////////////////////////////////////////// +std::vector<PostProcessingVariable> PlanarAverageProbe::getPostProcessingVariables(Statistic statistic) +{ + std::vector<PostProcessingVariable> postProcessingVariables; + switch (statistic) + { + case Statistic::SpatialMeans: + postProcessingVariables.push_back( PostProcessingVariable("vx_spatMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy_spatMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz_spatMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("nut_spatMean", this->viscosityRatio) ); + break; + case Statistic::SpatioTemporalMeans: + postProcessingVariables.push_back( PostProcessingVariable("vx_spatTmpMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy_spatTmpMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz_spatTmpMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("nut_spatTmpMean", this->viscosityRatio) ); + break; + case Statistic::SpatialCovariances: + postProcessingVariables.push_back( PostProcessingVariable("vxvx_spatMean", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vyvy_spatMean", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vzvz_spatMean", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vxvy_spatMean", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vxvz_spatMean", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vyvz_spatMean", this->stressRatio) ); + break; + case Statistic::SpatioTemporalCovariances: + postProcessingVariables.push_back( PostProcessingVariable("vxvx_spatTmpMean", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vyvy_spatTmpMean", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vzvz_spatTmpMean", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vxvy_spatTmpMean", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vxvz_spatTmpMean", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vyvz_spatTmpMean", this->stressRatio) ); + break; + case Statistic::SpatialSkewness: + postProcessingVariables.push_back( PostProcessingVariable("Sx_spatMean", this->nondimensional) ); + postProcessingVariables.push_back( PostProcessingVariable("Sy_spatMean", this->nondimensional) ); + postProcessingVariables.push_back( PostProcessingVariable("Sz_spatMean", this->nondimensional) ); + break; + case Statistic::SpatioTemporalSkewness: + postProcessingVariables.push_back( PostProcessingVariable("Sx_spatTmpMean", this->nondimensional) ); + postProcessingVariables.push_back( PostProcessingVariable("Sy_spatTmpMean", this->nondimensional) ); + postProcessingVariables.push_back( PostProcessingVariable("Sz_spatTmpMean", this->nondimensional) ); + break; + case Statistic::SpatialFlatness: + postProcessingVariables.push_back( PostProcessingVariable("Fx_spatMean", this->nondimensional) ); + postProcessingVariables.push_back( PostProcessingVariable("Fy_spatMean", this->nondimensional) ); + postProcessingVariables.push_back( PostProcessingVariable("Fz_spatMean", this->nondimensional) ); + break; + case Statistic::SpatioTemporalFlatness: + postProcessingVariables.push_back( PostProcessingVariable("Fx_spatTmpMean", this->nondimensional) ); + postProcessingVariables.push_back( PostProcessingVariable("Fy_spatTmpMean", this->nondimensional) ); + postProcessingVariables.push_back( PostProcessingVariable("Fz_spatTmpMean", this->nondimensional) ); + break; + + default: + throw std::runtime_error("PlanarAverageProbe::getPostProcessingVariables: Statistic unavailable!"); + break; + } + return postProcessingVariables; +} + +/////////////////////////////////////////////////////////////////////////////////// + +void PlanarAverageProbe::findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level, + std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level, + std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, + int level) +{ + real dx = abs(para->getParH(level)->coordinateX[1]-para->getParH(level)->coordinateX[para->getParH(level)->neighborX[1]]); + + real /* *pointCoordsInplane1_par, *pointCoordsInplane2_par,*/ *pointCoordsNormal_par; + std::vector<real> *pointCoordsInplane1, *pointCoordsInplane2, *pointCoordsNormal; + + if(this->planeNormal == 'x'){ + pointCoordsNormal = &pointCoordsX_level; + pointCoordsInplane1 = &pointCoordsY_level; + pointCoordsInplane2 = &pointCoordsZ_level; + pointCoordsNormal_par = para->getParH(level)->coordinateX; + // pointCoordsInplane1_par = para->getParH(level)->coordY_SP; + // pointCoordsInplane2_par = para->getParH(level)->coordZ_SP; + } + if(this->planeNormal == 'y'){ + pointCoordsNormal = &pointCoordsY_level; + pointCoordsInplane1 = &pointCoordsX_level; + pointCoordsInplane2 = &pointCoordsZ_level; + pointCoordsNormal_par = para->getParH(level)->coordinateY; + // pointCoordsInplane1_par = para->getParH(level)->coordX_SP; + // pointCoordsInplane2_par = para->getParH(level)->coordZ_SP; + } + if(this->planeNormal == 'z'){ + pointCoordsNormal = &pointCoordsZ_level; + pointCoordsInplane1 = &pointCoordsX_level; + pointCoordsInplane2 = &pointCoordsY_level; + pointCoordsNormal_par = para->getParH(level)->coordinateZ; + // pointCoordsInplane1_par = para->getParH(level)->coordX_SP; + // pointCoordsInplane2_par = para->getParH(level)->coordY_SP; + } + + // Find all points along the normal direction + for(uint j=1; j<para->getParH(level)->numberOfNodes; j++ ) + { + if(para->getParH(level)->typeOfGridNode[j] == GEO_FLUID) + { + if( std::find(pointCoordsNormal->begin(), pointCoordsNormal->end(), pointCoordsNormal_par[j]) == pointCoordsNormal->end()) + { + pointCoordsNormal->push_back( pointCoordsNormal_par[j] ); + pointCoordsInplane1->push_back(999999.); + pointCoordsInplane2->push_back(999999.); + } + } + } + std::sort(pointCoordsNormal->begin(), pointCoordsNormal->end()); + + // Find all pointCoords in the first plane + for(uint j=1; j<para->getParH(level)->numberOfNodes; j++ ) + { + if( para->getParH(level)->typeOfGridNode[j] == GEO_FLUID && pointCoordsNormal_par[j] == pointCoordsNormal->at(0)) + { + //not needed in current state, might become relevant for two-point correlations + // pointCoordsNormal->push_back( pointCoordsNormal_par[j] ); + // pointCoordsInplane1->push_back( pointCoordsInplane1_par[j] ); + // pointCoordsInplane2->push_back( pointCoordsInplane2_par[j] ); + + probeIndices_level.push_back(j); + } + } +} + +/////////////////////////////////////////////////////////////////////////////////// + +void PlanarAverageProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t_level, int level) +{ + // Definition of normal and inplane directions for moveIndices kernels + uint *neighborNormal, *neighborInplane1, *neighborInplane2; + if( this->planeNormal == 'x' ) + { + neighborNormal = para->getParD(level)->neighborX; + neighborInplane1 = para->getParD(level)->neighborY; + neighborInplane2 = para->getParD(level)->neighborZ; + } + if( this->planeNormal == 'y' ) + { + neighborNormal = para->getParD(level)->neighborY; + neighborInplane1 = para->getParD(level)->neighborX; + neighborInplane2 = para->getParD(level)->neighborZ; + } + if( this->planeNormal == 'z' ) + { + neighborNormal = para->getParD(level)->neighborZ; + neighborInplane1 = para->getParD(level)->neighborX; + neighborInplane2 = para->getParD(level)->neighborY; + } + + bool doTmpAveraging = t_level>=(this->getTStartTmpAveraging()*pow(2,level)); + + // Pointer casts to use device arrays in thrust reductions + thrust::device_ptr<uint> indices_thrust = thrust::device_pointer_cast(probeStruct->pointIndicesD); + thrust::device_ptr<real> vx_thrust = thrust::device_pointer_cast(para->getParD(level)->velocityX); + thrust::device_ptr<real> vy_thrust = thrust::device_pointer_cast(para->getParD(level)->velocityY); + thrust::device_ptr<real> vz_thrust = thrust::device_pointer_cast(para->getParD(level)->velocityZ); + thrust::device_ptr<real> nut_thrust = thrust::device_pointer_cast(para->getParD(level)->turbViscosity); + + real N = (real)probeStruct->nIndices; + real n = (real)probeStruct->vals; + uint nPoints = probeStruct->nPoints; + // Permutation iterators for direct iteration over the velocities of the planes + typedef thrust::device_vector<real>::iterator valIterator; + typedef thrust::device_vector<uint>::iterator indIterator; + thrust::permutation_iterator<valIterator, indIterator> vx_iter_begin(vx_thrust, indices_thrust); + thrust::permutation_iterator<valIterator, indIterator> vx_iter_end (vx_thrust, indices_thrust+probeStruct->nIndices); + thrust::permutation_iterator<valIterator, indIterator> vy_iter_begin(vy_thrust, indices_thrust); + thrust::permutation_iterator<valIterator, indIterator> vy_iter_end (vy_thrust, indices_thrust+probeStruct->nIndices); + thrust::permutation_iterator<valIterator, indIterator> vz_iter_begin(vz_thrust, indices_thrust); + thrust::permutation_iterator<valIterator, indIterator> vz_iter_end (vz_thrust, indices_thrust+probeStruct->nIndices); + thrust::permutation_iterator<valIterator, indIterator> nut_iter_begin(nut_thrust, indices_thrust); + thrust::permutation_iterator<valIterator, indIterator> nut_iter_end (nut_thrust, indices_thrust+probeStruct->nIndices); + + for( uint i=0; i<nPoints; i++ ) + { + uint node = probeStruct->isEvenTAvg? i : nPoints-1-i; // Note, loop moves in positive normal dir at even calls and in negative normal dir in odd calls + + if(probeStruct->quantitiesH[int(Statistic::SpatialMeans)]) + { + // Compute the instantaneous spatial means of the velocity moments + real spatMean_vx = thrust::reduce(vx_iter_begin, vx_iter_end)/N; + real spatMean_vy = thrust::reduce(vy_iter_begin, vy_iter_end)/N; + real spatMean_vz = thrust::reduce(vz_iter_begin, vz_iter_end)/N; + + real spatMean_nut; + if(para->getUseTurbulentViscosity()) spatMean_nut = thrust::reduce(nut_iter_begin, nut_iter_end)/N; + + uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatialMeans)]; + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] = spatMean_vx; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] = spatMean_vy; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] = spatMean_vz; + if(para->getUseTurbulentViscosity()) probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node] = spatMean_nut; + + if(probeStruct->quantitiesH[int(Statistic::SpatioTemporalMeans)] && doTmpAveraging) + { + uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatioTemporalMeans)]; + real spatTmpMean_vx_old = probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node]; + real spatTmpMean_vy_old = probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node]; + real spatTmpMean_vz_old = probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node]; + real spatTmpMean_nut_old; + if(para->getUseTurbulentViscosity()) spatTmpMean_nut_old = probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node];; + + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_vx-spatTmpMean_vx_old)/n; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_vy-spatTmpMean_vy_old)/n; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_vz-spatTmpMean_vz_old)/n; + if(para->getUseTurbulentViscosity()) probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node] += (spatMean_nut-spatTmpMean_nut_old)/n; + + } + + if(probeStruct->quantitiesH[int(Statistic::SpatialCovariances)]) + { // <u_i' u_j'> = <u_i u_j> - <u_i>*<u_i> + real vx2 = thrust::transform_reduce(vx_iter_begin, vx_iter_end, pow2<real>(), 0.f, thrust::plus<real>())/N; + real vy2 = thrust::transform_reduce(vy_iter_begin, vy_iter_end, pow2<real>(), 0.f, thrust::plus<real>())/N; + real vz2 = thrust::transform_reduce(vz_iter_begin, vz_iter_end, pow2<real>(), 0.f, thrust::plus<real>())/N; + real vxvy = thrust::inner_product(vx_iter_begin, vx_iter_end, vy_iter_begin, 0.f)/N; + real vxvz = thrust::inner_product(vx_iter_begin, vx_iter_end, vz_iter_begin, 0.f)/N; + real vyvz = thrust::inner_product(vy_iter_begin, vy_iter_end, vz_iter_begin, 0.f)/N; + real spatMean_vxvx = vx2-spatMean_vx*spatMean_vx; + real spatMean_vyvy = vy2-spatMean_vy*spatMean_vy; + real spatMean_vzvz = vz2-spatMean_vz*spatMean_vz; + real spatMean_vxvy = vxvy-spatMean_vx*spatMean_vy; + real spatMean_vxvz = vxvz-spatMean_vx*spatMean_vz; + real spatMean_vyvz = vyvz-spatMean_vy*spatMean_vz; + + uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatialCovariances)]; + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] = spatMean_vxvx; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] = spatMean_vyvy; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] = spatMean_vzvz; + probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node] = spatMean_vxvy; + probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+node] = spatMean_vxvz; + probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+node] = spatMean_vyvz; + + if(probeStruct->quantitiesH[int(Statistic::SpatioTemporalCovariances)] && doTmpAveraging) + { + uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatioTemporalCovariances)]; + real spatTmpMean_vxvx_old = probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node]; + real spatTmpMean_vyvy_old = probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node]; + real spatTmpMean_vzvz_old = probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node]; + real spatTmpMean_vxvy_old = probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node]; + real spatTmpMean_vxvz_old = probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+node]; + real spatTmpMean_vyvz_old = probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+node]; + + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_vxvx-spatTmpMean_vxvx_old)/n; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_vyvy-spatTmpMean_vyvy_old)/n; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_vzvz-spatTmpMean_vzvz_old)/n; + probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node] += (spatMean_vxvy-spatTmpMean_vxvy_old)/n; + probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+node] += (spatMean_vxvz-spatTmpMean_vxvz_old)/n; + probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+node] += (spatMean_vyvz-spatTmpMean_vyvz_old)/n; + } + + if(probeStruct->quantitiesH[int(Statistic::SpatialSkewness)]) + { // <u_i'^3> = <u_i^3> - <u_i>^3 - 3 <u_i> <u_i'^2> + // real vx3 = thrust::transform_reduce(vx_iter_begin, vx_iter_end, pow3<real>(), 0.f, thrust::plus<real>())/N; + // real vy3 = thrust::transform_reduce(vy_iter_begin, vy_iter_end, pow3<real>(), 0.f, thrust::plus<real>())/N; + // real vz3 = thrust::transform_reduce(vz_iter_begin, vz_iter_end, pow3<real>(), 0.f, thrust::plus<real>())/N; + real spatMean_vxvxvx = thrust::transform_reduce(vx_iter_begin, vx_iter_end, nth_moment(spatMean_vx, 3), 0.f, thrust::plus<real>())/N; + //vx3 - spatMean_vx*spatMean_vx*spatMean_vx - 3*spatMean_vx*spatMean_vxvx; -> alternative only using vx3, etc. but containing some bug. Potentially better in terms of round-off errors. + real spatMean_vyvyvy = thrust::transform_reduce(vy_iter_begin, vy_iter_end, nth_moment(spatMean_vy, 3), 0.f, thrust::plus<real>())/N; + //vy3 - spatMean_vy*spatMean_vy*spatMean_vy - 3*spatMean_vy*spatMean_vzvz; + real spatMean_vzvzvz = thrust::transform_reduce(vz_iter_begin, vz_iter_end, nth_moment(spatMean_vz, 3), 0.f, thrust::plus<real>())/N; + //vz3 - spatMean_vz*spatMean_vz*spatMean_vz - 3*spatMean_vz*spatMean_vzvz; + real spatMean_Sx = spatMean_vxvxvx/pow(spatMean_vxvx, 1.5f); + real spatMean_Sy = spatMean_vyvyvy/pow(spatMean_vyvy, 1.5f); + real spatMean_Sz = spatMean_vzvzvz/pow(spatMean_vzvz, 1.5f); + + uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatialSkewness)]; + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] = spatMean_Sx; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] = spatMean_Sy; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] = spatMean_Sz; + + if(probeStruct->quantitiesH[int(Statistic::SpatioTemporalSkewness)] && doTmpAveraging) + { + uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatioTemporalSkewness)]; + real spatTmpMean_Sx_old = probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node]; + real spatTmpMean_Sy_old = probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node]; + real spatTmpMean_Sz_old = probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node]; + + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_Sx-spatTmpMean_Sx_old)/n; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_Sy-spatTmpMean_Sy_old)/n; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_Sz-spatTmpMean_Sz_old)/n; + } + + if(probeStruct->quantitiesH[int(Statistic::SpatialFlatness)]) + { // <u_i'^4> = <u_i^4> - <u_i>^4 - 6 <u_i>^2 <u_i'^2> - 4 <u> <u'^3> + // real vx4 = thrust::transform_reduce(vx_iter_begin, vx_iter_end, pow4<real>(), 0.f, thrust::plus<real>())/N; + // real vy4 = thrust::transform_reduce(vy_iter_begin, vy_iter_end, pow4<real>(), 0.f, thrust::plus<real>())/N; + // real vz4 = thrust::transform_reduce(vz_iter_begin, vz_iter_end, pow4<real>(), 0.f, thrust::plus<real>())/N; + real spatMean_vxvxvxvx = thrust::transform_reduce(vx_iter_begin, vx_iter_end, nth_moment(spatMean_vx, 4), 0.f, thrust::plus<real>())/N; //vx4 - spatMean_vx*spatMean_vx*spatMean_vx*spatMean_vx - 6*spatMean_vx*spatMean_vx*vx2 - 4*spatMean_vx*vx3; + real spatMean_vyvyvyvy = thrust::transform_reduce(vy_iter_begin, vy_iter_end, nth_moment(spatMean_vy, 4), 0.f, thrust::plus<real>())/N; //vy4 - spatMean_vy*spatMean_vy*spatMean_vy*spatMean_vy - 6*spatMean_vy*spatMean_vx*vy2 - 4*spatMean_vy*vy3; + real spatMean_vzvzvzvz = thrust::transform_reduce(vz_iter_begin, vz_iter_end, nth_moment(spatMean_vz, 4), 0.f, thrust::plus<real>())/N; //vz4 - spatMean_vz*spatMean_vz*spatMean_vz*spatMean_vz - 6*spatMean_vz*spatMean_vx*vz2 - 4*spatMean_vz*vz3; + real spatMean_Fx = spatMean_vxvxvxvx/(spatMean_vxvx*spatMean_vxvx); + real spatMean_Fy = spatMean_vyvyvyvy/(spatMean_vyvy*spatMean_vyvy); + real spatMean_Fz = spatMean_vzvzvzvz/(spatMean_vzvz*spatMean_vzvz); + + uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatialFlatness)]; + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] = spatMean_Fx; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] = spatMean_Fy; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] = spatMean_Fz; + + if(probeStruct->quantitiesH[int(Statistic::SpatioTemporalFlatness)] && doTmpAveraging) + { + uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatioTemporalFlatness)]; + real spatTmpMean_Fx_old = probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node]; + real spatTmpMean_Fy_old = probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node]; + real spatTmpMean_Fz_old = probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node]; + + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_Fx-spatTmpMean_Fx_old)/n; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_Fy-spatTmpMean_Fy_old)/n; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_Fz-spatTmpMean_Fz_old)/n; + } + } + } + } + } + if(i<probeStruct->nPoints-1) + { + vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, probeStruct->nIndices); + if(probeStruct->isEvenTAvg) + moveIndicesInPosNormalDir<<<grid.grid, grid.threads>>>( probeStruct->pointIndicesD, probeStruct->nIndices, neighborNormal, para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ ); + else + moveIndicesInNegNormalDir<<<grid.grid, grid.threads>>>( probeStruct->pointIndicesD, probeStruct->nIndices, para->getParD(level)->neighborInverse, neighborInplane1, neighborInplane2, para->getParD(level)->coordinateX, para->getParD(level)->coordinateY, para->getParD(level)->coordinateZ ); + } + } + probeStruct->isEvenTAvg=!(probeStruct->isEvenTAvg); + + getLastCudaError("PlanarAverageProbe::calculateQuantities execution failed"); +} diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.h new file mode 100644 index 0000000000000000000000000000000000000000..d11f8e76e4d13113b201af5494b7d0cfcfe18353 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.h @@ -0,0 +1,99 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file PlanarAverageProbe.h +//! \author Henrik Asmuth +//! \date 13/05/2022 +//! \brief Probe computing statistics across planes spanning the entire domain +//! +//! Computes spatial statistics across x, y or z-normal planes defined by planeNormal. +//! The planes include all points of the domain at each respective position along that normal direction. +//! The spatial statistics can additionally be averaged in time. +//! +//======================================================================================= + +#ifndef PlanarAverageProbe_H +#define PlanarAverageProbe_H + +#include <iostream> + +#include "Probe.h" + +__global__ void moveIndicesInNegNormalDir( uint* pointIndices, uint nPoints, uint* neighborWSB, uint* neighborInplane1, uint* neighborInplane2, real* coordsX, real* coordsY, real* coordsZ ); + +__global__ void moveIndicesInPosNormalDir( uint* pointIndices, uint nPoints, uint* neighborNormal, real* coordsX, real* coordsY, real* coordsZ ); + +/////////////////////////////////////////////////////////////////////////////////// + +class PlanarAverageProbe : public Probe +{ +public: + PlanarAverageProbe( + const std::string _probeName, + const std::string _outputPath, + uint _tStartAvg, + uint _tStartTmpAvg, + uint _tAvg, + uint _tStartOut, + uint _tOut, + char _planeNormal + ): Probe(_probeName, + _outputPath, + _tStartAvg, + _tStartTmpAvg, + _tAvg, + _tStartOut, + _tOut, + false, + false), + planeNormal(_planeNormal) + + { + if(!(_planeNormal == 'x' || _planeNormal == 'y' || _planeNormal == 'z')) + throw std::runtime_error("PlanarAverageProbe: planeNormal must be 'x', 'y' or 'z'!"); + } + + +private: + bool isAvailableStatistic(Statistic _variable) override; + + std::vector<PostProcessingVariable> getPostProcessingVariables(Statistic variable) override; + + void findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level, + std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level, + std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, + int level) override; + void calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) override; + +private: + real posX, posY, posZ; + real deltaX, deltaY, deltaZ; + char planeNormal; +}; + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.cu index cf03d639add0c883793c6ffad041e7b6da6d98d3..7d1c0205219737e4b28acbb1a893a0a6071ae9de 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.cu +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.cu @@ -1,3 +1,4 @@ +#include "Probe.h" #include "PlaneProbe.h" #include <cuda/CudaGrid.h> @@ -10,17 +11,76 @@ #include "DataStructureInitializer/GridProvider.h" #include "GPU/CudaMemoryManager.h" + +bool PlaneProbe::isAvailableStatistic(Statistic _variable) +{ + bool isAvailable; + switch (_variable) + { + case Statistic::Instantaneous: + case Statistic::Means: + case Statistic::Variances: + isAvailable = true; + break; + case Statistic::SpatialMeans: + case Statistic::SpatioTemporalMeans: + case Statistic::SpatialCovariances: + case Statistic::SpatioTemporalCovariances: + case Statistic::SpatialSkewness: + case Statistic::SpatioTemporalSkewness: + case Statistic::SpatialFlatness: + case Statistic::SpatioTemporalFlatness: + isAvailable = false; + break; + default: + isAvailable = false; + } + return isAvailable; +} + + +std::vector<PostProcessingVariable> PlaneProbe::getPostProcessingVariables(Statistic statistic) +{ + std::vector<PostProcessingVariable> postProcessingVariables; + switch (statistic) + { + case Statistic::Instantaneous: + postProcessingVariables.push_back( PostProcessingVariable("vx", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("rho", this->densityRatio ) ); + break; + case Statistic::Means: + postProcessingVariables.push_back( PostProcessingVariable("vx_mean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy_mean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz_mean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("rho_mean", this->densityRatio ) ); + break; + case Statistic::Variances: + postProcessingVariables.push_back( PostProcessingVariable("vx_var", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy_var", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz_var", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("rho_var", this->densityRatio) ); + break; + + default: + throw std::runtime_error("PlaneProbe::getPostProcessingVariables: Statistic unavailable!"); + break; + } + return postProcessingVariables; +} + void PlaneProbe::findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level, std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level, std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, int level) { - real dx = abs(para->getParH(level)->coordX_SP[1]-para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[1]]); - for(uint j=1; j<para->getParH(level)->size_Mat_SP; j++ ) + real dx = abs(para->getParH(level)->coordinateX[1]-para->getParH(level)->coordinateX[para->getParH(level)->neighborX[1]]); + for(uint j=1; j<para->getParH(level)->numberOfNodes; j++ ) { - real pointCoordX = para->getParH(level)->coordX_SP[j]; - real pointCoordY = para->getParH(level)->coordY_SP[j]; - real pointCoordZ = para->getParH(level)->coordZ_SP[j]; + real pointCoordX = para->getParH(level)->coordinateX[j]; + real pointCoordY = para->getParH(level)->coordinateY[j]; + real pointCoordZ = para->getParH(level)->coordinateZ[j]; real distX = pointCoordX - this->posX; real distY = pointCoordY - this->posY; real distZ = pointCoordZ - this->posZ; @@ -39,13 +99,11 @@ void PlaneProbe::findPoints(Parameter* para, GridProvider* gridProvider, std::ve } } -void PlaneProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, int level) +void PlaneProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, probeStruct->nPoints); - interpQuantities<<<grid.grid, grid.threads>>>( probeStruct->pointIndicesD, probeStruct->nPoints, probeStruct->vals, - probeStruct->distXD, probeStruct->distYD, probeStruct->distZD, - para->getParD(level)->vx_SP, para->getParD(level)->vy_SP, para->getParD(level)->vz_SP, para->getParD(level)->rho_SP, - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - probeStruct->quantitiesD, probeStruct->arrayOffsetsD, probeStruct->quantitiesArrayD, false); - + calcQuantitiesKernel<<<grid.grid, grid.threads>>>( probeStruct->pointIndicesD, probeStruct->nPoints, probeStruct->vals, + para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ, para->getParD(level)->rho, + para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + probeStruct->quantitiesD, probeStruct->arrayOffsetsD, probeStruct->quantitiesArrayD); } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.h index 6f6af68fc2e4b5d93502d9890a29cc4838ac6042..3440c01020f9b3505be7148024e47373b76648ff 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.h +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.h @@ -1,3 +1,41 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file PlaneProbe.h +//! \author Henry Korb, Henrik Asmuth +//! \date 13/05/2022 +//! \brief Probe computing point-wise statistics for a set of points across a plane +//! +//! The set of points can be defined by providing a list or on an x-normal plane. +//! All statistics are temporal. +//! +//======================================================================================= + #ifndef PlaneProbe_H #define PlaneProbe_H @@ -8,13 +46,20 @@ class PlaneProbe : public Probe public: PlaneProbe( const std::string _probeName, + const std::string _outputPath, uint _tStartAvg, + uint _tAvg, uint _tStartOut, uint _tOut ): Probe(_probeName, + _outputPath, _tStartAvg, + 0, + _tAvg, _tStartOut, - _tOut) + _tOut, + true, + false) {} void setProbePlane(real _posX, real _posY, real _posZ, real _deltaX, real _deltaY, real _deltaZ) @@ -28,11 +73,15 @@ public: } private: + bool isAvailableStatistic(Statistic _variable) override; + + std::vector<PostProcessingVariable> getPostProcessingVariables(Statistic variable) override; + void findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level, std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level, std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, int level) override; - void calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, int level) override; + void calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) override; private: real posX, posY, posZ; diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.cu index 76467d8da942cb189516571db66a473e5c4c32d5..e78a98f02ac2093fc46b4daa4a2485ed1395275b 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.cu +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.cu @@ -1,3 +1,4 @@ +#include "Probe.h" #include "PointProbe.h" #include <cuda.h> @@ -10,23 +11,80 @@ #include "DataStructureInitializer/GridProvider.h" #include "GPU/CudaMemoryManager.h" +bool PointProbe::isAvailableStatistic(Statistic _variable) +{ + bool isAvailable; + switch (_variable) + { + case Statistic::Instantaneous: + case Statistic::Means: + case Statistic::Variances: + isAvailable = true; + break; + case Statistic::SpatialMeans: + case Statistic::SpatioTemporalMeans: + case Statistic::SpatialCovariances: + case Statistic::SpatioTemporalCovariances: + case Statistic::SpatialSkewness: + case Statistic::SpatioTemporalSkewness: + case Statistic::SpatialFlatness: + case Statistic::SpatioTemporalFlatness: + isAvailable = false; + break; + default: + isAvailable = false; + } + return isAvailable; +} + +std::vector<PostProcessingVariable> PointProbe::getPostProcessingVariables(Statistic statistic) +{ + std::vector<PostProcessingVariable> postProcessingVariables; + switch (statistic) + { + case Statistic::Instantaneous: + postProcessingVariables.push_back( PostProcessingVariable("vx", velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("rho", this->densityRatio ) ); + break; + case Statistic::Means: + postProcessingVariables.push_back( PostProcessingVariable("vx_mean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy_mean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz_mean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("rho_mean", this->densityRatio ) ); + break; + case Statistic::Variances: + postProcessingVariables.push_back( PostProcessingVariable("vx_var", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy_var", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz_var", this->stressRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("rho_var", this->densityRatio) ); + break; + + default: + throw std::runtime_error("PointProbe::getPostProcessingVariables: Statistic unavailable!"); + break; + } + return postProcessingVariables; +} + void PointProbe::findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level, std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level, std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, int level) { - real dx = abs(para->getParH(level)->coordX_SP[1]-para->getParH(level)->coordX_SP[para->getParH(level)->neighborX_SP[1]]); - for(uint j=1; j<para->getParH(level)->size_Mat_SP; j++ ) + real dx = abs(para->getParH(level)->coordinateX[1]-para->getParH(level)->coordinateX[para->getParH(level)->neighborX[1]]); + for(uint j=1; j<para->getParH(level)->numberOfNodes; j++ ) { for(uint point=0; point<this->pointCoordsX.size(); point++) { real pointCoordX = this->pointCoordsX[point]; real pointCoordY = this->pointCoordsY[point]; real pointCoordZ = this->pointCoordsZ[point]; - real distX = pointCoordX-para->getParH(level)->coordX_SP[j]; - real distY = pointCoordY-para->getParH(level)->coordY_SP[j]; - real distZ = pointCoordZ-para->getParH(level)->coordZ_SP[j]; + real distX = pointCoordX-para->getParH(level)->coordinateX[j]; + real distY = pointCoordY-para->getParH(level)->coordinateY[j]; + real distZ = pointCoordZ-para->getParH(level)->coordinateZ[j]; if( distX <=dx && distY <=dx && distZ <=dx && distX >0.f && distY >0.f && distZ >0.f) { @@ -42,21 +100,20 @@ void PointProbe::findPoints(Parameter* para, GridProvider* gridProvider, std::ve } } -void PointProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, int level) +void PointProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, probeStruct->nPoints); - - interpQuantities<<<grid.grid, grid.threads>>>( probeStruct->pointIndicesD, probeStruct->nPoints, probeStruct->vals, - probeStruct->distXD, probeStruct->distYD, probeStruct->distZD, - para->getParD(level)->vx_SP, para->getParD(level)->vy_SP, para->getParD(level)->vz_SP, para->getParD(level)->rho_SP, - para->getParD(level)->neighborX_SP, para->getParD(level)->neighborY_SP, para->getParD(level)->neighborZ_SP, - probeStruct->quantitiesD, probeStruct->arrayOffsetsD, probeStruct->quantitiesArrayD, true); + interpAndCalcQuantitiesKernel<<<grid.grid, grid.threads>>>( probeStruct->pointIndicesD, probeStruct->nPoints, probeStruct->vals, + probeStruct->distXD, probeStruct->distYD, probeStruct->distZD, + para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ, para->getParD(level)->rho, + para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, + probeStruct->quantitiesD, probeStruct->arrayOffsetsD, probeStruct->quantitiesArrayD); } void PointProbe::addProbePointsFromList(std::vector<real>& _pointCoordsX, std::vector<real>& _pointCoordsY, std::vector<real>& _pointCoordsZ) { bool isSameLength = ( (_pointCoordsX.size()==_pointCoordsY.size()) && (_pointCoordsY.size()==_pointCoordsZ.size())); - assert("Probe: point lists have different lengths" && isSameLength); + if (!isSameLength) throw std::runtime_error("Probe::addProbePointsFromList(): point lists have different lengths!"); this->pointCoordsX.insert(this->pointCoordsX.end(), _pointCoordsX.begin(), _pointCoordsX.end()); this->pointCoordsY.insert(this->pointCoordsY.end(), _pointCoordsY.begin(), _pointCoordsY.end()); this->pointCoordsZ.insert(this->pointCoordsZ.end(), _pointCoordsZ.begin(), _pointCoordsZ.end()); diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h index 917d2cf8c4f4606fc297491782bbc92dc621cf0e..6a6fbe76f089acfafc22672dd3e9d71bd193a3b3 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h @@ -1,3 +1,41 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file PointProbe.h +//! \author Henry Korb, Henrik Asmuth +//! \date 13/05/2022 +//! \brief Probe computing statistics for a set of points in space +//! +//! The set of points can be defined by providing a list or on an x-normal plane (the latter being somewhat redundant with PlaneProbe) +//! All statistics are temporal. +//! +//======================================================================================= + #ifndef PointProbe_H #define PointProbe_H @@ -8,25 +46,36 @@ class PointProbe: public Probe public: PointProbe( const std::string _probeName, + const std::string _outputPath, uint _tStartAvg, + uint _tAvg, uint _tStartOut, uint _tOut ): Probe(_probeName, + _outputPath, _tStartAvg, + 0, + _tAvg, _tStartOut, - _tOut) + _tOut, + true, + false) {} void addProbePointsFromList(std::vector<real>& _pointCoordsX, std::vector<real>& _pointCoordsY, std::vector<real>& _pointCoordsZ); void addProbePointsFromXNormalPlane(real pos_x, real pos0_y, real pos0_z, real pos1_y, real pos1_z, uint n_y, uint n_z); private: + bool isAvailableStatistic(Statistic _variable) override; + + std::vector<PostProcessingVariable> getPostProcessingVariables(Statistic variable) override; + void findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level, std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level, std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, int level) override; - void calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, int level) override; + void calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) override; private: std::vector<real> pointCoordsX, pointCoordsY, pointCoordsZ; diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu index e798f433270777f8d718218e91306f980b20e9ca..cc027b07bded01455437e65e08ccdcd51bcf7dc0 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file Probe.h +//! \author Henry Korb, Henrik Asmuth +//======================================================================================= + #include "Probe.h" #include <cuda.h> @@ -5,6 +37,7 @@ #include <helper_cuda.h> #include "VirtualFluids_GPU/GPU/GeometryUtils.h" +#include <lbm/constants/NumericConstants.h> #include "basics/writer/WbWriterVtkXmlBinary.h" #include <Core/StringUtilities/StringUtil.h> @@ -12,40 +45,27 @@ #include "DataStructureInitializer/GridProvider.h" #include "GPU/CudaMemoryManager.h" +using namespace vf::lbm::constant; -std::vector<std::string> getPostProcessingVariableNames(PostProcessingVariable variable) -{ - std::vector<std::string> varNames; - switch (variable) - { - case PostProcessingVariable::Means: - varNames.push_back("vx_mean"); - varNames.push_back("vy_mean"); - varNames.push_back("vz_mean"); - varNames.push_back("rho_mean"); - break; - case PostProcessingVariable::Variances: - varNames.push_back("vx_var"); - varNames.push_back("vy_var"); - varNames.push_back("vz_var"); - varNames.push_back("rho_var"); - break; - default: - break; - } - return varNames; -} - -__device__ void calculateQuantities(uint n, real* quantityArray, bool* quantities, uint* quantityArrayOffsets, uint nPoints, uint node, real vx, real vy, real vz, real rho) +__device__ void calculatePointwiseQuantities(uint n, real* quantityArray, bool* quantities, uint* quantityArrayOffsets, uint nPoints, uint node, real vx, real vy, real vz, real rho) { //"https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm" // also has extensions for higher order and covariances real inv_n = 1/real(n); - if(quantities[int(PostProcessingVariable::Means)]) + if(quantities[int(Statistic::Instantaneous)]) + { + uint arrOff = quantityArrayOffsets[int(Statistic::Instantaneous)]; + quantityArray[(arrOff+0)*nPoints+node] = vx; + quantityArray[(arrOff+1)*nPoints+node] = vy; + quantityArray[(arrOff+2)*nPoints+node] = vz; + quantityArray[(arrOff+3)*nPoints+node] = rho; + } + + if(quantities[int(Statistic::Means)]) { - uint arrOff = quantityArrayOffsets[int(PostProcessingVariable::Means)]; + uint arrOff = quantityArrayOffsets[int(Statistic::Means)]; real vx_m_old = quantityArray[(arrOff+0)*nPoints+node]; real vy_m_old = quantityArray[(arrOff+1)*nPoints+node]; real vz_m_old = quantityArray[(arrOff+2)*nPoints+node]; @@ -61,9 +81,9 @@ __device__ void calculateQuantities(uint n, real* quantityArray, bool* quantitie quantityArray[(arrOff+2)*nPoints+node] = vz_m_new; quantityArray[(arrOff+3)*nPoints+node] = rho_m_new; - if(quantities[int(PostProcessingVariable::Variances)]) + if(quantities[int(Statistic::Variances)]) { - arrOff = quantityArrayOffsets[int(PostProcessingVariable::Variances)]; + arrOff = quantityArrayOffsets[int(Statistic::Variances)]; real vx_var_old = quantityArray[(arrOff+0)*nPoints+node]; real vy_var_old = quantityArray[(arrOff+1)*nPoints+node]; @@ -83,14 +103,12 @@ __device__ void calculateQuantities(uint n, real* quantityArray, bool* quantitie } } -__global__ void interpQuantities( uint* pointIndices, +__global__ void calcQuantitiesKernel( uint* pointIndices, uint nPoints, uint n, - real* distX, real* distY, real* distZ, real* vx, real* vy, real* vz, real* rho, uint* neighborX, uint* neighborY, uint* neighborZ, bool* quantities, - uint* quantityArrayOffsets, real* quantityArray, - bool interpolate + uint* quantityArrayOffsets, real* quantityArray ) { const uint x = threadIdx.x; @@ -109,36 +127,69 @@ __global__ void interpQuantities( uint* pointIndices, uint k = pointIndices[node]; real u_interpX, u_interpY, u_interpZ, rho_interp; - if(interpolate) - { - uint ke, kn, kt, kne, kte, ktn, ktne; - getNeighborIndicesOfBSW( k, ke, kn, kt, kne, kte, ktn, ktne, neighborX, neighborY, neighborZ); + u_interpX = vx[k]; + u_interpY = vy[k]; + u_interpZ = vz[k]; + rho_interp = rho[k]; - // Trilinear interpolation of macroscopic quantities to probe point - real dW, dE, dN, dS, dT, dB; - getInterpolationWeights(dW, dE, dN, dS, dT, dB, distX[node], distY[node], distZ[node]); + calculatePointwiseQuantities(n, quantityArray, quantities, quantityArrayOffsets, nPoints, node, u_interpX, u_interpY, u_interpZ, rho_interp); +} - u_interpX = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vx ); - u_interpY = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vy ); - u_interpZ = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vz ); - rho_interp = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, rho ); - } - else - { - u_interpX = vx[k]; - u_interpY = vy[k]; - u_interpZ = vz[k]; - rho_interp = rho[k]; - } +__global__ void interpAndCalcQuantitiesKernel( uint* pointIndices, + uint nPoints, uint n, + real* distX, real* distY, real* distZ, + real* vx, real* vy, real* vz, real* rho, + uint* neighborX, uint* neighborY, uint* neighborZ, + bool* quantities, + uint* quantityArrayOffsets, real* quantityArray + ) +{ + const uint x = threadIdx.x; + const uint y = blockIdx.x; + const uint z = blockIdx.y; + + const uint nx = blockDim.x; + const uint ny = gridDim.x; + + const uint node = nx*(ny*z + y) + x; + + if(node>=nPoints) return; + + // Get indices of neighbor nodes. + // node referring to BSW cell as seen from probe point + uint k = pointIndices[node]; + real u_interpX, u_interpY, u_interpZ, rho_interp; - calculateQuantities(n, quantityArray, quantities, quantityArrayOffsets, nPoints, node, u_interpX, u_interpY, u_interpZ, rho_interp); + uint ke, kn, kt, kne, kte, ktn, ktne; + getNeighborIndicesOfBSW( k, ke, kn, kt, kne, kte, ktn, ktne, neighborX, neighborY, neighborZ); + + // Trilinear interpolation of macroscopic quantities to probe point + real dW, dE, dN, dS, dT, dB; + getInterpolationWeights(dW, dE, dN, dS, dT, dB, distX[node], distY[node], distZ[node]); + + u_interpX = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vx ); + u_interpY = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vy ); + u_interpZ = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vz ); + rho_interp = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, rho ); + + calculatePointwiseQuantities(n, quantityArray, quantities, quantityArrayOffsets, nPoints, node, u_interpX, u_interpY, u_interpZ, rho_interp); } +bool Probe::getHasDeviceQuantityArray(){ return this->hasDeviceQuantityArray; } -void Probe::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaManager) +real Probe::getNondimensionalConversionFactor(int level){ return c1o1; } + +void Probe::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaMemoryManager) { + using std::placeholders::_1; + this->velocityRatio = std::bind(&Parameter::getScaledVelocityRatio, para, _1); + this->densityRatio = std::bind(&Parameter::getScaledDensityRatio, para, _1); + this->forceRatio = std::bind(&Parameter::getScaledForceRatio, para, _1); + this->stressRatio = std::bind(&Parameter::getScaledPressureRatio, para, _1); + this->viscosityRatio = std::bind(&Parameter::getScaledViscosityRatio, para, _1); + this->nondimensional = std::bind(&Probe::getNondimensionalConversionFactor, this, _1); probeParams.resize(para->getMaxLevel()+1); @@ -151,28 +202,27 @@ void Probe::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* std::vector<real> pointCoordsX_level; std::vector<real> pointCoordsY_level; std::vector<real> pointCoordsZ_level; - + this->findPoints(para, gridProvider, probeIndices_level, distX_level, distY_level, distZ_level, pointCoordsX_level, pointCoordsY_level, pointCoordsZ_level, level); - this->addProbeStruct(cudaManager, probeIndices_level, + this->addProbeStruct(cudaMemoryManager, probeIndices_level, distX_level, distY_level, distZ_level, - pointCoordsX_level, pointCoordsX_level, pointCoordsX_level, + pointCoordsX_level, pointCoordsY_level, pointCoordsZ_level, level); } } - - -void Probe::addProbeStruct(CudaMemoryManager* cudaManager, std::vector<int>& probeIndices, +void Probe::addProbeStruct(CudaMemoryManager* cudaMemoryManager, std::vector<int>& probeIndices, std::vector<real>& distX, std::vector<real>& distY, std::vector<real>& distZ, std::vector<real>& pointCoordsX, std::vector<real>& pointCoordsY, std::vector<real>& pointCoordsZ, int level) { probeParams[level] = SPtr<ProbeStruct>(new ProbeStruct); probeParams[level]->vals = 1; - probeParams[level]->nPoints = uint(probeIndices.size()); + probeParams[level]->nPoints = uint(pointCoordsX.size()); // Note, need to have both nPoints and nIndices because they differ in PlanarAverage + probeParams[level]->nIndices = uint(probeIndices.size()); probeParams[level]->pointCoordsX = (real*)malloc(probeParams[level]->nPoints*sizeof(real)); probeParams[level]->pointCoordsY = (real*)malloc(probeParams[level]->nPoints*sizeof(real)); @@ -182,36 +232,40 @@ void Probe::addProbeStruct(CudaMemoryManager* cudaManager, std::vector<int>& pro std::copy(pointCoordsY.begin(), pointCoordsY.end(), probeParams[level]->pointCoordsY); std::copy(pointCoordsZ.begin(), pointCoordsZ.end(), probeParams[level]->pointCoordsZ); - // Might have to catch nPoints=0 ?!?! - cudaManager->cudaAllocProbeDistances(this, level); - cudaManager->cudaAllocProbeIndices(this, level); - - std::copy(distX.begin(), distX.end(), probeParams[level]->distXH); - std::copy(distY.begin(), distY.end(), probeParams[level]->distYH); - std::copy(distZ.begin(), distZ.end(), probeParams[level]->distZH); + // Note, dist only needed for kernels that do interpolate + if( distX.size()>0 && distY.size()>0 && distZ.size()>0 ) + { + probeParams[level]->hasDistances=true; + cudaMemoryManager->cudaAllocProbeDistances(this, level); + std::copy(distX.begin(), distX.end(), probeParams[level]->distXH); + std::copy(distY.begin(), distY.end(), probeParams[level]->distYH); + std::copy(distZ.begin(), distZ.end(), probeParams[level]->distZH); + cudaMemoryManager->cudaCopyProbeDistancesHtoD(this, level); + } + + cudaMemoryManager->cudaAllocProbeIndices(this, level); std::copy(probeIndices.begin(), probeIndices.end(), probeParams[level]->pointIndicesH); - - cudaManager->cudaCopyProbeDistancesHtoD(this, level); - cudaManager->cudaCopyProbeIndicesHtoD(this, level); + cudaMemoryManager->cudaCopyProbeIndicesHtoD(this, level); uint arrOffset = 0; - cudaManager->cudaAllocProbeQuantitiesAndOffsets(this, level); + cudaMemoryManager->cudaAllocProbeQuantitiesAndOffsets(this, level); - for( int var=0; var<int(PostProcessingVariable::LAST); var++){ - if(this->quantities[var]) + for( int var=0; var<int(Statistic::LAST); var++) { - - probeParams[level]->quantitiesH[var] = true; - probeParams[level]->arrayOffsetsH[var] = arrOffset; - arrOffset += uint(getPostProcessingVariableNames(static_cast<PostProcessingVariable>(var)).size()); - }} + if(this->quantities[var]) + { + probeParams[level]->quantitiesH[var] = true; + probeParams[level]->arrayOffsetsH[var] = arrOffset; + arrOffset += uint( this->getPostProcessingVariables(static_cast<Statistic>(var)).size() ); + } + } - cudaManager->cudaCopyProbeQuantitiesAndOffsetsHtoD(this, level); + cudaMemoryManager->cudaCopyProbeQuantitiesAndOffsetsHtoD(this, level); probeParams[level]->nArrays = arrOffset; - cudaManager->cudaAllocProbeQuantityArray(this, level); + cudaMemoryManager->cudaAllocProbeQuantityArray(this, level); for(uint arr=0; arr<probeParams[level]->nArrays; arr++) { @@ -220,83 +274,102 @@ void Probe::addProbeStruct(CudaMemoryManager* cudaManager, std::vector<int>& pro probeParams[level]->quantitiesArrayH[arr*probeParams[level]->nPoints+point] = 0.0f; } } - cudaManager->cudaCopyProbeQuantityArrayHtoD(this, level); + if(this->hasDeviceQuantityArray) + cudaMemoryManager->cudaCopyProbeQuantityArrayHtoD(this, level); } - -void Probe::interact(Parameter* para, CudaMemoryManager* cudaManager, int level, uint t) +void Probe::interact(Parameter* para, CudaMemoryManager* cudaMemoryManager, int level, uint t) { + uint t_level = para->getTimeStep(level, t, false); - if(t>this->tStartAvg) - { - SPtr<ProbeStruct> probeStruct = this->getProbeStruct(level); - - this->calculateQuantities(probeStruct, para, level); - probeStruct->vals++; + //! if tAvg==1 the probe will be evaluated in every sub-timestep of each respective level + //! else, the probe will only be evaluated in each synchronous time step tAvg - if(max(int(t) - int(this->tStartOut), -1) % this->tOut == 0) - { - cudaManager->cudaCopyProbeQuantityArrayDtoH(this, level); + uint tAvg_level = this->tAvg==1? this->tAvg: this->tAvg*pow(2,level); - this->write(para, level, t); - } + if(max(int(t_level) - int(this->tStartAvg*pow(2,level)), -1) % tAvg_level==0) + { + SPtr<ProbeStruct> probeStruct = this->getProbeStruct(level); + this->calculateQuantities(probeStruct, para, t_level, level); + if(t_level>=(this->tStartTmpAveraging*pow(2,level))) probeStruct->vals++; + } + //! output only in synchronous timesteps + if(max(int(t_level) - int(this->tStartOut*pow(2,level)), -1) % int(this->tOut*pow(2,level)) == 0) + { + if(this->hasDeviceQuantityArray) + cudaMemoryManager->cudaCopyProbeQuantityArrayDtoH(this, level); + this->write(para, level, t); } } -void Probe::free(Parameter* para, CudaMemoryManager* cudaManager) +void Probe::free(Parameter* para, CudaMemoryManager* cudaMemoryManager) { for(int level=0; level<=para->getMaxLevel(); level++) - { - cudaManager->cudaFreeProbeDistances(this, level); - cudaManager->cudaFreeProbeIndices(this, level); - cudaManager->cudaFreeProbeQuantityArray(this, level); - cudaManager->cudaFreeProbeQuantitiesAndOffsets(this, level); + { + if(this->probeParams[level]->hasDistances) + cudaMemoryManager->cudaFreeProbeDistances(this, level); + cudaMemoryManager->cudaFreeProbeIndices(this, level); + cudaMemoryManager->cudaFreeProbeQuantityArray(this, level); + cudaMemoryManager->cudaFreeProbeQuantitiesAndOffsets(this, level); } } - - -void Probe::addPostProcessingVariable(PostProcessingVariable variable) +void Probe::addStatistic(Statistic variable) { + if (!this->isAvailableStatistic(variable)) throw std::runtime_error("Probe::addStatistic(): Statistic not available for this probe type!"); + this->quantities[int(variable)] = true; switch(variable) { - case PostProcessingVariable::Variances: - this->addPostProcessingVariable(PostProcessingVariable::Means); break; + case Statistic::Variances: + this->addStatistic(Statistic::Means); break; + default: break; } } +void Probe::addAllAvailableStatistics() +{ + for( int var=0; var < int(Statistic::LAST); var++) + { + if(this->isAvailableStatistic(static_cast<Statistic>(var))) + this->addStatistic(static_cast<Statistic>(var)); + } +} + void Probe::write(Parameter* para, int level, int t) { + int t_write = this->fileNameLU ? t: t/this->tOut; + const uint numberOfParts = this->getProbeStruct(level)->nPoints / para->getlimitOfNodesForVTK() + 1; std::vector<std::string> fnames; for (uint i = 1; i <= numberOfParts; i++) { std::string fname = this->probeName + "_bin_lev_" + StringUtil::toString<int>(level) - + "_ID_" + StringUtil::toString<int>(para->getMyID()) - + "_Part_" + StringUtil::toString<int>(i) - + "_t_" + StringUtil::toString<int>(t) - + ".vtk"; + + "_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + + "_Part_" + StringUtil::toString<int>(i); + if(!this->outputTimeSeries) fname += "_t_" + StringUtil::toString<int>(t_write); + fname += ".vtk"; fnames.push_back(fname); this->fileNamesForCollectionFile.push_back(fname); } this->writeGridFiles(para, level, fnames, t); - if(level == 0) this->writeCollectionFile(para, t); + if(level == 0 && !this->outputTimeSeries) this->writeCollectionFile(para, t); } void Probe::writeCollectionFile(Parameter* para, int t) { - std::string filename = this->probeName + "_bin_ID_" + StringUtil::toString<int>(para->getMyID()) - + "_t_" + StringUtil::toString<int>(t) + int t_write = this->fileNameLU ? t: t/this->tOut; + std::string filename = this->probeName + "_bin_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + + "_t_" + StringUtil::toString<int>(t_write) + ".vtk"; std::ofstream file; - file.open( filename + ".pvtu" ); + file.open(this->outputPath + "/" + filename + ".pvtu" ); ////////////////////////////////////////////////////////////////////////// @@ -305,7 +378,7 @@ void Probe::writeCollectionFile(Parameter* para, int t) file << " <PPointData>" << std::endl; - for(std::string varName: this->getVarNames()) + for(std::string varName: this->getVarNames()) //TODO { file << " <DataArray type=\"Float64\" Name=\""<< varName << "\" /> " << std::endl; } @@ -346,7 +419,8 @@ void Probe::writeGridFiles(Parameter* para, int level, std::vector<std::string>& for (uint part = 0; part < fnames.size(); part++) { startpos = part * para->getlimitOfNodesForVTK(); - sizeOfNodes = min(para->getlimitOfNodesForVTK(), probeStruct->nPoints - startpos); + uint nDataPoints = this->outputTimeSeries? this->tProbe: probeStruct->nPoints; + sizeOfNodes = min(para->getlimitOfNodesForVTK(), nDataPoints - startpos); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// @@ -361,48 +435,44 @@ void Probe::writeGridFiles(Parameter* para, int level, std::vector<std::string>& for( auto it=nodedata.begin(); it!=nodedata.end(); it++) it->resize(sizeOfNodes); - for( int var=0; var < int(PostProcessingVariable::LAST); var++){ - if(this->quantities[var]) - { - PostProcessingVariable quantity = static_cast<PostProcessingVariable>(var); - real coeff; - uint n_arrs = uint(getPostProcessingVariableNames(quantity).size()); - - switch(quantity) + for( int var=0; var < int(Statistic::LAST); var++){ + if(this->quantities[var]) { - case PostProcessingVariable::Means: - coeff = para->getVelocityRatio(); - break; - case PostProcessingVariable::Variances: - coeff = pow(para->getVelocityRatio(),2); - break; - default: break; - } + Statistic statistic = static_cast<Statistic>(var); + real coeff; - uint arrOff = probeStruct->arrayOffsetsH[var]; - uint arrLen = probeStruct->nPoints; + std::vector<PostProcessingVariable> postProcessingVariables = this->getPostProcessingVariables(statistic); + uint n_arrs = uint(postProcessingVariables.size()); - for(uint arr=0; arr<n_arrs; arr++) - { - for (uint pos = startpos; pos < endpos; pos++) + uint arrOff = probeStruct->arrayOffsetsH[var]; + uint arrLen = probeStruct->nPoints; + + for(uint arr=0; arr<n_arrs; arr++) { - nodedata[arrOff+arr][pos-startpos] = double(probeStruct->quantitiesArrayH[(arrOff+arr)*arrLen+pos]*coeff); + coeff = postProcessingVariables[arr].conversionFactor(level); + + for (uint pos = startpos; pos < endpos; pos++) + { + nodedata[arrOff+arr][pos-startpos] = double(probeStruct->quantitiesArrayH[(arrOff+arr)*arrLen+pos]*coeff); + } } } - }} - WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(fnames[part], nodes, nodedatanames, nodedata); + } + WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(this->outputPath + "/" + fnames[part], nodes, nodedatanames, nodedata); } } std::vector<std::string> Probe::getVarNames() { std::vector<std::string> varNames; - for( int var=0; var < int(PostProcessingVariable::LAST); var++){ - if(this->quantities[var]) + for( int statistic=0; statistic < int(Statistic::LAST); statistic++) { - std::vector<std::string> names = getPostProcessingVariableNames(static_cast<PostProcessingVariable>(var)); - varNames.insert(varNames.end(), names.begin(), names.end()); - }} + if(this->quantities[statistic]) + { + std::vector<PostProcessingVariable> postProcessingVariables = this->getPostProcessingVariables(static_cast<Statistic>(statistic)); + for(int i = 0; i<postProcessingVariables.size(); i++) + varNames.push_back(postProcessingVariables[i].name); + } + } return varNames; -} - +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h index 8223411ffc45fdac8b3ba038f97eeb899dd3d94d..9cb0bd43e27fb7a28cae9c363ce245fbd9cc5677 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h @@ -1,40 +1,130 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file Probe.h +//! \author Henry Korb, Henrik Asmuth +//! \date 13/05/2022 +//! \brief Base class for probes called in UpdateGrid27 +//! +//! Any probe should be initiated in the app and added via para->addProbe( someProbe ) +//! Note, that all probes generally require that macroscopic variables have been updated in the +//! time step they are called in. Most collision kernels (atm, all except TurbulentViscosityCumulantK17CompChim ) +//! don't do this and would require an explicit call of calcMacroscopicQuantities. It does seem quite +//! inexpensive though to simply save vx, vy, etc., directly in the collider. +//! +//! \todo might have to adapt conversionFactors when using grid refinement +//======================================================================================= + #ifndef Probe_H #define Probe_H +#include <iostream> + #include <cuda.h> #include "PreCollisionInteractor/PreCollisionInteractor.h" #include "PointerDefinitions.h" -enum class PostProcessingVariable{ - // HowTo add new PostProcessingVariable: Add enum here, LAST has to stay last - // In interpQuantities add computation of quantity in switch statement - // In writeGridFiles add lb->rw conversion factor - // In getPostProcessingVariableNames add names - // If new quantity depends on other quantities i.e. mean, catch in addPostProcessingVariable +//======================================================================================= +//! \note How to add new Statistics +//! Generally, the Statistic enum refers to the type of statistic to be calculated. +//! It then depends on the derived probe class, which of these statistics are available. +//! Some type of statistics are only suitable for a certain probe class, others might +//! simply not have been implemented, yet. +//! For the same reasons it is also probe-specific, for which quantities (e.g. velocities, rho, etc.) these statistics are computed. +//! The specific quantity (e.g., mean of vx, or variance of rho) is defined as PostProcessingVariable in getPostProcessingVariables of each respective probe. +//! PostProcessingVariable also holds the name and conversionFactor of the quantity that is required when writing the data to file +//! +//! To add new Statistics: +//! 1. Add enum here, LAST has to stay last +//! 2. For PointProbe and PlaneProbe: add the computation of the statistic in switch statement in calculatePointwiseQuantities. +//! 3. For PlanarAverageProbe and WallModelProbe: add the computation directly in calculateQuantities. +//! 4. In getPostProcessingVariables add the static in the switch statement and add the corresponding PostProcessingVariables +//! 5. Add Statistic to isAvailableStatistic of the respective probe +//! +//! When adding new quantities to existing statistics (e.g., add rho to PlanarAverageProbe which currently only computes stats of velocity) only do steps 2 to 4 +//! + +enum class Statistic{ + // Variables currently available in Point and Plane probe (all temporal pointwise statistics) + Instantaneous, Means, Variances, + + // Variables available in PlanarAverage probe and (partially) in WallModelProbe + // Spatial statistics are typically computed across fixed spatial subdomains, e.g. a plane of constant height + // Spatio-temporal statistics additionally average the spatial stats in time + SpatialMeans, + SpatioTemporalMeans, + SpatialCovariances, + SpatioTemporalCovariances, + SpatialSkewness, + SpatioTemporalSkewness, + SpatialFlatness, + SpatioTemporalFlatness, LAST, }; +typedef struct PostProcessingVariable{ + std::string name; + std::function<real(int)> conversionFactor; + PostProcessingVariable( std::string _name, + std::function<real(int)> _conversionFactor): + name(_name), conversionFactor(_conversionFactor){}; +} PostProcessingVariable; + struct ProbeStruct{ - uint nPoints, nArrays, vals; + uint nPoints, nIndices, nArrays, vals; uint *pointIndicesH, *pointIndicesD; real *pointCoordsX, *pointCoordsY, *pointCoordsZ; + bool hasDistances=false; real *distXH, *distYH, *distZH, *distXD, *distYD, *distZD; real *quantitiesArrayH, *quantitiesArrayD; bool *quantitiesH, *quantitiesD; uint *arrayOffsetsH, *arrayOffsetsD; + bool isEvenTAvg = true; }; -__global__ void interpQuantities( uint* pointIndices, +__global__ void calcQuantitiesKernel( uint* pointIndices, + uint nPoints, uint n, + real* vx, real* vy, real* vz, real* rho, + uint* neighborX, uint* neighborY, uint* neighborZ, + bool* quantities, + uint* quantityArrayOffsets, real* quantityArray + ); + +__global__ void interpAndCalcQuantitiesKernel( uint* pointIndices, uint nPoints, uint n, real* distX, real* distY, real* distZ, real* vx, real* vy, real* vz, real* rho, uint* neighborX, uint* neighborY, uint* neighborZ, bool* quantities, - uint* quantityArrayOffsets, real* quantityArray, - bool interpolate + uint* quantityArrayOffsets, real* quantityArray ); @@ -43,35 +133,60 @@ class Probe : public PreCollisionInteractor public: Probe( const std::string _probeName, + const std::string _outputPath, uint _tStartAvg, + uint _tStartTmpAvg, + uint _tAvg, uint _tStartOut, - uint _tOut + uint _tOut, + bool _hasDeviceQuantityArray, + bool _outputTimeSeries ): probeName(_probeName), + outputPath(_outputPath), tStartAvg(_tStartAvg), + tStartTmpAveraging(_tStartTmpAvg), + tAvg(_tAvg), tStartOut(_tStartOut), tOut(_tOut), + hasDeviceQuantityArray(_hasDeviceQuantityArray), + outputTimeSeries(_outputTimeSeries), PreCollisionInteractor() { - assert("Output starts before averaging!" && tStartOut>=tStartAvg); + if (_tStartOut<_tStartAvg) throw std::runtime_error("Probe: tStartOut must be larger than tStartAvg!"); + if (_tStartTmpAvg<_tStartAvg) throw std::runtime_error("Probe: tStartTmpAvg must be larger than tStartAvg!"); } - void init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaManager); - void interact(Parameter* para, CudaMemoryManager* cudaManager, int level, uint t); - void free(Parameter* para, CudaMemoryManager* cudaManager); + + void init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaMemoryManager) override; + void interact(Parameter* para, CudaMemoryManager* cudaMemoryManager, int level, uint t) override; + void free(Parameter* para, CudaMemoryManager* cudaMemoryManager) override; SPtr<ProbeStruct> getProbeStruct(int level){ return this->probeParams[level]; } - void addPostProcessingVariable(PostProcessingVariable _variable); + void addStatistic(Statistic _variable); + void addAllAvailableStatistics(); + + bool getHasDeviceQuantityArray(); + uint getTStartTmpAveraging(){return this->tStartTmpAveraging;} + + void setFileNameToNOut(){this->fileNameLU = false;} + void setTStartTmpAveraging(uint _tStartTmpAveraging){this->tStartTmpAveraging = _tStartTmpAveraging;} + + real getNondimensionalConversionFactor(int level); private: + virtual bool isAvailableStatistic(Statistic _variable) = 0; + + virtual std::vector<PostProcessingVariable> getPostProcessingVariables(Statistic variable) = 0; + virtual void findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level, std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level, std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, int level) = 0; - void addProbeStruct(CudaMemoryManager* cudaManager, std::vector<int>& probeIndices, + void addProbeStruct(CudaMemoryManager* cudaMemoryManager, std::vector<int>& probeIndices, std::vector<real>& distX, std::vector<real>& distY, std::vector<real>& distZ, std::vector<real>& pointCoordsX, std::vector<real>& pointCoordsY, std::vector<real>& pointCoordsZ, int level); - virtual void calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, int level) = 0; + virtual void calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) = 0; void write(Parameter* para, int level, int t); void writeCollectionFile(Parameter* para, int t); @@ -80,15 +195,33 @@ private: private: const std::string probeName; + const std::string outputPath; std::vector<SPtr<ProbeStruct>> probeParams; - bool quantities[int(PostProcessingVariable::LAST)]; + bool quantities[int(Statistic::LAST)] = {}; + bool hasDeviceQuantityArray; //!> flag initiating memCopy in Point and PlaneProbe. Other probes are only based on thrust reduce functions and therefore dont need explict memCopy in interact() + bool outputTimeSeries; //!> flag initiating overwrite of output vtk files, skipping collection files and limiting the length of the written data to the current time step (currently only used for WallModelProbe) std::vector<std::string> fileNamesForCollectionFile; std::vector<std::string> varNames; + bool fileNameLU = true; //!> if true, written file name contains time step in LU, else is the number of the written probe files + +protected: uint tStartAvg; + uint tStartTmpAveraging; //!> only non-zero in PlanarAverageProbe and WallModelProbe to switch on Spatio-temporal averaging (while only doing spatial averaging for t<tStartTmpAveraging) + uint tAvg; //! for tAvg==1 the probe will be evaluated in every sub-timestep of each respective level, else, the probe will only be evaluated in each synchronous time step uint tStartOut; uint tOut; + + uint tProbe = 0; //!> counter for number of probe evaluations. Only used when outputting timeseries + + + std::function<real(int)> velocityRatio; + std::function<real(int)> densityRatio; + std::function<real(int)> forceRatio; + std::function<real(int)> stressRatio; + std::function<real(int)> viscosityRatio; + std::function<real(int)> nondimensional; }; #endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.cu new file mode 100644 index 0000000000000000000000000000000000000000..81da15595baae55aa562bc77e24442a9258d992f --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.cu @@ -0,0 +1,300 @@ +#include "Probe.h" +#include "WallModelProbe.h" + +#include <cuda/CudaGrid.h> + +#include <cuda.h> +#include <cuda_runtime.h> +#include <helper_cuda.h> + +#include <thrust/device_vector.h> +#include <thrust/reduce.h> +#include <thrust/device_ptr.h> +#include <thrust/inner_product.h> + +#include "Parameter/Parameter.h" +#include "DataStructureInitializer/GridProvider.h" +#include "GPU/CudaMemoryManager.h" + + +/////////////////////////////////////////////////////////////////////////////////// +/// Functors for thrust reductions +/////////////////////////////////////////////////////////////////////////////////// + +template<typename T> +struct pow2 : public thrust::unary_function<T,T> +{ + __host__ __device__ T operator()(const T &x) const + { + return x * x; + } +}; + +template<typename T> +struct pow3 : public thrust::unary_function<T,T> +{ + __host__ __device__ T operator()(const T &x) const + { + return x * x * x; + } +}; + +template<typename T> +struct pow4 : public thrust::unary_function<T,T> +{ + __host__ __device__ T operator()(const T &x) const + { + return x * x * x * x; + } +}; + +struct nth_moment +{ + const float mean; + const int n; + + nth_moment(float _mean, int _n) : mean(_mean), n(_n) {} + + __host__ __device__ + float operator()(const float& x) const { + + real fluctuation = x-mean; + real moment = fluctuation; + for(int i = 1; i<n; i++) moment *= fluctuation; + + return moment; + } +}; + + +/////////////////////////////////////////////////////////////////////////////////// +bool WallModelProbe::isAvailableStatistic(Statistic _variable) +{ + bool isAvailable; + + switch (_variable) + { + case Statistic::Instantaneous: + case Statistic::Means: + case Statistic::Variances: + isAvailable = false; + break; + case Statistic::SpatialMeans: + case Statistic::SpatioTemporalMeans: + isAvailable = true; + break; + case Statistic::SpatialCovariances: + case Statistic::SpatioTemporalCovariances: + case Statistic::SpatialSkewness: + case Statistic::SpatioTemporalSkewness: + case Statistic::SpatialFlatness: + case Statistic::SpatioTemporalFlatness: + isAvailable = false; + break; + default: + isAvailable = false; + } + return isAvailable; +} + +/////////////////////////////////////////////////////////////////////////////////// + +std::vector<PostProcessingVariable> WallModelProbe::getPostProcessingVariables(Statistic statistic) +{ + std::vector<PostProcessingVariable> postProcessingVariables; + switch (statistic) + { + case Statistic::SpatialMeans: + postProcessingVariables.push_back( PostProcessingVariable("vx_el_spatMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy_el_spatMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz_el_spatMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vx1_spatMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy1_spatMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz1_spatMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("u_star_spatMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("Fx_spatMean", this->outputStress? this->stressRatio: this->forceRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("Fy_spatMean", this->outputStress? this->stressRatio: this->forceRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("Fz_spatMean", this->outputStress? this->stressRatio: this->forceRatio) ); + if(this->evaluatePressureGradient) + { + postProcessingVariables.push_back( PostProcessingVariable("dpdx_spatMean", this->forceRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("dpdy_spatMean", this->forceRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("dpdz_spatMean", this->forceRatio) ); + } + break; + case Statistic::SpatioTemporalMeans: + postProcessingVariables.push_back( PostProcessingVariable("vx_el_spatTmpMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy_el_spatTmpMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz_el_spatTmpMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vx1_spatTmpMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vy1_spatTmpMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("vz1_spatTmpMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("u_star_spatTmpMean", this->velocityRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("Fx_spatTmpMean", this->outputStress? this->stressRatio: this->forceRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("Fy_spatTmpMean", this->outputStress? this->stressRatio: this->forceRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("Fz_spatTmpMean", this->outputStress? this->stressRatio: this->forceRatio) ); + if(this->evaluatePressureGradient) + { + postProcessingVariables.push_back( PostProcessingVariable("dpdx_spatTmpMean", this->forceRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("dpdy_spatTmpMean", this->forceRatio) ); + postProcessingVariables.push_back( PostProcessingVariable("dpdz_spatTmpMean", this->forceRatio) ); + } + break; + + default: + throw std::runtime_error("WallModelProbe::getPostProcessingVariables: Statistic unavailable!"); + break; + } + return postProcessingVariables; +} + +/////////////////////////////////////////////////////////////////////////////////// + +void WallModelProbe::findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level, + std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level, + std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, + int level) +{ + if ( !para->getHasWallModelMonitor()) throw std::runtime_error("WallModelProbe::findPoints(): !para->getHasWallModelMonitor() !"); + + real dt = para->getTimeRatio(); + uint nt = uint((para->getTimestepEnd()-this->tStartAvg)/this->tAvg); + + for(uint t=0; t<nt; t++) + { + pointCoordsX_level.push_back(dt*(t*this->tAvg)+this->tStartAvg); // x coord will serve as time in this probe + pointCoordsY_level.push_back(0); + pointCoordsZ_level.push_back(0); + } + + if(this->evaluatePressureGradient) + { + if (!para->getIsBodyForce()) throw std::runtime_error("WallModelProbe::findPoints(): bodyforce not allocated!"); + // Find all fluid nodes + for(uint j=1; j<para->getParH(level)->numberOfNodes; j++ ) + { + if( para->getParH(level)->typeOfGridNode[j] == GEO_FLUID) + { + probeIndices_level.push_back(j); + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////////// + +void WallModelProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) +{ + bool doTmpAveraging = (t>this->getTStartTmpAveraging()); + real N = para->getParD(level)->stressBC.numberOfBCnodes; + if(N<1) return; //Skipping levels without StressBC + real n = (real)probeStruct->vals; + int nPoints = probeStruct->nPoints; + + // Pointer casts to use device arrays in thrust reductions + thrust::device_ptr<real> u_el_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vx); + thrust::device_ptr<real> v_el_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vy); + thrust::device_ptr<real> w_el_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vz); + thrust::device_ptr<real> u1_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vx1); + thrust::device_ptr<real> v1_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vy1); + thrust::device_ptr<real> w1_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vz1); + thrust::device_ptr<real> u_star_thrust = thrust::device_pointer_cast(para->getParD(level)->wallModel.u_star); + thrust::device_ptr<real> Fx_thrust = thrust::device_pointer_cast(para->getParD(level)->wallModel.Fx); + thrust::device_ptr<real> Fy_thrust = thrust::device_pointer_cast(para->getParD(level)->wallModel.Fy); + thrust::device_ptr<real> Fz_thrust = thrust::device_pointer_cast(para->getParD(level)->wallModel.Fz); + thrust::device_ptr<real> dpdx_thrust = thrust::device_pointer_cast(para->getParD(level)->forceX_SP); + thrust::device_ptr<real> dpdy_thrust = thrust::device_pointer_cast(para->getParD(level)->forceY_SP); + thrust::device_ptr<real> dpdz_thrust = thrust::device_pointer_cast(para->getParD(level)->forceZ_SP); + + thrust::device_ptr<uint> indices_thrust = thrust::device_pointer_cast(probeStruct->pointIndicesD); + typedef thrust::device_vector<real>::iterator valIterator; + typedef thrust::device_vector<uint>::iterator indIterator; + thrust::permutation_iterator<valIterator, indIterator> dpdx_iter_begin(dpdx_thrust, indices_thrust); + thrust::permutation_iterator<valIterator, indIterator> dpdx_iter_end (dpdx_thrust, indices_thrust+probeStruct->nIndices); + thrust::permutation_iterator<valIterator, indIterator> dpdy_iter_begin(dpdy_thrust, indices_thrust); + thrust::permutation_iterator<valIterator, indIterator> dpdy_iter_end (dpdy_thrust, indices_thrust+probeStruct->nIndices); + thrust::permutation_iterator<valIterator, indIterator> dpdz_iter_begin(dpdz_thrust, indices_thrust); + thrust::permutation_iterator<valIterator, indIterator> dpdz_iter_end (dpdz_thrust, indices_thrust+probeStruct->nIndices); + + if(probeStruct->quantitiesH[int(Statistic::SpatialMeans)]) + { + // Compute the instantaneous spatial means of the velocity moments + real spatMean_u_el = thrust::reduce(u_el_thrust, u_el_thrust+N)/N; + real spatMean_v_el = thrust::reduce(v_el_thrust, v_el_thrust+N)/N; + real spatMean_w_el = thrust::reduce(w_el_thrust, w_el_thrust+N)/N; + real spatMean_u1 = thrust::reduce(u1_thrust, u1_thrust+N)/N; + real spatMean_v1 = thrust::reduce(v1_thrust, v1_thrust+N)/N; + real spatMean_w1 = thrust::reduce(w1_thrust, w1_thrust+N)/N; + real spatMean_u_star = thrust::reduce(u_star_thrust, u_star_thrust+N)/N; + real spatMean_Fx = thrust::reduce(Fx_thrust, Fx_thrust+N)/N; + real spatMean_Fy = thrust::reduce(Fy_thrust, Fy_thrust+N)/N; + real spatMean_Fz = thrust::reduce(Fz_thrust, Fz_thrust+N)/N; + + uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatialMeans)]; + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+tProbe] = spatMean_u_el; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+tProbe] = spatMean_v_el; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+tProbe] = spatMean_w_el; + probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+tProbe] = spatMean_u1; + probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+tProbe] = spatMean_v1; + probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+tProbe] = spatMean_w1; + probeStruct->quantitiesArrayH[(arrOff+6)*nPoints+tProbe] = spatMean_u_star; + probeStruct->quantitiesArrayH[(arrOff+7)*nPoints+tProbe] = spatMean_Fx; + probeStruct->quantitiesArrayH[(arrOff+8)*nPoints+tProbe] = spatMean_Fy; + probeStruct->quantitiesArrayH[(arrOff+9)*nPoints+tProbe] = spatMean_Fz; + + real spatMean_dpdx; + real spatMean_dpdy; + real spatMean_dpdz; + if(this->evaluatePressureGradient) + { + real N_fluid = (real)probeStruct->nIndices; + spatMean_dpdx = thrust::reduce(dpdx_iter_begin, dpdx_iter_end)/N_fluid; + spatMean_dpdy = thrust::reduce(dpdy_iter_begin, dpdy_iter_end)/N_fluid; + spatMean_dpdz = thrust::reduce(dpdz_iter_begin, dpdz_iter_end)/N_fluid; + probeStruct->quantitiesArrayH[(arrOff+10)*nPoints+tProbe] = spatMean_dpdx; + probeStruct->quantitiesArrayH[(arrOff+11)*nPoints+tProbe] = spatMean_dpdy; + probeStruct->quantitiesArrayH[(arrOff+12)*nPoints+tProbe] = spatMean_dpdz; + } + + if(probeStruct->quantitiesH[int(Statistic::SpatioTemporalMeans)] && doTmpAveraging) + { + uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatioTemporalMeans)]; + real spatMean_u_el_old = probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+tProbe-1]; + real spatMean_v_el_old = probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+tProbe-1]; + real spatMean_w_el_old = probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+tProbe-1]; + real spatMean_u1_old = probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+tProbe-1]; + real spatMean_v1_old = probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+tProbe-1]; + real spatMean_w1_old = probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+tProbe-1]; + real spatMean_u_star_old = probeStruct->quantitiesArrayH[(arrOff+6)*nPoints+tProbe-1]; + real spatMean_Fx_old = probeStruct->quantitiesArrayH[(arrOff+7)*nPoints+tProbe-1]; + real spatMean_Fy_old = probeStruct->quantitiesArrayH[(arrOff+8)*nPoints+tProbe-1]; + real spatMean_Fz_old = probeStruct->quantitiesArrayH[(arrOff+9)*nPoints+tProbe-1]; + + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+tProbe] = spatMean_u_el_old + (spatMean_u_el-spatMean_u_el_old)/n; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+tProbe] = spatMean_v_el_old + (spatMean_v_el-spatMean_v_el_old)/n; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+tProbe] = spatMean_w_el_old + (spatMean_w_el-spatMean_w_el_old)/n; + probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+tProbe] = spatMean_u1_old + (spatMean_u1-spatMean_u1_old)/n; + probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+tProbe] = spatMean_v1_old + (spatMean_v1-spatMean_v1_old)/n; + probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+tProbe] = spatMean_w1_old + (spatMean_w1-spatMean_w1_old)/n; + probeStruct->quantitiesArrayH[(arrOff+6)*nPoints+tProbe] = spatMean_u_star_old +(spatMean_u_star-spatMean_u_star_old)/n; + probeStruct->quantitiesArrayH[(arrOff+7)*nPoints+tProbe] = spatMean_Fx_old + (spatMean_Fx-spatMean_Fx_old)/n; + probeStruct->quantitiesArrayH[(arrOff+8)*nPoints+tProbe] = spatMean_Fy_old + (spatMean_Fy-spatMean_Fy_old)/n; + probeStruct->quantitiesArrayH[(arrOff+9)*nPoints+tProbe] = spatMean_Fz_old + (spatMean_Fz-spatMean_Fz_old)/n; + + if(this->evaluatePressureGradient) + { + real spatMean_dpdx_old = probeStruct->quantitiesArrayH[(arrOff+10)*nPoints+tProbe-1]; + real spatMean_dpdy_old = probeStruct->quantitiesArrayH[(arrOff+11)*nPoints+tProbe-1]; + real spatMean_dpdz_old = probeStruct->quantitiesArrayH[(arrOff+12)*nPoints+tProbe-1]; + probeStruct->quantitiesArrayH[(arrOff+10)*nPoints+tProbe] = spatMean_dpdx_old + (spatMean_dpdx-spatMean_dpdx_old)/n; + probeStruct->quantitiesArrayH[(arrOff+11)*nPoints+tProbe] = spatMean_dpdy_old + (spatMean_dpdy-spatMean_dpdy_old)/n; + probeStruct->quantitiesArrayH[(arrOff+12)*nPoints+tProbe] = spatMean_dpdz_old + (spatMean_dpdz-spatMean_dpdz_old)/n; + } + } + } + + + this->tProbe += 1; + getLastCudaError("WallModelProbe::calculateQuantities execution failed"); +} + diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.h new file mode 100644 index 0000000000000000000000000000000000000000..d6464c5ca2aa60310cc6bb7ca0a210bc12e755ff --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.h @@ -0,0 +1,87 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file WallModelProbe.h +//! \author Henrik Asmuth +//! \date 13/05/2022 +//! \brief Probe computing statistics of all relevant wall model quantities used in the StressBC kernels +//! +//! Computes spatial statistics for all grid points of the StressBC +//! The spatial statistics can additionally be averaged in time. +//! +//======================================================================================= + +#ifndef WallModelProbe_H +#define WallModelProbe_H + +#include "Probe.h" + +/////////////////////////////////////////////////////////////////////////////////// + +class WallModelProbe : public Probe +{ +public: + WallModelProbe( + const std::string _probeName, + const std::string _outputPath, + uint _tStartAvg, + uint _tStartTmpAvg, + uint _tAvg, + uint _tStartOut, + uint _tOut + ): Probe(_probeName, + _outputPath, + _tStartAvg, + _tStartTmpAvg, + _tAvg, + _tStartOut, + _tOut, + false, + true){} + + + void setForceOutputToStress(bool _outputStress){ this->outputStress = _outputStress; } + void setEvaluatePressureGradient(bool _evalPressGrad){ this->evaluatePressureGradient = _evalPressGrad; } + +private: + bool isAvailableStatistic(Statistic _variable) override; + + std::vector<PostProcessingVariable> getPostProcessingVariables(Statistic variable) override; + + void findPoints(Parameter* para, GridProvider* gridProvider, std::vector<int>& probeIndices_level, + std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level, + std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, + int level) override; + void calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) override; + +private: + bool outputStress = false; //!> if true, output wall force is converted to a stress + bool evaluatePressureGradient = false; //!> if true, mean global pressure gradient will also be evaluated +}; + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.cpp b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.cpp index 7bddc1e471b7615e0b83fe37d6d81edf7dfd0c52..d587419e76229b1be0d9b75b88bd88d79b48de54 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.cpp +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.cpp @@ -10,13 +10,6 @@ #include "PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7.h" #include "PreProcessor/PreProcessorStrategy/InitSP27/InitSP27.h" -std::shared_ptr<PreProcessorFactoryImp> PreProcessorFactoryImp::getInstance() -{ - static std::shared_ptr<PreProcessorFactoryImp> uniqueInstance; - if (!uniqueInstance) - uniqueInstance = std::shared_ptr<PreProcessorFactoryImp>(new PreProcessorFactoryImp()); - return uniqueInstance; -} std::shared_ptr<PreProcessor> PreProcessorFactoryImp::makePreProcessor(std::vector<PreProcessorType> preProcessorTypes, std::shared_ptr<Parameter> para) { @@ -28,11 +21,6 @@ std::shared_ptr<PreProcessor> PreProcessorFactoryImp::makePreProcessor(std::vect return prePro; } -PreProcessorFactoryImp::PreProcessorFactoryImp() -{ - -} - std::shared_ptr<PreProcessorStrategy> PreProcessorFactoryImp::makePreProcessorStrategy(PreProcessorType preProcessorType, std::shared_ptr<Parameter> para) { switch (preProcessorType) diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h index 843dc934907b8c91a0af5185db058bbb4f5d4049..e61c8e442f0d90cc16fc4125402265787fc1ed38 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactoryImp.h @@ -8,12 +8,8 @@ class PreProcessorStrategy; class VIRTUALFLUIDS_GPU_EXPORT PreProcessorFactoryImp : public PreProcessorFactory { public: - static std::shared_ptr< PreProcessorFactoryImp> getInstance(); std::shared_ptr<PreProcessor> makePreProcessor(std::vector<PreProcessorType> preProcessorTypes, std::shared_ptr<Parameter> para); -private: - PreProcessorFactoryImp(); - std::shared_ptr<PreProcessorStrategy> makePreProcessorStrategy(PreProcessorType preProcessorTyp, std::shared_ptr<Parameter> para); }; diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorImp.cpp b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorImp.cpp index 17c5c406d768b53b5191cd8cf18466a21dad98aa..a303ee77b0eb90ff32014b3bd9d8b903f1250722 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorImp.cpp +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorImp.cpp @@ -16,11 +16,11 @@ void PreProcessorImp::addStrategy(std::shared_ptr<PreProcessorStrategy> strategy void PreProcessorImp::init(std::shared_ptr<Parameter> para, int level) { - para->getParD(level)->evenOrOdd = false; + para->getParD(level)->isEvenTimestep = false; for (std::size_t i = 0; i < strategies.size(); i++) strategies.at(i)->init(level); - para->getParD(level)->evenOrOdd = true; + para->getParD(level)->isEvenTimestep = true; for (std::size_t i = 0; i < strategies.size(); i++) strategies.at(i)->init(level); } diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27.cu index c10942897aa667b554e591eba402ee1f93097ab4..e43fb54a6b56b4d9a501269544cea000df31cdb7 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27.cu @@ -11,7 +11,7 @@ std::shared_ptr<PreProcessorStrategy> InitCompAD27::getNewInstance(std::shared_p void InitCompAD27::init(int level) { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -28,18 +28,18 @@ void InitCompAD27::init(int level) dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1); - LB_Init_Comp_AD_27 << < grid, threads >> >( para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->geoSP, + LB_Init_Comp_AD_27 << < grid, threads >> >( para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->typeOfGridNode, para->getParD(level)->Conc, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->d27.f[0], - para->getParD(level)->evenOrOdd); - getLastCudaError("LBInitThS27 execution failed"); + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->isEvenTimestep); + getLastCudaError("InitAD27 execution failed"); } bool InitCompAD27::checkParameter() diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27_Device.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27_Device.cu index dfe1ccd23d8da075fa627231f1548ba5370f115b..d40e60c764054f8ac6c1793ea3e3573ed04a84fc 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; -#include "math.h" +using namespace vf::lbm::dir; -extern "C" __global__ void LB_Init_Comp_AD_27(unsigned int* neighborX, + +__global__ void LB_Init_Comp_AD_27(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, @@ -39,63 +40,63 @@ extern "C" __global__ void LB_Init_Comp_AD_27(unsigned int* neighborX, Distributions27 D27; if (EvenOrOdd == true) { - D27.f[dirE] = &DD27[dirE *size_Mat]; - D27.f[dirW] = &DD27[dirW *size_Mat]; - D27.f[dirN] = &DD27[dirN *size_Mat]; - D27.f[dirS] = &DD27[dirS *size_Mat]; - D27.f[dirT] = &DD27[dirT *size_Mat]; - D27.f[dirB] = &DD27[dirB *size_Mat]; - D27.f[dirNE] = &DD27[dirNE *size_Mat]; - D27.f[dirSW] = &DD27[dirSW *size_Mat]; - D27.f[dirSE] = &DD27[dirSE *size_Mat]; - D27.f[dirNW] = &DD27[dirNW *size_Mat]; - D27.f[dirTE] = &DD27[dirTE *size_Mat]; - D27.f[dirBW] = &DD27[dirBW *size_Mat]; - D27.f[dirBE] = &DD27[dirBE *size_Mat]; - D27.f[dirTW] = &DD27[dirTW *size_Mat]; - D27.f[dirTN] = &DD27[dirTN *size_Mat]; - D27.f[dirBS] = &DD27[dirBS *size_Mat]; - D27.f[dirBN] = &DD27[dirBN *size_Mat]; - D27.f[dirTS] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW] = &DD27[dirBNW *size_Mat]; + D27.f[DIR_P00] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM]= &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM]= &DD27[DIR_MPM *size_Mat]; } else { - D27.f[dirW] = &DD27[dirE *size_Mat]; - D27.f[dirE] = &DD27[dirW *size_Mat]; - D27.f[dirS] = &DD27[dirN *size_Mat]; - D27.f[dirN] = &DD27[dirS *size_Mat]; - D27.f[dirB] = &DD27[dirT *size_Mat]; - D27.f[dirT] = &DD27[dirB *size_Mat]; - D27.f[dirSW] = &DD27[dirNE *size_Mat]; - D27.f[dirNE] = &DD27[dirSW *size_Mat]; - D27.f[dirNW] = &DD27[dirSE *size_Mat]; - D27.f[dirSE] = &DD27[dirNW *size_Mat]; - D27.f[dirBW] = &DD27[dirTE *size_Mat]; - D27.f[dirTE] = &DD27[dirBW *size_Mat]; - D27.f[dirTW] = &DD27[dirBE *size_Mat]; - D27.f[dirBE] = &DD27[dirTW *size_Mat]; - D27.f[dirBS] = &DD27[dirTN *size_Mat]; - D27.f[dirTN] = &DD27[dirBS *size_Mat]; - D27.f[dirTS] = &DD27[dirBN *size_Mat]; - D27.f[dirBN] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirBSW] = &DD27[dirTNE *size_Mat]; - D27.f[dirBNE] = &DD27[dirTSW *size_Mat]; - D27.f[dirBNW] = &DD27[dirTSE *size_Mat]; - D27.f[dirBSE] = &DD27[dirTNW *size_Mat]; - D27.f[dirTSW] = &DD27[dirBNE *size_Mat]; - D27.f[dirTNE] = &DD27[dirBSW *size_Mat]; - D27.f[dirTNW] = &DD27[dirBSE *size_Mat]; - D27.f[dirTSE] = &DD27[dirBNW *size_Mat]; + D27.f[DIR_M00] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_MMM] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PPM] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MPM]= &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_PMM]= &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MMP] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PPP] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MPP] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PMP] = &DD27[DIR_MPM *size_Mat]; } ////////////////////////////////////////////////////////////////////////// real ConcD = Conc[k]; @@ -166,33 +167,33 @@ extern "C" __global__ void LB_Init_Comp_AD_27(unsigned int* neighborX, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real cu_sq = c3o2*(vx1*vx1 + vx2*vx2 + vx3*vx3); - (D27.f[dirZERO])[kzero] = c8o27* ConcD*(c1o1 - cu_sq); - (D27.f[dirE])[ke] = c2o27* ConcD*(c1o1 + c3o1*(vx1)+c9o2*(vx1)*(vx1)-cu_sq); - (D27.f[dirW])[kw] = c2o27* ConcD*(c1o1 + c3o1*(-vx1) + c9o2*(-vx1)*(-vx1) - cu_sq); - (D27.f[dirN])[kn] = c2o27* ConcD*(c1o1 + c3o1*(vx2)+c9o2*(vx2)*(vx2)-cu_sq); - (D27.f[dirS])[ks] = c2o27* ConcD*(c1o1 + c3o1*(-vx2) + c9o2*(-vx2)*(-vx2) - cu_sq); - (D27.f[dirT])[kt] = c2o27* ConcD*(c1o1 + c3o1*(vx3)+c9o2*(vx3)*(vx3)-cu_sq); - (D27.f[dirB])[kb] = c2o27* ConcD*(c1o1 + c3o1*(-vx3) + c9o2*(-vx3)*(-vx3) - cu_sq); - (D27.f[dirNE])[kne] = c1o54* ConcD*(c1o1 + c3o1*(vx1 + vx2) + c9o2*(vx1 + vx2)*(vx1 + vx2) - cu_sq); - (D27.f[dirSW])[ksw] = c1o54* ConcD*(c1o1 + c3o1*(-vx1 - vx2) + c9o2*(-vx1 - vx2)*(-vx1 - vx2) - cu_sq); - (D27.f[dirSE])[kse] = c1o54* ConcD*(c1o1 + c3o1*(vx1 - vx2) + c9o2*(vx1 - vx2)*(vx1 - vx2) - cu_sq); - (D27.f[dirNW])[knw] = c1o54* ConcD*(c1o1 + c3o1*(-vx1 + vx2) + c9o2*(-vx1 + vx2)*(-vx1 + vx2) - cu_sq); - (D27.f[dirTE])[kte] = c1o54* ConcD*(c1o1 + c3o1*(vx1 + vx3) + c9o2*(vx1 + vx3)*(vx1 + vx3) - cu_sq); - (D27.f[dirBW])[kbw] = c1o54* ConcD*(c1o1 + c3o1*(-vx1 - vx3) + c9o2*(-vx1 - vx3)*(-vx1 - vx3) - cu_sq); - (D27.f[dirBE])[kbe] = c1o54* ConcD*(c1o1 + c3o1*(vx1 - vx3) + c9o2*(vx1 - vx3)*(vx1 - vx3) - cu_sq); - (D27.f[dirTW])[ktw] = c1o54* ConcD*(c1o1 + c3o1*(-vx1 + vx3) + c9o2*(-vx1 + vx3)*(-vx1 + vx3) - cu_sq); - (D27.f[dirTN])[ktn] = c1o54* ConcD*(c1o1 + c3o1*(vx2 + vx3) + c9o2*(vx2 + vx3)*(vx2 + vx3) - cu_sq); - (D27.f[dirBS])[kbs] = c1o54* ConcD*(c1o1 + c3o1*(-vx2 - vx3) + c9o2*(-vx2 - vx3)*(-vx2 - vx3) - cu_sq); - (D27.f[dirBN])[kbn] = c1o54* ConcD*(c1o1 + c3o1*(vx2 - vx3) + c9o2*(vx2 - vx3)*(vx2 - vx3) - cu_sq); - (D27.f[dirTS])[kts] = c1o54* ConcD*(c1o1 + c3o1*(-vx2 + vx3) + c9o2*(-vx2 + vx3)*(-vx2 + vx3) - cu_sq); - (D27.f[dirTNE])[ktne] = c1o216*ConcD*(c1o1 + c3o1*(vx1 + vx2 + vx3) + c9o2*(vx1 + vx2 + vx3)*(vx1 + vx2 + vx3) - cu_sq); - (D27.f[dirBSW])[kbsw] = c1o216*ConcD*(c1o1 + c3o1*(-vx1 - vx2 - vx3) + c9o2*(-vx1 - vx2 - vx3)*(-vx1 - vx2 - vx3) - cu_sq); - (D27.f[dirBNE])[kbne] = c1o216*ConcD*(c1o1 + c3o1*(vx1 + vx2 - vx3) + c9o2*(vx1 + vx2 - vx3)*(vx1 + vx2 - vx3) - cu_sq); - (D27.f[dirTSW])[ktsw] = c1o216*ConcD*(c1o1 + c3o1*(-vx1 - vx2 + vx3) + c9o2*(-vx1 - vx2 + vx3)*(-vx1 - vx2 + vx3) - cu_sq); - (D27.f[dirTSE])[ktse] = c1o216*ConcD*(c1o1 + c3o1*(vx1 - vx2 + vx3) + c9o2*(vx1 - vx2 + vx3)*(vx1 - vx2 + vx3) - cu_sq); - (D27.f[dirBNW])[kbnw] = c1o216*ConcD*(c1o1 + c3o1*(-vx1 + vx2 - vx3) + c9o2*(-vx1 + vx2 - vx3)*(-vx1 + vx2 - vx3) - cu_sq); - (D27.f[dirBSE])[kbse] = c1o216*ConcD*(c1o1 + c3o1*(vx1 - vx2 - vx3) + c9o2*(vx1 - vx2 - vx3)*(vx1 - vx2 - vx3) - cu_sq); - (D27.f[dirTNW])[ktnw] = c1o216*ConcD*(c1o1 + c3o1*(-vx1 + vx2 + vx3) + c9o2*(-vx1 + vx2 + vx3)*(-vx1 + vx2 + vx3) - cu_sq); + (D27.f[DIR_000])[kzero] = c8o27* ConcD*(c1o1 - cu_sq); + (D27.f[DIR_P00])[ke] = c2o27* ConcD*(c1o1 + c3o1*(vx1)+c9o2*(vx1)*(vx1)-cu_sq); + (D27.f[DIR_M00])[kw] = c2o27* ConcD*(c1o1 + c3o1*(-vx1) + c9o2*(-vx1)*(-vx1) - cu_sq); + (D27.f[DIR_0P0])[kn] = c2o27* ConcD*(c1o1 + c3o1*(vx2)+c9o2*(vx2)*(vx2)-cu_sq); + (D27.f[DIR_0M0])[ks] = c2o27* ConcD*(c1o1 + c3o1*(-vx2) + c9o2*(-vx2)*(-vx2) - cu_sq); + (D27.f[DIR_00P])[kt] = c2o27* ConcD*(c1o1 + c3o1*(vx3)+c9o2*(vx3)*(vx3)-cu_sq); + (D27.f[DIR_00M])[kb] = c2o27* ConcD*(c1o1 + c3o1*(-vx3) + c9o2*(-vx3)*(-vx3) - cu_sq); + (D27.f[DIR_PP0])[kne] = c1o54* ConcD*(c1o1 + c3o1*(vx1 + vx2) + c9o2*(vx1 + vx2)*(vx1 + vx2) - cu_sq); + (D27.f[DIR_MM0])[ksw] = c1o54* ConcD*(c1o1 + c3o1*(-vx1 - vx2) + c9o2*(-vx1 - vx2)*(-vx1 - vx2) - cu_sq); + (D27.f[DIR_PM0])[kse] = c1o54* ConcD*(c1o1 + c3o1*(vx1 - vx2) + c9o2*(vx1 - vx2)*(vx1 - vx2) - cu_sq); + (D27.f[DIR_MP0])[knw] = c1o54* ConcD*(c1o1 + c3o1*(-vx1 + vx2) + c9o2*(-vx1 + vx2)*(-vx1 + vx2) - cu_sq); + (D27.f[DIR_P0P])[kte] = c1o54* ConcD*(c1o1 + c3o1*(vx1 + vx3) + c9o2*(vx1 + vx3)*(vx1 + vx3) - cu_sq); + (D27.f[DIR_M0M])[kbw] = c1o54* ConcD*(c1o1 + c3o1*(-vx1 - vx3) + c9o2*(-vx1 - vx3)*(-vx1 - vx3) - cu_sq); + (D27.f[DIR_P0M])[kbe] = c1o54* ConcD*(c1o1 + c3o1*(vx1 - vx3) + c9o2*(vx1 - vx3)*(vx1 - vx3) - cu_sq); + (D27.f[DIR_M0P])[ktw] = c1o54* ConcD*(c1o1 + c3o1*(-vx1 + vx3) + c9o2*(-vx1 + vx3)*(-vx1 + vx3) - cu_sq); + (D27.f[DIR_0PP])[ktn] = c1o54* ConcD*(c1o1 + c3o1*(vx2 + vx3) + c9o2*(vx2 + vx3)*(vx2 + vx3) - cu_sq); + (D27.f[DIR_0MM])[kbs] = c1o54* ConcD*(c1o1 + c3o1*(-vx2 - vx3) + c9o2*(-vx2 - vx3)*(-vx2 - vx3) - cu_sq); + (D27.f[DIR_0PM])[kbn] = c1o54* ConcD*(c1o1 + c3o1*(vx2 - vx3) + c9o2*(vx2 - vx3)*(vx2 - vx3) - cu_sq); + (D27.f[DIR_0MP])[kts] = c1o54* ConcD*(c1o1 + c3o1*(-vx2 + vx3) + c9o2*(-vx2 + vx3)*(-vx2 + vx3) - cu_sq); + (D27.f[DIR_PPP])[ktne] = c1o216*ConcD*(c1o1 + c3o1*(vx1 + vx2 + vx3) + c9o2*(vx1 + vx2 + vx3)*(vx1 + vx2 + vx3) - cu_sq); + (D27.f[DIR_MMM])[kbsw] = c1o216*ConcD*(c1o1 + c3o1*(-vx1 - vx2 - vx3) + c9o2*(-vx1 - vx2 - vx3)*(-vx1 - vx2 - vx3) - cu_sq); + (D27.f[DIR_PPM])[kbne] = c1o216*ConcD*(c1o1 + c3o1*(vx1 + vx2 - vx3) + c9o2*(vx1 + vx2 - vx3)*(vx1 + vx2 - vx3) - cu_sq); + (D27.f[DIR_MMP])[ktsw] = c1o216*ConcD*(c1o1 + c3o1*(-vx1 - vx2 + vx3) + c9o2*(-vx1 - vx2 + vx3)*(-vx1 - vx2 + vx3) - cu_sq); + (D27.f[DIR_PMP])[ktse] = c1o216*ConcD*(c1o1 + c3o1*(vx1 - vx2 + vx3) + c9o2*(vx1 - vx2 + vx3)*(vx1 - vx2 + vx3) - cu_sq); + (D27.f[DIR_MPM])[kbnw] = c1o216*ConcD*(c1o1 + c3o1*(-vx1 + vx2 - vx3) + c9o2*(-vx1 + vx2 - vx3)*(-vx1 + vx2 - vx3) - cu_sq); + (D27.f[DIR_PMM])[kbse] = c1o216*ConcD*(c1o1 + c3o1*(vx1 - vx2 - vx3) + c9o2*(vx1 - vx2 - vx3)*(vx1 - vx2 - vx3) - cu_sq); + (D27.f[DIR_MPP])[ktnw] = c1o216*ConcD*(c1o1 + c3o1*(-vx1 + vx2 + vx3) + c9o2*(-vx1 + vx2 + vx3)*(-vx1 + vx2 + vx3) - cu_sq); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27_Device.cuh b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27_Device.cuh index 1a21f872f7adbde555e6d45a233c93eb7ff3e055..80c46f94549371811025e7f751acda65c858c0f4 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Init_Comp_AD_27(unsigned int* neighborX, +__global__ void LB_Init_Comp_AD_27(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7.cu index 009295d4df1e4fd5f152fd680988f80f3188aa8c..8a53dff5c14adef69aa012bdf1d870d62a9749b2 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7.cu @@ -11,7 +11,7 @@ std::shared_ptr<InitCompAD7> InitCompAD7::getNewInstance(std::shared_ptr<Paramet void InitCompAD7::init(int level) { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -28,18 +28,18 @@ void InitCompAD7::init(int level) dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1); - LB_Init_Comp_AD_7 << < grid, threads >> >( para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->geoSP, + LB_Init_Comp_AD_7 << < grid, threads >> >( para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->typeOfGridNode, para->getParD(level)->Conc, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->d7.f[0], - para->getParD(level)->evenOrOdd); - getLastCudaError("LBInitThS7 execution failed"); + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->distributionsAD7.f[0], + para->getParD(level)->isEvenTimestep); + getLastCudaError("InitAD7 execution failed"); } bool InitCompAD7::checkParameter() diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7_Device.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7_Device.cu index 6b4058f4bbbeacabb91f3cd5ba55f616565afb23..38cd57fd48e02e410e1ae557088e023ffeadfc4e 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7_Device.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Init_Comp_AD_7(unsigned int* neighborX, +__global__ void LB_Init_Comp_AD_7(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7_Device.cuh b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7_Device.cuh index 4eb8b9eeb70876f39bc8c0b58a8789fb239530a0..7dc17056bca6116aa6e98367a78e92320813b502 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Init_Comp_AD_7(unsigned int* neighborX, +__global__ void LB_Init_Comp_AD_7(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27.cu index 76f3adafa1fa2806d521862b05f715d495b44d26..23ec3e5293ec3a49bf632a720ab554d156dc9674 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27.cu @@ -11,7 +11,7 @@ std::shared_ptr<PreProcessorStrategy> InitCompSP27::getNewInstance(std::shared_p void InitCompSP27::init(int level) { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -30,34 +30,34 @@ void InitCompSP27::init(int level) if( ! para->getUseInitNeq() ) { - LB_Init_Comp_SP_27 <<< grid, threads >>> (para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->geoSP, - para->getParD(level)->rho_SP, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->evenOrOdd); + LB_Init_Comp_SP_27 <<< grid, threads >>> (para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->rho, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->distributions.f[0], + para->getParD(level)->isEvenTimestep); getLastCudaError("LBInitSP27 execution failed"); } else { - LB_Init_Comp_Neq_SP_27 <<< grid, threads >>> (para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->neighborWSB_SP, - para->getParD(level)->geoSP, - para->getParD(level)->rho_SP, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->d0SP.f[0], + LB_Init_Comp_Neq_SP_27 <<< grid, threads >>> (para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->neighborInverse, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->rho, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->distributions.f[0], para->getParD(level)->omega, - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); cudaDeviceSynchronize(); getLastCudaError("LBInitNeqSP27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27_Device.cu index a411f5be08df855df141f202acd01de2a3e99cae..dcc3b9a060a026accffdc6d24f338a6d23295d73 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27_Device.cu @@ -1,13 +1,14 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" #include <stdio.h> -extern "C" __global__ void LB_Init_Comp_SP_27(unsigned int* neighborX, +__global__ void LB_Init_Comp_SP_27(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, @@ -41,63 +42,63 @@ extern "C" __global__ void LB_Init_Comp_SP_27(unsigned int* neighborX, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; } ////////////////////////////////////////////////////////////////////////// real drho = rho[k];//0.0f;// @@ -137,33 +138,33 @@ extern "C" __global__ void LB_Init_Comp_SP_27(unsigned int* neighborX, ////////////////////////////////////////////////////////////////////////// real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D.f[dirZERO])[kzero] = c8o27* (drho-cu_sq*(c1o1+drho)); - (D.f[dirE ])[ke ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq)); - (D.f[dirW ])[kw ] = c2o27* (drho+ (c1o1+drho) * (c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - (D.f[dirN ])[kn ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq)); - (D.f[dirS ])[ks ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq)); - (D.f[dirT ])[kt ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq)); - (D.f[dirB ])[kb ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq)); - (D.f[dirNE ])[kne ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - (D.f[dirSW ])[ksw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - (D.f[dirSE ])[kse ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - (D.f[dirNW ])[knw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - (D.f[dirTE ])[kte ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - (D.f[dirBW ])[kbw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - (D.f[dirBE ])[kbe ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - (D.f[dirTW ])[ktw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - (D.f[dirTN ])[ktn ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - (D.f[dirBS ])[kbs ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - (D.f[dirBN ])[kbn ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - (D.f[dirTS ])[kts ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - (D.f[dirTNE ])[ktne ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - (D.f[dirBSW ])[kbsw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - (D.f[dirBNE ])[kbne ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - (D.f[dirTSW ])[ktsw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - (D.f[dirTSE ])[ktse ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - (D.f[dirBNW ])[kbnw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - (D.f[dirBSE ])[kbse ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - (D.f[dirTNW ])[ktnw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + (D.f[DIR_000])[kzero] = c8o27* (drho-cu_sq*(c1o1+drho)); + (D.f[DIR_P00 ])[ke ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq)); + (D.f[DIR_M00 ])[kw ] = c2o27* (drho+ (c1o1+drho) * (c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq)); + (D.f[DIR_0P0 ])[kn ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq)); + (D.f[DIR_0M0 ])[ks ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq)); + (D.f[DIR_00P ])[kt ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq)); + (D.f[DIR_00M ])[kb ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq)); + (D.f[DIR_PP0 ])[kne ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + (D.f[DIR_MM0 ])[ksw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + (D.f[DIR_PM0 ])[kse ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + (D.f[DIR_MP0 ])[knw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + (D.f[DIR_P0P ])[kte ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + (D.f[DIR_M0M ])[kbw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + (D.f[DIR_P0M ])[kbe ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + (D.f[DIR_M0P ])[ktw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + (D.f[DIR_0PP ])[ktn ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + (D.f[DIR_0MM ])[kbs ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + (D.f[DIR_0PM ])[kbn ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + (D.f[DIR_0MP ])[kts ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + (D.f[DIR_PPP ])[ktne ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + (D.f[DIR_MMM ])[kbsw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + (D.f[DIR_PPM ])[kbne ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + (D.f[DIR_MMP ])[ktsw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + (D.f[DIR_PMP ])[ktse ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + (D.f[DIR_MPM ])[kbnw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + (D.f[DIR_PMM ])[kbse ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + (D.f[DIR_MPP ])[ktnw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); } } } @@ -178,7 +179,7 @@ extern "C" __global__ void LB_Init_Comp_SP_27(unsigned int* neighborX, //////////////////////////////////////////////////////////////////////////////// -extern "C" __global__ void LB_Init_Comp_Neq_SP_27( unsigned int* neighborX, +__global__ void LB_Init_Comp_Neq_SP_27( unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* neighborWSB, @@ -214,63 +215,63 @@ extern "C" __global__ void LB_Init_Comp_Neq_SP_27( unsigned int* neighborX, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; } ////////////////////////////////////////////////////////////////////////// real drho = rho[k];//0.0f;// @@ -392,63 +393,63 @@ extern "C" __global__ void LB_Init_Comp_Neq_SP_27( unsigned int* neighborX, ////////////////////////////////////////////////////////////////////////// real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D.f[dirZERO])[kzero] = c8o27* (drho-cu_sq*(c1o1+drho)); - (D.f[dirE ])[ke ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq)); - (D.f[dirW ])[kw ] = c2o27* (drho+ (c1o1+drho) * (c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq)); - (D.f[dirN ])[kn ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq)); - (D.f[dirS ])[ks ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq)); - (D.f[dirT ])[kt ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq)); - (D.f[dirB ])[kb ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq)); - (D.f[dirNE ])[kne ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); - (D.f[dirSW ])[ksw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); - (D.f[dirSE ])[kse ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); - (D.f[dirNW ])[knw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); - (D.f[dirTE ])[kte ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); - (D.f[dirBW ])[kbw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); - (D.f[dirBE ])[kbe ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); - (D.f[dirTW ])[ktw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); - (D.f[dirTN ])[ktn ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); - (D.f[dirBS ])[kbs ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); - (D.f[dirBN ])[kbn ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); - (D.f[dirTS ])[kts ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); - (D.f[dirTNE ])[ktne ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); - (D.f[dirBSW ])[kbsw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); - (D.f[dirBNE ])[kbne ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); - (D.f[dirTSW ])[ktsw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); - (D.f[dirTSE ])[ktse ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); - (D.f[dirBNW ])[kbnw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); - (D.f[dirBSE ])[kbse ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); - (D.f[dirTNW ])[ktnw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); + (D.f[DIR_000])[kzero] = c8o27* (drho-cu_sq*(c1o1+drho)); + (D.f[DIR_P00 ])[ke ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq)); + (D.f[DIR_M00 ])[kw ] = c2o27* (drho+ (c1o1+drho) * (c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq)); + (D.f[DIR_0P0 ])[kn ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq)); + (D.f[DIR_0M0 ])[ks ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq)); + (D.f[DIR_00P ])[kt ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq)); + (D.f[DIR_00M ])[kb ] = c2o27* (drho+ (c1o1+drho) * (c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq)); + (D.f[DIR_PP0 ])[kne ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq)); + (D.f[DIR_MM0 ])[ksw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq)); + (D.f[DIR_PM0 ])[kse ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq)); + (D.f[DIR_MP0 ])[knw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq)); + (D.f[DIR_P0P ])[kte ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq)); + (D.f[DIR_M0M ])[kbw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq)); + (D.f[DIR_P0M ])[kbe ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq)); + (D.f[DIR_M0P ])[ktw ] = c1o54* (drho+ (c1o1+drho) * (c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq)); + (D.f[DIR_0PP ])[ktn ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq)); + (D.f[DIR_0MM ])[kbs ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq)); + (D.f[DIR_0PM ])[kbn ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq)); + (D.f[DIR_0MP ])[kts ] = c1o54* (drho+ (c1o1+drho) * (c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq)); + (D.f[DIR_PPP ])[ktne ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq)); + (D.f[DIR_MMM ])[kbsw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq)); + (D.f[DIR_PPM ])[kbne ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq)); + (D.f[DIR_MMP ])[ktsw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq)); + (D.f[DIR_PMP ])[ktse ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq)); + (D.f[DIR_MPM ])[kbnw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq)); + (D.f[DIR_PMM ])[kbse ] = c1o216*(drho+ (c1o1+drho) * (c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq)); + (D.f[DIR_MPP ])[ktnw ] = c1o216*(drho+ (c1o1+drho) * (c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq)); ////////////////////////////////////////////////////////////////////////// - (D.f[dirZERO])[kzero] += (c1o1+drho) * f_ZERO; - (D.f[dirE ])[ke ] += (c1o1+drho) * f_E ; - (D.f[dirW ])[kw ] += (c1o1+drho) * f_E ; - (D.f[dirN ])[kn ] += (c1o1+drho) * f_N ; - (D.f[dirS ])[ks ] += (c1o1+drho) * f_N ; - (D.f[dirT ])[kt ] += (c1o1+drho) * f_T ; - (D.f[dirB ])[kb ] += (c1o1+drho) * f_T ; - (D.f[dirNE ])[kne ] += (c1o1+drho) * f_NE ; - (D.f[dirSW ])[ksw ] += (c1o1+drho) * f_NE ; - (D.f[dirSE ])[kse ] += (c1o1+drho) * f_SE ; - (D.f[dirNW ])[knw ] += (c1o1+drho) * f_SE ; - (D.f[dirTE ])[kte ] += (c1o1+drho) * f_TE ; - (D.f[dirBW ])[kbw ] += (c1o1+drho) * f_TE ; - (D.f[dirBE ])[kbe ] += (c1o1+drho) * f_BE ; - (D.f[dirTW ])[ktw ] += (c1o1+drho) * f_BE ; - (D.f[dirTN ])[ktn ] += (c1o1+drho) * f_TN ; - (D.f[dirBS ])[kbs ] += (c1o1+drho) * f_TN ; - (D.f[dirBN ])[kbn ] += (c1o1+drho) * f_BN ; - (D.f[dirTS ])[kts ] += (c1o1+drho) * f_BN ; - (D.f[dirTNE ])[ktne ] += (c1o1+drho) * f_TNE ; - (D.f[dirBSW ])[kbsw ] += (c1o1+drho) * f_TNE ; - (D.f[dirBNE ])[kbne ] += (c1o1+drho) * f_TSW ; - (D.f[dirTSW ])[ktsw ] += (c1o1+drho) * f_TSW ; - (D.f[dirTSE ])[ktse ] += (c1o1+drho) * f_TSE ; - (D.f[dirBNW ])[kbnw ] += (c1o1+drho) * f_TSE ; - (D.f[dirBSE ])[kbse ] += (c1o1+drho) * f_TNW ; - (D.f[dirTNW ])[ktnw ] += (c1o1+drho) * f_TNW ; + (D.f[DIR_000])[kzero] += (c1o1+drho) * f_ZERO; + (D.f[DIR_P00 ])[ke ] += (c1o1+drho) * f_E ; + (D.f[DIR_M00 ])[kw ] += (c1o1+drho) * f_E ; + (D.f[DIR_0P0 ])[kn ] += (c1o1+drho) * f_N ; + (D.f[DIR_0M0 ])[ks ] += (c1o1+drho) * f_N ; + (D.f[DIR_00P ])[kt ] += (c1o1+drho) * f_T ; + (D.f[DIR_00M ])[kb ] += (c1o1+drho) * f_T ; + (D.f[DIR_PP0 ])[kne ] += (c1o1+drho) * f_NE ; + (D.f[DIR_MM0 ])[ksw ] += (c1o1+drho) * f_NE ; + (D.f[DIR_PM0 ])[kse ] += (c1o1+drho) * f_SE ; + (D.f[DIR_MP0 ])[knw ] += (c1o1+drho) * f_SE ; + (D.f[DIR_P0P ])[kte ] += (c1o1+drho) * f_TE ; + (D.f[DIR_M0M ])[kbw ] += (c1o1+drho) * f_TE ; + (D.f[DIR_P0M ])[kbe ] += (c1o1+drho) * f_BE ; + (D.f[DIR_M0P ])[ktw ] += (c1o1+drho) * f_BE ; + (D.f[DIR_0PP ])[ktn ] += (c1o1+drho) * f_TN ; + (D.f[DIR_0MM ])[kbs ] += (c1o1+drho) * f_TN ; + (D.f[DIR_0PM ])[kbn ] += (c1o1+drho) * f_BN ; + (D.f[DIR_0MP ])[kts ] += (c1o1+drho) * f_BN ; + (D.f[DIR_PPP ])[ktne ] += (c1o1+drho) * f_TNE ; + (D.f[DIR_MMM ])[kbsw ] += (c1o1+drho) * f_TNE ; + (D.f[DIR_PPM ])[kbne ] += (c1o1+drho) * f_TSW ; + (D.f[DIR_MMP ])[ktsw ] += (c1o1+drho) * f_TSW ; + (D.f[DIR_PMP ])[ktse ] += (c1o1+drho) * f_TSE ; + (D.f[DIR_MPM ])[kbnw ] += (c1o1+drho) * f_TSE ; + (D.f[DIR_PMM ])[kbse ] += (c1o1+drho) * f_TNW ; + (D.f[DIR_MPP ])[ktnw ] += (c1o1+drho) * f_TNW ; ////////////////////////////////////////////////////////////////////////// } @@ -456,9 +457,9 @@ extern "C" __global__ void LB_Init_Comp_Neq_SP_27( unsigned int* neighborX, { ////////////////////////////////////////////////////////////////////////// Distributions27 D; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; ////////////////////////////////////////////////////////////////////////// - (D.f[dirZERO])[k] = c96o1; + (D.f[DIR_000])[k] = c96o1; ////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27_Device.cuh index dd9dbd7d0b5d783bdbdcc05dd6c38fad0d60b79f..0e1d89b9ac4778a1fdb4d8e72cd13be5eb3920d1 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Init_Comp_SP_27(unsigned int* neighborX, +__global__ void LB_Init_Comp_SP_27(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, @@ -16,7 +16,7 @@ extern "C" __global__ void LB_Init_Comp_SP_27(unsigned int* neighborX, real* DD, bool EvenOrOdd); -extern "C" __global__ void LB_Init_Comp_Neq_SP_27(unsigned int* neighborX, +__global__ void LB_Init_Comp_Neq_SP_27(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* neighborWSB, diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3.cu index 65a05073c82a3e858024d5eb3e7adba7c49f33ea..cb6b40b4371a206c6d1e031822338621c4907be1 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3.cu @@ -11,7 +11,7 @@ std::shared_ptr<PreProcessorStrategy> InitF3::getNewInstance(std::shared_ptr<Par void InitF3::init(int level) { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -28,17 +28,17 @@ void InitF3::init(int level) dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1); - LB_Init_F3 << < grid, threads >> >( para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->geoSP, - para->getParD(level)->rho_SP, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->size_Mat_SP, + LB_Init_F3 << < grid, threads >> >( para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->rho, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->numberOfNodes, para->getParD(level)->g6.g[0], - para->getParD(level)->evenOrOdd); + para->getParD(level)->isEvenTimestep); getLastCudaError("LBInitF3 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3_Device.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3_Device.cu index f69224e726eb9570642a9a1c09c20362c364256c..25af54e43ec213214615c2edc79d7996e4651c38 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3_Device.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3_Device.cu @@ -1,12 +1,13 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Init_F3(unsigned int* neighborX, +__global__ void LB_Init_F3(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, @@ -40,21 +41,21 @@ extern "C" __global__ void LB_Init_F3(unsigned int* neighborX, Distributions6 D; if (EvenOrOdd == true) { - D.g[dirE] = &G6[dirE *size_Mat]; - D.g[dirW] = &G6[dirW *size_Mat]; - D.g[dirN] = &G6[dirN *size_Mat]; - D.g[dirS] = &G6[dirS *size_Mat]; - D.g[dirT] = &G6[dirT *size_Mat]; - D.g[dirB] = &G6[dirB *size_Mat]; + D.g[DIR_P00] = &G6[DIR_P00 *size_Mat]; + D.g[DIR_M00] = &G6[DIR_M00 *size_Mat]; + D.g[DIR_0P0] = &G6[DIR_0P0 *size_Mat]; + D.g[DIR_0M0] = &G6[DIR_0M0 *size_Mat]; + D.g[DIR_00P] = &G6[DIR_00P *size_Mat]; + D.g[DIR_00M] = &G6[DIR_00M *size_Mat]; } else { - D.g[dirW] = &G6[dirE *size_Mat]; - D.g[dirE] = &G6[dirW *size_Mat]; - D.g[dirS] = &G6[dirN *size_Mat]; - D.g[dirN] = &G6[dirS *size_Mat]; - D.g[dirB] = &G6[dirT *size_Mat]; - D.g[dirT] = &G6[dirB *size_Mat]; + D.g[DIR_M00] = &G6[DIR_P00 *size_Mat]; + D.g[DIR_P00] = &G6[DIR_M00 *size_Mat]; + D.g[DIR_0M0] = &G6[DIR_0P0 *size_Mat]; + D.g[DIR_0P0] = &G6[DIR_0M0 *size_Mat]; + D.g[DIR_00M] = &G6[DIR_00P *size_Mat]; + D.g[DIR_00P] = &G6[DIR_00M *size_Mat]; } ////////////////////////////////////////////////////////////////////////// //index @@ -68,12 +69,12 @@ extern "C" __global__ void LB_Init_F3(unsigned int* neighborX, unsigned int kb = neighborZ[k]; ////////////////////////////////////////////////////////////////////////// - (D.g[dirE])[ke] = 0.0f; - (D.g[dirW])[kw] = 0.0f; - (D.g[dirN])[kn] = 0.0f; - (D.g[dirS])[ks] = 0.0f; - (D.g[dirT])[kt] = 0.0f; - (D.g[dirB])[kb] = 0.0f; + (D.g[DIR_P00])[ke] = 0.0f; + (D.g[DIR_M00])[kw] = 0.0f; + (D.g[DIR_0P0])[kn] = 0.0f; + (D.g[DIR_0M0])[ks] = 0.0f; + (D.g[DIR_00P])[kt] = 0.0f; + (D.g[DIR_00M])[kb] = 0.0f; } } } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3_Device.cuh b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3_Device.cuh index 0df2f099bfede16d19edf171016e1a20e1efe0b7..71750c0fde2722a900800f742d801b6caf2febbf 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Init_F3(unsigned int* neighborX, +__global__ void LB_Init_F3(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27.cu index f15c2f91a84595a783ec227e6e34b302968e0d1a..419ae80b96be57f8dc9c4ebecaccac0d435f00e0 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27.cu @@ -11,7 +11,7 @@ std::shared_ptr<PreProcessorStrategy> InitIncompAD27::getNewInstance(std::shared void InitIncompAD27::init(int level) { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -28,17 +28,17 @@ void InitIncompAD27::init(int level) dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1); - LB_Init_Incomp_AD_27 << < grid, threads >> >( para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->geoSP, + LB_Init_Incomp_AD_27 << < grid, threads >> >( para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->typeOfGridNode, para->getParD(level)->Conc, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->d27.f[0], - para->getParD(level)->evenOrOdd); + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->isEvenTimestep); getLastCudaError("LBInitIncompAD27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27_Device.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27_Device.cu index f304201bf82fe7b84b6e558dfe65ef780c9cd25f..62d766aaa04b6f6349c6c4106e201f36898601ec 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Init_Incomp_AD_27(unsigned int* neighborX, +__global__ void LB_Init_Incomp_AD_27(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, @@ -39,63 +40,63 @@ extern "C" __global__ void LB_Init_Incomp_AD_27(unsigned int* neighborX, Distributions27 D27; if (EvenOrOdd==true) { - D27.f[dirE ] = &DD27[dirE *size_Mat]; - D27.f[dirW ] = &DD27[dirW *size_Mat]; - D27.f[dirN ] = &DD27[dirN *size_Mat]; - D27.f[dirS ] = &DD27[dirS *size_Mat]; - D27.f[dirT ] = &DD27[dirT *size_Mat]; - D27.f[dirB ] = &DD27[dirB *size_Mat]; - D27.f[dirNE ] = &DD27[dirNE *size_Mat]; - D27.f[dirSW ] = &DD27[dirSW *size_Mat]; - D27.f[dirSE ] = &DD27[dirSE *size_Mat]; - D27.f[dirNW ] = &DD27[dirNW *size_Mat]; - D27.f[dirTE ] = &DD27[dirTE *size_Mat]; - D27.f[dirBW ] = &DD27[dirBW *size_Mat]; - D27.f[dirBE ] = &DD27[dirBE *size_Mat]; - D27.f[dirTW ] = &DD27[dirTW *size_Mat]; - D27.f[dirTN ] = &DD27[dirTN *size_Mat]; - D27.f[dirBS ] = &DD27[dirBS *size_Mat]; - D27.f[dirBN ] = &DD27[dirBN *size_Mat]; - D27.f[dirTS ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirTNE ] = &DD27[dirTNE *size_Mat]; - D27.f[dirTSW ] = &DD27[dirTSW *size_Mat]; - D27.f[dirTSE ] = &DD27[dirTSE *size_Mat]; - D27.f[dirTNW ] = &DD27[dirTNW *size_Mat]; - D27.f[dirBNE ] = &DD27[dirBNE *size_Mat]; - D27.f[dirBSW ] = &DD27[dirBSW *size_Mat]; - D27.f[dirBSE ] = &DD27[dirBSE *size_Mat]; - D27.f[dirBNW ] = &DD27[dirBNW *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_MPM *size_Mat]; } else { - D27.f[dirW ] = &DD27[dirE *size_Mat]; - D27.f[dirE ] = &DD27[dirW *size_Mat]; - D27.f[dirS ] = &DD27[dirN *size_Mat]; - D27.f[dirN ] = &DD27[dirS *size_Mat]; - D27.f[dirB ] = &DD27[dirT *size_Mat]; - D27.f[dirT ] = &DD27[dirB *size_Mat]; - D27.f[dirSW ] = &DD27[dirNE *size_Mat]; - D27.f[dirNE ] = &DD27[dirSW *size_Mat]; - D27.f[dirNW ] = &DD27[dirSE *size_Mat]; - D27.f[dirSE ] = &DD27[dirNW *size_Mat]; - D27.f[dirBW ] = &DD27[dirTE *size_Mat]; - D27.f[dirTE ] = &DD27[dirBW *size_Mat]; - D27.f[dirTW ] = &DD27[dirBE *size_Mat]; - D27.f[dirBE ] = &DD27[dirTW *size_Mat]; - D27.f[dirBS ] = &DD27[dirTN *size_Mat]; - D27.f[dirTN ] = &DD27[dirBS *size_Mat]; - D27.f[dirTS ] = &DD27[dirBN *size_Mat]; - D27.f[dirBN ] = &DD27[dirTS *size_Mat]; - D27.f[dirZERO] = &DD27[dirZERO*size_Mat]; - D27.f[dirBSW ] = &DD27[dirTNE *size_Mat]; - D27.f[dirBNE ] = &DD27[dirTSW *size_Mat]; - D27.f[dirBNW ] = &DD27[dirTSE *size_Mat]; - D27.f[dirBSE ] = &DD27[dirTNW *size_Mat]; - D27.f[dirTSW ] = &DD27[dirBNE *size_Mat]; - D27.f[dirTNE ] = &DD27[dirBSW *size_Mat]; - D27.f[dirTNW ] = &DD27[dirBSE *size_Mat]; - D27.f[dirTSE ] = &DD27[dirBNW *size_Mat]; + D27.f[DIR_M00 ] = &DD27[DIR_P00 *size_Mat]; + D27.f[DIR_P00 ] = &DD27[DIR_M00 *size_Mat]; + D27.f[DIR_0M0 ] = &DD27[DIR_0P0 *size_Mat]; + D27.f[DIR_0P0 ] = &DD27[DIR_0M0 *size_Mat]; + D27.f[DIR_00M ] = &DD27[DIR_00P *size_Mat]; + D27.f[DIR_00P ] = &DD27[DIR_00M *size_Mat]; + D27.f[DIR_MM0 ] = &DD27[DIR_PP0 *size_Mat]; + D27.f[DIR_PP0 ] = &DD27[DIR_MM0 *size_Mat]; + D27.f[DIR_MP0 ] = &DD27[DIR_PM0 *size_Mat]; + D27.f[DIR_PM0 ] = &DD27[DIR_MP0 *size_Mat]; + D27.f[DIR_M0M ] = &DD27[DIR_P0P *size_Mat]; + D27.f[DIR_P0P ] = &DD27[DIR_M0M *size_Mat]; + D27.f[DIR_M0P ] = &DD27[DIR_P0M *size_Mat]; + D27.f[DIR_P0M ] = &DD27[DIR_M0P *size_Mat]; + D27.f[DIR_0MM ] = &DD27[DIR_0PP *size_Mat]; + D27.f[DIR_0PP ] = &DD27[DIR_0MM *size_Mat]; + D27.f[DIR_0MP ] = &DD27[DIR_0PM *size_Mat]; + D27.f[DIR_0PM ] = &DD27[DIR_0MP *size_Mat]; + D27.f[DIR_000] = &DD27[DIR_000*size_Mat]; + D27.f[DIR_MMM ] = &DD27[DIR_PPP *size_Mat]; + D27.f[DIR_PPM ] = &DD27[DIR_MMP *size_Mat]; + D27.f[DIR_MPM ] = &DD27[DIR_PMP *size_Mat]; + D27.f[DIR_PMM ] = &DD27[DIR_MPP *size_Mat]; + D27.f[DIR_MMP ] = &DD27[DIR_PPM *size_Mat]; + D27.f[DIR_PPP ] = &DD27[DIR_MMM *size_Mat]; + D27.f[DIR_MPP ] = &DD27[DIR_PMM *size_Mat]; + D27.f[DIR_PMP ] = &DD27[DIR_MPM *size_Mat]; } ////////////////////////////////////////////////////////////////////////// real ConcD = Conc[k]; @@ -139,33 +140,33 @@ extern "C" __global__ void LB_Init_Incomp_AD_27(unsigned int* neighborX, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D27.f[dirZERO])[kzero] = c8o27* ConcD*(c1o1-cu_sq); - (D27.f[dirE ])[ke ] = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - (D27.f[dirW ])[kw ] = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - (D27.f[dirN ])[kn ] = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - (D27.f[dirS ])[ks ] = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - (D27.f[dirT ])[kt ] = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - (D27.f[dirB ])[kb ] = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - (D27.f[dirNE ])[kne ] = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - (D27.f[dirSW ])[ksw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - (D27.f[dirSE ])[kse ] = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - (D27.f[dirNW ])[knw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - (D27.f[dirTE ])[kte ] = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - (D27.f[dirBW ])[kbw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - (D27.f[dirBE ])[kbe ] = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - (D27.f[dirTW ])[ktw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - (D27.f[dirTN ])[ktn ] = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - (D27.f[dirBS ])[kbs ] = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - (D27.f[dirBN ])[kbn ] = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - (D27.f[dirTS ])[kts ] = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - (D27.f[dirTNE ])[ktne ] = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - (D27.f[dirBSW ])[kbsw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - (D27.f[dirBNE ])[kbne ] = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - (D27.f[dirTSW ])[ktsw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - (D27.f[dirTSE ])[ktse ] = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - (D27.f[dirBNW ])[kbnw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - (D27.f[dirBSE ])[kbse ] = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - (D27.f[dirTNW ])[ktnw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + (D27.f[DIR_000])[kzero] = c8o27* ConcD*(c1o1-cu_sq); + (D27.f[DIR_P00 ])[ke ] = c2o27* ConcD*(c1o1+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + (D27.f[DIR_M00 ])[kw ] = c2o27* ConcD*(c1o1+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + (D27.f[DIR_0P0 ])[kn ] = c2o27* ConcD*(c1o1+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + (D27.f[DIR_0M0 ])[ks ] = c2o27* ConcD*(c1o1+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + (D27.f[DIR_00P ])[kt ] = c2o27* ConcD*(c1o1+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + (D27.f[DIR_00M ])[kb ] = c2o27* ConcD*(c1o1+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + (D27.f[DIR_PP0 ])[kne ] = c1o54* ConcD*(c1o1+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + (D27.f[DIR_MM0 ])[ksw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + (D27.f[DIR_PM0 ])[kse ] = c1o54* ConcD*(c1o1+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + (D27.f[DIR_MP0 ])[knw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + (D27.f[DIR_P0P ])[kte ] = c1o54* ConcD*(c1o1+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + (D27.f[DIR_M0M ])[kbw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + (D27.f[DIR_P0M ])[kbe ] = c1o54* ConcD*(c1o1+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + (D27.f[DIR_M0P ])[ktw ] = c1o54* ConcD*(c1o1+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + (D27.f[DIR_0PP ])[ktn ] = c1o54* ConcD*(c1o1+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + (D27.f[DIR_0MM ])[kbs ] = c1o54* ConcD*(c1o1+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + (D27.f[DIR_0PM ])[kbn ] = c1o54* ConcD*(c1o1+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + (D27.f[DIR_0MP ])[kts ] = c1o54* ConcD*(c1o1+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + (D27.f[DIR_PPP ])[ktne ] = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + (D27.f[DIR_MMM ])[kbsw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + (D27.f[DIR_PPM ])[kbne ] = c1o216*ConcD*(c1o1+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + (D27.f[DIR_MMP ])[ktsw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + (D27.f[DIR_PMP ])[ktse ] = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + (D27.f[DIR_MPM ])[kbnw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + (D27.f[DIR_PMM ])[kbse ] = c1o216*ConcD*(c1o1+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + (D27.f[DIR_MPP ])[ktnw ] = c1o216*ConcD*(c1o1+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27_Device.cuh b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27_Device.cuh index a67b7a9f446fc49983d0a9f2e309dfaec3649547..85b8f1b7ae9f814b1a15aa2a8af4aa2d7c3645b5 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Init_Incomp_AD_27(unsigned int* neighborX, +__global__ void LB_Init_Incomp_AD_27(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7.cu index 6bc6b41195c7a871c64922ceac3485410ba6e1ff..795cd0496a207e0861e35e4f310481950a037caf 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7.cu @@ -11,7 +11,7 @@ std::shared_ptr<PreProcessorStrategy> InitIncompAD7::getNewInstance(std::shared_ void InitIncompAD7::init(int level) { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -28,17 +28,17 @@ void InitIncompAD7::init(int level) dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1); - LB_Init_Incomp_AD_7 << < grid, threads >> >( para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->geoSP, + LB_Init_Incomp_AD_7 << < grid, threads >> >( para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->typeOfGridNode, para->getParD(level)->Conc, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->d27.f[0], - para->getParD(level)->evenOrOdd); + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->distributionsAD27.f[0], + para->getParD(level)->isEvenTimestep); getLastCudaError("LBInitIncompAD7 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7_Device.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7_Device.cu index 3a2730c8d116542e06338eb94430c2ee24e75404..94a4352d43dee67117f66eaf03536c5ea3e15edd 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7_Device.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Init_Incomp_AD_7(unsigned int* neighborX, +__global__ void LB_Init_Incomp_AD_7(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7_Device.cuh b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7_Device.cuh index 9dedbf270e6e53283d41d315d67135f9c57940db..2d381e6e0531b900cee90eb8f7e2f3d4ff8615f7 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Init_Incomp_AD_7(unsigned int* neighborX, +__global__ void LB_Init_Incomp_AD_7(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27.cu index 89148570fd9322f4b114c50611d2af2772efd224..0538c7ab89eb750a40cfc47486dc0891d4493976 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27.cu @@ -11,7 +11,7 @@ std::shared_ptr<PreProcessorStrategy> InitSP27::getNewInstance(std::shared_ptr<P void InitSP27::init(int level) { int numberOfThreads = para->getParD(level)->numberofthreads; - int size_Mat = para->getParD(level)->size_Mat_SP; + int size_Mat = para->getParD(level)->numberOfNodes; int Grid = (size_Mat / numberOfThreads) + 1; int Grid1, Grid2; @@ -28,17 +28,17 @@ void InitSP27::init(int level) dim3 grid(Grid1, Grid2); dim3 threads(numberOfThreads, 1, 1); - LB_Init_SP_27 << < grid, threads >> >( para->getParD(level)->neighborX_SP, - para->getParD(level)->neighborY_SP, - para->getParD(level)->neighborZ_SP, - para->getParD(level)->geoSP, - para->getParD(level)->rho_SP, - para->getParD(level)->vx_SP, - para->getParD(level)->vy_SP, - para->getParD(level)->vz_SP, - para->getParD(level)->size_Mat_SP, - para->getParD(level)->d0SP.f[0], - para->getParD(level)->evenOrOdd); + LB_Init_SP_27 << < grid, threads >> >( para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->rho, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->numberOfNodes, + para->getParD(level)->distributions.f[0], + para->getParD(level)->isEvenTimestep); getLastCudaError("LBInitSP27 execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27_Device.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27_Device.cu index ad55c17528b2348536846a8769848f17eeb6244a..b58935feb0bf276a2d8da3f36efbb1fb0ab9d13f 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27_Device.cu @@ -1,11 +1,12 @@ #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include <lbm/constants/NumericConstants.h> using namespace vf::lbm::constant; +using namespace vf::lbm::dir; #include "math.h" -extern "C" __global__ void LB_Init_SP_27(unsigned int* neighborX, +__global__ void LB_Init_SP_27(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, @@ -39,63 +40,63 @@ extern "C" __global__ void LB_Init_SP_27(unsigned int* neighborX, Distributions27 D; if (EvenOrOdd==true) { - D.f[dirE ] = &DD[dirE *size_Mat]; - D.f[dirW ] = &DD[dirW *size_Mat]; - D.f[dirN ] = &DD[dirN *size_Mat]; - D.f[dirS ] = &DD[dirS *size_Mat]; - D.f[dirT ] = &DD[dirT *size_Mat]; - D.f[dirB ] = &DD[dirB *size_Mat]; - D.f[dirNE ] = &DD[dirNE *size_Mat]; - D.f[dirSW ] = &DD[dirSW *size_Mat]; - D.f[dirSE ] = &DD[dirSE *size_Mat]; - D.f[dirNW ] = &DD[dirNW *size_Mat]; - D.f[dirTE ] = &DD[dirTE *size_Mat]; - D.f[dirBW ] = &DD[dirBW *size_Mat]; - D.f[dirBE ] = &DD[dirBE *size_Mat]; - D.f[dirTW ] = &DD[dirTW *size_Mat]; - D.f[dirTN ] = &DD[dirTN *size_Mat]; - D.f[dirBS ] = &DD[dirBS *size_Mat]; - D.f[dirBN ] = &DD[dirBN *size_Mat]; - D.f[dirTS ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirTNE ] = &DD[dirTNE *size_Mat]; - D.f[dirTSW ] = &DD[dirTSW *size_Mat]; - D.f[dirTSE ] = &DD[dirTSE *size_Mat]; - D.f[dirTNW ] = &DD[dirTNW *size_Mat]; - D.f[dirBNE ] = &DD[dirBNE *size_Mat]; - D.f[dirBSW ] = &DD[dirBSW *size_Mat]; - D.f[dirBSE ] = &DD[dirBSE *size_Mat]; - D.f[dirBNW ] = &DD[dirBNW *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_MPM *size_Mat]; } else { - D.f[dirW ] = &DD[dirE *size_Mat]; - D.f[dirE ] = &DD[dirW *size_Mat]; - D.f[dirS ] = &DD[dirN *size_Mat]; - D.f[dirN ] = &DD[dirS *size_Mat]; - D.f[dirB ] = &DD[dirT *size_Mat]; - D.f[dirT ] = &DD[dirB *size_Mat]; - D.f[dirSW ] = &DD[dirNE *size_Mat]; - D.f[dirNE ] = &DD[dirSW *size_Mat]; - D.f[dirNW ] = &DD[dirSE *size_Mat]; - D.f[dirSE ] = &DD[dirNW *size_Mat]; - D.f[dirBW ] = &DD[dirTE *size_Mat]; - D.f[dirTE ] = &DD[dirBW *size_Mat]; - D.f[dirTW ] = &DD[dirBE *size_Mat]; - D.f[dirBE ] = &DD[dirTW *size_Mat]; - D.f[dirBS ] = &DD[dirTN *size_Mat]; - D.f[dirTN ] = &DD[dirBS *size_Mat]; - D.f[dirTS ] = &DD[dirBN *size_Mat]; - D.f[dirBN ] = &DD[dirTS *size_Mat]; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; - D.f[dirBSW ] = &DD[dirTNE *size_Mat]; - D.f[dirBNE ] = &DD[dirTSW *size_Mat]; - D.f[dirBNW ] = &DD[dirTSE *size_Mat]; - D.f[dirBSE ] = &DD[dirTNW *size_Mat]; - D.f[dirTSW ] = &DD[dirBNE *size_Mat]; - D.f[dirTNE ] = &DD[dirBSW *size_Mat]; - D.f[dirTNW ] = &DD[dirBSE *size_Mat]; - D.f[dirTSE ] = &DD[dirBNW *size_Mat]; + D.f[DIR_M00 ] = &DD[DIR_P00 *size_Mat]; + D.f[DIR_P00 ] = &DD[DIR_M00 *size_Mat]; + D.f[DIR_0M0 ] = &DD[DIR_0P0 *size_Mat]; + D.f[DIR_0P0 ] = &DD[DIR_0M0 *size_Mat]; + D.f[DIR_00M ] = &DD[DIR_00P *size_Mat]; + D.f[DIR_00P ] = &DD[DIR_00M *size_Mat]; + D.f[DIR_MM0 ] = &DD[DIR_PP0 *size_Mat]; + D.f[DIR_PP0 ] = &DD[DIR_MM0 *size_Mat]; + D.f[DIR_MP0 ] = &DD[DIR_PM0 *size_Mat]; + D.f[DIR_PM0 ] = &DD[DIR_MP0 *size_Mat]; + D.f[DIR_M0M ] = &DD[DIR_P0P *size_Mat]; + D.f[DIR_P0P ] = &DD[DIR_M0M *size_Mat]; + D.f[DIR_M0P ] = &DD[DIR_P0M *size_Mat]; + D.f[DIR_P0M ] = &DD[DIR_M0P *size_Mat]; + D.f[DIR_0MM ] = &DD[DIR_0PP *size_Mat]; + D.f[DIR_0PP ] = &DD[DIR_0MM *size_Mat]; + D.f[DIR_0MP ] = &DD[DIR_0PM *size_Mat]; + D.f[DIR_0PM ] = &DD[DIR_0MP *size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; + D.f[DIR_MMM ] = &DD[DIR_PPP *size_Mat]; + D.f[DIR_PPM ] = &DD[DIR_MMP *size_Mat]; + D.f[DIR_MPM ] = &DD[DIR_PMP *size_Mat]; + D.f[DIR_PMM ] = &DD[DIR_MPP *size_Mat]; + D.f[DIR_MMP ] = &DD[DIR_PPM *size_Mat]; + D.f[DIR_PPP ] = &DD[DIR_MMM *size_Mat]; + D.f[DIR_MPP ] = &DD[DIR_PMM *size_Mat]; + D.f[DIR_PMP ] = &DD[DIR_MPM *size_Mat]; } ////////////////////////////////////////////////////////////////////////// real drho = rho[k];//0.0f;// @@ -135,41 +136,41 @@ extern "C" __global__ void LB_Init_SP_27(unsigned int* neighborX, ////////////////////////////////////////////////////////////////////////// real cu_sq=c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); - (D.f[dirZERO])[kzero] = c8o27* (drho-cu_sq); - (D.f[dirE ])[ke ] = c2o27* (drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); - (D.f[dirW ])[kw ] = c2o27* (drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); - (D.f[dirN ])[kn ] = c2o27* (drho+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); - (D.f[dirS ])[ks ] = c2o27* (drho+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); - (D.f[dirT ])[kt ] = c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); - (D.f[dirB ])[kb ] = c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); - (D.f[dirNE ])[kne ] = c1o54* (drho+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); - (D.f[dirSW ])[ksw ] = c1o54* (drho+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); - (D.f[dirSE ])[kse ] = c1o54* (drho+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); - (D.f[dirNW ])[knw ] = c1o54* (drho+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); - (D.f[dirTE ])[kte ] = c1o54* (drho+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); - (D.f[dirBW ])[kbw ] = c1o54* (drho+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); - (D.f[dirBE ])[kbe ] = c1o54* (drho+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); - (D.f[dirTW ])[ktw ] = c1o54* (drho+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); - (D.f[dirTN ])[ktn ] = c1o54* (drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); - (D.f[dirBS ])[kbs ] = c1o54* (drho+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); - (D.f[dirBN ])[kbn ] = c1o54* (drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); - (D.f[dirTS ])[kts ] = c1o54* (drho+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); - (D.f[dirTNE ])[ktne ] = c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); - (D.f[dirBSW ])[kbsw ] = c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); - (D.f[dirBNE ])[kbne ] = c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); - (D.f[dirTSW ])[ktsw ] = c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); - (D.f[dirTSE ])[ktse ] = c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); - (D.f[dirBNW ])[kbnw ] = c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); - (D.f[dirBSE ])[kbse ] = c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); - (D.f[dirTNW ])[ktnw ] = c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); + (D.f[DIR_000])[kzero] = c8o27* (drho-cu_sq); + (D.f[DIR_P00 ])[ke ] = c2o27* (drho+c3o1*( vx1 )+c9o2*( vx1 )*( vx1 )-cu_sq); + (D.f[DIR_M00 ])[kw ] = c2o27* (drho+c3o1*(-vx1 )+c9o2*(-vx1 )*(-vx1 )-cu_sq); + (D.f[DIR_0P0 ])[kn ] = c2o27* (drho+c3o1*( vx2 )+c9o2*( vx2 )*( vx2 )-cu_sq); + (D.f[DIR_0M0 ])[ks ] = c2o27* (drho+c3o1*( -vx2 )+c9o2*( -vx2 )*( -vx2 )-cu_sq); + (D.f[DIR_00P ])[kt ] = c2o27* (drho+c3o1*( vx3)+c9o2*( vx3)*( vx3)-cu_sq); + (D.f[DIR_00M ])[kb ] = c2o27* (drho+c3o1*( -vx3)+c9o2*( -vx3)*( -vx3)-cu_sq); + (D.f[DIR_PP0 ])[kne ] = c1o54* (drho+c3o1*( vx1+vx2 )+c9o2*( vx1+vx2 )*( vx1+vx2 )-cu_sq); + (D.f[DIR_MM0 ])[ksw ] = c1o54* (drho+c3o1*(-vx1-vx2 )+c9o2*(-vx1-vx2 )*(-vx1-vx2 )-cu_sq); + (D.f[DIR_PM0 ])[kse ] = c1o54* (drho+c3o1*( vx1-vx2 )+c9o2*( vx1-vx2 )*( vx1-vx2 )-cu_sq); + (D.f[DIR_MP0 ])[knw ] = c1o54* (drho+c3o1*(-vx1+vx2 )+c9o2*(-vx1+vx2 )*(-vx1+vx2 )-cu_sq); + (D.f[DIR_P0P ])[kte ] = c1o54* (drho+c3o1*( vx1 +vx3)+c9o2*( vx1 +vx3)*( vx1 +vx3)-cu_sq); + (D.f[DIR_M0M ])[kbw ] = c1o54* (drho+c3o1*(-vx1 -vx3)+c9o2*(-vx1 -vx3)*(-vx1 -vx3)-cu_sq); + (D.f[DIR_P0M ])[kbe ] = c1o54* (drho+c3o1*( vx1 -vx3)+c9o2*( vx1 -vx3)*( vx1 -vx3)-cu_sq); + (D.f[DIR_M0P ])[ktw ] = c1o54* (drho+c3o1*(-vx1 +vx3)+c9o2*(-vx1 +vx3)*(-vx1 +vx3)-cu_sq); + (D.f[DIR_0PP ])[ktn ] = c1o54* (drho+c3o1*( vx2+vx3)+c9o2*( vx2+vx3)*( vx2+vx3)-cu_sq); + (D.f[DIR_0MM ])[kbs ] = c1o54* (drho+c3o1*( -vx2-vx3)+c9o2*( -vx2-vx3)*( -vx2-vx3)-cu_sq); + (D.f[DIR_0PM ])[kbn ] = c1o54* (drho+c3o1*( vx2-vx3)+c9o2*( vx2-vx3)*( vx2-vx3)-cu_sq); + (D.f[DIR_0MP ])[kts ] = c1o54* (drho+c3o1*( -vx2+vx3)+c9o2*( -vx2+vx3)*( -vx2+vx3)-cu_sq); + (D.f[DIR_PPP ])[ktne ] = c1o216*(drho+c3o1*( vx1+vx2+vx3)+c9o2*( vx1+vx2+vx3)*( vx1+vx2+vx3)-cu_sq); + (D.f[DIR_MMM ])[kbsw ] = c1o216*(drho+c3o1*(-vx1-vx2-vx3)+c9o2*(-vx1-vx2-vx3)*(-vx1-vx2-vx3)-cu_sq); + (D.f[DIR_PPM ])[kbne ] = c1o216*(drho+c3o1*( vx1+vx2-vx3)+c9o2*( vx1+vx2-vx3)*( vx1+vx2-vx3)-cu_sq); + (D.f[DIR_MMP ])[ktsw ] = c1o216*(drho+c3o1*(-vx1-vx2+vx3)+c9o2*(-vx1-vx2+vx3)*(-vx1-vx2+vx3)-cu_sq); + (D.f[DIR_PMP ])[ktse ] = c1o216*(drho+c3o1*( vx1-vx2+vx3)+c9o2*( vx1-vx2+vx3)*( vx1-vx2+vx3)-cu_sq); + (D.f[DIR_MPM ])[kbnw ] = c1o216*(drho+c3o1*(-vx1+vx2-vx3)+c9o2*(-vx1+vx2-vx3)*(-vx1+vx2-vx3)-cu_sq); + (D.f[DIR_PMM ])[kbse ] = c1o216*(drho+c3o1*( vx1-vx2-vx3)+c9o2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); + (D.f[DIR_MPP ])[ktnw ] = c1o216*(drho+c3o1*(-vx1+vx2+vx3)+c9o2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); } else { ////////////////////////////////////////////////////////////////////////// Distributions27 D; - D.f[dirZERO] = &DD[dirZERO*size_Mat]; + D.f[DIR_000] = &DD[DIR_000*size_Mat]; ////////////////////////////////////////////////////////////////////////// - (D.f[dirZERO])[k] = c96o1; + (D.f[DIR_000])[k] = c96o1; ////////////////////////////////////////////////////////////////////////// } } diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27_Device.cuh index 038b10f7bd85786fe3b3ef4c4d70d11816543def..2cb9c74506862e4c4766b2416dfc7f1a0024e6b0 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27_Device.cuh @@ -4,7 +4,7 @@ #include <DataTypes.h> #include <curand.h> -extern "C" __global__ void LB_Init_SP_27(unsigned int* neighborX, +__global__ void LB_Init_SP_27(unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, unsigned int* geoD, diff --git a/src/gpu/VirtualFluids_GPU/Restart/RestartObject.cpp b/src/gpu/VirtualFluids_GPU/Restart/RestartObject.cpp index bb38f4f478cf6dbaff5ebd9e9ce2fac1586d8803..a38535f7bdff0d87a5af74a69f0ed8255c647382 100644 --- a/src/gpu/VirtualFluids_GPU/Restart/RestartObject.cpp +++ b/src/gpu/VirtualFluids_GPU/Restart/RestartObject.cpp @@ -13,8 +13,8 @@ void RestartObject::deserialize(const std::string &filename, std::shared_ptr<Par std::vector<real> vec; fs.push_back(vec); - for (unsigned int i = 0; i < (para->getD3Qxx() * para->getParH(j)->size_Mat_SP); i++) { - para->getParH(j)->d0SP.f[0][i] = fs[j][i]; + for (unsigned int i = 0; i < (para->getD3Qxx() * para->getParH(j)->numberOfNodes); i++) { + para->getParH(j)->distributions.f[0][i] = fs[j][i]; } } } @@ -28,11 +28,11 @@ void RestartObject::serialize(const std::string &filename, const std::shared_ptr std::vector<real> vec; fs.push_back(vec); - for (unsigned int i = 0; i < (para->getD3Qxx() * para->getParH(j)->size_Mat_SP); i++) { - if (UbMath::isNaN(para->getParH(j)->d0SP.f[0][i])) { + for (unsigned int i = 0; i < (para->getD3Qxx() * para->getParH(j)->numberOfNodes); i++) { + if (UbMath::isNaN(para->getParH(j)->distributions.f[0][i])) { fs[j].push_back((real)0.0); } else { - fs[j].push_back(para->getParH(j)->d0SP.f[0][i]); + fs[j].push_back(para->getParH(j)->distributions.f[0][i]); } } } diff --git a/src/gpu/VirtualFluids_GPU/Temperature/FindQTemp.h b/src/gpu/VirtualFluids_GPU/Temperature/FindQTemp.h index fb399e6b154aeeae766e39564c3c492fb35442d7..8704431e95d86ddfc4df8f14ed189592250283be 100644 --- a/src/gpu/VirtualFluids_GPU/Temperature/FindQTemp.h +++ b/src/gpu/VirtualFluids_GPU/Temperature/FindQTemp.h @@ -2,21 +2,21 @@ #define FIND_Q_TEMP_H #include "LBM/LB.h" -#include "LBM/D3Q27.h" +#include "lbm/constants/D3Q27.h" #include "Parameter/Parameter.h" -extern "C" void findTempPress(Parameter* para); +void findTempPress(Parameter* para); -extern "C" void findKforTempPress(Parameter* para); +void findKforTempPress(Parameter* para); -extern "C" void findTempVel(Parameter* para); +void findTempVel(Parameter* para); -extern "C" void findKforTempVel(Parameter* para); +void findKforTempVel(Parameter* para); -extern "C" void findTemp(Parameter* para); +void findTemp(Parameter* para); -extern "C" void findKforTemp(Parameter* para); +void findKforTemp(Parameter* para); #endif diff --git a/src/gpu/VirtualFluids_GPU/Temperature/FindTemperature.cpp b/src/gpu/VirtualFluids_GPU/Temperature/FindTemperature.cpp index 906bdb57255513a4dd76df6eee6789a34ef2a816..7b42b22cbf66b248bb1ae6681207eef1da22fa97 100644 --- a/src/gpu/VirtualFluids_GPU/Temperature/FindTemperature.cpp +++ b/src/gpu/VirtualFluids_GPU/Temperature/FindTemperature.cpp @@ -14,23 +14,23 @@ #include "Parameter/Parameter.h" #include "Temperature/FindQTemp.h" -void initTemperatur(Parameter* para, CudaMemoryManager* cudaManager, int lev) +void initTemperatur(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev) { - cudaManager->cudaAllocTempFs(lev); + cudaMemoryManager->cudaAllocTempFs(lev); - cudaManager->cudaCopyConcHD(lev); + cudaMemoryManager->cudaCopyConcentrationHostToDevice(lev); if (para->getDiffMod() == 7) { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - para->getParD(lev)->evenOrOdd = false; + para->getParD(lev)->isEvenTimestep = false; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //InitThS7(); getLastCudaError("Kernel execution failed"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - para->getParD(lev)->evenOrOdd = true; + para->getParD(lev)->isEvenTimestep = true; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //InitThS7(); getLastCudaError("Kernel execution failed"); @@ -38,82 +38,82 @@ void initTemperatur(Parameter* para, CudaMemoryManager* cudaManager, int lev) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CalcMacThS7(para->getParD(lev)->Conc, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, para->getParD(lev)->numberofthreads, - para->getParD(lev)->d7.f[0], - para->getParD(lev)->evenOrOdd); + para->getParD(lev)->distributionsAD7.f[0], + para->getParD(lev)->isEvenTimestep); getLastCudaError("CalcMacSP27 execution failed"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } else if (para->getDiffMod() == 27) { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - para->getParD(lev)->evenOrOdd = false; + para->getParD(lev)->isEvenTimestep = false; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //InitThS27( ); + //InitADDev27( ); getLastCudaError("Kernel execution failed"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - para->getParD(lev)->evenOrOdd = true; + para->getParD(lev)->isEvenTimestep = true; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //InitThS27( ); + //InitADDev27( ); getLastCudaError("Kernel execution failed"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - CalcMacThS27( para->getParD(lev)->Conc, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->numberofthreads, - para->getParD(lev)->d27.f[0], - para->getParD(lev)->evenOrOdd); - getLastCudaError("CalcMacSP27 execution failed"); + CalcConcentration27( + para->getParD(lev)->numberofthreads, + para->getParD(lev)->Conc, + para->getParD(lev)->typeOfGridNode, + para->getParD(lev)->neighborX, + para->getParD(lev)->neighborY, + para->getParD(lev)->neighborZ, + para->getParD(lev)->numberOfNodes, + para->getParD(lev)->distributionsAD27.f[0], + para->getParD(lev)->isEvenTimestep); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } - cudaManager->cudaCopyConcDH(lev); + cudaMemoryManager->cudaCopyConcentrationDeviceToHost(lev); } -void findTempSim(Parameter* para, CudaMemoryManager* cudaManager) +void findTempSim(Parameter* para, CudaMemoryManager* cudaMemoryManager) { findKforTemp(para); - cudaManager->cudaAllocTempNoSlipBC(para->getCoarse()); + cudaMemoryManager->cudaAllocTempNoSlipBC(para->getCoarse()); findTemp(para); - cudaManager->cudaCopyTempNoSlipBCHD(para->getCoarse()); + cudaMemoryManager->cudaCopyTempNoSlipBCHD(para->getCoarse()); } -void findTempVelSim(Parameter* para, CudaMemoryManager* cudaManager) +void findTempVelSim(Parameter* para, CudaMemoryManager* cudaMemoryManager) { findKforTempVel(para); - cudaManager->cudaAllocTempVeloBC(para->getCoarse()); + cudaMemoryManager->cudaAllocTempVeloBC(para->getCoarse()); findTempVel(para); - cudaManager->cudaCopyTempVeloBCHD(para->getCoarse()); + cudaMemoryManager->cudaCopyTempVeloBCHD(para->getCoarse()); } -void findTempPressSim(Parameter* para, CudaMemoryManager* cudaManager) +void findTempPressSim(Parameter* para, CudaMemoryManager* cudaMemoryManager) { findKforTempPress(para); - cudaManager->cudaAllocTempPressBC(para->getCoarse()); + cudaMemoryManager->cudaAllocTempPressBC(para->getCoarse()); findTempPress(para); - cudaManager->cudaCopyTempPressBCHD(para->getCoarse()); + cudaMemoryManager->cudaCopyTempPressBCHD(para->getCoarse()); } diff --git a/src/gpu/VirtualFluids_GPU/Temperature/FindTemperature.h b/src/gpu/VirtualFluids_GPU/Temperature/FindTemperature.h index cfd36f90884008c0a27ce873b3edad31cd94112c..a4918536d21ca611d75eb6b498a44c72e4a322a8 100644 --- a/src/gpu/VirtualFluids_GPU/Temperature/FindTemperature.h +++ b/src/gpu/VirtualFluids_GPU/Temperature/FindTemperature.h @@ -6,13 +6,13 @@ class CudaMemoryManager; class Parameter; -void initTemperatur(Parameter* para, CudaMemoryManager* cudaManager, int lev); +void initTemperatur(Parameter* para, CudaMemoryManager* cudaMemoryManager, int lev); -void findTempSim(Parameter* para, CudaMemoryManager* cudaManager); +void findTempSim(Parameter* para, CudaMemoryManager* cudaMemoryManager); -void findTempVelSim(Parameter* para, CudaMemoryManager* cudaManager); +void findTempVelSim(Parameter* para, CudaMemoryManager* cudaMemoryManager); -void findTempPressSim(Parameter* para, CudaMemoryManager* cudaManager); +void findTempPressSim(Parameter* para, CudaMemoryManager* cudaMemoryManager); #endif diff --git a/src/gpu/VirtualFluids_GPU/TurbulenceModels/TurbulenceModelFactory.cpp b/src/gpu/VirtualFluids_GPU/TurbulenceModels/TurbulenceModelFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..980a199b03710ac91310d26424c20c7371f1097d --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/TurbulenceModels/TurbulenceModelFactory.cpp @@ -0,0 +1,88 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file TurbulentViscosityFactory.cpp +//! \ingroup TurbulentViscosity +//! \author Henrik Asmuth +//======================================================================================= +#include "LBM/LB.h" +#include "TurbulenceModelFactory.h" +#include "GPU/TurbulentViscosityKernels.h" +#include "Parameter/Parameter.h" +#include <logger/Logger.h> + +#include <variant> + +void TurbulenceModelFactory::setTurbulenceModel(TurbulenceModel _turbulenceModel) +{ + this->turbulenceModel = _turbulenceModel; + para->setTurbulenceModel(_turbulenceModel); + if(this->turbulenceModel != TurbulenceModel::None) para->setUseTurbulentViscosity(true); + + switch (this->turbulenceModel) { + case TurbulenceModel::AMD: + this->turbulenceModelKernel = calcTurbulentViscosityAMD; + break; + default: + this->turbulenceModelKernel = nullptr; + } +} + +void TurbulenceModelFactory::setModelConstant(real modelConstant) +{ + para->setSGSConstant(modelConstant); +} + +void TurbulenceModelFactory::readConfigFile(const vf::basics::ConfigurationFile &configData) +{ + if (configData.contains("TurbulenceModel")) + { + std::string config = configData.getValue<std::string>("TurbulenceModel"); + + if (config == "Smagorinsky") this->setTurbulenceModel( TurbulenceModel::Smagorinsky ); + else if (config == "AMD") this->setTurbulenceModel( TurbulenceModel::AMD ); + else if (config == "QR" ) this->setTurbulenceModel( TurbulenceModel::QR ); + else if (config == "None") this->setTurbulenceModel( TurbulenceModel::None ); + else std::runtime_error("TurbulenceModelFactory: Invalid turbulence model!"); + + VF_LOG_INFO("Turbulence model: {}", config); + + } + + if (configData.contains("SGSconstant")) + { + para->setSGSConstant(configData.getValue<real>("SGSconstant")); + + VF_LOG_INFO("SGS constant: {}", para->getSGSConstant() ); + } +} + +void TurbulenceModelFactory::runTurbulenceModelKernel(const int level) const +{ + if(this->turbulenceModelKernel) this->turbulenceModelKernel(para.get(), level); +} diff --git a/src/gpu/VirtualFluids_GPU/TurbulenceModels/TurbulenceModelFactory.h b/src/gpu/VirtualFluids_GPU/TurbulenceModels/TurbulenceModelFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..e71c8ed5f7be016a4a800b83cfb3252ee6b8246e --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/TurbulenceModels/TurbulenceModelFactory.h @@ -0,0 +1,71 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file TurbulentViscosityFactory.h +//! \ingroup TurbulentViscosity +//! \author Henrik Asmuth +//======================================================================================= +#ifndef TurbulenceModelFactory_H +#define TurbulenceModelFactory_H + +#include <functional> +#include <map> +#include <string> +#include <variant> + +#include "LBM/LB.h" +#include "Parameter/Parameter.h" + +#include <basics/config/ConfigurationFile.h> + +class Parameter; + +using TurbulenceModelKernel = std::function<void(Parameter *, int )>; + +class TurbulenceModelFactory +{ +public: + + TurbulenceModelFactory(SPtr<Parameter> parameter): para(parameter) {} + + void setTurbulenceModel(TurbulenceModel _turbulenceModel); + + void setModelConstant(real modelConstant); + + void readConfigFile(const vf::basics::ConfigurationFile &configData); + + void runTurbulenceModelKernel(const int level) const; + +private: + TurbulenceModel turbulenceModel = TurbulenceModel::None; + TurbulenceModelKernel turbulenceModelKernel = nullptr; + SPtr<Parameter> para; + +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Utilities/FindNeighbors.h b/src/gpu/VirtualFluids_GPU/Utilities/FindNeighbors.h new file mode 100644 index 0000000000000000000000000000000000000000..2ecbed5fd6c4b84b92c05953a4c96ecdc3b988de --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Utilities/FindNeighbors.h @@ -0,0 +1,33 @@ +#ifndef FIND_NEIGHBORS_H +#define FIND_NEIGHBORS_H + +#include "Parameter/Parameter.h" +#include "lbm/constants/D3Q27.h" + +using namespace vf::lbm::dir; + +// Only use for fluid nodes! +inline uint getNeighborIndex(LBMSimulationParameter *parH, const uint position, const int direction) +{ + uint nodeIndex = position; + + if (mapForPointerChasing.at(direction).counterInverse != 0) { + nodeIndex = parH->neighborInverse[nodeIndex]; + } + + for (uint x = 0; x < mapForPointerChasing.at(direction).counterX; x++) { + nodeIndex = parH->neighborX[nodeIndex]; + } + + for (uint y = 0; y < mapForPointerChasing.at(direction).counterY; y++) { + nodeIndex = parH->neighborY[nodeIndex]; + } + + for (uint z = 0; z < mapForPointerChasing.at(direction).counterZ; z++) { + nodeIndex = parH->neighborZ[nodeIndex]; + } + + return nodeIndex; +} + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Utilities/testUtilitiesGPU.h b/src/gpu/VirtualFluids_GPU/Utilities/testUtilitiesGPU.h new file mode 100644 index 0000000000000000000000000000000000000000..884c33fad875f80569ecbbdba6d05cbe0c0c6ba7 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Utilities/testUtilitiesGPU.h @@ -0,0 +1,22 @@ + +#ifndef TESTUTILITIESGPU_H +#define TESTUTILITIESGPU_H + +#include "Parameter/Parameter.h" + +namespace testingVF +{ + +inline SPtr<Parameter> createParameterForLevel(uint level) +{ + SPtr<Parameter> para = std::make_shared<Parameter>(); + para->setMaxLevel(level + 1); // setMaxLevel resizes parH and parD + para->parH[level] = std::make_shared<LBMSimulationParameter>(); + para->parD[level] = std::make_shared<LBMSimulationParameter>(); + + return para; +} + +} // namespace testingVF + +#endif diff --git a/src/lbm/CumulantChimera.cpp b/src/lbm/CumulantChimera.cpp index 65dc9b1f82f409447fda54fc0bc5f460533aad1b..e1c27f90b6611640d8e5db47c9432268f5f58f15 100644 --- a/src/lbm/CumulantChimera.cpp +++ b/src/lbm/CumulantChimera.cpp @@ -181,7 +181,7 @@ __host__ __device__ void cumulantChimera(KernelParameter parameter, RelaxationRa setRelaxationRates(omega, OxxPyyPzz, OxyyPxzz, OxyyMxzz, Oxyz, O4, O5, O6); //////////////////////////////////////////////////////////////////////////////////// - //! - A and B: parameters for fourth order convergence of the diffusion term according to Eq. (114) and (115) + //! - A and B: parameters for fourth order convergence of the diffusion term according to Eq. (115) and (116) //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05 040 ]</b></a> //! with simplifications assuming \f$ \omega_2 = 1.0 \f$ (modify for different bulk viscosity). //! diff --git a/src/lbm/MacroscopicQuantities.h b/src/lbm/MacroscopicQuantities.h index c37791294ff5b4edad21795f4ce0a32a18c5d236..8789f65195ee38b1399a42a0c24511dfcea3d6d0 100644 --- a/src/lbm/MacroscopicQuantities.h +++ b/src/lbm/MacroscopicQuantities.h @@ -25,10 +25,10 @@ namespace lbm inline __host__ __device__ real getDensity(const real *const &f /*[27]*/) { - return ((f[dir::TNE] + f[dir::BSW]) + (f[dir::TSE] + f[dir::BNW])) + ((f[dir::BSE] + f[dir::TNW]) + (f[dir::TSW] + f[dir::BNE])) + - (((f[dir::NE] + f[dir::SW]) + (f[dir::SE] + f[dir::NW])) + ((f[dir::TE] + f[dir::BW]) + (f[dir::BE] + f[dir::TW])) + - ((f[dir::BN] + f[dir::TS]) + (f[dir::TN] + f[dir::BS]))) + - ((f[dir::E] + f[dir::W]) + (f[dir::N] + f[dir::S]) + (f[dir::T] + f[dir::B])) + f[dir::REST]; + return ((f[dir::DIR_PPP] + f[dir::DIR_MMM]) + (f[dir::DIR_PMP] + f[dir::DIR_MPM])) + ((f[dir::DIR_PMM] + f[dir::DIR_MPP]) + (f[dir::DIR_MMP] + f[dir::DIR_PPM])) + + (((f[dir::DIR_PP0] + f[dir::DIR_MM0]) + (f[dir::DIR_PM0] + f[dir::DIR_MP0])) + ((f[dir::DIR_P0P] + f[dir::DIR_M0M]) + (f[dir::DIR_P0M] + f[dir::DIR_M0P])) + + ((f[dir::DIR_0PM] + f[dir::DIR_0MP]) + (f[dir::DIR_0PP] + f[dir::DIR_0MM]))) + + ((f[dir::DIR_P00] + f[dir::DIR_M00]) + (f[dir::DIR_0P0] + f[dir::DIR_0M0]) + (f[dir::DIR_00P] + f[dir::DIR_00M])) + f[dir::DIR_000]; } /* @@ -36,22 +36,22 @@ inline __host__ __device__ real getDensity(const real *const &f /*[27]*/) */ inline __host__ __device__ real getIncompressibleVelocityX1(const real *const &f /*[27]*/) { - return ((((f[dir::TNE] - f[dir::BSW]) + (f[dir::TSE] - f[dir::BNW])) + ((f[dir::BSE] - f[dir::TNW]) + (f[dir::BNE] - f[dir::TSW]))) + - (((f[dir::BE] - f[dir::TW]) + (f[dir::TE] - f[dir::BW])) + ((f[dir::SE] - f[dir::NW]) + (f[dir::NE] - f[dir::SW]))) + (f[dir::E] - f[dir::W])); + return ((((f[dir::DIR_PPP] - f[dir::DIR_MMM]) + (f[dir::DIR_PMP] - f[dir::DIR_MPM])) + ((f[dir::DIR_PMM] - f[dir::DIR_MPP]) + (f[dir::DIR_PPM] - f[dir::DIR_MMP]))) + + (((f[dir::DIR_P0M] - f[dir::DIR_M0P]) + (f[dir::DIR_P0P] - f[dir::DIR_M0M])) + ((f[dir::DIR_PM0] - f[dir::DIR_MP0]) + (f[dir::DIR_PP0] - f[dir::DIR_MM0]))) + (f[dir::DIR_P00] - f[dir::DIR_M00])); } inline __host__ __device__ real getIncompressibleVelocityX2(const real *const &f /*[27]*/) { - return ((((f[dir::TNE] - f[dir::BSW]) + (f[dir::BNW] - f[dir::TSE])) + ((f[dir::TNW] - f[dir::BSE]) + (f[dir::BNE] - f[dir::TSW]))) + - (((f[dir::BN] - f[dir::TS]) + (f[dir::TN] - f[dir::BS])) + ((f[dir::NW] - f[dir::SE]) + (f[dir::NE] - f[dir::SW]))) + (f[dir::N] - f[dir::S])); + return ((((f[dir::DIR_PPP] - f[dir::DIR_MMM]) + (f[dir::DIR_MPM] - f[dir::DIR_PMP])) + ((f[dir::DIR_MPP] - f[dir::DIR_PMM]) + (f[dir::DIR_PPM] - f[dir::DIR_MMP]))) + + (((f[dir::DIR_0PM] - f[dir::DIR_0MP]) + (f[dir::DIR_0PP] - f[dir::DIR_0MM])) + ((f[dir::DIR_MP0] - f[dir::DIR_PM0]) + (f[dir::DIR_PP0] - f[dir::DIR_MM0]))) + (f[dir::DIR_0P0] - f[dir::DIR_0M0])); } inline __host__ __device__ real getIncompressibleVelocityX3(const real *const &f /*[27]*/) { - return ((((f[dir::TNE] - f[dir::BSW]) + (f[dir::TSE] - f[dir::BNW])) + ((f[dir::TNW] - f[dir::BSE]) + (f[dir::TSW] - f[dir::BNE]))) + - (((f[dir::TS] - f[dir::BN]) + (f[dir::TN] - f[dir::BS])) + ((f[dir::TW] - f[dir::BE]) + (f[dir::TE] - f[dir::BW]))) + (f[dir::T] - f[dir::B])); + return ((((f[dir::DIR_PPP] - f[dir::DIR_MMM]) + (f[dir::DIR_PMP] - f[dir::DIR_MPM])) + ((f[dir::DIR_MPP] - f[dir::DIR_PMM]) + (f[dir::DIR_MMP] - f[dir::DIR_PPM]))) + + (((f[dir::DIR_0MP] - f[dir::DIR_0PM]) + (f[dir::DIR_0PP] - f[dir::DIR_0MM])) + ((f[dir::DIR_M0P] - f[dir::DIR_P0M]) + (f[dir::DIR_P0P] - f[dir::DIR_M0M]))) + (f[dir::DIR_00P] - f[dir::DIR_00M])); } @@ -81,12 +81,12 @@ inline __host__ __device__ real getCompressibleVelocityX3(const real *const &f27 */ inline __host__ __device__ real getPressure(const real *const &f27, const real& rho, const real& vx, const real& vy, const real& vz) { - return (f27[dir::E] + f27[dir::W] + f27[dir::N] + f27[dir::S] + f27[dir::T] + f27[dir::B] + - constant::c2o1 * (f27[dir::NE] + f27[dir::SW] + f27[dir::SE] + f27[dir::NW] + f27[dir::TE] + - f27[dir::BW] + f27[dir::BE] + f27[dir::TW] + f27[dir::TN] + f27[dir::BS] + - f27[dir::BN] + f27[dir::TS]) + - constant::c3o1 * (f27[dir::TNE] + f27[dir::TSW] + f27[dir::TSE] + f27[dir::TNW] + - f27[dir::BNE] + f27[dir::BSW] + f27[dir::BSE] + f27[dir::BNW]) - + return (f27[dir::DIR_P00] + f27[dir::DIR_M00] + f27[dir::DIR_0P0] + f27[dir::DIR_0M0] + f27[dir::DIR_00P] + f27[dir::DIR_00M] + + constant::c2o1 * (f27[dir::DIR_PP0] + f27[dir::DIR_MM0] + f27[dir::DIR_PM0] + f27[dir::DIR_MP0] + f27[dir::DIR_P0P] + + f27[dir::DIR_M0M] + f27[dir::DIR_P0M] + f27[dir::DIR_M0P] + f27[dir::DIR_0PP] + f27[dir::DIR_0MM] + + f27[dir::DIR_0PM] + f27[dir::DIR_0MP]) + + constant::c3o1 * (f27[dir::DIR_PPP] + f27[dir::DIR_MMP] + f27[dir::DIR_PMP] + f27[dir::DIR_MPP] + + f27[dir::DIR_PPM] + f27[dir::DIR_MMM] + f27[dir::DIR_PMM] + f27[dir::DIR_MPM]) - rho - (vx * vx + vy * vy + vz * vz) * (constant::c1o1 + rho)) * constant::c1o2 + rho; // times zero for incompressible case // Attention: op defined directly to op = 1 ; ^^^^(1.0/op-0.5)=0.5 diff --git a/src/lbm/MacroscopicQuantitiesTests.cpp b/src/lbm/MacroscopicQuantitiesTests.cpp index 52f89943a3e6a99fcab13eba22de9959229a289d..382ec180e7a97749c4a005734a61f96ec7a146d5 100644 --- a/src/lbm/MacroscopicQuantitiesTests.cpp +++ b/src/lbm/MacroscopicQuantitiesTests.cpp @@ -34,7 +34,7 @@ TEST(MacroscopicQuantitiesTest, whenFsAreEqual_velocityInEachDirectionShouldBeZe TEST(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Eis2_velocityInX1ShouldBeOne) { - f[dir::E] = 2.; + f[dir::DIR_P00] = 2.; const double velocityX1 = getIncompressibleVelocityX1(f); const double velocityX2 = getIncompressibleVelocityX2(f); @@ -51,7 +51,7 @@ TEST(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Eis2_velocityInX1ShouldBeO TEST(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Nis2_velocityInX2ShouldBeOne) { - f[dir::N] = 2.; + f[dir::DIR_0P0] = 2.; const double velocity = getIncompressibleVelocityX2(f); @@ -62,7 +62,7 @@ TEST(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Nis2_velocityInX2ShouldBeO TEST(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Tis2_velocityInX3ShouldBeOne) { - f[dir::T] = 2.; + f[dir::DIR_00P] = 2.; const double velocity = getIncompressibleVelocityX3(f); diff --git a/src/lbm/constants/D3Q27.h b/src/lbm/constants/D3Q27.h index 418038c35e9e5f0ae423f87a4d4a468888a2f274..b9c9d34f7004d1be2f90b6115f005fb2c8d0cbac 100644 --- a/src/lbm/constants/D3Q27.h +++ b/src/lbm/constants/D3Q27.h @@ -1,69 +1,16 @@ #ifndef LBM_D3Q27_H #define LBM_D3Q27_H -namespace vf -{ -namespace lbm -{ -namespace dir +#include <map> +#include "basics/Core/DataTypes.h" + +namespace vf::lbm::dir { -static constexpr int E = 0; -static constexpr int W = 1; -static constexpr int N = 2; -static constexpr int S = 3; -static constexpr int T = 4; -static constexpr int B = 5; -static constexpr int NE = 6; -static constexpr int SW = 7; -static constexpr int SE = 8; -static constexpr int NW = 9; -static constexpr int TE = 10; -static constexpr int BW = 11; -static constexpr int BE = 12; -static constexpr int TW = 13; -static constexpr int TN = 14; -static constexpr int BS = 15; -static constexpr int BN = 16; -static constexpr int TS = 17; -static constexpr int TNE = 18; -static constexpr int TNW = 19; -static constexpr int TSE = 20; -static constexpr int TSW = 21; -static constexpr int BNE = 22; -static constexpr int BNW = 23; -static constexpr int BSE = 24; -static constexpr int BSW = 25; -static constexpr int REST = 26; - -static constexpr int PZZ = 0; -static constexpr int MZZ = 1; -static constexpr int ZPZ = 2; -static constexpr int ZMZ = 3; -static constexpr int ZZP = 4; -static constexpr int ZZM = 5; -static constexpr int PPZ = 6; -static constexpr int MMZ = 7; -static constexpr int PMZ = 8; -static constexpr int MPZ = 9; -static constexpr int PZP = 10; -static constexpr int MZM = 11; -static constexpr int PZM = 12; -static constexpr int MZP = 13; -static constexpr int ZPP = 14; -static constexpr int ZMM = 15; -static constexpr int ZPM = 16; -static constexpr int ZMP = 17; -static constexpr int PPP = 18; -static constexpr int MPP = 19; -static constexpr int PMP = 20; -static constexpr int MMP = 21; -static constexpr int PPM = 22; -static constexpr int MPM = 23; -static constexpr int PMM = 24; -static constexpr int MMM = 25; -static constexpr int ZZZ = 26; +static constexpr int STARTDIR = 0; +static constexpr int ENDDIR = 26; +// used in the CPU and the GPU version static constexpr int DIR_000 = 0; static constexpr int DIR_P00 = 1; static constexpr int DIR_M00 = 2; @@ -146,8 +93,131 @@ static constexpr int SGD_MPM = 23; static constexpr int SGD_PMM = 24; static constexpr int SGD_MMM = 25; -} -} -} +struct countersForPointerChasing{ + uint counterInverse; + uint counterX; + uint counterY; + uint counterZ; +}; + +const std::map<const int, const countersForPointerChasing> mapForPointerChasing = +{ + {DIR_000, countersForPointerChasing{0, 0, 0, 0}}, + {DIR_P00, countersForPointerChasing{0, 1, 0, 0}}, + {DIR_M00, countersForPointerChasing{1, 0, 1, 1}}, + {DIR_0P0, countersForPointerChasing{0, 0, 1, 0}}, + {DIR_0M0, countersForPointerChasing{1, 1, 0, 1}}, + {DIR_00P, countersForPointerChasing{0, 0, 0, 1}}, + {DIR_00M, countersForPointerChasing{1, 1, 1, 0}}, + {DIR_PP0, countersForPointerChasing{0, 1, 1, 0}}, + {DIR_MM0, countersForPointerChasing{1, 0, 0, 1}}, + {DIR_PM0, countersForPointerChasing{1, 2, 0, 1}}, + {DIR_MP0, countersForPointerChasing{1, 0, 2, 1}}, + {DIR_P0P, countersForPointerChasing{0, 1, 0, 1}}, + {DIR_M0M, countersForPointerChasing{1, 0, 1, 0}}, + {DIR_P0M, countersForPointerChasing{1, 2, 1, 0}}, + {DIR_M0P, countersForPointerChasing{1, 0, 1, 2}}, + {DIR_0PP, countersForPointerChasing{0, 0, 1, 1}}, + {DIR_0MM, countersForPointerChasing{1, 1, 0, 0}}, + {DIR_0PM, countersForPointerChasing{1, 1, 2, 0}}, + {DIR_0MP, countersForPointerChasing{1, 1, 0, 2}}, + + {DIR_PPP, countersForPointerChasing{0, 1, 1, 1}}, + {DIR_MPP, countersForPointerChasing{1, 0, 2, 2}}, + {DIR_PMP, countersForPointerChasing{1, 2, 0, 2}}, + {DIR_MMP, countersForPointerChasing{1, 0, 0, 2}}, + {DIR_PPM, countersForPointerChasing{1, 2, 2, 0}}, + {DIR_MPM, countersForPointerChasing{1, 0, 2, 0}}, + {DIR_PMM, countersForPointerChasing{1, 2, 0, 0}}, + {DIR_MMM, countersForPointerChasing{1, 0, 0, 0}} +}; + + + +// used in the CPU version +// static constexpr int INV_P00 = DIR_M00; +// static constexpr int INV_M00 = DIR_P00; +// static constexpr int INV_0P0 = DIR_0M0; +// static constexpr int INV_0M0 = DIR_0P0; +// static constexpr int INV_00P = DIR_00M; +// static constexpr int INV_00M = DIR_00P; +// static constexpr int INV_PP0 = DIR_MM0; +// static constexpr int INV_MM0 = DIR_PP0; +// static constexpr int INV_PM0 = DIR_MP0; +// static constexpr int INV_MP0 = DIR_PM0; +// static constexpr int INV_P0P = DIR_M0M; +// static constexpr int INV_M0M = DIR_P0P; +// static constexpr int INV_P0M = DIR_M0P; +// static constexpr int INV_M0P = DIR_P0M; +// static constexpr int INV_0PP = DIR_0MM; +// static constexpr int INV_0MM = DIR_0PP; +// static constexpr int INV_0PM = DIR_0MP; +// static constexpr int INV_0MP = DIR_0PM; +// static constexpr int INV_PPP = DIR_MMM; +// static constexpr int INV_MPP = DIR_PMM; +// static constexpr int INV_PMP = DIR_MPM; +// static constexpr int INV_MMP = DIR_PPM; +// static constexpr int INV_PPM = DIR_MMP; +// static constexpr int INV_MPM = DIR_PMP; +// static constexpr int INV_PMM = DIR_MPP; +// static constexpr int INV_MMM = DIR_PPP; + +// static constexpr int SGD_P00 = 0; +// static constexpr int SGD_M00 = 1; +// static constexpr int SGD_0P0 = 2; +// static constexpr int SGD_0M0 = 3; +// static constexpr int SGD_00P = 4; +// static constexpr int SGD_00M = 5; +// static constexpr int SGD_PP0 = 6; +// static constexpr int SGD_MM0 = 7; +// static constexpr int SGD_PM0 = 8; +// static constexpr int SGD_MP0 = 9; +// static constexpr int SGD_P0P = 10; +// static constexpr int SGD_M0M = 11; +// static constexpr int SGD_P0M = 12; +// static constexpr int SGD_M0P = 13; +// static constexpr int SGD_0PP = 14; +// static constexpr int SGD_0MM = 15; +// static constexpr int SGD_0PM = 16; +// static constexpr int SGD_0MP = 17; +// static constexpr int SGD_PPP = 18; +// static constexpr int SGD_MPP = 19; +// static constexpr int SGD_PMP = 20; +// static constexpr int SGD_MMP = 21; +// static constexpr int SGD_PPM = 22; +// static constexpr int SGD_MPM = 23; +// static constexpr int SGD_PMM = 24; +// static constexpr int SGD_MMM = 25; + + +// DEPRECATED +static constexpr int ZZZ = DIR_000; +static constexpr int PZZ = DIR_P00; +static constexpr int MZZ = DIR_M00; +static constexpr int ZPZ = DIR_0P0; +static constexpr int ZMZ = DIR_0M0; +static constexpr int ZZP = DIR_00P; +static constexpr int ZZM = DIR_00M; +static constexpr int PPZ = DIR_PP0; +static constexpr int MMZ = DIR_MM0; +static constexpr int PMZ = DIR_PM0; +static constexpr int MPZ = DIR_MP0; +static constexpr int PZP = DIR_P0P; +static constexpr int MZM = DIR_M0M; +static constexpr int PZM = DIR_P0M; +static constexpr int MZP = DIR_M0P; +static constexpr int ZPP = DIR_0PP; +static constexpr int ZMM = DIR_0MM; +static constexpr int ZPM = DIR_0PM; +static constexpr int ZMP = DIR_0MP; +static constexpr int PPP = DIR_PPP; +static constexpr int MPP = DIR_MPP; +static constexpr int PMP = DIR_PMP; +static constexpr int MMP = DIR_MMP; +static constexpr int PPM = DIR_PPM; +static constexpr int MPM = DIR_MPM; +static constexpr int PMM = DIR_PMM; +static constexpr int MMM = DIR_MMM; +} #endif diff --git a/src/lbm/constants/NumericConstants.h b/src/lbm/constants/NumericConstants.h index 5c7556ceb4ccb711e2d2b6777e03a52e35fc1f19..4918d49aaa0431de639ea8ba3320c4fa45e539d4 100644 --- a/src/lbm/constants/NumericConstants.h +++ b/src/lbm/constants/NumericConstants.h @@ -2,11 +2,7 @@ #define REAL_CONSTANT_H -namespace vf -{ -namespace lbm -{ -namespace constant +namespace vf::lbm::constant { #ifdef VF_DOUBLE_ACCURACY @@ -119,6 +115,7 @@ static constexpr double c10eM10 = 1e-10; static constexpr double smallSingle = 0.0000000002; static constexpr double cPi = 3.1415926535; +static constexpr double c2Pi = 6.28318530717; static constexpr double cPio180 = 1.74532925199e-2; static constexpr double c180oPi = 57.2957795131; @@ -232,13 +229,12 @@ static constexpr float c10eM10 = 1e-10f; static constexpr float smallSingle = 0.0000000002f; static constexpr float cPi = 3.1415926535f; +static constexpr double c2Pi = 6.2831853071f; static constexpr float cPio180 = 1.74532925199e-2f; static constexpr float c180oPi = 57.2957795131f; #endif -} -} } #endif diff --git a/src/lbm/cuda/CMakeLists.txt b/src/lbm/cuda/CMakeLists.txt index 3a88d91648b960915279fc4f133f6b60047149bf..4142b7c3b1c46275c3257e3dfd657cc6b30c841d 100644 --- a/src/lbm/cuda/CMakeLists.txt +++ b/src/lbm/cuda/CMakeLists.txt @@ -4,7 +4,7 @@ project(lbmCuda LANGUAGES CUDA CXX) vf_add_library(NAME lbmCuda BUILDTYPE static PUBLIC_LINK basics FOLDER ../../lbm) -set_target_properties(lbmCuda PROPERTIES CUDA_SEPARABLE_COMPILATION ON) +set_target_properties(lbmCuda PROPERTIES CUDA_SEPARABLE_COMPILATION ON POSITION_INDEPENDENT_CODE ON) set_source_files_properties(../KernelParameter.cpp PROPERTIES LANGUAGE CUDA) diff --git a/src/mpi/NullCommunicator.cpp b/src/mpi/NullCommunicator.cpp index 0f407d0dccab79b551e8671bcaa150f6aab36789..267942895df0afbfae7e2d528feb67ff7a2c6519 100644 --- a/src/mpi/NullCommunicator.cpp +++ b/src/mpi/NullCommunicator.cpp @@ -33,43 +33,65 @@ #include "NullCommunicator.h" -namespace vf::mpi +namespace vf::mpi { -// std::shared_ptr<Communicator> NullCommunicator::getInstance() -// { -// std::lock_guard<std::mutex> myLock(instantiation_mutex); -// if (!instance){ -// instance = std::shared_ptr<NullCommunicator>(new NullCommunicator); -// } -// return instance; -// } -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getBundleID() { return 0; } -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getNumberOfBundles() { return 0; } -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getProcessID() { return 0; } -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getNumberOfProcesses() { return 0; } -////////////////////////////////////////////////////////////////////////// -void *NullCommunicator::getNativeCommunicator() { return NULL; } -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getRoot() { return 0; } -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getBundleRoot() { return 0; } -////////////////////////////////////////////////////////////////////////// -int NullCommunicator::getProcessRoot() { return 0; } -////////////////////////////////////////////////////////////////////////// -std::vector<std::string> NullCommunicator::gather(const std::string & /*str*/) { return std::vector<std::string>(); } -////////////////////////////////////////////////////////////////////////// -std::vector<double> NullCommunicator::gatherDoubles(std::vector<double> & /*values*/) { return std::vector<double>(); } -////////////////////////////////////////////////////////////////////////// -void NullCommunicator::allGatherInts(std::vector<int> &svalues, std::vector<int> &rvalues) {} -////////////////////////////////////////////////////////////////////////// -void NullCommunicator::sendSerializedObject(std::stringstream &ss, int target) {} -////////////////////////////////////////////////////////////////////////// -void NullCommunicator::receiveSerializedObject(std::stringstream &ss, int source) {} + std::shared_ptr<Communicator> NullCommunicator::getInstance() + { + std::lock_guard<std::mutex> myLock(instantiation_mutex); + if (!instance){ + instance = std::shared_ptr<NullCommunicator>(new NullCommunicator); + } + return instance; + } + ////////////////////////////////////////////////////////////////////////// + int NullCommunicator::getBundleID() { return 0; } + ////////////////////////////////////////////////////////////////////////// + int NullCommunicator::getNumberOfBundles() { return 0; } + ////////////////////////////////////////////////////////////////////////// + int NullCommunicator::getProcessID() { return 0; } + ////////////////////////////////////////////////////////////////////////// + int NullCommunicator::getNumberOfProcesses() { return 0; } + ////////////////////////////////////////////////////////////////////////// + void *NullCommunicator::getNativeCommunicator() { return NULL; } + ////////////////////////////////////////////////////////////////////////// + int NullCommunicator::getRoot() { return 0; } + ////////////////////////////////////////////////////////////////////////// + int NullCommunicator::getBundleRoot() { return 0; } + ////////////////////////////////////////////////////////////////////////// + int NullCommunicator::getProcessRoot() { return 0; } + ////////////////////////////////////////////////////////////////////////// + std::vector<std::string> NullCommunicator::gather(const std::string & /*str*/) { return std::vector<std::string>(); } + ////////////////////////////////////////////////////////////////////////// + void NullCommunicator::sendSerializedObject(std::stringstream &ss, int target) {} + ////////////////////////////////////////////////////////////////////////// + void NullCommunicator::receiveSerializedObject(std::stringstream &ss, int source) {} + int NullCommunicator::getProcessID(int bundle, int rank) { return 0; } + bool NullCommunicator::isRoot() {return true; } + + int NullCommunicator::getNumberOfProcessesInBundle(int bundle) {return 0;} + void NullCommunicator::barrier() {} + void NullCommunicator::abort(int errorcode) {} + + + std::vector<int> NullCommunicator::gather(std::vector<int> &values){ return std::vector<int>(); } + std::vector<float> NullCommunicator::gather(std::vector<float> &values){ return std::vector<float>(); } + std::vector<double> NullCommunicator::gather(std::vector<double> &values){ return std::vector<double>(); } + std::vector<unsigned long long> NullCommunicator::gather(std::vector<unsigned long long> &values){ return std::vector<unsigned long long>(); } + + void NullCommunicator::allGather(std::vector<int> &svalues, std::vector<int> &rvalues){ } + void NullCommunicator::allGather(std::vector<float> &svalues, std::vector<float> &rvalues){ } + void NullCommunicator::allGather(std::vector<double> &svalues, std::vector<double> &rvalues){ } + void NullCommunicator::allGather(std::vector<unsigned long long> &svalues, std::vector<unsigned long long> &rvalues){ } + + void NullCommunicator::broadcast(int &value){ } + void NullCommunicator::broadcast(float &value){ } + void NullCommunicator::broadcast(double &value){ } + void NullCommunicator::broadcast(long int &value){ } + void NullCommunicator::broadcast(std::vector<int> &values){ } + void NullCommunicator::broadcast(std::vector<float> &values){ } + void NullCommunicator::broadcast(std::vector<double> &values){ } + void NullCommunicator::broadcast(std::vector<long int> &values){ } } diff --git a/src/mpi/NullCommunicator.h b/src/mpi/NullCommunicator.h index 1a3ba3eac5c840d8e6e6c474d7dec9dfe6be6750..836f801ab6d15e377da8a34dfed8016b05f86e3a 100644 --- a/src/mpi/NullCommunicator.h +++ b/src/mpi/NullCommunicator.h @@ -36,7 +36,7 @@ #include "Communicator.h" -namespace vf::mpi +namespace vf::mpi { //! \brief A class implements Communicator for shared memory. @@ -44,22 +44,45 @@ namespace vf::mpi class NullCommunicator : public Communicator { public: - // static std::shared_ptr<Communicator> getInstance(); - int getBundleID() override; - int getNumberOfBundles() override; - int getProcessID() override; - int getNumberOfProcesses() override; - void *getNativeCommunicator() override; - int getRoot() override; - int getBundleRoot() override; - int getProcessRoot() override; - std::vector<std::string> gather(const std::string &str) override; - std::vector<double> gatherDoubles(std::vector<double> &values); - void allGatherInts(std::vector<int> &svalues, std::vector<int> &rvalues); - void sendSerializedObject(std::stringstream &ss, int target) override; - void receiveSerializedObject(std::stringstream &ss, int source) override; + static std::shared_ptr<Communicator> getInstance(); - + int getBundleID(); + int getNumberOfBundles(); + int getProcessID(); + int getProcessID(int bundle, int rank); + int getNumberOfProcesses(); + bool isRoot(); + void *getNativeCommunicator(); + + void sendSerializedObject(std::stringstream &ss, int target); + void receiveSerializedObject(std::stringstream &ss, int source); + + int getRoot(); + int getBundleRoot(); + int getProcessRoot(); + int getNumberOfProcessesInBundle(int bundle); + void barrier(); + void abort(int errorcode); + + std::vector<std::string> gather(const std::string &str); + std::vector<int> gather(std::vector<int> &values); + std::vector<float> gather(std::vector<float> &values); + std::vector<double> gather(std::vector<double> &values); + std::vector<unsigned long long> gather(std::vector<unsigned long long> &values); + + void allGather(std::vector<int> &svalues, std::vector<int> &rvalues); + void allGather(std::vector<float> &svalues, std::vector<float> &rvalues); + void allGather(std::vector<double> &svalues, std::vector<double> &rvalues); + void allGather(std::vector<unsigned long long> &svalues, std::vector<unsigned long long> &rvalues); + + void broadcast(int &value); + void broadcast(float &value); + void broadcast(double &value); + void broadcast(long int &value); + void broadcast(std::vector<int> &values); + void broadcast(std::vector<float> &values); + void broadcast(std::vector<double> &values); + void broadcast(std::vector<long int> &values); }; }